@import url('https://fonts.googleapis.com/css2?family=Fraunces:wght@500;600;700&family=Space+Grotesk:wght@400;500;600;700&display=swap');

html,
body {
  height: 100%;
}

:root {
  color-scheme: light;
  font-family: 'Space Grotesk', 'Helvetica Neue', Arial, sans-serif;
  line-height: 1.5;
  font-weight: 400;
  --font-body: 'Space Grotesk', 'Helvetica Neue', Arial, sans-serif;
  --font-display: 'Fraunces', 'Times New Roman', serif;
  --bg: #f6f1e6;
  --bg-strong: #f2ecde;
  --card: rgba(255, 255, 255, 0.88);
  --card-strong: #ffffff;
  --border: rgba(25, 36, 52, 0.15);
  --text: #18212d;
  --text-muted: rgba(24, 33, 45, 0.65);
  --accent: #ff7a1a;
  --accent-muted: rgba(255, 122, 26, 0.18);
  --success: #15803d;
  --warning: #f59e0b;
  --error: #dc2626;
  --shadow-soft: 0 18px 45px rgba(24, 33, 45, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: radial-gradient(circle at 15% 15%, rgba(255, 214, 170, 0.55), transparent 45%),
    radial-gradient(circle at 85% 0%, rgba(123, 173, 210, 0.35), transparent 50%),
    linear-gradient(140deg, #f9f4eb, #eef2f6 55%, #f5efe4);
  color: var(--text);
  padding: 2rem clamp(1rem, 4vw, 4rem) 4rem;
}

body[data-page='host'],
body[data-page='player'],
body[data-page='podium'],
body[data-page='cards-host'],
body[data-page='cards-player'],
body[data-page='tictactoe-host'],
body[data-page='tictactoe-player'] {
  color-scheme: dark;
  --bg: #0d1117;
  --bg-strong: #0b0f14;
  --card: rgba(255, 255, 255, 0.05);
  --card-strong: rgba(12, 18, 26, 0.95);
  --border: rgba(255, 255, 255, 0.08);
  --text: #f4f6fb;
  --text-muted: rgba(255, 255, 255, 0.65);
  --accent: #f97316;
  --accent-muted: rgba(249, 115, 22, 0.25);
  --success: #22c55e;
  --warning: #facc15;
  --error: #ef4444;
  --shadow-soft: 0 18px 45px rgba(0, 0, 0, 0.35);
  background: radial-gradient(circle at 20% 20%, rgba(255, 255, 255, 0.08), transparent 45%),
    radial-gradient(circle at 80% 0%, rgba(249, 115, 22, 0.15), transparent 50%),
    var(--bg);
}

body[data-page='tictactoe-host'],
body[data-page='tictactoe-player'] {
  height: 100vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  padding: clamp(1rem, 2vw, 2rem);
}

body[data-page='host'] {
  padding: clamp(1rem, 2vh, 1.25rem) clamp(0.9rem, 2vw, 1.5rem) 2rem;
}

body[data-page='player'] {
  padding-bottom: clamp(2rem, 4vh, 3rem);
}

h1,
h2,
h3,
h4,
h5,
h6 {
  margin: 0 0 0.5rem 0;
  font-weight: 600;
  font-family: var(--font-display);
  letter-spacing: -0.01em;
}

p {
  margin: 0 0 0.75rem 0;
}

.masthead {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 2rem;
  flex-wrap: wrap;
  margin-bottom: 2rem;
}

.platform-head h1 {
  font-size: clamp(2.1rem, 4vw, 3.1rem);
}

.platform-grid .card {
  min-height: 240px;
}

body[data-page='host'] .masthead {
  margin-bottom: 1rem;
  gap: 0.75rem;
  align-items: center;
}

body[data-page='host'] .masthead h1 {
  font-size: clamp(1.35rem, 2vw, 1.6rem);
  margin-bottom: 0.1rem;
}

body[data-page='host'] .masthead .muted {
  margin: 0;
}

body[data-page='host'] .user-chip,
body[data-page='player'] .user-chip {
  background: transparent;
  border: none;
  padding: 0;
}

.cta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 1rem;
}

.button-link {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  padding: 0.5rem 1.25rem;
  text-decoration: none;
  font-weight: 600;
  color: var(--text);
  background: var(--card-strong);
  box-shadow: var(--shadow-soft);
}

.button-link.ghost {
  background: transparent;
  box-shadow: none;
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.5rem 0.75rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--card);
}

.stat-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 1rem;
  padding: 1.25rem;
  max-width: 320px;
}

.stat-card ul {
  margin: 0;
  padding-left: 1.25rem;
  font-size: 0.9rem;
}

.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.5rem;
}

.host-layout {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(260px, 1fr);
  gap: 1.5rem;
  align-items: start;
}

.host-columns {
  display: flex;
  gap: 1.5rem;
  align-items: flex-start;
}

.host-column {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  flex: 1 1 25%;
  min-width: 260px;
}

.host-center {
  flex: 2 1 60%;
  min-width: 420px;
  gap: 1.5rem;
}

.host-right {
  flex: 0 1 17.5%;
  position: sticky;
  top: 1.5rem;
}

.host-audio-panel {
  padding-top: 0.75rem;
  border-top: 1px solid var(--border);
}

.host-audio-embed {
  position: relative;
  width: 100%;
  border-radius: 0.75rem;
  overflow: hidden;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.04);
  padding: 1rem;
  min-height: 88px;
  display: grid;
  align-items: center;
}

.host-audio-embed audio {
  width: 100%;
}

.audio-cache-grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.audio-cache-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 0.75rem;
  padding: 0.75rem;
}

.audio-cache-card audio {
  width: 100%;
}

.button-group {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.button-group .is-active {
  background: var(--primary);
  color: #0a0a0a;
  border-color: var(--primary);
}

#host-share-column[data-collapsed='true'] {
  display: none;
}

.host-live__header {
  align-items: flex-start;
}

.host-live[data-review-phase='true'] .live-phase,
.host-live[data-review-phase='true'] #lobby-question,
.host-live[data-review-phase='true'] .timer-display,
.host-live[data-review-phase='true'] #host-audio {
  display: none;
}

.host-live[data-review-phase='true'] .live-actions {
  justify-content: flex-start;
}

.host-live[data-review-phase='true'] .live-actions button:not(#action-next) {
  display: none;
}

.live-phase__title {
  display: flex;
  align-items: baseline;
  gap: 0.35rem;
  margin: 0 0 0.2rem 0;
  font-size: 1.05rem;
  line-height: 1.2;
}

