:root {
  color-scheme: dark;
  --ink: #f7f4ec;
  --muted: #a7a8b8;
  --surface: rgba(18, 19, 31, 0.82);
  --surface-strong: #151624;
  --line: rgba(255, 255, 255, 0.1);
  --violet: #8f6bff;
  --violet-deep: #5a32df;
  --coral: #ff5d76;
  --gold: #ffc857;
  --mint: #45e6b0;
  --blue: #55b8ff;
  --shadow: 0 28px 80px rgba(0, 0, 0, 0.38);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

html { min-height: 100%; background: #090a12; }

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 20% 0%, rgba(97, 60, 215, 0.21), transparent 36rem),
    radial-gradient(circle at 90% 90%, rgba(255, 93, 118, 0.12), transparent 34rem),
    #090a12;
  overflow-x: hidden;
}

button, input { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }

button:focus-visible, a:focus-visible, input:focus-visible {
  outline: 3px solid var(--gold);
  outline-offset: 3px;
}

.skip-link {
  position: fixed;
  left: 1rem;
  top: -5rem;
  z-index: 100;
  background: var(--ink);
  color: #090a12;
  padding: .75rem 1rem;
  border-radius: .6rem;
}
.skip-link:focus { top: 1rem; }

.ambient {
  position: fixed;
  width: 24rem;
  height: 24rem;
  border-radius: 999px;
  filter: blur(90px);
  opacity: .18;
  pointer-events: none;
}
.ambient-one { top: -8rem; left: -9rem; background: var(--violet); }
.ambient-two { right: -8rem; bottom: -10rem; background: var(--coral); }

.shell {
  position: relative;
  z-index: 1;
  width: min(100% - 2rem, 1440px);
  min-height: 100vh;
  margin: 0 auto;
  padding: 1.15rem 0 2rem;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: 4.5rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: .8rem;
  color: var(--ink);
  text-decoration: none;
  border: 0;
  background: transparent;
  cursor: pointer;
  padding: .25rem;
}
.brand-mark {
  display: block;
  width: 4rem;
  height: 2.65rem;
  border-radius: .85rem;
  object-fit: contain;
  object-position: center;
  border: 1px solid rgba(255,255,255,.1);
  box-shadow: 0 10px 30px rgba(143, 107, 255, .16);
}
.brand-copy { display: grid; text-align: left; }
.brand-copy strong { font-size: .92rem; letter-spacing: .09em; text-transform: uppercase; }
.brand-copy span { color: var(--muted); font-size: .72rem; }

.view-tag, .room-chip, .status-chip {
  display: inline-flex;
  align-items: center;
  gap: .45rem;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, .045);
  color: var(--muted);
  border-radius: 999px;
  padding: .55rem .8rem;
  font-size: .78rem;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.status-dot { width: .55rem; height: .55rem; border-radius: 50%; background: var(--mint); box-shadow: 0 0 18px var(--mint); }

.landing {
  display: grid;
  align-content: center;
  min-height: calc(100vh - 6rem);
  padding: 4vh 0 8vh;
}
.eyebrow {
  margin: 0 0 1rem;
  color: var(--gold);
  font-size: .78rem;
  font-weight: 900;
  letter-spacing: .18em;
  text-transform: uppercase;
}
.hero-title {
  max-width: 980px;
  margin: 0;
  font-size: clamp(4rem, 10vw, 9rem);
  line-height: .84;
  letter-spacing: -.075em;
  font-weight: 950;
}
.hero-title em {
  display: block;
  color: transparent;
  font-style: normal;
  background: linear-gradient(100deg, var(--coral), var(--gold) 48%, var(--violet));
  background-clip: text;
  -webkit-background-clip: text;
}
.hero-lede {
  max-width: 700px;
  margin: 2rem 0 0;
  color: #d8d6df;
  font-size: clamp(1.15rem, 2vw, 1.55rem);
  line-height: 1.5;
}

