/* ==========================================================================
   LOCKED IN — style
   Art Deco vault at night. One system everywhere:
     · surfaces  = translucent ink panels with a double gold rule (.deco)
     · type      = Limelight (display, numerals) + Josefin Sans (UI, body)
     · numbering = brass plates (boxes, answers, steps, milestones)
     · icons     = one 24px line sprite, 1.8 stroke
   Gold / silver / bronze / ruby are reserved for scoring.
   ========================================================================== */

:root {
  color-scheme: dark;

  /* Finish: Midnight (default) */
  --ink-0: #050913;
  --ink-1: #0A1120;
  --ink-2: #0F182B;
  --ink-3: #152038;
  --ink-4: #1F2C49;
  --ink-0-rgb: 5, 9, 19;
  --ink-1-rgb: 10, 17, 32;
  --ink-2-rgb: 15, 24, 43;
  --ink-3-rgb: 21, 32, 56;
  --orn: #D9B25F;
  --orn-hi: #F5DDA0;
  --orn-lo: #94702E;
  --orn-rgb: 217, 178, 95;
  --metal: linear-gradient(180deg, #FCE8B2 0%, #E8C470 38%, #C8963F 74%, #A87A2E 100%);
  --metal-ink: #1E1405;

  --ivory: #EEE5D1;
  --ivory-2: #BDB5A3;
  --muted: #8F98AD;
  --dim: #5E6881;

  /* Reserved for scoring: the five kinds of loot */
  --t-diamond: #8FD8FF; --t-diamond-rgb: 143, 216, 255;
  --t-gold: #F2C14E; --t-gold-rgb: 242, 193, 78;
  --t-silver: #C9D3DF; --t-silver-rgb: 201, 211, 223;
  --t-key: #C98A52; --t-key-rgb: 201, 138, 82;
  --t-cobweb: #6E7891; --t-cobweb-rgb: 110, 120, 145;
  --gold: var(--t-gold);
  --gold-rgb: var(--t-gold-rgb);
  --ruby: #E5484D;
  --ruby-rgb: 229, 72, 77;

  --rule: rgba(var(--orn-rgb), 0.42);
  --rule-soft: rgba(var(--orn-rgb), 0.17);
  --rule-faint: rgba(var(--orn-rgb), 0.08);
  --panel: rgba(var(--ink-2-rgb), 0.86);
  --panel-solid: var(--ink-2);

  /* Limelight's zero reads as "◐", so a one-glyph Abril Fatface subset supplies 0. */
  --display: "Abril Fatface", "Limelight", Georgia, serif;
  --ui: "Josefin Sans", "Futura", "Century Gothic", ui-sans-serif, system-ui, sans-serif;
  --emoji: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", sans-serif;

  --r: 6px;
  --r-sm: 4px;
  --box-h: clamp(46px, 5.9vh, 58px);
  --door: min(90vw, 46vh, 480px);
  --ease: cubic-bezier(0.2, 0.9, 0.25, 1);
  --spring: cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* ---------- vault finishes (streak rewards) ----------------------------- */

body[data-finish="emerald"] {
  --ink-0: #030E0B; --ink-1: #06171A; --ink-2: #0A211F; --ink-3: #0F2D29; --ink-4: #173F39;
  --ink-0-rgb: 3, 14, 11; --ink-1-rgb: 6, 23, 26; --ink-2-rgb: 10, 33, 31; --ink-3-rgb: 15, 45, 41;
}
body[data-finish="oxblood"] {
  --ink-0: #0E0406; --ink-1: #19090D; --ink-2: #220E13; --ink-3: #2D141B; --ink-4: #3F1D26;
  --ink-0-rgb: 14, 4, 6; --ink-1-rgb: 25, 9, 13; --ink-2-rgb: 34, 14, 19; --ink-3-rgb: 45, 20, 27;
  --orn: #E2A47A; --orn-hi: #F8D2B4; --orn-lo: #9A5C3B; --orn-rgb: 226, 164, 122;
  --metal: linear-gradient(180deg, #FFE0C8 0%, #EDB48C 38%, #C98257 74%, #A2613B 100%);
  --metal-ink: #2A1208;
}
body[data-finish="noir"] {
  --ink-0: #040404; --ink-1: #0A0A0B; --ink-2: #111113; --ink-3: #18181B; --ink-4: #26262A;
  --ink-0-rgb: 4, 4, 4; --ink-1-rgb: 10, 10, 11; --ink-2-rgb: 17, 17, 19; --ink-3-rgb: 24, 24, 27;
  --orn: #E6DCC6; --orn-hi: #FFF8EA; --orn-lo: #8F8778; --orn-rgb: 230, 220, 198;
  --metal: linear-gradient(180deg, #FFFFFF 0%, #EFE7D6 40%, #CFC4AE 75%, #ADA28C 100%);
  --metal-ink: #141210;
}

/* ---------- base -------------------------------------------------------- */

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; background: var(--ink-0); }
body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--ink-1);
  color: var(--ivory);
  font-family: var(--ui);
  font-size: 15px;
  line-height: 1.6;
  letter-spacing: 0.01em;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  transition: background-color 0.4s;
}
button { font: inherit; color: inherit; }
a { color: inherit; }
[hidden] { display: none !important; }
:focus { outline: none; }
:focus-visible { outline: 2px solid var(--orn-hi); outline-offset: 3px; }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.ic { width: 20px; height: 20px; flex: none; display: block; }
.emo { font-family: var(--emoji); line-height: 1; font-style: normal; }
.noscript { position: relative; z-index: 2; text-align: center; padding: 40px; }

.kicker {
  font-family: var(--ui); font-weight: 600; font-size: 10.5px; line-height: 1.3;
  letter-spacing: 0.3em; text-transform: uppercase; color: var(--orn);
}
.deco-title {
  margin: 4px 0 0; font-family: var(--display); font-weight: 400;
  font-size: 24px; line-height: 1.05; letter-spacing: 0.03em; color: var(--ivory);
}

/* ---------- the scene (background) -------------------------------------- */

.scene {
  position: fixed; inset: 0; z-index: 0; overflow: hidden; pointer-events: none;
  background: radial-gradient(130% 90% at 50% 0%, var(--ink-2) 0%, var(--ink-1) 42%, var(--ink-0) 100%);
}
.topbar, #app { position: relative; z-index: 1; }

/* Deco sunburst fanning down from the top edge */
.scene-sunburst {
  position: absolute; left: 50%; top: -100vmax; width: 200vmax; height: 200vmax; margin-left: -100vmax;
  background: repeating-conic-gradient(from 0deg, rgba(var(--orn-rgb), 0.06) 0deg 1.6deg, transparent 1.6deg 7.5deg);
  -webkit-mask-image: radial-gradient(circle at 50% 50%, #000 0%, rgba(0, 0, 0, 0.55) 22%, transparent 46%);
  mask-image: radial-gradient(circle at 50% 50%, #000 0%, rgba(0, 0, 0, 0.55) 22%, transparent 46%);
}

/* A wall of safe-deposit boxes, fading out toward the centre
   (quieter during play, so the real boxes stay the focus) */
body[data-screen="game"] .scene-wall { opacity: 0.5; }
.scene-wall {
  position: absolute; inset: 0; transition: opacity 0.6s;
  -webkit-mask-image: radial-gradient(ellipse 72% 62% at 50% 42%, transparent 30%, rgba(0, 0, 0, 0.85) 92%);
  mask-image: radial-gradient(ellipse 72% 62% at 50% 42%, transparent 30%, rgba(0, 0, 0, 0.85) 92%);
}
.scene-wall-boxes {
  position: absolute; inset: 0;
  background-color: rgba(var(--orn-rgb), 0.12);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='104' height='68' viewBox='0 0 104 68'%3E%3Crect x='3' y='3' width='98' height='62' rx='3' fill='none' stroke='black' stroke-width='1.4'/%3E%3Crect x='7' y='7' width='90' height='54' rx='2' fill='none' stroke='black' stroke-opacity='.4'/%3E%3Crect x='42' y='13' width='20' height='8' rx='1.5'/%3E%3Ccircle cx='52' cy='38' r='3.4'/%3E%3Cpath d='M50.5 40h3l1.4 8.5h-5.8z'/%3E%3C/svg%3E") 0 0 / 104px 68px repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='104' height='68' viewBox='0 0 104 68'%3E%3Crect x='3' y='3' width='98' height='62' rx='3' fill='none' stroke='black' stroke-width='1.4'/%3E%3Crect x='7' y='7' width='90' height='54' rx='2' fill='none' stroke='black' stroke-opacity='.4'/%3E%3Crect x='42' y='13' width='20' height='8' rx='1.5'/%3E%3Ccircle cx='52' cy='38' r='3.4'/%3E%3Cpath d='M50.5 40h3l1.4 8.5h-5.8z'/%3E%3C/svg%3E") 0 0 / 104px 68px repeat;
}

.scene-dust { position: absolute; inset: 0; }
.scene-dust i {
  position: absolute; bottom: -12px; border-radius: 50%;
  background: var(--orn-hi); box-shadow: 0 0 6px rgba(var(--orn-rgb), 0.9);
  animation: dustRise linear infinite;
}
@keyframes dustRise {
  from { transform: translate3d(0, 0, 0); }
  to { transform: translate3d(var(--drift, 0), -112vh, 0); }
}
.scene-vignette {
  position: absolute; inset: 0;
  background: radial-gradient(ellipse 90% 80% at 50% 40%, transparent 55%, rgba(0, 0, 0, 0.55) 100%);
}

/* ---------- shared surfaces --------------------------------------------- */

.deco {
  position: relative;
  background: var(--panel);
  border: 1px solid var(--rule);
  border-radius: var(--r);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
}
.deco::before {
  content: ""; position: absolute; inset: 4px; pointer-events: none;
  border: 1px solid var(--rule-soft); border-radius: calc(var(--r) - 3px);
}
/* Stepped Deco corners in gold, drawn with masks so every finish re-tints them */
.corners::after {
  content: ""; position: absolute; inset: -1px; pointer-events: none; background: var(--orn);
  -webkit-mask:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18'%3E%3Cpath d='M1 17V9h4V5h4V1h8' fill='none' stroke='black' stroke-width='2'/%3E%3C/svg%3E") top left / 18px no-repeat,
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18'%3E%3Cpath d='M17 17V9h-4V5H9V1H1' fill='none' stroke='black' stroke-width='2'/%3E%3C/svg%3E") top right / 18px no-repeat,
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18'%3E%3Cpath d='M1 1v8h4v4h4v4h8' fill='none' stroke='black' stroke-width='2'/%3E%3C/svg%3E") bottom left / 18px no-repeat,
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18'%3E%3Cpath d='M17 1v8h-4v4H9v4H1' fill='none' stroke='black' stroke-width='2'/%3E%3C/svg%3E") bottom right / 18px no-repeat;
  mask:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18'%3E%3Cpath d='M1 17V9h4V5h4V1h8' fill='none' stroke='black' stroke-width='2'/%3E%3C/svg%3E") top left / 18px no-repeat,
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18'%3E%3Cpath d='M17 17V9h-4V5H9V1H1' fill='none' stroke='black' stroke-width='2'/%3E%3C/svg%3E") top right / 18px no-repeat,
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18'%3E%3Cpath d='M1 1v8h4v4h4v4h8' fill='none' stroke='black' stroke-width='2'/%3E%3C/svg%3E") bottom left / 18px no-repeat,
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18'%3E%3Cpath d='M17 1v8h-4v4H9v4H1' fill='none' stroke='black' stroke-width='2'/%3E%3C/svg%3E") bottom right / 18px no-repeat;
}

/* Brass number plate: boxes, answers, steps, milestones */
.plate {
  display: inline-grid; place-items: center; min-width: 34px; height: 28px; padding: 3px 7px 0;
  border-radius: 3px; background: var(--metal); color: var(--metal-ink);
  font-family: var(--display); font-size: 18px; line-height: 1;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.55), inset 0 -1px 0 rgba(0, 0, 0, 0.2), 0 1px 3px rgba(0, 0, 0, 0.5);
}

.chip {
  display: inline-block; padding: 5px 9px 2px; border-radius: 3px;
  background: var(--metal); color: var(--metal-ink);
  font-family: var(--display); font-size: 15px; line-height: 1; word-spacing: 0.18em; white-space: nowrap;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.5);
}