.live-phase__label {
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.8rem;
  color: rgba(255, 255, 255, 0.7);
}

.live-phase__state {
  font-weight: 600;
  font-size: 1.05rem;
}

.live-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  justify-content: flex-start;
}

body[data-page='host'] .live-actions {
  gap: 0.4rem;
}

#action-next {
  margin-left: auto;
}

.card-section {
  margin-top: 1.5rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

body[data-page='host'] .card-section {
  margin-top: 1rem;
  padding-top: 0.75rem;
}

.timer-display {
  margin-top: 1rem;
}

body[data-page='host'] .timer-display {
  margin-top: 0.6rem;
}

.audio-indicator {
  margin-top: 0.5rem;
  padding: 0.6rem 0.85rem;
  border-radius: 0.75rem;
  background: rgba(255, 255, 255, 0.08);
  border: 1px dashed var(--border);
  font-size: 0.85rem;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.audio-indicator::before {
  content: '♪';
  font-weight: 600;
  color: var(--accent);
}

.audio-muted-note {
  font-size: 0.85rem;
  color: rgba(255, 255, 255, 0.6);
}

.sr-audio-frame {
  position: fixed;
  bottom: 0.5rem;
  right: 0.5rem;
  width: 1px;
  height: 1px;
  overflow: hidden;
  z-index: 10;
}

.podium-panel {
  margin-top: 1.5rem;
}

.host-right {
  transition: opacity 250ms ease, transform 250ms ease;
}

.host-right[data-final-question='true'] {
  opacity: 0.4;
  transform: translateY(6px);
}

#live-scoreboard[data-hidden='true'] {
  opacity: 0;
  transform: translateY(6px);
  pointer-events: none;
  max-height: 0;
  margin: 0;
  padding: 0;
  overflow: hidden;
  transition: opacity 200ms ease, transform 200ms ease, max-height 200ms ease, margin 200ms ease;
}

.final-question-note {
  display: none;
  margin-bottom: 0.75rem;
}

.host-right[data-final-question='true'] .final-question-note {
  display: block;
}

.full-width {
  width: 100%;
}

.share-panel-toggle {
  position: static;
  top: auto;
  left: auto;
  z-index: auto;
  background: transparent;
  border: 1px solid var(--border);
  backdrop-filter: none;
}

@media (max-width: 1100px) {
  .host-columns {
    flex-direction: column;
  }

  .host-center {
    min-width: 0;
  }

  .host-right {
    position: static;
  }

  .share-panel-toggle {
    position: static;
  }
}

@media (max-width: 960px) {
  .host-layout {
    grid-template-columns: 1fr;
  }

  .leaderboard-card {
    position: static;
  }
}

.quizzes-grid {
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
}

.editor-grid {
  grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
}

.quiz-workspace {
  display: grid;
  grid-template-columns: minmax(320px, 1fr) 1.5fr;
  gap: 1rem;
  align-items: start;
}

.quiz-studio {
  display: grid;
  grid-template-columns: minmax(280px, 0.9fr) minmax(0, 2.1fr);
  gap: 1.5rem;
  align-items: start;
}

.studio-rail {
  position: static;
}

.studio-main {
  min-width: 0;
}

.answer-tools {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.answer-summary {
  margin-bottom: 0;
}

#studio-questions,
#studio-answers {
  scroll-margin-top: 2rem;
}

.quiz-editor-shell,
.answer-editor-shell {
  gap: 1rem;
}

.split-panel,
.answer-editor-grid,
.responsive-grid.two-columns {
  display: grid;
  gap: 1rem;
  grid-template-columns: minmax(320px, 0.9fr) minmax(360px, 1.1fr);
  align-items: start;
}

.split-panel article,
.answer-editor-grid article {
  height: 100%;
}

@media (max-width: 960px) {
  .split-panel,
  .answer-editor-grid,
  .responsive-grid.two-columns {
    grid-template-columns: 1fr;
  }
}

.workspace-column {
  gap: 1rem;
}

@media (max-width: 1024px) {
  .quiz-workspace {
    grid-template-columns: 1fr;
  }

  .quiz-studio {
    grid-template-columns: 1fr;
  }

  .studio-rail {
    position: static;
  }
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 1rem;
  padding: 1.5rem;
  backdrop-filter: blur(10px);
  box-shadow: var(--shadow-soft);
}

@keyframes riseIn {
  0% {
    opacity: 0;
    transform: translateY(12px) scale(0.98);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

body[data-page='platform'] .card,
body[data-page='dashboard'] .card,
body[data-page='quizzes'] .card {
  animation: riseIn 0.5s ease both;
}

body[data-page='platform'] .platform-grid .card:nth-child(1) {
  animation-delay: 0.05s;
}

body[data-page='platform'] .platform-grid .card:nth-child(2) {
  animation-delay: 0.1s;
}

body[data-page='platform'] .platform-grid .card:nth-child(3) {
  animation-delay: 0.15s;
}

@media (prefers-reduced-motion: reduce) {
  body[data-page='platform'] .card,
  body[data-page='dashboard'] .card,
  body[data-page='quizzes'] .card {
    animation: none;
  }
}

body[data-page='host'] .card {
  padding: 1.15rem;
  border-radius: 0.9rem;
}

.card hr {
  border: none;
  border-top: 1px solid var(--border);
}

.card__header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

body[data-page='host'] .card__header {
  margin-bottom: 0.65rem;
}

.stack {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.stack.small {
  gap: 0.4rem;
}

label {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  font-size: 0.9rem;
}

label.checkbox {
  flex-direction: row;
  align-items: center;
  gap: 0.5rem;
}

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

input,
textarea,
select {
  padding: 0.65rem 0.85rem;
  border-radius: 0.75rem;
  border: 1px solid var(--border);
  background: var(--card-strong);
  color: var(--text);
}

input[type='checkbox'] {
  padding: 0;
  width: 1.1rem;
  height: 1.1rem;
  min-width: 1.1rem;
  accent-color: var(--accent);
}

select {
  appearance: none;
  background-image: linear-gradient(135deg, rgba(255, 255, 255, 0.15), transparent);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.06);
  cursor: pointer;
}

select:focus {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

select option {
  background: var(--card-strong);
  color: var(--text);
}

button {
  border: none;
  border-radius: 0.75rem;
  padding: 0.65rem 1.25rem;
  background: var(--accent);
  color: #111827;
  font-weight: 600;
  cursor: pointer;
  transition: transform 120ms ease, box-shadow 120ms ease;
}

button:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-soft);
}

button.ghost {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
}

button.primary {
  background: var(--accent);
  color: #111;
}

.small {
  font-size: 0.85rem;
}

.muted {
  color: var(--text-muted);
}

.shell-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.tabs {
  display: inline-flex;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.35rem;
  background: rgba(255, 255, 255, 0.05);
}

.tab {
  background: transparent;
  border-radius: 999px;
  padding-inline: 1.5rem;
  color: rgba(255, 255, 255, 0.7);
}

.tab.active {
  background: rgba(255, 255, 255, 0.15);
  color: var(--text);
}

.panel {
  display: none;
}

.panel.active {
  display: block;
}

.quiz-table {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.question-list {
  max-height: 420px;
  overflow-y: auto;
  margin-bottom: 1rem;
}

.quiz-row {
  border: 1px solid var(--border);
  border-radius: 0.9rem;
  padding: 1rem;
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  background: var(--card-strong);
}

.quiz-actions {
  display: flex;
  gap: 0.5rem;
  align-items: flex-start;
}

.question-card {
  border: 1px solid var(--border);
  border-radius: 0.75rem;
  padding: 1rem;
  margin-bottom: 0.75rem;
}

.question-card ul {
  list-style: none;
  padding: 0;
  margin: 0.5rem 0 0 0;
  display: grid;
  gap: 0.25rem;
}

.question-card li {
  padding: 0.35rem 0.5rem;
  border-radius: 0.5rem;
  background: rgba(24, 33, 45, 0.06);
}

.question-card li.correct {
  background: rgba(34, 197, 94, 0.25);
}

.choice-builder {
  border: 1px dashed var(--border);
  border-radius: 0.9rem;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.choice-rows {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.choice-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.choice-row input[type='text'] {
  flex: 1;
}

.choice-marker {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.85rem;
}

.choice-row .remove-choice {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
}

.form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

.form-actions button {
  flex: 0 0 auto;
}

.scoreboard {
  border: 1px solid var(--border);
  border-radius: 0.75rem;
  padding: 0.5rem;
  display: grid;
  gap: 0.35rem;
}

.inline-score {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.inline-score button {
  border: none;
  background: transparent;
  color: var(--error);
  font-size: 1.25rem;
  padding: 0;
  line-height: 1;
}

.inline-score button:hover {
  transform: scale(1.05);
  box-shadow: none;
}

.score-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(255, 255, 255, 0.04);
  padding: 0.35rem 0.75rem;
  border-radius: 0.5rem;
}

.question-live {
  border: 1px dashed var(--border);
  border-radius: 0.75rem;
  padding: 1rem;
}

body[data-page='host'] .question-live {
  padding: 0.8rem;
}

.question-image {
  margin: 0.5rem 0 0.75rem;
  text-align: center;
}

.question-image img {
  max-width: 100%;
  max-height: 320px;
  border-radius: 0.65rem;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
}

.question-choices {
  list-style: none;
  padding: 0;
  margin: 0.5rem 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.25rem 0.75rem;
}

.question-choice {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.35rem;
  align-items: flex-start;
}

.question-choice__index {
  color: rgba(255, 255, 255, 0.65);
  font-weight: 700;
}

.question-choice__text {
  word-break: break-word;
}

.lobby-meta {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.share-link {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.share-link__row {
  display: flex;
  gap: 0.5rem;
}

.share-link__row input {
  flex: 1;
}

.inline-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.lobby-layout {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1rem;
}

.leaderboard-card {
  position: sticky;
  top: 1.5rem;
}

.host-grid {
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
}

.share-link-row {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.share-link-row input {
  flex: 1;
}

.qr-template {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  border: 1px dashed var(--border);
  border-radius: 1rem;
  padding: 0.75rem;
  background: var(--card-bg-alt, #f8fafc);
}

.qr-template__code {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  justify-content: center;
  align-items: center;
}

.qr-card {
  background: white;
  border-radius: 1.25rem;
  padding: 1.2rem;
  width: min(280px, 100%);
  margin: 0 auto;
  box-shadow: 0 20px 45px rgba(15, 23, 42, 0.2), inset 0 0 0 1px rgba(15, 23, 42, 0.05);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  color: #0f172a;
}

.qr-panel {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 160px;
  height: 160px;
  border-radius: 1rem;
  background: #fff;
}

.qr-panel canvas,
.qr-panel img {
  width: 100% !important;
  height: 100% !important;
}

.qr-placeholder {
  text-align: center;
  margin: 0;
  color: #475569;
}

.qr-template__details {
  flex: 1 1 200px;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  justify-content: center;
}

.qr-template__label {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.qr-template__value {
  font-size: 2.25rem;
  font-weight: 700;
  letter-spacing: 0.1em;
}

.qr-template__url {
  font-family: 'JetBrains Mono', 'SFMono-Regular', Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', monospace;
  word-break: break-all;
}

.player-grid {
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
}

.player-shell {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  min-height: 60vh;
}

body[data-page='player'][data-player-state='live'] .player-masthead {
  display: none;
}

.player-stage {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  min-height: 60vh;
}

.player-stage__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.player-stage__meta {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.player-countdown {
  font-weight: 600;
}

.player-question {
  margin: 0;
  padding: 0.5rem 0;
}

.player-question__prompt {
  margin: 0;
  font-size: clamp(1.35rem, 3vw, 2rem);
  line-height: 1.4;
}

.host-question__prompt {
  margin: 0 0 0.25rem;
  font-size: clamp(1.35rem, 2.6vw, 1.8rem);
  line-height: 1.45;
}

.player-response {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  flex: 1;
}

.choice-grid--full {
  flex: 1;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  grid-auto-rows: minmax(72px, 18vh);
  align-content: stretch;
}

.choice-grid--full button {
  min-height: clamp(72px, 14vh, 200px);
  font-size: clamp(1.15rem, 3.2vw, 1.5rem);
  border-radius: 0.9rem;
  padding: clamp(0.9rem, 3vw, 1.1rem);
}

@media (max-width: 640px) {
  .choice-grid--full {
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 0.65rem;
  }
}

.player-text {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.player-text__form {
  display: grid;
  grid-template-columns: 1fr minmax(140px, auto);
  gap: 0.75rem;
  align-items: stretch;
}

.player-text__form input {
  height: auto;
  padding: 0.9rem 0.85rem;
  font-size: 1rem;
}

.player-text__form button {
  padding: 0.9rem 1rem;
}

.player-text--confirm-only .player-text__form {
  grid-template-columns: 1fr;
}

.player-text--confirm-only .player-text__form input {
  display: none;
}

@media (max-width: 640px) {
  .player-text__form {
    grid-template-columns: 1fr;
  }
}

.player-text__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  justify-content: space-between;
}

.choice--toggle[aria-pressed='true'],
.choice--selected {
  background: linear-gradient(135deg, #5cb3ff, #b86bff);
  color: #fff;
  border-color: transparent;
  box-shadow: 0 0.5rem 1.5rem rgba(0, 0, 0, 0.2);
}

.player-feedback {
  margin-top: 0.5rem;
}

.player-audio {
  margin-top: 0.25rem;
}

.podium-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin-top: 1rem;
}

.podium-list .score-row {
  font-size: 1.25rem;
}

.submission-list {
  display: grid;
  gap: 0.5rem;
}

.submission-list table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.submission-list th,
.submission-list td {
  padding: 0.4rem 0.5rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

.submission-list tbody tr:nth-child(even) {
  background: rgba(255, 255, 255, 0.03);
}

.submission-list .verdict-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.submission-list .verdict-buttons button {
  flex: 1 1 30%;
  min-width: 4.5rem;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--border);
  border-radius: 0.65rem;
  padding: 0.4rem 0.5rem;
  color: var(--text);
  font-size: 0.85rem;
  white-space: nowrap;
  transition: background 150ms ease, color 150ms ease, box-shadow 150ms ease;
}

.submission-list .verdict-buttons button[data-selected='true'] {
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.2);
}

.submission-list .verdict-buttons button[data-selected='true'][data-verdict='correct'] {
  background: var(--success);
  border-color: var(--success);
  color: #041706;
}

.submission-list .verdict-buttons button[data-selected='true'][data-verdict='half'] {
  background: var(--warning);
  border-color: var(--warning);
  color: #2a1a04;
}

.submission-list .verdict-buttons button[data-selected='true'][data-verdict='none'] {
  background: var(--error);
  border-color: var(--error);
  color: #fff7f7;
}

.submission {
  border: 1px solid var(--border);
  border-radius: 0.75rem;
  padding: 0.75rem;
}

.submission-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.inline-form {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: flex-end;
}

.choices-grid,
.choice-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 0.75rem;
  margin-top: 1rem;
}

.choice,
.choice-grid button {
  background: rgba(255, 255, 255, 0.15);
  color: var(--text);
  border: 1px solid transparent;
  transition: transform 0.12s ease, box-shadow 0.2s ease, opacity 0.2s ease;
}

.choice:disabled {
  opacity: 0.35;
}

.choice-grid button.choice-pressed {
  animation: choicePulse 0.35s ease;
  transform: scale(0.98);
  box-shadow: 0 0 0 8px var(--accent-muted);
}

.choice-grid button.answer-sent,
.choice-grid[data-answered='true'] button,
#player-choices input.answer-sent,
#player-text-form button.answer-sent,
#player-text-form input.answer-sent {
  opacity: 0.35;
  cursor: not-allowed;
  background: rgba(255, 255, 255, 0.08);
  border-color: var(--border);
}

@keyframes choicePulse {
  0% {
    transform: scale(0.98);
  }
  60% {
    transform: scale(1.02);
  }
  100% {
    transform: scale(1);
  }
}

#player-answer-feedback {
  min-height: 1.25rem;
  color: var(--accent);
}

#player-answer-feedback[data-variant='success'] {
  color: var(--success);
}

#player-answer-feedback.answer-feedback--animate {
  animation: answerPulse 0.9s ease;
}

@keyframes answerPulse {
  0% {
    opacity: 0.2;
    transform: translateY(-2px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

.pill {
  border-radius: 999px;
  padding: 0.2rem 0.8rem;
  border: 1px solid var(--border);
  font-size: 0.85rem;
  text-transform: capitalize;
}

#host-audio iframe,
#player-audio iframe {
  width: 100%;
  min-height: 200px;
  border: none;
  border-radius: 0.75rem;
  margin-top: 0.5rem;
}

#host-audio .sr-audio-frame iframe,
#player-audio .sr-audio-frame iframe {
  min-height: 0;
}

.audio-permission {
  margin-top: 0.5rem;
  padding: 0.75rem;
  border: 1px dashed var(--border);
  border-radius: 0.75rem;
  background: rgba(255, 255, 255, 0.04);
}

.audio-permission button {
  margin-top: 0.5rem;
}

.answer-key {
  margin-top: 1rem;
  padding: 0.75rem;
  border: 1px dashed var(--border);
  border-radius: 0.75rem;
  background: rgba(255, 255, 255, 0.03);
}

body[data-page='host'] .answer-key {
  margin-top: 0.75rem;
  padding: 0.6rem 0.75rem;
}

.answer-key__row {
  display: flex;
  align-items: baseline;
  gap: 0.35rem;
  margin: 0;
}

.answer-key__label {
  font-weight: 600;
}

#timer-track {
  --timer-color: var(--accent);
  width: 100%;
  border-radius: 999px;
  border: 1px solid var(--timer-color);
  height: 0.65rem;
  overflow: hidden;
  margin-top: 0.25rem;
  background: rgba(255, 255, 255, 0.05);
  transition: border-color 200ms ease;
}

#timer-fill {
  height: 100%;
  width: 0%;
  border-radius: inherit;
  background: var(--timer-color);
  transition: width 0.3s ease, background 0.3s ease;
}

.points-display {
  margin-top: 0.75rem;
}

.points-display__header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem;
}

#points-display p {
  margin: 0;
}

#points-track {
  --points-color: var(--accent);
  width: 100%;
  border-radius: 999px;
  border: 1px solid var(--points-color);
  height: 0.65rem;
  overflow: hidden;
  margin-top: 0.25rem;
  background: rgba(255, 255, 255, 0.05);
  transition: border-color 200ms ease;
}

#points-fill {
  height: 100%;
  width: 0%;
  border-radius: inherit;
  background: var(--points-color);
  transition: width 0.3s ease, background 0.3s ease;
}

