:root {
  color-scheme: dark;
  --ink: #121a18;
  --panel: #1b2622;
  --raised: #26332c;
  --line: #48574e;
  --paper: #f9f1e0;
  --muted: #c4cec4;
  --accent: #f5bd70;
  --on-accent: #261a11;
  --sans: "DM Sans", "Avenir Next", system-ui, sans-serif;
  --serif: "Instrument Serif", Georgia, serif;
  --mono: "IBM Plex Mono", ui-monospace, monospace;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  min-height: 100svh;
  margin: 0;
  background: radial-gradient(ellipse at 56% 0%, #243128 0%, var(--ink) 62%);
  color: var(--paper);
  font: 400 1rem/1.5 var(--sans);
}

a, button { touch-action: manipulation; }
button { color: inherit; font: inherit; cursor: pointer; -webkit-tap-highlight-color: transparent; }
button:disabled { cursor: default; }
:where(button, a):focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 4px;
}

.site-header {
  min-height: 66px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 8px max(4vw, calc((100% - 1440px) / 2));
  border-bottom: 1px solid #ffffff1f;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  color: var(--paper);
  font-size: .91rem;
  font-weight: 700;
  text-decoration: none;
}

.brand-clock {
  position: relative;
  flex: 0 0 22px;
  width: 22px;
  height: 22px;
  border: 1px solid var(--accent);
  border-radius: 50%;
}

.brand-clock::after {
  position: absolute;
  left: 9px;
  top: 4px;
  width: 4px;
  height: 6px;
  border-bottom: 1px solid var(--accent);
  border-left: 1px solid var(--accent);
  content: "";
}

#mute {
  min-height: 44px;
  flex: 0 0 auto;
  padding: 0 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #121a189c;
  color: var(--muted);
  font-size: .84rem;
  font-weight: 600;
}

main {
  width: min(100%, 1552px);
  margin-inline: auto;
  padding: clamp(12px, 2.1vw, 30px) clamp(12px, 3.5vw, 56px) clamp(22px, 3vw, 48px);
}

#cover {
  position: relative;
  isolation: isolate;
  display: grid;
  align-items: center;
  min-height: clamp(540px, 78svh, 800px);
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #1d2922;
  box-shadow: 0 20px 70px #080e0c80;
}

#coverimage {
  position: absolute;
  z-index: -1;
  inset: 0;
  background: #26372e;
}

#coverimage::after {
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, #101916 0%, #111917e6 21%, #111917a8 44%, #1119172b 65%, transparent 82%),
    linear-gradient(0deg, #15191678, transparent 24%);
  content: "";
  pointer-events: none;
}

#art {
  position: absolute;
  inset: 0;
}

.intro {
  width: min(70%, 820px);
  padding: clamp(28px, 5vw, 76px);
}

.intro h1 {
  margin: 0;
  color: var(--paper);
  font: 400 clamp(4rem, 7.5vw, 7.75rem)/.88 var(--serif);
  letter-spacing: -.035em;
  text-wrap: balance;
}

.intro h1 em { color: var(--accent); font-weight: 400; }

.intro p {
  max-width: 34ch;
  margin: clamp(19px, 3.3vw, 34px) 0 24px;
  color: #e6ebdf;
  font-size: clamp(1rem, 1.5vw, 1.29rem);
}

.entry-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 9px;
}

.primary, .secondary, .mini {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  gap: .6em;
  padding: 8px 16px;
  border: 1px solid transparent;
  border-radius: 7px;
  font-weight: 700;
}

.primary {
  min-height: 48px;
  padding-inline: 20px;
  background: var(--accent);
  color: var(--on-accent);
}

.secondary, .mini {
  border-color: var(--line);
  background: var(--raised);
  color: var(--paper);
}

.intro .secondary { min-height: 48px; background: #19241ee8; }
.room-dialog {
  width: min(430px, calc(100% - 32px));
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--panel);
  color: var(--paper);
}
.room-dialog::backdrop { background: #060a08c7; }
.room-dialog h2 { margin: 0 0 16px; font: 400 2.5rem/1 var(--serif); }
.room-dialog label { display: block; }
.room-dialog input {
  width: 100%;
  min-height: 44px;
  margin: 6px 0 12px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--ink);
  color: var(--paper);
  font: inherit;
}
.room-dialog input:focus-visible { outline: 2px solid var(--accent); }
#room-code { text-transform: uppercase; }
#host-error { color: #ffaaa7; }
#host-error:empty { display: none; }
.mini { font-size: .88rem; }
.primary:hover:enabled { background: #ffd397; }
:is(.secondary, .mini, #mute):hover:enabled { background: #35443a; }
:is(.primary, .secondary, .mini):disabled { opacity: .6; }

#stage {
  max-width: 1216px;
  margin-inline: auto;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--panel);
  box-shadow: 0 14px 42px #080e0c67;
}

.topline, .eyebrow {
  color: var(--accent);
  font: 600 clamp(.72rem, 1.25vw, .91rem)/1.4 var(--mono);
  letter-spacing: .085em;
  text-transform: uppercase;
}

.topline {
  min-height: 42px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  column-gap: 16px;
  padding: 8px clamp(14px, 2.3vw, 30px);
  border-bottom: 1px solid #ffffff1d;
  background: #121b17;
}

#time {
  margin-left: auto;
  color: var(--paper);
  font-variant-numeric: tabular-nums;
}

