:root {
  color-scheme: dark;
  --ink: #f7f4ec;
  --muted: #aaa7ba;
  --canvas: #100f1d;
  --panel: rgba(31, 29, 52, 0.82);
  --panel-solid: #211f36;
  --line: rgba(255, 255, 255, 0.1);
  --coral: #ff6b5f;
  --coral-light: #ff968c;
  --mint: #71dfbd;
  --gold: #ffd36a;
  --violet: #9d8cff;
  --danger: #ff5d79;
  --radius-lg: 28px;
  --radius-md: 18px;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.35);
  font-family: Inter, ui-rounded, "SF Pro Rounded", "PingFang SC", "Microsoft YaHei", sans-serif;
}

* { box-sizing: border-box; }
html { min-width: 320px; background: var(--canvas); }
body { margin: 0; min-height: 100vh; color: var(--ink); background: radial-gradient(circle at 50% -20%, #312a59 0, var(--canvas) 52%); }
button, input, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button:focus-visible, a:focus-visible, input:focus-visible, textarea:focus-visible { outline: 3px solid var(--gold); outline-offset: 3px; }

.skip-link { position: fixed; left: 16px; top: -60px; z-index: 100; padding: 10px 16px; color: #171323; background: var(--gold); border-radius: 10px; }
.skip-link:focus { top: 12px; }
.ambient { position: fixed; z-index: -1; filter: blur(1px); border-radius: 999px; opacity: .4; pointer-events: none; }
.ambient-one { width: 340px; height: 340px; left: -180px; top: 22%; background: radial-gradient(circle, rgba(255,107,95,.35), transparent 70%); }
.ambient-two { width: 420px; height: 420px; right: -220px; bottom: 0; background: radial-gradient(circle, rgba(113,223,189,.22), transparent 70%); }

.site-header { width: min(1160px, calc(100% - 40px)); height: 84px; margin: auto; display: flex; align-items: center; justify-content: space-between; }
.brand { display: inline-flex; align-items: center; gap: 11px; color: var(--ink); text-decoration: none; }
.brand-mark { width: 42px; height: 42px; display: grid; place-items: center; color: #191525; background: linear-gradient(135deg, var(--coral), var(--gold)); border-radius: 14px 14px 14px 5px; font-weight: 900; box-shadow: 0 8px 24px rgba(255,107,95,.25); }
.brand strong, .brand small { display: block; }
.brand strong { font-size: 17px; letter-spacing: .08em; }
.brand small { margin-top: 1px; color: var(--muted); font-size: 9px; letter-spacing: .24em; }
.firego-link { color: var(--muted); font-size: 13px; text-decoration: none; transition: color .2s; }
.firego-link:hover { color: var(--ink); }

main { width: min(1160px, calc(100% - 40px)); margin: 0 auto; padding: 46px 0 80px; }
.hero { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(360px, .85fr); gap: clamp(36px, 7vw, 100px); align-items: center; min-height: calc(100vh - 210px); }
.eyebrow { margin: 0 0 18px; color: var(--mint); font-weight: 800; font-size: 12px; letter-spacing: .22em; text-transform: uppercase; }
h1 { margin: 0; max-width: 700px; font-size: clamp(52px, 8vw, 104px); line-height: .96; letter-spacing: -.055em; }
h1 .accent { display: block; color: transparent; background: linear-gradient(100deg, var(--coral-light), var(--gold)); background-clip: text; -webkit-background-clip: text; }
.lead { max-width: 590px; margin: 30px 0 0; color: #c5c1d1; font-size: clamp(16px, 2vw, 19px); line-height: 1.8; }
.feature-row { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 34px; }
.feature { padding: 9px 13px; color: #d8d5df; background: rgba(255,255,255,.055); border: 1px solid var(--line); border-radius: 999px; font-size: 12px; }

.panel { position: relative; overflow: hidden; padding: 30px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow); backdrop-filter: blur(24px); }
.panel::before { content: ""; position: absolute; inset: 0 0 auto; height: 1px; background: linear-gradient(90deg, transparent, rgba(255,255,255,.34), transparent); }
.panel h2 { margin: 0 0 7px; font-size: 23px; letter-spacing: -.02em; }
.panel-subtitle { margin: 0 0 24px; color: var(--muted); font-size: 13px; line-height: 1.6; }
.resume-room { width: 100%; min-height: 48px; display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; padding: 0 15px; color: var(--mint); background: rgba(113,223,189,.08); border: 1px solid rgba(113,223,189,.2); border-radius: 13px; cursor: pointer; text-align: left; }
.resume-room small { color: var(--muted); }
.tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 5px; padding: 5px; margin-bottom: 24px; background: rgba(0,0,0,.18); border-radius: 14px; }
.tab { min-height: 42px; color: var(--muted); background: transparent; border: 0; border-radius: 10px; cursor: pointer; }
.tab.active { color: var(--ink); background: #36324f; box-shadow: 0 3px 12px rgba(0,0,0,.18); }
.field { display: grid; gap: 8px; margin-top: 17px; }
.field label { color: #d8d5df; font-size: 13px; font-weight: 700; }
.input, .textarea { width: 100%; color: var(--ink); background: rgba(7,6,15,.38); border: 1px solid rgba(255,255,255,.14); border-radius: 14px; transition: border-color .2s, box-shadow .2s; }
.input { min-height: 50px; padding: 0 15px; }
.textarea { min-height: 110px; padding: 14px 15px; resize: vertical; line-height: 1.6; }
.input::placeholder, .textarea::placeholder { color: #777489; }
.input:focus, .textarea:focus { border-color: var(--violet); box-shadow: 0 0 0 4px rgba(157,140,255,.12); outline: 0; }
.button { min-height: 50px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 0 20px; border: 0; border-radius: 14px; cursor: pointer; font-weight: 800; transition: transform .16s, filter .16s, opacity .16s; }
.button:hover:not(:disabled) { transform: translateY(-2px); filter: brightness(1.06); }
.button:active:not(:disabled) { transform: translateY(0); }
.button:disabled { opacity: .48; cursor: not-allowed; }
.button-primary { width: 100%; margin-top: 22px; color: #201521; background: linear-gradient(110deg, var(--coral), #ffb067); box-shadow: 0 12px 32px rgba(255,107,95,.23); }
.button-mint { color: #10231e; background: var(--mint); }
.button-ghost { color: var(--ink); background: rgba(255,255,255,.08); border: 1px solid var(--line); }
.button-danger { color: white; background: #613047; }
.inline-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.game-shell { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 20px; align-items: start; }
.game-top { grid-column: 1 / -1; display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 16px 20px; background: rgba(30,28,50,.62); border: 1px solid var(--line); border-radius: 20px; }
.room-meta { display: flex; align-items: center; gap: 14px; min-width: 0; }
.back-link { width: 42px; height: 42px; display: grid; place-items: center; flex: 0 0 auto; padding: 0; color: var(--ink); text-decoration: none; background: rgba(255,255,255,.07); border: 0; border-radius: 13px; cursor: pointer; }
.room-meta h1 { margin: 0; font-size: 19px; line-height: 1.2; letter-spacing: -.01em; }
.room-code { max-width: 100%; padding: 2px 0; color: var(--muted); background: none; border: 0; font: 12px ui-monospace, monospace; text-align: left; cursor: pointer; overflow-wrap: anywhere; }
.phase-wrap { display: flex; align-items: center; gap: 12px; }
.phase-pill { padding: 8px 12px; color: var(--gold); background: rgba(255,211,106,.09); border: 1px solid rgba(255,211,106,.2); border-radius: 999px; font-size: 12px; font-weight: 800; white-space: nowrap; }
.timer { min-width: 62px; color: var(--ink); font: 800 21px ui-monospace, monospace; text-align: right; }
.main-column { display: grid; gap: 20px; min-width: 0; }
.secret-card { min-height: 174px; display: grid; place-items: center; position: relative; overflow: hidden; padding: 24px; color: var(--ink); background: linear-gradient(145deg, #41386b, #25233e); border: 1px solid rgba(255,255,255,.15); border-radius: var(--radius-lg); cursor: pointer; box-shadow: var(--shadow); }
.secret-card::after { content: ""; position: absolute; width: 220px; height: 220px; right: -60px; top: -100px; background: radial-gradient(circle, rgba(255,211,106,.27), transparent 68%); }
.secret-card small { color: #c4bfd4; letter-spacing: .14em; }
.secret-value { margin-top: 10px; font-size: clamp(31px, 6vw, 48px); font-weight: 900; letter-spacing: .08em; }
.secret-hint { margin-top: 8px; color: #aaa5bd; font-size: 12px; }
.secret-card.covered .secret-value { color: rgba(247,244,236,.7); filter: none; letter-spacing: .28em; user-select: none; }
.secret-card.covered .secret-value::selection { background: transparent; }
.section-card { padding: 24px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-lg); backdrop-filter: blur(18px); }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
.section-head h2 { margin: 0; font-size: 18px; }
.section-note { color: var(--muted); font-size: 12px; }
.timeline { display: grid; gap: 12px; }
.empty { padding: 30px 15px; color: var(--muted); text-align: center; border: 1px dashed rgba(255,255,255,.13); border-radius: 16px; }
.speech { display: grid; grid-template-columns: 38px 1fr; gap: 11px; align-items: start; }
.avatar { width: 38px; height: 38px; display: grid; place-items: center; color: #181525; background: var(--avatar, var(--mint)); border-radius: 12px; font-weight: 900; }
.speech-body { padding: 11px 14px; background: rgba(255,255,255,.055); border-radius: 5px 16px 16px 16px; }
.speech-meta { display: flex; justify-content: space-between; gap: 8px; margin-bottom: 5px; color: var(--muted); font-size: 11px; }
.speech-text { margin: 0; line-height: 1.65; overflow-wrap: anywhere; }
.round-divider { display: flex; align-items: center; gap: 10px; margin: 8px 0; color: var(--muted); font-size: 11px; }
.round-divider::before, .round-divider::after { content: ""; height: 1px; flex: 1; background: var(--line); }
.action-card { border-color: rgba(157,140,255,.26); }
.action-title { margin: 0; font-size: 20px; }
.action-copy { margin: 7px 0 18px; color: var(--muted); font-size: 13px; line-height: 1.65; }
.action-row { display: flex; gap: 10px; }
.action-row .button { flex: 1; }
.char-count { margin-top: 7px; color: var(--muted); font-size: 11px; text-align: right; }

.side-column { display: grid; gap: 20px; position: sticky; top: 20px; }
.player-list { display: grid; gap: 9px; }
.player { display: grid; grid-template-columns: 38px minmax(0,1fr) auto; gap: 10px; align-items: center; padding: 10px; border: 1px solid transparent; border-radius: 14px; }
.player.current { background: rgba(113,223,189,.08); border-color: rgba(113,223,189,.2); }
.player.out { opacity: .48; }
.player-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; font-weight: 800; }
.player-status { margin-top: 3px; color: var(--muted); font-size: 11px; }
.badge { padding: 4px 7px; color: var(--muted); background: rgba(255,255,255,.07); border-radius: 999px; font-size: 9px; font-weight: 800; }
.badge-ai { color: var(--violet); background: rgba(157,140,255,.12); }
.vote-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.vote-option { min-height: 68px; padding: 10px; color: var(--ink); background: rgba(255,255,255,.055); border: 1px solid var(--line); border-radius: 14px; cursor: pointer; text-align: left; }
.vote-option:hover { border-color: var(--violet); background: rgba(157,140,255,.09); }
.vote-option.selected { border-color: var(--gold); background: rgba(255,211,106,.1); box-shadow: inset 0 0 0 1px rgba(255,211,106,.25); }
.reveal-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin: 18px 0; }
.reveal-word { padding: 16px; text-align: center; background: rgba(255,255,255,.055); border-radius: 16px; }
.reveal-word small { display: block; margin-bottom: 6px; color: var(--muted); }
.vote-record { padding: 3px 0; border-bottom: 1px solid var(--line); }
.vote-record:last-child { border-bottom: 0; }
.vote-record summary { padding: 10px 0; color: #d8d5df; cursor: pointer; font-size: 12px; font-weight: 800; }
.ballot-lines { display: grid; gap: 6px; margin: 3px 0 12px; color: var(--muted); font-size: 10px; }
.ballot-line { display: flex; justify-content: space-between; gap: 10px; }
.winner { color: var(--gold); }
.toast { position: fixed; z-index: 50; left: 50%; bottom: max(22px, env(safe-area-inset-bottom)); max-width: calc(100% - 32px); padding: 12px 18px; color: #17131f; background: var(--ink); border-radius: 12px; box-shadow: var(--shadow); font-weight: 800; font-size: 13px; transform: translate(-50%, 25px); opacity: 0; pointer-events: none; transition: .22s; }
.toast.show { transform: translate(-50%, 0); opacity: 1; }
.error-banner { margin-bottom: 16px; padding: 12px 14px; color: #ffd7de; background: rgba(255,93,121,.13); border: 1px solid rgba(255,93,121,.25); border-radius: 13px; font-size: 13px; }

@media (max-width: 820px) {
  .hero { grid-template-columns: 1fr; min-height: auto; }
  .hero-copy { text-align: center; }
  .lead { margin-left: auto; margin-right: auto; }
  .feature-row { justify-content: center; }
  .game-shell { grid-template-columns: 1fr; }
  .main-column { grid-row: 2; }
  .side-column { position: static; grid-row: 3; }
}

@media (max-width: 520px) {
  .site-header, main { width: min(100% - 24px, 1160px); }
  .site-header { height: 68px; }
  .firego-link { font-size: 0; }
  .firego-link span { font-size: 18px; }
  main { padding-top: 24px; padding-bottom: calc(40px + env(safe-area-inset-bottom)); }
  .hero { gap: 34px; }
  h1 { font-size: clamp(48px, 17vw, 72px); }
  .panel, .section-card { padding: 20px; border-radius: 22px; }
  .inline-fields, .reveal-grid { grid-template-columns: 1fr; }
  .game-top { align-items: flex-start; padding: 13px; }
  .room-meta { gap: 9px; }
  .phase-wrap { flex-direction: column; align-items: flex-end; gap: 5px; }
  .phase-pill { padding: 6px 9px; }
  .copy-label { display: none; }
  .secret-card { min-height: 150px; }
  .action-row { flex-direction: column; }
  .vote-grid { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; }
}
