:root {
  --night: #090d21;
  --ink: #101735;
  --panel: rgba(22, 29, 65, .82);
  --panel-soft: rgba(31, 40, 86, .62);
  --line: rgba(178, 188, 231, .16);
  --text: #f5f1e9;
  --muted: #a8afd0;
  --gold: #e2b96c;
  --gold-bright: #f4d28f;
  --rose: #b785a4;
  --green: #9dd3bd;
  --serif: "Cormorant Garamond", Georgia, serif;
  --sans: Inter, ui-sans-serif, system-ui, sans-serif;
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--night); }
body { margin: 0; min-height: 100vh; color: var(--text); font-family: var(--sans); background: radial-gradient(circle at 65% 0%, #20245a 0, transparent 39rem), var(--night); }
button, input, textarea { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .45; }
:focus-visible { outline: 2px solid var(--gold-bright); outline-offset: 3px; }
.sky { position: fixed; inset: 0; pointer-events: none; overflow: hidden; opacity: .5; }
.sky span { position: absolute; width: 2px; height: 2px; border-radius: 50%; background: #fff; box-shadow: 0 0 8px 2px rgba(255,255,255,.4); }
.sky span:nth-child(1) { top: 11%; left: 14%; } .sky span:nth-child(2) { top: 19%; left: 78%; width: 3px; height: 3px; }
.sky span:nth-child(3) { top: 45%; left: 91%; } .sky span:nth-child(4) { top: 74%; left: 8%; } .sky span:nth-child(5) { top: 85%; left: 64%; width: 3px; height: 3px; }
.app-shell { position: relative; z-index: 1; width: min(1500px, 100%); margin: auto; padding: 28px; }
.brand { font-family: var(--serif); font-size: clamp(2.8rem, 7vw, 5.2rem); font-weight: 500; letter-spacing: -.04em; line-height: .85; color: var(--gold-bright); }
.eyebrow { color: var(--gold); font-size: .7rem; letter-spacing: .18em; text-transform: uppercase; }
.muted { color: var(--muted); }
.small { font-size: .82rem; }
.landing { min-height: calc(100vh - 56px); display: grid; place-items: center; }
.landing-inner { width: min(100%, 850px); display: grid; grid-template-columns: 1.2fr .8fr; gap: 72px; align-items: center; }
.landing h1 { font-family: var(--serif); font-size: clamp(4.5rem, 12vw, 9rem); font-weight: 500; line-height: .78; letter-spacing: -.06em; margin: 18px 0 26px; }
.landing h1 em { color: var(--gold); font-weight: 400; }
.landing-copy { font-family: var(--serif); font-size: 1.35rem; line-height: 1.25; max-width: 25rem; color: #c7c9df; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 20px; box-shadow: 0 22px 90px rgba(0,0,0,.26); backdrop-filter: blur(18px); }
.join-panel { padding: 30px; }
.join-panel h2, .section-title { font-family: var(--serif); font-weight: 500; font-size: 2rem; margin: 0 0 18px; }
.field { display: grid; gap: 8px; margin: 14px 0; }
.field label { color: var(--muted); font-size: .8rem; }
input, textarea { width: 100%; color: var(--text); background: rgba(7, 11, 31, .52); border: 1px solid var(--line); border-radius: 10px; padding: 13px 14px; transition: border .2s, background .2s; }
input:focus, textarea:focus { border-color: var(--gold); background: rgba(7, 11, 31, .75); outline: none; }
textarea { resize: vertical; line-height: 1.5; min-height: 125px; }
.split-form { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.button { border: 1px solid transparent; border-radius: 999px; padding: 12px 18px; color: var(--night); background: var(--gold); font-weight: 700; transition: transform .2s, background .2s; }
.button:hover:not(:disabled) { transform: translateY(-2px); background: var(--gold-bright); }
.button.ghost { background: transparent; color: var(--text); border-color: var(--line); }
.button.ghost:hover:not(:disabled) { background: rgba(255,255,255,.06); }
.button.danger { color: #f5d8dd; border-color: rgba(239,146,162,.4); background: rgba(136,45,73,.3); }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin-bottom: 25px; }
.topbar .brand { font-size: 2.5rem; }
.room-badge { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: .85rem; }
.room-code { color: var(--gold-bright); font-size: 1.1rem; letter-spacing: .18em; font-weight: 700; }
.game-grid { display: grid; grid-template-columns: minmax(0, 1fr) 280px; gap: 22px; align-items: start; }
.main-panel { min-height: 620px; padding: clamp(20px, 4vw, 40px); }
.side-panel { padding: 22px; position: sticky; top: 20px; }
.side-panel h3 { font-family: var(--serif); font-size: 1.7rem; font-weight: 500; margin: 0 0 16px; }
.player-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; border-top: 1px solid var(--line); padding: 12px 0; }
.player-name { display: flex; gap: 8px; align-items: center; min-width: 0; }
.player-name span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.host-mark { color: var(--gold); font-size: .7rem; }
.score { color: var(--gold-bright); font-weight: 700; }
.status { border-left: 2px solid var(--gold); padding: 9px 14px; color: #d9d5c9; background: rgba(226,185,108,.08); margin: 18px 0 27px; }
.lobby-content { max-width: 740px; margin: auto; text-align: center; }
.lobby-content .section-title { font-size: clamp(2.4rem, 5vw, 4rem); margin-bottom: 5px; }
.player-list { margin: 30px auto; display: grid; grid-template-columns: repeat(auto-fit, minmax(175px, 1fr)); gap: 10px; text-align: left; }
.lobby-player { border: 1px solid var(--line); border-radius: 12px; padding: 14px; background: var(--panel-soft); }
.round-heading { display: flex; align-items: end; justify-content: space-between; gap: 20px; }
.round-heading h1 { font-family: var(--serif); font-size: clamp(2.8rem, 6vw, 5rem); font-weight: 500; line-height: .9; margin: 0; }
.clue-box { background: rgba(255,255,255,.035); border: 1px solid var(--line); border-radius: 12px; padding: 20px; margin: 24px 0; white-space: pre-wrap; line-height: 1.55; color: #eeeadf; }
.clue-box.placeholder { color: var(--muted); font-family: var(--serif); font-size: 1.25rem; }
.action-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.hand-section { margin-top: 38px; }
.hand-title { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 12px; }
.hand-title h3 { font-family: var(--serif); font-size: 1.7rem; font-weight: 500; margin: 0; }
.card-row { display: grid; grid-template-columns: repeat(5, minmax(100px, 1fr)); gap: 12px; }
.card { position: relative; overflow: hidden; border-radius: 12px; border: 2px solid transparent; background: #151b3a; aspect-ratio: 2 / 3; transition: transform .2s, border .2s, box-shadow .2s; }
.card:hover { transform: translateY(-7px); box-shadow: 0 13px 26px rgba(0,0,0,.36); }
.card img { width: 100%; height: 100%; object-fit: cover; display: block; }
.card.selected { border-color: var(--gold-bright); box-shadow: 0 0 0 3px rgba(226,185,108,.2); transform: translateY(-7px); }
.card.disabled { opacity: .8; filter: saturate(.75); }
.card.disabled:hover { transform: none; box-shadow: none; }
.card-tag { position: absolute; left: 7px; right: 7px; bottom: 7px; padding: 6px 7px; border-radius: 7px; color: #fff; background: rgba(4,6,18,.78); font-size: .68rem; line-height: 1.1; }
.table-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(145px, 1fr)); gap: 16px; margin: 25px 0; }
.table-card { min-width: 0; }
.table-card .card { cursor: pointer; }
.table-card figcaption { color: var(--muted); font-size: .78rem; padding: 8px 2px; }
.table-card.storyteller-card .card { border-color: var(--gold-bright); box-shadow: 0 0 22px rgba(226,185,108,.3); }
.votes { color: var(--text); font-size: .75rem; line-height: 1.35; margin-top: 4px; }
.reveal-points { color: var(--gold-bright); font-weight: 700; }
.empty { padding: 30px 0; color: var(--muted); text-align: center; }
.toast { position: fixed; z-index: 10; left: 50%; bottom: 24px; transform: translate(-50%, 20px); opacity: 0; pointer-events: none; padding: 12px 18px; border: 1px solid var(--line); border-radius: 999px; background: #1c2550; color: var(--text); transition: opacity .2s, transform .2s; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.modal { position: fixed; inset: 0; z-index: 20; display: grid; place-items: center; padding: 24px; background: rgba(3,5,16,.88); cursor: zoom-out; }
.modal[hidden] { display: none; }
.modal img { max-width: min(88vw, 560px); max-height: 88vh; object-fit: contain; border-radius: 16px; box-shadow: 0 20px 70px #000; }
@media (max-width: 820px) {
  .app-shell { padding: 18px; }
  .landing-inner { grid-template-columns: 1fr; gap: 30px; max-width: 510px; }
  .landing { align-items: start; padding-top: 10vh; }
  .landing h1 { font-size: clamp(4.4rem, 20vw, 7rem); }
  .game-grid { grid-template-columns: 1fr; }
  .side-panel { position: static; order: -1; }
  .side-panel details summary { cursor: pointer; font-family: var(--serif); font-size: 1.4rem; }
  .side-panel details[open] summary { margin-bottom: 15px; }
  .side-panel h3 { display: none; }
  .card-row { display: flex; overflow-x: auto; padding: 5px 3px 12px; scroll-snap-type: x proximity; }
  .card-row .card { flex: 0 0 125px; scroll-snap-align: start; }
}
@media (max-width: 480px) {
  .topbar { align-items: flex-start; }
  .topbar .brand { font-size: 2rem; }
  .room-badge { display: block; text-align: right; }
  .split-form { grid-template-columns: 1fr; }
  .main-panel { padding: 18px; }
  .round-heading { display: block; }
  .round-heading .eyebrow { margin-top: 12px; }
  .table-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; } }
.card-pick { all: unset; display: block; width: 100%; height: 100%; cursor: pointer; }
.card-pick:disabled { cursor: default; }
.card-pick:focus-visible { outline: 2px solid var(--gold-bright); outline-offset: -4px; }
.card-zoom { position: absolute; top: 6px; right: 6px; width: 30px; height: 30px; border-radius: 50%; border: 0; background: rgba(4,6,18,.7); color: #fff; font-size: 15px; cursor: zoom-in; opacity: .85; }
.card-zoom:hover { opacity: 1; }
