:root {
  color-scheme: light;
  --ink: var(--kq-ink);
  --muted: rgba(255, 255, 255, 0.72);
  --paper: var(--kq-blue);
  --panel: var(--kq-white);
  --blue: var(--kq-blue);
  --blue-deep: var(--kq-blue-deep);
  --pink: var(--kq-pink);
  --aqua: var(--kq-aqua);
  --yellow: var(--kq-yellow);
  --green: var(--kq-green);
  --red: var(--kq-red);
  --line: rgba(255, 255, 255, 0.26);
  --shadow: 0 22px 52px rgba(20, 14, 92, 0.22);
  --font-display: var(--kq-font-display);
  --font-ui: var(--kq-font-ui);
  --font-data: var(--kq-font-data);
}

* {
  box-sizing: border-box;
}

[hidden],
.sr-only {
  display: none !important;
}

html,
body {
  width: 100%;
  height: 100%;
  overscroll-behavior: none;
}

body {
  margin: 0;
  overflow: hidden;
  background: var(--paper);
  color: #fff;
  font-family: var(--font-ui);
  letter-spacing: 0;
  touch-action: manipulation;
}

body::before,
body::after {
  content: "";
  position: fixed;
  pointer-events: none;
  z-index: 0;
}

body::before {
  width: min(50vw, 640px);
  height: min(32vh, 330px);
  right: -11vw;
  top: 70px;
  border-radius: 120px 0 0 230px;
  background: var(--pink);
}

body::after {
  width: min(44vw, 560px);
  height: min(37vh, 360px);
  right: -12vw;
  bottom: 0;
  border-radius: 250px 0 0 86px;
  background: var(--aqua);
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

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

.player-shell {
  position: relative;
  z-index: 1;
  width: min(100vw - 24px, 1180px);
  height: 100dvh;
  min-height: 620px;
  margin: 0 auto;
  padding: 14px 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 12px;
  overflow: hidden;
}

.player-top {
  min-height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.player-nav {
  min-width: 0;
  display: inline-flex;
  gap: 6px;
  padding: 4px;
  border-radius: 999px;
  background: rgba(47, 41, 144, 0.58);
  box-shadow: inset 0 0 0 1px var(--line);
}

.player-nav a {
  min-height: 30px;
  padding: 0 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  font-size: 12px;
  font-weight: 950;
  text-decoration: none;
}

.brand-lockup {
  min-width: 0;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: inherit;
  text-decoration: none;
}

.brand-name,
.brand-claim {
  display: block;
}

.brand-name {
  font-family: var(--font-display);
  font-size: clamp(22px, 2.3vw, 34px);
  font-weight: 950;
  line-height: 0.92;
}

.brand-claim {
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 760;
}

.connection-pill {
  flex: 0 0 auto;
  min-height: 34px;
  padding: 0 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: var(--panel);
  color: var(--blue-deep);
  box-shadow: inset 0 0 0 1px var(--line);
  font-family: var(--font-data);
  font-size: 12px;
  font-weight: 900;
}

.connection-pill.lost {
  background: var(--red);
  color: #fff;
}

.show-frame {
  min-height: 0;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  gap: 10px;
  overflow: hidden;
}

.show-meta {
  min-height: 58px;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.meta-chip {
  min-width: 0;
  padding: 9px 11px;
  display: grid;
  align-content: center;
  gap: 4px;
  border-radius: 16px;
  background: rgba(47, 41, 144, 0.58);
  box-shadow: inset 0 0 0 1px var(--line);
}

.meta-chip span {
  color: rgba(255, 255, 255, 0.68);
  font-size: 10px;
  font-weight: 900;
  text-transform: uppercase;
}

.meta-chip strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #fff;
  font-family: var(--font-data);
  font-size: clamp(15px, 1.8vw, 24px);
  font-weight: 900;
  line-height: 1;
}

.pot-chip strong {
  overflow: visible;
  text-overflow: clip;
  white-space: normal;
}

.timer-wrap {
  min-height: 70px;
  padding: 10px;
  border-radius: 20px;
  background: rgba(47, 41, 144, 0.58);
  box-shadow: inset 0 0 0 1px var(--line);
}

.timer-track {
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.18);
}

.timer-fill {
  width: 100%;
  height: 100%;
  transform-origin: left center;
  border-radius: inherit;
  background: var(--yellow);
  transition: width 160ms linear;
}

.timer-wrap.danger .timer-fill {
  background: var(--pink);
}

.timer-wrap.locked .timer-fill {
  background: var(--aqua);
}

.timer-copy {
  margin-top: 7px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: #fff;
  font-size: 13px;
  font-weight: 900;
}

#countdownValue {
  min-width: 70px;
  text-align: right;
  font-family: var(--font-data);
  font-size: clamp(28px, 4.5vw, 50px);
  line-height: 0.9;
  font-variant-numeric: tabular-nums;
}

.quiz-stage,
.completion-panel {
  min-height: 0;
  padding: clamp(14px, 2.4vw, 28px);
  display: grid;
  align-content: start;
  gap: clamp(10px, 1.6vw, 18px);
  overflow: hidden;
  border-radius: 28px;
  background: rgba(47, 41, 144, 0.36);
  box-shadow: inset 0 0 0 1px var(--line);
}