#app-status {
  min-height: 1.5rem;
}

#app-status.success {
  color: var(--success);
}

#app-status.error {
  color: var(--error);
}

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  z-index: 2000;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.modal-overlay.visible {
  opacity: 1;
}

.modal-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 0.9rem;
  padding: 1.5rem;
  max-width: min(520px, 92vw);
  width: 100%;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
  position: relative;
}

.modal-card__close {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  border: none;
  background: transparent;
  color: var(--text);
  font-size: 1.25rem;
  cursor: pointer;
}

.modal-card p {
  margin-bottom: 0.5rem;
}

.podium-page {
  background: radial-gradient(circle at 18% 18%, rgba(59, 130, 246, 0.14), transparent 26%),
    radial-gradient(circle at 82% 14%, rgba(34, 211, 238, 0.12), transparent 24%),
    radial-gradient(circle at 70% 72%, rgba(147, 51, 234, 0.15), transparent 28%),
    #0a0f1e;
  color: var(--text);
}

.podium-shell {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
  align-items: stretch;
  transition: grid-template-columns 650ms ease;
}

.podium-shell.split-view {
  grid-template-columns: minmax(380px, 1.05fr) minmax(320px, 0.95fr);
}

#leaderboard-panel {
  opacity: 0;
  transform: translateX(12px);
  transition: opacity 600ms ease, transform 600ms ease;
}

