:root {
  --font: "Manrope", "Segoe UI", "Noto Sans", sans-serif;
  --display: "Unbounded", "Manrope", "Segoe UI", sans-serif;
  --bg: #16130f;
  --paper: #f4eee6;
  --ink: #241c16;
  --muted: #8a7d72;
  --cream: #f3eadf;
  --red: #e15a45;
  --blue: #3d74d8;
  --gold: #e2b15a;
  --ok: #1f8a5b;
  color-scheme: dark;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.45;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--cream);
  background-color: var(--bg);
  background-image:
    radial-gradient(rgba(243, 234, 223, 0.045) 0.8px, transparent 0.8px),
    radial-gradient(920px 460px at -10% -20%, rgba(225, 90, 69, 0.32), transparent 55%),
    radial-gradient(820px 440px at 115% -10%, rgba(61, 116, 216, 0.3), transparent 52%);
  background-size: 18px 18px, auto, auto;
  -webkit-font-smoothing: antialiased;
}

button,
input,
select {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

h1,
h2,
p {
  margin: 0;
}

h1,
.question__text,
.brand,
.hero__value,
.team-panel h2 {
  font-family: var(--display);
  font-weight: 700;
  letter-spacing: -0.03em;
}

h1 {
  font-size: clamp(1.7rem, 4vw, 2.5rem);
  line-height: 1.15;
}

:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 3px;
}

.boot {
  padding: 18vh 20px;
  text-align: center;
}

.shell {
  min-height: 100vh;
}

.topbar,
.banner,
.stage {
  width: min(1120px, calc(100% - 28px));
  margin-inline: auto;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 0 14px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1.15rem;
}

.brand__mark {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: linear-gradient(90deg, var(--red) 50%, var(--blue) 50%);
  box-shadow: 0 0 0 3px rgba(243, 234, 223, 0.14);
}

.topbar__meta {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px;
}

.stage {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding-bottom: 48px;
}

.pill,
.chip,
.badge,
.tag {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  font-weight: 700;
}

.pill {
  padding: 6px 10px;
  font-size: 13px;
  background: rgba(243, 234, 223, 0.08);
  border: 1px solid rgba(243, 234, 223, 0.14);
}

.pill--live {
  color: #b6f3d2;
}

.pill--connecting,
.pill--idle {
  color: #f3d7a2;
}

.pill--closed {
  color: #ffc7be;
  background: transparent;
}

.chip {
  max-width: 240px;
  padding: 6px 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  background: rgba(243, 234, 223, 0.1);
}

.chip--red {
  background: rgba(225, 90, 69, 0.22);
}

.chip--blue {
  background: rgba(61, 116, 216, 0.24);
}

.banner {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
  padding: 12px 14px;
  border: 1px solid rgba(255, 180, 168, 0.28);
  border-radius: 16px;
  background: #3a221c;
  color: #ffd9d2;
}

.banner code {
  display: block;
  margin-top: 4px;
  color: rgba(255, 217, 210, 0.72);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  letter-spacing: 0.04em;
}

.button {
  min-height: 44px;
  padding: 10px 16px;
  border: 1px solid transparent;
  border-radius: 999px;
  background: var(--ink);
  color: var(--paper);
  font-weight: 800;
}

.button--small {
  min-height: 34px;
  padding: 6px 10px;
  font-size: 13px;
}

.button--gold {
  background: var(--gold);
  color: #2a2116;
}

.button--ghost {
  background: transparent;
  color: inherit;
  border-color: rgba(243, 234, 223, 0.28);
}

.button--danger {
  background: transparent;
  color: #ffb4a8;
  border-color: rgba(255, 180, 168, 0.45);
}

.button--block {
  width: 100%;
}

.card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 22px;
  border-radius: 28px;
  background: var(--paper);
  color: var(--ink);
  color-scheme: light;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.28);
}

.card .lead,
.note {
  color: #5e564e;
}

.card .button--ghost {
  color: var(--ink);
  border-color: rgba(36, 28, 22, 0.22);
}

.card .button--danger {
  color: #9d3428;
  border-color: rgba(157, 52, 40, 0.35);
}