.kicker {
  margin: 0;
  color: var(--yellow);
  font-family: var(--font-data);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.question {
  max-width: 980px;
  margin: 0;
  color: #fff;
  font-family: var(--font-display);
  font-size: clamp(28px, 4.8vw, 58px);
  font-weight: 950;
  line-height: 1.02;
  text-wrap: balance;
}

.question.question-short {
  font-size: clamp(34px, 5.4vw, 66px);
}

.question.question-medium {
  font-size: clamp(30px, 4.8vw, 58px);
}

.question.question-long {
  font-size: clamp(24px, 3.9vw, 46px);
}

.answer-grid {
  min-height: 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.answer-card {
  min-height: clamp(68px, 10vh, 104px);
  padding: 13px 15px;
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  border: 0;
  border-radius: 18px;
  background: #fff;
  color: var(--ink);
  box-shadow: inset 0 0 0 2px rgba(64, 56, 184, 0.16);
  text-align: left;
  transition: transform 120ms ease, box-shadow 120ms ease, background 120ms ease;
}

.answer-card:hover,
.answer-card:focus-visible {
  transform: translateY(-1px);
  box-shadow: inset 0 0 0 3px var(--blue), 0 8px 18px rgba(47, 41, 144, 0.14);
}

.answer-card[disabled] {
  cursor: not-allowed;
}

.answer-card.disabled {
  opacity: 0.54;
}

.answer-card.selected_pending {
  background: var(--yellow);
  color: var(--blue-deep);
  box-shadow: inset 0 0 0 3px #fff, 0 0 0 3px var(--yellow);
}

.answer-card.submitted_locked {
  background: #eef0ff;
  color: var(--blue-deep);
  box-shadow: inset 0 0 0 3px var(--aqua), 0 0 0 3px rgba(103, 223, 209, 0.42);
}

.answer-card.correct,
.answer-card.correct_not_selected {
  background: var(--green);
  color: #fff;
  box-shadow: inset 0 0 0 3px #fff, 0 0 0 3px rgba(24, 165, 111, 0.36);
}

.answer-card.selected_wrong {
  background: var(--pink);
  color: #fff;
  box-shadow: inset 0 0 0 3px #fff, 0 0 0 3px rgba(227, 24, 104, 0.36);
}

.answer-key {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--blue);
  color: #fff;
  font-family: var(--font-data);
  font-size: 14px;
  font-weight: 900;
}

.answer-card.correct .answer-key,
.answer-card.correct_not_selected .answer-key,
.answer-card.selected_wrong .answer-key,
.answer-card.selected_pending .answer-key {
  background: #fff;
  color: var(--blue-deep);
}

.answer-label {
  min-width: 0;
  overflow-wrap: anywhere;
  font-size: clamp(16px, 1.8vw, 22px);
  font-weight: 850;
  line-height: 1.14;
}

.player-status {
  min-height: 44px;
  padding: 10px 13px;
  display: flex;
  align-items: center;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.14);
  color: rgba(255, 255, 255, 0.88);
  font-size: clamp(14px, 1.5vw, 18px);
  font-weight: 800;
  line-height: 1.18;
}

.player-status.good {
  background: rgba(24, 165, 111, 0.30);
  color: #fff;
}

.player-status.bad {
  background: rgba(227, 24, 104, 0.34);
  color: #fff;
}

.primary-actions,
.completion-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.primary-action,
.secondary-action {
  min-height: 48px;
  padding: 0 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 16px;
  background: var(--blue);
  color: #fff;
  font-weight: 900;
  text-decoration: none;
}

.secondary-action {
  background: rgba(255, 255, 255, 0.16);
  color: #fff;
}

.survivor-transition {
  width: fit-content;
  max-width: 100%;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.16);
  color: #fff;
  font-weight: 900;
}

.pregame-panel {
  width: min(100%, 540px);
  padding: 14px;
  border-radius: 22px;
  background: var(--blue);
  color: #fff;
}

.pregame-head,
.pregame-countdown {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.pregame-head {
  font-size: 13px;
  font-weight: 900;
  text-transform: uppercase;
}

.pregame-head strong {
  color: var(--yellow);
  font-family: var(--font-data);
  font-size: 12px;
}

.pregame-countdown {
  margin-top: 8px;
}

.pregame-countdown span {
  color: rgba(255, 255, 255, 0.76);
  font-size: 16px;
  font-weight: 850;
}

.pregame-countdown strong {
  font-family: var(--font-data);
  font-size: clamp(30px, 7vw, 48px);
  font-weight: 900;
  line-height: 1;
}

.chat-list {
  height: 132px;
  margin-top: 10px;
  display: grid;
  align-content: end;
  gap: 7px;
  overflow: hidden;
}

.chat-message {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr);
  align-items: start;
  gap: 8px;
  color: rgba(255, 255, 255, 0.84);
  font-size: 13px;
  font-weight: 740;
  line-height: 1.2;
}

.chat-avatar {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.18);
  color: #fff;
  font-size: 11px;
  font-weight: 900;
}