#leaderboard-panel[data-visible='true'] {
  opacity: 1;
  transform: translateX(0);
  animation: leaderboardReveal 1400ms ease;
}

.podium-ceremony {
  position: relative;
  overflow: hidden;
  padding: 1.5rem;
  border-radius: 1.25rem;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: linear-gradient(155deg, rgba(15, 23, 42, 0.92), rgba(11, 15, 30, 0.94));
  box-shadow: 0 15px 55px rgba(0, 0, 0, 0.35);
  min-height: 440px;
}

.podium-ceremony::before,
.podium-ceremony::after {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 24% 22%, rgba(79, 70, 229, 0.2), transparent 36%),
    radial-gradient(circle at 72% 12%, rgba(16, 185, 129, 0.18), transparent 30%),
    radial-gradient(circle at 62% 76%, rgba(59, 130, 246, 0.2), transparent 32%);
  filter: blur(2px);
  z-index: 1;
  opacity: 0.55;
}

.podium-ceremony::after {
  animation: aurora 16s linear infinite;
  mix-blend-mode: screen;
}

.podium-ceremony__header {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.podium-ceremony__header h2 {
  margin: 0.25rem 0;
}

.podium-flagline {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.podium-flagline span {
  width: 18px;
  height: 10px;
  border-radius: 3px;
  background: linear-gradient(135deg, #22c55e, #60a5fa);
  opacity: 0.8;
}

.podium-stage {
  position: relative;
  z-index: 2;
  margin-top: 2rem;
  padding: 2rem;
  border-radius: 1.25rem;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.04), rgba(0, 0, 0, 0.2));
  overflow: hidden;
}

.podium-stands {
  display: grid;
  grid-template-columns: repeat(3, minmax(160px, 1fr));
  gap: 1.25rem;
  align-items: end;
}

.podium-meta {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  margin-top: 1.25rem;
}

.podium-meta p {
  margin: 0;
}

.podium-stand {
  position: relative;
  text-align: center;
  transition: transform 850ms ease, opacity 650ms ease;
}

.podium-stand::before {
  content: '';
  position: absolute;
  inset: -8% 6% auto 6%;
  height: 210px;
  background: radial-gradient(circle at 50% 42%, rgba(59, 130, 246, 0.16), transparent 70%);
  opacity: 0;
  filter: blur(1px);
  transform: translateY(14px) scale(0.96);
  transition: opacity 900ms ease, transform 900ms ease, filter 900ms ease, background 400ms ease;
  pointer-events: none;
  z-index: 0;
}

.podium-stand[data-has-player='false'] .podium-block {
  opacity: 0.5;
}

.podium-stand[data-rank='1'] {
  order: 2;
}

.podium-stand[data-rank='2'] {
  order: 1;
}

.podium-stand[data-rank='3'] {
  order: 3;
}

.podium-block {
  position: relative;
  z-index: 1;
  border-radius: 1rem 1rem 0.85rem 0.85rem;
  padding: 1.5rem 1rem 1rem;
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.12), rgba(255, 255, 255, 0.04));
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.35);
  transform: translateY(32px);
  opacity: 0;
}

