/* The opening flow (visual-system 12.0 to 12.8): the painted exterior, the TV title, invitation, dossier board, the storm
   gathering, play again; and the phone's join, guest picker, rename sheet and waiting screens. Tokens 1 to 4 only. */

/* ---------- The exterior (12.4): painting plus coded dial, door, fog and grades ---------- */
.exterior { position: absolute; inset: 0; overflow: hidden; background: #05070D; }
.exterior__svg { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.exterior__fog { position: absolute; left: -20%; right: -20%; bottom: -6%; height: 46%; pointer-events: none; mix-blend-mode: screen; filter: blur(26px); will-change: transform; }
.exterior__fog--a { opacity: 0.2; background: radial-gradient(ellipse 30% 40% at 25% 70%, #A9BDBA, transparent 70%), radial-gradient(ellipse 34% 36% at 70% 80%, #A9BDBA, transparent 70%); animation: fog-a 75s linear infinite alternate; }
.exterior__fog--b { opacity: 0.16; height: 34%; background: radial-gradient(ellipse 40% 50% at 55% 80%, #93A9B3, transparent 70%), radial-gradient(ellipse 24% 40% at 12% 90%, #93A9B3, transparent 70%); animation: fog-b 110s linear infinite alternate; }
@keyframes fog-a { from { transform: translateX(-5%); } to { transform: translateX(5%); } }
@keyframes fog-b { from { transform: translateX(6%); } to { transform: translateX(-6%); } }
.exterior__grade { position: absolute; inset: 0; pointer-events: none; }
/* 12.7 deeper night: the lobby opens at dusk values and tends darker over about ten minutes, then holds. The still frame is the darkest. */
.exterior[data-grade='night'] .exterior__paint { filter: saturate(0.82) brightness(0.86); }
.exterior[data-grade='night'] .exterior__grade { background: radial-gradient(ellipse 70% 80% at 66% 62%, transparent 35%, rgb(2 4 12 / 0.6) 100%), linear-gradient(180deg, rgb(4 8 24 / 0.42), rgb(4 8 24 / 0.12) 60%); animation: night-deepen 600s ease-out both; }
.exterior[data-grade='night'] .exterior__fog--a { opacity: 0.24; }
@keyframes night-deepen { from { opacity: 0.55; } to { opacity: 1; } }
/* 12.8 dawn: a warm lift, the sky toward #8FA8D8 then #E8C07A, the house cooled and asleep (no door glow). */
.exterior[data-grade='dawn'] .exterior__paint { filter: brightness(1.12) saturate(0.78) sepia(0.12); }
.exterior[data-grade='dawn'] .exterior__grade { background: linear-gradient(180deg, rgb(143 168 216 / 0.5) 0%, rgb(232 192 122 / 0.42) 62%, rgb(232 192 122 / 0.15) 100%), radial-gradient(ellipse 50% 30% at 10% 70%, rgb(255 214 150 / 0.45), transparent 70%); mix-blend-mode: soft-light; }
.exterior[data-grade='dawn'] .exterior__fog { opacity: 0.12; }
.exterior[data-grade='dawn'] .exterior__gap, .exterior[data-grade='dawn'] .exterior__sill, .exterior[data-grade='dawn'] .exterior__fan, .exterior[data-grade='dawn'] .exterior__halo { opacity: 0; }
.exterior[data-grade='dawn'] .exterior__dial { filter: brightness(0.92); }
/* The door: shut with a warm gap and a lit fanlight; on Enter the Manor it swings in and the hall light spills out. */
.exterior__gap, .exterior__sill { opacity: 0.85; animation: candle 4s ease-in-out infinite; }
.exterior__fan { animation: candle 4s ease-in-out infinite; }
.exterior__halo { opacity: 0.8; animation: candle 5s ease-in-out infinite; }
@keyframes candle { 0%, 100% { opacity: 0.86; } 23% { opacity: 1; } 41% { opacity: 0.9; } 67% { opacity: 0.97; } 83% { opacity: 0.88; } }
.exterior__leaf { transform-box: fill-box; transform-origin: 0% 50%; transition: transform 700ms cubic-bezier(0.4, 0, 0.3, 1); }
.exterior__spill { opacity: 0; transition: opacity 600ms 150ms; mix-blend-mode: screen; }
.exterior[data-door='open'] .exterior__leaf { transform: perspective(400px) rotateY(-74deg); }
.exterior[data-door='open'] .exterior__spill { opacity: 1; }
.exterior[data-door='open'] .exterior__gap { opacity: 0; }

/* ---------- TV: the title (12.0 step 1) ---------- */
.tv .opening { position: absolute; inset: 0; overflow: hidden; }
.title__scene { transition: transform 900ms cubic-bezier(0.5, 0, 0.3, 1); transform-origin: 66% 72%; }
.opening--title[data-leaving='yes'] .title__scene { transform: scale(1.08); }
.opening--title[data-leaving='yes'] .title__lockup, .opening--title[data-leaving='yes'] .title__plate { opacity: 0; transition: opacity 500ms; }
.title__scrim { position: absolute; inset: 0; pointer-events: none; background: linear-gradient(90deg, rgb(3 5 12 / 0.8) 0%, rgb(3 5 12 / 0.68) 34%, rgb(3 5 12 / 0.32) 46%, transparent 58%); }
.title__lockup { position: absolute; left: 104px; top: 112px; width: 700px; display: flex; flex-direction: column; align-items: center; text-align: center; gap: 18px; }
.title__emblem { width: 168px; height: 168px; }
.title__name { font: 700 88px/1.02 var(--f-display); letter-spacing: 0.06em; color: var(--cream); text-shadow: 0 4px 18px rgb(0 0 0 / 0.85), 0 0 2px rgb(0 0 0 / 0.9); }
.title__sub { font: 500 italic 40px/1.1 var(--f-body); color: var(--cream); text-shadow: 0 2px 10px #000; }
.title__rule { width: 460px; }
.button--tv { min-height: 92px; padding: 0 56px; font-size: 38px; letter-spacing: 0.08em; border-width: 3px; }
.title__enter { margin-top: 18px; box-shadow: 0 0 40px rgb(229 154 60 / 0.35), inset 0 1px 0 rgb(255 240 190 / 0.6), 0 6px 16px rgb(0 0 0 / 0.6); }
.button--tv:focus-visible { outline: 4px solid #FFF4C2; outline-offset: 6px; box-shadow: 0 0 0 10px #000; }
.title__plate { position: absolute; left: 104px; bottom: 64px; }
.address-plate { display: inline-flex; align-items: center; gap: 22px; padding: 12px 30px; border: 2px solid var(--brass); border-radius: 999px; background: rgb(5 7 13 / 0.82); box-shadow: inset 0 0 0 4px rgb(5 7 13 / 0.8), inset 0 0 0 5px rgb(212 175 55 / 0.45); }
.address-plate__code { font: 700 40px/1 var(--f-display); letter-spacing: 0.08em; color: var(--brass-hi); }
.address-plate__url { font: 600 32px/1 var(--f-ui); letter-spacing: 0.06em; color: var(--cream); }

/* ---------- TV: behind the invitation and the board, the painting blurred and darkened ---------- */
.opening__backdrop .exterior__svg { filter: blur(12px); transform: scale(1.04); }
.opening__backdrop::after { content: ''; position: absolute; inset: 0; background: rgb(from var(--velvet-deep) r g b / 0.78); }

/* ---------- TV: the invitation (12.0 step 2): the seal cracks as the card arrives ---------- */
.invitation { position: absolute; left: 150px; top: 92px; width: 1620px; height: 908px; display: grid; grid-template-columns: 1fr 560px; gap: 56px; padding: 64px 72px 56px; color: var(--ink); isolation: isolate; animation: card-rise 600ms cubic-bezier(0.2, 0.7, 0.3, 1) both; }
@keyframes card-rise { from { transform: translateY(60px); opacity: 0; } }
.invitation__paper { position: absolute; inset: 0; z-index: -1; border-radius: 4px; background-color: var(--parchment); background-image: radial-gradient(ellipse at 18% 12%, rgb(201 181 138 / 0.45), transparent 45%), radial-gradient(ellipse at 85% 90%, rgb(201 181 138 / 0.55), transparent 50%), var(--noise); background-blend-mode: normal, normal, multiply; box-shadow: 0 30px 80px rgb(0 0 0 / 0.7), inset 0 0 0 14px var(--parchment), inset 0 0 0 16px var(--brass-lo), inset 0 0 0 20px var(--parchment), inset 0 0 0 21px var(--brass-lo); }
.invitation__flap { position: absolute; inset: 0; z-index: 3; pointer-events: none; visibility: hidden; background: linear-gradient(160deg, #D9C79D 50%, transparent 50.2%), linear-gradient(200deg, #CDB88A 50%, transparent 50.2%); animation: flap-open 700ms ease-in both; }
@keyframes flap-open { 0%, 40% { visibility: visible; opacity: 1; transform: none; } 100% { visibility: visible; opacity: 0; transform: translateY(-40px); } }
.invitation__seal { position: absolute; left: 50%; top: -58px; width: 136px; height: 136px; margin-left: -68px; z-index: 4; pointer-events: none; }
.invitation__half { position: absolute; inset: 0; width: 136px; height: 136px; }
.invitation__half--l { clip-path: polygon(0 0, 54% 0, 44% 38%, 56% 60%, 46% 100%, 0 100%); transform: translate(-30px, 8px) rotate(-12deg); animation: crack-l 700ms cubic-bezier(0.3, 0, 0.2, 1) both; }
.invitation__half--r { clip-path: polygon(54% 0, 100% 0, 100% 100%, 46% 100%, 56% 60%, 44% 38%); transform: translate(30px, 8px) rotate(10deg); animation: crack-r 700ms cubic-bezier(0.3, 0, 0.2, 1) both; }
@keyframes crack-l { 0%, 30% { transform: translate(0, 470px); } 100% { transform: translate(-30px, 8px) rotate(-12deg); } }
@keyframes crack-r { 0%, 30% { transform: translate(0, 470px); } 100% { transform: translate(30px, 8px) rotate(10deg); } }
.invitation__words { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 10px; min-width: 0; }
.invitation__crest { width: 104px; height: 104px; }
.invitation__invited { font: 500 italic 34px/1.1 var(--f-body); color: #4A3420; }
.invitation__title { font: 700 72px/1 var(--f-display); letter-spacing: 0.08em; color: #3A2A10; }
.invitation__at { font: 500 italic 34px/1.1 var(--f-body); color: #4A3420; margin-bottom: 14px; }
.invitation__door { display: flex; flex-direction: column; gap: 24px; }
.settings { width: 100%; display: grid; gap: 16px; padding: 24px 30px; border: 2px solid var(--brass-lo); border-radius: 6px; background: linear-gradient(180deg, #1B3A2E, #0C2219); color: var(--cream); box-shadow: inset 0 0 0 5px #0C2219, inset 0 0 0 6px rgb(212 175 55 / 0.45), 0 8px 18px rgb(40 20 0 / 0.35); text-align: left; }
.setting { display: flex; align-items: center; gap: 18px; }
.setting__label { flex: none; width: 230px; font: 700 28px/1.1 var(--f-ui); letter-spacing: 0.06em; text-transform: uppercase; color: var(--brass-hi); }
.setting__options { display: inline-flex; border: 2px solid var(--brass-line); border-radius: 999px; overflow: hidden; }
.setting__option { display: inline-flex; align-items: center; gap: 8px; min-height: 60px; padding: 0 24px; border: 0; font: 700 30px/1 var(--f-ui); letter-spacing: 0.04em; text-transform: uppercase; color: var(--cream); background: rgb(59 35 20 / 0.75); }
.setting__option + .setting__option { border-left: 1.5px solid var(--brass-line); }
.setting__option[data-on='yes'] { background: linear-gradient(180deg, #F0D77A, #D4AF37 45%, #8A6A1E); color: var(--ink); }
.setting__option:focus-visible { outline-offset: -6px; }
.setting__check { width: 14px; height: 22px; border: solid var(--ink); border-width: 0 4px 4px 0; transform: rotate(40deg) translate(-2px, -3px); }
.setting--gentle { display: grid; grid-template-columns: 230px auto 1fr; grid-template-areas: 'label lever line'; align-items: center; gap: 18px; }
.setting--gentle .setting__label { grid-area: label; font: 700 28px/1.1 var(--f-ui); color: var(--brass-hi); }
.setting--gentle .gentle__line { grid-area: line; font: 500 26px/1.2 var(--f-body); color: rgb(243 231 201 / 0.85); }
.setting--gentle .lever, .gentle__switch { grid-area: lever; }
.gentle__switch { padding: 0; border: 0; background: none; border-radius: 40px; }
.setting--gentle .lever { display: block; flex: none; }
.join-plate { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 26px 24px 28px; border: 2px solid var(--brass); border-radius: 6px; background: linear-gradient(180deg, #14302A, #07120E); color: var(--cream); text-align: center; box-shadow: inset 0 0 0 5px #07120E, inset 0 0 0 6px rgb(212 175 55 / 0.5), 0 10px 22px rgb(40 20 0 / 0.4); }
.join-plate__label { font: 600 26px/1.1 var(--f-ui); letter-spacing: 0.06em; text-transform: uppercase; color: rgb(243 231 201 / 0.85); }
.join-plate__url { font: 700 38px/1.25 var(--f-ui); letter-spacing: 0.04em; overflow-wrap: anywhere; }
.join-plate__code { margin: 6px 0; font: 700 100px/1.15 var(--f-display); letter-spacing: 0.08em; color: var(--brass-hi); text-shadow: 0 3px 10px #000; }
.join-plate__or { font: 500 italic 26px/1.3 var(--f-body); color: rgb(243 231 201 / 0.8); }
.qr { width: 236px; height: 236px; display: block; border: 3px solid var(--brass-lo); }
.invitation__go { width: 100%; }

/* ---------- TV: the dossier board (12.0 step 3; 12.1 B; 12.5) ---------- */
.board { position: absolute; inset: 0; }
.board__felt { position: absolute; inset: 0; background: radial-gradient(ellipse 50% 46% at 18% 16%, rgb(229 154 60 / 0.2), transparent 70%), radial-gradient(ellipse at 60% 55%, transparent 40%, rgb(3 5 10 / 0.6) 100%); }
.board__side { position: absolute; left: 64px; top: 56px; width: 470px; bottom: 64px; z-index: 3; }
.board__side > * { position: absolute; left: 0; }
.code-tag { top: 0; }
.board__summary { top: 176px; right: 0; }
.ribbon__title { top: 254px; }
.ribbon { top: 300px; right: 0; height: 456px; } /* BOARD.ribbonY = 56 + 300 */
.board__begin { bottom: 0; right: 0; }
.code-tag { position: relative; align-self: flex-start; display: flex; flex-direction: column; gap: 10px; padding: 14px 34px 16px 52px; border: 2px solid var(--brass); border-radius: 8px 40px 40px 8px; background: linear-gradient(180deg, #F0D77A, #D4AF37 45%, #8A6A1E); color: var(--ink); box-shadow: 0 8px 18px rgb(0 0 0 / 0.5); }
.code-tag::before { content: ''; position: absolute; left: 18px; top: 50%; width: 18px; height: 18px; margin-top: -9px; border-radius: 50%; background: #0C2219; box-shadow: inset 0 0 0 3px var(--brass-lo); }
.code-tag__code { font: 700 60px/1 var(--f-display); letter-spacing: 0.08em; }
.code-tag__url { font: 700 28px/1.1 var(--f-ui); letter-spacing: 0.04em; }
.board__summary { display: flex; align-items: center; justify-content: space-between; gap: 14px; min-height: 64px; padding: 8px 22px; border: 1.5px solid var(--brass); border-radius: 6px; background: rgb(5 7 13 / 0.7); text-align: left; }
.board__summary-text { font: 600 26px/1.2 var(--f-ui); letter-spacing: 0.03em; color: var(--cream); }
.board__summary-change { flex: none; font: 700 22px/1 var(--f-ui); letter-spacing: 0.08em; text-transform: uppercase; color: var(--brass-hi); border-bottom: 2px solid var(--brass); }
.ribbon__title { font: 700 34px/1.1 var(--f-display); letter-spacing: 0.06em; color: var(--brass-hi); }
.ribbon { display: flex; flex-direction: column; gap: 6px; padding-left: 6px; border-left: 6px solid var(--string); }
.ribbon__guest { height: 32px; padding-left: 14px; font: 700 26px/32px var(--f-display); color: var(--cream); white-space: nowrap; text-shadow: 0 2px 4px #000; }
.ribbon__empty { padding-left: 14px; font: 500 italic 26px/1.3 var(--f-body); color: rgb(243 231 201 / 0.75); }
.board__begin { display: flex; flex-direction: column; gap: 10px; }
.board__reason { font: 500 italic 26px/1.2 var(--f-body); color: var(--cream); }
.board__threads { position: absolute; inset: 0; width: 1920px; height: 1080px; z-index: 2; pointer-events: none; }
.board__thread { fill: none; stroke: var(--string); stroke-width: 3; opacity: 0.62; filter: drop-shadow(0 2px 2px rgb(0 0 0 / 0.6)); }
.dossiers { position: absolute; inset: 0; z-index: 1; pointer-events: none; } /* the cards are not buttons; the side column stays pressable */
.dossier { position: absolute; width: 196px; height: 224px; display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 10px 8px 6px; border-radius: 3px; color: var(--ink); background-color: #D9C79D; background-image: radial-gradient(ellipse at 20% 10%, rgb(243 231 201 / 0.6), transparent 55%), var(--noise); background-blend-mode: normal, multiply; box-shadow: 0 8px 16px rgb(0 0 0 / 0.55); transition: transform 200ms ease-out, filter 250ms ease-out; }
/* The 6 x 4 grid, in step with BOARD in opening-tv.tsx (positions in CSS: no inline styles anywhere). */
.dossier:nth-child(6n+1) { left: 616px; }
.dossier:nth-child(6n+2) { left: 824px; }
.dossier:nth-child(6n+3) { left: 1032px; }
.dossier:nth-child(6n+4) { left: 1240px; }
.dossier:nth-child(6n+5) { left: 1448px; }
.dossier:nth-child(6n+6) { left: 1656px; }
.dossier:nth-child(n+1):nth-child(-n+6) { top: 56px; }
.dossier:nth-child(n+7):nth-child(-n+12) { top: 296px; }
.dossier:nth-child(n+13):nth-child(-n+18) { top: 536px; }
.dossier:nth-child(n+19):nth-child(-n+24) { top: 776px; }
.dossier[data-taken='no'] { filter: brightness(0.7) saturate(0.85); }
.dossier[data-taken='yes'] { transform: translateY(6px); box-shadow: 0 0 0 3px var(--glow), 0 10px 20px rgb(0 0 0 / 0.6); }
.dossier__pin { position: absolute; top: 4px; left: 50%; width: 18px; height: 18px; margin-left: -9px; border-radius: 50%; z-index: 3; background: radial-gradient(circle at 35% 30%, #FFF0B8, #D4AF37 55%, #6B4F14); box-shadow: 0 3px 4px rgb(0 0 0 / 0.6); }
.dossier .dossier-portrait { width: 108px; height: 144px; flex: none; }
.dossier__title, .dossier__player { width: 100%; text-align: center; overflow-wrap: normal; text-wrap: balance; }
.dossier__title { font: 700 26px/1.02 var(--f-ui); letter-spacing: 0.02em; text-transform: uppercase; }
.dossier__player { font: 700 23px/1.06 var(--f-display); color: #2B1D12; }
/* The 3:4 portrait, or the medallion with the stamped band (a missing painting that looks intended) */
.dossier-portrait { position: relative; display: block; border: 3px solid var(--brass); background: var(--portrait-edge); box-shadow: inset 0 0 0 2px #000, 0 2px 4px rgb(0 0 0 / 0.5); }
.dossier-portrait__art { width: 100%; height: 100%; }
.medallion { position: relative; display: grid; place-items: start center; padding-top: 24%; width: 100%; height: 100%; background: radial-gradient(circle at 50% 42%, rgb(229 154 60 / 0.32), transparent 58%), #0C1A14; }
.medallion__mono { font: 700 2.2em/1 var(--f-display); color: var(--brass); letter-spacing: 0.06em; }
.medallion__stamp { position: absolute; left: 4%; right: 4%; bottom: 7%; padding: 2px 0; border: 2px double rgb(180 60 60 / 0.75); font: 700 0.62em/1.1 var(--f-ui); letter-spacing: 0.06em; text-transform: uppercase; text-align: center; color: rgb(210 110 100 / 0.9); transform: rotate(-6deg); }
.dossier .medallion { font-size: 20px; }

/* ---------- TV: the storm gathers (12.8 item 3), play again (item 16) ---------- */
.gathering { position: absolute; left: 50%; top: 50%; width: 760px; margin-left: -380px; transform: translateY(-50%); display: flex; flex-direction: column; align-items: center; gap: 28px; padding: 56px; border: 2px solid var(--brass); background: rgb(5 7 13 / 0.78); }
.gathering__emblem { width: 220px; height: 220px; }
.gathering__ring { position: absolute; top: 46px; left: 50%; width: 240px; height: 240px; margin-left: -120px; border-radius: 50%; border: 4px solid rgb(212 175 55 / 0.25); border-top-color: var(--brass-hi); animation: ring-turn 2.4s linear infinite; }
.gathering__line { font: 600 italic 52px/1.1 var(--f-body); color: var(--brass-hi); }
.again__plate { position: absolute; left: 104px; top: 50%; width: 860px; transform: translateY(-50%); display: flex; flex-direction: column; align-items: center; gap: 18px; padding: 56px 64px; text-align: center; border: 2px solid var(--brass); outline: 1.5px solid rgb(212 175 55 / 0.5); outline-offset: -10px; background: rgb(5 7 13 / 0.82); }
.again__quiet { font: 500 italic 48px/1.1 var(--f-body); color: var(--cream); }
.again__title { font: 700 96px/1 var(--f-display); letter-spacing: 0.06em; color: var(--brass-hi); }
.again__sharpest { font: 700 34px/1.2 var(--f-display); color: var(--cream); }
.again__line { font: 500 30px/1.3 var(--f-body); color: rgb(243 231 201 / 0.85); }
.again__phone { font: 500 italic 26px/1.2 var(--f-body); color: rgb(243 231 201 / 0.75); }

@media (prefers-reduced-motion: reduce) {
  .exterior__fog, .exterior__grade, .exterior__gap, .exterior__fan, .exterior__halo, .exterior__sill { animation: none !important; }
  .invitation, .invitation__flap, .invitation__half--l, .invitation__half--r { animation: none !important; }
  .exterior__leaf, .title__scene { transition: none !important; }
}

/* ---------- Phone (12.3): baseline 390 x 844, gutters 16, text 16 px and up, taps 48 px, primary 56 px ---------- */
.play .manor-header { position: relative; height: 38dvh; min-height: 200px; max-height: 420px; flex: none; margin: 0 -16px; overflow: hidden; }
.play .manor-header[data-size='short'] { height: 20dvh; min-height: 120px; max-height: 220px; }
.play .manor-header .exterior { position: absolute; inset: 0; }
.play .manor-header::after { content: ''; position: absolute; inset: 0; pointer-events: none; background: linear-gradient(180deg, transparent 55%, var(--velvet-deep) 100%); }
.manor-header__title { position: absolute; left: 16px; top: calc(12px + env(safe-area-inset-top)); z-index: 2; font: 700 1.25rem/1.1 var(--f-display); letter-spacing: 0.06em; color: var(--cream); text-shadow: 0 2px 8px #000, 0 0 2px #000; }
.play--join, .lobby-phone { padding-top: 0; }
.play--join { gap: 0; }
.door-sheet { position: relative; z-index: 2; margin: -28px -16px 0; padding: 24px 16px calc(24px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 14px; border-top: 2px solid var(--brass); border-radius: 24px 24px 0 0; background: linear-gradient(180deg, #10291F, var(--velvet-deep)); box-shadow: 0 -10px 30px rgb(0 0 0 / 0.6); }
.door-sheet__title { font: 700 1.4rem/1.15 var(--f-display); color: var(--brass-hi); text-align: center; }
.door-sheet__hint { font: 500 1.05rem/1.4 var(--f-body); color: rgb(243 231 201 / 0.85); text-align: center; }
.door-sheet__error { min-height: 1.4em; margin-top: -6px; font: 600 1rem/1.4 var(--f-ui); letter-spacing: 0.02em; color: #F3A3A0; text-align: center; }
.door-sheet__error:empty { min-height: 0; margin: 0; }
.door-sheet__go { width: 100%; }
.code-boxes { display: grid; gap: 8px; justify-items: center; }
.code-boxes__label { font: 700 1rem var(--f-ui); letter-spacing: 0.06em; text-transform: uppercase; color: rgb(243 231 201 / 0.85); }
.code-boxes__row { position: relative; display: flex; gap: 12px; }
.code-boxes__input { position: absolute; inset: 0; z-index: 2; width: 100%; height: 100%; opacity: 0; font-size: 16px; caret-color: transparent; border: 0; }
.code-boxes__box { display: grid; place-items: center; width: 56px; height: 72px; border: 2px solid var(--brass-line); border-radius: 12px; background: rgb(5 7 13 / 0.6); font: 700 40px/1 var(--f-display); color: var(--cream); box-shadow: inset 0 2px 6px rgb(0 0 0 / 0.6); }
.code-boxes__box[data-filled='yes'] { border-color: var(--brass); }
.code-boxes__input:focus ~ .code-boxes__box[data-next='yes'] { border-color: var(--brass-hi); box-shadow: 0 0 0 3px rgb(240 215 122 / 0.35), inset 0 2px 6px rgb(0 0 0 / 0.6); }
.code-boxes[data-error='yes'] .code-boxes__row { animation: shake 360ms ease-in-out 1; }
.code-boxes[data-error='yes'] .code-boxes__box { border-color: #C0505A; }
@keyframes shake { 20%, 60% { transform: translateX(-6px); } 40%, 80% { transform: translateX(6px); } }
.link-button { align-self: center; min-height: 48px; padding: 0 12px; border: 0; background: none; font: 600 1rem var(--f-ui); letter-spacing: 0.04em; color: var(--brass-hi); text-decoration: underline; text-underline-offset: 4px; }
.reclaim-strip { display: flex; gap: 10px; overflow-x: auto; scroll-snap-type: x mandatory; padding: 4px 2px 8px; }
.reclaim-card { scroll-snap-align: center; flex: none; display: flex; flex-direction: column; align-items: center; gap: 4px; width: 132px; padding: 8px; border: 2px solid rgb(212 175 55 / 0.35); border-radius: 12px; background: rgb(5 7 13 / 0.5); }
.reclaim-card[aria-pressed='true'] { border-color: var(--brass-hi); box-shadow: 0 0 14px var(--glow); }
.reclaim-card .dossier-portrait { width: 96px; height: 128px; }
.reclaim-card .medallion { font-size: 22px; }
.reclaim-card__name { font: 700 1rem/1.1 var(--f-display); color: var(--cream); text-align: center; }
.reclaim-card__title { font: 600 0.95rem/1.1 var(--f-ui); text-transform: uppercase; letter-spacing: 0.03em; color: rgb(243 231 201 / 0.75); text-align: center; }

.lobby-phone { gap: 14px; padding-bottom: calc(120px + env(safe-area-inset-bottom)); }
.phone-plate { position: relative; display: grid; gap: 10px; justify-items: center; text-align: center; padding: 18px 16px 20px; border: 1.5px solid var(--brass); border-radius: 16px; background: rgb(5 7 13 / 0.72); }
.phone-plate__code { font: 700 1.5rem/1 var(--f-display); letter-spacing: 0.08em; color: var(--brass-hi); }
.phone-plate__head { font: 700 1.35rem/1.2 var(--f-display); color: var(--cream); }
.phone-plate__line { font: 500 1.1rem/1.4 var(--f-body); color: rgb(243 231 201 / 0.88); }
.phone-plate--gathering { padding-top: 96px; }
.play .gathering__ring--phone { position: absolute; top: 16px; left: 50%; width: 64px; height: 64px; margin-left: -32px; border-radius: 50%; border: 3px solid rgb(212 175 55 / 0.25); border-top-color: var(--brass-hi); animation: ring-turn 2.4s linear infinite; }
.pinned-action { position: fixed; left: 0; right: 0; bottom: 0; z-index: 12; display: grid; gap: 6px; padding: 10px 16px calc(12px + env(safe-area-inset-bottom)); background: linear-gradient(180deg, transparent, rgb(5 7 13 / 0.94) 22%); }
.pinned-action .button { width: 100%; min-height: 56px; }
.pinned-action__reason { font: 500 italic 1rem/1.3 var(--f-body); color: var(--cream); text-align: center; }
/* The settings on a phone: one column, full-width segments */
.play .settings { padding: 14px; gap: 14px; }
.play .setting { flex-direction: column; align-items: stretch; gap: 6px; }
.play .setting__label { width: auto; font-size: 1rem; }
.play .setting__options { display: flex; }
.play .setting__option { flex: 1; justify-content: center; min-height: 48px; padding: 0 8px; font-size: 1rem; }
.play .setting__check { width: 8px; height: 14px; border-width: 0 3px 3px 0; }
.play .setting--gentle { grid-template-columns: 1fr auto; grid-template-areas: 'label lever' 'line line'; gap: 6px 12px; }
.play .setting--gentle .setting__label { font-size: 1rem; }
.play .setting--gentle .gentle__line { font-size: 1rem; }
.play .setting--gentle .lever { width: 96px; height: 48px; border-radius: 24px; border-width: 2px; }
.play .setting--gentle .lever__knob { width: 40px; height: 40px; top: 2px; left: 3px; }
.play .gentle[data-on='yes'] .lever__knob { left: 51px; }
.play .setting--gentle .lever__flame { width: 14px; height: 20px; }
.notices { display: grid; gap: 8px; }
.notice { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 12px; border: 1.5px solid var(--glow); border-radius: 14px; background: rgb(229 154 60 / 0.14); font: 500 1rem/1.3 var(--f-body); }
.notice .button { flex: none; min-height: 48px; padding: 0 14px; font-size: 0.95rem; }

/* The picker (12.3 items 2, 3) */
.picker { display: grid; gap: 10px; min-width: 0; }
.picker__bar { display: flex; align-items: center; gap: 8px; }
.picker__title { flex: 1; min-width: 0; font: 700 1.2rem/1.1 var(--f-display); color: var(--brass-hi); }
.chips { display: inline-flex; gap: 6px; }
.chip-button { min-height: 48px; min-width: 56px; padding: 0 12px; border: 1.5px solid var(--brass-line); border-radius: 999px; background: rgb(5 7 13 / 0.6); font: 700 0.95rem var(--f-ui); letter-spacing: 0.06em; text-transform: uppercase; color: var(--cream); }
.chip-button[aria-pressed='true'] { background: linear-gradient(180deg, #F0D77A, #D4AF37 45%, #8A6A1E); color: var(--ink); border-color: var(--brass); }
.icon-button { flex: none; width: 48px; height: 48px; display: grid; place-items: center; padding: 0; border: 1.5px solid var(--brass); border-radius: 12px; background: rgb(5 7 13 / 0.6); color: var(--brass-hi); }
.icon-button svg, .pick-card__pencil svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linejoin: round; }
.carousel { display: flex; gap: 10px; overflow-x: auto; scroll-snap-type: x mandatory; margin: 0 -16px; padding: 6px 14% 12px; scrollbar-width: none; overscroll-behavior-x: contain; }
.carousel::-webkit-scrollbar { display: none; }
.carousel__item { flex: none; width: min(72vw, 300px); scroll-snap-align: center; }
.pick-card { position: relative; display: flex; flex-direction: column; gap: 8px; padding: 10px; border: 2px solid var(--brass); border-radius: 14px; background: linear-gradient(180deg, #13281F, #07100C); transition: transform 250ms ease-out, filter 250ms ease-out, box-shadow 250ms; }
.carousel .pick-card { transform: scale(0.92); filter: brightness(0.7); }
.carousel .pick-card[data-state='focused'], .carousel .pick-card[data-state='mine'] { transform: none; filter: none; }
.pick-card[data-state='focused'] { box-shadow: 0 0 22px 2px rgb(229 154 60 / 0.55); }
.pick-card[data-state='mine'] { border-color: var(--brass-hi); box-shadow: inset 0 0 0 3px #07100C, inset 0 0 0 4.5px var(--brass-hi), 0 0 18px rgb(229 154 60 / 0.45); }
.pick-card[data-state='taken'], .pick-card[data-state='raced'], .carousel .pick-card[data-state='taken'] { filter: brightness(0.55) saturate(0.25); }
.pick-card[data-state='raced'] { animation: settle 250ms ease-out 1; }
@keyframes settle { from { transform: scale(1); filter: none; } }
.pick-card__portrait { width: 100%; aspect-ratio: 3 / 4; }
.pick-card .medallion { font-size: 34px; }
.pick-card__seal { position: absolute; right: 2px; top: 2px; width: 52px; height: 52px; z-index: 2; }
.pick-card__reserved { position: absolute; left: -6px; right: -6px; bottom: 34%; z-index: 2; padding: 6px 8px; transform: rotate(-8deg); background: var(--crimson); color: var(--cream); font: 700 1rem/1.1 var(--f-ui); letter-spacing: 0.06em; text-transform: uppercase; text-align: center; box-shadow: 0 3px 8px rgb(0 0 0 / 0.6); overflow-wrap: anywhere; }
.pick-card__plate { display: grid; gap: 2px; padding: 8px 10px; border: 1.5px solid var(--brass); border-radius: 3px; background: #0F2A20; text-align: center; box-shadow: inset 0 0 0 3px #0F2A20, inset 0 0 0 4px var(--brass-lo); }
.pick-card__title { font: 700 1rem/1.15 var(--f-ui); letter-spacing: 0.05em; text-transform: uppercase; color: var(--brass-hi); }
.pick-card__name { font: 700 1.05rem/1.2 var(--f-display); color: var(--cream); overflow-wrap: anywhere; }
.pick-card[data-state='taken'] .medallion__stamp, .pick-card[data-state='raced'] .medallion__stamp { display: none; } /* the ribbon says it */
.pick-card__pencil { position: absolute; right: -14px; top: -14px; z-index: 3; width: 48px; height: 48px; display: grid; place-items: center; padding: 0; border: 1.5px solid var(--brass); border-radius: 50%; background: rgb(5 7 13 / 0.8); color: var(--brass-hi); }
.pips { display: flex; flex-wrap: wrap; justify-content: center; gap: 5px; }
.pip { width: 8px; height: 8px; border-radius: 50%; background: rgb(212 175 55 / 0.45); }
.pip[data-taken='yes'] { background: rgb(243 231 201 / 0.15); }
.pip[data-taken='mine'] { background: var(--brass-hi); box-shadow: 0 0 6px var(--glow); }
.pip[data-on='yes'] { outline: 2px solid var(--cream); outline-offset: 1px; }
.picker__tagline { min-height: 2.6em; font: 500 italic 1.1rem/1.3 var(--f-body); color: rgb(243 231 201 / 0.9); text-align: center; }
.picker__status { min-height: 1.3em; font: 600 1rem/1.3 var(--f-ui); color: #F0C27A; text-align: center; }
.picker__status:empty { min-height: 0; }
.pick-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.pick-grid__cell { display: block; width: 100%; padding: 0; border: 0; background: none; text-align: inherit; }
.pick-grid .pick-card { gap: 4px; padding: 5px; border-width: 1.5px; border-radius: 10px; }
.pick-grid .pick-card__plate { padding: 4px 2px; }
.pick-grid .pick-card__title { font-size: 0.8rem; letter-spacing: 0.02em; overflow-wrap: anywhere; }
.pick-grid .pick-card__name { display: none; }
.pick-grid .pick-card__seal { width: 30px; height: 30px; }
.pick-grid .pick-card__reserved { font-size: 0.7rem; padding: 3px 2px; }
.pick-grid .medallion { font-size: 18px; }
.pick-grid .medallion__stamp { display: none; }

/* The name sheet (12.3 item 4) */
.name-sheet { inset: 0; display: flex; align-items: flex-end; padding: 0; background: rgb(5 7 13 / 0.7); }
.name-sheet__panel { width: 100%; display: grid; gap: 14px; justify-items: center; padding: 12px 16px calc(20px + env(safe-area-inset-bottom)); border-top: 2px solid var(--brass); border-radius: 24px 24px 0 0; background: linear-gradient(180deg, #13281F, var(--velvet-deep)); animation: sheet-up 280ms ease-out 1; }
@keyframes sheet-up { from { transform: translateY(40%); opacity: 0; } }
.name-sheet__grip { width: 44px; height: 5px; border-radius: 3px; background: rgb(212 175 55 / 0.5); }
.name-sheet__card { display: grid; justify-items: center; gap: 8px; }
.name-sheet__portrait { width: 96px; height: 128px; }
.name-sheet__portrait .medallion { font-size: 22px; }
.name-sheet__plate { max-width: 100%; padding: 6px 16px; border: 2px solid var(--brass); background: #0F2A20; font: 700 1.2rem/1.2 var(--f-display); color: var(--cream); overflow-wrap: anywhere; text-align: center; }
.name-sheet__label { width: 100%; display: grid; gap: 8px; font: 700 1.2rem/1.2 var(--f-display); color: var(--brass-hi); text-align: center; }
.name-sheet__input { width: 100%; min-height: 56px; padding: 8px 14px; border: 2px solid var(--brass); border-radius: 14px; background: rgb(5 7 13 / 0.6); color: var(--cream); font: 600 1.25rem var(--f-body); text-align: center; }
.name-sheet__panel .button { width: 100%; }

/* Waiting (12.3 item 5) */
.waiting { display: grid; gap: 12px; justify-items: center; }
.waiting__me { width: 160px; }
.waiting__me .pick-card { padding: 8px; gap: 6px; }
.waiting__me .medallion { font-size: 24px; }
.waiting__me .pick-card__seal { width: 40px; height: 40px; right: auto; left: -10px; top: -10px; }
.waiting__head { font: 700 1.15rem/1.1 var(--f-display); color: var(--brass-hi); }
.who-strip { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px 8px; }
.who-strip__guest { display: grid; justify-items: center; gap: 2px; width: 84px; }
.who-strip__name { font: 600 0.95rem/1.1 var(--f-body); text-align: center; overflow-wrap: normal; hyphens: none; text-wrap: balance; }
.who-strip__guest[data-me='yes'] .who-strip__name { color: var(--brass-hi); }
.waiting__status { font: 500 italic 1.1rem/1.3 var(--f-body); text-align: center; }
.summary-line { display: flex; width: 100%; align-items: center; justify-content: space-between; gap: 10px; min-height: 56px; padding: 6px 14px; border: 1.5px solid var(--brass); border-radius: 14px; background: rgb(5 7 13 / 0.6); font: 600 1rem/1.3 var(--f-ui); text-align: left; }
.summary-line__change { flex: none; color: var(--brass-hi); text-transform: uppercase; letter-spacing: 0.06em; text-decoration: underline; text-underline-offset: 3px; }

/* Play again on the phone (12.8 item 16) and the host-handover notice */
.again-bar { position: relative; overflow: hidden; margin-top: 16px; border: 2px solid var(--brass); border-radius: 18px; min-height: 200px; display: grid; align-items: end; }
.again-bar__scene { position: absolute; inset: 0; }
.again-bar__words { position: relative; display: grid; gap: 10px; justify-items: center; padding: 16px; background: linear-gradient(180deg, transparent, rgb(5 7 13 / 0.85) 40%); }
.again-bar__quiet { font: 600 italic 1.25rem/1.2 var(--f-body); color: var(--cream); text-shadow: 0 2px 6px #000; }
.again-bar__words .button { width: 100%; }
.again-bar__wait { font: 500 1rem/1.3 var(--f-body); }
.toast--host { background: linear-gradient(180deg, #F0D77A, #D4AF37 45%, #8A6A1E); color: var(--ink); }
@media (prefers-reduced-motion: reduce) { .code-boxes[data-error='yes'] .code-boxes__row, .pick-card, .name-sheet__panel { animation: none !important; transition: none !important; } }
/* Phone landscape (844 x 390): the header gives way to the controls */
@media (orientation: landscape) and (max-height: 500px) {
  .play .manor-header { height: 34dvh; min-height: 96px; }
  .play .manor-header[data-size='short'] { height: 22dvh; min-height: 72px; }
  .carousel__item { width: min(34vw, 220px); }
}

/* ---------- Rain (12.4a on the exterior, 7.5a on the glass): soft veils, beads, runnels; never streak lines ---------- */
/* The exterior: three veil layers from one baked tile, fog woven between (far, fog A, mid, fog B, near). */
.veil { --veil-tile: url("data:image/svg+xml,%3Csvg%20xmlns%3D'http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg'%20width%3D'1024'%20height%3D'1024'%3E%3Cfilter%20id%3D'v'%20x%3D'0'%20y%3D'0'%20width%3D'100%25'%20height%3D'100%25'%3E%3CfeTurbulence%20type%3D'fractalNoise'%20baseFrequency%3D'0.022%200.0035'%20numOctaves%3D'3'%20seed%3D'7'%20stitchTiles%3D'stitch'%2F%3E%3CfeColorMatrix%20values%3D'0%200%200%200%200.624%20%200%200%200%200%200.690%20%200%200%200%200%200.816%20%201.9%200%200%200%20-0.95'%2F%3E%3CfeComponentTransfer%3E%3CfeFuncA%20type%3D'linear'%20slope%3D'0.85'%20intercept%3D'0'%2F%3E%3C%2FfeComponentTransfer%3E%3C%2Ffilter%3E%3Crect%20width%3D'1024'%20height%3D'1024'%20filter%3D'url(%23v)'%2F%3E%3C%2Fsvg%3E"); position: absolute; inset: -40%; pointer-events: none; mix-blend-mode: screen; transform: rotate(var(--ang)); will-change: transform, opacity; }
.veil__sheet { position: absolute; left: 0; right: 0; top: calc(-1 * var(--tile)); bottom: 0; background-image: var(--veil-tile); background-size: var(--tile) var(--tile); filter: blur(var(--blur)); animation: veil-fall var(--fall-s) linear infinite; will-change: transform; }
@keyframes veil-fall { to { transform: translate3d(0, var(--tile), 0); } }
@keyframes veil-wobble { from { transform: rotate(calc(var(--ang) - 2deg)); } to { transform: rotate(calc(var(--ang) + 2deg)); } }
@keyframes veil-rise { from { opacity: var(--drizzle); } to { opacity: var(--steady); } }
@keyframes veil-ease { from { opacity: var(--steady); } to { opacity: calc(var(--drizzle) * 0.4); } }
.veil--far { --ang: 11deg; --tile: 614px; --blur: 6px; --fall-s: 17.5s; --drizzle: 0.05; --steady: 0.08; --storm: 0.11; }
.veil--mid { --ang: 12deg; --tile: 1024px; --blur: 3px; --fall-s: 15.8s; --drizzle: 0.06; --steady: 0.1; --storm: 0.14; }
.veil--near { --ang: 14deg; --tile: 1843px; --blur: 2px; --fall-s: 16.8s; --drizzle: 0.04; --steady: 0.08; --storm: 0.12; }
/* Night (the lobby): drizzle on arrival, steady after about ten minutes of waiting (the night-falls curve). The still frame is steady. */
.exterior[data-grade='night'] .veil { opacity: var(--steady); }
.exterior[data-grade='night'] .veil--far { animation: veil-wobble 17s ease-in-out infinite alternate, veil-rise 600s ease-out both; }
.exterior[data-grade='night'] .veil--mid { animation: veil-wobble 23s ease-in-out infinite alternate, veil-rise 600s ease-out both; }
.exterior[data-grade='night'] .veil--near { animation: veil-wobble 29s ease-in-out infinite alternate, veil-rise 600s ease-out both; }
/* Dawn: the rain eases to 40% of drizzle over 20 s, never off abruptly. */
.exterior[data-grade='dawn'] .veil { opacity: calc(var(--drizzle) * 0.4); animation: veil-ease 20s ease-out both; }
.exterior[data-weather='storm'] .veil { opacity: var(--storm); --ang-storm: 3deg; }
/* The porch lamp: the warm veil and the flecks are seen only where the light catches them. */
.porch-rain__warm-sheet { fill: url(#p-veil); opacity: 0.55; filter: sepia(1) saturate(2.2) brightness(1.4); mix-blend-mode: screen; animation: warm-fall 2.8s linear infinite; }
@keyframes warm-fall { from { transform: translateY(-256px); } to { transform: translateY(0); } }
.porch-rain__warm { animation: candle 4s ease-in-out infinite; }
.porch-rain__fleck { fill: rgb(255 226 170 / 0.35); }
.porch-rain__sheen { fill: #7F93B8; opacity: 0.13; mix-blend-mode: screen; animation: sheen 7s ease-in-out infinite alternate; }
@keyframes sheen { from { opacity: 0.08; } to { opacity: 0.18; } }
.porch-rain__smear { fill: #E59A3C; opacity: 0.1; mix-blend-mode: screen; animation: candle 4s ease-in-out infinite; }
.porch-rain__ripple { fill: none; stroke: rgb(169 184 214); stroke-width: 1.6; }
.exterior[data-grade='dawn'] .porch-rain__warm, .exterior[data-grade='dawn'] .porch-rain__fleck, .exterior[data-grade='dawn'] .porch-rain__smear { display: none; }
.exterior[data-grade='dawn'] .porch-rain__sheen { animation: none; opacity: 0.06; }

/* The glass: beads hold, runnels gather and slide, a faint veil outside, a wet shade at the foot. Act 1 light, Act 3 heavy. */
.pane-rain { pointer-events: none; }
.pane-rain__veil { fill: url(#p-veil); mix-blend-mode: screen; opacity: 0.04; transform-box: fill-box; animation: pane-fall 4s linear infinite; }
@keyframes pane-fall { to { transform: translateY(50%); } } /* the rect is two panes tall: half its height is one pane */
.pane-rain__shade { fill: url(#g-wet); mix-blend-mode: multiply; opacity: 0.5; }
.pane-rain__bead { opacity: 0.35; }
.pane-rain__drop { fill: url(#g-bead); }
.pane-rain__rim { fill: url(#g-bead-rim); mix-blend-mode: multiply; }
.pane-rain__spot { fill: rgb(220 230 255 / 0.55); mix-blend-mode: screen; }
.pane-rain__bead[data-set='2'], .pane-rain__bead[data-set='3'] { display: none; }
.pane-rain__trail { fill: none; stroke: rgb(190 205 235 / 0.22); stroke-linecap: round; }
.pane-rain__head { fill: url(#g-bead); stroke: rgb(220 230 255 / 0.35); stroke-width: 0.6; }
.pane-rain__runnel[data-n='2'], .pane-rain__runnel[data-n='3'], .pane-rain__runnel[data-n='4'], .pane-rain__runnel[data-n='5'] { display: none; }
[data-act='2'] .pane-rain__veil { opacity: 0.07; }
[data-act='2'] .pane-rain__shade { opacity: 0.8; }
[data-act='2'] .pane-rain__bead { opacity: 0.55; }
[data-act='2'] .pane-rain__bead[data-set='2'], [data-act='2'] .pane-rain__runnel[data-n='2'], [data-act='2'] .pane-rain__runnel[data-n='3'] { display: inline; }
[data-act='3'] .pane-rain__veil { opacity: 0.1; }
[data-act='3'] .pane-rain__shade { opacity: 1; }
[data-act='3'] .pane-rain__bead { opacity: 0.75; animation: bead-catch 17s linear infinite; }
[data-act='3'] .pane-rain__bead[data-set], [data-act='3'] .pane-rain__runnel[data-n] { display: inline; }
/* Lightning (Act 3 only): the beads catch the flash, x1.4 for the 70 ms, in step with the window flash keyframes. */
@keyframes bead-catch { 0%, 3.9% { opacity: 0.75; } 4% { opacity: 1; } 4.4%, 100% { opacity: 0.75; } }

@media (prefers-reduced-motion: reduce) {
  .veil, .veil__sheet, .pane-rain__veil, .porch-rain__warm-sheet { animation: none !important; }
  .exterior[data-grade='night'] .veil { opacity: calc(var(--steady) * 0.8); }
  .porch-rain__sheen { animation: none !important; opacity: 0.13; }
}

/* Sound credits (CC BY 4.0 asks for the wind's author by name): quiet, on the play-again screens. */
.credits { position: absolute; left: 104px; right: 104px; bottom: 28px; font: 500 22px/1.3 var(--f-body); color: rgb(243 231 201 / 0.82); text-shadow: 0 1px 4px #000; }
.credits--phone { position: static; font-size: 0.9rem; text-align: center; }
