:root {
  color-scheme: dark;
  font-family: ui-sans-serif, system-ui, sans-serif;
  color: #fff1dd;
  background: #20172a;
  --paper: #fff1dd;
  --muted: #d9c7d8;
  --night: #20172a;
  --surface: #33243e;
  --line: #67516c;
  --apricot: #ffb78f;
  --cream: #fff0db;
  --soft-serif: Georgia, "Times New Roman", serif;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  background: radial-gradient(ellipse at 18% 6%, #462c48 0, transparent 57%), var(--night);
}
button, input, select { font: inherit; }
button, a { -webkit-tap-highlight-color: #ffb78f24; }
button { cursor: pointer; }
a { color: inherit; }
:focus-visible { outline: 3px solid #ffe5a7; outline-offset: 3px; }
h1, h2, p { margin: 0; }
h1, h2 { overflow-wrap: anywhere; }
h1 {
  font: 700 clamp(2.4rem, 7vw, 4.45rem)/.99 var(--soft-serif);
  letter-spacing: -.055em;
  outline: none;
}
h2 { font: 700 clamp(1.42rem, 2.7vw, 1.95rem)/1.15 var(--soft-serif); letter-spacing: -.028em; }
input, select {
  display: block;
  width: 100%;
  min-width: 0;
  min-height: 48px;
  margin-top: 6px;
  padding: 10px 12px;
  border: 1px solid #846d89;
  border-radius: 9px;
  background: #20172b;
  color: var(--paper);
  font-size: 1rem;
}
input::placeholder { color: #c2aac1; }
label { color: var(--muted); font-size: .89rem; font-weight: 650; }

.topbar { border-bottom: 1px solid #5b4661; padding-inline: clamp(14px, 4vw, 38px); }
.bar-inner {
  min-height: 62px;
  width: min(100%, 1050px);
  margin-inline: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 7px;
}
.back-link, .help-link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 44px;
  font-size: .88rem;
  font-weight: 730;
  text-decoration: none;
}
.back-link { white-space: nowrap; }
.help-link {
  padding: 7px 10px;
  border: 1px solid #715a76;
  border-radius: 9px;
  background: transparent;
  color: var(--paper);
  line-height: 1.15;
}
.round-label { color: var(--apricot); font-size: .85rem; text-align: center; font-variant-numeric: tabular-nums; }
.game { padding: clamp(22px, 5vw, 62px) clamp(14px, 4vw, 38px) max(26px, env(safe-area-inset-bottom)); }
.setup-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.14fr) minmax(0, 1fr);
  align-items: start;
  gap: clamp(14px, 3vw, 30px);
  width: min(100%, 1050px);
  margin: 0 auto;
}
.poster, .panel {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 22px;
  box-shadow: 0 16px 52px #120b1a42;
}
.poster { display: grid; align-content: start; background: #36213d; overflow: hidden; }
.poster-copy {
  padding: clamp(18px, 4vw, 36px);
  background: radial-gradient(ellipse at 80% -10%, #583143, transparent 72%);
}
.poster h1 { font-size: clamp(3rem, 7.1vw, 6.4rem); margin: 5px 0 12px; white-space: nowrap; }
.poster-copy > p:last-child { color: #f6ddcd; font-size: clamp(.97rem, 1.8vw, 1.15rem); }
.poster img { width: 100%; height: clamp(218px, 25vw, 360px); display: block; object-fit: cover; object-position: 50% 49%; }
.kicker { color: var(--apricot); font-size: .84rem; font-weight: 780; letter-spacing: .05em; }
.panel {
  padding: clamp(17px, 4vw, 36px);
  background: linear-gradient(145deg, #3c2a46, #302038 75%);
}
.setup-panel { display: grid; gap: 12px; }
.copy { color: var(--muted); line-height: 1.55; font-size: 1rem; }
.copy strong { color: var(--paper); }
.seats, .word-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 11px; }
.seats { margin: 3px 0 2px; }
.seat { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: end; column-gap: 4px; }
.seat label { grid-column: 1 / -1; }
.remove {
  min-width: 34px;
  min-height: 44px;
  border: 0;
  border-radius: 8px;
  background: #482e4b;
  color: var(--paper);
  font-size: 1.25rem;
}
.button, .choice {
  border-radius: 10px;
  border: 1px solid transparent;
  min-height: 49px;
  padding: 10px 15px;
  font-size: 1rem;
  font-weight: 760;
  line-height: 1.25;
  overflow-wrap: anywhere;
}
.button.primary { color: #291523; background: var(--apricot); border-color: #ffd2b5; }
.button.primary:hover { background: #ffd0af; }
.button.secondary { background: #21182b; color: var(--paper); border-color: #816589; }
.button.secondary:hover, .vote-player:hover, .choice:hover { background: #532f50; }
.full { width: 100%; }
.text-button {
  justify-self: start;
  color: var(--apricot);
  background: transparent;
  padding-inline: 0;
  min-height: 44px;
  text-align: left;
}
.text-button:hover { text-decoration: underline; text-underline-offset: 3px; }
.small-button { font-size: .91rem; }
.form-error { color: #ffb6ba; font-weight: 650; line-height: 1.45; }

.stage {
  display: grid;
  gap: clamp(14px, 3vw, 22px);
  width: min(100%, 645px);
  margin-inline: auto;
  align-content: start;
}
.stage > .button.primary { justify-self: start; }
.choices { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 12px; }
.choice {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: flex-start;
  gap: 6px;
  padding: clamp(12px, 2.5vw, 18px);
  background: #261a2f;
  border-color: #84648d;
  color: var(--paper);
  text-align: left;
}
.choice strong { font: 700 1.45rem/1.1 var(--soft-serif); }
.choice span { color: var(--muted); font-size: .93rem; font-weight: 530; line-height: 1.45; }
.choice.warm { background: #563044; border-color: #dc9475; }
.choice.warm span { color: #f3d0c2; }
.choice.warm:hover { background: #664056; }
.word-form { display: grid; gap: 14px; }
.setter-info { font-size: .91rem; margin-top: -3px; }
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 9px; }

.private-card {
  min-height: clamp(350px, 56vh, 530px);
  justify-items: center;
  place-content: center;
  text-align: center;
  background: radial-gradient(ellipse at 50% -25%, #5b3b61, #302439 74%);
  border-color: #85678c;
}
.private-card .copy { max-width: 360px; }
.private-card > .button.primary { justify-self: center; min-width: min(280px, 100%); margin-top: 7px; }
.private-card.revealed { background: radial-gradient(ellipse at 50% 0, #244c4a, #222d39 84%); border-color: #83bcad; }
.private-card.revealed .kicker { color: #b9f2db; }
.private-card.impostor { background: radial-gradient(ellipse at 50% 0, #682e48, #372234 84%); border-color: #e9979b; }
.private-card.impostor .kicker { color: #ffc1bb; }
.category, .word-reveal {
  display: flex;
  flex-wrap: wrap;
  gap: 5px 11px;
  align-items: baseline;
  justify-self: start;
  width: fit-content;
  max-width: 100%;
  padding: 8px 12px;
  border: 1px solid #916d91;
  border-radius: 10px;
  background: #20172b;
  line-height: 1.35;
}
.category span, .word-reveal span { color: var(--muted); font-size: .87rem; }
.category strong { overflow-wrap: anywhere; color: var(--apricot); }
.private-card .category { justify-self: center; }
.order { display: flex; flex-wrap: wrap; gap: 7px; list-style: none; padding: 0; margin: 0; }
.order li {
  border: 1px solid #7b6184;
  background: #251931;
  padding: 6px 11px;
  border-radius: 50px;
  font-size: .92rem;
  overflow-wrap: anywhere;
}
.order li:first-child { color: var(--apricot); border-color: #b68173; font-weight: 700; }
.host-note, .tie-note { font-size: .92rem; }
.clock {
  color: var(--apricot);
  font: 760 clamp(3.8rem, 15vw, 6.8rem)/.9 ui-sans-serif, system-ui, sans-serif;
  letter-spacing: -.085em;
  font-variant-numeric: tabular-nums;
}
.clock span { margin-left: .1em; font-size: .42em; letter-spacing: 0; }
.time-bar { display: block; margin: -3px 0 2px; width: 100%; height: 12px; accent-color: var(--apricot); }
.discussion .button { justify-self: start; }
.vote-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 9px; }
.vote-player { min-height: 54px; color: var(--paper); background: #21182c; border-color: #876c8d; text-align: left; }

.result-top { display: grid; gap: 12px; }
.word-reveal strong { font: 700 1.3rem/1.2 var(--soft-serif); color: var(--apricot); overflow-wrap: anywhere; }
.score { display: grid; gap: 8px; }
.score ol { list-style: none; margin: 0; padding: 0; border: 1px solid #806486; border-radius: 12px; overflow: hidden; }
.score li {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 7px 12px;
  min-height: 42px;
  padding: 7px 11px;
  border-bottom: 1px solid #5f4966;
  background: #281c32;
}
.score li:last-child { border-bottom: 0; }
.score-name { font-weight: 650; overflow-wrap: anywhere; }
.score-total { grid-column: 3; white-space: nowrap; color: var(--cream); font-variant-numeric: tabular-nums; }
.score-total small { color: var(--muted); font-size: .72em; }
.gain { color: #bbefd7; font-weight: 770; }
.score-note { color: var(--muted); font-size: .82rem; }

dialog {
  width: min(calc(100vw - 24px), 540px);
  max-height: 86vh;
  padding: 0;
  border: 1px solid #94769a;
  border-radius: 16px;
  background: #392640;
  color: var(--paper);
}
dialog::backdrop { background: #130c1bdd; }
.dialog-content { display: grid; gap: 14px; padding: clamp(17px, 4vw, 27px); }
.rules { margin: 0; padding-left: 1.35rem; color: var(--muted); line-height: 1.48; }
.rules li + li { margin-top: 6px; }
.rules-scores { display: grid; gap: 3px; margin: 0; }
.rules-scores div { padding: 7px 10px; border-radius: 7px; background: #251932; }
.rules-scores dt { color: var(--paper); font-weight: 730; }
.rules-scores dd { margin: 0; color: var(--apricot); }

@media (max-width: 700px) {
  .setup-layout { grid-template-columns: 1fr; width: min(100%, 520px); }
  .poster { grid-template-columns: 1fr minmax(78px, .49fr); }
  .poster img { height: 100%; min-height: 128px; object-position: 54% center; }
  .poster h1 { font-size: clamp(2.05rem, 8.4vw, 4rem); margin-block: 6px; }
  .poster-copy { padding: 15px 0 16px 15px; z-index: 1; }
  .poster-copy > p:last-child { font-size: .91rem; line-height: 1.35; }
  .poster .kicker { font-size: .74rem; letter-spacing: 0; }
}
@media (max-width: 440px) {
  .bar-inner { min-height: 54px; }
  .game { padding-top: 16px; }
  .choices { grid-template-columns: 1fr; }
  .word-fields { grid-template-columns: 1fr; }
  .stage .actions > .button, .stage .actions > form { flex: 1 1 150px; }
  .stage > .button.primary { justify-self: stretch; }
  .panel { border-radius: 15px; }
  .private-card { min-height: 370px; }
}
