/* Light full-screen viewer. Small pills only — no full-screen blur. */
:root {
  --bg: #050505;
  --fg: #ededed;
  --red: #c23a3a;
  --red-ink: #8b1e1e;
  --cream: #f4f0e6;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

.vh {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

html, body {
  height: 100%;
  min-height: 100dvh;
  background: #050505;
  color: var(--fg);
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  overflow: hidden;
  touch-action: none;
  overscroll-behavior: none;
}

#full-screen-viewer {
  position: relative;
  width: 100vw;
  height: 100dvh;
  background: #050505;
}

#viewer-canvas {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  background: #050505;
  outline: none;
  touch-action: none;
  z-index: 0;
  opacity: 0;
  pointer-events: none;
}

body.is-ready #viewer-canvas {
  opacity: 1;
  pointer-events: auto;
}

.back,
.chip,
.immerse,
.badge,
.legend,
.boot {
  font-size: 0.75rem;
}

.back {
  position: fixed;
  top: 1rem;
  left: 1rem;
  z-index: 5;
  padding: 0.4rem 0.8rem;
  border-radius: 0.5rem;
  color: var(--fg);
  text-decoration: none;
  background: rgba(10, 10, 10, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.back:hover { background: rgba(255, 255, 255, 0.08); }

.hud {
  position: fixed;
  bottom: 1.5rem;
  left: 1.5rem;
  z-index: 5;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.45rem;
}

.chip,
.immerse {
  background: rgba(10, 10, 10, 0.85);
  border: 1px solid rgba(194, 58, 58, 0.4);
  color: var(--cream);
  cursor: pointer;
  font: inherit;
}

.chip {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: 10px;
  font-weight: 700;
  font-family: ui-monospace, Menlo, monospace;
}

.chip::before {
  content: "";
  width: 0.35rem;
  height: 0.35rem;
  border-radius: 99px;
  background: var(--red);
}

.chip-hand { display: none; }

.view-bar {
  display: none;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.35rem;
  max-width: 16rem;
}

.view-bar button {
  appearance: none;
  margin: 0;
  padding: 0.32rem 0.6rem;
  border-radius: 999px;
  border: 1px solid rgba(194, 58, 58, 0.4);
  background: rgba(10, 10, 10, 0.85);
  color: var(--cream);
  cursor: pointer;
  font: inherit;
  font-size: 10px;
  font-weight: 700;
  font-family: ui-monospace, Menlo, monospace;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.chip.is-on,
.view-bar button.is-on {
  background: var(--red);
  border-color: var(--red);
  color: #050505;
}

.chip.is-on::before {
  background: #050505;
}

.legend--hand { display: none; }

.legend {
  margin-top: 0.5rem;
  min-width: 13rem;
  padding: 0.7rem 0.85rem;
  border-radius: 0.75rem;
  background: rgba(10, 10, 10, 0.9);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.legend p {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  font-size: 0.7rem;
  color: #a1a1aa;
  margin-top: 0.35rem;
}

.legend kbd {
  font-family: ui-monospace, Menlo, monospace;
  color: #e4e4e7;
  font-size: 10px;
}

.immerse {
  position: fixed;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  padding: 0.4rem 1.15rem 0.4rem 0.4rem;
  border-radius: 999px;
  background: transparent;
  border: 1px solid var(--red);
  color: var(--cream);
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.immerse:hover {
  border-color: var(--cream);
  background: transparent;
}

.immerse i {
  width: 1.7rem;
  height: 1.7rem;
  border-radius: 99px;
  background: transparent;
  border: 1px solid var(--red);
  flex-shrink: 0;
}

.immerse i::after {
  content: "";
  display: block;
  width: 0;
  height: 0;
  margin: 0.48rem 0 0 0.58rem;
  border-style: solid;
  border-width: 0.32rem 0 0.32rem 0.5rem;
  border-color: transparent transparent transparent var(--cream);
}

.badge {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  background: rgba(10, 10, 10, 0.85);
  border: 1px solid rgba(194, 58, 58, 0.35);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  font-family: ui-monospace, Menlo, monospace;
  color: var(--cream);
}

.badge i {
  width: 0.35rem;
  height: 0.35rem;
  border-radius: 99px;
  background: var(--red);
}

body.is-playing .back,
body.is-playing .immerse,
body.is-playing .hud,
body.is-playing .badge { display: none; }

.tour-line {
  position: fixed;
  left: 50%;
  bottom: 2.35rem;
  transform: translateX(-50%);
  z-index: 6;
  max-width: min(36rem, calc(100vw - 2rem));
  text-align: center;
  pointer-events: none;
}

.tour-kicker {
  display: block;
  font-size: 10px;
  font-weight: 700;
  font-family: ui-monospace, Menlo, monospace;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: #a1a1aa;
  margin-bottom: 0.4rem;
}

.tour-caption {
  display: block;
  font-size: clamp(1.05rem, 2.5vw, 1.5rem);
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--cream);
  line-height: 1.25;
}

.tour-hint {
  position: fixed;
  left: 50%;
  bottom: 1.15rem;
  transform: translateX(-50%);
  z-index: 6;
  font-size: 10px;
  font-family: ui-monospace, Menlo, monospace;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #71717a;
  pointer-events: none;
}

.tour-rail {
  position: fixed;
  left: 18%;
  right: 18%;
  bottom: 0.45rem;
  z-index: 6;
  height: 3px;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.12);
  cursor: pointer;
}

.tour-rail i {
  display: block;
  height: 100%;
  width: 0%;
  border-radius: 99px;
  background: var(--red);
  pointer-events: none;
}

.boot {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100dvh;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.85rem;
  background: #050505;
  transform: translateZ(0);
  font-family: ui-monospace, Menlo, monospace;
  letter-spacing: 0.06em;
}

.boot.is-gone { display: none; }

.spin {
  width: 2.4rem;
  height: 2.4rem;
  border: 3px solid #1a1a1a;
  border-top-color: var(--red);
  border-radius: 99px;
  animation: spin 0.8s linear infinite;
}

.boot p { color: #a3a3a3; font-size: 0.8rem; }

.boot .err { color: #fca5a5; padding: 2rem; text-align: center; }

@keyframes spin { to { transform: rotate(360deg); } }

@media (prefers-reduced-motion: reduce) {
  .spin { animation: none; }
}

@media (max-width: 860px), (pointer: coarse) {
  .badge { display: none; }
  .chip-desk,
  .legend--desk { display: none !important; }
  .legend--hand:not([hidden]) { display: block; }
  .view-bar {
    display: flex;
    flex-wrap: wrap;
    max-width: none;
    justify-content: flex-end;
  }
  .back {
    top: 0.65rem;
    left: 0.65rem;
  }
  .hud {
    top: 0.65rem;
    left: 4.4rem;
    right: 0.65rem;
    bottom: auto;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    gap: 0.3rem;
  }
  .legend {
    position: absolute;
    top: calc(100% + 0.35rem);
    right: 0;
    margin-top: 0;
    z-index: 6;
  }
}

@media (max-width: 720px) {
  .tour-line {
    bottom: 3.6rem;
  }

  .tour-hint {
    display: none;
  }

  .tour-rail {
    left: 8%;
    right: 8%;
    bottom: 0.7rem;
  }

  .immerse {
    bottom: 1.5rem;
    width: calc(100% - 2rem);
    left: 1rem;
    transform: none;
    justify-content: center;
    background: rgba(10, 10, 10, 0.85);
  }
  
  .tour-text {
    display: none;
  }
}