.podium-stand[data-rank='1'] .podium-block {
  height: 190px;
  background: linear-gradient(160deg, rgba(234, 179, 8, 0.22), rgba(255, 255, 255, 0.05));
}

.podium-stand[data-rank='2'] .podium-block {
  height: 150px;
  background: linear-gradient(160deg, rgba(148, 163, 184, 0.25), rgba(255, 255, 255, 0.05));
}

.podium-stand[data-rank='3'] .podium-block {
  height: 120px;
  background: linear-gradient(160deg, rgba(245, 158, 11, 0.25), rgba(255, 255, 255, 0.05));
}

.podium-name {
  font-size: 1.25rem;
  font-weight: 700;
  margin: 0.25rem 0;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 700ms ease, transform 700ms ease;
}

.podium-score {
  color: var(--muted);
  font-size: 0.95rem;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 700ms ease, transform 700ms ease;
}

.podium-medal {
  position: absolute;
  top: -0.75rem;
  left: 50%;
  transform: translateX(-50%) scale(0.9);
  z-index: 2;
  background: rgba(0, 0, 0, 0.45);
  border: 1px solid rgba(255, 255, 255, 0.15);
  padding: 0.35rem 0.6rem;
  border-radius: 999px;
  font-size: 1.2rem;
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.35);
}

.podium-flare {
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 50% 32%, rgba(59, 130, 246, 0.18), transparent 48%),
    radial-gradient(circle at 24% 62%, rgba(16, 185, 129, 0.14), transparent 42%),
    radial-gradient(circle at 78% 62%, rgba(94, 234, 212, 0.18), transparent 42%);
  opacity: 0;
  transition: opacity 400ms ease;
}

.podium-ceremony[data-stage^='reveal'] .podium-flare,
.podium-ceremony[data-stage='encore'] .podium-flare {
  opacity: 0.75;
  animation: flarePulse 7s ease-in-out infinite;
}

.podium-ceremony[data-stage='encore'] .podium-flare {
  animation: flarePulse 6s ease-in-out infinite, hueSweep 18s linear infinite;
}

.podium-ceremony[data-stage='reveal-3'] .podium-stand[data-rank='3'] .podium-block,
.podium-ceremony[data-stage='reveal-2'] .podium-stand[data-rank='3'] .podium-block,
.podium-ceremony[data-stage='reveal-1'] .podium-stand[data-rank='3'] .podium-block,
.podium-ceremony[data-stage='encore'] .podium-stand[data-rank='3'] .podium-block,
.podium-ceremony[data-stage='settled'] .podium-stand[data-rank='3'] .podium-block {
  transform: translateY(0);
  opacity: 1;
  animation: standRise 5s ease forwards;
}