/* Loot token: a round deposit-box coin ringed in the tier's colour */
.loot {
  --loot: var(--t-cobweb); --loot-rgb: var(--t-cobweb-rgb);
  display: inline-grid; place-items: center; flex: none; width: 28px; height: 28px; border-radius: 50%;
  background:
    radial-gradient(circle at 35% 28%, rgba(255, 255, 255, 0.16), transparent 55%),
    radial-gradient(circle, rgba(var(--loot-rgb), 0.2) 0 60%, rgba(var(--ink-0-rgb), 0.9) 62%);
  box-shadow: inset 0 0 0 1.5px var(--loot), 0 2px 6px rgba(0, 0, 0, 0.45);
}
.loot .emo { font-size: 15px; }
.loot-diamond { --loot: var(--t-diamond); --loot-rgb: var(--t-diamond-rgb); }
.loot-gold { --loot: var(--t-gold); --loot-rgb: var(--t-gold-rgb); }
.loot-silver { --loot: var(--t-silver); --loot-rgb: var(--t-silver-rgb); }
.loot-key { --loot: var(--t-key); --loot-rgb: var(--t-key-rgb); }
.loot-cobweb { --loot: var(--t-cobweb); --loot-rgb: var(--t-cobweb-rgb); }
.loot-cobweb .emo { opacity: 0.75; }

.rule-div {
  display: flex; align-items: center; gap: 12px; margin: 26px 0 14px;
  color: var(--orn); font-weight: 600; font-size: 10px; letter-spacing: 0.32em; text-transform: uppercase;
}
.rule-div::before, .rule-div::after { content: ""; flex: 1; height: 1px; }
.rule-div::before { background: linear-gradient(90deg, transparent, var(--rule)); }
.rule-div::after { background: linear-gradient(90deg, var(--rule), transparent); }

/* ---------- buttons ----------------------------------------------------- */

.btn {
  position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  width: 100%; min-height: 50px; padding: 4px 20px 0; border: 0; border-radius: var(--r-sm);
  font-family: var(--ui); font-weight: 600; font-size: 13px; letter-spacing: 0.26em; text-transform: uppercase;
  cursor: pointer; text-decoration: none;
  transition: transform 0.12s var(--ease), filter 0.15s, box-shadow 0.15s, background 0.2s, color 0.2s;
}
.btn .ic { width: 19px; height: 19px; margin-top: -3px; }
.btn:active:not(:disabled) { transform: scale(0.98); }

.btn-gold {
  background: var(--metal); color: var(--metal-ink);
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.35);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.6), inset 0 -2px 0 rgba(0, 0, 0, 0.2), 0 10px 30px rgba(var(--orn-rgb), 0.22);
}
.btn-gold:hover:not(:disabled) { filter: brightness(1.07); }
.btn-gold:disabled {
  background: rgba(var(--ink-2-rgb), 0.92); color: var(--muted); text-shadow: none; cursor: default;
  box-shadow: inset 0 0 0 1px var(--rule-soft);
}

.btn-line {
  background: rgba(var(--orn-rgb), 0.05); color: var(--orn-hi);
  box-shadow: inset 0 0 0 1px var(--rule);
}
.btn-line::before {
  content: ""; position: absolute; inset: 4px; border: 1px solid var(--rule-faint); border-radius: 2px; pointer-events: none;
}
.btn-line:hover { background: rgba(var(--orn-rgb), 0.11); }
.btn-sm { min-height: 40px; font-size: 11.5px; letter-spacing: 0.22em; padding: 3px 14px 0; }

.icon-btn {
  position: relative; width: 42px; height: 42px; display: grid; place-items: center; flex: none;
  border-radius: var(--r-sm); border: 1px solid var(--rule); background: rgba(var(--ink-2-rgb), 0.72);
  color: var(--orn); cursor: pointer; transition: background 0.15s, color 0.15s;
}
.icon-btn:hover { background: rgba(var(--orn-rgb), 0.1); color: var(--orn-hi); }
#btn-sound .snd-off { display: none; }
#btn-sound[aria-pressed="false"] .snd-on { display: none; }
#btn-sound[aria-pressed="false"] .snd-off { display: block; }

.link-row { display: flex; justify-content: center; gap: 8px; flex-wrap: wrap; margin-top: 16px; }
.link-row .btn { width: auto; }

/* ---------- top bar ----------------------------------------------------- */

.topbar {
  display: flex; align-items: center; gap: 10px;
  height: 64px; max-width: 1120px; margin: 0 auto; padding: 0 16px;
}
.brand {
  margin-right: auto; display: inline-flex; align-items: center; gap: 9px;
  background: none; border: 0; padding: 6px 4px; cursor: pointer;
  font-family: var(--display); font-size: 20px; line-height: 1; color: var(--ivory); letter-spacing: 0.04em;
  transition: opacity 0.3s;
}
.brand .ic { width: 18px; height: 18px; color: var(--orn); margin-top: -4px; }
body[data-screen="lobby"] .brand { opacity: 0; pointer-events: none; }
.topbar-right { display: flex; gap: 8px; }

.streak-chip {
  display: inline-flex; align-items: center; gap: 6px; height: 42px; padding: 0 12px 0 10px;
  border-radius: var(--r-sm); border: 1px solid var(--rule); background: rgba(var(--ink-2-rgb), 0.72);
  color: var(--ivory); cursor: pointer; font-family: var(--display); font-size: 17px; line-height: 1;
}
.streak-chip .ic { color: var(--muted); }
.streak-chip b { font-weight: 400; padding-top: 3px; }
.streak-chip.is-live .ic { color: var(--orn-hi); filter: drop-shadow(0 0 6px rgba(var(--orn-rgb), 0.8)); }
/* The streak flame flickers (faster once today's vault is cracked) */
.streak-chip .ic, .streak-hero .ic { transform-origin: 50% 88%; animation: flameFlicker 2.6s ease-in-out infinite; }
.streak-chip.is-live .ic, .streak-hero .ic { animation-duration: 1.4s; }
@keyframes flameFlicker {
  0%, 100% { transform: scale(1, 1) rotate(0deg); }
  20% { transform: scale(1.06, 0.95) rotate(-4deg); }
  45% { transform: scale(0.95, 1.08) rotate(3deg); }
  70% { transform: scale(1.03, 0.97) rotate(-2deg); }
}

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