.kicker {
  color: #cbbbaa;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.card .kicker,
.team-panel .kicker {
  color: rgba(255, 255, 255, 0.76);
}

.card .kicker {
  color: var(--muted);
}

.lead {
  max-width: 40rem;
  color: #d9cbbd;
  font-size: 1.02rem;
}

.lead--center {
  margin-inline: auto;
  text-align: center;
}

.fineprint {
  margin-top: 14px;
  color: var(--muted);
  font-size: 12px;
}

.login {
  width: min(460px, 100%);
  margin: 4vh auto 0;
}

.segment {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  margin: 18px 0 16px;
  padding: 4px;
  border-radius: 14px;
  background: rgba(36, 28, 22, 0.06);
}

.segment button {
  min-height: 42px;
  border: 0;
  border-radius: 11px;
  background: transparent;
  color: var(--ink);
  font-weight: 800;
}

.segment button[aria-pressed="true"] {
  background: white;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 14px;
  font-weight: 700;
}

.field span {
  font-size: 13px;
}

.field input,
.field select {
  min-height: 48px;
  padding: 10px 12px;
  border: 1.5px solid rgba(36, 28, 22, 0.16);
  border-radius: 14px;
  background: white;
  color: var(--ink);
  font-weight: 600;
}

.section-head,
.lobby,
.play,
.results,
.admin,
.controls {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.controls__row,
.history__answers,
.answer__tags,
.player__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.scoreboard {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.score {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  padding: 12px 14px;
  border: 1px solid rgba(243, 234, 223, 0.12);
  border-radius: 18px;
  background: rgba(243, 234, 223, 0.06);
}

.card .score {
  border-color: rgba(36, 28, 22, 0.08);
  background: rgba(36, 28, 22, 0.04);
}

.score__label {
  font-weight: 800;
}

.score__value {
  font-family: var(--display);
  font-size: 1.6rem;
  line-height: 1;
}

.score--red .score__value {
  color: #d4533e;
}

.score--blue .score__value {
  color: #2f66d0;
}

.score--me {
  box-shadow: inset 0 0 0 2px var(--gold);
}

.team-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.team-panel {
  min-height: 220px;
  padding: 16px;
  border-radius: 24px;
  color: white;
}

.team-panel--red {
  background: linear-gradient(180deg, #ee6a54, #a43326);
}

.team-panel--blue {
  background: linear-gradient(180deg, #4d86ea, #1d4f9f);
}

.team-panel__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}

.team-panel h2 {
  font-size: 1.35rem;
}

.team-panel__count,
.team-panel__captain,
.team-panel__empty {
  color: rgba(255, 255, 255, 0.82);
}

.team-panel__captain {
  margin: 8px 0 12px;
  font-weight: 700;
}

.team-panel__list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 360px;
  overflow: auto;
}

.player {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 14px;
  background: rgba(0, 0, 0, 0.16);
}

.player--me {
  box-shadow: inset 0 0 0 1.5px rgba(255, 255, 255, 0.9);
}

.player__name {
  flex: 1 1 80px;
  min-width: 0;
  overflow: hidden;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dot {
  width: 8px;
  height: 8px;
  flex: none;
  border-radius: 50%;
  background: #b6f3d2;
}

.dot--off {
  background: rgba(255, 255, 255, 0.35);
}

.badge {
  padding: 3px 7px;
  background: rgba(255, 255, 255, 0.18);
  font-size: 11px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.team-panel .button {
  background: rgba(255, 255, 255, 0.16);
  color: white;
}

.team-panel .button--ghost {
  background: transparent;
  border-color: rgba(255, 255, 255, 0.4);
}

.question__text {
  margin-bottom: 16px;
  font-size: clamp(1.45rem, 3vw, 2.15rem);
  overflow-wrap: anywhere;
}

.answers {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.answer {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  width: 100%;
  min-height: 72px;
  padding: 14px;
  border: 1.5px solid rgba(36, 28, 22, 0.12);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.55);
  color: var(--ink);
  text-align: left;
}

button.answer:hover {
  border-color: rgba(36, 28, 22, 0.45);
}

.answer--picked {
  border-color: var(--ink);
  background: white;
  box-shadow: inset 0 0 0 1px var(--ink);
}

.answer--correct {
  border-color: var(--ok);
  background: #e7f6ee;
  box-shadow: none;
}

.answer--wrong {
  border-color: #e3b0a8;
  background: #fdeceb;
  box-shadow: none;
}

.answer__line {
  display: flex;
  align-items: baseline;
  gap: 10px;
}

.answer__letter {
  font-family: var(--display);
  font-size: 0.85rem;
  opacity: 0.55;
}

.answer__text {
  font-weight: 800;
  overflow-wrap: anywhere;
}

.tag {
  padding: 3px 8px;
  font-size: 12px;
}

.tag--red {
  background: #f8d4cc;
  color: #8e2e22;
}

.tag--blue {
  background: #d7e4fb;
  color: #1a3f86;
}

.tag--ok {
  background: #d7f3e4;
  color: #146843;
}

.tag--bad {
  background: #f8d4cc;
  color: #8e2e22;
}

.note {
  font-weight: 700;
}

div.answer {
  cursor: default;
}

.note--secret {
  color: #8a5a12;
}

.hero {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 12px;
  align-items: center;
  margin: 4px 0 8px;
}

.hero__team {
  padding: 8px;
  text-align: center;
}

.hero__label,
.hero__unit,
.hero__vs {
  font-weight: 800;
}

.hero__vs {
  color: #cbbbaa;
}

.hero__value {
  display: block;
  font-size: clamp(3.2rem, 8vw, 5.4rem);
  line-height: 0.92;
}

.hero__team--red .hero__value {
  color: #ff8d7a;
}

.hero__team--blue .hero__value {
  color: #9db7ff;
}

.hero__team--me {
  border-radius: 18px;
  outline: 2px solid var(--gold);
  outline-offset: 4px;
}

.history__list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin: 4px 0 0;
  padding: 0;
  list-style: none;
}

.admin-winner {
  font-family: var(--display);
  font-size: 1.6rem;
}

.waiting .button {
  margin-top: 16px;
}

@media (max-width: 800px) {
  .team-grid,
  .answers,
  .hero {
    grid-template-columns: 1fr;
  }

  .hero {
    justify-items: center;
  }

  .login {
    margin-top: 12px;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    scroll-behavior: auto;
    transition: none;
  }
}
