:root {
  color-scheme: dark;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #101418;
  color: #f8fafc;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(135deg, rgba(25, 135, 84, 0.15), transparent 32%),
    linear-gradient(315deg, rgba(220, 53, 69, 0.12), transparent 36%),
    linear-gradient(rgba(10, 14, 18, 0.78), rgba(10, 14, 18, 0.78)),
    url('./host-bg.jpg') center/cover no-repeat fixed;
}

button,
select,
input {
  font: inherit;
}

button,
.button-link {
  border: 0;
  border-radius: 8px;
  background: #f8c537;
  color: #111827;
  cursor: pointer;
  font-weight: 800;
  padding: 16px 22px;
  text-decoration: none;
}

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

.host-shell {
  min-height: 100vh;
  padding: 48px;
}

.screen {
  display: none;
}

.screen.active {
  display: grid;
  gap: 32px;
}

.eyebrow {
  color: #8bd3dd;
  font-size: 18px;
  font-weight: 800;
  letter-spacing: 0;
  margin: 0 0 8px;
  text-transform: uppercase;
}

h1 {
  font-size: clamp(48px, 8vw, 104px);
  line-height: 1;
  margin: 0;
}

h2 {
  font-size: 36px;
  margin: 0 0 12px;
}

.setup-row {
  align-items: end;
  display: grid;
  gap: 16px;
  grid-template-columns: 1fr auto auto;
  max-width: 920px;
}

.setup-check input {
  accent-color: #f8c537;
  height: 18px;
  width: 18px;
}

label {
  color: #cbd5e1;
  display: block;
  font-weight: 700;
  grid-column: 1 / -1;
}

.setup-check {
  align-items: center;
  display: flex;
  gap: 8px;
  grid-column: auto;
  min-height: 58px;
}

select {
  background: #1f2937;
  border: 1px solid #475569;
  border-radius: 8px;
  color: #f8fafc;
  min-height: 58px;
  padding: 0 16px;
}

.message {
  color: #fca5a5;
  font-size: 20px;
  min-height: 28px;
}

.pin-panel {
  border-bottom: 1px solid rgba(255, 255, 255, 0.16);
  padding-bottom: 28px;
}

.pin-panel p {
  color: #cbd5e1;
  font-size: 24px;
  font-weight: 800;
  margin: 0;
  text-transform: uppercase;
}

.pin-panel strong {
  color: #f8c537;
  display: block;
  font-size: clamp(78px, 16vw, 180px);
  line-height: 1;
}

.lobby-grid {
  align-items: start;
  display: grid;
  gap: 32px;
  grid-template-columns: 1fr 220px;
}

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

.player-chip {
  align-items: center;
  background: #1f2937;
  border: 1px solid #334155;
  border-radius: 8px;
  display: flex;
  font-size: 24px;
  font-weight: 800;
  justify-content: space-between;
  overflow: hidden;
  padding: 18px;
}

.player-chip span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.kick-btn {
  background: none;
  border: 0;
  border-radius: 4px;
  color: #f87171;
  cursor: pointer;
  flex-shrink: 0;
  font-size: 20px;
  font-weight: 400;
  line-height: 1;
  margin-left: 8px;
  min-height: auto;
  padding: 4px 8px;
}

.kick-btn:hover {
  background: rgba(248, 113, 113, 0.15);
  color: #fca5a5;
}

.question-meta {
  color: #cbd5e1;
  display: flex;
  font-size: 24px;
  font-weight: 800;
  justify-content: space-between;
}

.timer-track {
  background: #334155;
  border-radius: 999px;
  height: 22px;
  overflow: hidden;
  position: relative;
}

.timer-bar {
  background: #22c55e;
  height: 100%;
  transform-origin: left;
  transition: width 0.2s linear;
  width: 100%;
}

.timer-seconds {
  color: #f8fafc;
  font-size: 14px;
  font-weight: 800;
  left: 50%;
  position: absolute;
  text-shadow: 0 1px 3px rgba(0,0,0,0.6);
  top: 50%;
  transform: translate(-50%, -50%);
  z-index: 1;
}

.leaderboard {
  display: grid;
  gap: 10px;
  list-style-position: inside;
  margin: 0;
  max-width: 820px;
  padding: 0;
}

.leaderboard li {
  background: #1f2937;
  border: 1px solid #334155;
  border-radius: 8px;
  display: flex;
  font-size: 28px;
  font-weight: 800;
  justify-content: space-between;
  padding: 16px 20px;
}