.lobby { max-width: 500px; margin: 0 auto; padding: 0 16px 56px; text-align: center; }

.lobby-hero {
  position: relative; height: var(--door); margin: 0 auto;
  display: grid; place-items: center;
}
.lobby-door {
  position: absolute; left: 50%; top: 0; width: var(--door); height: var(--door);
  transform: translateX(-50%); transition: transform 0.6s var(--ease), opacity 0.6s;
}
.door-svg { display: block; width: 100%; height: 100%; overflow: visible; filter: drop-shadow(0 26px 50px rgba(0, 0, 0, 0.65)); }
.st-face-a { stop-color: var(--ink-4); }
.st-face-b { stop-color: var(--ink-1); }
.st-hi { stop-color: var(--orn-hi); }
.st-mid { stop-color: var(--orn); }
.st-lo { stop-color: var(--orn-lo); }
.d-frame { fill: none; stroke: rgba(var(--orn-rgb), 0.34); stroke-width: 2; }
.d-frame.soft { stroke: rgba(var(--orn-rgb), 0.14); stroke-width: 1.5; }
.d-body { fill: url(#liDoorFace); stroke: url(#liDoorGold); stroke-width: 9; }
.d-bolt, .d-knob { fill: url(#liDoorGold); }
.d-glint { fill: #fff; opacity: 0.35; }
.d-rule { fill: none; stroke: rgba(var(--orn-rgb), 0.55); stroke-width: 1.6; }
.d-rule.soft { stroke: rgba(var(--orn-rgb), 0.2); stroke-width: 1; }
.d-rays line { stroke: rgba(var(--orn-rgb), 0.26); stroke-width: 1.3; }
.d-plate { fill: var(--ink-1); stroke: url(#liDoorGold); stroke-width: 4; }
.d-dial { animation: dialSpin 140s linear infinite; }
.d-dial line { stroke: rgba(var(--orn-rgb), 0.5); stroke-width: 1; }
.d-dial line.major { stroke: var(--orn); stroke-width: 2.2; }
.d-num { fill: var(--orn); font-family: var(--ui); font-weight: 700; font-size: 11px; text-anchor: middle; dominant-baseline: central; letter-spacing: 0.04em; }
.d-spoke { stroke: url(#liDoorGold); stroke-width: 9; stroke-linecap: round; }
.d-hub-core { fill: var(--ink-1); }
.d-hinge { fill: var(--ink-3); stroke: url(#liDoorGold); stroke-width: 2.5; }
.d-hinge-pin { stroke: rgba(var(--orn-rgb), 0.6); stroke-width: 3; stroke-linecap: round; }
@keyframes dialSpin { to { transform: rotate(360deg); } }

/* Idle: every few seconds someone tests the handle */
.d-wheel { animation: wheelIdle 7s var(--ease) infinite; }
@keyframes wheelIdle {
  0%, 74% { transform: rotate(0); }
  80% { transform: rotate(34deg); }
  86% { transform: rotate(-9deg); }
  91%, 100% { transform: rotate(0); }
}

/* "Crack the vault": dial the combination, turn the wheel, retract the bolts,
   swing the door open on its hinges, and let the light out. */
.lobby-door { transform-origin: 5% 50%; }
.lobby-hero::before {
  content: ""; position: absolute; left: 50%; top: 50%; width: calc(var(--door) * 0.86); aspect-ratio: 1;
  border-radius: 50%; pointer-events: none; opacity: 0; transform: translate(-50%, -50%) scale(0.6);
  background: radial-gradient(circle, rgba(255, 238, 196, 0.6) 0%, rgba(var(--orn-rgb), 0.22) 38%, transparent 70%);
  transition: opacity 0.5s 1s, transform 0.8s 1s var(--ease);
}
.lobby.is-opening .lobby-hero::before { opacity: 1; transform: translate(-50%, -50%) scale(1.3); }
.lobby.is-opening .d-dial { animation: dialCombo 0.95s var(--ease) forwards; }
.lobby.is-opening .d-wheel { animation: wheelOpen 0.8s 0.3s cubic-bezier(0.5, 0, 0.3, 1) both; }
.lobby.is-opening .d-bolts { transform-origin: 0 0; animation: boltsRetract 0.32s 0.95s ease-in both; }
.lobby.is-opening .lobby-door {
  transform: translateX(-50%) perspective(1400px) rotateY(-104deg);
  opacity: 0;
  transition: transform 0.62s cubic-bezier(0.55, 0, 0.6, 1) 1.02s, opacity 0.3s ease-in 1.34s;
}
.lobby.is-opening .lobby-card, .lobby.is-opening .plaque, .lobby.is-opening .tagline, .lobby.is-opening .link-row {
  opacity: 0; transform: translateY(14px); transition: opacity 0.35s, transform 0.35s;
}
@keyframes dialCombo {
  0% { transform: rotate(0); }
  35% { transform: rotate(-250deg); }
  65% { transform: rotate(-110deg); }
  100% { transform: rotate(-330deg); }
}
@keyframes wheelOpen { from { transform: rotate(0); } to { transform: rotate(270deg); } }
@keyframes boltsRetract { to { transform: scale(0.92); } }

.plaque {
  position: relative; z-index: 1; padding: 14px 26px 11px; border-radius: var(--r-sm); overflow: hidden;
  background: var(--ink-1); border: 1px solid var(--rule);
  box-shadow: 0 0 0 4px var(--ink-1), 0 0 0 5px var(--rule-soft), 0 20px 50px rgba(0, 0, 0, 0.7);
}
.wordmark {
  margin: 0; font-family: var(--display); font-weight: 400;
  font-size: clamp(40px, 11vw, 66px); line-height: 0.95; letter-spacing: 0.03em; white-space: nowrap;
  color: var(--orn-hi);
  /* A slow gold shimmer sweeps across the letters every few seconds */
  background: linear-gradient(105deg, var(--orn-lo) 0%, var(--orn) 32%, #FFF4D6 47%, var(--orn) 60%, var(--orn-lo) 100%);
  background-size: 260% 100%; background-position: 100% 0;
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 2px 0 rgba(0, 0, 0, 0.6));
  animation: titleShimmer 7s ease-in-out infinite;
}
@keyframes titleShimmer { 0%, 52% { background-position: 100% 0; } 82%, 100% { background-position: 0% 0; } }
.plaque-sub { margin-top: 8px; font-size: 9.5px; font-weight: 600; letter-spacing: 0.42em; text-transform: uppercase; color: var(--ivory-2); }
/* ...and a glint of light crosses the nameplate in time with it */
.plaque::after {
  content: ""; position: absolute; top: -50%; bottom: -50%; left: -40%; width: 26%; pointer-events: none;
  background: linear-gradient(90deg, transparent, rgba(255, 244, 214, 0.13), transparent);
  transform: skewX(-18deg); animation: plaqueGlint 7s ease-in-out infinite;
}
@keyframes plaqueGlint { 0%, 52% { left: -40%; } 82%, 100% { left: 130%; } }
.tagline { margin: 24px auto 26px; max-width: 320px; color: var(--muted); font-size: 13.5px; line-height: 1.75; letter-spacing: 0.03em; }

.lobby-card { text-align: left; padding: 28px 26px 24px; transition: opacity 0.35s, transform 0.35s; }
.lc-top { display: flex; align-items: center; gap: 10px; }
.lc-date { color: var(--muted); font-size: 12px; letter-spacing: 0.06em; padding-top: 3px; }
.lc-label { margin-top: 24px; }
.lc-cat { margin-top: 8px; font-family: var(--display); font-size: clamp(30px, 8vw, 38px); line-height: 1; letter-spacing: 0.02em; color: var(--ivory); }
.lc-q { margin: 12px 0 24px; color: var(--ivory-2); font-size: 14px; line-height: 1.65; }
.lc-q b { color: var(--ivory); font-weight: 600; }

.lc-facts { list-style: none; margin: 0 0 22px; padding: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.lc-facts li {
  padding: 13px 4px 11px; text-align: center; border-radius: var(--r-sm);
  background: rgba(var(--ink-0-rgb), 0.55); border: 1px solid var(--rule-soft);
  font-size: 9.5px; font-weight: 600; letter-spacing: 0.2em; text-transform: uppercase; color: var(--muted); white-space: nowrap;
}
.lc-facts b { display: block; margin-bottom: 5px; font-family: var(--display); font-weight: 400; font-size: 21px; line-height: 1; letter-spacing: 0; color: var(--orn-hi); }

.lc-status {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 0 0 14px;
  padding: 12px 14px 10px; border-radius: var(--r-sm); background: rgba(var(--ink-0-rgb), 0.55); border: 1px solid var(--rule-soft);
}
.lc-status .big { font-family: var(--display); font-size: 30px; line-height: 1; color: var(--ivory); }
.lc-status .big small { font-size: 15px; color: var(--muted); }
.lc-status .right { text-align: right; font-size: 13px; color: var(--muted); }
.lc-status .right b { display: block; color: var(--ivory); font-size: 15px; }
.lc-status .medal-row { justify-content: flex-start; margin-top: 6px; }
.lc-players { margin: 16px 0 0; text-align: center; font-size: 11.5px; color: var(--muted); letter-spacing: 0.06em; }
.lc-players b { color: var(--orn-hi); font-family: var(--display); font-weight: 400; font-size: 14px; }
.lc-players .live { display: inline-block; width: 7px; height: 7px; margin: 0 7px 1px 0; border-radius: 50%; background: var(--gold); box-shadow: 0 0 8px rgba(var(--gold-rgb), 0.9); animation: livePulse 1.8s ease-in-out infinite; }
@keyframes livePulse { 50% { opacity: 0.35; } }
.rerun-note { margin: 14px 0 0; font-size: 14px; color: var(--muted); }

/* ---------- game layout ------------------------------------------------- */

.game {
  max-width: 540px; margin: 0 auto; padding: 0 16px calc(112px + env(safe-area-inset-bottom));
  display: grid; gap: 18px;
}
body.is-done .game { padding-bottom: 56px; }

.vault-meta .vm-row { display: flex; align-items: center; gap: 10px; }
.vm-cat { font-family: var(--display); font-size: 21px; letter-spacing: 0.02em; line-height: 1; padding-top: 3px; }
.vm-tag {
  margin-left: auto; padding: 4px 8px 2px; border-radius: 3px; border: 1px solid var(--rule);
  font-size: 10.5px; font-weight: 700; letter-spacing: 0.2em; text-transform: uppercase; color: var(--orn);
}
.vm-today { margin-left: auto; background: none; border: 0; padding: 4px 0; cursor: pointer; color: var(--orn-hi); font-weight: 700; font-size: 12px; letter-spacing: 0.16em; text-transform: uppercase; }
.vm-q { margin: 10px 0 16px; color: var(--muted); font-size: 13.5px; letter-spacing: 0.02em; }
.vm-q b { color: var(--ivory); }

/* The valuable on offer, inside its timer dial */
.valuable {
  display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 18px; align-items: center;
  padding: 18px 18px 20px;
  background:
    radial-gradient(circle at 72px 50%, rgba(var(--orn-rgb), 0.14), transparent 140px),
    var(--panel);
}
.valuable.enter { animation: dealIn 0.5s var(--ease) both; }
@keyframes dealIn {
  from { transform: translateY(20px) scale(0.96) rotate(-1.2deg); opacity: 0; }
  to { transform: none; opacity: 1; }
}
.dial { position: relative; width: 110px; height: 110px; flex: none; }
.dial-svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.dial .emo { position: absolute; inset: 0; display: grid; place-items: center; font-size: 46px; }
.dial-secs {
  position: absolute; left: 50%; bottom: -9px; transform: translateX(-50%);
  min-width: 44px; padding: 4px 9px 1px; border-radius: 999px; text-align: center;
  background: var(--ink-1); border: 1px solid var(--rule); color: var(--orn-hi);
  font-family: var(--display); font-size: 13px; line-height: 1.1; font-variant-numeric: tabular-nums;
}
.t-rim { fill: rgba(var(--ink-0-rgb), 0.6); stroke: var(--rule); stroke-width: 1; }
/* The combination bezel clicks round one notch-pair per second (spring = the "click") */
.t-bezel { transform-origin: 60px 60px; transition: transform 0.42s var(--spring); }
.valuable.enter .t-bezel { animation: bezelIn 0.9s var(--ease) backwards; }
@keyframes bezelIn { from { transform: rotate(210deg); } }
.t-notch { stroke: rgba(var(--orn-rgb), 0.5); stroke-width: 1.3; stroke-linecap: round; transition: stroke 0.3s; }
.t-notch.major { stroke: var(--orn); stroke-width: 2.4; }
.t-pointer { fill: var(--orn-hi); transition: fill 0.3s; }
.t-track { fill: none; stroke: rgba(var(--orn-rgb), 0.13); stroke-width: 5; }
.t-arc { fill: none; stroke: var(--orn-hi); stroke-width: 5; stroke-linecap: round; transition: stroke 0.3s; }
.t-face { fill: var(--ink-2); stroke: var(--rule-soft); }
.dial.is-urgent .t-arc, .dial.is-urgent .t-notch { stroke: var(--ruby); }
.dial.is-urgent .t-pointer { fill: var(--ruby); }
.dial.is-urgent .dial-secs { color: #fff; background: var(--ruby); border-color: var(--ruby); animation: urgent 1s steps(2) infinite; }
@keyframes urgent { 50% { box-shadow: 0 0 0 4px rgba(var(--ruby-rgb), 0.3); } }

.val-top { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 10px; margin-bottom: 10px; }
.val-top .kicker { white-space: nowrap; }
.val-name {
  margin: 0 0 6px; font-family: var(--display); font-weight: 400;
  font-size: clamp(22px, 6vw, 28px); line-height: 1.1; letter-spacing: 0.02em; color: var(--ivory); overflow-wrap: anywhere;
}
.val-hint { margin: 0; color: var(--muted); font-size: 13.5px; letter-spacing: 0.02em; }
.pips { display: flex; gap: 4px; }
.pip { width: 12px; height: 4px; border-radius: 2px; background: var(--rule-soft); }
.pip.done { background: var(--orn); }
.pip.now { background: var(--ivory); }

.panel-card { padding: 20px; }
.panel-card.enter { animation: dealIn 0.45s var(--ease) both; }
.ready-card { text-align: center; padding: 24px 20px; }
.ready-card .locks { display: flex; justify-content: center; gap: 6px; margin-bottom: 12px; color: var(--orn); }
.ready-card .locks .ic { width: 18px; height: 18px; }
.ready-card h2, .reveal-card h2 { margin: 0; font-family: var(--display); font-weight: 400; font-size: 25px; line-height: 1.05; }
.ready-card p { margin: 10px 0 0; color: var(--ivory-2); }
.reveal-card { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 16px; }
.reveal-card h2 { margin-top: 6px; }
/* The vault wheel turns a notch per opened box, then swings the vault open */
.reveal-wheel { width: 66px; height: 66px; filter: drop-shadow(0 6px 14px rgba(0, 0, 0, 0.5)); }
.wheel-svg { display: block; width: 100%; height: 100%; }
.w-ring { fill: rgba(var(--ink-0-rgb), 0.55); stroke: var(--orn); stroke-width: 2.5; }
.w-stud { fill: var(--orn); opacity: 0.75; }
.w-turn { transform-origin: 50px 50px; transition: transform 0.5s var(--spring); }
.w-spoke { stroke: var(--orn-hi); stroke-width: 5; stroke-linecap: round; }
.w-knob { fill: var(--orn-hi); }
.w-core { fill: var(--ink-1); }
.running { font-family: var(--display); font-size: 46px; line-height: 0.85; color: var(--ivory); font-variant-numeric: tabular-nums; }
.running small { font-size: 17px; color: var(--muted); }
.running .bump { display: inline-block; animation: bump 0.3s var(--spring); }
@keyframes bump { 0% { transform: scale(1.3); color: var(--orn-hi); } 100% { transform: none; } }

/* ---------- action bar -------------------------------------------------- */

.actionbar { margin-top: 14px; }
.actionbar .key {
  position: absolute; right: 14px; top: 50%; transform: translateY(-50%);
  padding: 3px 6px 1px; border-radius: 3px; border: 1px solid currentColor; opacity: 0.5;
  font-size: 11px; letter-spacing: 0.06em;
}
body.is-done .actionbar { display: none; }

/* ---------- the deposit boxes ------------------------------------------- */

.board-end {
  display: flex; align-items: center; gap: 10px; margin: 0 0 9px;
  font-size: 10px; font-weight: 600; letter-spacing: 0.32em; text-transform: uppercase; color: var(--orn);
}
.board-end::after { content: ""; flex: 1; height: 1px; background: linear-gradient(90deg, var(--rule), transparent); }
.board-end.bottom { margin: 9px 0 0; }
.board-end .ic { width: 11px; height: 11px; }

.boxes { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.box {
  position: relative; width: 100%; min-height: var(--box-h);
  display: grid; grid-template-columns: 56px minmax(0, 1fr) auto; align-items: center;
  padding: 0 12px 0 0; border-radius: var(--r-sm); text-align: left; cursor: pointer;
  background: linear-gradient(180deg, rgba(var(--ink-3-rgb), 0.9), rgba(var(--ink-2-rgb), 0.9));
  border: 1px solid var(--rule-soft);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.035), 0 2px 0 rgba(0, 0, 0, 0.3);
  transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
}
.box .plate { justify-self: center; min-width: 30px; height: 24px; font-size: 15px; }
.box .content { display: flex; align-items: center; gap: 10px; min-width: 0; }
.box .emo { font-size: 24px; flex: none; }
.box .txt { display: flex; flex-direction: column; min-width: 0; padding-top: 3px; }
.box .nm { font-weight: 500; font-size: 14px; letter-spacing: 0.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.box .val { font-size: 11.5px; color: var(--ivory-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.box .empty { font-size: 10.5px; font-weight: 600; letter-spacing: 0.26em; text-transform: uppercase; color: var(--dim); padding-top: 3px; }
.box .empty .on-hover { display: none; }
.box .kh { width: 18px; height: 18px; color: rgba(var(--orn-rgb), 0.3); }
.box .lock { width: 18px; height: 18px; color: var(--orn); }
.box .lock .shackle { transform-box: fill-box; transform-origin: 50% 100%; }

.box.is-empty .plate { background: transparent; color: var(--orn); box-shadow: inset 0 0 0 1px var(--rule); }
body.is-playing .box.is-empty:hover { border-color: var(--rule); background: linear-gradient(180deg, rgba(var(--orn-rgb), 0.09), rgba(var(--ink-2-rgb), 0.9)); }
@media (hover: hover) {
  body.is-playing .box.is-empty:hover .empty .idle { display: none; }
  body.is-playing .box.is-empty:hover .empty .on-hover { display: inline; color: var(--orn-hi); }
}
body:not(.is-playing) .box { cursor: default; }

.box.is-filled { border-color: var(--rule); color: var(--ivory); }
.box.is-selected {
  border-color: var(--orn-hi); color: var(--ivory);
  background: linear-gradient(180deg, rgba(var(--orn-rgb), 0.16), rgba(var(--ink-2-rgb), 0.92));
  box-shadow: 0 0 0 1px var(--orn-hi), 0 0 26px rgba(var(--orn-rgb), 0.28);
  animation: selectGlow 1.6s ease-in-out infinite;
}
.box.is-selected .content { opacity: 0.85; }
.box.is-selected .plate { background: var(--metal); color: var(--metal-ink); box-shadow: none; }
.box .tap-hint { font-size: 10px; font-weight: 600; letter-spacing: 0.22em; text-transform: uppercase; color: var(--orn-hi); white-space: nowrap; padding-top: 2px; }
@keyframes selectGlow { 50% { box-shadow: 0 0 0 1px var(--orn-hi), 0 0 34px rgba(var(--orn-rgb), 0.45); } }

.box.just-locked { animation: thunk 0.45s var(--ease); }
.box.just-locked .lock .shackle { animation: shackleDrop 0.45s var(--spring); }
@keyframes thunk {
  0% { transform: scale(1.03); box-shadow: 0 0 0 1px var(--orn-hi), 0 0 40px rgba(var(--orn-rgb), 0.6); }
  45% { transform: scale(0.985); }
  100% { transform: none; }
}
@keyframes shackleDrop { 0% { transform: translateY(-40%); } 100% { transform: translateY(0); } }
.box.denied { animation: shake 0.32s; }
@keyframes shake { 20% { transform: translateX(-5px); } 40% { transform: translateX(5px); } 60% { transform: translateX(-3px); } 80% { transform: translateX(3px); } }
.box .timed-out { width: 14px; height: 14px; color: var(--ruby); margin-left: 4px; }

/* revealed boxes */
.box.flipping { animation: flip 0.5s var(--ease); }
@keyframes flip {
  0% { transform: perspective(700px) rotateX(0); }
  42% { transform: perspective(700px) rotateX(88deg); }
  100% { transform: perspective(700px) rotateX(0); }
}
.box .payout { display: flex; align-items: center; gap: 6px; padding-left: 6px; }
.box .payout .loot { width: 30px; height: 30px; }
.box .payout .loot .emo { font-size: 16px; }
.box .payout b { font-family: var(--display); font-weight: 400; font-size: 15px; line-height: 1; padding-top: 3px; min-width: 22px; }
.box .payout small { display: block; font-family: var(--ui); font-size: 10px; letter-spacing: 0.12em; color: var(--muted); text-transform: uppercase; }
.box.t-diamond { border-color: rgba(var(--t-diamond-rgb), 0.7); background: linear-gradient(90deg, rgba(var(--t-diamond-rgb), 0.16), rgba(var(--ink-2-rgb), 0.9) 70%); }
.box.t-gold { border-color: rgba(var(--t-gold-rgb), 0.7); background: linear-gradient(90deg, rgba(var(--t-gold-rgb), 0.16), rgba(var(--ink-2-rgb), 0.9) 70%); }
.box.t-silver { border-color: rgba(var(--t-silver-rgb), 0.55); background: linear-gradient(90deg, rgba(var(--t-silver-rgb), 0.13), rgba(var(--ink-2-rgb), 0.9) 70%); }
.box.t-key { border-color: rgba(var(--t-key-rgb), 0.6); background: linear-gradient(90deg, rgba(var(--t-key-rgb), 0.14), rgba(var(--ink-2-rgb), 0.9) 70%); }
.box.t-cobweb { border-color: rgba(var(--t-cobweb-rgb), 0.5); background: linear-gradient(90deg, rgba(var(--t-cobweb-rgb), 0.1), rgba(var(--ink-2-rgb), 0.9) 70%); }

/* ---------- the vault report (results) ---------------------------------- */

.report { padding: 22px 20px 20px; }
.report.enter { animation: dealIn 0.5s var(--ease) both; }
.rp-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.rp-head .kicker:last-child { white-space: nowrap; }
.rp-score { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; margin-top: 14px; }
.rp-big { font-family: var(--display); font-size: 62px; line-height: 0.85; color: var(--ivory); letter-spacing: -0.01em; }
.rp-big small { font-size: 21px; color: var(--muted); letter-spacing: 0; }
.rp-title { text-align: right; padding-bottom: 2px; }
.rp-title .t-emoji { font-size: 22px; }
.rp-title .t-name { font-family: var(--display); font-size: 21px; line-height: 1.05; color: var(--orn-hi); }
.rp-title .t-line { margin-top: 4px; font-size: 12px; color: var(--muted); }

.medal-row { display: flex; justify-content: space-between; gap: 4px; margin: 18px 0 10px; }
.medal-row .m { display: flex; flex-direction: column; align-items: center; gap: 3px; flex: 1; }
.medal-row .loot { width: 100%; max-width: 36px; height: auto; aspect-ratio: 1; }
.medal-row .loot .emo { font-size: 17px; }
.medal-row .m small { font-family: var(--display); font-size: 12px; color: var(--muted); }
.medal-row.mini { gap: 3px; margin: 0; justify-content: flex-start; }
.medal-row.mini .loot { width: 18px; height: 18px; max-width: 18px; box-shadow: inset 0 0 0 1px var(--loot); }
.medal-row.mini .loot .emo { font-size: 10px; }

.rp-meta { display: flex; justify-content: center; flex-wrap: wrap; gap: 8px 18px; margin: 2px 0 18px; font-size: 12.5px; color: var(--muted); }
.rp-meta span { display: inline-flex; align-items: center; gap: 6px; }
.rp-meta .ic { width: 15px; height: 15px; color: var(--orn); margin-top: -3px; }
.rp-meta .haul-mini { gap: 10px; }
.rp-meta .loot { width: 20px; height: 20px; }
.rp-meta .loot .emo { font-size: 11px; }

.rank-card { padding: 16px 16px 12px; margin-bottom: 14px; }
.rank-card .rc-top { display: flex; align-items: flex-end; justify-content: space-between; gap: 10px; }
.rc-rank { font-family: var(--display); font-size: 30px; line-height: 0.95; color: var(--ivory); }
.rc-rank small { font-family: var(--ui); font-weight: 600; font-size: 13px; color: var(--muted); letter-spacing: 0.02em; }
.rc-pct { text-align: right; }
.rc-pct b { display: block; font-family: var(--display); font-weight: 400; font-size: 19px; line-height: 1; color: var(--orn-hi); }
.rc-pct span { font-size: 12px; color: var(--muted); }
.rc-caption { margin: 10px 0 0; text-align: center; font-size: 12px; color: var(--muted); letter-spacing: 0.02em; }
.rc-empty { padding: 6px 0; text-align: center; color: var(--ivory-2); font-size: 14px; }
.rc-empty .btn { width: auto; margin-top: 10px; }
.rc-loading { height: 8px; margin: 14px 0; border-radius: 4px; background: linear-gradient(90deg, var(--rule-faint), var(--rule-soft), var(--rule-faint)); background-size: 200% 100%; animation: shimmer 1.2s linear infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }

.skyline { position: relative; margin-top: 14px; }
.skyline-svg { display: block; width: 100%; height: auto; overflow: visible; }
.sk-bar { fill: rgba(var(--orn-rgb), 0.4); }
.sk-bar.is-you { fill: var(--orn-hi); }
.sk-base { stroke: var(--rule); stroke-width: 1; }
.sk-axis { fill: var(--muted); font-family: var(--ui); font-weight: 600; font-size: 10px; text-anchor: middle; }
.sk-you-mark { fill: var(--orn-hi); }
.sk-you-label { fill: var(--ivory); font-family: var(--ui); font-weight: 700; font-size: 9px; letter-spacing: 0.16em; text-anchor: middle; }
.sk-hit { fill: transparent; cursor: pointer; }
.sk-tip {
  position: absolute; z-index: 3; transform: translate(-50%, calc(-100% - 8px)); pointer-events: none;
  padding: 7px 10px 5px; border-radius: var(--r-sm); white-space: nowrap;
  background: var(--ink-1); border: 1px solid var(--rule); box-shadow: 0 8px 20px rgba(0, 0, 0, 0.5);
  font-size: 12.5px; color: var(--ivory);
}
.sk-tip b { color: var(--orn-hi); }

.new-relics { display: flex; align-items: center; gap: 12px; margin: 0 0 14px; padding: 12px 14px 10px; }
.new-relics .nr-list { display: flex; gap: 6px; flex-wrap: wrap; }
.new-relics .nr-text { font-size: 13px; color: var(--ivory-2); }
.new-relics .nr-text b { display: block; color: var(--orn-hi); font-size: 14px; }

.rp-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.rp-actions .btn { padding: 4px 10px 0; letter-spacing: 0.16em; white-space: nowrap; }
.rp-foot {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--rule-soft);
  font-size: 13px; color: var(--muted);
}
.rp-foot b { display: block; font-family: var(--display); font-weight: 400; font-size: 18px; line-height: 1.1; color: var(--ivory); font-variant-numeric: tabular-nums; }
.rp-foot .right { text-align: right; }
.rp-foot .progress { display: block; width: 120px; height: 4px; margin: 6px 0 0 auto; border-radius: 2px; background: var(--rule-soft); overflow: hidden; }
.rp-foot .progress i { display: block; height: 100%; background: var(--orn); }

/* ---------- the real ranking -------------------------------------------- */

.answers { margin-top: 6px; }
.answers-head { display: flex; align-items: center; gap: 14px; margin: 0 0 6px; }
.answers-head h2 { margin: 0; font-family: var(--display); font-weight: 400; font-size: 23px; line-height: 1; }
.answers-head::after { content: ""; flex: 1; height: 1px; background: linear-gradient(90deg, var(--rule), transparent); }
.answers-list { list-style: none; margin: 0; padding: 0; }
.answer {
  display: grid; grid-template-columns: 42px 48px minmax(0, 1fr); gap: 4px 12px; align-items: start;
  padding: 16px 0; border-bottom: 1px solid var(--rule-soft);
}
.answer .plate { margin-top: 10px; min-width: 34px; }
.a-emo {
  width: 48px; height: 48px; border-radius: var(--r-sm); display: grid; place-items: center; font-size: 27px;
  background: rgba(var(--ink-2-rgb), 0.85); border: 1px solid var(--rule-soft);
}
.a-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.a-name { font-weight: 600; font-size: 14.5px; letter-spacing: 0.01em; }
.a-val { font-family: var(--display); font-size: 17px; line-height: 1; color: var(--orn-hi); white-space: nowrap; }
.a-fact { margin: 6px 0 10px; color: var(--muted); font-size: 13px; line-height: 1.65; }
.a-foot { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 12px; font-size: 11.5px; }
.a-you {
  display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px 1px 4px; border-radius: 999px;
  background: rgba(var(--ink-2-rgb), 0.9); border: 1px solid var(--rule-soft); font-weight: 700;
}
.a-you .loot { width: 20px; height: 20px; }
.a-you .loot .emo { font-size: 11px; }
.a-crowd { color: var(--ivory-2); }
.a-crowd b { color: var(--ivory); }
.a-src { color: var(--dim); }
.a-src a { color: var(--muted); text-underline-offset: 3px; }
.a-src a:hover { color: var(--ivory); }
.page-foot { margin: 26px 0 0; text-align: center; font-size: 13px; color: var(--dim); letter-spacing: 0.04em; }
.page-foot button { background: none; border: 0; padding: 0; cursor: pointer; color: var(--muted); text-decoration: underline; text-underline-offset: 3px; }

/* ---------- menu drawer -------------------------------------------------- */

.drawer {
  position: fixed; inset: 0 auto 0 0; margin: 0; padding: 0;
  width: min(390px, 94vw); height: 100%; max-height: none; max-width: none;
  border: 0; border-right: 1px solid var(--rule);
  background:
    radial-gradient(120% 50% at 0% 0%, rgba(var(--orn-rgb), 0.08), transparent 60%),
    var(--ink-1);
  color: var(--ivory); overflow-y: auto;
}
/* While a menu or sheet is open, the page behind it must not scroll
   (otherwise scrolling the rules drags the lobby down underneath). */
html:has(dialog[open]) { overflow: hidden; }
.drawer, .sheet { overscroll-behavior: contain; }
.drawer::backdrop, .sheet::backdrop {
  background: rgba(2, 4, 9, 0.72); -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px);
}
.drawer[open] { animation: drawerIn 0.32s var(--ease); }
@keyframes drawerIn { from { transform: translateX(-100%); } }
.drawer-inner { min-height: 100%; display: flex; flex-direction: column; padding: 18px 18px calc(18px + env(safe-area-inset-bottom)); }
.drawer-head { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 18px; }
.drawer-head .deco-title { font-size: 26px; }
.menu-today { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; align-items: center; padding: 16px 16px 14px; width: 100%; text-align: left; cursor: pointer; color: var(--ivory); }
.menu-today:hover { border-color: var(--orn); }
.menu-today .mt-cat { font-family: var(--display); font-size: 20px; line-height: 1.05; letter-spacing: 0.02em; }
.menu-today .mt-status { grid-column: 1; font-size: 13px; color: var(--ivory-2); }
.menu-today .ic { grid-row: 1 / span 3; grid-column: 2; color: var(--orn); }
.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.tile {
  display: flex; flex-direction: column; align-items: flex-start; gap: 10px; padding: 16px 14px 13px;
  text-align: left; cursor: pointer; color: var(--ivory); transition: border-color 0.15s, background 0.15s;
}
.tile:hover { border-color: var(--orn); background: rgba(var(--orn-rgb), 0.07); }
.tile .ic { width: 22px; height: 22px; color: var(--orn); }
.tile b { font-weight: 600; font-size: 11px; letter-spacing: 0.24em; text-transform: uppercase; }
.tile small { display: block; margin-top: 4px; font-size: 11px; color: var(--muted); letter-spacing: 0.02em; text-transform: none; font-weight: 600; }
.menu-setting {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 8px; padding: 14px 16px 12px;
  width: 100%; cursor: pointer; color: var(--ivory); text-align: left;
}
.menu-setting b { font-weight: 600; font-size: 11px; letter-spacing: 0.24em; text-transform: uppercase; }
.switch { position: relative; width: 44px; height: 24px; border-radius: 999px; border: 1px solid var(--rule); background: rgba(var(--ink-0-rgb), 0.7); flex: none; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: var(--dim); transition: transform 0.2s var(--ease), background 0.2s; }
.switch.on::after { transform: translateX(20px); background: var(--orn-hi); }
.drawer-foot { margin-top: auto; padding-top: 22px; text-align: center; font-size: 10.5px; color: var(--muted); letter-spacing: 0.1em; line-height: 1.8; }
.drawer-foot b { color: var(--ivory-2); }

/* ---------- sheets (archive, streaks, relics, stats, credits, how to) --- */

.sheet {
  width: min(580px, calc(100% - 24px)); max-height: min(88dvh, 860px); padding: 0;
  border: 1px solid var(--rule); border-radius: var(--r);
  background:
    radial-gradient(120% 40% at 50% 0%, rgba(var(--orn-rgb), 0.07), transparent 70%),
    var(--ink-1);
  color: var(--ivory); overflow-y: auto;
  box-shadow: 0 0 0 4px var(--ink-1), 0 0 0 5px var(--rule-soft), 0 40px 90px rgba(0, 0, 0, 0.75);
}
.sheet[open] { animation: sheetIn 0.3s var(--ease); }
@keyframes sheetIn { from { opacity: 0; transform: translateY(18px) scale(0.98); } }
.sheet-inner { padding: 20px 20px 24px; }
.sheet-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.sheet-head .deco-title { font-size: 25px; }
.sheet-lead { margin: -2px 0 18px; color: var(--muted); font-size: 13.5px; line-height: 1.65; }

/* how to play */
.steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 16px; font-size: 14px; line-height: 1.65; }
.steps li { display: grid; grid-template-columns: 40px 1fr; gap: 12px; align-items: start; color: var(--ivory-2); }
.steps .plate { margin-top: -2px; }
.steps b { color: var(--ivory); }
.legend { display: grid; grid-template-columns: 1fr; gap: 5px; margin: 12px 0 0 52px; }
.legend > span {
  display: flex; align-items: center; gap: 8px; padding: 7px 10px 5px 7px; border-radius: var(--r-sm);
  background: rgba(var(--ink-2-rgb), 0.9); border: 1px solid var(--rule-soft); font-size: 13px;
}
.legend .loot { width: 26px; height: 26px; }
.legend .loot .emo { font-size: 14px; }
.legend .lg-txt small { margin-left: 8px; font-size: 11.5px; color: var(--muted); letter-spacing: 0.04em; }
.legend b { margin-left: auto; font-family: var(--display); font-weight: 400; font-size: 15px; color: var(--orn-hi); }

/* archive */
.vault-list { display: grid; gap: 8px; }
.vault-row {
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 4px 14px; align-items: center;
  width: 100%; padding: 14px 16px 12px; text-align: left; cursor: pointer; color: var(--ivory);
}
.vault-row:hover { border-color: var(--orn); }
.vault-row .vr-cat { display: block; font-family: var(--display); font-size: 19px; line-height: 1; }
.vault-row .vr-date { display: block; font-size: 12.5px; color: var(--muted); margin-top: 4px; }
.vault-row .vr-side { text-align: right; font-size: 12px; color: var(--muted); }
.vault-row .vr-side b { display: block; font-family: var(--display); font-weight: 400; font-size: 20px; color: var(--ivory); }
.vault-row .vr-cta { font-weight: 700; font-size: 12px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--orn-hi); }
.vault-row.is-today { border-color: var(--orn); }
.forging { padding: 18px; text-align: center; color: var(--muted); border: 1px dashed var(--rule-soft); border-radius: var(--r); }
.forging b { display: block; font-family: var(--display); font-weight: 400; font-size: 20px; color: var(--ivory-2); margin-bottom: 4px; }

/* streaks & rewards */
.streak-hero { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 18px; }
.streak-hero .sh-main { display: flex; align-items: center; gap: 14px; }
.streak-hero .ic { width: 46px; height: 46px; color: var(--orn-hi); filter: drop-shadow(0 0 12px rgba(var(--orn-rgb), 0.6)); }
.streak-hero .sh-num { font-family: var(--display); font-size: 42px; line-height: 0.85; }
.streak-hero .sh-label { font-size: 10.5px; font-weight: 600; letter-spacing: 0.28em; text-transform: uppercase; color: var(--ivory-2); }
.streak-hero .sh-best { text-align: right; font-size: 12px; color: var(--muted); }
.streak-hero .sh-best b { display: block; font-family: var(--display); font-weight: 400; font-size: 22px; color: var(--ivory); }
.track { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.track li { display: grid; grid-template-columns: 54px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 12px 14px 10px; }
.track .plate { min-width: 46px; }
.track li.locked .plate { background: transparent; color: var(--orn); box-shadow: inset 0 0 0 1px var(--rule); }
.track .tr-title { display: block; font-weight: 600; font-size: 13.5px; }
.track .tr-sub { display: block; margin-top: 2px; font-size: 11.5px; color: var(--muted); }
.track .tr-state { font-size: 10px; font-weight: 600; letter-spacing: 0.2em; text-transform: uppercase; color: var(--muted); white-space: nowrap; }
.track li.done .tr-state { color: var(--orn-hi); }
.track .tr-state .ic { width: 18px; height: 18px; color: var(--orn-hi); }
.finishes { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.finish {
  position: relative; display: flex; flex-direction: column; gap: 10px; padding: 12px; text-align: left;
  cursor: pointer; color: var(--ivory); border-radius: var(--r); border: 1px solid var(--rule-soft); background: rgba(var(--ink-2-rgb), 0.85);
}
.finish:disabled { cursor: default; }
.finish.is-on { border-color: var(--orn-hi); box-shadow: 0 0 0 1px var(--orn-hi); }
.finish .swatch {
  height: 56px; border-radius: var(--r-sm); position: relative; overflow: hidden;
  background: radial-gradient(circle at 30% 120%, var(--sw-orn) 0 22%, transparent 23%), radial-gradient(130% 120% at 50% 0%, var(--sw-ink-hi), var(--sw-ink));
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
}
.finish .swatch::after {
  content: ""; position: absolute; inset: 0;
  background: repeating-conic-gradient(from 0deg at 50% -40%, var(--sw-ray) 0deg 2deg, transparent 2deg 8deg);
  opacity: 0.45;
}
.finish b { font-weight: 700; font-size: 13px; letter-spacing: 0.16em; text-transform: uppercase; }
.finish small { display: block; font-size: 12px; color: var(--muted); margin-top: 2px; }
.finish .lockbadge { position: absolute; top: 18px; right: 18px; display: flex; align-items: center; gap: 5px; padding: 4px 8px 2px; border-radius: 3px; background: rgba(0, 0, 0, 0.7); font-size: 11px; font-weight: 700; letter-spacing: 0.08em; color: var(--ivory); }
.finish .lockbadge .ic { width: 12px; height: 12px; margin-top: -2px; }
.finish:disabled .swatch { filter: grayscale(0.7) brightness(0.6); }
.finish[data-id="midnight"] { --sw-ink: #0A1120; --sw-ink-hi: #1F2C49; --sw-orn: #D9B25F; --sw-ray: rgba(217, 178, 95, 0.3); }
.finish[data-id="emerald"] { --sw-ink: #06171A; --sw-ink-hi: #173F39; --sw-orn: #D9B25F; --sw-ray: rgba(217, 178, 95, 0.3); }
.finish[data-id="oxblood"] { --sw-ink: #19090D; --sw-ink-hi: #3F1D26; --sw-orn: #E2A47A; --sw-ray: rgba(226, 164, 122, 0.3); }
.finish[data-id="noir"] { --sw-ink: #0A0A0B; --sw-ink-hi: #26262A; --sw-orn: #E6DCC6; --sw-ray: rgba(230, 220, 198, 0.28); }

/* relics */
.relic-count { display: flex; align-items: baseline; gap: 8px; margin: -6px 0 16px; color: var(--ivory-2); }
.relic-count b { font-family: var(--display); font-weight: 400; font-size: 26px; color: var(--orn-hi); }
.relics { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.relic { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 8px; padding: 14px 8px 12px; }
.medallion {
  position: relative; width: 64px; height: 64px; border-radius: 50%; display: grid; place-items: center; flex: none;
  background:
    repeating-conic-gradient(from 0deg, rgba(var(--orn-rgb), 0.22) 0deg 4deg, transparent 4deg 12deg),
    radial-gradient(circle, var(--ink-3) 0 58%, var(--ink-2) 59%);
  box-shadow: inset 0 0 0 2px var(--orn), inset 0 0 0 5px var(--ink-2), inset 0 0 0 6px var(--rule), 0 6px 16px rgba(0, 0, 0, 0.5);
}
.medallion .emo { font-size: 28px; filter: sepia(1) saturate(2.4) hue-rotate(-12deg) brightness(1.05) drop-shadow(0 1px 0 rgba(0, 0, 0, 0.6)); }
.relic.is-locked .medallion { box-shadow: inset 0 0 0 1px var(--rule-soft), 0 4px 10px rgba(0, 0, 0, 0.4); background: radial-gradient(circle, var(--ink-2) 0 60%, var(--ink-1) 61%); }
.relic.is-locked .medallion .emo { filter: grayscale(1) brightness(0.28) contrast(1.2); }
.relic b { font-weight: 600; font-size: 11.5px; letter-spacing: 0.16em; text-transform: uppercase; line-height: 1.25; }
.relic small { font-size: 11.5px; color: var(--muted); line-height: 1.5; }
.relic.is-locked b { color: var(--muted); }
.relic .when { font-size: 10.5px; color: var(--orn); letter-spacing: 0.08em; text-transform: uppercase; font-weight: 700; }
.medallion.sm { width: 34px; height: 34px; }
.medallion.sm .emo { font-size: 16px; }
.medallion.sm { box-shadow: inset 0 0 0 1.5px var(--orn), inset 0 0 0 3px var(--ink-2), 0 3px 8px rgba(0, 0, 0, 0.5); }

/* stats */
.stat-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; text-align: center; }
.stat { padding: 12px 2px 9px; }
.stat b { display: block; font-family: var(--display); font-weight: 400; font-size: 21px; line-height: 1; }
.stat span { display: block; margin-top: 6px; font-size: 9px; font-weight: 600; letter-spacing: 0.16em; text-transform: uppercase; color: var(--muted); }
.stat-extra { display: flex; justify-content: center; flex-wrap: wrap; gap: 6px 18px; margin: 14px 0 0; font-size: 13.5px; color: var(--ivory-2); }
.stat-extra b { color: var(--ivory); }
.dist { display: grid; gap: 6px; }
.dist-row { display: grid; grid-template-columns: 26px minmax(0, 168px) 1fr; gap: 8px; align-items: center; font-size: 13px; }
.dist-row .d-emo { text-align: center; }
.dist-row .d-name { color: var(--ivory-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding-top: 2px; }
.dist-row .d-name small { color: var(--dim); }
.dist-bar {
  height: 22px; min-width: 26px; border-radius: 3px; display: flex; align-items: center; justify-content: flex-end;
  padding: 2px 8px 0; background: rgba(var(--orn-rgb), 0.16); font-weight: 700; font-size: 12px; color: var(--ivory-2);
}
.dist-row.is-today .dist-bar { background: var(--metal); color: var(--metal-ink); }

/* credits */
.credits { text-align: center; padding: 26px 18px 22px; }
.credits .wordmark { font-size: 34px; }
.crew { list-style: none; margin: 24px 0 4px; padding: 0; display: grid; gap: 20px; }
.crew li { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.crew .name { font-family: var(--display); font-size: 30px; line-height: 1; letter-spacing: 0.04em; color: var(--ivory); }

/* My Player */
.player-card { display: flex; align-items: center; gap: 18px; padding: 18px 20px; }
.medallion.lg { width: 78px; height: 78px; }
.medallion.lg .emo { font-size: 34px; }
.pl-id { flex: 1; min-width: 0; }
.pl-tier { margin-top: 5px; font-family: var(--display); font-size: 32px; line-height: 1; color: var(--ivory); }
.pl-next { margin-top: 6px; font-size: 13px; color: var(--ivory-2); }
.pl-id .progress { display: block; height: 4px; margin-top: 9px; border-radius: 2px; background: var(--rule-soft); overflow: hidden; }
.pl-id .progress i { display: block; height: 100%; background: var(--orn); }
.stat-grid.four { grid-template-columns: repeat(4, minmax(0, 1fr)); margin-top: 10px; }

.perf { padding: 14px 14px 10px; }
.perf-chart { position: relative; }
.pc-svg { display: block; width: 100%; height: auto; overflow: visible; }
.pc-grid { stroke: var(--rule-faint); stroke-width: 1; }
.pc-ylab { fill: var(--muted); font-family: var(--ui); font-weight: 600; font-size: 10px; text-anchor: end; dominant-baseline: central; }
.pc-xlab { fill: var(--muted); font-family: var(--ui); font-weight: 600; font-size: 10px; }
.pc-area { fill: rgba(var(--orn-rgb), 0.1); }
.pc-line { fill: none; stroke: var(--orn); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.pc-avg { stroke: var(--ivory-2); stroke-width: 1; stroke-dasharray: 4 4; opacity: 0.55; }
.pc-avg-lab {
  fill: var(--ivory-2); font-family: var(--ui); font-weight: 700; font-size: 10px; letter-spacing: 0.06em; text-anchor: start;
  paint-order: stroke; stroke: var(--ink-2); stroke-width: 3px; stroke-linejoin: round;
}
.pc-dot { fill: var(--ink-1); stroke: var(--orn-hi); stroke-width: 2; }
.pc-dot.is-on { fill: var(--orn-hi); }
.pc-cross { stroke: var(--rule); stroke-width: 1; }
.pc-hit { fill: transparent; cursor: crosshair; }
.perf-note { margin: 8px 0 2px; text-align: center; font-size: 13px; color: var(--ivory-2); }
.perf-note b { color: var(--ivory); }

.haul { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; }
.haul-tile { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 12px 4px 10px; text-align: center; }
.haul-tile .loot { width: 32px; height: 32px; }
.haul-tile .loot .emo { font-size: 17px; }
.haul-tile b { font-family: var(--display); font-weight: 400; font-size: 19px; line-height: 1; padding-top: 2px; }
.haul-tile > span:not(.loot) { font-size: 9px; font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase; color: var(--ivory-2); line-height: 1.3; }
.haul-tile small { font-size: 10.5px; color: var(--muted); }
.pl-ranks { margin: 0; text-align: center; font-size: 14px; color: var(--ivory-2); }
.pl-ranks b { color: var(--orn-hi); }

.recent { display: grid; gap: 6px; }
.recent-row {
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto auto; gap: 12px; align-items: center;
  width: 100%; padding: 11px 14px 9px; text-align: left; cursor: pointer; color: var(--ivory);
}
.recent-row:hover { border-color: var(--orn); }
.rr-cat { display: block; font-family: var(--display); font-size: 18px; line-height: 1.05; }
.rr-date { display: block; margin-top: 2px; font-size: 12px; color: var(--muted); }
.rr-score { text-align: right; font-size: 12px; color: var(--muted); white-space: nowrap; }
.rr-score b { font-family: var(--display); font-weight: 400; font-size: 20px; color: var(--ivory); }
.rr-score small { display: block; font-weight: 700; color: var(--orn); }

/* Version stamp, bottom-right of the main screen */
.version {
  position: fixed; right: 14px; bottom: calc(10px + env(safe-area-inset-bottom)); z-index: 2; pointer-events: none;
  font-size: 10.5px; font-weight: 700; letter-spacing: 0.22em; text-transform: uppercase; color: var(--dim);
}
body:not([data-screen="lobby"]) .version { display: none; }
@media (max-width: 919px) {
  /* Phones: sit at the bottom-right of the page instead of floating over the buttons */
  .version { position: relative; right: auto; bottom: auto; text-align: right; padding: 0 16px calc(16px + env(safe-area-inset-bottom)); }
}

/* ---------- intro countdown ---------------------------------------------- */

.intro {
  position: fixed; inset: 0; z-index: 70; display: grid; place-items: center; text-align: center;
  background: radial-gradient(circle at 50% 45%, rgba(var(--ink-2-rgb), 0.92), rgba(var(--ink-0-rgb), 0.98));
}
.intro .in-cat { margin-top: 10px; font-family: var(--display); font-size: clamp(34px, 9vw, 52px); line-height: 1; color: var(--ivory); }
.intro .in-q { margin: 12px auto 0; max-width: 300px; color: var(--muted); font-size: 13.5px; line-height: 1.65; }
/* Solid colour on purpose: gradient-clipped text can vanish while it animates in Chrome. */
.intro .in-count {
  min-height: 1em; margin-top: 26px; font-family: var(--display); font-size: 92px; line-height: 1; color: var(--orn-hi);
  text-shadow: 0 4px 0 rgba(0, 0, 0, 0.45), 0 0 46px rgba(var(--orn-rgb), 0.55);
}
.intro .in-count.pop { animation: countPop 0.42s var(--spring); }
@keyframes countPop { from { transform: scale(1.6); opacity: 0; } to { transform: none; opacity: 1; } }

/* ---------- toast & confetti ------------------------------------------- */

.toast {
  position: fixed; left: 50%; top: 14px; z-index: 100; max-width: calc(100% - 32px);
  display: flex; align-items: center; gap: 10px; padding: 11px 16px 9px;
  transform: translate(-50%, -24px); opacity: 0; pointer-events: none;
  background: var(--ink-1); color: var(--ivory); border: 1px solid var(--rule); border-radius: var(--r-sm);
  box-shadow: 0 0 0 3px var(--ink-1), 0 0 0 4px var(--rule-soft), 0 14px 34px rgba(0, 0, 0, 0.55);
  font-weight: 600; font-size: 13.5px; letter-spacing: 0.02em; transition: transform 0.25s var(--ease), opacity 0.25s;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast .medallion { width: 38px; height: 38px; }
.toast .medallion .emo { font-size: 18px; }
.toast .t-kick { display: block; color: var(--orn); font-size: 10.5px; font-weight: 700; letter-spacing: 0.22em; text-transform: uppercase; }

.confetti { position: fixed; inset: 0; z-index: 90; pointer-events: none; overflow: hidden; }
.confetti i { position: absolute; top: -24px; border-radius: 1px; }

/* ---------- responsive --------------------------------------------------- */

@media (max-width: 919px) {
  .topbar { height: 58px; }
  .dial { width: 96px; height: 96px; }
  .dial .emo { font-size: 40px; }
  .valuable { gap: 16px; padding: 16px 16px 18px; background: radial-gradient(circle at 64px 50%, rgba(var(--orn-rgb), 0.14), transparent 120px), var(--panel); }

  /* Phones: keep the valuable pinned while the boxes scroll under it.
     (Block layout, because a sticky grid item can't leave its own row.) */
  .game { display: block; }
  .game > * + * { margin-top: 18px; }
  body.is-playing .col-left, body.is-revealing .col-left {
    position: sticky; top: 0; z-index: 15; margin: 0 -16px; padding: 8px 16px 6px;
    transition: background-color 0.2s, box-shadow 0.2s;
  }
  body.is-scrolled.is-playing .col-left, body.is-scrolled.is-revealing .col-left {
    background-color: rgba(var(--ink-1-rgb), 0.97);
    box-shadow: 0 1px 0 var(--rule-soft), 0 14px 26px -14px rgba(0, 0, 0, 0.95);
  }

  .actionbar {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; margin: 0;
    padding: 20px 16px calc(14px + env(safe-area-inset-bottom));
    background: linear-gradient(to top, var(--ink-1) 62%, rgba(var(--ink-1-rgb), 0));
  }
  .actionbar .btn { display: flex; max-width: 508px; margin: 0 auto; }
  .actionbar .key { display: none; }
}

@media (min-width: 920px) {
  .topbar { padding: 0 28px; }
  .game {
    max-width: 1040px; padding: 6px 28px 64px;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); column-gap: 44px; row-gap: 30px; align-items: start;
  }
  .col-left { position: sticky; top: 16px; }
  body.is-done .col-left { position: static; }
  .answers { grid-column: 1 / -1; }
  .answers-list { display: grid; grid-template-columns: 1fr 1fr; column-gap: 44px; }
  .dial { width: 124px; height: 124px; }
  .dial .emo { font-size: 54px; }
  .valuable { padding: 22px 22px 24px; gap: 22px; }
  .val-name { font-size: clamp(24px, 2.4vw, 31px); }
  :root { --door: min(54vh, 500px); }
}

@media (max-width: 430px) {
  .wide-only { display: none; }
  .rp-score { flex-direction: column; align-items: flex-start; gap: 10px; }
  .rp-title { text-align: left; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
  .rp-title .t-line { flex-basis: 100%; margin-top: 0; }
  .recent-row .medal-row { display: none; }
  .player-card { gap: 14px; padding: 16px; }
  .medallion.lg { width: 64px; height: 64px; }
  .haul-tile small { font-size: 10px; }
  .stat b { font-size: 18px; }
  .stat span { font-size: 8px; letter-spacing: 0.1em; }
  .rp-big { font-size: 56px; }
  .legend { margin-left: 0; }
}

@media (max-height: 700px) and (max-width: 919px) {
  :root { --box-h: 42px; }
  .dial { width: 84px; height: 84px; }
  .dial .emo { font-size: 34px; }
  .valuable { padding: 12px 14px 15px; }
}

@media (max-width: 599px) {
  .sheet {
    width: 100%; max-width: 100%; margin: auto 0 0; max-height: 90dvh;
    border-radius: 14px 14px 0 0; border-bottom: 0;
  }
  .sheet[open] { animation: sheetUp 0.32s var(--ease); }
  @keyframes sheetUp { from { transform: translateY(40%); opacity: 0.4; } }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  .scene-dust { display: none; }
}
