/* Hollowmere — "Lantern Tales". A bedtime book you shouldn't read alone:
   warm windows, painted fog, and something patient in the water.
   Source of truth: design/storybook/README.md. Two typefaces (Young Serif for
   voice, Figtree for work), one lantern-gold action colour, and a three-way
   side code: silhouette + word + colour, never colour alone. */

:root {
  /* colour */
  --hm-dusk: #17162A;
  --hm-dusk-2: #232241;
  --hm-fog: #3A3960;
  --hm-mist: #A9A5C4;
  --hm-cream: #F5EBDA;
  --hm-cream-2: #D8D2E6;
  --hm-lantern: #F2B65A;
  --hm-lantern-text: #F7D59A;
  --hm-lantern-soft: #F2D7A8;
  --hm-moon: #B7A8F0;
  --hm-moon-text: #CFC4F7;
  --hm-moon-title: #D9CFFB;
  --hm-dawn: #2A2036;
  --hm-dawn-2: #3A2D48;
  --hm-dawn-3: #54436A;
  --hm-dawn-mist: #BFB3C9;
  --hm-dead: #6D6A90;        /* outlines, dots, empty rings */
  --hm-dead-text: #9391B6;   /* dead / disabled TEXT, lifted to pass 4.5:1 */
  --hm-error: #FF9C85;
  --hm-error-text: #FFB4A3;

  /* type */
  --hm-font-display: 'Young Serif', Georgia, serif;
  --hm-font-ui: 'Figtree', system-ui, -apple-system, 'Segoe UI', sans-serif;

  /* shape */
  --hm-r-tile: 16px;
  --hm-r-card: 24px;
  --hm-r-sheet: 28px;
  --hm-r-pill: 999px;

  /* sizes */
  --hm-tap: 54px;
  --hm-seat-h: 50px;
  --hm-avatar: 36px;

  /* light */
  --hm-glow-lantern: 0 6px 24px rgb(242 182 90 / .35);
  --hm-glow-moon: 0 0 40px rgb(183 168 240 / .12);
  --hm-shadow-sheet: 0 -12px 30px rgb(0 0 0 / .35);

  --gx: 14px;   /* block side margin on mobile */
  --sx: 12px;   /* seat-grid side padding on mobile */
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; background: var(--hm-dusk); overscroll-behavior-y: contain; }
body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  overscroll-behavior-y: contain;
  /* notch / rounded corners in landscape */
  padding-left: env(safe-area-inset-left); padding-right: env(safe-area-inset-right);
  -webkit-tap-highlight-color: transparent;
  background: var(--hm-dusk);
  color: var(--hm-cream);
  font: 400 15px/1.45 var(--hm-font-ui);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
body[data-ground='day'] { background: var(--hm-dawn); }
body[data-ground='day']::before {
  content: ''; position: fixed; inset: 0; pointer-events: none; z-index: 0;
  background: radial-gradient(ellipse 90% 30% at 50% 0%, rgb(242 182 90 / .28), transparent 70%);
}
body[data-screen='lobby']::before {
  content: ''; position: fixed; inset: 0; pointer-events: none; z-index: 0;
  background: radial-gradient(ellipse 80% 30% at 50% 12%, rgb(242 182 90 / .22), transparent 70%);
}
#app { position: relative; z-index: 1; }
[hidden] { display: none !important; }

h1, h2, h3, h4, p, ul, ol, dl, dd { margin: 0; }
ul, ol { padding: 0; list-style: none; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }

/* ------------------------------------------------------------------ touch
   No double-tap zoom or 300ms delay; no grey flash (visible :active instead, since a phone has no
   hover); tiles and buttons are not text-selectable, chat and whispers still are. */