.role-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin-top: 3rem;
}
.role-card {
  position: relative;
  min-height: 14.5rem;
  padding: 1.35rem;
  border: 1px solid var(--line);
  border-radius: 1.35rem;
  color: var(--ink);
  text-decoration: none;
  background: linear-gradient(145deg, rgba(255,255,255,.075), rgba(255,255,255,.025));
  box-shadow: var(--shadow);
  overflow: hidden;
  transition: transform .2s ease, border-color .2s ease, background .2s ease;
}
.role-card::after {
  content: "";
  position: absolute;
  width: 9rem;
  height: 9rem;
  right: -3rem;
  bottom: -4rem;
  border-radius: 50%;
  background: var(--card-accent, var(--violet));
  filter: blur(25px);
  opacity: .22;
}
.role-card:hover { transform: translateY(-5px); border-color: rgba(255,255,255,.26); background: rgba(255,255,255,.08); }
.role-card:nth-child(2) { --card-accent: var(--coral); }
.role-card:nth-child(3) { --card-accent: var(--mint); }
.role-number { color: var(--muted); font-weight: 850; font-size: .78rem; letter-spacing: .14em; }
.role-card h2 { margin: 2.9rem 0 .6rem; font-size: clamp(1.6rem, 3vw, 2.35rem); letter-spacing: -.04em; }
.role-card p { max-width: 31ch; color: var(--muted); line-height: 1.5; margin: 0; }
.role-arrow { position: absolute; right: 1.4rem; top: 1.25rem; font-size: 1.5rem; }

.app-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.8fr) minmax(18rem, .72fr);
  gap: 1rem;
  padding-top: 1rem;
}
.panel {
  border: 1px solid var(--line);
  border-radius: 1.35rem;
  background: var(--surface);
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
}
.stage { min-height: calc(100vh - 7rem); padding: clamp(1.35rem, 3vw, 3rem); display: grid; align-content: space-between; gap: 2rem; }
.side-panel { min-height: calc(100vh - 7rem); padding: 1rem; }

.stage-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; }
.stage-kicker { color: var(--gold); text-transform: uppercase; font-weight: 900; letter-spacing: .16em; font-size: .75rem; }
.stage h1, .stage h2 { margin: .6rem 0 0; letter-spacing: -.045em; }
.stage h1 { max-width: 16ch; font-size: clamp(2.6rem, 6vw, 6.5rem); line-height: .98; }
.stage h2 { font-size: clamp(2rem, 4.3vw, 4.7rem); line-height: 1.02; }
.round-meta { display: flex; flex-wrap: wrap; gap: .65rem; align-items: center; }

.timer {
  display: grid;
  place-items: center;
  width: clamp(5.2rem, 9vw, 8rem);
  aspect-ratio: 1;
  flex: 0 0 auto;
  border-radius: 50%;
  border: 3px solid rgba(255,255,255,.15);
  background: radial-gradient(circle, rgba(143,107,255,.22), transparent 66%);
  font-size: clamp(2rem, 4.5vw, 4.3rem);
  font-weight: 950;
  font-variant-numeric: tabular-nums;
}
.timer.urgent { color: var(--coral); border-color: var(--coral); box-shadow: 0 0 32px rgba(255,93,118,.2); }