@media (max-width: 720px) {
  .host-shell {
    padding: 24px;
  }

  .setup-row,
  .scheduled-play-form,
  .lobby-grid {
    grid-template-columns: 1fr;
  }

  .host-nav {
    flex-wrap: wrap;
  }
}

/* ── Nav tabs ─────────────────────────────── */
.host-nav {
  align-items: center;
  border-bottom: 2px solid #334155;
  display: flex;
  gap: 0;
  margin-bottom: 32px;
}

.nav-home {
  border: 1px solid #475569;
  border-radius: 8px;
  color: #f8c537;
  font-size: 16px;
  font-weight: 800;
  margin-right: 12px;
  padding: 10px 16px;
  text-decoration: none;
}

.nav-tab {
  background: none;
  border: 0;
  border-bottom: 3px solid transparent;
  border-radius: 0;
  color: #94a3b8;
  cursor: pointer;
  font-size: 18px;
  font-weight: 700;
  margin-bottom: -2px;
  padding: 14px 28px;
}

.nav-tab.active {
  border-bottom-color: #f8c537;
  color: #f8fafc;
}

/* ── Mode containers ──────────────────────── */
.mode {
  display: none;
}

.mode.active {
  display: block;
}

/* ── Text & secondary buttons ─────────────── */
.text-btn {
  background: none;
  border: 0;
  color: #8bd3dd;
  cursor: pointer;
  font-size: 16px;
  font-weight: 700;
  padding: 8px 14px;
}

.text-btn:hover {
  color: #f8fafc;
}

.text-btn.danger {
  color: #f87171;
}

.text-btn.danger:hover {
  color: #fca5a5;
}

.secondary-btn {
  background: #334155;
  border: 1px solid #475569;
  border-radius: 8px;
  color: #f8fafc;
  cursor: pointer;
  font-size: 16px;
  font-weight: 700;
  padding: 14px 20px;
}

.secondary-btn:hover {
  background: #475569;
}

/* ── Quiz list ────────────────────────────── */
.quiz-list {
  display: grid;
  gap: 12px;
  margin-top: 20px;
}

.quiz-list-item {
  align-items: center;
  background: #1f2937;
  border: 1px solid #334155;
  border-radius: 10px;
  display: flex;
  justify-content: space-between;
  padding: 18px 22px;
}

.quiz-list-item strong {
  font-size: 20px;
}

.quiz-meta {
  color: #94a3b8;
  display: block;
  font-size: 14px;
  margin-top: 4px;
}