button, a, input, [data-act], [data-tab], .seat-in, .curtain, .herald { touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
button, .seat-in, .tag, .pill, .sheet, .tabs, .fp, .rv, .census li, .herald, .curtain, .tally, .meta, .bar { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
input, .bub, .note-paper, .timeline .tx, .tl-row, .code-big, .cv-note { -webkit-user-select: text; user-select: text; }
.btn:active, .copy-btn:active, .send:active, .round-btn:active, .step:active, .tab:active, .slotb:active, .gift:active, .filllabel:active, .roomline:active { transform: scale(.96); filter: brightness(1.15); }
button.seat-in:not(:disabled):active { transform: scale(.97); filter: brightness(1.2); }
.btn:active, .copy-btn:active, .send:active, .round-btn:active, .step:active, .tab:active, .slotb:active, .gift:active, button.seat-in:active, .herald:active { transition: transform .06s; }
.btn:disabled:active, .step:disabled:active { transform: none; filter: none; }
a { color: var(--hm-lantern); text-underline-offset: 3px; }
:focus-visible { outline: 3px solid var(--hm-cream); outline-offset: 3px; }
input:focus-visible { outline: none; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ------------------------------------------------------------------ motion: only these two */
@keyframes hmFog { from { transform: translateX(-6%); } to { transform: translateX(6%); } }
@keyframes hmGlow { 0%, 100% { opacity: .85; } 38% { opacity: .6; } 42% { opacity: 1; } 68% { opacity: .75; } }
.fogwrap { position: fixed; inset: 0; overflow: hidden; pointer-events: none; z-index: 0; }
.fog {
  position: absolute; inset: 0 -15%; pointer-events: none;
  /* No filter: blur on a full-screen layer is costly on phones, and these gradients are already soft. */
  animation: hmFog 40s ease-in-out infinite alternate;
  background:
    radial-gradient(ellipse 50% 18% at 30% 72%, rgb(169 165 196 / .22), transparent 70%),
    radial-gradient(ellipse 45% 14% at 75% 84%, rgb(169 165 196 / .18), transparent 70%),
    radial-gradient(ellipse 60% 12% at 55% 58%, rgb(245 235 218 / .08), transparent 70%);
}
.bg .fog, .bg .lamp { animation-play-state: paused; }
.banner .fog { animation: none; }
.lamp { display: inline-block; flex: none; width: 10px; height: 12px; border-radius: 5px 5px 2px 2px; background: var(--hm-dusk); animation: hmGlow 3.4s infinite; }
.lamp.lg { width: 20px; height: 24px; border-radius: 10px 10px 4px 4px; background: var(--hm-lantern); box-shadow: 0 0 30px 8px rgb(242 182 90 / .4); }

/* ------------------------------------------------------------------ side coding glyphs */
.glyph { display: inline-block; flex: none; width: 9px; height: 11px; border-radius: 5px 5px 2px 2px; background: var(--hm-lantern); }
.glyph.drowned { width: 9px; height: 9px; border-radius: 0 50% 50% 50%; background: var(--hm-moon); transform: rotate(45deg); }
.glyph.neutral { width: 14px; height: 7px; border-radius: 4px; background: var(--hm-mist); transform: rotate(-10deg); }

/* ------------------------------------------------------------------ tags and pills */
.tag {
  display: inline-flex; align-items: center; gap: 6px; align-self: flex-start;
  font: 800 11px/1 var(--hm-font-ui); letter-spacing: .08em; text-transform: uppercase;
  padding: 4px 10px; border-radius: 99px; white-space: nowrap;
}
.tag.side.village { background: rgb(242 182 90 / .16); color: var(--hm-lantern-text); }
.tag.side.drowned { background: rgb(183 168 240 / .18); color: var(--hm-moon-title); }
.tag.side.neutral { border: 1.5px dashed var(--hm-mist); color: var(--hm-cream-2); padding: 3px 10px; }
.tag.side.solid.village { background: var(--hm-lantern); color: var(--hm-dusk); }
.tag.side.solid.drowned { background: var(--hm-moon); color: var(--hm-dusk); }
.tag.side.solid.neutral { background: var(--hm-mist); color: var(--hm-dusk); border: 0; padding: 4px 10px; }
.tag.solid .glyph { background: var(--hm-dusk); }
.pill { display: inline-block; flex: none; font: 800 10px/1 var(--hm-font-ui); letter-spacing: .06em; padding: 3px 6px; border-radius: 99px; white-space: nowrap; }
.pill.host { background: var(--hm-lantern); color: var(--hm-dusk); }
.pill.bot { background: var(--hm-fog); color: var(--hm-cream-2); }
.pill.you { background: var(--hm-cream); color: var(--hm-dusk); }
.pill.away { background: var(--hm-dusk-2); color: var(--hm-cream-2); border: 1.5px solid var(--hm-mist); padding: 1.5px 5px; }

/* ------------------------------------------------------------------ buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  min-height: var(--hm-tap); padding: 0 24px; border-radius: var(--hm-r-pill);
  border: 2px solid transparent; background: transparent; color: var(--hm-cream);
  font: 700 16px/1.1 var(--hm-font-ui); text-align: center;
}
.btn.block { width: 100%; }
.btn.big { min-height: 60px; font-size: 17px; }
.btn.small { min-height: 44px; padding: 0 16px; font-size: 14px; }
.btn.primary { background: var(--hm-lantern); color: var(--hm-dusk); font-weight: 800; font-size: 17px; box-shadow: var(--hm-glow-lantern); }
.btn.secondary { border-color: var(--hm-cream); }
.btn.tertiary, .btn.quiet { background: var(--hm-dusk-2); }
.btn.warn { background: rgb(242 182 90 / .18); border-color: var(--hm-lantern); color: var(--hm-lantern-text); font-weight: 800; }
.btn.toggled, .btn.secondary.on { background: rgb(242 182 90 / .18); border-color: var(--hm-lantern); color: var(--hm-lantern-text); font-weight: 800; box-shadow: none; }
.btn:disabled { background: var(--hm-dusk-2); color: var(--hm-dead-text); border-color: transparent; box-shadow: none; cursor: not-allowed; }
.btn.sent { cursor: default; font-size: 15px; }
.check { width: 11px; height: 11px; stroke: currentColor; stroke-width: 2.2; fill: none; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.btn .check { width: 15px; height: 15px; }
.chev { width: 18px; height: 18px; stroke: currentColor; stroke-width: 2; fill: none; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.round-btn { width: 44px; height: 44px; border-radius: 50%; background: var(--hm-dusk-2); border: 0; display: grid; place-items: center; }
.round-btn svg { width: 22px; height: 22px; stroke: var(--hm-cream); stroke-width: 2; fill: none; stroke-linecap: round; stroke-linejoin: round; }
.m { display: inline; } .d { display: none; }

/* ------------------------------------------------------------------ inputs */
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font: 600 13px/1.3 var(--hm-font-ui); color: var(--hm-mist); }
.input {
  width: 100%; height: 56px; border-radius: var(--hm-r-tile); background: var(--hm-dusk);
  border: 1.5px solid var(--hm-fog); padding: 0 16px; font: 600 18px var(--hm-font-ui); color: var(--hm-cream);
}
.input::placeholder { color: var(--hm-mist); font-weight: 400; opacity: 1; }
.input:focus { background: var(--hm-dusk); border: 2px solid var(--hm-lantern); box-shadow: 0 0 0 4px rgb(242 182 90 / .15); caret-color: var(--hm-lantern); outline: none; }
.input.err, .codefield.err { border: 2px solid var(--hm-error); }
.field-err { font-size: 13px; color: var(--hm-error-text); }
.field-err:empty { display: none; }
.codefield {
  position: relative; flex: 1; min-width: 0; height: 58px; border-radius: var(--hm-r-tile); background: var(--hm-dusk);
  border: 1.5px solid var(--hm-fog); display: flex; align-items: center; justify-content: center;
  font: 400 24px/1 var(--hm-font-display); letter-spacing: .2em; color: var(--hm-cream);
}
.codefield .slots { display: flex; padding-left: .2em; }
.codefield .slots i { font-style: normal; width: 1.05em; text-align: center; color: var(--hm-fog); }
.codefield .slots i.on { color: var(--hm-cream); }
.codefield .slots i.next { color: var(--hm-lantern); }
.codefield.focus { border: 2px solid var(--hm-lantern); box-shadow: 0 0 0 4px rgb(242 182 90 / .15); }
.codefield input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; font-size: 16px; border: 0; background: none; }

/* ------------------------------------------------------------------ home */
.home { position: relative; }
.hero { position: relative; }
.hero-stage { position: relative; height: 420px; overflow: hidden; }
.hero-art { position: absolute; inset: 0; overflow: hidden; }
.hero .hero-art {
  background:
    radial-gradient(ellipse 60% 40% at 70% 38%, rgb(242 182 90 / .45), transparent 70%),
    linear-gradient(180deg, #2c2a55 0%, #1d1c38 60%, #17162A 100%);
}
.hero-img { position: absolute; inset: 0; background-size: cover; background-position: center; background-image: var(--img-m, none); }
.hero-img::after { content: ''; position: absolute; inset: 0; background: linear-gradient(0deg, rgb(23 22 42 / .7), transparent 55%); }
.hub-back { position: absolute; top: calc(22px + env(safe-area-inset-top)); right: 18px; z-index: 2; font: 700 12px/1 var(--hm-font-ui); letter-spacing: .08em; text-transform: uppercase; color: var(--hm-cream); text-decoration: none; background: rgb(23 22 42 / .6); padding: 8px 12px; border-radius: 99px; }
.over-hub { margin: 18px 0 0; text-align: center; font-size: 13px; color: var(--hm-mist); }
.over-hub a { color: var(--hm-lantern-text); }
.hero-brand { position: absolute; top: calc(16px + env(safe-area-inset-top)); left: 22px; height: 38px; width: auto; }
.mark { display: block; flex: none; width: 26px; height: 33px; }
.bar-l { display: flex; align-items: center; gap: 10px; min-width: 0; }
.bar-t { min-width: 0; }
.lt-brand { display: inline-flex; align-items: center; gap: 10px; }
.topnav { display: none; }
.hero-copy { position: absolute; left: 22px; right: 22px; bottom: 26px; display: flex; flex-direction: column; gap: 10px; }
.pill-label { align-self: flex-start; font: 700 12px/1.2 var(--hm-font-ui); letter-spacing: .14em; text-transform: uppercase; background: rgb(23 22 42 / .6); padding: 5px 10px; border-radius: 99px; }
.hero h1 { font: 400 clamp(40px, 14.4vw, 64px)/.95 var(--hm-font-display); text-shadow: 0 2px 30px rgb(0 0 0 / .6), 0 0 30px rgb(242 182 90 / .3); }
.hook { font: 400 19px/1.35 var(--hm-font-display); color: var(--hm-lantern-soft); text-wrap: pretty; }
.join-card {
  position: relative; margin: -6px var(--gx) 0; background: var(--hm-dusk-2); border-radius: 26px; padding: 20px 18px;
  display: flex; flex-direction: column; gap: 12px; box-shadow: 0 -10px 30px rgb(0 0 0 / .3); z-index: 2;
}
.join-row { display: flex; gap: 8px; }
.join-row .btn { height: 58px; padding: 0 18px; font-size: 15px; flex: none; }
.invite-note { font: 600 14px/1.4 var(--hm-font-ui); color: var(--hm-lantern-text); background: rgb(242 182 90 / .12); border-radius: 14px; padding: 10px 14px; }
.invite-note b { letter-spacing: .12em; }

.how { padding: 30px 18px 10px; }
.how h2, .who-head h2 { font: 400 28px/1 var(--hm-font-display); }
.steps { display: flex; flex-direction: column; gap: 14px; margin-top: 14px; }
.steps li { display: grid; grid-template-columns: 52px 1fr; gap: 14px; align-items: center; }
.orb { width: 52px; height: 52px; border-radius: 50%; display: grid; place-items: center; font: 400 22px var(--hm-font-display); color: var(--hm-dusk); }
.orb.a { background: radial-gradient(circle at 50% 40%, #F2B65A, #a5702a); }
.orb.b { background: radial-gradient(circle at 50% 40%, #F5EBDA, #a9a5c4); }
.orb.c { background: radial-gradient(circle at 50% 40%, #B7A8F0, #5b4f9a); }
.steps h3 { font: 700 16px/1.3 var(--hm-font-ui); }
.steps p { font: 400 14px/1.45 var(--hm-font-ui); color: var(--hm-cream-2); }
.steps-note { margin-top: 14px; font-size: 13px; color: var(--hm-mist); }

.village-gal { padding: 24px 14px 30px; }
.who-head { padding: 0 4px; }
.who-sub { display: none; }
.gallery { display: flex; flex-direction: column; margin-top: 12px; }
.gal-head { display: flex; align-items: center; gap: 8px; font: 700 13px var(--hm-font-ui); padding: 0 4px; margin: 14px 0 10px; }
.gal-group.village .gal-head { color: var(--hm-lantern); }
.gal-group.drowned .gal-head { color: var(--hm-moon); }
.gal-group.neutral .gal-head { color: var(--hm-mist); }
.gal-head .glyph.village { width: 12px; height: 15px; border-radius: 6px 6px 2px 2px; }
.gal-head .glyph.drowned { width: 12px; height: 12px; }
.gal-head .glyph.neutral { width: 16px; height: 8px; }
.gal-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.role-tile { background: var(--hm-dusk-2); border-radius: 18px; padding: 8px 8px 10px; display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.role-tile h3 { font: 700 12.5px/1.2 var(--hm-font-ui); text-align: center; min-height: 30px; display: grid; place-items: center; }
.role-tile .side-word, .role-tile .ab { display: none; }
.role-tile.drowned { background: #1F1D3D; border: 1.5px solid rgb(183 168 240 / .45); }
.role-tile.neutral { grid-column: 1 / -1; display: grid; grid-template-columns: 76px 1fr; grid-template-areas: 'p h' 'p a'; align-content: center; column-gap: 12px; row-gap: 3px; border: 1.5px dashed var(--hm-mist); border-radius: 22px; padding: 10px; }
.role-tile.neutral .portrait { grid-area: p; width: 76px; aspect-ratio: 1; border-radius: 38px; }
.role-tile.neutral h3 { grid-area: h; font: 400 22px/1 var(--hm-font-display); text-align: left; min-height: 0; place-items: end start; }
.role-tile.neutral .ab { grid-area: a; display: block; font: 400 13.5px/1.4 var(--hm-font-ui); color: var(--hm-cream-2); }
.foot { padding: 18px 18px 40px; color: var(--hm-mist); font-size: 13px; text-align: center; }

/* ------------------------------------------------------------------ portraits (gradient fallbacks; art swaps in via ROLE_ART) */
.portrait { position: relative; overflow: hidden; display: grid; aspect-ratio: 4 / 5; font: 400 18px var(--hm-font-display); }
.portrait img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.portrait:has(img) b { display: none; }
.portrait.village { border-radius: var(--arch, 40px) var(--arch, 40px) 10px 10px; background: radial-gradient(ellipse at 50% 30%, rgb(242 182 90 / .4), transparent 65%), #2d2b52; place-items: end center; padding-bottom: 8px; color: var(--hm-lantern); }
.portrait.drowned { border-radius: 10px 10px var(--arch, 40px) var(--arch, 40px); background: radial-gradient(ellipse at 50% 75%, rgb(183 168 240 / .45), transparent 65%), #24224a; place-items: start center; padding-top: 8px; color: var(--hm-moon); }
.portrait.neutral { border-radius: var(--arch, 40px); background: radial-gradient(circle, rgb(169 165 196 / .35), transparent 70%), #2d2b52; place-items: center; color: var(--hm-mist); }

/* silhouette + initial: arch, droplet, plank */
.sil { position: relative; display: grid; place-items: center; flex: none; width: 34px; height: 40px; }
.sil::before { content: ''; grid-area: 1 / 1; }
.sil b { grid-area: 1 / 1; position: relative; font: 400 15px/1 var(--hm-font-display); color: var(--hm-dusk); }
.sil.village::before { width: 34px; height: 40px; border-radius: 17px 17px 6px 6px; background: var(--hm-lantern); }
.sil.drowned::before { width: 26px; height: 26px; border-radius: 0 50% 50% 50%; background: var(--hm-moon); transform: rotate(45deg) translate(2px, 2px); }
.sil.drowned b { margin-top: 6px; font-size: 14px; }
.sil.neutral::before { width: 34px; height: 18px; border-radius: 9px; background: var(--hm-mist); transform: rotate(-10deg); }
.sil.sm { width: 36px; height: 36px; }
.sil.sm.village::before { width: 28px; height: 34px; border-radius: 14px 14px 5px 5px; }
.sil.sm.neutral::before { width: 32px; height: 17px; }

/* ------------------------------------------------------------------ lobby */
.lobby { position: relative; z-index: 1; max-width: 560px; margin: 0 auto; min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; gap: 18px; padding: calc(20px + env(safe-area-inset-top)) 16px 0; }
.lobby-top { display: flex; justify-content: space-between; align-items: center; font: 600 14px var(--hm-font-ui); color: var(--hm-mist); }
.lobby-top i { width: 44px; }
.code-card { background: var(--hm-dusk-2); border-radius: 28px; padding: 20px 18px 18px; display: flex; flex-direction: column; align-items: center; gap: 10px; box-shadow: inset 0 0 60px rgb(242 182 90 / .12); }
.cc-label { font: 600 13px var(--hm-font-ui); color: var(--hm-mist); }
.code-big { font: 400 clamp(60px, 22vw, 92px)/1 var(--hm-font-display); letter-spacing: .1em; padding-left: .1em; color: var(--hm-lantern-text); text-shadow: 0 0 34px rgb(242 182 90 / .55); max-width: 100%; }
.copy-btn { width: 100%; height: 52px; border-radius: 99px; border: 0; background: var(--hm-cream); color: var(--hm-dusk); font: 800 15px var(--hm-font-ui); }
.copy-btn.done { background: var(--hm-lantern); font-size: 14px; }
.sec-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.sec-head h2 { font: 400 24px/1.1 var(--hm-font-display); }
.sec-head .count { font: 700 14px var(--hm-font-ui); color: var(--hm-lantern); white-space: nowrap; }
.fire { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px 6px; }
.fp { display: flex; flex-direction: column; align-items: center; gap: 5px; min-width: 0; }
.fav { position: relative; width: 52px; height: 52px; display: grid; place-items: center; font: 400 20px var(--hm-font-display); margin-bottom: 4px; }
.fav.human { border-radius: 50%; background: radial-gradient(circle at 50% 35%, #3f3d6e, #2a2850); border: 2px solid rgb(242 182 90 / .5); }
.fav.bot { border-radius: 16px; background: var(--hm-dusk-2); border: 2px dashed var(--hm-mist); color: var(--hm-mist); }
.fav.away { opacity: .6; border-style: dashed; }
.fav.open { border-radius: 50%; border: 1.5px dashed var(--hm-fog); }
.fav .pill { position: absolute; bottom: -7px; left: 50%; transform: translateX(-50%); }
.fav .pill.bot { background: var(--hm-mist); color: var(--hm-dusk); }
.rm { position: absolute; top: -8px; right: -8px; width: 24px; height: 24px; border-radius: 50%; border: 2px solid var(--hm-dusk); background: var(--hm-fog); display: grid; place-items: center; padding: 0; }
.rm::after { content: ''; position: absolute; inset: -10px; } /* 44px hit area around the 24px dot */
.rm svg { width: 12px; height: 12px; stroke: var(--hm-cream); stroke-width: 1.8; fill: none; stroke-linecap: round; }
.fn { font: 600 12.5px/1.2 var(--hm-font-ui); text-align: center; max-width: 100%; overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.fn.open { font-weight: 400; font-size: 12px; color: var(--hm-dead-text); }
.dist { background: var(--hm-dusk-2); border-radius: var(--hm-r-card); padding: 16px 18px; }
.dist h3 { font: 400 20px/1.1 var(--hm-font-display); }
.dist-sum { font: 600 14px var(--hm-font-ui); color: var(--hm-lantern-text); margin: 4px 0 10px; }
.dist dt { display: flex; align-items: center; gap: 8px; font: 800 11px var(--hm-font-ui); letter-spacing: .1em; text-transform: uppercase; color: var(--hm-mist); margin-top: 10px; }
.dist dd { font: 400 14px/1.45 var(--hm-font-ui); color: var(--hm-cream-2); margin: 3px 0 0; }
.host-bar { position: sticky; bottom: 0; margin: auto -16px 0; padding: 18px 16px calc(14px + env(safe-area-inset-bottom)); background: linear-gradient(180deg, transparent, rgb(23 22 42 / .95) 34%); display: flex; flex-direction: column; gap: 8px; }
.host-row { display: flex; gap: 8px; }
.host-row .btn { flex: 1; height: 52px; min-height: 52px; padding: 0; font-size: 14px; }
.fillpill { flex: 1.35; height: 52px; border-radius: 99px; background: var(--hm-dusk-2); display: flex; align-items: center; padding: 0 4px 0 16px; gap: 2px; }
.filllabel { flex: 1; height: 100%; background: none; border: 0; text-align: left; font: 700 14px var(--hm-font-ui); padding: 0; }
.filllabel:disabled { color: var(--hm-dead-text); cursor: not-allowed; }
.step { width: 44px; height: 44px; border-radius: 50%; background: var(--hm-fog); border: 0; font: 600 20px/1 var(--hm-font-ui); display: grid; place-items: center; padding: 0; }
.step:disabled { opacity: .4; cursor: not-allowed; }
.host-hint { font: 400 12.5px/1.4 var(--hm-font-ui); color: var(--hm-mist); text-align: center; }
.host-hint.wait-host { background: var(--hm-dusk-2); border-radius: 18px; padding: 14px; font-size: 14px; color: var(--hm-cream-2); }

/* ------------------------------------------------------------------ game: bar */
.game { position: relative; z-index: 1; min-height: 100vh; min-height: 100dvh; }
.bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: calc(16px + env(safe-area-inset-top)) 16px 10px; }
.bar-title { font: 400 30px/1 var(--hm-font-display); }
.roomline { display: block; background: none; border: 0; min-height: 44px; padding: 14px 12px 14px 0; margin: -12px 0 -16px; font: 600 12px var(--hm-font-ui); color: var(--hm-mist); letter-spacing: .02em; }
body[data-ground='day'] .roomline { color: var(--hm-dawn-mist); }
.tide { display: flex; align-items: center; gap: 8px; background: var(--hm-dusk-2); border-radius: 99px; padding: 8px 12px; }
body[data-ground='day'] .tide { background: rgb(23 22 42 / .5); }
.tide-label { font: 700 12px var(--hm-font-ui); color: var(--hm-mist); }
body[data-ground='day'] .tide-label { color: var(--hm-dawn-mist); }
.drops { display: flex; gap: 8px; align-items: center; }
.drop { width: 13px; height: 13px; border-radius: 0 50% 50% 50%; transform: rotate(45deg); border: 1.5px solid var(--hm-dead); }
body[data-ground='day'] .drop { border-color: #8a7f99; }
.drop.on, body[data-ground='day'] .drop.on { background: var(--hm-moon); border-color: var(--hm-moon); }
.tide b { font: 800 13px var(--hm-font-ui); }

/* game: main column */
.game-grid { display: block; }
.col-main { display: flex; flex-direction: column; }
.warn-strip { margin: 0 var(--gx); padding: 10px 14px; border-radius: 16px; background: rgb(183 168 240 / .16); font: 600 13.5px/1.4 var(--hm-font-ui); color: #E3DBFF; }
.tally { margin: 12px var(--gx) 0; background: rgb(23 22 42 / .55); border-radius: 22px; padding: 14px; display: flex; flex-direction: column; gap: 9px; }
.tally-head { display: flex; justify-content: space-between; font: 700 13px var(--hm-font-ui); }
.tally-head .need { color: var(--hm-lantern); }
.trow { display: grid; grid-template-columns: minmax(64px, 34%) 1fr 26px; gap: 10px; align-items: center; }
.tn { font: 600 14px var(--hm-font-ui); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-track { height: 14px; border-radius: 99px; background: var(--hm-fog); position: relative; overflow: hidden; }
.bar-track i { position: absolute; inset: 0 auto 0 0; border-radius: 99px; background: linear-gradient(90deg, #c98d3e, #F2B65A); box-shadow: 0 0 12px rgb(242 182 90 / .6); }
.tc { font: 400 18px/1 var(--hm-font-display); text-align: right; }
.tally-empty { font-size: 13px; color: var(--hm-dawn-mist); }
.tally-foot { display: flex; gap: 12px; flex-wrap: wrap; font: 500 12.5px var(--hm-font-ui); color: var(--hm-dawn-mist); }
.tally-foot .r { margin-left: auto; }

/* role card */
.role-card { position: relative; margin: 4px var(--gx) 0; border-radius: var(--hm-r-card); }
.role-card.full { display: grid; grid-template-columns: 86px 1fr; gap: 14px; padding: 12px; background: var(--hm-dusk-2); }
.role-card.full.drowned { background: linear-gradient(160deg, #2b2756, #1f1d3d); border: 1.5px solid rgb(183 168 240 / .5); box-shadow: var(--hm-glow-moon); padding: 10.5px; }
.role-card.full.neutral { border: 1.5px dashed var(--hm-mist); padding: 10.5px; }
.role-card .portrait { --arch: 43px; width: 86px; height: 110px; aspect-ratio: auto; }
.rc-body { display: flex; flex-direction: column; gap: 5px; justify-content: center; min-width: 0; padding-right: 22px; }
.rc-body h2 { font: 400 28px/1 var(--hm-font-display); overflow-wrap: anywhere; }
.role-card.drowned .rc-body h2 { color: var(--hm-moon-title); }
.rc-body .ab { font: 400 13.5px/1.4 var(--hm-font-ui); color: var(--hm-cream-2); }
.rc-body .status { font: 600 12.5px/1.4 var(--hm-font-ui); color: var(--hm-lantern-soft); }
.rc-body .allies { font: 600 12.5px/1.4 var(--hm-font-ui); color: var(--hm-moon-text); }

/* seats */
.meta { display: flex; justify-content: space-between; gap: 12px; padding: 14px 18px 8px; font: 600 12.5px var(--hm-font-ui); color: var(--hm-mist); }
body[data-ground='day'] .meta { color: var(--hm-dawn-mist); }
.legend { display: flex; align-items: center; gap: 6px; }
.dot { width: 8px; height: 8px; border-radius: 50%; border: 1.5px solid var(--hm-dead); flex: none; }
.dot.on { background: var(--hm-lantern); border-color: var(--hm-lantern); box-shadow: 0 0 8px var(--hm-lantern); }
.seats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; padding: 0 var(--sx); }
.seat-in {
  width: 100%; min-height: var(--hm-seat-h); border-radius: var(--hm-r-tile); background: var(--hm-dusk-2); color: var(--hm-cream);
  padding: 4px 10px 4px 6px; display: flex; align-items: center; gap: 8px; border: 0; text-align: left; font: inherit; cursor: default;
}
button.seat-in { cursor: pointer; }
button.seat-in:disabled { cursor: default; }
.av { position: relative; width: var(--hm-avatar); height: var(--hm-avatar); border-radius: 50%; background: var(--hm-fog); display: grid; place-items: center; font: 400 15px var(--hm-font-display); flex: none; }
.seat .who, .rv .who { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.seat .nm { font: 600 15px/1.2 var(--hm-font-ui); overflow: hidden; overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.subline { display: flex; align-items: center; flex-wrap: wrap; gap: 2px 6px; margin-top: 2px; }
.subline .pill { font-size: 9.5px; padding: 2px 5px; }
.subline .pill.away { padding: 0.5px 4px; }
.seat .sub { font: 700 11px/1.3 var(--hm-font-ui); color: var(--hm-mist); }
.seat.me .seat-in { border: 2px solid var(--hm-cream); padding: 2px 8px 2px 4px; }
.seat.me .av { background: var(--hm-cream); color: var(--hm-dusk); }
.seat.me .nm { font-weight: 700; }
.seat.chosen .seat-in { background: var(--hm-lantern); color: var(--hm-dusk); box-shadow: 0 0 0 3px rgb(242 182 90 / .3), 0 0 24px rgb(242 182 90 / .4); }
.seat.chosen .nm { font-weight: 800; }
.seat.chosen .av { background: var(--hm-dusk); color: var(--hm-lantern); }
.seat.chosen .sub { color: #4a3510; }
.chosen-lab { font: 800 10px var(--hm-font-ui); letter-spacing: .06em; text-transform: uppercase; flex: none; }
.seat.chosen .subline { margin-top: 1px; }
.mere-lab { font: 700 10px var(--hm-font-ui); flex: none; }
.seat.off .seat-in { opacity: .5; }
.seat.dead .seat-in { background: rgb(35 34 65 / .4); color: var(--hm-dead-text); }
.seat.dead .nm { text-decoration: line-through; font-weight: 400; }
.av.ripple { background: none; border: 1.5px solid var(--hm-fog); box-shadow: inset 0 0 0 5px var(--hm-dusk), inset 0 0 0 6.5px var(--hm-fog); }
.rdy { position: absolute; right: -3px; bottom: -3px; width: 16px; height: 16px; border-radius: 50%; background: var(--hm-lantern); color: var(--hm-dusk); border: 2px solid var(--hm-dawn-2); display: grid; place-items: center; }
.rdy .check { width: 9px; height: 9px; }
.legend .rdy { position: static; border-color: transparent; }
/* day tiles */
.seats.day .seat-in { background: var(--hm-dawn-2); min-height: 52px; padding: 4px 8px 4px 6px; }
.seats.day .av { background: var(--hm-dawn-3); }
.seats.day .nm { font-weight: 700; font-size: 14px; }
.seats.day .sub { font: 500 11.5px/1.3 var(--hm-font-ui); color: var(--hm-dawn-mist); }
.seats.day .sub.voted { color: var(--hm-lantern-soft); }
.seats.day .seat.me .seat-in { padding: 2px 6px 2px 4px; }
.seats.day .seat.me .av { background: var(--hm-cream); }
.seats.day .seat.dead .seat-in { background: rgb(58 45 72 / .35); color: #A99CB6; }
.seats.day .av.ripple { border-color: var(--hm-dawn-3); box-shadow: inset 0 0 0 5px var(--hm-dawn), inset 0 0 0 6.5px var(--hm-dawn-3); }
.seats.day .seat.myvote .seat-in { box-shadow: 0 0 0 2.5px var(--hm-lantern); }
.seats.day .seat.off .seat-in { opacity: .6; }

/* bottom sheet */
.sheet-wrap { position: sticky; bottom: 0; z-index: 5; margin-top: 14px; }
.sheet { background: var(--hm-dusk-2); border-radius: var(--hm-r-sheet) var(--hm-r-sheet) 0 0; padding: 18px 18px calc(20px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 12px; box-shadow: var(--hm-shadow-sheet); max-height: 60vh; max-height: 60dvh; overflow-y: auto; overscroll-behavior: contain; }
.sheet.day { background: var(--hm-dawn-2); padding: 16px 16px calc(20px + env(safe-area-inset-bottom)); gap: 10px; }
.sheet-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; font: 600 13px var(--hm-font-ui); color: var(--hm-mist); }
.sheet-head .note { font: 700 12px var(--hm-font-ui); color: var(--hm-moon-text); text-align: right; }
.target { font: 400 32px/1.05 var(--hm-font-display); overflow-wrap: anywhere; }
.target.none { color: var(--hm-mist); }
.sheet-text { font: 400 13.5px/1.45 var(--hm-font-ui); color: var(--hm-cream-2); }
.wait { display: flex; align-items: center; gap: 8px; font: 600 13px var(--hm-font-ui); color: var(--hm-mist); }
.sheet.day .wait, .sheet.day .hint { color: var(--hm-dawn-mist); }
.vline { font: 400 14px var(--hm-font-ui); color: var(--hm-dawn-mist); }
.vline b { color: var(--hm-cream); font-weight: 700; }
.btnrow { display: flex; gap: 8px; }
.btnrow .btn { flex: 1; min-height: 54px; padding: 0 10px; font-size: 14px; }
.btnrow .btn:last-child { flex: 1.2; font-weight: 800; }
.slotrow { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.slotb { text-align: left; border-radius: var(--hm-r-tile); background: var(--hm-dusk); border: 1.5px solid var(--hm-fog); padding: 8px 12px; display: flex; flex-direction: column; gap: 2px; min-height: 58px; min-width: 0; }
.slotb small { font: 800 10.5px var(--hm-font-ui); letter-spacing: .08em; text-transform: uppercase; color: var(--hm-mist); }
.slotb .val { font: 400 18px/1.2 var(--hm-font-display); color: var(--hm-mist); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.slotb.filled .val { color: var(--hm-cream); }
.slotb.active { border: 2px solid var(--hm-lantern); padding: 7.5px 11.5px; box-shadow: 0 0 0 4px rgb(242 182 90 / .15); }
.gift { display: flex; gap: 12px; align-items: flex-start; width: 100%; text-align: left; background: var(--hm-dusk); border: 1.5px solid var(--hm-fog); border-radius: var(--hm-r-tile); padding: 10px 12px; }
.gift .sw { position: relative; flex: none; width: 40px; height: 24px; margin-top: 2px; border-radius: 99px; background: var(--hm-fog); }
.gift .sw i { position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: var(--hm-cream); }
.gift.on { border-color: var(--hm-lantern); background: rgb(242 182 90 / .1); }
.gift.on .sw { background: var(--hm-lantern); }
.gift.on .sw i { left: 19px; background: var(--hm-dusk); }
.gt b { display: block; font: 700 14px/1.3 var(--hm-font-ui); }
.gt small { display: block; margin-top: 2px; font: 400 12.5px/1.35 var(--hm-font-ui); color: var(--hm-mist); }
.extra { display: flex; flex-wrap: wrap; gap: 8px 10px; align-items: center; }
.extra .hint { flex: 1; min-width: 150px; }
.extra .hint.wide { flex-basis: 100%; }
.hint { font: 400 12.5px/1.4 var(--hm-font-ui); color: var(--hm-mist); }

/* ------------------------------------------------------------------ game over */
.banner { position: relative; min-height: 430px; padding-top: 70px; overflow: hidden; display: flex; align-items: flex-end; }
.banner .hero-art { background: linear-gradient(180deg, #6a4f6e 0%, #3a2d55 55%, #17162A 100%); }
.banner.village .hero-art { background: radial-gradient(ellipse 70% 50% at 50% 30%, rgb(255 214 150 / .6), transparent 70%), linear-gradient(180deg, #6a4f6e 0%, #3a2d55 55%, #17162A 100%); }
.banner .hero-img { background-position: center top; }
.banner .hero-img::after { background: linear-gradient(0deg, rgb(23 22 42 / .88), rgb(23 22 42 / .45) 45%, transparent 75%); }
.banner.drowned .hero-art { background: radial-gradient(ellipse 70% 50% at 50% 88%, rgb(183 168 240 / .4), transparent 70%), linear-gradient(180deg, #1b1a36 0%, #2b2756 55%, #17162A 100%); }
.banner-copy { position: relative; padding: 0 20px 22px; display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
.banner h1 { font: 400 40px/1.02 var(--hm-font-display); text-shadow: 0 2px 20px rgb(0 0 0 / .5); text-wrap: balance; }
.banner p { font: 400 14px/1.45 var(--hm-font-ui); color: #F2E6D3; }
.drift-note { margin: 14px var(--gx) 0; display: flex; gap: 10px; align-items: flex-start; border: 1.5px dashed var(--hm-mist); border-radius: 18px; padding: 12px 14px; font: 400 14px/1.45 var(--hm-font-ui); color: var(--hm-cream-2); }
.drift-note .glyph { margin-top: 8px; }
.drift-note.won { color: var(--hm-lantern-soft); }
.drift-note b { color: var(--hm-cream); }
.sec-head.over { padding: 18px var(--sx) 8px; }
.sec-head.over h2 { font-size: 22px; }
.sec-head.over .count { font-weight: 500; font-size: 12.5px; color: var(--hm-mist); }
.reveals { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; padding: 0 var(--sx); }
.rv { min-height: 56px; border-radius: var(--hm-r-tile); background: var(--hm-dusk-2); padding: 6px 8px 6px 6px; display: flex; align-items: center; gap: 8px; }
.rv.drowned { background: rgb(183 168 240 / .14); border: 1.5px solid rgb(183 168 240 / .55); padding: 4.5px 6.5px 4.5px 4.5px; }
.rv.neutral { border: 1.5px dashed var(--hm-mist); padding: 4.5px 6.5px 4.5px 4.5px; }
.rv .nm { font: 700 13.5px/1.25 var(--hm-font-ui); overflow-wrap: anywhere; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.rv .rl { font: 600 12px/1.3 var(--hm-font-ui); color: var(--hm-lantern-soft); }
.rv.drowned .rl { color: var(--hm-moon-text); }
.rv.neutral .rl { color: var(--hm-cream-2); }
.rv .fate { font: 400 10.5px/1.3 var(--hm-font-ui); color: var(--hm-mist); }
.tale { margin: 18px var(--gx) 0; background: var(--hm-dusk-2); border-radius: 22px; padding: 14px 16px; }
.tale h2 { font: 400 20px/1.2 var(--hm-font-display); margin-bottom: 6px; }
.tl-row { display: grid; grid-template-columns: 36px 1fr; gap: 8px; padding: 6px 0; font: 400 13px/1.4 var(--hm-font-ui); border-top: 1px solid rgb(245 235 218 / .08); }
.tl-t { font-weight: 700; color: var(--hm-mist); }
.tl-row .tag, .timeline .tag { margin-left: 6px; vertical-align: 1px; font-size: 9.5px; padding: 3px 8px; }
.tl-row .tag.side.neutral, .timeline .tag.side.neutral { padding: 2px 8px; }
.over-actions { display: flex; flex-wrap: wrap; gap: 8px; padding: 16px var(--sx) 20px; }
.over-actions .btn.big { flex: 1; min-height: 56px; font-size: 15px; }
.over-actions .quiet { flex-basis: 100%; }
.over-actions .hint { flex-basis: 100%; text-align: center; }

/* ------------------------------------------------------------------ side column: journal, chat, census */
.col-side { padding: 18px 14px 28px; display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.tabs { display: flex; gap: 4px; background: var(--hm-dusk-2); border-radius: 99px; padding: 5px; }
.tab { flex: 1 1 auto; min-height: 44px; border-radius: 99px; border: 0; background: none; color: var(--hm-mist); font: 700 13px var(--hm-font-ui); display: flex; align-items: center; justify-content: center; gap: 6px; padding: 0 8px; white-space: nowrap; }
.tab[aria-selected='true'] { background: var(--hm-cream); color: var(--hm-dusk); font-weight: 800; }
.cnt { min-width: 18px; height: 18px; border-radius: 9px; padding: 0 5px; background: var(--hm-lantern); color: var(--hm-dusk); font: 800 11px/18px var(--hm-font-ui); text-align: center; }
.cnt:empty { display: none; }
.badge { width: 8px; height: 8px; border-radius: 50%; background: var(--hm-lantern); }
.pane { display: none; }
.pane.show { display: flex; flex-direction: column; gap: 14px; }
.pane-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 0 4px; }
.pane-head h2 { font: 400 26px/1.1 var(--hm-font-display); }
.pane-head .gold { font: 700 12px var(--hm-font-ui); color: var(--hm-lantern); text-align: right; }
.pane-head.record { padding-top: 4px; }
.pane-head.record h2 { font-size: 22px; color: var(--hm-mist); }
.pane-head.record span { font: 600 12px var(--hm-font-ui); color: var(--hm-mist); text-align: right; }
.note-paper { position: relative; background: var(--hm-cream); color: #2a2540; border-radius: 6px 22px 22px 22px; padding: 14px 16px; display: flex; flex-direction: column; gap: 6px; box-shadow: 0 8px 24px rgb(0 0 0 / .35); }
.np-when { font: 800 11px var(--hm-font-ui); letter-spacing: .1em; color: #7a5a2a; }
.note-paper p { font: 400 17px/1.4 var(--hm-font-display); text-wrap: pretty; }
.timeline { margin: 0 0 0 12px; padding: 0 0 0 16px; border-left: 2px solid var(--hm-fog); display: flex; flex-direction: column; gap: 12px; }
.timeline li { position: relative; display: flex; flex-direction: column; gap: 2px; }
.timeline li::before { content: ''; position: absolute; left: -22px; top: 4px; width: 10px; height: 10px; border-radius: 50%; background: var(--hm-fog); border: 2px solid var(--hm-dusk); }
body[data-ground='day'] .timeline li::before { border-color: var(--hm-dawn); }
.timeline .when { font: 700 11.5px var(--hm-font-ui); color: var(--hm-mist); }
.timeline .tx { font: 400 14px/1.45 var(--hm-font-ui); color: var(--hm-cream-2); }
.timeline .k-win .tx { color: var(--hm-cream); font-weight: 600; }
.empty { border: 1.5px dashed var(--hm-fog); border-radius: 18px; padding: 16px; text-align: center; font: 400 14px/1.45 var(--hm-font-ui); color: var(--hm-mist); }
.chat-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; padding: 0 4px 10px; border-bottom: 1px solid rgb(245 235 218 / .08); }
.chat-head h2 { font: 400 26px/1.1 var(--hm-font-display); }
.chat-head span { font: 600 12.5px var(--hm-font-ui); color: var(--hm-mist); }
.sys-wrap { display: flex; justify-content: center; }
.sys-wrap:empty { display: none; }
.sysline { font: 700 12.5px var(--hm-font-ui); color: var(--hm-lantern-text); background: rgb(242 182 90 / .12); padding: 6px 14px; border-radius: 99px; }
.chat-list { max-height: 420px; min-height: 120px; overflow-y: auto; overscroll-behavior: contain; display: flex; flex-direction: column; gap: 12px; padding: 2px 0; }
.msg { display: flex; gap: 8px; max-width: 88%; }
.mav { width: 32px; height: 32px; border-radius: 50%; background: var(--hm-fog); display: grid; place-items: center; font: 400 13px var(--hm-font-display); flex: none; }
.mb { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.mb .who { font: 700 12px var(--hm-font-ui); color: var(--hm-mist); }
.bub { font: 400 15px/1.4 var(--hm-font-ui); background: var(--hm-dusk-2); border-radius: 4px 18px 18px 18px; padding: 9px 12px; overflow-wrap: anywhere; }
.msg.me { align-self: flex-end; max-width: 80%; }
.msg.me .bub { background: var(--hm-lantern); color: var(--hm-dusk); font-weight: 500; border-radius: 18px 4px 18px 18px; }
.msg.ghost .bub { background: none; border: 1.5px dashed var(--hm-fog); color: var(--hm-cream-2); font-style: italic; }
.chat-list .empty { list-style: none; }
.chat-form { display: flex; gap: 8px; position: sticky; bottom: 0; padding: 6px 0 calc(6px + env(safe-area-inset-bottom)); background: linear-gradient(180deg, transparent, var(--hm-dusk) 30%); z-index: 2; }
body[data-ground='day'] .chat-form { background: linear-gradient(180deg, transparent, var(--hm-dawn) 30%); }
.chat-in { flex: 1; min-width: 0; height: 52px; border-radius: 99px; background: var(--hm-dusk-2); border: 1.5px solid transparent; padding: 0 18px; font: 400 16px var(--hm-font-ui); } /* 16px: iOS zooms smaller */
.chat-in::placeholder { color: var(--hm-mist); opacity: 1; }
.chat-in:focus { border-color: var(--hm-lantern); outline: none; caret-color: var(--hm-lantern); }
.send { width: 52px; height: 52px; border-radius: 50%; border: 0; background: var(--hm-lantern); color: var(--hm-dusk); display: grid; place-items: center; flex: none; padding: 0; }
.send svg { width: 22px; height: 22px; stroke: currentColor; stroke-width: 2.4; fill: none; stroke-linecap: round; stroke-linejoin: round; }
.census { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
.census li { display: flex; align-items: center; gap: 8px; background: var(--hm-dusk-2); border-radius: var(--hm-r-tile); padding: 6px 12px 6px 6px; min-height: 50px; min-width: 0; }
.census li.drowned { background: rgb(183 168 240 / .14); }
.census li.neutral { border: 1.5px dashed var(--hm-mist); }
.census .cn { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.census .cn b { font: 700 13.5px/1.2 var(--hm-font-ui); overflow-wrap: anywhere; }
.census .cn small { font: 800 10px var(--hm-font-ui); letter-spacing: .08em; color: var(--hm-lantern-soft); }
.census li.drowned small { color: var(--hm-moon-text); }
.census li.neutral small { color: var(--hm-cream-2); }
.census .cnt { background: none; color: var(--hm-cream); font: 400 18px var(--hm-font-display); }

/* ------------------------------------------------------------------ system states */
.center-screen { position: relative; min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; text-align: center; padding: 24px; }
.center-screen h2 { font: 400 26px var(--hm-font-display); position: relative; }
.center-screen p { color: var(--hm-mist); position: relative; }
.center-screen .lamp { position: relative; }
.conn-banner { position: fixed; top: calc(8px + env(safe-area-inset-top)); left: 50%; transform: translateX(-50%); z-index: 40; white-space: nowrap; max-width: calc(100% - 24px); padding: 9px 16px; border-radius: 99px; background: #2b2756; border: 1.5px solid rgb(183 168 240 / .6); color: var(--hm-moon-title); font: 700 13px var(--hm-font-ui); box-shadow: 0 8px 24px rgb(0 0 0 / .4); }
#toast { position: fixed; left: 50%; bottom: calc(20px + env(safe-area-inset-bottom)); transform: translate(-50%, 16px); opacity: 0; pointer-events: none; z-index: 50; width: max-content; max-width: calc(100% - 32px); background: var(--hm-dusk-2); border: 1.5px solid var(--hm-lantern); color: var(--hm-cream); padding: 12px 20px; border-radius: 99px; font: 600 14px/1.35 var(--hm-font-ui); text-align: center; box-shadow: 0 10px 30px rgb(0 0 0 / .5); }
#toast.show { opacity: 1; transform: translate(-50%, 0); }
#toast.err { border-color: var(--hm-error); color: var(--hm-error-text); background: var(--hm-dusk); }

/* ------------------------------------------------------------------ tablet: keep the phone layout, centred */
@media (min-width: 600px) and (max-width: 959px) {
  .game .bar, .game-grid { max-width: 640px; margin-inline: auto; }
  .hero-copy { left: max(22px, calc(50% - 300px)); }
  .join-card { max-width: 520px; margin-inline: auto; width: calc(100% - 28px); }
  .how, .village-gal { max-width: 640px; margin-inline: auto; }
}

/* ------------------------------------------------------------------ desktop */
@media (min-width: 900px) {
  .m { display: none; } .d { display: inline; }
  .hero-stage { height: 680px; }
  .hero-img { background-image: var(--img, var(--img-m, none)); }
  .hero-brand { display: none; }
  .hub-back { display: none; }
  .hero .hero-art { background: radial-gradient(ellipse 40% 45% at 72% 42%, rgb(242 182 90 / .42), transparent 70%), linear-gradient(180deg, #2c2a55 0%, #1d1c38 65%, #17162A 100%); }
  .topnav { display: flex; align-items: center; gap: 36px; position: absolute; top: 0; left: 0; right: 0; height: 80px; padding: 0 64px; font: 600 15px var(--hm-font-ui); }
  .topnav .wordmark { margin-right: auto; display: block; }
  .topnav .wordmark img { display: block; height: 42px; width: auto; }
  .topnav a { color: var(--hm-cream); text-decoration: none; }
  .topnav .muted { color: var(--hm-mist); }
  .hero-copy { left: 64px; right: auto; bottom: 80px; width: min(620px, calc(100vw - 580px)); gap: 18px; }
  .pill-label { font-size: 13px; padding: 6px 12px; }
  .hero h1 { font-size: clamp(56px, calc((100vw - 580px) / 4.8), 132px); line-height: .92; text-shadow: 0 0 50px rgb(242 182 90 / .3); }
  .hook { font-size: 28px; }
  .join-card { position: absolute; right: 64px; bottom: 64px; width: 420px; margin: 0; background: rgb(35 34 65 / .92); border-radius: 30px; padding: 28px; gap: 14px; box-shadow: 0 20px 60px rgb(0 0 0 / .45); }
  .join-card .field label { font-size: 14px; }
  .join-row .btn { padding: 0 22px; font-size: 16px; }
  .btn.primary { font-size: 18px; min-height: 60px; }
  .how { padding: 56px 64px 24px; }
  .how h2 { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .steps { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; margin-top: 0; }
  .steps li { background: var(--hm-dusk-2); border-radius: 26px; padding: 22px; grid-template-columns: 64px 1fr; gap: 18px; }
  .orb { width: 64px; height: 64px; font-size: 26px; }
  .steps h3 { font: 400 24px/1.1 var(--hm-font-display); }
  .steps p { font-size: 15px; line-height: 1.5; margin-top: 4px; }
  .steps-note { margin-top: 18px; font-size: 14px; }
  .village-gal { padding: 40px 64px 72px; }
  .who-head { display: flex; justify-content: space-between; align-items: baseline; padding: 0; }
  .who-head h2 { font-size: 48px; }
  .who-sub { display: block; font-size: 15px; color: var(--hm-mist); }
  .gallery { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 14px; margin-top: 18px; }
  .gal-group, .gal-grid { display: contents; }
  .gal-head { display: none; }
  .gal-group.village .role-tile { order: 1; } .gal-group.neutral .role-tile { order: 2; } .gal-group.drowned .role-tile { order: 3; }
  .role-tile, .role-tile.neutral { display: flex; flex-direction: column; grid-column: auto; gap: 10px; border-radius: 22px; padding: 10px 10px 16px; }
  .role-tile.neutral { border: 1.5px dashed var(--hm-mist); }
  .role-tile .portrait, .role-tile.neutral .portrait { --arch: 70px; width: auto; aspect-ratio: 4 / 5; }
  .role-tile.drowned .portrait { border-radius: 12px 12px 70px 70px; }
  .role-tile.village .portrait { border-radius: 70px 70px 12px 12px; }
  .role-tile.neutral .portrait { --arch: 60px; border-radius: 60px; }
  .role-tile h3, .role-tile.neutral h3 { font: 400 20px/1.1 var(--hm-font-display); text-align: left; min-height: 0; padding: 0 6px; place-items: start; display: block; }
  .role-tile.drowned h3 { color: var(--hm-moon-title); }
  .role-tile .side-word { display: block; padding: 0 6px; font: 800 11px var(--hm-font-ui); letter-spacing: .08em; margin-top: -4px; }
  .role-tile.village .side-word { color: var(--hm-lantern); } .role-tile.drowned .side-word { color: var(--hm-moon); } .role-tile.neutral .side-word { color: var(--hm-mist); }
  .role-tile .ab, .role-tile.neutral .ab { display: block; padding: 0 6px; font: 400 13px/1.45 var(--hm-font-ui); color: var(--hm-cream-2); }
  .role-tile .from { color: var(--hm-mist); }
  .foot { padding-bottom: 56px; }
}

@media (min-width: 960px) {
  :root { --gx: 0px; --sx: 0px; }
  .game .bar { max-width: 1240px; margin: 0 auto; padding: 28px 32px 14px; }
  .game-grid { display: grid; grid-template-columns: minmax(0, 1fr) 400px; gap: 32px; max-width: 1240px; margin: 0 auto; padding: 0 32px 40px; align-items: start; }
  .seats, .reveals { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
  .meta { padding-inline: 4px; }
  .sec-head.over { padding-inline: 4px; }
  .over-actions { padding-inline: 0; }
  .banner { border-radius: 28px; }
  .sheet-wrap { bottom: 16px; }
  .sheet, .sheet.day { border-radius: var(--hm-r-sheet); padding-bottom: 20px; box-shadow: 0 12px 40px rgb(0 0 0 / .45); }
  .col-side { position: sticky; top: 16px; padding: 0; max-height: calc(100vh - 32px); max-height: calc(100dvh - 32px); overflow-y: auto; }
  .chat-list { max-height: 46vh; }
  .lobby { max-width: 640px; }
}

/* ------------------------------------------------------------------ short screens (iPhone SE class) and landscape phones */
@media (max-height: 700px) and (max-width: 959px) {
  .sheet, .sheet.day { padding: 12px 14px calc(12px + env(safe-area-inset-bottom)); gap: 8px; max-height: 45vh; max-height: 45dvh; }
  .target { font-size: 24px; }
  .sheet-text { display: none; }
  .btn.big { min-height: 50px; }
  .btnrow .btn { min-height: 48px; }
  .sheet .btn.small { min-height: 44px; }
  .slotb { min-height: 52px; padding: 6px 12px; }
  .slotb.active { padding: 5.5px 11.5px; }
  .gift { padding: 8px 12px; }
  .gt small { display: none; }
  .extra .hint { display: none; }
  .sheet-head { font-size: 12.5px; }
  .vline { font-size: 13px; }
  .role-card.full { padding-block: 10px; }
}
@media (max-height: 500px) and (orientation: landscape) {
  .seats, .reveals { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .census { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .hero-stage { height: 300px; }
  .lobby { max-width: 720px; }
  .fire { grid-template-columns: repeat(6, minmax(0, 1fr)); }
  .sheet, .sheet.day { max-height: 52vh; max-height: 52dvh; }
  .bar { padding-block: calc(8px + env(safe-area-inset-top)) 6px; }
  .bar-title { font-size: 24px; }
  .banner { min-height: 220px; padding-top: 40px; }
  .center-screen { padding: 12px; }
}
@media (max-width: 360px) {
  :root { --hm-avatar: 30px; }
  .seat-in { gap: 6px; padding-left: 5px; padding-right: 7px; }
  .seat .nm, .seats.day .nm { font-size: 14px; }
  .av { font-size: 13px; }
  .slotb .val { font-size: 16px; }
}
@media (max-width: 340px) {
  .seat .nm, .seats.day .nm { font-size: 13px; }
  .tab { font-size: 12px; padding: 0 4px; gap: 3px; }
  .btnrow .btn { font-size: 13px; padding: 0 6px; }
  .join-row .btn { padding: 0 12px; font-size: 14px; }
  .bar-title { font-size: 26px; }
  .tide { padding: 8px 9px; gap: 6px; }
  .drops { gap: 6px; }
}

@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* ================================================================== interludes
   Full-screen staged beats between phases (see public/app.js "interludes").
   Extends the handoff's "two animations" rule on purpose: one-shot, transform and
   opacity only. Every @keyframes names only a FROM state; the element's base style
   is the final pose, so .frozen (fixtures) and reduced motion simply show the end. */
@keyframes cvFade { from { opacity: 0; } }
@keyframes cvOut { from { opacity: 1; } }
@keyframes cvRise { from { transform: translateY(var(--ry, 90px)); opacity: 0; } }
@keyframes cvFog { from { transform: translateX(var(--fx0, -35%)); opacity: var(--fo0, 0); } }
@keyframes cvRip { from { transform: scale(.15); opacity: .9; } }
@keyframes cvSink { from { transform: translateY(-26px); opacity: 0; } }
@keyframes cvWater { from { transform: translateY(var(--wl0)); } }
@keyframes cvFlip { from { transform: rotateY(180deg); } }
@keyframes cvFill { from { transform: scale(.3); opacity: 0; } }
@keyframes cvUnfold { from { transform: scaleY(.12) rotate(-2.5deg); opacity: 0; } }
@keyframes cvDrift { from { transform: rotate(-10deg) translateX(0); opacity: 1; } }
@keyframes cvUp { from { transform: translateY(150px); opacity: 0; } }
@keyframes cvProg { from { transform: scaleX(0); } }
@keyframes cvDrop { from { transform: translateY(-90px); opacity: 0; } }
@keyframes cvSinker { from { transform: translateY(-150px); opacity: 1; } }

.curtain { position: fixed; inset: 0; z-index: 100; overscroll-behavior: contain; overflow: hidden; background: #0e0d1c; color: var(--hm-cream); cursor: pointer; outline: none; contain: layout paint; animation: cvFade .4s both; -webkit-tap-highlight-color: transparent; }
.cv-stage, .cv-st, .cv-scene { position: absolute; inset: 0; }
.cv-stage { animation: cvFade .3s both; }
.cv-scene > *, .fogs > *, .shore { pointer-events: none; }

/* sky and orbs */
.sky { position: absolute; inset: 0; }
.sky.black { background: linear-gradient(180deg, #08071a, #121127 60%, #0d0c1d); }
.sky.night { background: radial-gradient(ellipse 60% 30% at 70% 14%, rgb(183 168 240 / .16), transparent 70%), linear-gradient(180deg, #0e0d1c, #1d1c38 58%, #17162A); }
.sky.dawn { background: radial-gradient(ellipse 70% 38% at 50% 60%, rgb(242 182 90 / .5), transparent 70%), linear-gradient(180deg, #6a4f6e, #3a2d55 52%, #2A2036); }
.sky.vote { background: radial-gradient(ellipse 90% 30% at 50% 0%, rgb(242 182 90 / .22), transparent 70%), linear-gradient(180deg, #3a2d48, #2A2036 62%, #1f1830); }
.sky.mere { background: radial-gradient(ellipse 70% 30% at 50% 100%, rgb(183 168 240 / .2), transparent 70%), linear-gradient(180deg, #141233, #1d1c4a 55%, #0f0e24); }
.sky.fadeout { animation: cvOut 2.2s ease-in-out both; opacity: 0; }
.orb.moon, .orb.sun { position: absolute; border-radius: 50%; } /* scene orbs only; `.orb` alone is the home page's numbered step */
.orb.moon { width: 58px; height: 58px; right: 15%; top: 11%; background: radial-gradient(circle at 36% 36%, #fff6e2, #d9cfe9 58%, #a89fc8); box-shadow: 0 0 50px 12px rgb(183 168 240 / .32); animation: cvRise 1.6s .2s ease-out both; }
.orb.sun { width: 84px; height: 84px; left: 50%; margin-left: -42px; top: calc(var(--shore, 62%) - 66px); background: radial-gradient(circle, #fff1c9, #F2B65A 62%, #d98f3c); box-shadow: 0 0 60px 20px rgb(242 182 90 / .4); animation: cvRise 2s .1s ease-out both; --ry: 80px; }

/* fog */
.fogs > i { position: absolute; left: -30%; width: 160%; height: 34%; background: radial-gradient(ellipse 50% 50% at 50% 50%, rgb(169 165 196 / .46), transparent 74%); opacity: var(--fo, 1); transform: translateX(var(--fx, 0)); animation: cvFog 2.8s var(--d, 0s) ease-out both; }
.fogs.peel > i { --fo: 0; --fx: 38%; --fo0: .85; --fx0: 0%; animation-duration: 2.6s; }

/* the shore: a row of arched windows */
.shore { position: absolute; left: 0; right: 0; top: calc(var(--shore, 62%) - 60px); height: 60px; display: flex; align-items: flex-end; justify-content: center; gap: 11px; }
.shore::after { content: ''; position: absolute; left: 50%; bottom: -3px; width: min(380px, 88%); height: 7px; transform: translateX(-50%); background: #0b0a18; border-radius: 4px; }
.win { position: relative; width: 26px; border-radius: 13px 13px 3px 3px; background: #0b0a18; }
.win i { position: absolute; inset: 0; border-radius: inherit; background: var(--hm-lantern); box-shadow: 0 0 18px 3px rgb(242 182 90 / .5); opacity: var(--lit, 1); }
.shore.dim { --lit: .42; }
.shore.out i { opacity: 0; animation: cvOut .6s calc(var(--i) * .3s + .5s) ease-in both; }

/* water */
.water { position: absolute; inset: 0; transform: translateY(var(--wl, 62%)); }
.water.climb { animation: cvWater 1.5s .3s ease-in-out both; }
.water.w-night { background: linear-gradient(180deg, rgb(245 235 218 / .38) 0 2px, rgb(40 38 86 / .92) 2px, #11102a 100%); }
.water.w-black { background: linear-gradient(180deg, rgb(245 235 218 / .2) 0 2px, #0b0a1d 2px, #06050f 100%); }
.water.w-dawn { background: linear-gradient(180deg, rgb(255 226 170 / .65) 0 2px, rgb(78 56 100 / .94) 2px, #241b33 100%); }
.water.w-mere { background: linear-gradient(180deg, rgb(207 196 247 / .5) 0 2px, rgb(36 34 92 / .94) 2px, #0c0b22 100%); }
.water::after { content: ''; position: absolute; left: 50%; top: 8px; width: min(340px, 82%); height: 110px; transform: translateX(-50%); background: repeating-linear-gradient(180deg, var(--refl, rgb(242 182 90 / .2)) 0 3px, transparent 3px 12px); -webkit-mask-image: linear-gradient(180deg, #000, transparent); mask-image: linear-gradient(180deg, #000, transparent); }
.water.w-black::after { --refl: rgb(242 182 90 / .1); }
.water.w-mere::after { --refl: rgb(183 168 240 / .16); }
.ripset { position: absolute; top: calc(var(--wl, 62%) + 34px); width: 0; height: 0; }
.ripset i { position: absolute; left: -64px; top: -14px; width: 128px; height: 28px; border: 2px solid rgb(245 235 218 / .6); border-radius: 50%; transform: scale(var(--s)); opacity: var(--o); animation: cvRip 2s calc(var(--base, 0s) + var(--d)) ease-out both; }

/* copy */
.cv-copy { position: absolute; left: 0; right: 0; top: 17%; padding: 0 max(24px, env(safe-area-inset-right)) 0 max(24px, env(safe-area-inset-left)); display: flex; flex-direction: column; align-items: center; gap: 14px; text-align: center; }
.cv-copy.top { top: 15%; }
.cv-eyebrow { font: 800 12px/1.2 var(--hm-font-ui); letter-spacing: .16em; text-transform: uppercase; color: var(--hm-lantern-text); display: flex; align-items: center; gap: 8px; animation: cvFade .6s .1s both; }
.cv-eyebrow .tag { letter-spacing: .1em; }
.cv-line { font: 400 44px/1.08 var(--hm-font-display); max-width: 15em; text-wrap: balance; overflow-wrap: anywhere; text-shadow: 0 0 30px rgb(242 182 90 / .3); animation: cvFade .7s .3s both; }
.cv-line.f2 { font-size: 36px; } .cv-line.f3 { font-size: 30px; } .cv-line.f4 { font-size: 26px; }
.cv-line .nm { display: inline-block; animation: cvSink 1s calc(var(--i, 0) * .9s + .5s) ease-in both; }
.cv-line .rise { display: inline-block; animation: cvUp 1.4s .3s cubic-bezier(.2, .7, .2, 1) both; }
.cv-sub { font: 500 16px/1.45 var(--hm-font-ui); color: var(--hm-cream-2); max-width: 30ch; text-wrap: balance; animation: cvFade .7s 1s both; }
.cv-hint { position: absolute; left: 0; right: 0; bottom: calc(20px + env(safe-area-inset-bottom)); text-align: center; font: 700 11.5px var(--hm-font-ui); letter-spacing: .12em; text-transform: uppercase; color: var(--hm-mist); pointer-events: none; }
.cv-skip { position: absolute; top: calc(12px + env(safe-area-inset-top)); right: max(12px, env(safe-area-inset-right)); z-index: 3; min-height: 44px; padding: 0 20px; border-radius: var(--hm-r-pill); background: rgb(23 22 42 / .65); border: 1.5px solid rgb(245 235 218 / .45); color: var(--hm-cream); font: 700 13px var(--hm-font-ui); }
.cv-skip:focus-visible { outline: 3px solid var(--hm-cream); outline-offset: 3px; }
.cv-prog { position: absolute; top: 0; left: 0; right: 0; height: 3px; background: rgb(245 235 218 / .55); transform-origin: left; animation: cvProg var(--ms, 3s) linear both; }

/* per-beat touches */
.end.v .cv-line { color: var(--hm-cream); } .end.d .cv-line { color: var(--hm-moon-title); text-shadow: 0 0 30px rgb(183 168 240 / .35); }
.cv-copy.vote .cv-line { font-size: 58px; line-height: 1; }
.sinker { position: absolute; left: 0; right: 0; text-align: center; padding: 0 24px; top: calc(var(--wl, 62%) + 62px); font: 400 30px/1.1 var(--hm-font-display); color: var(--hm-cream-2); opacity: .85; overflow-wrap: anywhere; animation: cvSinker 1.1s 1.5s cubic-bezier(.5, 0, .9, .6) both; }
.sinker.f2 { font-size: 28px; } .sinker.f3 { font-size: 24px; } .sinker.f4 { font-size: 21px; }
.plank { position: absolute; left: 14%; top: calc(var(--wl, 62%) + 30px); width: 150px; height: 18px; border-radius: 99px; border: 2px dashed var(--hm-mist); background: rgb(169 165 196 / .2); transform: rotate(-10deg) translateX(165%); opacity: .6; animation: cvDrift 3s .2s ease-in both; }
.cv-copy.notide { gap: 12px; }
.cv-copy.notide .cv-sub { display: flex; flex-direction: column; align-items: center; gap: 10px; max-width: 34ch; }
.cv-drops { display: flex; gap: 24px; justify-content: center; padding: 6px 0; }
.cv-drop { position: relative; width: 26px; height: 26px; border: 2.5px solid var(--hm-dead); border-radius: 0 50% 50% 50%; transform: rotate(45deg); }
.cv-drop i { position: absolute; inset: -2.5px; border-radius: inherit; background: var(--hm-moon); box-shadow: 0 0 22px rgb(183 168 240 / .5); opacity: 0; }
.cv-drop.on i { opacity: 1; }
.cv-drop.fresh i { animation: cvFill 1s .7s ease-out both; }
.cv-of { font: 800 13px var(--hm-font-ui); letter-spacing: .14em; text-transform: uppercase; color: var(--hm-moon-text); }
.cv-warn.hot { padding: 9px 16px; border-radius: 14px; background: rgb(183 168 240 / .16); border: 1.5px solid rgb(183 168 240 / .5); color: #E3DBFF; font-weight: 700; font-size: 15px; }

/* the role card turning over */
.cv-card { width: min(360px, calc(100vw - 32px)); perspective: 1200px; text-align: left; margin-top: 4px; }
.rc-face { backface-visibility: hidden; -webkit-backface-visibility: hidden; }
.cv-card .role-card { margin: 0; box-shadow: 0 14px 40px rgb(0 0 0 / .5); }
.cv-card .rc-body { padding-right: 0; }

/* the whisper: cream paper, unfolding */
.cv-note { width: min(360px, calc(100vw - 40px)); max-height: 56vh; max-height: 56dvh; overflow: hidden; text-align: left; transform-origin: top center; background: var(--hm-cream); color: #2a2540; border-radius: 6px 22px 22px 22px; padding: 16px 18px; display: flex; flex-direction: column; gap: 8px; box-shadow: 0 14px 40px rgb(0 0 0 / .5); animation: cvUnfold 1s .25s cubic-bezier(.2, .7, .2, 1) both; }
.cv-note p { font: 400 18px/1.4 var(--hm-font-display); text-wrap: pretty; }

/* heralds: mid-phase news, top of the screen, never a full stage */
#heralds { position: fixed; top: calc(10px + env(safe-area-inset-top)); left: 0; right: 0; z-index: 90; display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 0 max(12px, env(safe-area-inset-right)) 0 max(12px, env(safe-area-inset-left)); pointer-events: none; }
.herald { pointer-events: auto; display: flex; align-items: center; gap: 12px; width: max-content; max-width: min(460px, 100%); min-height: 56px; padding: 10px 20px 10px 16px; border-radius: 28px; text-align: left; color: var(--hm-cream); background: #2e2742; border: 1.5px solid rgb(245 235 218 / .5); box-shadow: 0 10px 30px rgb(0 0 0 / .5); animation: cvDrop .5s cubic-bezier(.2, .8, .2, 1) both; }
.herald.village { border-color: rgb(242 182 90 / .7); }
.herald.drowned { background: #2b2756; border-color: rgb(183 168 240 / .65); }
.herald.neutral { border: 1.5px dashed var(--hm-mist); }
.herald.out { opacity: 0; transition: opacity .3s; pointer-events: none; }
.herald .h-ic { display: grid; place-items: center; width: 22px; flex: none; }
.herald .glyph { transform-origin: center; scale: 1.5; }
.herald .h-t { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.herald b { font: 800 14px/1.25 var(--hm-font-ui); overflow-wrap: anywhere; }
.herald small { font: 500 12.5px/1.35 var(--hm-font-ui); color: var(--hm-cream-2); overflow-wrap: anywhere; }
.hbell { width: 12px; height: 14px; border-radius: 6px 6px 2px 2px; background: var(--hm-lantern); box-shadow: 0 0 12px 2px rgb(242 182 90 / .5); }

/* fixtures render the final pose; reduced motion keeps only a crossfade, same words and timings */
.curtain.frozen, .curtain.frozen * { animation-duration: 0s !important; animation-delay: 0s !important; }
.curtain.frozen .cv-prog { display: none; }
@media (min-width: 900px) {
  .cv-line { font-size: 58px; } .cv-line.f2 { font-size: 48px; } .cv-line.f3 { font-size: 40px; } .cv-line.f4 { font-size: 34px; }
  .cv-copy.vote .cv-line { font-size: 80px; } .cv-sub { font-size: 19px; max-width: 36ch; } .cv-copy { top: 15%; gap: 18px; }
  .cv-card { width: 500px; } .cv-card .rc-body h2 { font-size: 36px; } .cv-card .rc-body .ab { font-size: 15.5px; } .cv-card .role-card.full { grid-template-columns: 110px 1fr; } .cv-card .portrait { width: 110px; height: 140px; --arch: 55px; } .cv-note { width: 460px; } .cv-note p { font-size: 22px; }
  .shore { transform: scale(1.7); transform-origin: 50% 100%; } .orb.sun { transform-origin: 50% 100%; scale: 1.5; }
  .sinker { font-size: 38px; } .orb.moon { right: 28%; }
}
@media (prefers-reduced-motion: reduce) {
  .curtain, .cv-stage, .cv-copy, .herald { animation: cvFade .5s both !important; }
  .curtain *:not(.cv-copy) { animation: none !important; transition: none !important; }
  .curtain .cv-prog { display: none; }
}

/* curtains on short screens (landscape phones, iPhone SE) */
@media (max-height: 640px) {
  .cv-copy { top: 12%; gap: 10px; }
  .cv-copy.top { top: 11%; }
  .cv-line { font-size: 38px; } .cv-line.f2 { font-size: 32px; } .cv-line.f3 { font-size: 27px; } .cv-line.f4 { font-size: 23px; }
  .cv-copy.vote .cv-line { font-size: 46px; }
  .cv-sub { font-size: 15px; }
  .cv-note p { font-size: 16px; }
  .cv-drop { width: 22px; height: 22px; } .cv-drops { gap: 20px; }
}
@media (max-height: 500px) {
  .cv-copy { top: 6%; gap: 6px; }
  .cv-copy.top { top: 5%; }
  .cv-eyebrow { font-size: 11px; }
  .cv-line { font-size: 30px; } .cv-line.f2 { font-size: 27px; } .cv-line.f3 { font-size: 23px; } .cv-line.f4 { font-size: 20px; }
  .cv-copy.vote .cv-line { font-size: 36px; }
  .cv-sub { font-size: 13.5px; max-width: 46ch; }
  .cv-note { max-height: 64dvh; } .cv-note p { font-size: 14.5px; }
  .cv-card { width: min(420px, 90vw); }
  .cv-card .rc-body .ab { font-size: 12.5px; line-height: 1.32; }
  .cv-card .rc-body h2 { font-size: 22px; }
  .cv-card .role-card.full { grid-template-columns: 64px 1fr; padding: 8px; gap: 10px; }
  .cv-card .portrait { width: 64px; height: 80px; --arch: 32px; }
  .orb.moon { width: 40px; height: 40px; } .orb.sun { width: 60px; height: 60px; margin-left: -30px; }
  .sinker { font-size: 22px; }
  .cv-hint { display: none; }
  .cv-drop { width: 18px; height: 18px; } .cv-drops { gap: 16px; padding: 2px 0; }
  .cv-warn.hot { padding: 5px 10px; font-size: 13px; }
}
@media (max-width: 340px) {
  .cv-line { font-size: 36px; } .cv-line.f2 { font-size: 31px; } .cv-line.f3 { font-size: 26px; } .cv-line.f4 { font-size: 22px; }
  .cv-copy { padding-inline: 18px; }
  .cv-copy.vote .cv-line { font-size: 50px; }
}

@media print { .fogwrap, .fog { display: none; } }


/* ------------------------------------------------------------------ in-person: hold to peek */
/* One component for everything private. No text selection, no iOS callout, no scrolling gesture steals the press. */
.hold { touch-action: none; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; -webkit-tap-highlight-color: transparent; cursor: pointer; }
.priv-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 4px var(--gx) 0; }
.priv { display: flex; align-items: center; gap: 10px; min-height: 56px; padding: 6px 12px; border-radius: 20px; border: 1.5px dashed var(--hm-fog); background: var(--hm-dusk-2); color: var(--hm-cream); text-align: left; min-width: 0; }
body[data-ground='day'] .priv { background: var(--hm-dawn-2); border-color: var(--hm-dawn-3); }
.priv .eye { flex: none; width: 22px; height: 22px; stroke: var(--hm-mist); stroke-width: 1.7; fill: none; stroke-linecap: round; stroke-linejoin: round; }
.pv-t { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.pv-t b { font: 700 14px/1.2 var(--hm-font-ui); }
.pv-t small { font: 600 11.5px/1.2 var(--hm-font-ui); color: var(--hm-mist); }
body[data-ground='day'] .pv-t small { color: var(--hm-dawn-mist); }
.priv.held { border-style: solid; border-color: var(--hm-cream); }
.peek { margin: 8px var(--gx) 0; }
.peek[hidden] { display: none; }
.peek.role-card { margin-top: 8px; }
.peek.role-card.full { box-shadow: 0 10px 30px rgb(0 0 0 / .4); }
.night-notes { display: flex; flex-direction: column; gap: 6px; padding: 12px 16px; border-radius: 20px; background: #0f0e1d; border: 1.5px solid var(--hm-fog); }
.nn-h { font: 800 10.5px var(--hm-font-ui); letter-spacing: .12em; text-transform: uppercase; color: var(--hm-mist); }
.night-notes p { font: 500 14.5px/1.4 var(--hm-font-ui); color: var(--hm-cream); text-wrap: pretty; }

/* role reveal beat: a card that is face down until held */
.cv-hold { display: block; width: 100%; border: 0; color: inherit; text-align: left; padding: 0; }
.cv-hold.down { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; min-height: 150px; padding: 20px; text-align: center; border-radius: var(--hm-r-card); background: var(--hm-dusk-2); border: 1.5px dashed var(--hm-fog); box-shadow: 0 14px 40px rgb(0 0 0 / .5); }
.cv-hold.down b { font: 400 22px/1.15 var(--hm-font-display); }
.cv-hold.down small { font: 600 12.5px var(--hm-font-ui); color: var(--hm-mist); }
.cv-hold.role-card.full { margin: 0; }
.curtain .cv-hint { display: block; }

/* private results, small and dark rather than bright paper */
.note-paper { background: #0f0e1d; color: var(--hm-cream-2); border: 1.5px solid var(--hm-fog); border-radius: 14px; padding: 10px 12px; gap: 3px; box-shadow: none; }
.np-when { color: var(--hm-mist); font-size: 10.5px; }
.note-paper p { font: 500 14px/1.4 var(--hm-font-ui); }

/* "phone down" screen after you have acted */
body.dimmed { overflow: hidden; }
.dim { position: fixed; inset: 0; z-index: 45; background: #050509; color: #8d8aa8; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 22px; padding: 24px; text-align: center; }
.dim[hidden] { display: none; }
.dim-t { font: 400 28px/1.15 var(--hm-font-display); color: #8d8aa8; }
.dim-change { min-height: 44px; padding: 0 18px; background: none; border: 1.5px solid #34324f; border-radius: 99px; color: #8d8aa8; font: 600 13.5px var(--hm-font-ui); }
.dim-bell { position: absolute; left: 0; right: 0; bottom: calc(18px + env(safe-area-inset-bottom)); display: flex; justify-content: center; gap: 8px; }
.dim-bell .btn { background: none; border: 1.5px solid #34324f; color: #8d8aa8; }

/* talk stage */
.talk { margin: 10px var(--gx) 0; padding: 22px 18px; border-radius: 26px; background: var(--hm-dawn-2); text-align: center; display: flex; flex-direction: column; gap: 8px; }
.talk-h { font: 400 40px/1.05 var(--hm-font-display); text-wrap: balance; }
.talk-news { font: 600 16px/1.4 var(--hm-font-ui); color: var(--hm-cream); }
.talk-sub { font: 600 13px var(--hm-font-ui); color: var(--hm-dawn-mist); }

/* night sheet extras */
.sheet-note { font: 700 13px/1.35 var(--hm-font-ui); color: var(--hm-lantern-text); }
.kinpicks { display: flex; flex-direction: column; gap: 2px; margin: -2px 0 0; }
.kinpicks li { font: 500 12.5px/1.35 var(--hm-font-ui); color: var(--hm-mist); }

/* lobby */
.qr { display: block; width: min(232px, 100%); height: auto; border-radius: 10px; image-rendering: pixelated; background: #fff; }
.cc-scan { font: 600 12.5px var(--hm-font-ui); color: var(--hm-mist); margin-top: -4px; }
.room-switch .gift, .room-switch .rs-line { background: var(--hm-dusk-2); }
.rs-line { padding: 12px 14px; border-radius: var(--hm-r-tile); font: 400 13.5px/1.4 var(--hm-font-ui); color: var(--hm-cream-2); }
.rs-line b { color: var(--hm-cream); }
.howcard { background: var(--hm-dusk-2); border-radius: var(--hm-r-card); overflow: hidden; }
.how-t { display: flex; align-items: center; justify-content: space-between; gap: 10px; width: 100%; min-height: 56px; padding: 8px 16px; background: none; border: 0; color: inherit; text-align: left; }
.how-t span { display: flex; flex-direction: column; gap: 1px; }
.how-t b { font: 400 20px/1.1 var(--hm-font-display); }
.how-t small { font: 600 12px var(--hm-font-ui); color: var(--hm-mist); }
.how-t .chev { flex: none; color: var(--hm-mist); transition: transform .2s; }
.how-t[aria-expanded='true'] .chev { transform: rotate(180deg); }
.how-l { display: flex; flex-direction: column; gap: 10px; padding: 0 16px 16px; counter-reset: how; }
.how-l li { display: flex; flex-direction: column; gap: 1px; padding-left: 30px; position: relative; counter-increment: how; }
.how-l li::before { content: counter(how); position: absolute; left: 0; top: 1px; width: 22px; height: 22px; border-radius: 50%; background: var(--hm-fog); display: grid; place-items: center; font: 800 12px var(--hm-font-ui); }
.how-l b { font: 800 13px var(--hm-font-ui); color: var(--hm-lantern-text); }
.how-l span { font: 400 13.5px/1.45 var(--hm-font-ui); color: var(--hm-cream-2); }
#pane-roles .howcard { margin-bottom: 4px; }

/* roles in play: tap to read */
.census li { flex-wrap: wrap; padding: 0; }
.cen-b { display: flex; align-items: center; gap: 8px; width: 100%; min-height: 50px; padding: 6px 12px 6px 6px; background: none; border: 0; color: inherit; text-align: left; min-width: 0; }
.census li.open { grid-column: 1 / -1; }
.cdesc { width: 100%; padding: 0 14px 12px; font: 400 13.5px/1.45 var(--hm-font-ui); color: var(--hm-cream-2); }
.cdesc .from { color: var(--hm-mist); }
.census-note { font: 600 12px var(--hm-font-ui); color: var(--hm-mist); text-align: center; }
@media (max-width: 340px) { .cen-b { gap: 5px; padding-right: 8px; } .census .cn b { font-size: 12px; overflow-wrap: normal; } .census .cn { overflow: hidden; } }

/* ------------------------------------------------------------------ phase clock and lobby timers */
#clockrow:empty { display: none; }
.clock { display: flex; align-items: center; gap: 10px; margin: 0 var(--gx) 8px; padding: 2px 2px 2px 14px; min-height: 44px; border-radius: 99px; background: rgb(23 22 42 / .6); border: 1.5px solid var(--hm-fog); }
body[data-ground='day'] .clock { background: rgb(23 22 42 / .5); border-color: var(--hm-dawn-3); }
.ck-l { flex: 1; min-width: 0; font: 600 13px/1.2 var(--hm-font-ui); color: var(--hm-cream-2); }
.ck-t { font: 800 18px/1 var(--hm-font-ui); font-variant-numeric: tabular-nums; color: var(--hm-cream); white-space: nowrap; }
.ck-add { flex: none; min-height: 44px; min-width: 64px; padding: 0 12px; border-radius: 99px; border: 1.5px solid var(--hm-mist); background: none; color: var(--hm-cream); font: 700 12.5px var(--hm-font-ui); }
.ck-add:active { transform: scale(.96); }
.clock.low { border-color: var(--hm-lantern); background: rgb(242 182 90 / .14); animation: ck-glow 2s ease-in-out infinite; }
.clock.low .ck-t { color: var(--hm-lantern-text); }
.clock.up .ck-t { font-size: 15px; }
@keyframes ck-glow { 50% { box-shadow: 0 0 0 4px rgb(242 182 90 / .16); } }
.tm-box { display: flex; flex-direction: column; gap: 6px; background: var(--hm-dusk-2); border-radius: var(--hm-r-tile); padding: 12px 14px; }
.tm-box b { font: 700 15px var(--hm-font-ui); }
.tm-box small { font: 400 12.5px/1.35 var(--hm-font-ui); color: var(--hm-cream-2); }
.tm-row { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-top: 4px; }
.tm-row label { display: flex; flex-direction: column; gap: 4px; min-width: 0; font: 700 12px var(--hm-font-ui); color: var(--hm-mist); }
.tm-row select { width: 100%; min-height: 44px; border-radius: 12px; border: 1.5px solid var(--hm-fog); background: var(--hm-dusk); color: var(--hm-cream); font: 600 16px var(--hm-font-ui); padding: 0 6px; }
@media (prefers-reduced-motion: reduce) { .clock.low { animation: none; } }