.choice-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .8rem; }
.choice, .vote-button {
  position: relative;
  display: flex;
  align-items: center;
  gap: 1rem;
  min-height: 5.6rem;
  padding: 1rem 1.15rem;
  border: 1px solid var(--line);
  border-radius: 1.05rem;
  background: rgba(255,255,255,.045);
  color: var(--ink);
  text-align: left;
  overflow: hidden;
}
.choice-letter {
  display: grid;
  place-items: center;
  width: 2.35rem;
  height: 2.35rem;
  flex: 0 0 auto;
  border-radius: .72rem;
  background: var(--violet-deep);
  font-weight: 950;
}
.choice:nth-child(2) .choice-letter, .vote-button:nth-child(2) .choice-letter { background: #c23c57; }
.choice:nth-child(3) .choice-letter, .vote-button:nth-child(3) .choice-letter { background: #a8740d; }
.choice:nth-child(4) .choice-letter, .vote-button:nth-child(4) .choice-letter { background: #087c67; }
.choice-text { font-size: clamp(1rem, 1.5vw, 1.35rem); font-weight: 800; }

.result-fill { position: absolute; inset: auto 0 0; height: var(--result-height, 0%); opacity: .12; background: var(--violet); transition: height .6s cubic-bezier(.2,.8,.2,1); }
.choice.winner { border-color: var(--gold); box-shadow: inset 0 0 0 1px var(--gold); }
.choice-stat { margin-left: auto; font-size: 1.2rem; font-weight: 950; font-variant-numeric: tabular-nums; }

.stage-footer { display: flex; justify-content: space-between; align-items: flex-end; gap: 1rem; color: var(--muted); }
.response-count strong { display: block; color: var(--ink); font-size: 1.9rem; }
.score-strip { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: .45rem; }
.score-strip span { padding: .5rem .65rem; border-radius: .65rem; background: rgba(255,255,255,.055); color: var(--muted); font-size: .78rem; }
.score-strip b { color: var(--gold); }
.score-strip strong { color: var(--ink); margin-left: .25rem; }

.leaderboard { display: grid; gap: .55rem; margin-top: 1rem; }
.leader-row { display: grid; grid-template-columns: 2rem minmax(0,1fr) auto; gap: .65rem; align-items: center; padding: .85rem; border-radius: .85rem; background: rgba(255,255,255,.045); }
.leader-row:first-child { background: linear-gradient(100deg, rgba(255,200,87,.17), rgba(255,255,255,.045)); }
.rank { color: var(--muted); font-weight: 900; }
.leader-team { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 780; }
.leader-score { color: var(--gold); font-weight: 950; font-variant-numeric: tabular-nums; }

.side-title { display: flex; align-items: center; justify-content: space-between; padding: .35rem .25rem .9rem; }
.side-title h2 { font-size: 1rem; margin: 0; }
.side-block { padding: 1rem; border-radius: 1rem; background: rgba(255,255,255,.04); margin-bottom: .75rem; }
.side-block h3 { margin: 0 0 .35rem; font-size: .84rem; color: var(--muted); letter-spacing: .08em; text-transform: uppercase; }
.side-number { display: block; font-size: 2.1rem; font-weight: 950; letter-spacing: -.05em; }
.button-stack { display: grid; gap: .65rem; margin-top: 1rem; }
.button {
  width: 100%;
  min-height: 3.15rem;
  border: 1px solid transparent;
  border-radius: .85rem;
  padding: .75rem 1rem;
  cursor: pointer;
  color: #0b0b12;
  background: var(--ink);
  font-weight: 900;
  transition: transform .15s ease, filter .15s ease, opacity .15s ease;
}
.button:hover:not(:disabled) { transform: translateY(-2px); filter: brightness(1.05); }
.button:disabled { opacity: .42; cursor: not-allowed; }
.button.primary { background: linear-gradient(100deg, var(--coral), var(--gold)); }
.button.secondary { color: var(--ink); border-color: var(--line); background: rgba(255,255,255,.07); }
.button.danger { color: #ff9bab; border-color: rgba(255,93,118,.3); background: rgba(255,93,118,.08); }
.button.inline { width: auto; }

.player-shell { width: min(100%, 520px); margin: 0 auto; padding: 1rem 0 2rem; }
.player-card { padding: 1.2rem; }
.player-hero { padding: 2rem 1.25rem 1.25rem; text-align: center; }
.player-hero h1 { margin: .6rem 0 .4rem; font-size: clamp(2.5rem, 13vw, 4.5rem); letter-spacing: -.07em; line-height: .9; }
.player-hero p { margin: 0 auto; max-width: 30ch; color: var(--muted); line-height: 1.5; }
.join-form { display: grid; gap: 1rem; margin-top: 1rem; }
.field { display: grid; gap: .45rem; }
.field span { font-size: .78rem; font-weight: 850; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; }
.field input {
  width: 100%;
  min-height: 3.35rem;
  border: 1px solid var(--line);
  border-radius: .85rem;
  padding: .8rem .95rem;
  color: var(--ink);
  background: rgba(255,255,255,.055);
}
.field input::placeholder { color: #747687; }
.player-info { display: flex; justify-content: space-between; gap: 1rem; align-items: center; margin-bottom: 1rem; }
.player-name { font-weight: 900; }
.player-team { color: var(--muted); font-size: .9rem; }
.mini-score { text-align: right; color: var(--gold); font-weight: 950; font-size: 1.35rem; }
.vote-grid { display: grid; gap: .7rem; margin-top: 1.15rem; }
.vote-button { width: 100%; cursor: pointer; min-height: 4.7rem; }
.vote-button:hover:not(:disabled) { border-color: rgba(255,255,255,.3); background: rgba(255,255,255,.085); }
.vote-button.selected { border-color: var(--gold); box-shadow: inset 0 0 0 1px var(--gold); background: rgba(255,200,87,.09); }
.vote-button:disabled { cursor: not-allowed; opacity: .68; }
.vote-confirm { margin-top: 1rem; text-align: center; color: var(--mint); font-weight: 850; }

.empty-state { display: grid; place-items: center; align-content: center; text-align: center; min-height: 55vh; padding: 2rem; }
.empty-state h1 { max-width: 15ch; margin: .6rem auto; font-size: clamp(2.5rem, 8vw, 6rem); line-height: .95; }
.empty-state p { max-width: 42ch; color: var(--muted); line-height: 1.6; }
.room-code { color: var(--gold); letter-spacing: .16em; }

.break-card {
  position: relative;
  display: grid;
  grid-template-columns: 1.2fr .8fr;
  gap: 2rem;
  align-items: center;
  min-height: 60vh;
  padding: clamp(2rem, 5vw, 5rem);
  overflow: hidden;
  border-radius: 1.4rem;
  background: linear-gradient(130deg, #5c2fd8, #9b3fd4 42%, #e75a71);
}
.break-card::before { content: ""; position: absolute; inset: 0; background: radial-gradient(circle at 85% 25%, rgba(255,255,255,.28), transparent 22rem); }
.break-copy, .break-offer { position: relative; z-index: 1; }
.break-copy h1 { max-width: 11ch; margin: .5rem 0 1rem; font-size: clamp(3rem, 7vw, 7rem); }
.break-copy p { max-width: 42ch; font-size: 1.2rem; line-height: 1.5; }
.break-offer { padding: 1.5rem; border: 1px solid rgba(255,255,255,.25); border-radius: 1.2rem; background: rgba(12,12,22,.28); backdrop-filter: blur(10px); }
.break-offer strong { display: block; font-size: clamp(2.1rem, 5vw, 4.5rem); line-height: .95; }
.break-offer span { display: block; margin-top: .8rem; color: rgba(255,255,255,.76); }

.complete-badge { display: inline-flex; padding: .55rem .8rem; border-radius: 999px; background: rgba(69,230,176,.12); color: var(--mint); font-weight: 900; }
.footnote { color: var(--muted); font-size: .78rem; line-height: 1.5; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

@media (max-width: 900px) {
  .role-grid { grid-template-columns: 1fr; }
  .role-card { min-height: 11rem; }
  .role-card h2 { margin-top: 2rem; }
  .app-grid { grid-template-columns: 1fr; }
  .stage, .side-panel { min-height: auto; }
  .stage { min-height: calc(100vh - 6.5rem); }
  .side-panel { padding-bottom: 1.5rem; }
  .break-card { grid-template-columns: 1fr; }
}

@media (max-width: 560px) {
  .shell { width: min(100% - 1rem, 1440px); padding-top: .55rem; }
  .brand-copy span { display: none; }
  .view-tag { font-size: .68rem; }
  .hero-title { font-size: clamp(3.4rem, 21vw, 6rem); }
  .landing { padding-top: 7vh; }
  .choice-grid { grid-template-columns: 1fr; }
  .stage { padding: 1.1rem; }
  .stage-head { align-items: center; }
  .stage h1 { font-size: clamp(2.3rem, 12vw, 3.8rem); }
  .timer { width: 4.9rem; }
  .stage-footer { align-items: center; }
  .break-card { padding: 1.5rem; }
}

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