.podium-ceremony[data-stage='reveal-2'] .podium-stand[data-rank='2'] .podium-block,
.podium-ceremony[data-stage='reveal-1'] .podium-stand[data-rank='2'] .podium-block,
.podium-ceremony[data-stage='encore'] .podium-stand[data-rank='2'] .podium-block,
.podium-ceremony[data-stage='settled'] .podium-stand[data-rank='2'] .podium-block {
  transform: translateY(0);
  opacity: 1;
  animation: standRise 5s ease forwards;
}

.podium-ceremony[data-stage='reveal-1'] .podium-stand[data-rank='1'] .podium-block,
.podium-ceremony[data-stage='encore'] .podium-stand[data-rank='1'] .podium-block,
.podium-ceremony[data-stage='settled'] .podium-stand[data-rank='1'] .podium-block {
  transform: translateY(0);
  opacity: 1;
  animation: standRise 5s ease forwards;
}

.podium-ceremony[data-stage='reveal-3'] .podium-stand[data-rank='3'] .podium-name,
.podium-ceremony[data-stage='reveal-3'] .podium-stand[data-rank='3'] .podium-score,
.podium-ceremony[data-stage='reveal-2'] .podium-stand[data-rank='3'] .podium-name,
.podium-ceremony[data-stage='reveal-2'] .podium-stand[data-rank='3'] .podium-score,
.podium-ceremony[data-stage='reveal-1'] .podium-stand[data-rank='3'] .podium-name,
.podium-ceremony[data-stage='reveal-1'] .podium-stand[data-rank='3'] .podium-score,
.podium-ceremony[data-stage='encore'] .podium-stand[data-rank='3'] .podium-name,
.podium-ceremony[data-stage='encore'] .podium-stand[data-rank='3'] .podium-score,
.podium-ceremony[data-stage='settled'] .podium-stand[data-rank='3'] .podium-name,
.podium-ceremony[data-stage='settled'] .podium-stand[data-rank='3'] .podium-score {
  opacity: 1;
  transform: translateY(0);
  transition-delay: 450ms;
}

.podium-ceremony[data-stage='reveal-2'] .podium-stand[data-rank='2'] .podium-name,
.podium-ceremony[data-stage='reveal-2'] .podium-stand[data-rank='2'] .podium-score,
.podium-ceremony[data-stage='reveal-1'] .podium-stand[data-rank='2'] .podium-name,
.podium-ceremony[data-stage='reveal-1'] .podium-stand[data-rank='2'] .podium-score,
.podium-ceremony[data-stage='encore'] .podium-stand[data-rank='2'] .podium-name,
.podium-ceremony[data-stage='encore'] .podium-stand[data-rank='2'] .podium-score,
.podium-ceremony[data-stage='settled'] .podium-stand[data-rank='2'] .podium-name,
.podium-ceremony[data-stage='settled'] .podium-stand[data-rank='2'] .podium-score {
  opacity: 1;
  transform: translateY(0);
  transition-delay: 450ms;
}

.podium-ceremony[data-stage='reveal-1'] .podium-stand[data-rank='1'] .podium-name,
.podium-ceremony[data-stage='reveal-1'] .podium-stand[data-rank='1'] .podium-score,
.podium-ceremony[data-stage='encore'] .podium-stand[data-rank='1'] .podium-name,
.podium-ceremony[data-stage='encore'] .podium-stand[data-rank='1'] .podium-score,
.podium-ceremony[data-stage='settled'] .podium-stand[data-rank='1'] .podium-name,
.podium-ceremony[data-stage='settled'] .podium-stand[data-rank='1'] .podium-score {
  opacity: 1;
  transform: translateY(0);
  transition-delay: 450ms;
}

.podium-ceremony[data-stage^='reveal'] .podium-stand::before,
.podium-ceremony[data-stage='encore'] .podium-stand::before,
.podium-ceremony[data-stage='settled'] .podium-stand::before {
  opacity: 0.35;
  filter: blur(0.5px);
  transform: translateY(0) scale(1);
  background: radial-gradient(circle at 50% 44%, rgba(59, 130, 246, 0.2), transparent 70%);
}

.podium-ceremony[data-stage='encore'] .podium-block {
  animation: podiumGlow 5.5s ease-in-out infinite alternate;
}

.podium-ceremony[data-stage='encore'] .podium-medal {
  animation: shimmer 3.5s ease-in-out infinite;
}

.podium-ceremony[data-stage='settled'] .podium-block {
  transform: translateY(0);
  opacity: 1;
}

.podium-celebration {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}

.podium-sparkle {
  position: absolute;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.9);
  filter: blur(0.5px);
  animation: sparkle 2.5s ease-in-out infinite;
}

.podium-sparkle:nth-child(2) {
  animation-delay: 0.4s;
}

.podium-sparkle:nth-child(3) {
  animation-delay: 0.8s;
}

.podium-sparkle:nth-child(4) {
  animation-delay: 1.2s;
}

.podium-sparkle:nth-child(5) {
  animation-delay: 1.6s;
}

.podium-sparkle:nth-child(6) {
  animation-delay: 2s;
}

.leaderboard-card {
  background: rgba(13, 17, 23, 0.8);
  border-radius: 1.1rem;
  border: 1px solid rgba(255, 255, 255, 0.06);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.35);
}

.leaderboard-rows {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  margin-top: 1rem;
}

.leaderboard-row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 0.75rem;
  align-items: center;
  padding: 0.75rem 0.85rem;
  border-radius: 0.9rem;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.07);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
  opacity: 0;
  transform: translateY(12px);
  animation: leaderboardRise 900ms ease forwards;
  animation-delay: calc(var(--rank, 0) * 70ms);
  animation-play-state: paused;
}

#leaderboard-panel[data-visible='true'] .leaderboard-row {
  animation-play-state: running;
}

.leaderboard-rank {
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 0.75rem;
  display: grid;
  place-items: center;
  font-weight: 800;
  background: rgba(255, 255, 255, 0.08);
}

