/* No More Space — eerie spaceship UI */
:root {
  --bg: #04050c;
  --panel: rgba(10, 13, 28, 0.82);
  --panel-solid: #0c1022;
  --line: rgba(120, 220, 255, 0.18);
  --text: #e3e8ff;
  --muted: #8a92b8;
  --accent: #6cf0ff;
  --accent-2: #3fb8ff;
  --danger: #ff3b5c;
  --evil: #c77dff;
  --good: #6cf0ff;
  --warn: #ffb547;
  --ok: #7dffa8;
  --radius: 14px;
  --shadow: 0 10px 40px rgba(0, 0, 0, 0.55);
  --font-title: 'Unbounded', system-ui, sans-serif;
  --font-body: 'Bricolage Grotesque', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --font-spooky: 'Rubik Wet Paint', 'Unbounded', fantasy;
  --font-mono: 'Martian Mono', ui-monospace, 'Cascadia Mono', monospace;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 15px;
  font-optical-sizing: auto;
  -webkit-font-smoothing: antialiased;
}
[hidden] { display: none !important; }

#world { position: fixed; inset: 0; z-index: 0; }
#world canvas { display: block; width: 100%; height: 100%; }
#vignette {
  position: fixed; inset: 0; z-index: 1; pointer-events: none;
  background: radial-gradient(ellipse at center, transparent 45%, rgba(0, 0, 0, 0.55) 80%, rgba(0, 0, 0, 0.9) 100%);
  transition: background 2s;
}
/* the disaster outside tints the edges of the screen, and flashes (lightning, a laugh, a shudder) */
#doom-glow, #doom-flash { position: fixed; inset: 0; z-index: 1; pointer-events: none; opacity: 0; }
#doom-glow { background: radial-gradient(ellipse at center, transparent 48%, rgba(var(--doom-rgb, 255, 110, 40), 0.5) 100%); }
#doom-flash { background: rgb(var(--doom-rgb, 255, 110, 40)); mix-blend-mode: screen; }
body.phase-night #vignette { background: radial-gradient(ellipse at center, rgba(0, 0, 10, 0.4) 0%, rgba(0, 0, 0, 0.92) 70%); }
body.horizon-close #vignette { box-shadow: inset 0 0 160px rgba(160, 0, 40, 0.35); }

