@font-face {
  font-family: "Chakra Petch";
  src: url("/fonts/ChakraPetch-600.woff2") format("woff2");
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Chakra Petch";
  src: url("/fonts/ChakraPetch-700.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Oxanium";
  src: url("/fonts/Oxanium-600.woff2") format("woff2");
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Oxanium";
  src: url("/fonts/Oxanium-700.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Inter";
  src: url("/fonts/Inter-400.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Inter";
  src: url("/fonts/Inter-600.woff2") format("woff2");
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}

:root {
  --bg: #07080d;
  --surface: rgba(17, 21, 32, 0.92);
  --surface-solid: #111520;
  --panel: #0e111a;
  --text: #f4f6fb;
  --text-soft: #d5dbe8;
  --muted: #9aa3b8;
  --line: #232a3a;
  --action: #d4f500;
  --action-ink: #07080d;
  --mint: #d4f500;
  --cyan: #00a6e8;
  --magenta: #d6009e;
  --paper: #f4ecd8;
  --paper-ink: #1c140c;
  --stamp: #d7263d;
  --bad: #ff4d5a;
  --good: #b6f25a;
  color-scheme: dark;
}

* { box-sizing: border-box; }

html, body { margin: 0; min-height: 100%; }

body {
  font-family: Inter, "Segoe UI", sans-serif;
  color: var(--text);
  background-color: var(--bg);
  background-image:
    linear-gradient(rgba(212, 245, 0, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(212, 245, 0, 0.035) 1px, transparent 1px),
    radial-gradient(980px 460px at 8% -12%, rgba(0, 166, 232, 0.16), transparent 58%);
  background-size: 36px 36px, 36px 36px, auto;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background: repeating-linear-gradient(
    to bottom,
    transparent 0,
    transparent 3px,
    rgba(212, 245, 0, 0.02) 3px,
    rgba(212, 245, 0, 0.02) 4px
  );
}

#app { position: relative; z-index: 1; }

body.shake { animation: shake 0.4s linear; }

@keyframes shake {
  20% { transform: translateX(-6px); }
  40% { transform: translateX(5px); }
  60% { transform: translateX(-3px); }
  80% { transform: translateX(2px); }
}

button, input { font: inherit; }

h1, h2, .room-code, .clock, .brand, .stamp, .award strong, .role-banner strong {
  font-family: "Chakra Petch", Oxanium, Inter, sans-serif;
}

.pad button, button, .dial, .readout span, .code-input, .map th, .map td.say, .stat b {
  font-family: Oxanium, "Chakra Petch", Inter, sans-serif;
}

button {
  font-weight: 700;
  border: 1px solid rgba(7, 20, 13, 0.4);
  background: var(--action);
  color: var(--action-ink);
  border-radius: 8px;
  padding: 0.8rem 1.05rem;
  box-shadow: none;
  cursor: pointer;
  touch-action: manipulation;
}

button:hover { filter: brightness(1.06); }

button:active { transform: translateY(1px); }

button:focus-visible, input:focus-visible {
  outline: 2px solid var(--mint);
  outline-offset: 3px;
}

button.secondary {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--line);
}

button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

input {
  width: 100%;
  font-size: 1.15rem;
  padding: 0.85rem 0.9rem;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: rgba(25, 26, 28, 0.92);
  color: var(--text);
}

.wrap {
  width: min(1120px, calc(100% - 1.5rem));
  margin: 0 auto;
  padding: max(0.75rem, env(safe-area-inset-top)) 0 max(1.5rem, env(safe-area-inset-bottom));
}

.gate {
  width: min(720px, calc(100% - 1.5rem));
  margin: 4vh auto 3rem;
}

.kicker, .eyebrow {
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--action);
  margin: 0;
}

h1 {
  font-size: clamp(3.2rem, 10vw, 6.4rem);
  line-height: 0.86;
  letter-spacing: -0.045em;
  margin: 0.15rem 0 0.4rem;
  font-weight: 700;
}

.deck, .note, .ask {
  font-size: 1.2rem;
  line-height: 1.35;
  color: var(--text-soft);
}

.howto {
  display: grid;
  gap: 0.45rem;
  padding: 0;
  margin: 1.2rem 0 0;
  list-style: none;
  counter-reset: step;
}

.howto li {
  counter-increment: step;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 0.75rem 0.9rem 0.75rem 3.2rem;
  position: relative;
  font-size: 1.08rem;
  backdrop-filter: blur(10px);
}

.howto li::before {
  content: counter(step);
  position: absolute;
  left: 0.7rem;
  top: 0.65rem;
  width: 1.8rem;
  height: 1.8rem;
  border-radius: 999px;
  background: var(--action);
  color: var(--action-ink);
  display: grid;
  place-items: center;
  font-family: Oxanium, Inter, sans-serif;
  font-weight: 700;
}

.stack { display: grid; gap: 0.7rem; margin-top: 1rem; }
.row { display: flex; gap: 0.6rem; }
.row > * { flex: 1; }
.code-input { text-transform: uppercase; letter-spacing: 0.18em; font-weight: 700; }

.toast {
  background: rgba(42, 14, 18, 0.88);
  color: #ffd5da;
  border: 1px solid var(--stamp);
  border-radius: 14px;
  padding: 0.75rem 0.9rem;
  margin: 0.8rem 0 0;
}

.topbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.8rem 1.2rem;
  position: sticky;
  top: 0;
  z-index: 4;
  background: rgba(7, 8, 13, 0.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
  padding: 0.55rem 0 0.7rem;
  margin-bottom: 0.8rem;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.mark { width: 42px; height: 42px; }

.clock {
  font-size: clamp(2.6rem, 6vw, 4.4rem);
  font-weight: 700;
  letter-spacing: -0.05em;
  line-height: 0.85;
  margin-left: auto;
}

.clock.urgent { color: var(--bad); }
.clock.round-label {
  font-size: 1.35rem;
  letter-spacing: 0;
  margin-left: auto;
}

.strikes { display: flex; align-items: center; gap: 0.35rem; font-weight: 700; }
.pip {
  width: 1rem;
  height: 1rem;
  border-radius: 999px;
  border: 2px solid var(--text);
  display: inline-block;
}
.pip.on { background: var(--bad); border-color: var(--bad); }

.chips { display: flex; flex-wrap: wrap; gap: 0.45rem; width: 100%; align-items: center; }
.chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 999px;
  padding: 0.18rem 0.45rem 0.18rem 0.6rem;
  font-size: 0.92rem;
}
.chip-x {
  min-width: 44px;
  min-height: 44px;
  border-radius: 999px;
  padding: 0 0.7rem;
  font-size: 1.45rem;
  line-height: 1;
}
.chip-x.armed {
  font-size: 0.95rem;
  background: var(--bad, #ff4d5a);
  color: #fff;
  border-color: var(--bad, #ff4d5a);
}
.chip.you { border-color: var(--action); }
.chip.away { opacity: 0.5; }
.chip b { font-weight: 700; }

.room-code {
  font-size: clamp(4rem, 14vw, 7.5rem);
  letter-spacing: 0.12em;
  line-height: 0.85;
  margin: 0.1rem 0 0.4rem;
  font-weight: 700;
}

.people { list-style: none; padding: 0; margin: 0.6rem 0 1rem; display: grid; gap: 0.5rem; }
.people li {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 0.8rem 0.95rem;
  font-size: 1.25rem;
  backdrop-filter: blur(10px);
}
.people .meta { color: var(--action); font-size: 0.95rem; text-align: right; }
.people li.away { opacity: 0.55; }

.stage-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(250px, 0.7fr);
  gap: 1rem;
  align-items: start;
}

.manual, .device, .relay-card, .wait-card, .aside, .poster, .panel-card {
  border: 1px solid var(--line);
  box-shadow: none;
}

.manual {
  background: var(--paper);
  color: var(--paper-ink);
  padding: 1.15rem 1.2rem 1.3rem;
  border-radius: 14px;
  border-color: rgba(243, 234, 214, 0.7);
}

.stamp {
  display: inline-block;
  border: 3px solid var(--stamp);
  color: var(--stamp);
  font-weight: 700;
  letter-spacing: 0.16em;
  padding: 0.15rem 0.45rem;
  transform: rotate(-6deg);
  transform-origin: left center;
  margin: 0.15rem 0 0.9rem;
  background: transparent;
}

.manual h2 {
  font-size: clamp(2rem, 4vw, 3.2rem);
  line-height: 0.95;
  margin: 0.4rem 0;
  letter-spacing: -0.04em;
  font-weight: 700;
}

.contact {
  font-size: 1.2rem;
  font-weight: 700;
  margin: 0 0 0.6rem;
}

.rules { margin: 0; padding: 0; list-style: none; display: grid; gap: 0.55rem; }
.rules li {
  font-family: Inter, "Segoe UI", sans-serif;
  font-size: clamp(1.28rem, 2.3vw, 1.85rem);
  line-height: 1.25;
  background: #fff8ec;
  border-left: 8px solid var(--paper-ink);
  padding: 0.55rem 0.7rem;
}

.ask { color: #5c4a38; margin-bottom: 0; }

.progress { list-style: none; padding: 0; margin: 0 0 0.8rem; display: grid; gap: 0.35rem; }
.progress li { display: flex; justify-content: space-between; gap: 0.5rem; font-size: 1.02rem; }
.progress .now { color: var(--action); font-weight: 700; }
.progress .done { opacity: 0.55; text-decoration: line-through; }

.aside, .relay-card, .wait-card, .panel-card {
  background: var(--surface);
  border-radius: 14px;
  padding: 0.9rem;
  backdrop-filter: blur(12px);
}

.device {
  width: min(760px, 100%);
  margin: 0 auto;
  background: var(--panel);
  border-radius: 14px;
  padding: 1rem 1rem 1.1rem;
  backdrop-filter: blur(12px);
}

.device h2 {
  font-size: clamp(2.2rem, 5vw, 3.4rem);
  margin: 0.1rem 0 0.2rem;
  letter-spacing: -0.04em;
  line-height: 0.95;
  font-weight: 700;
}

.turn {
  margin: 0 0 0.8rem;
  font-size: 1.15rem;
  font-weight: 700;
}
.turn.live { color: var(--action); }
.turn.wait { color: var(--muted); }

.readouts {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.65rem;
}

.readout {
  background: #111520;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 0.7rem;
  min-height: 9.2rem;
  display: grid;
  align-content: center;
  justify-items: center;
  text-align: center;
  gap: 0.25rem;
}

.readout span { font-size: 1.25rem; font-weight: 700; letter-spacing: 0.04em; }
.readout small {
  color: var(--muted);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: 0.78rem;
}

.bulb {
  width: 4.6rem;
  height: 4.6rem;
  border-radius: 999px;
  border: 3px solid rgba(244, 244, 245, 0.35);
  box-shadow: inset 0 -8px 0 rgba(0, 0, 0, 0.25);
}

.symbol { width: 4.8rem; height: 4.8rem; }
.symbol svg { width: 100%; height: 100%; }

.dial {
  width: 4.6rem;
  height: 4.6rem;
  border-radius: 999px;
  border: 6px solid var(--action);
  display: grid;
  place-items: center;
  font-size: 2.2rem;
  font-weight: 700;
}

.lights { display: flex; gap: 0.45rem; }
.lights i {
  width: 1.35rem;
  height: 1.35rem;
  border-radius: 999px;
  border: 3px solid #f4f4f5;
  display: block;
}
.lights i.on { background: #f4f4f5; }

.pad {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.7rem;
  margin-top: 0.8rem;
}

.pad button {
  min-height: 5rem;
  font-size: clamp(1.4rem, 3vw, 1.9rem);
  letter-spacing: 0.05em;
}

.pad button.dim {
  background: rgba(12, 16, 14, 0.9);
  color: var(--muted);
  border-color: var(--line);
}

.hint { min-height: 1.3rem; color: var(--action); margin: 0.45rem 0 0; }

.feed { list-style: none; padding: 0; margin: 0.4rem 0 0.7rem; display: grid; gap: 0.3rem; align-content: start; height: 9.5rem; overflow-y: auto; }
.feed li { font-size: 1.02rem; line-height: 1.3; }
.feed .bad { color: var(--bad); }
.feed .good { color: var(--good); }
.feed .chat b { color: var(--action); }

.phrases { display: flex; flex-wrap: wrap; gap: 0.4rem; padding-bottom: 0.2rem; }
.phrases button {
  flex: 0 0 auto;
  background: #111520;
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.55rem 0.75rem;
  font-size: 0.95rem;
  font-weight: 600;
}

.map {
  width: 100%;
  border-collapse: collapse;
  margin-top: 0.6rem;
  font-size: clamp(1.25rem, 3vw, 1.8rem);
}
.map th {
  text-align: left;
  font-size: 0.8rem;
  letter-spacing: 0.12em;
  color: var(--action);
  font-family: Oxanium, Inter, sans-serif;
}
.map td { padding: 0.45rem 0.2rem; border-top: 1px solid var(--line); font-weight: 700; }
.map td.say { color: var(--action); font-family: Oxanium, Inter, sans-serif; }

.relay-card h2, .wait-card h2 {
  margin: 0.2rem 0 0.4rem;
  font-size: clamp(2rem, 5vw, 3rem);
  letter-spacing: -0.04em;
  font-weight: 700;
}

.poster {
  background: var(--surface);
  color: var(--text);
  border-radius: 14px;
  padding: clamp(1rem, 3vw, 2rem);
  margin-top: 0.4rem;
  backdrop-filter: blur(12px);
}

.poster h1 {
  max-width: 12ch;
  font-size: clamp(3.1rem, 8vw, 6.3rem);
}

.subhead {
  font-size: clamp(1.2rem, 2.4vw, 1.6rem);
  line-height: 1.3;
  max-width: 38rem;
  color: var(--text-soft);
}

.stats {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin: 1rem 0;
}
.stat {
  background: rgba(12, 16, 14, 0.55);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 0.55rem 0.75rem;
  min-width: 6.5rem;
}
.stat b {
  display: block;
  font-size: 1.5rem;
  font-family: Oxanium, Inter, sans-serif;
}

.awards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}
.award {
  background: var(--mint);
  color: var(--action-ink);
  border: 1px solid rgba(7, 20, 13, 0.18);
  box-shadow: none;
  border-radius: 14px;
  padding: 0.85rem 0.95rem 1rem;
  min-height: 8.5rem;
}
.award.chaos {
  background: var(--magenta);
  color: #fff;
  border-color: #ff4fa8;
}
.award .label { letter-spacing: 0.14em; font-size: 0.82rem; font-weight: 700; }
.award strong {
  display: block;
  font-size: clamp(2rem, 4vw, 3.2rem);
  line-height: 0.95;
  letter-spacing: -0.04em;
  margin: 0.25rem 0;
}
.award p { margin: 0; font-size: 1.05rem; }

.timeline { list-style: none; padding: 0; margin: 1.1rem 0 0; }
.timeline li {
  display: grid;
  grid-template-columns: 4.4rem minmax(6rem, 0.8fr) 2.4fr;
  gap: 0.65rem;
  padding: 0.75rem 0;
  border-top: 1px solid var(--line);
  font-size: clamp(1.05rem, 2vw, 1.28rem);
  line-height: 1.3;
}
.timeline .who { font-weight: 700; }
.timeline .bad { color: #ffb4bc; }
.timeline .good { color: var(--good); }
.timeline .chat { color: var(--mint); }

.actions { display: flex; flex-wrap: wrap; gap: 0.6rem; margin-top: 1rem; }

.logo { height: 42px; width: auto; }
.logo[hidden] { display: none !important; }
.discord { color: var(--cyan); font-weight: 700; display: inline-block; margin: 0.8rem 0; }
.role-banner {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 0.75rem 0.9rem;
  margin: 0 0 0.8rem;
  background: var(--surface);
}
.role-banner strong { display: block; font-size: clamp(1.6rem, 3vw, 2.3rem); line-height: 1; }
.role-banner.lead { border-color: var(--action); }
.role-banner.go { border-color: var(--cyan); }
.role-banner p { margin: 0.35rem 0 0; color: var(--text-soft); }
.callout {
  font-size: 1.35rem;
  background: var(--panel);
  border-left: 4px solid var(--cyan);
  padding: 0.7rem 0.8rem;
  margin: 0 0 0.8rem;
}
.lore { font-size: 1.05rem; margin: 0.2rem 0 0.4rem; }
.prompts { margin: 0.6rem 0; padding-left: 1.1rem; }
.prompts li { margin: 0.25rem 0; }
.composer { display: flex; gap: 0.45rem; margin-top: 0.45rem; }
.composer input { flex: 1; }
.start-row { margin-top: 0.8rem; }
.setup { display: grid; gap: 0.45rem; margin: 0.6rem 0; }
.people .meta { display: flex; gap: 0.45rem; align-items: center; }
button.tiny { padding: 0.25rem 0.5rem; font-size: 0.85rem; }
.people li.is-briefer { border-color: var(--action); }
.chip.briefer { border-color: var(--action); }
.chip.listening { box-shadow: inset 0 0 0 2px var(--cyan); }
.dot { width: 0.7rem; height: 0.7rem; border-radius: 999px; display: inline-block; flex: 0 0 auto; }
.talkto {
  border: 2px solid var(--action);
  border-radius: 16px;
  padding: 0.85rem 1rem;
  margin: 0 0 0.8rem;
  background: var(--surface);
}
.talkto strong {
  display: block;
  font-family: "Chakra Petch", Oxanium, sans-serif;
  font-size: clamp(2.1rem, 5vw, 3.6rem);
  line-height: 0.95;
}
.talkto.quiet strong { font-size: clamp(1.45rem, 3.4vw, 2.2rem); }
.talkto.now { animation: turn-pop 0.45s ease-out 1; }
.talkto .lock-owner, .yours, .manual .lock-owner { font-size: 1.25rem; font-weight: 700; margin: 0.35rem 0 0; }
.talkto .level, .mode-flag { margin: 0.35rem 0 0; color: var(--text-soft); }
.mode-row {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  margin: 0.2rem 0 0.8rem;
}
.mode-field { display: grid; gap: 0.25rem; }
.mode-select, .mode-name {
  font-family: "Chakra Petch", Oxanium, sans-serif;
  font-size: 1.35rem;
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.45rem 0.7rem;
  min-width: 11rem;
}
.mode-explainer { margin: 0; font-size: 1.05rem; max-width: 28rem; }
.removed-row { display: flex; flex-wrap: wrap; gap: 0.4rem; align-items: center; width: 100%; }
.up-next {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  width: 100%;
  overflow-x: auto;
  flex-wrap: nowrap;
}
.up-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.15rem 0.55rem;
  background: var(--surface);
  flex: 0 0 auto;
}
.turn-card {
  border: 2px solid var(--line);
  border-radius: 16px;
}
.turn-card h2, .turn-card strong {
  font-family: "Chakra Petch", Oxanium, sans-serif;
  font-size: clamp(1.7rem, 4vw, 2.6rem);
  line-height: 1;
  margin: 0.15rem 0;
}
.turn-card.next {
  animation: turn-pulse 1.8s ease-in-out infinite;
  border-color: var(--turn, var(--action));
}
.turn-card.next h2, .turn-card.now strong { color: var(--turn, var(--cyan)); }
.turn-card.now { animation: turn-pop 0.45s ease-out 1; }
.brief-note {
  margin: 0 0 0.7rem;
  padding: 0.45rem 0.75rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  font-weight: 700;
  color: var(--text);
}
.sound-toggle { margin-left: 0.2rem; }
@keyframes turn-pulse {
  0%, 100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--turn, var(--action)) 50%, transparent); }
  70% { box-shadow: 0 0 0 8px transparent; }
}
@keyframes turn-pop {
  0% { transform: scale(0.98); }
  40% { transform: scale(1.02); }
  100% { transform: scale(1); }
}
@media (prefers-reduced-motion: reduce) {
  .turn-card.next, .turn-card.now { animation: none; }
}
.progress li { padding-left: 0.45rem; }
.aside.dimmed { opacity: 0.45; }
.device { border: 1px solid var(--line); }
.leaderboard { margin-top: 1.2rem; }
.leaderboard h2 { font-size: 1.8rem; margin: 0 0 0.4rem; }
.board { margin: 0.2rem 0 0.7rem; padding-left: 1.1rem; }
.penalty {
  position: fixed;
  top: 18%;
  left: 50%;
  transform: translateX(-50%);
  z-index: 30;
  pointer-events: none;
  font-family: "Chakra Petch", Oxanium, sans-serif;
  font-size: clamp(3rem, 8vw, 5rem);
  font-weight: 700;
  color: var(--bad);
  text-shadow: 0 0 18px rgba(255, 77, 90, 0.45);
}
#link-status { position: fixed; left: 1rem; right: 1rem; bottom: 1rem; z-index: 25; }

@media (max-width: 860px) {
  .stage-layout, .awards, .timeline li { grid-template-columns: 1fr; }
  .timeline li { gap: 0.15rem; }
  .clock { margin-left: 0; }
  .mode-row { flex-direction: column; align-items: stretch; }
  h1 { font-size: clamp(2.8rem, 14vw, 4.4rem); }
}