#screen {
  position: relative;
  height: clamp(250px, 49svh, 580px);
  overflow: hidden;
  background: #25342b;
}

body.voting #screen { height: clamp(135px, 25svh, 275px); }
#stage:has(#screen:empty) { max-width: 740px; }

#dialogue, #panel { padding-inline: clamp(14px, 2.6vw, 34px); }
#dialogue { padding-block: clamp(12px, 1.65vw, 22px) 4px; }
#panel { padding-block: 10px clamp(16px, 2.3vw, 28px); }
:is(#dialogue, #panel, #screen):empty { display: none; }

#panel > :is(button, .joinlink) {
  margin-inline-end: 8px;
  margin-block-end: 5px;
}

.line, .question { margin: .28em 0 0; font-weight: 400; }
.line {
  max-width: 76ch;
  font-size: clamp(1.25rem, 2.14vw, 1.8rem);
  line-height: 1.38;
}
.caption-pending { visibility: hidden; }

body[data-ending="best"] { --accent: #f5ce83; --panel: #253027; }
body[data-ending="mixed"] { --accent: #cdd8e7; --panel: #252f39; }
body[data-ending="bad"] { --accent: #ffaaa7; --panel: #301f26; }

.question {
  font-family: var(--serif);
  font-size: clamp(2.15rem, 4vw, 3.75rem);
  line-height: .99;
  text-wrap: pretty;
}

.choices {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px;
  margin-block: 4px 12px;
}

.choices:last-child { margin-bottom: 0; }

.choice {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  min-height: 72px;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #27352d;
  text-align: left;
  line-height: 1.25;
  transition: background-color .16s ease, border-color .16s ease;
}

.choice:where(:enabled:hover, :enabled:active) {
  border-color: #97aa96;
  background: #34463a;
}

.choice:disabled { background: #212c25; }
.choice:disabled strong { color: var(--muted); }

.choice i {
  display: grid;
  place-items: center;
  min-width: 30px;
  min-height: 30px;
  border: 1px solid #8d7550;
  border-radius: 4px;
  color: var(--accent);
  font: normal 600 .88rem/1 var(--mono);
}

.choice strong, .choice small { display: block; }
.choice strong { font-size: clamp(1rem, 1.5vw, 1.22rem); }
.choice small {
  margin-top: 3px;
  color: var(--muted);
  font-size: clamp(.91rem, 1.23vw, 1.03rem);
  line-height: 1.4;
}

.choice.selected, .choice[aria-pressed="true"] {
  border-color: var(--accent);
  background: #453528;
  box-shadow: inset 0 0 0 1px var(--accent);
}

.choice.selected i, .choice[aria-pressed="true"] i {
  border-color: var(--accent);
  background: var(--accent);
  color: var(--on-accent);
}

.note, #panel > p {
  margin: 0 0 .7em;
  color: var(--muted);
  line-height: 1.45;
}

#dialogue .note { margin-top: .8em; }

#stage:has(#screen:empty) #panel:not(:empty) {
  display: flex;
  flex-direction: column;
}

#stage:has(#screen:empty) #panel > .note {
  order: -1;
  padding: 8px 10px;
  border-left: 2px solid var(--accent);
  background: #362b23;
  color: var(--paper);
}

.note:empty { display: none; }

.roomWrap {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: clamp(12px, 3vw, 26px);
}

.roomWrap .question { overflow-wrap: anywhere; }
.roomWrap .note { display: block; }

.qr {
  width: clamp(155px, 16vw, 230px);
  height: auto;
  padding: 6px;
  border-radius: 7px;
  background: white;
}

.joinlink {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  padding: 4px 8px;
  color: var(--accent);
  font-weight: 600;
  text-underline-offset: .18em;
}

#error {
  max-width: 64ch;
  margin: 12px auto 0;
  padding: 10px 14px;
  border: 1px solid #a76863;
  border-radius: 7px;
  background: #41292c;
  color: #ffe0d0;
  font-size: .96rem;
}

#error:empty {
  margin: 0;
  padding: 0;
  border: 0;
}

@media (max-width: 760px) {
  .site-header { min-height: 56px; }

  #cover {
    min-height: 0;
    display: block;
    border-radius: 12px;
  }

  #coverimage {
    position: relative;
    z-index: auto;
    aspect-ratio: 16 / 9;
  }

  #coverimage::after {
    background: linear-gradient(0deg, #1d2922, transparent 30%);
  }

  .intro {
    position: relative;
    width: auto;
    padding: 0 clamp(18px, 5vw, 34px) 26px;
    margin-top: -8px;
  }

  .intro h1 {
    font-size: clamp(3.25rem, 11vw, 5.25rem);
    text-wrap: initial;
  }

  .intro p { margin-block: 16px; }
  #stage { border-radius: 10px; }
  #screen { height: clamp(190px, 38svh, 340px); }
  body.voting #screen { height: clamp(110px, 23svh, 185px); }
  .choices { grid-template-columns: minmax(0, 1fr); }
  #stage:has(#screen:empty) .question { font-size: clamp(1.9rem, 8vw, 2.55rem); }
  #stage:has(#screen:empty) .choice { padding: 10px; }
}

@media (max-width: 375px) {
  .brand { font-size: .79rem; gap: 7px; }
  .brand-clock { display: none; }
  #mute { padding-inline: 9px; }
  .entry-actions > button { flex: 1 1 100%; }
}

@media (prefers-reduced-motion: reduce) {
  .choice { transition: none; }
}