/* ---------- Title cards: each part of the day opens like a scene in a film ---------- */
.title-card { position: fixed; inset: 0; z-index: 30; pointer-events: none; --accent: #6cf0ff; }
.title-card .tc-bar { position: absolute; left: 0; right: 0; height: 0; background: #000; transition: height 0.45s cubic-bezier(0.2, 0.8, 0.2, 1); }
.title-card .tc-bar.top { top: 0; }
.title-card .tc-bar.bottom { bottom: 0; }
.title-card.on .tc-bar { height: 7vh; }
.title-card .tc-band {
  position: absolute; left: 0; right: 0; top: 40%; transform: translateY(-50%); padding: 16px 12px 14px; text-align: center; overflow: hidden;
  background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--accent) 20%, rgba(2, 4, 14, 0.82)) 16%, color-mix(in srgb, var(--accent) 20%, rgba(2, 4, 14, 0.82)) 84%, transparent);
  clip-path: inset(0 50% 0 50%); opacity: 0; transition: clip-path 0.55s cubic-bezier(0.2, 0.8, 0.2, 1) 0.08s, opacity 0.25s 0.08s, transform 0.4s;
}
.title-card.on .tc-band { clip-path: inset(0 0 0 0); opacity: 1; }
.title-card .tc-band::after { content: ''; position: absolute; top: 0; bottom: 0; left: -40%; width: 30%; background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.22), transparent); transform: skewX(-20deg); }
.title-card.on .tc-band::after { animation: tc-sweep 1.3s ease-in-out 0.35s both; }
@keyframes tc-sweep { from { left: -40%; } to { left: 120%; } }
.title-card .tc-title { font-family: var(--font-title); font-size: clamp(1.7rem, 5vw, 3.3rem); line-height: 1.15; letter-spacing: 0.16em; text-transform: uppercase; color: #fff; text-shadow: 0 0 22px var(--accent), 0 0 3px rgba(255, 255, 255, 0.8); }
.title-card.on .tc-title { animation: tc-in 0.7s cubic-bezier(0.2, 0.8, 0.2, 1) 0.12s both; }
@keyframes tc-in { from { letter-spacing: 0.55em; filter: blur(8px); opacity: 0; } }
.title-card .tc-sub { margin-top: 6px; font-size: clamp(1rem, 2.2vw, 1.3rem); color: color-mix(in srgb, var(--accent) 45%, #ffffff); }
.title-card.on .tc-sub { animation: tc-rise 0.6s ease-out 0.42s both; }
@keyframes tc-rise { from { transform: translateY(10px); opacity: 0; } }
.title-card .tc-line { height: 2px; width: 0; margin: 6px auto; background: linear-gradient(90deg, transparent, var(--accent), transparent); transition: width 0.8s cubic-bezier(0.2, 0.8, 0.2, 1) 0.2s; }
.title-card.on .tc-line { width: min(72vw, 760px); }
.title-card.out .tc-band { opacity: 0; transform: translateY(calc(-50% - 18px)); transition: opacity 0.45s, transform 0.45s; }
.title-card.out .tc-bar { height: 0; }
@media (prefers-reduced-motion: reduce) { .title-card *, .title-card *::after { animation: none !important; transition: none !important; } }

/* ---------- Motion: panels arrive instead of popping in (each plays when the panel is shown) ---------- */
.modal-box { animation: panel-in 0.28s cubic-bezier(0.2, 0.8, 0.2, 1); }
.vote-panel { animation: panel-drop 0.38s cubic-bezier(0.2, 0.8, 0.2, 1); }
.emote-menu { animation: panel-rise 0.24s cubic-bezier(0.2, 0.8, 0.2, 1); }
.emote-menu .emote-tile { animation: tile-pop 0.3s cubic-bezier(0.3, 1.6, 0.5, 1) both; }
.emote-menu .eg .emote-tile:nth-child(3n + 2) { animation-delay: 0.03s; }
.emote-menu .eg .emote-tile:nth-child(3n) { animation-delay: 0.06s; }
@keyframes panel-in { from { opacity: 0; transform: scale(0.94) translateY(10px); } }
@keyframes panel-drop { from { opacity: 0; transform: translate(-50%, -16px); } }
@keyframes panel-rise { from { opacity: 0; transform: translate(-50%, 14px); } }
@keyframes tile-pop { from { opacity: 0; transform: scale(0.7); } }
@media (prefers-reduced-motion: reduce) { .modal-box, .vote-panel, .emote-menu, .emote-menu .emote-tile { animation: none; } }

/* ---------- Generic controls ---------- */
.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
h1, h2, h3 { font-family: var(--font-title); font-weight: 700; letter-spacing: 0.01em; margin: 0 0 8px; }
h2 { font-size: 1.15rem; }
h3 { font-size: 0.82rem; color: var(--accent); letter-spacing: 0.04em; }
label { display: flex; flex-direction: column; gap: 6px; color: var(--muted); font-size: 0.9rem; }
input, textarea, select, button { font: inherit; color: var(--text); }
input, textarea, select {
  padding: 10px 12px; border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.05);
  outline: none;
}
input:focus, textarea:focus, select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(108, 240, 255, 0.15); }
select option { background: var(--panel-solid); }
/* Buttons are little pieces of ship hardware: a lit top edge, a shadow
   underneath, a lift on hover and a press-in when clicked. */
button {
  cursor: pointer; padding: 9px 15px; border-radius: 12px;
  border: 1px solid rgba(160, 200, 255, 0.16);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.09), rgba(255, 255, 255, 0.025));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1), 0 2px 0 rgba(0, 0, 0, 0.35), 0 6px 14px rgba(0, 0, 0, 0.22);
  font-weight: 650; letter-spacing: 0.005em;
  transition: transform 0.14s cubic-bezier(.3, 1.6, .5, 1), box-shadow 0.2s, background 0.2s, border-color 0.2s, color 0.2s, filter 0.2s;
}
button:hover:not(:disabled) {
  border-color: rgba(108, 240, 255, 0.55);
  background: linear-gradient(180deg, rgba(108, 240, 255, 0.2), rgba(108, 240, 255, 0.05));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.16), 0 3px 0 rgba(0, 0, 0, 0.35), 0 8px 22px rgba(108, 240, 255, 0.16);
  transform: translateY(-1px);
}
button:active:not(:disabled) { transform: translateY(1px); box-shadow: inset 0 2px 7px rgba(0, 0, 0, 0.45); transition-duration: 0.05s; }
button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
button:disabled { opacity: 0.38; cursor: not-allowed; filter: saturate(0.3); box-shadow: none; }
button.primary {
  position: relative; overflow: hidden;
  font-family: var(--font-title); font-weight: 700; letter-spacing: 0.02em; color: #02141d;
  background: linear-gradient(180deg, #b4f9ff 0%, #5ad8f2 48%, #1f9fd0 100%);
  border: 1px solid rgba(200, 252, 255, 0.9);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.75), inset 0 -2px 0 rgba(0, 60, 90, 0.35), 0 3px 0 #0b5f80, 0 10px 26px rgba(79, 211, 240, 0.32);
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.45);
}
button.primary:hover:not(:disabled) {
  background: linear-gradient(180deg, #d2fcff 0%, #74e0f5 48%, #2bb0de 100%); border-color: #e2feff;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.85), inset 0 -2px 0 rgba(0, 60, 90, 0.3), 0 4px 0 #0b5f80, 0 14px 34px rgba(79, 211, 240, 0.5);
}
button.primary:active:not(:disabled) { transform: translateY(2px); box-shadow: inset 0 3px 8px rgba(0, 60, 90, 0.5), 0 1px 0 #0b5f80; }
/* a glint sweeps across the main buttons on hover */
button.primary::after {
  content: ''; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(110deg, transparent 35%, rgba(255, 255, 255, 0.6) 50%, transparent 65%);
  transform: translateX(-130%);
}
button.primary:hover:not(:disabled)::after { transform: translateX(130%); transition: transform 0.75s ease; }
button.danger {
  color: #fff; border: 1px solid rgba(255, 190, 200, 0.6); text-shadow: 0 1px 0 rgba(90, 0, 20, 0.5);
  background: linear-gradient(180deg, #ff8a9e 0%, #e5355a 48%, #a8142f 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.45), 0 3px 0 #6b0a1d, 0 10px 24px rgba(229, 53, 90, 0.3);
}
button.danger:hover:not(:disabled) { background: linear-gradient(180deg, #ffa3b3 0%, #f04a6c 48%, #b81a37 100%); border-color: #ffd0d8; box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.5), 0 4px 0 #6b0a1d, 0 14px 30px rgba(229, 53, 90, 0.45); }
button.danger:active:not(:disabled) { box-shadow: inset 0 3px 8px rgba(80, 0, 20, 0.55), 0 1px 0 #6b0a1d; }
button.ghost { background: transparent; border-color: transparent; box-shadow: none; }
button.ghost:hover:not(:disabled) { background: rgba(255, 255, 255, 0.07); border-color: rgba(255, 255, 255, 0.12); box-shadow: none; }
button.small { padding: 6px 11px; font-size: 0.85rem; border-radius: 10px; }
button.big { padding: 13px 20px; font-size: 1rem; }
button.icon { position: relative; width: 38px; height: 38px; padding: 0; display: grid; place-items: center; font-size: 1.05rem; border-radius: 50%; }
button.on { border-color: var(--accent); background: linear-gradient(180deg, rgba(108, 240, 255, 0.28), rgba(108, 240, 255, 0.1)); box-shadow: inset 0 0 0 1px rgba(108, 240, 255, 0.3), 0 0 16px rgba(108, 240, 255, 0.25); }
button.off { opacity: 0.6; }
/* muted toggles get a red slash */
button.icon.off::after { content: ''; position: absolute; width: 62%; height: 2px; border-radius: 2px; background: var(--danger); transform: rotate(-45deg); box-shadow: 0 0 6px var(--danger); }
kbd {
  display: inline-block; min-width: 1.6em; padding: 1px 5px; margin: 0 2px; border-radius: 6px; text-align: center;
  border: 1px solid rgba(255, 255, 255, 0.2); border-bottom-width: 3px;
  background: linear-gradient(180deg, #262d4a, #141a30);
  font-size: 0.68em; font-family: var(--font-mono); font-weight: 700; color: #cfd8ff;
}
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.row > input { flex: 1; min-width: 0; }
.muted { color: var(--muted); }
.hint { color: var(--muted); font-size: 0.85rem; line-height: 1.4; }
.eyebrow { text-transform: uppercase; letter-spacing: 0.14em; font-size: 0.7rem; color: var(--muted); margin: 10px 0 6px; }
.code { font-family: var(--font-mono); font-weight: 700; letter-spacing: 0.2em; color: var(--accent); }
.check { flex-direction: row; align-items: center; gap: 6px; }
.badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 0.72rem; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; border: 1px solid currentColor; }

/* ---------- Title screen ---------- */
.screen { position: fixed; inset: 0; z-index: 5; overflow-y: auto; }
#screen-home { display: grid; place-items: center; padding: 24px 16px; background: radial-gradient(ellipse at 50% 120%, rgba(120, 0, 40, 0.35), transparent 60%); }
.title-wrap { width: min(520px, 100%); text-align: center; }
.logo {
  font-family: var(--font-title); font-weight: 900; font-size: clamp(2.3rem, 8vw, 4rem); line-height: 1; margin: 0;
  letter-spacing: 0.02em; color: #dff9ff; text-shadow: 0 0 24px rgba(108, 240, 255, 0.6), 0 0 80px rgba(108, 240, 255, 0.3);
  animation: flicker 6s infinite;
}
.logo span { display: inline-block; margin-top: 4px; font-family: var(--font-spooky); font-weight: 400; font-size: 1.3em; letter-spacing: 0.04em; color: #ff3b5c; text-shadow: 0 0 30px rgba(255, 59, 92, 0.6), 0 4px 0 #6b0a1d; }
@keyframes flicker { 0%, 92%, 100% { opacity: 1; } 93% { opacity: 0.4; } 94% { opacity: 1; } 96% { opacity: 0.6; } }
.tagline { color: var(--muted); margin: 14px 0 22px; line-height: 1.5; }
.home-card { padding: 20px; display: flex; flex-direction: column; gap: 14px; text-align: left; }
.mode-pick { display: grid; gap: 8px; }
.mode { flex-direction: row; align-items: flex-start; gap: 10px; padding: 10px 12px; border-radius: 12px; border: 1px solid rgba(255, 255, 255, 0.1); cursor: pointer; color: var(--text); }
.mode:has(input:checked) { border-color: var(--accent); background: rgba(108, 240, 255, 0.07); }
.mode input { margin-top: 4px; accent-color: var(--accent); }
.mode span { display: flex; flex-direction: column; gap: 2px; }
.mode small { color: var(--muted); font-size: 0.82rem; }
.divider { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 0.8rem; }
.divider::before, .divider::after { content: ''; flex: 1; height: 1px; background: var(--line); }
.code-input { text-transform: uppercase; letter-spacing: 0.4em; text-align: center; font-family: var(--font-mono); font-weight: 700; }
.footnote { color: var(--muted); font-size: 0.8rem; margin-top: 16px; }

/* ---------- Lobby ---------- */
#screen-lobby { pointer-events: none; }
#screen-lobby .card { pointer-events: auto; }
.lobby-left, .lobby-right { position: absolute; top: 16px; bottom: 16px; width: min(330px, calc(50vw - 24px)); padding: 16px; overflow-y: auto; }
.lobby-left { left: 16px; }
.lobby-right { right: 16px; }
.lobby-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
.swatches { display: flex; flex-wrap: wrap; gap: 6px; }
.swatch { width: 30px; height: 30px; border-radius: 50%; padding: 0; border: 2px solid rgba(255, 255, 255, 0.2); }
.swatch.selected { border-color: white; box-shadow: 0 0 0 3px var(--accent); }
.swatch.taken { opacity: 0.25; cursor: not-allowed; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { padding: 5px 9px; border-radius: 999px; font-size: 0.82rem; font-weight: 600; }
.chip.selected { border-color: var(--accent); background: rgba(108, 240, 255, 0.16); }
.lobby-players { list-style: none; padding: 0; margin: 8px 0; display: grid; gap: 6px; }
.lobby-players li { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 10px; background: rgba(255, 255, 255, 0.04); }
.lobby-players .dot { width: 14px; height: 14px; border-radius: 50%; flex: none; border: 1px solid rgba(255, 255, 255, 0.4); }
.lobby-players .name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lobby-players .seatno { color: var(--muted); font-size: 0.75rem; width: 18px; text-align: right; }
.lobby-players button { padding: 2px 7px; font-size: 0.75rem; }
.lobby-setup { display: grid; gap: 10px; margin: 12px 0; }
.dist-table { width: 100%; border-collapse: collapse; font-size: 0.8rem; }
.dist-table td, .dist-table th { padding: 4px 6px; text-align: center; border-bottom: 1px solid var(--line); }
.dist-table tr.current { background: rgba(108, 240, 255, 0.12); }
.role-picker { display: grid; gap: 4px; max-height: 260px; overflow-y: auto; padding-right: 4px; }
.role-picker label { flex-direction: row; align-items: center; gap: 6px; color: var(--text); font-size: 0.85rem; }
.role-picker .locked { opacity: 0.4; }

/* ---------- HUD ---------- */
#hud { position: fixed; inset: 0; z-index: 4; pointer-events: none; }
#hud > * { pointer-events: auto; }
.topbar {
  position: absolute; top: 10px; left: 10px; right: 10px; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 10px;
  pointer-events: none;
}
.topbar > * { pointer-events: auto; }
.tb-left { display: flex; gap: 10px; align-items: center; }
.tb-right { display: flex; gap: 8px; justify-content: flex-end; align-items: center; }
.tb-center { text-align: center; padding: 2px 16px 4px; border-radius: 14px; background: rgba(4, 6, 16, 0.6); backdrop-filter: blur(6px); }
.phase-pill { padding: 6px 12px; border-radius: 999px; background: var(--panel); border: 1px solid var(--line); font-family: var(--font-title); font-weight: 500; font-size: 0.74rem; letter-spacing: 0.04em; }
.timer { font-family: var(--font-mono); font-size: 1.55rem; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: 0.04em; text-shadow: 0 0 18px rgba(108, 240, 255, 0.5); }
.timer.urgent { color: var(--danger); text-shadow: 0 0 18px rgba(255, 59, 92, 0.6); animation: pulse 1s infinite; }
.timer.paused { color: var(--warn); }
@keyframes pulse { 50% { opacity: 0.55; } }
.horizon { font-size: 0.75rem; color: var(--muted); letter-spacing: 0.05em; }
.horizon b { color: var(--danger); }
/* The Observation Array: the first half of the bar charges a clue, the second half a bonus clue */
.charge { position: relative; width: 150px; height: 28px; border-radius: 999px; background: var(--panel); border: 1px solid var(--line); overflow: hidden; display: flex; align-items: center; justify-content: space-between; padding: 0 8px; }
.charge span, .charge em { position: absolute; top: 0; bottom: 0; transition: width 0.6s; }
.charge span { left: 0; background: linear-gradient(90deg, rgba(108, 240, 255, 0.25), rgba(108, 240, 255, 0.65)); }
.charge em { left: 50%; background: linear-gradient(90deg, rgba(255, 210, 63, 0.3), rgba(255, 210, 63, 0.75)); }
.charge::after { content: ''; position: absolute; left: 50%; top: 3px; bottom: 3px; width: 2px; background: rgba(255, 255, 255, 0.45); } /* the clue mark */
.charge i { position: relative; z-index: 1; font-style: normal; font-size: 0.8rem; letter-spacing: 0.05em; text-shadow: 0 1px 2px #000; }
.charge b { position: relative; z-index: 1; }
.charge.full { box-shadow: 0 0 14px rgba(108, 240, 255, 0.7); }
.charge.over { box-shadow: 0 0 16px rgba(255, 210, 63, 0.85); }
.charge.pulse { animation: charge-pulse 0.7s ease-out; }
@keyframes charge-pulse { 30% { transform: scale(1.18); } }

.phase-banner {
  position: absolute; top: 90px; left: 50%; transform: translateX(-50%); padding: 10px 22px; border-radius: 12px;
  background: rgba(5, 8, 20, 0.85); border: 1px solid var(--line); font-family: var(--font-title); letter-spacing: 0.1em; text-align: center;
  animation: drop 0.5s ease-out; pointer-events: none;
}
.phase-banner small { display: block; font-family: var(--font-body); letter-spacing: 0; color: var(--muted); margin-top: 4px; }
@keyframes drop { from { opacity: 0; transform: translate(-50%, -20px); } }

.toasts { position: fixed; z-index: 9; top: 72px; left: 50%; transform: translateX(-50%); display: grid; gap: 6px; pointer-events: none; width: min(560px, calc(100% - 32px)); }
body.phase-night .toasts { top: auto; bottom: 18px; }
body.phase-dawn .toasts, body.phase-dusk .toasts, body.phase-lastwords .toasts { top: auto; bottom: 80px; }
body.screen-home .toasts { display: none; }
.toast { padding: 9px 14px; border-radius: 10px; background: rgba(6, 10, 24, 0.9); border: 1px solid var(--line); text-align: center; animation: drop 0.3s ease-out; font-size: 0.92rem; }
.toast.death { border-color: var(--danger); color: #ffc2cc; }
.toast.vote { border-color: var(--warn); }
.toast.evil { border-color: var(--evil); }

/* Bridge table ring */
.ring-panel { position: absolute; right: 10px; top: 64px; width: 300px; padding: 10px; max-height: calc(100vh - 160px); overflow-y: auto; }
.ring-panel.collapsed .ring, .ring-panel.collapsed .nomination-box, .ring-panel.collapsed .ring-hint { display: none; }
.ring-title { display: flex; justify-content: space-between; align-items: center; font-family: var(--font-title); font-size: 0.8rem; letter-spacing: 0.1em; color: var(--muted); }
.ring { position: relative; width: 270px; height: 270px; margin: 4px auto; }
.ring .table { position: absolute; inset: 72px; border-radius: 50%; background: radial-gradient(circle, #000 25%, #2a0f3e 55%, #ff7a3a22 70%, transparent 72%); box-shadow: 0 0 30px rgba(255, 122, 58, 0.25); }
.ring .hand-clock { position: absolute; left: 50%; top: 50%; width: 4px; height: 96px; background: linear-gradient(var(--warn), transparent); transform-origin: 50% 0; border-radius: 2px; transition: transform 0.5s; }
.seat {
  position: absolute; width: 64px; transform: translate(-50%, -50%); display: flex; flex-direction: column; align-items: center; gap: 1px;
  padding: 3px 2px; border-radius: 10px; border: 1px solid transparent; background: none; font-size: 0.7rem; font-weight: 600;
}
.seat .token { width: 26px; height: 26px; border-radius: 50%; border: 2px solid rgba(255, 255, 255, 0.5); position: relative; display: grid; place-items: center; font-size: 0.8rem; }
.seat .nm { max-width: 62px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.seat.dead .token { filter: grayscale(1) brightness(0.5); }
.seat.dead .nm { color: var(--muted); text-decoration: line-through; }
.seat .ghostvote { position: absolute; right: -5px; top: -5px; width: 10px; height: 10px; border-radius: 50%; background: white; box-shadow: 0 0 6px white; }
.seat.me .nm { color: var(--accent); }
.seat.offline { opacity: 0.55; }
.seat.nominee .token { box-shadow: 0 0 0 3px var(--danger), 0 0 16px var(--danger); }
.seat.block .token::after { content: ''; position: absolute; bottom: -10px; width: 18px; height: 18px; --ix: var(--ix-skull); --iy: var(--iy-skull); background: url('/assets/icons/atlas.webp') no-repeat; background-size: calc(var(--icon-cols, 16) * 100%) calc(var(--icon-rows, 16) * 100%); background-position: calc(var(--ix) * 100% / (var(--icon-cols, 16) - 1)) calc(var(--iy) * 100% / (var(--icon-rows, 16) - 1)); }
.seat .hand { position: absolute; left: -8px; top: -8px; font-size: 0.85rem; }
.seat.locked-yes .token { box-shadow: 0 0 0 3px var(--warn); }
.seat.current { border-color: var(--warn); }
.seat.selectable { cursor: pointer; border-color: rgba(108, 240, 255, 0.35); }
.seat.selectable:hover { background: rgba(108, 240, 255, 0.15); }
.seat.chosen { background: rgba(108, 240, 255, 0.3); border-color: var(--accent); }
.nomination-box { padding: 8px; border-radius: 10px; background: rgba(255, 59, 92, 0.08); border: 1px solid rgba(255, 59, 92, 0.35); font-size: 0.85rem; display: grid; gap: 6px; }
.nomination-box b { color: #ffd0d8; }
.nomination-box .stage { font-family: var(--font-title); font-size: 0.75rem; letter-spacing: 0.08em; color: var(--warn); }

/* Chat */
.chat { position: absolute; left: 10px; bottom: 76px; width: 330px; max-height: 42vh; display: flex; flex-direction: column; padding: 8px; }
.chat.collapsed .chat-log, .chat.collapsed .chat-form { display: none; }
.chat-tabs { display: flex; gap: 4px; align-items: center; }
.chat-tabs .tab { padding: 4px 10px; font-size: 0.78rem; border-radius: 8px; }
.chat-tabs .tab.active { border-color: var(--accent); }
.chat-tabs .tab.evil.active { border-color: var(--evil); color: var(--evil); }
.chat-tabs #chat-collapse { margin-left: auto; }
.chat-log { overflow-y: auto; flex: 1; display: flex; flex-direction: column; gap: 4px; margin: 6px 0; min-height: 60px; font-size: 0.88rem; }
.chat-log .msg { line-height: 1.35; word-wrap: break-word; }
.chat-log .msg b { color: var(--accent); }
.chat-log .msg.ghost { opacity: 0.7; font-style: italic; }
.chat-log .msg.captain b { color: var(--warn); }
.chat-log .msg.evil b { color: var(--evil); }
.chat-log .msg.system { color: var(--muted); font-size: 0.8rem; }
.chat-log .msg .ch { font-size: 0.68rem; color: var(--muted); margin-right: 4px; }
.chat-form input { width: 100%; }

.minimap { position: absolute; left: 10px; top: 64px; border-radius: 12px; background: rgba(5, 8, 18, 0.7); border: 1px solid var(--line); }
.use-prompt { position: absolute; left: 50%; bottom: 96px; transform: translateX(-50%); padding: 10px 18px; border-radius: 12px; background: rgba(5, 10, 24, 0.9); border: 1px solid var(--accent); font-weight: 600; cursor: pointer; }
.actionbar {
  position: absolute; left: 50%; bottom: 12px; transform: translateX(-50%); display: flex; gap: 8px; flex-wrap: wrap; justify-content: center;
  width: max-content; max-width: calc(100% - 20px); padding: 6px; border-radius: 18px; background: rgba(4, 6, 16, 0.55); border: 1px solid var(--line); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
}
.actionbar:not(:has(.action:not([hidden]))) { display: none; }
.action {
  display: flex; align-items: center; gap: 8px; padding: 6px 12px 6px 6px; border-radius: 13px;
  background: linear-gradient(180deg, rgba(34, 42, 76, 0.96), rgba(14, 18, 36, 0.96));
  border: 1px solid rgba(140, 200, 255, 0.2);
}
.action span {
  width: 30px; height: 30px; flex: none; display: grid; place-items: center; border-radius: 9px; font-size: 1rem;
  background: radial-gradient(circle at 50% 30%, rgba(108, 240, 255, 0.3), rgba(108, 240, 255, 0.06));
  box-shadow: inset 0 0 0 1px rgba(108, 240, 255, 0.28);
}
.action.danger span { background: radial-gradient(circle at 50% 30%, rgba(255, 255, 255, 0.35), rgba(255, 255, 255, 0.08)); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.35); }
.action.hand span { background: radial-gradient(circle at 50% 30%, rgba(255, 210, 122, 0.4), rgba(255, 180, 70, 0.08)); box-shadow: inset 0 0 0 1px rgba(255, 210, 122, 0.4); }
.action.ready span { background: radial-gradient(circle at 50% 30%, rgba(125, 255, 168, 0.35), rgba(125, 255, 168, 0.06)); box-shadow: inset 0 0 0 1px rgba(125, 255, 168, 0.35); }
.action.hand.up { background: linear-gradient(180deg, #ffe09a, #e09a1a); color: #1a0e00; border-color: #ffe7b0; box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.6), 0 3px 0 #7a4a00, 0 0 24px rgba(255, 190, 80, 0.45); }
.action.hand.up span, .action.ready.on span { background: rgba(255, 255, 255, 0.35); box-shadow: none; }
.action.hand.locked { opacity: 0.7; }
.emote-menu { position: absolute; left: 50%; bottom: 66px; transform: translateX(-50%); padding: 10px; display: grid; gap: 6px; width: min(500px, calc(100vw - 24px)); max-height: 72vh; overflow-y: auto; }
.emote-menu .eg-head { font-size: 0.95rem; letter-spacing: 0.08em; opacity: 0.8; padding: 2px 4px 0; }
.emote-menu .eg { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 6px; }
.emote-tile { position: relative; display: grid; justify-items: center; gap: 2px; padding: 10px 4px 7px; }
.emote-tile .ico { font-size: 2.3rem; line-height: 1.1; transition: transform 0.15s; }
.emote-tile:hover .ico { transform: scale(1.3) rotate(-8deg); }
.emote-tile .nm { font-size: 0.85rem; }
.emote-tile kbd { position: absolute; top: 3px; left: 5px; font-size: 0.7rem; opacity: 0.65; }
.joystick { position: absolute; left: 24px; bottom: 90px; width: 120px; height: 120px; border-radius: 50%; background: rgba(255, 255, 255, 0.06); border: 1px solid var(--line); touch-action: none; }
.joystick .knob { position: absolute; left: 35px; top: 35px; width: 50px; height: 50px; border-radius: 50%; background: rgba(108, 240, 255, 0.35); }

/* Story cloud bubble */
.story { position: fixed; z-index: 7; left: 50%; top: 18%; transform: translateX(-50%); width: min(620px, calc(100% - 32px)); pointer-events: none; }
.cloud {
  position: relative; padding: 22px 28px; background: #f4f1ff; color: #1b1530; border-radius: 48px;
  box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.25), 0 20px 60px rgba(0, 0, 0, 0.6), 0 0 80px rgba(180, 140, 255, 0.25);
  font-size: 1.08rem; line-height: 1.5; animation: puff 0.6s cubic-bezier(.2, 1.6, .4, 1);
}
.cloud::before, .cloud::after { content: ''; position: absolute; background: #f4f1ff; border-radius: 50%; }
.cloud::before { width: 34px; height: 34px; left: 38px; bottom: -22px; }
.cloud::after { width: 18px; height: 18px; left: 22px; bottom: -42px; }
@keyframes puff { from { transform: scale(0.6); opacity: 0; } }
.cloud-author { font-family: var(--font-title); font-size: 0.72rem; letter-spacing: 0.12em; color: #6b4fb8; margin-bottom: 6px; text-transform: uppercase; }
.cloud-text { font-family: var(--font-body); }
.cloud-deaths { margin-top: 10px; display: flex; flex-wrap: wrap; gap: 6px; }
.cloud-deaths span { background: #2a1030; color: #ffd0de; padding: 3px 10px; border-radius: 999px; font-weight: 700; font-size: 0.85rem; }

/* Night */
.night { position: fixed; inset: 0; z-index: 6; background-color: rgba(0, 0, 8, 0.5); overflow-y: auto; padding: 24px 16px 40px; background: radial-gradient(ellipse at 50% 0%, rgba(40, 20, 90, 0.45), rgba(0, 0, 8, 0.94) 60%); }
.night-sky { position: fixed; inset: 0; z-index: -1; opacity: 0.6; background-image: radial-gradient(1px 1px at 10% 20%, #fff, transparent), radial-gradient(1px 1px at 80% 30%, #fff, transparent), radial-gradient(1.5px 1.5px at 40% 70%, #bcd, transparent), radial-gradient(1px 1px at 65% 85%, #fff, transparent), radial-gradient(1px 1px at 25% 55%, #fff, transparent); background-size: 260px 260px; animation: drift 90s linear infinite; }
@keyframes drift { to { background-position: -260px 260px; } }
.night-title { margin-top: 34px !important; text-align: center; font-family: var(--font-spooky); font-weight: 400; font-size: clamp(2.4rem, 7vw, 3.8rem); color: #b9a4ff; letter-spacing: 0.04em; text-shadow: 0 0 30px rgba(140, 100, 255, 0.7); margin: 0; }
.night-sub { text-align: center; color: var(--muted); margin: 6px 0 20px; }
.night-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 16px; max-width: 1100px; margin: 0 auto; }
.night-grid > .card { padding: 16px; }
.night-action .pick-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 6px; margin: 10px 0; }
.night-action .pick { display: flex; align-items: center; gap: 6px; padding: 7px 8px; text-align: left; font-size: 0.85rem; }
.night-action .pick .dot { width: 12px; height: 12px; border-radius: 50%; flex: none; }
.night-action .pick.chosen { border-color: var(--accent); background: rgba(108, 240, 255, 0.2); }
.night-action .pick.dead { opacity: 0.55; }
.night-action .role-line { display: flex; gap: 10px; align-items: center; }
.night-action .role-line .ico { font-size: 2rem; }
.draw-head { display: flex; flex-direction: column; gap: 2px; margin-bottom: 8px; }
#draw-canvas { width: 100%; max-width: 480px; aspect-ratio: 4 / 3; border-radius: 10px; background: #f6f3ea; cursor: crosshair; touch-action: none; display: block; }
.draw-tools { display: flex; flex-wrap: wrap; gap: 5px; margin: 8px 0; }
.draw-tools .pen { width: 26px; height: 26px; padding: 0; border-radius: 50%; }
.draw-tools .pen.selected { box-shadow: 0 0 0 3px var(--accent); }
.draw-tools .size { padding: 2px 8px; font-size: 0.8rem; }
.draw-tools .size.selected { border-color: var(--accent); }
.night-evil { border-color: rgba(199, 125, 255, 0.5); }
.night-evil h3 { color: var(--evil); }
.night-evil .chat-log { max-height: 220px; }

/* Command station */
.command { position: fixed; z-index: 5; right: 10px; top: 64px; bottom: 10px; width: min(420px, calc(100% - 20px)); display: flex; flex-direction: column; padding: 12px; }
.command.collapsed .command-tabs, .command.collapsed .command-body { display: none; }
.command.collapsed { bottom: auto; }
.command-head { display: flex; justify-content: space-between; align-items: center; }
.command-tabs { display: flex; flex-wrap: wrap; gap: 4px; margin: 6px 0; }
.command-tabs button { padding: 5px 9px; font-size: 0.8rem; }
.command-tabs button.active { border-color: var(--warn); color: var(--warn); }
.command-body { overflow-y: auto; flex: 1; display: grid; gap: 10px; align-content: start; padding-right: 4px; }
.command-body section { display: grid; gap: 8px; padding: 10px; border-radius: 10px; background: rgba(255, 255, 255, 0.03); border: 1px solid rgba(255, 255, 255, 0.06); }
.grim-row { display: grid; grid-template-columns: 18px 1fr auto; gap: 6px; align-items: center; padding: 5px; border-radius: 8px; background: rgba(255, 255, 255, 0.03); font-size: 0.82rem; }
.grim-row.dead { opacity: 0.6; }
.grim-row .role { font-size: 0.75rem; }
.grim-row .flags { display: flex; gap: 3px; flex-wrap: wrap; }
.grim-row .flag { font-size: 0.68rem; padding: 1px 6px; border-radius: 999px; background: rgba(255, 255, 255, 0.08); }
.grim-row .flag.bad { background: rgba(255, 59, 92, 0.25); }
.draft-msg { display: grid; gap: 4px; }
.draft-msg textarea { min-height: 54px; resize: vertical; font-size: 0.85rem; }
.draft-msg .false { color: var(--warn); font-size: 0.75rem; }
.grid-buttons { display: flex; flex-wrap: wrap; gap: 5px; }
.grid-buttons button { padding: 5px 8px; font-size: 0.8rem; }
.big-next { font-size: 1.05rem; padding: 14px; }

/* Modal */
.modal { position: fixed; inset: 0; z-index: 20; display: grid; place-items: center; padding: 16px; background: rgba(0, 0, 0, 0.6); }
.modal-box { position: relative; width: min(760px, 100%); max-height: calc(100vh - 32px); overflow-y: auto; padding: 22px; background: var(--panel-solid); }
.modal-close { position: absolute; right: 12px; top: 12px; }
.tabs { display: flex; gap: 6px; margin-bottom: 12px; flex-wrap: wrap; }
.tabs button.active { border-color: var(--accent); color: var(--accent); }
.rolecard-hero { display: flex; gap: 16px; align-items: center; padding: 16px; border-radius: 14px; background: linear-gradient(135deg, rgba(108, 240, 255, 0.1), transparent); border: 1px solid var(--line); }
.rolecard-hero.infiltrators { background: linear-gradient(135deg, rgba(199, 125, 255, 0.16), rgba(255, 59, 92, 0.08)); border-color: rgba(199, 125, 255, 0.4); }
.rolecard-hero .ico { font-size: 3.4rem; }
.rolecard-hero h2 { font-size: 1.5rem; margin: 4px 0; }
.ability { font-size: 1.05rem; line-height: 1.5; margin: 14px 0; padding: 12px 14px; border-left: 3px solid var(--accent); background: rgba(255, 255, 255, 0.03); border-radius: 0 10px 10px 0; }
.tips { padding-left: 20px; line-height: 1.55; }
.flavor { font-style: italic; color: var(--muted); }
.notes { display: grid; gap: 6px; }
.note { padding: 8px 10px; border-radius: 8px; background: rgba(255, 255, 255, 0.04); font-size: 0.9rem; }
.note small { color: var(--muted); margin-right: 6px; }
.note.evil { border-left: 3px solid var(--evil); }
.almanac { display: grid; gap: 6px; }
.alm { display: grid; grid-template-columns: 34px 1fr; gap: 8px; padding: 8px; border-radius: 10px; background: rgba(255, 255, 255, 0.03); }
.alm .ico { font-size: 1.5rem; }
.alm b { display: block; }
.alm small { color: var(--muted); }
.alm .min { float: right; font-size: 0.7rem; color: var(--muted); }

/* Task minigames */
.task-area { display: grid; place-items: center; gap: 12px; padding: 8px; user-select: none; }
.task-area canvas { max-width: 100%; border-radius: 12px; background: #050913; border: 1px solid var(--line); touch-action: none; }
.task-grid { display: grid; gap: 8px; }
.task-btn { min-width: 64px; min-height: 64px; font-size: 1.6rem; display: grid; place-items: center; }
.task-btn.lit { background: rgba(255, 255, 255, 0.85); color: #000; box-shadow: 0 0 20px white; }
.task-done { color: var(--ok); font-family: var(--font-title); font-size: 1.3rem; text-align: center; animation: task-pop 0.45s ease-out; }
@keyframes task-pop { 0% { transform: scale(0.6); opacity: 0; } 60% { transform: scale(1.15); } }
/* what a finished task did for the Observation Array */
.task-reward { display: grid; gap: 8px; justify-items: center; margin-top: 8px; }
.task-array { position: relative; width: min(320px, 90%); height: 30px; border-radius: 999px; background: rgba(255, 255, 255, 0.08); border: 1px solid var(--line); overflow: hidden; }
.task-array span, .task-array em { position: absolute; top: 0; bottom: 0; transition: width 0.9s ease-out; }
.task-array span { left: 0; background: linear-gradient(90deg, rgba(108, 240, 255, 0.35), rgba(108, 240, 255, 0.9)); }
.task-array em { left: 50%; background: linear-gradient(90deg, rgba(255, 210, 63, 0.4), rgba(255, 210, 63, 0.95)); }
.task-array::after { content: '📡'; position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); font-size: 1.1rem; }
.task-array b { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); font-size: 0.95rem; text-shadow: 0 1px 2px #000; }
.task-reward .big-line { font-size: 1.25rem; }
.task-reward .gold { color: #ffd23f; }

/* Reveal */
.reveal { position: fixed; inset: 0; z-index: 15; pointer-events: none; }
.reveal > * { pointer-events: auto; }
.reveal-caption { position: absolute; left: 50%; bottom: 9%; transform: translateX(-50%); width: min(820px, calc(100% - 32px)); text-align: center; font-size: clamp(1rem, 2.4vw, 1.4rem); line-height: 1.45; text-shadow: 0 2px 12px #000, 0 0 30px #000; pointer-events: none; }
.reveal-chapter { position: absolute; left: 50%; top: 9%; transform: translateX(-50%); font-family: var(--font-spooky); font-size: clamp(2rem, 7vw, 4rem); letter-spacing: 0.08em; color: #ffe8b0; text-shadow: 0 0 40px rgba(255, 160, 60, 0.7); pointer-events: none; text-align: center; }
.reveal-chapter.win-crew { color: #bff8ff; text-shadow: 0 0 50px rgba(108, 240, 255, 0.9); font-family: var(--font-title); }
.reveal-chapter.win-evil { color: #ff9fb3; text-shadow: 0 0 50px rgba(255, 59, 92, 0.9); }
.reveal-bubble { position: absolute; left: 50%; top: 22%; transform: translateX(-50%); width: min(560px, calc(100% - 32px)); pointer-events: none; }
.reveal-controls { position: absolute; right: 16px; bottom: 16px; display: flex; gap: 8px; }
.reveal-summary { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); width: min(820px, calc(100% - 24px)); max-height: calc(100vh - 40px); overflow-y: auto; padding: 22px; background: var(--panel-solid); }
.summary-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 8px; margin: 12px 0; }
.summary-card { padding: 10px; border-radius: 12px; background: rgba(255, 255, 255, 0.04); border: 1px solid var(--line); display: grid; gap: 2px; font-size: 0.85rem; }
.summary-card.infiltrators { border-color: rgba(199, 125, 255, 0.5); background: rgba(199, 125, 255, 0.08); }
.summary-card .ico { font-size: 1.6rem; }
.summary-card.dead { opacity: 0.7; }

.problem { position: fixed; z-index: 30; left: 50%; bottom: 80px; transform: translateX(-50%); padding: 10px 16px; border-radius: 10px; background: rgba(60, 0, 14, 0.92); border: 1px solid var(--danger); color: #ffd7de; pointer-events: none; opacity: 0; transition: opacity 0.3s; max-width: calc(100% - 32px); text-align: center; }
.problem.show { opacity: 1; }

/* ---------- Rooms: teleport + who can hear you ---------- */
.chat-who { font-size: 0.78rem; padding: 5px 8px; margin: 4px 0 2px; border-radius: 8px; background: rgba(108, 240, 255, 0.1); color: #bff6ff; border: 1px solid rgba(108, 240, 255, 0.25); }
.chat-who.alone { background: rgba(255, 180, 80, 0.12); color: #ffd9a8; border-color: rgba(255, 180, 80, 0.35); }
.chat.collapsed .chat-who { display: none; }
.action.rooms { border-color: rgba(108, 240, 255, 0.55); box-shadow: 0 0 14px rgba(108, 240, 255, 0.25); }
.rooms-menu { position: absolute; left: 50%; bottom: 76px; transform: translateX(-50%); width: min(460px, calc(100% - 20px)); max-height: min(70vh, 620px); overflow-y: auto; padding: 10px; z-index: 6; }
.rooms-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 4px; }
.room-list { display: flex; flex-direction: column; gap: 5px; margin: 8px 0; }
.room-row { display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; padding: 7px 9px; border-radius: 10px; background: rgba(120, 140, 200, 0.12); border: 1px solid var(--line); color: inherit; cursor: pointer; }
.room-row:hover:not(:disabled) { background: rgba(108, 240, 255, 0.18); border-color: rgba(108, 240, 255, 0.6); }
.room-row.busy { background: rgba(108, 240, 255, 0.1); }
.room-row.here { opacity: 1; cursor: default; border-color: rgba(108, 240, 255, 0.8); background: rgba(108, 240, 255, 0.22); }
.room-ico { font-size: 1.3rem; width: 1.6rem; text-align: center; }
.room-main { display: flex; flex-direction: column; gap: 3px; flex: 1; min-width: 0; }
.room-who { display: flex; flex-wrap: wrap; gap: 4px; font-size: 0.75rem; }
.room-who em { opacity: 0.45; }
.room-go { font-size: 0.78rem; white-space: nowrap; color: #9ff3ff; }
.who-chip { display: inline-flex; align-items: center; gap: 4px; padding: 1px 6px; border-radius: 999px; background: rgba(255, 255, 255, 0.08); }
.who-chip i { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.who-chip.me { color: #6cf0ff; font-weight: 600; }
.who-chip.ghost { opacity: 0.6; }
.minimap { cursor: pointer; }

/* ---------- Ship systems on the role card ---------- */
.sys-box { margin: 10px 0; padding: 10px 12px; border-radius: 10px; border: 1px solid rgba(199, 125, 255, 0.5); background: rgba(120, 60, 180, 0.15); display: flex; flex-direction: column; gap: 4px; }
.sys-box small { opacity: 0.75; }
.alm .sys-line { color: #d9b8ff; }

/* ---------- Voting: everyone votes at once ---------- */
.vote-panel { position: absolute; left: 50%; top: 128px; transform: translateX(-50%); width: min(440px, calc(100% - 20px)); padding: 12px 14px; z-index: 7; text-align: center; display: flex; flex-direction: column; gap: 6px; border-color: rgba(255, 181, 71, 0.45); box-shadow: 0 0 30px rgba(255, 181, 71, 0.15); }
.vote-stage { font-size: 0.8rem; letter-spacing: 0.06em; color: var(--warn); font-weight: 700; }
.vote-timer { font-family: var(--font-mono); margin-left: 6px; color: #fff; }
.vote-title { font-size: 1.05rem; }
.vote-title .nominee { color: var(--danger); }
.vote-buttons { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 4px 0; }
.vote-btn { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 12px 8px; font-size: 1.15rem; font-weight: 700; position: relative; }
.vote-btn small { font-size: 0.72rem; font-weight: 400; opacity: 0.8; }
.vote-btn kbd { position: absolute; right: 8px; top: 6px; font-size: 0.65rem; opacity: 0.6; }
.vote-btn.yes.on { border-color: var(--danger); background: linear-gradient(180deg, rgba(255, 59, 92, 0.45), rgba(255, 59, 92, 0.15)); box-shadow: 0 0 18px rgba(255, 59, 92, 0.4); }
.vote-btn.no.on { border-color: var(--accent); background: linear-gradient(180deg, rgba(108, 240, 255, 0.35), rgba(108, 240, 255, 0.1)); box-shadow: 0 0 18px rgba(108, 240, 255, 0.3); }
.vote-btn:disabled { opacity: 0.6; cursor: default; }
.vote-btn:disabled.on { opacity: 1; }
.vote-outcome { font-weight: 600; }
.vote-outcome.block { color: var(--danger); }
.vote-outcome.safe { color: var(--accent); }
.votes-today { margin-top: 8px; display: flex; flex-direction: column; gap: 3px; }
.vt-row { display: flex; justify-content: space-between; gap: 6px; font-size: 0.8rem; padding: 3px 6px; border-radius: 6px; background: rgba(120, 140, 200, 0.12); }
.vt-row small { opacity: 0.7; }
.seat .cast-tick { position: absolute; top: -12px; font-size: 0.75rem; }
.action.nominate { border-color: rgba(255, 181, 71, 0.6); box-shadow: 0 0 14px rgba(255, 181, 71, 0.25); }
.action.system { border-color: rgba(199, 125, 255, 0.6); box-shadow: 0 0 14px rgba(199, 125, 255, 0.25); }
.pick-row { display: flex; flex-wrap: wrap; gap: 5px; margin: 8px 0; }
.room-row.sealed { opacity: 0.5; }
.msg.intercept { color: #d9b8ff; font-style: italic; }
.intercept-tag { position: absolute; left: 50%; top: 64px; transform: translateX(-50%); padding: 4px 12px; border-radius: 999px; background: rgba(60, 20, 90, 0.85); border: 1px solid rgba(199, 125, 255, 0.6); font-size: 0.8rem; z-index: 6; }
body.blackout #world { filter: brightness(0.55) saturate(0.6); transition: filter 0.6s; }
body.blackout .minimap { opacity: 0.35; }

/* ---------- Social: whispers, claims, day log, last words ---------- */
.whisper-card { position: absolute; right: 10px; bottom: 76px; z-index: 8; padding: 10px 12px; display: flex; flex-direction: column; gap: 8px; max-width: 320px; border-color: rgba(108, 240, 255, 0.6); box-shadow: 0 0 22px rgba(108, 240, 255, 0.3); }
.action.claim { border-color: rgba(155, 227, 107, 0.55); }
.claim-post { display: flex; gap: 6px; align-items: center; margin: 8px 0; flex-wrap: wrap; }
.claim-post input { flex: 1; min-width: 180px; }
.seat .claim-tag { position: absolute; bottom: -2px; right: -6px; font-size: 0.8rem; filter: drop-shadow(0 0 3px #000); }
.daylog input[type=search] { width: 100%; margin: 6px 0 10px; }
.log-list { margin: 4px 0 10px; padding-left: 18px; display: flex; flex-direction: column; gap: 4px; font-size: 0.86rem; }
.msg.lastwords { font-size: 1.05rem; color: #ffe3a3; }
.reconnect-banner { position: fixed; top: 0; left: 50%; transform: translateX(-50%); z-index: 40; padding: 6px 14px; border-radius: 0 0 10px 10px; background: rgba(120, 20, 30, 0.92); border: 1px solid var(--danger); font-size: 0.85rem; }
.bug-report textarea { width: 100%; margin: 8px 0; }
.awards { margin-top: 12px; }
.award-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 8px; }
.award { display: flex; gap: 8px; align-items: flex-start; padding: 8px 10px; border-radius: 10px; background: rgba(255, 210, 90, 0.08); border: 1px solid rgba(255, 210, 90, 0.35); }
.award .ico { font-size: 1.6rem; }
.unlocked { margin-top: 10px; padding: 8px 12px; border-radius: 10px; background: rgba(155, 227, 107, 0.12); border: 1px solid rgba(155, 227, 107, 0.5); }
.chip.locked { opacity: 0.55; border-style: dashed; }
.fun-grid { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0 10px; }

/* ---------- Small screens ---------- */
@media (max-width: 820px) {
  .lobby-left, .lobby-right { position: static; width: auto; margin: 10px; max-height: none; }
  #screen-lobby { pointer-events: auto; overflow-y: auto; padding-bottom: 40vh; }
  .lobby-left { margin-top: 38vh; }
  .ring-panel { width: 230px; top: auto; bottom: 70px; right: 6px; max-height: 50vh; }
  .ring { width: 210px; height: 210px; transform: scale(0.78); transform-origin: top left; margin: 0 0 -46px; }
  .chat { width: calc(100% - 252px); min-width: 160px; max-height: 30vh; bottom: 70px; left: 6px; }
  .minimap { display: none; }
  .timer { font-size: 1.3rem; }
  .charge { width: 96px; }
  .tb-left .code { display: none; }
  .actionbar { bottom: 8px; gap: 5px; }
  .action { padding: 7px 9px; font-size: 0.8rem; }
  .action kbd { display: none; }
  .command { top: auto; height: 55vh; }
  .joystick { bottom: 130px; left: 16px; }
  .vote-panel { top: 60px; padding: 8px 10px; }
  .vote-btn { padding: 9px 6px; font-size: 1rem; }
}

/* ---------- Screen-specific layout ---------- */
body.screen-home #hud { display: none; }
body.screen-lobby .topbar,
body.screen-lobby #ring-panel,
body.screen-lobby .actionbar,
body.screen-lobby .minimap,
body.screen-lobby #use-prompt { display: none !important; }
body.screen-lobby .chat { left: 50%; transform: translateX(-50%); bottom: 12px; width: min(380px, calc(100% - 720px)); min-width: 260px; max-height: 30vh; }
body.is-captain .minimap { display: none; }
body.is-captain .ring-panel { right: auto; left: 10px; }
body.is-captain .chat { bottom: 12px; }
body.phase-ended .actionbar,
body.phase-ended .topbar,
body.phase-ended .ring-panel,
body.phase-ended .minimap { display: none; }
body.phase-night #hud .actionbar { display: none; }
@media (max-width: 820px) {
  body.screen-lobby .chat { position: fixed; width: calc(100% - 20px); left: 10px; transform: none; }
  body.is-captain .ring-panel { display: none; }
}
body.is-captain .lobby-left { bottom: auto; }
body.is-captain .story { left: 40%; width: min(440px, 38vw); }
@media (max-width: 820px) { body.is-captain .story { left: 50%; width: calc(100% - 32px); top: 10%; } }

/* ---------- Ready to move on ---------- */
.action.ready.on { background: linear-gradient(180deg, #7dffa8, #2fbf6a); color: #04210f; border: none; }
.seat .ready-tick { position: absolute; left: -6px; bottom: -6px; width: 14px; height: 14px; border-radius: 50%; background: var(--ok); color: #04210f; font-size: 0.6rem; font-weight: 800; display: grid; place-items: center; }

/* ---------- Notebook ---------- */
.seat .nb-badge { position: absolute; left: -9px; top: -9px; min-width: 18px; height: 18px; padding: 0 2px; border-radius: 9px; background: var(--panel-solid); border: 1px solid var(--line); font-size: 0.7rem; line-height: 16px; text-align: center; }
.seat .nb-badge.good { border-color: var(--good); }
.seat .nb-badge.evil { border-color: var(--evil); box-shadow: 0 0 6px var(--evil); }
.notebook { display: grid; gap: 6px; }
.nb-row { display: grid; grid-template-columns: minmax(90px, 1fr) minmax(130px, 1.3fr) auto minmax(100px, 1.4fr); gap: 6px; align-items: center; padding: 6px 8px; border-radius: 8px; background: rgba(255, 255, 255, 0.04); }
.nb-row.dead { opacity: 0.65; }
.nb-name { display: flex; align-items: center; gap: 6px; font-weight: 600; font-size: 0.9rem; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nb-name .dot { width: 12px; height: 12px; border-radius: 50%; flex: none; }
.nb-row select, .nb-row input { width: 100%; min-width: 0; padding: 5px 6px; font-size: 0.85rem; }
.nb-trust { display: flex; gap: 2px; }
.nb-trust button { padding: 3px 6px; opacity: 0.55; }
.nb-trust button.active { opacity: 1; border-color: var(--accent); background: rgba(108, 240, 255, 0.15); }
@media (max-width: 640px) {
  .nb-row { grid-template-columns: 1fr auto; }
  .nb-row select, .nb-row .nb-text { grid-column: 1 / -1; }
}
.wake { color: var(--warn); font-size: 0.85rem; margin: 6px 0; }
small.wake { display: block; margin: 2px 0 0; font-size: 0.75rem; }


/* ---------- Segmented tabs ---------- */
.tabs, .command-tabs { padding: 4px; border-radius: 14px; background: rgba(255, 255, 255, 0.04); border: 1px solid rgba(255, 255, 255, 0.06); width: fit-content; max-width: 100%; }
.tabs button, .command-tabs button { background: transparent; border-color: transparent; box-shadow: none; }
.tabs button:hover:not(:disabled), .command-tabs button:hover:not(:disabled) { transform: none; box-shadow: none; }
.tabs button.active { color: var(--accent); background: rgba(108, 240, 255, 0.15); border-color: rgba(108, 240, 255, 0.45); }
.command-tabs button.active { color: var(--warn); background: rgba(255, 181, 71, 0.13); border-color: rgba(255, 181, 71, 0.45); }
.chat-tabs .tab { box-shadow: none; }

/* The bridge-table seats are buttons placed with transform: keep them still and flat. */
.ring .seat, .ring .seat:hover:not(:disabled), .ring .seat:active:not(:disabled) { transform: translate(-50%, -50%); box-shadow: none; }
.ring .seat:not(.selectable):hover:not(:disabled) { background: none; border-color: transparent; }
.ring .seat:not(.selectable) { cursor: default; }
.swatch, .draw-tools .pen { box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.25); }

/* Title screen: keep text readable over the 3D ship */
.tagline, .footnote { text-shadow: 0 1px 2px #000, 0 0 14px rgba(0, 0, 0, 0.95); color: #b7bfdf; }
.home-audio { margin-top: 6px; }
.home-audio button { background: var(--panel); border-color: var(--line); backdrop-filter: blur(8px); }

/* Fonts: small headings in Unbounded read best a touch smaller and tighter */
.ring-title, .nomination-box .stage, .cloud-author { letter-spacing: 0.05em; font-weight: 600; }
.phase-banner { letter-spacing: 0.03em; }
.reveal-chapter { font-weight: 400; }
.reveal-chapter.win-crew { font-weight: 900; letter-spacing: 0.02em; }

@media (prefers-reduced-motion: reduce) {
  button, button.primary::after { transition: none !important; }
  button:hover:not(:disabled), button:active:not(:disabled) { transform: none; }
}
