:root {
  --void: #08090D;
  --panel: #14171E;
  --panel-2: #101319;
  --steel: #2A2F3A;
  --steel-dim: #1b1f27;
  --amber: #FFB02C;
  --amber-dim: #a86f13;
  --red: #FF2E3F;
  --red-deep: #6d0c16;
  --bone: #F4F0E6;
  --cold: #CFE9FF;
  --font-display: "Big Shoulders Stencil", "Arial Narrow", Impact, sans-serif;
  --font-num: "Saira Condensed", "Arial Narrow", sans-serif;
  --font-text: "Archivo Narrow", system-ui, sans-serif;
  --pad-x: 16px;
  --ease-out: cubic-bezier(.16, .84, .3, 1);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: var(--void);
  color: var(--bone);
  overscroll-behavior: none;
}

body {
  height: 100dvh;
  overflow: hidden;
  font-family: var(--font-text);
  -webkit-font-smoothing: antialiased;
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

button {
  font-family: inherit;
  color: inherit;
  border: 0;
  background: none;
  padding: 0;
  cursor: pointer;
  touch-action: manipulation;
}

button:focus-visible {
  outline: 1px solid var(--amber);
  outline-offset: 2px;
}

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

/* ---------------- the room behind everything ---------------- */

.house {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  background:
    radial-gradient(58% 34% at 54% 92%, rgba(74,50,22,.30), transparent 70%),
    radial-gradient(140% 90% at 50% 120%, #12141a 0%, #0a0b10 42%, var(--void) 78%);
}

.door {
  position: absolute;
  top: 4%;
  bottom: -12%;
  width: 26%;
  background: linear-gradient(180deg, #0b0c12, #12141b 58%, #0b0c12);
  filter: blur(6px);
  opacity: .95;
}
.door::after {
  content: "";
  position: absolute;
  top: 0; bottom: 0; width: 1px;
  background: linear-gradient(180deg, transparent, rgba(42,47,58,.55) 22%, rgba(42,47,58,.25) 70%, transparent);
}
.door-l { left: 7%; }
.door-l::after { right: 0; }
.door-r { right: 9%; width: 30%; }
.door-r::after { left: 0; }

.door-glow {
  position: absolute;
  left: 57%;
  top: 66%;
  width: 21%;
  height: 3px;
  background: var(--amber);
  opacity: .52;
  filter: blur(5px);
  border-radius: 4px;
  box-shadow: 0 0 46px 14px rgba(255,176,44,.22), 0 0 120px 40px rgba(255,176,44,.08);
}

.far-window {
  position: absolute;
  left: 46%;
  top: 26%;
  width: 9%;
  height: 14%;
  background: #7a766a;
  opacity: .13;
  filter: blur(10px);
}

.dust {
  position: absolute;
  inset: 0;
  opacity: .5;
  background-image:
    radial-gradient(1px 1px at 18% 34%, rgba(244,240,230,.30), transparent 60%),
    radial-gradient(1px 1px at 72% 22%, rgba(244,240,230,.20), transparent 60%),
    radial-gradient(1px 1px at 44% 58%, rgba(244,240,230,.24), transparent 60%),
    radial-gradient(1px 1px at 63% 74%, rgba(244,240,230,.16), transparent 60%),
    radial-gradient(1px 1px at 31% 81%, rgba(244,240,230,.14), transparent 60%),
    radial-gradient(1px 1px at 86% 47%, rgba(244,240,230,.18), transparent 60%),
    radial-gradient(1px 1px at 9% 63%, rgba(244,240,230,.12), transparent 60%);
}

.house-dim {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(90% 62% at 50% 38%, rgba(8,9,13,.10), rgba(8,9,13,.72) 74%, rgba(8,9,13,.94) 100%),
    linear-gradient(180deg, rgba(8,9,13,.34), rgba(8,9,13,.06) 34%, rgba(8,9,13,.55) 100%);
}

.grain {
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  opacity: .055;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='140' height='140'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.82' numOctaves='3' stitchTiles='stitch'/><feColorMatrix type='saturate' values='0'/></filter><rect width='140' height='140' filter='url(%23n)' opacity='0.9'/></svg>");
  background-size: 140px 140px;
  mix-blend-mode: screen;
}
.grain::after {
  content: "";
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(180deg, rgba(0,0,0,.22) 0 1px, transparent 1px 3px);
  opacity: .5;
  mix-blend-mode: multiply;
}

/* ---------------- the panel ---------------- */

.panel {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 620px;
  height: 100dvh;
  margin: 0 auto;
  padding:
    max(8px, env(safe-area-inset-top))
    max(var(--pad-x), env(safe-area-inset-right))
    max(8px, env(safe-area-inset-bottom))
    max(var(--pad-x), env(safe-area-inset-left));
}

.panel.jolt { animation: jolt .5s steps(2, end) 1; }

@keyframes jolt {
  0% { transform: translate(0, 0); }
  20% { transform: translate(-5px, 3px); }
  40% { transform: translate(4px, -4px); }
  60% { transform: translate(-3px, -2px); }
  80% { transform: translate(3px, 2px); }
  100% { transform: translate(0, 0); }
}

/* ---------------- top rule ---------------- */

.rule-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  height: 40px;
  flex: 0 0 40px;
  border-bottom: 1px solid var(--steel);
  box-shadow: 0 1px 0 rgba(0,0,0,.8), 0 -1px 0 rgba(255,255,255,.02) inset;
  margin-bottom: 10px;
}

.mark {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.mark-bars {
  display: flex;
  gap: 2px;
  align-items: flex-end;
  height: 11px;
}
.mark-bars i {
  display: block;
  width: 2px;
  background: var(--amber);
  box-shadow: 0 0 8px rgba(255,176,44,.6);
}
.mark-bars i:nth-child(1) { height: 5px; opacity: .55; }
.mark-bars i:nth-child(2) { height: 8px; opacity: .8; }
.mark-bars i:nth-child(3) { height: 11px; }
.mark-text {
  font-family: var(--font-text);
  font-weight: 600;
  font-size: 10px;
  letter-spacing: .24em;
  color: rgba(244,240,230,.62);
  white-space: nowrap;
}

.rule-center {
  font-family: var(--font-text);
  font-weight: 600;
  font-size: 9px;
  letter-spacing: .22em;
  color: var(--amber);
  text-transform: uppercase;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.link-state {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}
.link-state i {
  width: 5px; height: 5px;
  border-radius: 50%;
  background: var(--steel);
  box-shadow: 0 0 0 2px rgba(42,47,58,.4);
}
.link-state span {
  font-family: var(--font-text);
  font-weight: 600;
  font-size: 9px;
  letter-spacing: .18em;
  color: rgba(244,240,230,.55);
  white-space: nowrap;
}
.link-state.live i { background: var(--amber); box-shadow: 0 0 10px 2px rgba(255,176,44,.7); animation: lamp 2.4s ease-in-out infinite; }
.link-state.live span { color: var(--amber); }
.link-state.lost i { background: var(--red); box-shadow: 0 0 10px 2px rgba(255,46,63,.6); }
.link-state.lost span { color: var(--red); }
.link-state.test i { background: var(--amber); }

@keyframes lamp {
  0%, 100% { opacity: 1; }
  50% { opacity: .45; }
}

.foot-rule {
  flex: 0 0 1px;
  height: 1px;
  margin-top: 8px;
  background: linear-gradient(90deg, transparent, var(--steel) 18%, var(--steel) 82%, transparent);
  opacity: .6;
}

/* ---------------- screens ---------------- */

.screen {
  display: none;
  flex: 1;
  min-height: 0;
  flex-direction: column;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: none;
}
.screen::-webkit-scrollbar { display: none; }
.screen.on { display: flex; }

.kicker {
  margin: 0;
  font-family: var(--font-text);
  font-weight: 600;
  font-size: 10px;
  line-height: 1.2;
  letter-spacing: .24em;
  text-transform: uppercase;
  color: rgba(244,240,230,.55);
}

.hint {
  margin: 0;
  font-family: var(--font-text);
  font-weight: 400;
  font-size: 11px;
  line-height: 1.45;
  letter-spacing: .09em;
  text-transform: uppercase;
  color: rgba(244,240,230,.58);
}

.display {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: .01em;
  line-height: .84;
  color: var(--bone);
}

/* ---------------- boot ---------------- */

.boot { justify-content: center; align-items: center; }
.boot-inner { display: flex; flex-direction: column; align-items: center; gap: 14px; padding-bottom: 12vh; }
.boot-lamp {
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--amber);
  box-shadow: 0 0 24px 6px rgba(255,176,44,.5);
  animation: lamp 1.2s ease-in-out infinite;
}
.boot-word { font-size: clamp(44px, 15vw, 82px); color: var(--bone); letter-spacing: .05em; }
#bootNote { color: rgba(244,240,230,.45); }

/* ---------------- home ---------------- */

#scr-home { gap: 4px; }

.home-head {
  padding-top: 6px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 0 0 auto;
}
.home-title {
  font-size: clamp(62px, 19.5vw, 122px);
  letter-spacing: .005em;
  color: var(--bone);
  text-shadow: 0 0 42px rgba(255,176,44,.10);
}
.home-sub { color: rgba(244,240,230,.5); letter-spacing: .18em; font-size: 9.5px; }

.home-dial {
  flex: 0 0 auto;
  height: clamp(140px, 28vh, 320px);
  display: grid;
  place-items: center;
  position: relative;
  overflow: hidden;
}
.home-dial .dial {
  width: min(82%, 28vh, 320px);
  height: auto;
  aspect-ratio: 1;
  max-height: 100%;
  overflow: visible;
}

.home-controls {
  margin-top: auto;
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  gap: 9px;
  padding-top: 10px;
}

.mode-switch {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.mode-btn {
  position: relative;
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 6px;
  padding: 10px 8px 9px;
  border: 1px solid var(--steel);
  border-radius: 3px;
  background: linear-gradient(180deg, #171b23, var(--panel-2));
  box-shadow: inset 0 1px 0 rgba(255,255,255,.06), inset 0 -1px 0 rgba(0,0,0,.75);
  color: rgba(244,240,230,.5);
  transition: color .12s linear, border-color .12s linear;
}
.mode-btn .mode-num {
  font-family: var(--font-num);
  font-weight: 900;
  font-size: 26px;
  line-height: 1;
}
.mode-btn .mode-word {
  font-family: var(--font-text);
  font-weight: 600;
  font-size: 10px;
  letter-spacing: .16em;
}
.mode-btn small {
  position: absolute;
  bottom: 3px;
  left: 0; right: 0;
  font-family: var(--font-text);
  font-size: 8px;
  letter-spacing: .2em;
  color: rgba(244,240,230,.3);
}
.mode-btn.on {
  color: var(--amber);
  border-color: rgba(255,176,44,.55);
  background: linear-gradient(180deg, #1e1b14, #14171E);
  box-shadow: inset 0 1px 0 rgba(255,176,44,.28), inset 0 -1px 0 rgba(0,0,0,.75), 0 0 22px rgba(255,176,44,.10);
}
.mode-btn.on small { color: rgba(255,176,44,.6); }
.mode-btn.soon {
  border-style: dashed;
  border-color: rgba(42,47,58,.75);
  color: rgba(244,240,230,.32);
}
.mode-btn.soon .mode-num { color: rgba(244,240,230,.38); }
.mode-btn.soon:hover, .mode-btn.soon:active { color: rgba(244,240,230,.5); }
.mode-note.soon { color: rgba(244,240,230,.5); }

.foot-note { text-align: center; color: rgba(244,240,230,.32); font-size: 9px; letter-spacing: .16em; }
.foot-note.warn { color: rgba(255,176,44,.82); }

/* ---------------- create ---------------- */

#scr-create { gap: 12px; }
.create-head { display: flex; flex-direction: column; gap: 8px; padding-top: 4vh; }
.create-head .display { font-size: clamp(46px, 14vw, 80px); }
.create-head .hint { color: rgba(244,240,230,.45); }

.create-code { display: flex; flex-direction: column; align-items: stretch; gap: 7px; width: 100%; max-width: 300px; margin: 0 auto; }
.create-code .field-label { align-self: flex-start; }
.create-cells { max-width: none; }
.create-cells .cell { font-size: clamp(34px, 10vw, 52px); }

.mode-field {
  display: flex;
  flex-direction: column;
  gap: 9px;
  padding: 11px 11px 12px;
  border: 1px solid rgba(42,47,58,.85);
  border-radius: 3px;
  background: linear-gradient(180deg, rgba(20,23,30,.75), rgba(12,14,19,.75));
  box-shadow: inset 0 1px 0 rgba(255,255,255,.05), inset 0 -1px 0 rgba(0,0,0,.7);
}
.field-label {
  margin: 0;
  font-family: var(--font-text);
  font-weight: 600;
  font-size: 9px;
  letter-spacing: .24em;
  text-transform: uppercase;
  color: rgba(244,240,230,.42);
}
.mode-field .mode-btn { padding: 12px 8px 13px; min-height: 62px; }
.mode-note { text-align: center; color: rgba(255,176,44,.68); letter-spacing: .14em; font-size: 9px; min-height: 2.6em; }

.create-dial {
  flex: 1;
  min-height: 100px;
  display: grid;
  place-items: center;
  overflow: hidden;
}
.create-dial .dial { width: min(64%, 22vh, 240px); height: auto; aspect-ratio: 1; overflow: visible; opacity: .85; }

.create-status {
  min-height: 2.4em;
  text-align: center;
  letter-spacing: .16em;
  color: rgba(255,176,44,.85);
}
.create-status.open { color: rgba(255,176,44,.85); }


/* ---------------- plates ---------------- */

.plate {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  width: 100%;
  min-height: 60px;
  padding: 10px 14px;
  border: 1px solid var(--steel);
  border-radius: 3px;
  background: linear-gradient(180deg, #191d25 0%, var(--panel) 48%, #101319 100%);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.08),
    inset 0 -1px 0 rgba(0,0,0,.85),
    0 2px 0 rgba(0,0,0,.55);
  color: var(--bone);
  transition: transform .05s linear, box-shadow .08s linear, filter .12s linear;
}
.plate .plate-label {
  font-family: var(--font-display);
  font-weight: 900;
  font-size: clamp(24px, 7.2vw, 32px);
  line-height: .92;
  letter-spacing: .06em;
  text-transform: uppercase;
}
.plate small {
  font-family: var(--font-text);
  font-weight: 400;
  font-size: 9px;
  letter-spacing: .19em;
  text-transform: uppercase;
  color: rgba(244,240,230,.42);
}
.plate:active { transform: translateY(1px); box-shadow: inset 0 2px 6px rgba(0,0,0,.7); }

.plate.big { min-height: 78px; }
.plate.big .plate-label { font-size: clamp(28px, 8.6vw, 40px); }
#btnArm .plate-label {
  font-size: clamp(21px, 6.15vw, 30px);
  letter-spacing: .045em;
  white-space: nowrap;
}

.plate-amber {
  color: #140d02;
  border-color: #ffc25a;
  background:
    linear-gradient(180deg, rgba(255,255,255,.28), transparent 42%),
    linear-gradient(180deg, #ffbe48, #ffab22 56%, #d98c12);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.55),
    inset 0 -2px 0 rgba(120,66,0,.45),
    0 0 34px rgba(255,176,44,.22),
    0 2px 0 rgba(0,0,0,.5);
}
.plate-amber small { color: rgba(20,13,2,.62); }
.plate-amber .plate-label { text-shadow: 0 1px 0 rgba(255,255,255,.28); }

.plate.quiet {
  min-height: 44px;
  background: linear-gradient(180deg, #12151c, #0d1015);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.04), inset 0 -1px 0 rgba(0,0,0,.8);
  color: rgba(244,240,230,.62);
}
.plate.quiet .plate-label { font-size: 19px; letter-spacing: .1em; }
.plate.danger-quiet { color: rgba(255,46,63,.8); }
.plate[disabled] { opacity: .38; pointer-events: none; }

.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.stack-bottom {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-top: 14px;
}

/* ---------------- join ---------------- */

#scr-join { gap: 14px; }
.join-head { display: flex; flex-direction: column; gap: 10px; padding-top: 8vh; }
.join-head .display { font-size: clamp(48px, 15vw, 86px); }
.join-head .hint { color: rgba(244,240,230,.45); }

.code-field { position: relative; }

.cells {
  display: flex;
  gap: 8px;
  width: 100%;
  max-width: 360px;
  margin: 0 auto;
}
.cell {
  flex: 1 1 0;
  min-width: 0;
  aspect-ratio: .87;
  display: grid;
  place-items: center;
  border: 1px solid var(--steel);
  border-radius: 3px;
  background: linear-gradient(180deg, #161a22, #101319);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.07),
    inset 0 -6px 14px rgba(0,0,0,.55);
  font-family: var(--font-display);
  font-weight: 900;
  font-size: clamp(40px, 12vw, 62px);
  line-height: 1;
  color: var(--bone);
  text-shadow: 0 0 22px rgba(255,176,44,.14);
  transition: border-color .12s linear, box-shadow .12s linear;
}
.cell.filled {
  border-color: rgba(255,176,44,.5);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.07),
    inset 0 -2px 0 rgba(255,176,44,.42),
    0 0 26px rgba(255,176,44,.10);
}
.join-cells.pulse .cell { border-color: rgba(255,255,255,.35); }

.code-input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 3;
  opacity: 0;
  border: 0;
  background: transparent;
  color: transparent;
  caret-color: transparent;
  font-size: 16px;
  text-align: center;
}

.join-status { text-align: center; letter-spacing: .2em; color: rgba(244,240,230,.4); }

/* ---------------- lobby ---------------- */

#scr-lobby { gap: 12px; }
.lobby-head {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding-top: 4vh;
}
.cells.big { max-width: 100%; }
.cells.big .cell { font-size: clamp(56px, 18.5vw, 104px); aspect-ratio: .82; }
#lobbyMode { color: rgba(255,176,44,.72); letter-spacing: .18em; font-size: 10px; }

.seat-list { display: flex; flex-direction: column; gap: 7px; margin-top: 6px; }
.seat-row {
  display: grid;
  grid-template-columns: 30px 1fr auto;
  align-items: center;
  gap: 10px;
  min-height: 52px;
  padding: 8px 12px;
  border: 1px solid rgba(42,47,58,.85);
  border-radius: 3px;
  background: linear-gradient(180deg, rgba(24,28,36,.9), rgba(16,19,25,.9));
  box-shadow: inset 0 1px 0 rgba(255,255,255,.05), inset 0 -1px 0 rgba(0,0,0,.6);
}
.seat-row .seat-no {
  font-family: var(--font-num);
  font-weight: 700;
  font-size: 20px;
  color: rgba(255,176,44,.65);
  letter-spacing: .04em;
}
.seat-row .seat-role {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.seat-row .seat-role b {
  font-family: var(--font-display);
  font-weight: 900;
  font-size: 23px;
  letter-spacing: .06em;
  color: var(--bone);
  line-height: 1;
}
.seat-row .seat-role i {
  font-family: var(--font-text);
  font-style: normal;
  font-size: 9px;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: rgba(244,240,230,.4);
}
.seat-row .seat-who {
  font-family: var(--font-text);
  font-weight: 600;
  font-size: 11px;
  letter-spacing: .08em;
  color: rgba(255,176,44,.8);
  text-align: right;
  max-width: 40vw;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.seat-row.empty {
  border-style: dashed;
  border-color: rgba(255,176,44,.28);
  background: rgba(14,16,21,.7);
}
.seat-row.empty .seat-role b { color: rgba(244,240,230,.36); }
.seat-row.empty .seat-who { color: rgba(255,176,44,.55); animation: lamp 2.2s ease-in-out infinite; }
.seat-row.me { border-color: rgba(255,176,44,.5); box-shadow: inset 0 1px 0 rgba(255,176,44,.2), 0 0 26px rgba(255,176,44,.08); }
.seat-row .you-tag {
  font-family: var(--font-text);
  font-size: 8px;
  letter-spacing: .2em;
  color: var(--amber);
  margin-left: 4px;
}

.lobby-status {
  font-size: clamp(22px, 6.4vw, 30px);
  letter-spacing: .05em;
  color: var(--amber);
  text-shadow: 0 0 26px rgba(255,176,44,.22);
  text-align: center;
}
.lobby-status.in { color: var(--bone); text-shadow: 0 0 30px rgba(244,240,230,.18); }
.lobby-status.gate { color: var(--amber); }
.lobby-hint { text-align: center; color: rgba(244,240,230,.38); }

/* ---------------- refusal ---------------- */

#scr-refuse { justify-content: center; }
.refuse-inner { display: flex; flex-direction: column; gap: 14px; padding-bottom: 8vh; }
#refuseWord { font-size: clamp(56px, 17vw, 96px); color: var(--red); text-shadow: 0 0 40px rgba(255,46,63,.22); }
#refuseSub { max-width: 40ch; }

/* ---------------- setup ---------------- */

#scr-setup { gap: 10px; }
.setup-head { display: flex; flex-direction: column; gap: 8px; padding-top: 2vh; }
#setupRole { font-size: clamp(50px, 16vw, 92px); color: var(--bone); }
#setupBlurb { color: rgba(255,176,44,.75); letter-spacing: .13em; }

.setup-dial {
  flex: 1;
  min-height: 90px;
  display: grid;
  place-items: center;
  overflow: hidden;
}
.setup-dial .dial { width: 100%; height: 100%; max-width: 250px; max-height: 250px; overflow: visible; opacity: .9; }

.armed-line {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: var(--font-text);
  font-weight: 600;
  font-size: 10px;
  letter-spacing: .22em;
  color: rgba(244,240,230,.55);
  text-transform: uppercase;
}
.live-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--steel);
}
.live-dot.on { background: var(--amber); box-shadow: 0 0 10px 2px rgba(255,176,44,.65); }
.live-dot.full { background: var(--amber); box-shadow: 0 0 16px 4px rgba(255,176,44,.8); animation: lamp 1.6s ease-in-out infinite; }

.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 12px;
  border: 1px solid rgba(42,47,58,.8);
  border-radius: 3px;
  background: linear-gradient(180deg, rgba(20,23,30,.8), rgba(12,14,19,.8));
}
.toggle-label {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-family: var(--font-display);
  font-weight: 900;
  font-size: 20px;
  letter-spacing: .08em;
  color: rgba(244,240,230,.85);
}
.toggle-label small {
  font-family: var(--font-text);
  font-weight: 400;
  font-size: 8.5px;
  letter-spacing: .18em;
  color: rgba(244,240,230,.4);
}
.toggle {
  position: relative;
  flex: 0 0 auto;
  width: 66px;
  height: 34px;
  border: 1px solid #3a404c;
  border-radius: 3px;
  background: linear-gradient(180deg, #0e1116, #161a22);
  box-shadow: inset 0 2px 5px rgba(0,0,0,.8), 0 1px 0 rgba(255,255,255,.05);
  transition: background .1s linear, border-color .1s linear;
}
.toggle i {
  position: absolute;
  top: 4px; left: 4px;
  width: 27px; height: 24px;
  border-radius: 2px;
  background: linear-gradient(180deg, #c9c5bb, #8b8880 70%, #6d6a63);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.6), 0 2px 4px rgba(0,0,0,.7);
  transition: transform .12s var(--ease-out), background .1s linear;
}
.toggle[aria-checked="true"] {
  border-color: rgba(255,176,44,.65);
  background: linear-gradient(180deg, #211a0f, #171309);
  box-shadow: inset 0 2px 5px rgba(0,0,0,.7), 0 0 20px rgba(255,176,44,.18);
}
.toggle[aria-checked="true"] i {
  transform: translateX(30px);
  background: linear-gradient(180deg, #ffd27e, var(--amber) 60%, #c9880f);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.7), 0 0 16px rgba(255,176,44,.6);
}
.sensor-note { text-align: center; min-height: 2.6em; color: rgba(244,240,230,.4); }
.sensor-note.warn { color: rgba(255,46,63,.85); }
.sensor-note.good { color: rgba(255,176,44,.8); }

/* ---------------- game shell ---------------- */

#scr-game { overflow: hidden; }

.game {
  display: flex;
  transition: filter .09s linear;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  gap: 8px;
}

.cd-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex: 0 0 auto;
}
.cd-side { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.cd-label {
  font-family: var(--font-text);
  font-weight: 600;
  font-size: 9px;
  letter-spacing: .24em;
  text-transform: uppercase;
  color: rgba(244,240,230,.45);
}
.cd-role { color: rgba(255,176,44,.8); font-size: 9px; letter-spacing: .2em; }
.cd {
  font-family: var(--font-num);
  font-weight: 900;
  font-size: clamp(34px, 10vw, 52px);
  line-height: .9;
  letter-spacing: .01em;
  color: var(--bone);
  font-variant-numeric: tabular-nums;
  text-shadow: 0 0 26px rgba(244,240,230,.10);
  transition: color .2s linear;
}
.cd.low { color: var(--red); text-shadow: 0 0 30px rgba(255,46,63,.35); }
.cd.critical { animation: cdbeat .5s steps(2, end) infinite; }
@keyframes cdbeat { 0%,100% { transform: scale(1); } 50% { transform: scale(1.045); } }

.sigil {
  display: none;
  width: 74px;
  color: var(--red);
  flex: 0 0 auto;
  transition: transform .16s var(--ease-out);
}
.sigil svg { width: 100%; height: auto; display: block; filter: drop-shadow(0 0 12px rgba(255,46,63,.4)); }
.sigil-bleed { opacity: .55; }
.sigil.pulse { transform: scale(1.16); }

.dial-stage {
  position: relative;
  flex: 1;
  min-height: 0;
  display: grid;
  place-items: center;
}
.dial-wrap { width: min(100%, 50vh); aspect-ratio: 1; }
.dial-wrap .dial { width: 100%; height: 100%; display: block; touch-action: none; overflow: visible; }

.prompt {
  position: absolute;
  inset: 0;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  pointer-events: none;
  text-align: center;
  padding: 0 6px;
}
.prompt::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 82%;
  aspect-ratio: 1;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: radial-gradient(circle,
    rgba(8,9,13,.94) 0 42%,
    rgba(8,9,13,.78) 58%,
    rgba(8,9,13,0) 74%);
}
.prompt-word, .prompt-count { position: relative; }
.prompt.on { display: flex; }
.prompt-word {
  font-family: var(--font-display);
  font-weight: 900;
  font-size: clamp(34px, 10.5vw, 58px);
  line-height: .88;
  letter-spacing: .035em;
  text-transform: uppercase;
  color: var(--amber);
  text-shadow: 0 0 22px rgba(255,176,44,.6), 0 0 70px rgba(255,176,44,.24), 0 2px 0 rgba(0,0,0,.8);
  animation: slam .18s var(--ease-out) both;
}
.prompt-count {
  font-family: var(--font-num);
  font-weight: 900;
  font-size: clamp(24px, 7vw, 34px);
  line-height: 1;
  color: var(--amber);
  font-variant-numeric: tabular-nums;
  text-shadow: 0 0 18px rgba(255,176,44,.5);
}
.prompt.hit .prompt-word { color: var(--bone); text-shadow: 0 0 30px rgba(244,240,230,.5); }
.prompt.hit .prompt-count { color: var(--bone); }
.prompt.missed .prompt-word,
.prompt.missed .prompt-count { color: var(--red); text-shadow: 0 0 28px rgba(255,46,63,.55); }
@keyframes slam {
  0% { transform: scale(1.12); opacity: 0; }
  60% { opacity: 1; }
  100% { transform: scale(1); opacity: 1; }
}

.readouts {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 6px;
  flex: 0 0 auto;
}
.readout {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  padding: 5px 4px 4px;
  border: 1px solid rgba(42,47,58,.75);
  border-radius: 3px;
  background: linear-gradient(180deg, rgba(18,21,28,.85), rgba(10,12,17,.85));
  box-shadow: inset 0 1px 0 rgba(255,255,255,.04), inset 0 -1px 0 rgba(0,0,0,.7);
}
.readout span {
  font-family: var(--font-text);
  font-weight: 600;
  font-size: 8px;
  letter-spacing: .2em;
  color: rgba(244,240,230,.4);
}
.readout b {
  font-family: var(--font-num);
  font-weight: 900;
  font-size: 19px;
  line-height: 1;
  letter-spacing: .06em;
  color: var(--amber);
  font-variant-numeric: tabular-nums;
  text-shadow: 0 0 14px rgba(255,176,44,.25);
}
.game[data-role="monster"] .readouts { display: none; }

.walk {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 0 0 auto;
  min-height: 26px;
}
.walk-word {
  font-family: var(--font-text);
  font-weight: 600;
  font-size: 9px;
  letter-spacing: .2em;
  color: var(--amber);
  min-width: 74px;
}
.walk-track {
  position: relative;
  flex: 1;
  height: 5px;
  border: 1px solid rgba(42,47,58,.9);
  background: #0c0e13;
  box-shadow: inset 0 1px 3px rgba(0,0,0,.8);
  overflow: hidden;
}
.walk-track i {
  position: absolute;
  inset: 0;
  transform-origin: left center;
  background: linear-gradient(90deg, rgba(255,176,44,.55), var(--amber));
  box-shadow: 0 0 14px rgba(255,176,44,.55);
}
.walk.still .walk-word { color: var(--red); }
.walk.still .walk-track i { background: linear-gradient(90deg, #8a0e1a, var(--red)); box-shadow: 0 0 16px rgba(255,46,63,.6); }
.walk-num {
  font-family: var(--font-num);
  font-weight: 700;
  font-size: 15px;
  min-width: 34px;
  text-align: right;
  color: rgba(244,240,230,.6);
  font-variant-numeric: tabular-nums;
}
.walk.still .walk-num { color: var(--red); }

.game-hint { flex: 0 0 auto; text-align: center; color: rgba(244,240,230,.4); font-size: 9.5px; letter-spacing: .18em; }

/* ---------------- stun plate ---------------- */

.plate.stun {
  --p: 1;
  display: none;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 12px;
  min-height: 74px;
  overflow: hidden;
  background: linear-gradient(180deg, #15181f, #0e1016);
  border: 1px solid var(--cold);
  color: var(--bone);
  box-shadow:
    inset 0 1px 0 rgba(207,233,255,.16),
    inset 0 -1px 0 rgba(0,0,0,.8),
    0 0 26px rgba(207,233,255,.10);
}
.plate.stun .glyph { width: 26px; height: 26px; color: var(--cold); flex: 0 0 auto; }
.plate.stun .plate-label {
  font-size: clamp(23px, 6.6vw, 30px);
  letter-spacing: .05em;
}
.plate.stun small {
  color: rgba(207,233,255,.7);
  font-family: var(--font-num);
  font-weight: 700;
  font-size: 13px;
  letter-spacing: .08em;
  min-width: 54px;
  text-align: right;
}
.plate.stun::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: conic-gradient(from 0deg,
    rgba(207,233,255,.85) 0deg,
    rgba(207,233,255,.85) calc(var(--p) * 360deg),
    rgba(42,47,58,.9) calc(var(--p) * 360deg),
    rgba(42,47,58,.9) 360deg);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  padding: 2px;
  opacity: .9;
}
.plate.stun.cooling { border-color: rgba(207,233,255,.22); color: rgba(244,240,230,.55); }
.plate.stun.cooling .glyph { color: rgba(207,233,255,.45); }
.plate.stun.cooling small { color: rgba(244,240,230,.55); }
.plate.stun.ready {
  background:
    radial-gradient(120% 180% at 50% -20%, #ffffff, var(--cold) 46%, #a9c6da 100%);
  color: #06080c;
  border-color: #ffffff;
  box-shadow: 0 0 40px rgba(207,233,255,.45), 0 0 90px rgba(207,233,255,.18), inset 0 1px 0 rgba(255,255,255,.9);
}
.plate.stun.ready .glyph { color: #06080c; }
.plate.stun.ready small { color: rgba(6,8,12,.7); }
.plate.stun.ready::after { display: none; }
.plate.stun.firing { animation: stunpress .24s var(--ease-out); }
@keyframes stunpress { 0% { filter: brightness(1.5); } 100% { filter: brightness(1); } }

/* ---------------- monster ---------------- */

.monster-head { display: none; align-items: baseline; justify-content: center; gap: 10px; flex: 0 0 auto; }
.monster-card {
  font-family: var(--font-display);
  font-weight: 900;
  font-size: 42px;
  line-height: .85;
  color: var(--bone);
  text-shadow: 0 0 24px rgba(244,240,230,.24);
}
.monster-head .hint { letter-spacing: .16em; }

.pad {
  display: none;
  align-self: center;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(3, 1fr);
  gap: 8px;
  width: min(62vw, 240px);
  aspect-ratio: 1;
  flex: 0 0 auto;
}
.key {
  position: relative;
  border: 1px solid rgba(255,176,44,.32);
  border-radius: 3px;
  background: linear-gradient(180deg, #1b2029, #10131a 62%, #0b0e13);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.09),
    inset 0 -2px 0 rgba(0,0,0,.85),
    0 2px 0 rgba(0,0,0,.5);
  display: grid;
  place-items: center;
  transition: transform .04s linear, box-shadow .06s linear, filter .06s linear;
}
.key span {
  font-family: var(--font-display);
  font-weight: 900;
  font-size: clamp(26px, 8vw, 38px);
  line-height: 1;
  color: var(--amber);
  text-shadow: 0 0 18px rgba(255,176,44,.5);
}
.key:active { transform: translateY(1px); filter: brightness(1.4); box-shadow: inset 0 2px 8px rgba(0,0,0,.9); }
.key.hit { animation: keyhit .3s var(--ease-out); }
@keyframes keyhit { 0% { background: rgba(255,176,44,.5); } 100% { background: linear-gradient(180deg, #1b2029, #10131a 62%, #0b0e13); } }
.key-n { grid-area: 1 / 2; }
.key-w { grid-area: 2 / 1; }
.pad-gap { grid-area: 2 / 2; }
.key-e { grid-area: 2 / 3; }
.key-s { grid-area: 3 / 2; }

.scare-row { display: none; flex: 0 0 auto; }
.plate.scare {
  display: flex;
  flex-direction: row;
  justify-content: center;
  gap: 10px;
  min-height: 58px;
  border-color: rgba(255,46,63,.5);
  background: linear-gradient(180deg, #1a1114, #120b0e);
  box-shadow: inset 0 1px 0 rgba(255,46,63,.14), inset 0 -1px 0 rgba(0,0,0,.8), 0 0 20px rgba(255,46,63,.08);
}
.plate.scare .glyph { width: 22px; height: 22px; color: var(--red); }
.plate.scare .plate-label { font-size: clamp(22px, 6.4vw, 28px); color: rgba(255,46,63,.95); letter-spacing: .08em; }
.plate.scare small { font-family: var(--font-num); font-weight: 700; font-size: 12px; color: rgba(255,46,63,.7); min-width: 46px; text-align: right; }
.plate.scare.ready { animation: redrim 1.8s ease-in-out infinite; }
@keyframes redrim {
  0%, 100% { box-shadow: inset 0 1px 0 rgba(255,46,63,.16), inset 0 -1px 0 rgba(0,0,0,.8), 0 0 16px rgba(255,46,63,.10); }
  50% { box-shadow: inset 0 1px 0 rgba(255,46,63,.3), inset 0 -1px 0 rgba(0,0,0,.8), 0 0 34px rgba(255,46,63,.26); }
}

.caught {
  display: none;
  position: relative;
  width: 100%;
  min-height: 78px;
  border: 1px solid #ff6a74;
  border-radius: 3px;
  background:
    radial-gradient(120% 160% at 50% -30%, rgba(255,255,255,.28), transparent 46%),
    linear-gradient(180deg, #ff3a4a, #d41223 58%, #8e0a17);
  box-shadow:
    inset 0 2px 0 rgba(255,255,255,.24),
    inset 0 -3px 0 rgba(70,0,6,.6),
    0 0 46px rgba(255,46,63,.34),
    0 0 110px rgba(255,46,63,.12);
  color: #fff3ef;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  flex: 0 0 auto;
}
.caught-label {
  font-family: var(--font-display);
  font-weight: 900;
  font-size: clamp(38px, 11.5vw, 58px);
  line-height: .86;
  letter-spacing: .05em;
  text-transform: uppercase;
  text-shadow: 0 2px 0 rgba(90,0,8,.5), 0 0 30px rgba(255,120,130,.5);
}
.caught small {
  font-family: var(--font-text);
  font-weight: 600;
  font-size: 9px;
  letter-spacing: .24em;
  text-transform: uppercase;
  color: rgba(255,240,238,.7);
}
.caught:active { transform: translateY(1px); filter: brightness(1.12); }
.caught.press { animation: caughtpress .3s var(--ease-out); }
@keyframes caughtpress { 0% { transform: scale(.985); filter: brightness(1.3); } 100% { transform: scale(1); } }

/* ---------------- role layouts ---------------- */

.game[data-role="driver"] .cd-row {
  min-height: 92px;
  justify-content: center;
  position: relative;
  flex-direction: column;
  gap: 0;
}
.game[data-role="driver"] .cd { font-size: clamp(58px, 17vw, 92px); }
.game[data-role="driver"] .cd-side {
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.game[data-role="driver"] .cd-side .cd-role { display: none; }
.game[data-role="driver"] .dial-wrap { width: min(100%, 54vh); }

.game[data-role="navigator"] .cd-row {
  border-top: 1px solid rgba(42,47,58,.7);
  border-bottom: 1px solid rgba(42,47,58,.7);
  padding: 5px 2px;
  background: linear-gradient(180deg, rgba(20,23,30,.5), transparent);
}
.game[data-role="navigator"] .cd { font-size: 32px; color: var(--bone); }
.game[data-role="navigator"] .dial-wrap { width: min(100%, 46vh); }
.game[data-role="navigator"] .plate.stun { display: flex; }

.game[data-role="solo"] .cd-row {
  border-top: 1px solid rgba(42,47,58,.7);
  border-bottom: 1px solid rgba(42,47,58,.7);
  padding: 3px 2px;
}
.game[data-role="solo"] .cd { font-size: 28px; }
.game[data-role="solo"] .dial-wrap { width: min(92%, 38vh); }
.game[data-role="solo"] .plate.stun { display: flex; min-height: 66px; }
.game[data-role="solo"] .walk { min-height: 22px; }

.game[data-role="navigator"] .walk,
.game[data-role="monster"] .walk { display: none; }

.game[data-role="monster"] .cd-row { min-height: 40px; }
.game[data-role="monster"] .cd { font-size: 30px; }
.game[data-role="monster"] .sigil { display: block; }
.game[data-role="monster"] .dial-wrap { width: min(62%, 27vh); }
.game[data-role="monster"] .pad { width: min(54vw, 204px); }
.game[data-role="monster"] .monster-head { display: flex; }
.game[data-role="monster"] .pad { display: grid; }
.game[data-role="monster"] .scare-row { display: flex; }
.game[data-role="monster"] .caught { display: flex; }
.game[data-role="monster"] .game-hint { margin-top: -2px; }

/* test tools */
.game.flash { filter: brightness(1.12); }

.game.stunned .pad,
.game.stunned .scare-row,
.game.stunned .caught {
  pointer-events: none;
  filter: grayscale(.75) brightness(.55);
}
.game.stunned .cd { color: var(--cold); text-shadow: 0 0 30px rgba(207,233,255,.4); }

.test-bar {
  display: none;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
}
.test-bar.on { display: flex; }
.test-tag {
  font-family: var(--font-text);
  font-weight: 600;
  font-size: 9px;
  letter-spacing: .2em;
  color: var(--amber);
  border: 1px solid rgba(255,176,44,.5);
  padding: 4px 6px;
  border-radius: 2px;
  background: rgba(255,176,44,.08);
}
.test-knob {
  flex: 1;
  min-height: 34px;
  border: 1px solid rgba(255,176,44,.35);
  border-radius: 3px;
  background: rgba(20,23,30,.85);
  font-family: var(--font-text);
  font-weight: 600;
  font-size: 9px;
  letter-spacing: .16em;
  color: rgba(244,240,230,.6);
  text-transform: uppercase;
}
.test-knob.on { color: var(--red); border-color: rgba(255,46,63,.6); background: rgba(60,8,14,.5); }
.game.testing .dial-wrap { opacity: .8; }

/* ---------------- full-screen effects ---------------- */

.stun-flash {
  position: fixed;
  inset: 0;
  z-index: 70;
  pointer-events: none;
  opacity: 0;
  background: #ffffff;
}
.stun-flash.on { animation: whiteout 1.05s var(--ease-out) 1 both; }
@keyframes whiteout {
  0% { opacity: 1; filter: brightness(2.2); }
  6% { opacity: .95; }
  20% { opacity: .55; }
  45% { opacity: .16; }
  100% { opacity: 0; }
}
.flash-core {
  position: absolute;
  left: 50%; top: 46%;
  width: 46vmin; height: 46vmin;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: radial-gradient(circle, #fff 0 24%, rgba(255,255,255,.9) 34%, rgba(207,233,255,.35) 58%, transparent 72%);
  filter: blur(1px);
}
.flash-spikes {
  position: absolute;
  inset: -10%;
  background: repeating-conic-gradient(from 0deg,
    rgba(255,255,255,.95) 0deg 1.2deg,
    transparent 1.2deg 9deg);
  -webkit-mask: radial-gradient(circle at 50% 46%, #000 0 12%, rgba(0,0,0,.7) 30%, transparent 74%);
  mask: radial-gradient(circle at 50% 46%, #000 0 12%, rgba(0,0,0,.7) 30%, transparent 74%);
  opacity: .9;
}
.flash-ring {
  position: absolute;
  left: 50%; top: 46%;
  border: 1px solid rgba(207,233,255,.8);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  box-shadow: 0 0 20px rgba(207,233,255,.5);
}
.flash-ring.r1 { width: 66vmin; height: 66vmin; }
.flash-ring.r2 { width: 96vmin; height: 96vmin; opacity: .45; }
.flash-after { position: absolute; inset: 0; background: rgba(207,233,255,.05); }

.scare-jolt {
  position: fixed;
  inset: 0;
  z-index: 65;
  pointer-events: none;
  opacity: 0;
  background:
    radial-gradient(circle at 50% 50%, rgba(255,46,63,.12), rgba(255,46,63,.46) 70%, rgba(120,4,14,.62));
}
.scare-jolt.on { animation: redjolt 1.15s steps(40, end) 1 both; }
@keyframes redjolt {
  0% { opacity: 1; }
  55% { opacity: .72; }
  100% { opacity: 0; }
}

/* ---------------- result ---------------- */

.over {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(8,9,13,.9);
}
.over.on { display: flex; }
.over-inner {
  width: 100%;
  max-width: 460px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  text-align: center;
}
.over-word {
  font-size: clamp(54px, 16.5vw, 96px);
  color: var(--bone);
  text-shadow: 0 0 60px rgba(255,176,44,.22);
  animation: overin .3s var(--ease-out) both;
}
@keyframes overin { from { transform: scale(1.08); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.over-code {
  font-family: var(--font-num);
  font-weight: 700;
  font-size: 12px;
  letter-spacing: .3em;
  color: rgba(244,240,230,.4);
}
.over.red { background:
  radial-gradient(110% 80% at 50% 42%, rgba(190,18,34,.42), transparent 64%),
  linear-gradient(180deg, rgba(52,3,10,.97), rgba(14,1,4,.99));
}
.over.red .over-word {
  color: var(--bone);
  text-shadow: 0 0 46px rgba(255,46,63,.7), 0 0 120px rgba(255,46,63,.35);
}
.over.red .kicker { color: rgba(255,150,158,.9); }
.over.red .hint { color: rgba(255,214,216,.68); }
.over.amber { background:
  radial-gradient(120% 90% at 50% 40%, rgba(255,176,44,.20), transparent 62%),
  linear-gradient(180deg, rgba(30,20,4,.88), rgba(10,9,7,.94));
}
.over.amber .over-word { color: var(--bone); text-shadow: 0 0 70px rgba(255,176,44,.4); }
.over .plate { max-width: 320px; }

/* ---------------- compact screens ---------------- */

@media (max-height: 700px) {
  .home-title { font-size: clamp(50px, 15vw, 92px); }
  .plate.big { min-height: 66px; }
  .setup-dial { min-height: 60px; }
  #setupRole { font-size: clamp(42px, 12vw, 70px); }
  .create-head { padding-top: 2vh; }
  .create-head .display { font-size: clamp(38px, 8.5vw, 58px); }
  .create-cells .cell { font-size: clamp(28px, 7vw, 40px); }
  .create-code { max-width: 232px; }
  .create-dial { display: none; }
  .mode-field .mode-btn { min-height: 54px; padding: 9px 8px 11px; }
  .cells.big { max-width: 380px; }
  .cells.big .cell { font-size: clamp(46px, 12vw, 76px); }
  .game[data-role="driver"] .cd-row { min-height: 64px; }
  .game[data-role="driver"] .cd { font-size: clamp(46px, 13vw, 74px); }
  .game[data-role="monster"] .dial-wrap { width: min(52%, 24vh); }
  .game[data-role="monster"] .pad { width: min(52vw, 186px); }
  .caught { min-height: 68px; }
  .game[data-role="monster"] .cd { font-size: 24px; }
}

@media (max-height: 560px) {
  .panel { max-width: 940px; }
  .rule-bar { height: 34px; flex-basis: 34px; margin-bottom: 6px; }
  .game { gap: 5px; }
  .game[data-role="driver"] .cd-row { min-height: 44px; }
  .game[data-role="driver"] .cd { font-size: 42px; }
  .game[data-role="driver"] .cd-side { bottom: 0; }
  .dial-stage { min-height: 0; }
  .game[data-role="driver"] .dial-wrap { width: min(100%, 40vh); }
  .game[data-role="navigator"] .dial-wrap { width: min(76%, 38vh); }
  .game[data-role="solo"] .dial-wrap { width: min(64%, 32vh); }
  .game[data-role="monster"] .dial-wrap { width: min(40%, 20vh); }
  .game[data-role="monster"] .pad { width: min(34vw, 150px); gap: 6px; }
  .game[data-role="monster"] .cd { font-size: 22px; }
  .caught { min-height: 56px; }
  .caught-label { font-size: 32px; }
  .plate.scare { min-height: 46px; }
  .plate.stun { min-height: 56px; }
  .walk { min-height: 20px; }
  .setup-dial { display: none; }
  .home-dial { display: none; }
  .create-dial { display: none; }
  .home-head { padding-top: 0; }
  .home-title { font-size: clamp(40px, 10vw, 64px); }
  .create-head { padding-top: 0; }
  .create-head .display { font-size: clamp(34px, 7vw, 50px); }
  .join-head { padding-top: 2vh; }
  .lobby-head { padding-top: 1vh; }
}

@media (orientation: landscape) and (max-height: 560px) {
  .panel {
    max-width: none;
    padding-left: max(14px, env(safe-area-inset-left));
    padding-right: max(14px, env(safe-area-inset-right));
  }
  .game {
    display: grid;
    grid-template-columns: minmax(0, 46%) minmax(0, 1fr);
    column-gap: 18px;
    row-gap: 6px;
  }
  .dial-stage {
    grid-column: 1;
    grid-row: 1 / 7;
  }
  .game[data-role="driver"] .dial-wrap,
  .game[data-role="navigator"] .dial-wrap,
  .game[data-role="solo"] .dial-wrap { width: min(100%, 66vh); }
  .game[data-role="driver"] { grid-template-rows: auto auto auto 1fr auto auto; }
  .game[data-role="driver"] .cd-row { grid-column: 2; grid-row: 1; min-height: 0; }
  .game[data-role="driver"] .cd { font-size: 54px; }
  .game[data-role="driver"] .readouts { grid-column: 2; grid-row: 2; }
  .game[data-role="driver"] .walk { grid-column: 2; grid-row: 3; }
  .game[data-role="driver"] .game-hint { grid-column: 2; grid-row: 5; }
  .game[data-role="driver"] .test-bar { grid-column: 2; grid-row: 6; }

  .game[data-role="navigator"] { grid-template-rows: auto auto 1fr auto auto; }
  .game[data-role="navigator"] .cd-row { grid-column: 2; grid-row: 1; }
  .game[data-role="navigator"] .readouts { grid-column: 2; grid-row: 2; }
  .game[data-role="navigator"] .plate.stun { grid-column: 2; grid-row: 3; align-self: center; }
  .game[data-role="navigator"] .game-hint { grid-column: 2; grid-row: 4; }

  .game[data-role="solo"] { grid-template-rows: auto auto auto auto auto auto; }
  .game[data-role="solo"] .cd-row { grid-column: 2; grid-row: 1; }
  .game[data-role="solo"] .readouts { grid-column: 2; grid-row: 2; }
  .game[data-role="solo"] .walk { grid-column: 2; grid-row: 3; }
  .game[data-role="solo"] .plate.stun { grid-column: 2; grid-row: 4; min-height: 58px; }
  .game[data-role="solo"] .game-hint { grid-column: 2; grid-row: 5; }
  .game[data-role="solo"] .test-bar { grid-column: 2; grid-row: 6; }

  .game[data-role="monster"] {
    grid-template-columns: minmax(0, 44%) minmax(0, 1fr);
    grid-template-rows: auto auto auto auto auto auto;
    align-content: start;
  }
  .game[data-role="monster"] .cd-row { grid-column: 1 / 3; grid-row: 1; min-height: 0; }
  .game[data-role="monster"] .dial-stage { grid-column: 1; grid-row: 2 / 6; }
  .game[data-role="monster"] .monster-head { grid-column: 2; grid-row: 2; }
  .game[data-role="monster"] .pad { grid-column: 2; grid-row: 3; width: min(35vw, 138px); align-self: start; gap: 6px; }
  .game[data-role="monster"] .scare-row { grid-column: 2; grid-row: 4; }
  .game[data-role="monster"] .caught { grid-column: 1 / 3; grid-row: 6; min-height: 52px; }
  .game[data-role="monster"] .game-hint { grid-column: 2; grid-row: 5; }
  .game[data-role="monster"] .test-bar { display: none; }
  .game[data-role="monster"] .dial-wrap { width: min(100%, 54vh); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; }
}