.leaderboard-row[data-rank='1'] .leaderboard-rank {
  background: linear-gradient(135deg, #fbbf24, #facc15);
  color: #1f2937;
}

.leaderboard-row[data-rank='2'] .leaderboard-rank {
  background: linear-gradient(135deg, #cbd5e1, #e2e8f0);
  color: #1f2937;
}

.leaderboard-row[data-rank='3'] .leaderboard-rank {
  background: linear-gradient(135deg, #fb923c, #f97316);
  color: #1f2937;
}

.leaderboard-name {
  font-weight: 700;
}

.leaderboard-score {
  font-variant-numeric: tabular-nums;
  color: var(--muted);
}

.podium-helper {
  color: var(--muted);
  margin-top: 0.5rem;
}

@keyframes aurora {
  0% {
    transform: translateX(0);
  }
  100% {
    transform: translateX(-10%);
  }
}

@keyframes standRise {
  0% {
    transform: translateY(32px) scale(0.98);
  }
  35% {
    transform: translateY(-8px) scale(1.02);
  }
  60% {
    transform: translateY(0) scale(1);
  }
  100% {
    transform: translateY(0) scale(1);
  }
}

@keyframes flarePulse {
  0% {
    opacity: 0.55;
  }
  45% {
    opacity: 1;
  }
  100% {
    opacity: 0.7;
  }
}

@keyframes hueSweep {
  0% {
    filter: hue-rotate(0deg);
  }
  100% {
    filter: hue-rotate(360deg);
  }
}

@keyframes shimmer {
  0% {
    filter: drop-shadow(0 0 2px rgba(255, 255, 255, 0.2));
  }
  50% {
    filter: drop-shadow(0 0 8px rgba(255, 255, 255, 0.35));
  }
  100% {
    filter: drop-shadow(0 0 3px rgba(255, 255, 255, 0.25));
  }
}

@keyframes podiumGlow {
  0% {
    box-shadow: 0 16px 40px rgba(255, 255, 255, 0.08), 0 0 0 2px rgba(255, 255, 255, 0.08);
    filter: saturate(1);
  }
  50% {
    box-shadow: 0 20px 55px rgba(250, 204, 21, 0.32), 0 0 0 3px rgba(250, 204, 21, 0.24);
    filter: saturate(1.2);
  }
  100% {
    box-shadow: 0 22px 64px rgba(94, 234, 212, 0.3), 0 0 0 3px rgba(94, 234, 212, 0.24);
    filter: saturate(1.25);
  }
}

@keyframes leaderboardReveal {
  0% {
    opacity: 0;
    transform: translateX(20px);
  }
  100% {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes leaderboardRise {
  0% {
    opacity: 0;
    transform: translateY(18px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes sparkle {
  0% {
    opacity: 0;
    transform: translateY(20px) scale(0.6);
  }
  30% {
    opacity: 1;
  }
  70% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform: translateY(-30px) scale(1.1);
  }
}

@media (max-width: 720px) {
  body {
    padding: 1rem;
  }
  .podium-shell,
  .podium-shell.split-view {
    grid-template-columns: 1fr;
  }
  .inline-form label,
  .inline-form button {
    flex: 1 1 100%;
  }
}

.pill {
  padding: 6px 12px;
  border-radius: 999px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-size: 12px;
  border: 1px solid #2a2a2a;
}

.pill.success {
  background: #0c3b1a;
  color: #6af07a;
  border-color: #1a5d2d;
}

.pill.error {
  background: #3b0c0c;
  color: #ff7b7b;
  border-color: #5d1a1a;
}

.pill.neutral {
  background: #1e1e1e;
  color: #cfcfcf;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
}

.summary-label {
  color: #8c8c8c;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-size: 12px;
  margin-bottom: 4px;
}

.summary-value {
  font-size: 26px;
  font-weight: 800;
}

.test-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 12px;
}

.test-card {
  border: 1px solid #1f1f1f;
  border-radius: 10px;
  padding: 12px;
  background: #0c0c0c;
}

.test-card h3 {
  margin: 0 0 4px;
}

.test-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  color: #9b9b9b;
}

.test-detail {
  margin-top: 8px;
  white-space: pre-wrap;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, Courier, monospace;
  background: #0b0b0b;
  padding: 8px;
  border-radius: 8px;
  border: 1px solid #1a1a1a;
}

.history-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 10px;
}

.history-item {
  border: 1px solid #1e1e1e;
  padding: 10px;
  border-radius: 10px;
  background: #0d0d0d;
}

.history-item strong {
  display: block;
  margin-bottom: 4px;
}


.audio-prep-overlay {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(6px);
  z-index: 20;
}

.audio-prep-overlay[hidden] {
  display: none;
}

.audio-prep-content {
  width: min(480px, 100%);
  text-align: center;
  padding: 32px 40px;
  border-radius: 16px;
  background: rgba(15, 15, 15, 0.85);
  border: 1px solid #1f1f1f;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.45);
}

.audio-prep-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
  margin-top: 12px;
}

.audio-prep-spinner {
  width: 64px;
  height: 64px;
  border-radius: 999px;
  margin: 0 auto 16px;
  border: 6px solid rgba(255, 255, 255, 0.15);
  border-top-color: #10b981;
  animation: audio-prep-spin 1s linear infinite;
}

@keyframes audio-prep-spin {
  to {
    transform: rotate(360deg);
  }
}

.audio-cache-row {
  border: 1px solid #1c1c1c;
  padding: 12px;
  border-radius: 10px;
  background: #0d0d0d;
}

.log-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.log-row {
  width: 100%;
  text-align: left;
  border: 1px solid var(--border);
  border-radius: 0.75rem;
  padding: 0.75rem 0.85rem;
  background: transparent;
  color: inherit;
  cursor: pointer;
  transition: border-color 150ms ease, background-color 150ms ease;
}

.log-row:hover,
.log-row:focus-visible {
  border-color: var(--primary);
  background: rgba(255, 255, 255, 0.04);
  outline: none;
}

.log-row.active {
  border-color: var(--primary);
  background: rgba(255, 255, 255, 0.06);
}

.log-row small {
  color: var(--muted);
}

.log-output {
  white-space: pre-wrap;
  font-family: 'SFMono-Regular', 'JetBrains Mono', monospace;
  background: #0c0c0c;
  border: 1px solid var(--border);
  border-radius: 0.75rem;
  padding: 0.85rem;
  max-height: 360px;
  overflow: auto;
}

.hidden {
  display: none;
}

[hidden] {
  display: none !important;
}

#debug-content {
  max-height: 360px;
  overflow: auto;
  background: #0a0a0a;
  border-radius: 8px;
  padding: 12px;
  border: 1px solid #1a1a1a;
}

.cards-layout {
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 24px;
}

.cards-host-layout {
  grid-template-columns: minmax(0, 1fr) minmax(220px, 25%);
  align-items: start;
}

.cards-host-layout #cards-host-lobby {
  grid-column: 1;
}

.cards-host-layout #cards-host-round {
  grid-column: 1;
}

.cards-host-layout #cards-host-scoreboard {
  grid-column: 2;
  grid-row: 1;
  align-self: start;
}