.chat-message strong {
  color: #fff;
  font-weight: 900;
}

.chat-message[data-kind="system"] strong {
  color: var(--yellow);
}

.chat-form {
  margin-top: 10px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.chat-form input,
.chat-form button {
  min-height: 46px;
  border: 0;
  border-radius: 15px;
}

.chat-form input {
  min-width: 0;
  padding: 0 13px;
  background: #fff;
  color: var(--ink);
  font-size: 16px;
  font-weight: 760;
}

.chat-form button {
  padding: 0 15px;
  background: var(--aqua);
  color: var(--blue-deep);
  font-weight: 900;
}

.chat-status {
  min-height: 18px;
  margin: 8px 0 0;
  color: rgba(255, 255, 255, 0.74);
  font-size: 12px;
  font-weight: 740;
}

.completion-panel {
  align-content: center;
}

.completion-panel h2 {
  max-width: 880px;
  margin: 0;
  color: #fff;
  font-family: var(--font-display);
  font-size: clamp(38px, 6vw, 78px);
  font-weight: 950;
  line-height: 0.96;
}

.completion-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.completion-stat {
  min-height: 84px;
  padding: 14px;
  display: grid;
  align-content: center;
  gap: 5px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.14);
}

.completion-stat span {
  color: rgba(255, 255, 255, 0.66);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.completion-stat strong {
  overflow-wrap: anywhere;
  color: #fff;
  font-size: clamp(18px, 2vw, 28px);
}

@media (max-width: 768px) {
  .player-shell {
    width: calc(100vw - 18px);
    min-height: 100dvh;
    padding: 8px 0;
    gap: 7px;
  }

  .player-top {
    min-height: 76px;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-content: center;
  }

  .connection-pill {
    grid-column: 2;
    grid-row: 1;
    justify-self: end;
    align-self: center;
  }

  .brand-lockup {
    grid-column: 1;
    grid-row: 1;
    gap: 7px;
  }

  .player-nav {
    grid-column: 1 / -1;
    grid-row: 2;
    width: 100%;
    gap: 4px;
    padding: 4px;
  }

  .player-nav a {
    flex: 1;
    min-height: 28px;
    padding: 0 5px;
    font-size: 11px;
  }

  .kq-mark,
  .brand-mark {
    width: 32px;
    height: 32px;
    font-size: 12px;
  }

  .brand-name {
    font-size: 21px;
  }

  .brand-claim {
    display: none;
  }

  .connection-pill {
    min-height: 30px;
    padding: 0 9px;
    font-size: 11px;
  }

  .show-frame {
    grid-template-rows: auto auto minmax(0, 1fr);
    gap: 7px;
  }

  .show-meta {
    min-height: 50px;
    gap: 5px;
  }

  .meta-chip {
    padding: 6px;
    border-radius: 12px;
  }

  .meta-chip span {
    font-size: 8px;
  }

  .meta-chip strong {
    font-size: clamp(11px, 3vw, 15px);
  }

  .timer-wrap {
    min-height: 56px;
    padding: 8px;
    border-radius: 16px;
  }

  .timer-track {
    height: 8px;
  }

  .timer-copy {
    margin-top: 5px;
    font-size: 11px;
  }

  #countdownValue {
    min-width: 52px;
    font-size: clamp(24px, 7vw, 32px);
  }

  .quiz-stage,
  .completion-panel {
    padding: 10px;
    gap: 7px;
    border-radius: 20px;
  }

  .kicker {
    font-size: 10px;
  }

  .question,
  .question.question-short,
  .question.question-medium {
    font-size: clamp(28px, 8.3vw, 36px);
    line-height: 1.02;
  }

  .question.question-long {
    font-size: clamp(22px, 6.7vw, 30px);
  }

  .answer-grid {
    grid-template-columns: 1fr;
    gap: 7px;
  }

  .answer-card {
    min-height: 56px;
    height: clamp(56px, 7.1vh, 64px);
    padding: 8px 10px;
    grid-template-columns: 30px minmax(0, 1fr);
    gap: 9px;
    border-radius: 16px;
  }

  .answer-key {
    width: 28px;
    height: 28px;
    font-size: 12px;
  }

  .answer-label {
    font-size: clamp(15px, 4.2vw, 18px);
  }

  .player-status {
    min-height: 34px;
    padding: 7px 9px;
    border-radius: 13px;
    font-size: 12px;
  }

  .survivor-transition {
    padding: 6px 9px;
    font-size: 12px;
  }

  .pregame-panel {
    width: 100%;
    padding: 11px;
    border-radius: 18px;
  }

  .pregame-countdown strong {
    font-size: 34px;
  }

  .chat-list {
    height: 112px;
  }

  .chat-form {
    grid-template-columns: 1fr;
  }

  .primary-action,
  .secondary-action {
    width: 100%;
    min-height: 44px;
  }

  .completion-panel h2 {
    font-size: clamp(31px, 9vw, 42px);
  }

  .completion-grid {
    grid-template-columns: 1fr;
    gap: 7px;
  }

  .completion-stat {
    min-height: 58px;
    padding: 10px;
  }
}

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