.quiz-list-actions {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.featured-order {
  background: #111827;
  border: 1px solid #475569;
  border-radius: 6px;
  color: #f8fafc;
  min-height: 34px;
  padding: 0 8px;
  width: 74px;
}

/* ── Editor form ──────────────────────────── */
.editor-topbar {
  align-items: center;
  display: flex;
  gap: 16px;
  margin-bottom: 8px;
}

.editor-topbar .eyebrow {
  margin: 0;
}

.quiz-form {
  display: grid;
  gap: 20px;
  max-width: 820px;
}

.quiz-form > label,
.brand-form > label {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.quiz-form > label input,
.brand-form input,
.brand-form textarea {
  background: #1f2937;
  border: 1px solid #475569;
  border-radius: 8px;
  color: #f8fafc;
  min-height: 50px;
  padding: 0 14px;
}

.brand-form {
  display: grid;
  gap: 18px;
  max-width: 820px;
}

.brand-form textarea {
  line-height: 1.5;
  min-height: auto;
  padding: 12px 14px;
  resize: vertical;
}

.scheduled-play-panel {
  border-top: 1px solid #334155;
  display: grid;
  gap: 18px;
  margin-top: 28px;
  padding-top: 28px;
}

.scheduled-play-panel h2 {
  font-size: 30px;
}

.scheduled-play-form {
  display: grid;
  gap: 14px;
  grid-template-columns: 1fr 1fr;
  max-width: 860px;
}

.scheduled-play-form > label {
  color: #cbd5e1;
  display: grid;
  gap: 8px;
  font-weight: 700;
}

.scheduled-play-form input,
.scheduled-play-form select {
  background: #1f2937;
  border: 1px solid #475569;
  border-radius: 8px;
  color: #f8fafc;
  min-height: 50px;
  padding: 0 14px;
}

.scheduled-play-form button {
  align-self: end;
}

.scheduled-play-list {
  display: grid;
  gap: 10px;
  max-width: 860px;
}

.scheduled-play-item {
  align-items: center;
  background: #1f2937;
  border: 1px solid #334155;
  border-radius: 8px;
  display: flex;
  justify-content: space-between;
  gap: 14px;
  padding: 14px;
}

.history-list {
  display: grid;
  gap: 16px;
  max-width: 980px;
}

.history-card {
  background: #1f2937;
  border: 1px solid #334155;
  border-radius: 8px;
  display: grid;
  gap: 16px;
  padding: 18px;
}

.history-card-head {
  align-items: start;
  display: flex;
  gap: 18px;
  justify-content: space-between;
}

.history-card strong {
  display: block;
  font-size: 22px;
}

.history-export {
  align-items: end;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.history-export label {
  color: #cbd5e1;
  display: grid;
  gap: 6px;
  grid-column: auto;
}

.history-export select {
  min-height: 40px;
  padding: 0 10px;
}

.history-scoreboard {
  display: grid;
  gap: 8px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.history-scoreboard li {
  align-items: center;
  background: #111827;
  border: 1px solid #334155;
  border-radius: 8px;
  display: flex;
  justify-content: space-between;
  padding: 10px 12px;
}

.slug-row {
  display: grid;
  grid-template-columns: auto 1fr;
}

.slug-row span {
  align-items: center;
  background: #111827;
  border: 1px solid #475569;
  border-radius: 8px 0 0 8px;
  border-right: 0;
  color: #94a3b8;
  display: flex;
  font-weight: 800;
  min-height: 50px;
  padding: 0 14px;
}

.slug-row input {
  border-radius: 0 8px 8px 0;
}

.checkbox-row {
  align-items: center;
  flex-direction: row !important;
  gap: 10px !important;
}

.checkbox-row input {
  accent-color: #f8c537;
  min-height: auto;
  width: 18px;
}

.button-link.muted {
  background: #334155;
  border: 1px solid #475569;
  color: #f8fafc;
  display: inline-flex;
  align-items: center;
}

.questions-container {
  display: grid;
  gap: 20px;
}

.question-card {
  background: #1a1f2b;
  border: 1px solid #334155;
  border-radius: 12px;
  border-top: 4px solid #f8c537;
  display: grid;
  gap: 14px;
  padding: 24px 22px 22px;
  position: relative;
}

.question-card legend {
  color: #f8c537;
  font-size: 18px;
  font-weight: 800;
  padding: 0 8px;
}

.question-card .remove-question {
  font-size: 14px;
  padding: 4px 10px;
  position: absolute;
  right: 12px;
  top: 12px;
}

.question-card label {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.question-card input[type="text"],
.question-card input[type="number"] {
  background: #111827;
  border: 1px solid #475569;
  border-radius: 6px;
  color: #f8fafc;
  min-height: 42px;
  padding: 0 12px;
}

.question-card input[type="number"] {
  max-width: 100px;
}

.answers-grid {
  display: grid;
  gap: 8px;
}

.answer-row {
  align-items: center;
  background: #111827;
  border: 1px solid #334155;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  gap: 10px;
  padding: 8px 12px;
}

.answer-row:has(input:checked) {
  border-color: #22c55e;
  background: rgba(34, 197, 94, 0.08);
}

.answer-row input[type="radio"] {
  accent-color: #22c55e;
  min-height: auto;
  width: 18px;
  height: 18px;
}

.answer-letter {
  background: #334155;
  border-radius: 4px;
  color: #f8fafc;
  display: inline-grid;
  font-size: 14px;
  font-weight: 800;
  min-width: 28px;
  padding: 4px;
  place-items: center;
}

.answer-row:has(input:checked) .answer-letter {
  background: #22c55e;
  color: #111827;
}

.tf-letter {
  min-width: 32px !important;
  background: #475569 !important;
}

.answer-row:has(input:checked) .tf-letter {
  background: #22c55e !important;
}

.answer-text-fixed {
  color: #f8fafc;
  font-size: 18px;
  font-weight: 700;
  padding: 0 10px;
}

.answer-row input[type="text"] {
  flex: 1;
  min-height: 36px !important;
}

.answer-hint {
  color: #64748b;
  font-size: 13px;
  grid-column: 1 / -1;
  margin: 4px 0 0;
}

/* ── Color choice editor swatches ─────────── */
.color-choice-row {
  cursor: pointer;
  gap: 10px;
}

.color-swatch {
  border-radius: 6px;
  display: inline-block;
  height: 28px;
  min-width: 40px;
}

.color-swatch.color-red    { background: #dc2626; }
.color-swatch.color-green  { background: #16a34a; }
.color-swatch.color-blue   { background: #2563eb; }
.color-swatch.color-yellow { background: #eab308; }

.color-label {
  font-size: 16px;
  font-weight: 700;
}

.form-actions {
  display: flex;
  gap: 12px;
}

/* ── Auth screens ────────────────────────── */
.auth-screen {
  display: none;
  margin: 0 auto;
  max-width: 480px;
  padding-top: 60px;
}

.auth-screen.active {
  display: block;
}

.auth-home-link {
  border: 1px solid #475569;
  border-radius: 8px;
  color: #f8c537;
  display: inline-block;
  font-weight: 900;
  margin-bottom: 18px;
  padding: 10px 14px;
  text-decoration: none;
}

.auth-tabs {
  border-bottom: 2px solid #334155;
  display: flex;
  gap: 0;
  margin-bottom: 32px;
}

.auth-form {
  display: none;
  flex-direction: column;
  gap: 14px;
}

.auth-form.active {
  display: flex;
}

.auth-form input {
  background: #1f2937;
  border: 1px solid #475569;
  border-radius: 8px;
  color: #f8fafc;
  min-height: 50px;
  padding: 0 14px;
}

.auth-form h1 {
  margin-bottom: 10px;
}

/* ── App shell (hidden before auth) ─────── */
.app-shell {
  display: none;
}

.app-shell.active {
  display: block;
}

/* ── User bar ────────────────────────────── */
.user-bar {
  align-items: center;
  display: flex;
  font-size: 15px;
  justify-content: flex-end;
  margin-bottom: 16px;
}

.user-bar span {
  color: #94a3b8;
  margin-right: 12px;
}

/* ── Countdown overlay ───────────────────── */
.countdown-overlay {
  align-items: center;
  background: rgba(0, 0, 0, 0.82);
  display: none;
  height: 100%;
  justify-content: center;
  left: 0;
  position: fixed;
  top: 0;
  width: 100%;
  z-index: 1000;
}

.countdown-overlay.active {
  display: flex;
}

.countdown-number {
  animation: countdown-pop 0.9s ease-out forwards;
  color: #f8c537;
  font-size: clamp(120px, 30vw, 320px);
  font-weight: 900;
  line-height: 1;
  text-shadow: 0 0 80px rgba(248, 197, 55, 0.5);
}

@keyframes countdown-pop {
  0% {
    opacity: 0;
    transform: scale(0.3);
  }
  20% {
    opacity: 1;
    transform: scale(1.15);
  }
  40% {
    transform: scale(0.95);
  }
  60% {
    transform: scale(1.05);
  }
  100% {
    opacity: 0;
    transform: scale(1.8);
  }
}

/* ── Answer reveal animations ────────────── */
@keyframes reveal-pop {
  0% {
    opacity: 0;
    transform: scale(0.5) translateY(20px);
  }
  60% {
    transform: scale(1.05) translateY(0);
  }
  100% {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

@keyframes reveal-slide-up {
  0% {
    opacity: 0;
    transform: translateY(30px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes reveal-glow {
  0%, 100% {
    box-shadow: 0 0 0 rgba(248, 197, 55, 0);
  }
  50% {
    box-shadow: 0 0 40px rgba(248, 197, 55, 0.4), 0 0 80px rgba(248, 197, 55, 0.15);
  }
}

#correct-answer.reveal {
  animation: reveal-pop 0.5s ease-out forwards, reveal-glow 1.5s ease-in-out;
}

.leaderboard li.reveal {
  animation: reveal-slide-up 0.4s ease-out forwards;
  opacity: 0;
}

.leaderboard li.reveal:nth-child(1) { animation-delay: 0.1s; }
.leaderboard li.reveal:nth-child(2) { animation-delay: 0.2s; }
.leaderboard li.reveal:nth-child(3) { animation-delay: 0.3s; }
.leaderboard li.reveal:nth-child(4) { animation-delay: 0.4s; }
.leaderboard li.reveal:nth-child(5) { animation-delay: 0.5s; }

/* ── Subscription badges ────────────────── */
.sub-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 500;
  margin-left: 8px;
}
.sub-badge.active {
  background: #14532d;
  color: #86efac;
}
.sub-badge.expired {
  background: #7f1d1d;
  color: #fca5a5;
}
.sub-badge.none {
  background: #1e293b;
  color: #94a3b8;
}
.sub-btn {
  font-size: 0.8rem;
}