body.cards-player-live .cards-player-layout {
  grid-template-columns: minmax(0, 1fr);
}

.cards-black {
  font-size: 1.1rem;
  font-weight: 600;
}

.cards-hand {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
}

.card-choice {
  text-align: left;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(15, 23, 42, 0.6);
  color: inherit;
  cursor: pointer;
  transition: border-color 0.2s ease, transform 0.2s ease;
}

.card-choice:hover:not(:disabled) {
  border-color: var(--primary);
  transform: translateY(-1px);
}

.card-choice.selected {
  border-color: var(--primary);
  background: rgba(37, 99, 235, 0.2);
}

.card-choice:disabled {
  cursor: not-allowed;
  opacity: 0.6;
}

.cards-submissions {
  display: grid;
  gap: 12px;
}

.cards-submission {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 14px;
  background: rgba(15, 23, 42, 0.45);
}

.cards-fill {
  color: #38bdf8;
  font-weight: 600;
}

@media (max-width: 900px) {
  .cards-host-layout {
    grid-template-columns: minmax(0, 1fr);
  }

  .cards-host-layout #cards-host-lobby {
    grid-column: auto;
  }

  .cards-host-layout #cards-host-round,
  .cards-host-layout #cards-host-scoreboard {
    grid-column: auto;
    grid-row: auto;
  }
}

.ttt-layout {
  grid-template-columns: minmax(220px, 30%) minmax(0, 1fr);
  gap: 24px;
  align-items: start;
  flex: 1;
  min-height: 0;
  height: 100%;
  overflow: hidden;
}

.ttt-layout--focus {
  grid-template-columns: minmax(0, 1fr);
}

.ttt-lobby {
  max-height: 100%;
  overflow: auto;
}

.ttt-board-card {
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  gap: 0;
  padding-bottom: 0.75rem;
}

.ttt-board-card .card__header {
  margin-bottom: 0.35rem;
}

.ttt-board-column .card__header {
  margin-bottom: 0;
}

.ttt-board-card .stack.small {
  gap: 0.35rem;
}

.ttt-toggle-lobby {
  padding: 0.4rem 0.9rem;
  font-size: 0.85rem;
  border-radius: 999px;
}

.ttt-board-layout {
  display: grid;
  grid-template-columns: minmax(0, 15%) minmax(0, 70%) minmax(0, 15%);
  width: 100%;
  column-gap: clamp(1rem, 2vw, 1.75rem);
  align-items: stretch;
  min-height: 0;
  flex: 1;
}

.ttt-board-column {
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.ttt-board-column--info {
  justify-content: flex-start;
}

.ttt-board-column--center {
  justify-content: flex-start;
  align-items: center;
}

.ttt-board-wrapper {
  width: 100%;
  min-height: 0;
  display: flex;
  justify-content: center;
  align-items: flex-start;
}

.ttt-board-column--status {
  justify-content: flex-start;
  align-items: flex-end;
  gap: 0.75rem;
}

.ttt-board-actions {
  width: 100%;
  display: flex;
  justify-content: flex-end;
}

.ttt-board-column--status .stack.small {
  text-align: right;
}

@media (max-width: 960px) {
  .ttt-layout {
    grid-template-columns: minmax(0, 1fr);
  }

  .ttt-board-layout {
    grid-template-columns: minmax(0, 100%);
    row-gap: 1rem;
  }

  .ttt-board-column--status {
    align-items: flex-start;
  }

  .ttt-board-column--status .stack.small {
    text-align: left;
  }
}

@media (max-width: 720px) {
  .ttt-layout {
    gap: 1rem;
  }

  .ttt-board-card {
    overflow: visible;
  }

  .ttt-board-layout {
    row-gap: 0.75rem;
  }

  .ttt-board-column--center {
    align-items: stretch;
  }
}

.ttt-board {
  display: grid;
  grid-template-columns: repeat(var(--ttt-size, 3), minmax(0, 1fr));
  gap: 0;
  padding: 0;
  background: radial-gradient(circle at top, rgba(59, 130, 246, 0.08), transparent 55%),
    radial-gradient(circle at bottom, rgba(248, 113, 113, 0.08), transparent 55%),
    rgba(15, 23, 42, 0.5);
  border-radius: 0;
  border: 1px solid var(--border);
  box-shadow: 0 18px 36px rgba(2, 6, 23, 0.45);
  width: 100%;
  height: auto;
  max-width: 100%;
  max-height: 100%;
  aspect-ratio: 1 / 1;
  margin: 0 auto;
}

.ttt-board--inactive {
  opacity: 0.7;
}

.ttt-cell {
  aspect-ratio: 1 / 1;
  display: grid;
  place-items: center;
  min-width: 0;
  min-height: 0;
  border-radius: 0;
  border: 1px solid var(--border);
  background: linear-gradient(150deg, rgba(15, 23, 42, 0.8), rgba(15, 23, 42, 0.45));
  color: var(--text);
  font-size: var(--ttt-cell-font, clamp(0.6rem, calc(2.2rem - (var(--ttt-size, 3) * 0.06rem)), 2rem));
  font-weight: 700;
  line-height: 1;
  padding: 0;
  text-align: center;
  overflow: hidden;
  cursor: pointer;
  touch-action: manipulation;
  transition: border-color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.ttt-cell:disabled {
  cursor: not-allowed;
  opacity: 0.65;
}

.ttt-cell--filled:disabled {
  opacity: 0.9;
}

.ttt-cell:hover:not(:disabled) {
  border-color: var(--primary);
  transform: translateY(-1px);
  box-shadow: 0 8px 16px rgba(30, 64, 175, 0.25);
  background: linear-gradient(150deg, rgba(30, 41, 59, 0.9), rgba(15, 23, 42, 0.6));
}

.ttt-cell--filled {
  border-color: rgba(148, 163, 184, 0.6);
  background: linear-gradient(160deg, rgba(15, 23, 42, 0.95), rgba(30, 41, 59, 0.55));
  box-shadow: inset 0 0 0 1px rgba(148, 163, 184, 0.08);
}

.ttt-cell:focus-visible {
  outline: 2px solid rgba(56, 189, 248, 0.7);
  outline-offset: 2px;
}

.ttt-cell--x {
  color: #f87171;
  text-shadow: 0 0 12px rgba(248, 113, 113, 0.35);
}

.ttt-cell--o {
  color: #38bdf8;
  text-shadow: 0 0 12px rgba(56, 189, 248, 0.35);
}

.grid-two {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
}
