:root {
  --bg: #0f1117;
  --surface: #1a1d27;
  --surface2: #232737;
  --border: #2e3347;
  --accent: #6c63ff;
  --accent2: #ff6584;
  --green: #43d98f;
  --yellow: #f5c542;
  --red: #ff5c5c;
  --text: #e8eaf6;
  --text2: #8b92b5;
  --radius: 14px;
  --shadow: 0 4px 32px rgba(0, 0, 0, 0.45);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Segoe UI', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

/* ── SETUP OVERLAY ── */
#setup-overlay {
  position: fixed;
  inset: 0;
  z-index: 10000;
  background: rgba(10, 10, 18, 0.97);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

#setup-overlay.hidden {
  display: none;
}

.setup-box {
  background: var(--surface);
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  padding: 2.4rem 2.8rem;
  width: min(560px, 96vw);
  box-shadow: 0 0 60px rgba(108, 99, 255, 0.2);
}

.setup-box h1 {
  font-size: 1.4rem;
  margin-bottom: 0.4rem;
}

.setup-box p {
  color: var(--text2);
  font-size: 0.9rem;
  line-height: 1.6;
  margin-bottom: 1.2rem;
}

.setup-step {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.9rem 1.1rem;
  margin-bottom: 0.7rem;
  font-size: 0.88rem;
}

.setup-step strong {
  color: var(--accent);
}

.setup-step code {
  display: block;
  background: var(--bg);
  border-radius: 6px;
  padding: 0.6rem 0.8rem;
  margin-top: 0.5rem;
  font-size: 0.82rem;
  color: var(--green);
  white-space: pre;
  overflow-x: auto;
  font-family: 'Consolas', monospace;
}

.setup-step a {
  color: var(--accent);
}

/* ── SCREENS ── */
.screen {
  display: none;
  min-height: 100vh;
}

.screen.active {
  display: flex;
  flex-direction: column;
}

/* ── HOME ── */
#screen-home {
  align-items: center;
  justify-content: center;
  background: radial-gradient(ellipse at 60% 30%, #1e1b4b 0%, #0f1117 70%);
  gap: 0;
}

.home-logo {
  font-size: 3.2rem;
  font-weight: 900;
  letter-spacing: -2px;
}

.home-logo span {
  color: var(--accent);
}

.home-tagline {
  color: var(--text2);
  margin: 0.4rem 0 2.8rem;
  font-size: 1.05rem;
}

.home-cards {
  display: flex;
  gap: 1.2rem;
  flex-wrap: wrap;
  justify-content: center;
}

.home-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2rem 2.4rem;
  width: 260px;
  cursor: pointer;
  transition: border-color 0.2s, transform 0.15s, box-shadow 0.2s;
  text-align: center;
}

.home-card:hover {
  border-color: var(--accent);
  transform: translateY(-3px);
  box-shadow: 0 8px 40px rgba(108, 99, 255, 0.2);
}

.home-card .card-icon {
  font-size: 2.6rem;
  margin-bottom: 0.8rem;
}

.home-card h2 {
  font-size: 1.2rem;
  margin-bottom: 0.4rem;
}

.home-card p {
  color: var(--text2);
  font-size: 0.87rem;
  line-height: 1.5;
}

/* ── FORMS ── */
#screen-create,
#screen-join {
  align-items: center;
  justify-content: center;
  background: radial-gradient(ellipse at 40% 60%, #1a1040 0%, #0f1117 70%);
}

.form-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2.4rem 2.8rem;
  width: min(420px, 92vw);
  box-shadow: var(--shadow);
}

.form-box h1 {
  font-size: 1.5rem;
  margin-bottom: 1.6rem;
}

.form-box label {
  display: block;
  font-size: 0.82rem;
  color: var(--text2);
  margin-bottom: 0.35rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.form-box input,
.form-box select {
  width: 100%;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  padding: 0.65rem 0.9rem;
  font-size: 0.97rem;
  margin-bottom: 1.1rem;
  outline: none;
  transition: border-color 0.2s;
}

.form-box input:focus,
.form-box select:focus {
  border-color: var(--accent);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.7rem 1.4rem;
  border-radius: 8px;
  border: none;
  font-size: 0.97rem;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.15s, transform 0.1s;
}

.btn:active {
  transform: scale(0.97);
}

.btn-primary {
  background: var(--accent);
  color: #fff;
}

.btn-primary:hover {
  opacity: 0.9;
}

.btn-secondary {
  background: var(--surface2);
  color: var(--text);
  border: 1px solid var(--border);
}

.btn-secondary:hover {
  border-color: var(--accent);
}

.btn-danger {
  background: var(--red);
  color: #fff;
}

.btn-danger:hover {
  opacity: 0.9;
}

.btn-success {
  background: var(--green);
  color: #0f1117;
}

.btn-success:hover {
  opacity: 0.9;
}

.btn-full {
  width: 100%;
}

.back-link {
  color: var(--text2);
  font-size: 0.88rem;
  cursor: pointer;
  margin-top: 1rem;
  display: inline-block;
}

.back-link:hover {
  color: var(--accent);
}

/* ── LEADER DASHBOARD ── */
#screen-leader {
  flex-direction: column;
}

.leader-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0.8rem 1.4rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.leader-header .logo {
  font-weight: 900;
  font-size: 1.15rem;
  letter-spacing: -1px;
}

.leader-header .logo span {
  color: var(--accent);
}

.game-code-badge {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.3rem 0.8rem;
  font-size: 0.85rem;
  color: var(--text2);
}

.game-code-badge strong {
  color: var(--text);
  letter-spacing: 0.12em;
  font-size: 1rem;
}

.leader-header .spacer {
  flex: 1;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--green);
  display: inline-block;
  box-shadow: 0 0 6px var(--green);
}

.leader-body {
  display: grid;
  grid-template-columns: 300px 1fr;
  flex: 1;
  overflow: hidden;
}

@media (max-width: 900px) {
  .leader-body {
    grid-template-columns: 1fr;
  }
}

.leader-sidebar {
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 1.2rem;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 1.2rem;
}

.sidebar-section h3 {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text2);
  margin-bottom: 0.8rem;
}

.setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.7rem;
}

.setting-row label {
  font-size: 0.9rem;
  color: var(--text);
}

.toggle {
  position: relative;
  width: 40px;
  height: 22px;
  flex-shrink: 0;
}

.toggle input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: absolute;
  inset: 0;
  background: var(--border);
  border-radius: 22px;
  cursor: pointer;
  transition: background 0.2s;
}

.toggle-slider:before {
  content: '';
  position: absolute;
  width: 16px;
  height: 16px;
  left: 3px;
  top: 3px;
  border-radius: 50%;
  background: #fff;
  transition: transform 0.2s;
}

.toggle input:checked+.toggle-slider {
  background: var(--accent);
}

.toggle input:checked+.toggle-slider:before {
  transform: translateX(18px);
}

.setting-input {
  width: 70px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  padding: 0.3rem 0.5rem;
  font-size: 0.88rem;
  text-align: center;
  outline: none;
}

.setting-input:focus {
  border-color: var(--accent);
}

.sound-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
}

.sound-btn {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.4rem 0.5rem;
  font-size: 0.8rem;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
  color: var(--text);
}

.sound-btn.active {
  border-color: var(--accent);
  background: rgba(108, 99, 255, 0.15);
}

.sound-btn:hover {
  border-color: var(--accent);
}

.round-control {
  display: flex;
  align-items: center;
  gap: 0.7rem;
}

.round-num {
  font-size: 1.8rem;
  font-weight: 800;
  color: var(--accent);
  min-width: 2ch;
  text-align: center;
}

.leader-main {
  padding: 1.4rem;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 1.4rem;
}

.buzz-queue-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.8rem;
}

.buzz-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  min-height: 80px;
}

.buzz-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.7rem 1rem;
  display: flex;
  align-items: center;
  gap: 0.8rem;
  animation: slideIn 0.25s ease;
}

.buzz-item.first {
  border-color: var(--accent);
  background: rgba(108, 99, 255, 0.12);
}

.buzz-item .buzz-rank {
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--accent);
  min-width: 1.8ch;
}

.buzz-item.first .buzz-rank {
  color: var(--yellow);
}

.buzz-item .buzz-name {
  font-weight: 600;
  flex: 1;
}

.buzz-item .buzz-time {
  font-size: 0.78rem;
  color: var(--text2);
  margin-left: auto;
}

.buzz-empty {
  color: var(--text2);
  font-size: 0.9rem;
  text-align: center;
  padding: 1.5rem;
}

.timer-display {
  text-align: center;
  font-size: 3.5rem;
  font-weight: 900;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  line-height: 1;
  transition: color 0.3s;
}

.timer-display.warning {
  color: var(--yellow);
}

.timer-display.danger {
  color: var(--red);
}

.timer-controls {
  display: flex;
  gap: 0.7rem;
  justify-content: center;
  flex-wrap: wrap;
}

.player-table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}

th {
  text-align: left;
  padding: 0.6rem 0.8rem;
  color: var(--text2);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  border-bottom: 1px solid var(--border);
}

td {
  padding: 0.55rem 0.8rem;
  border-bottom: 1px solid rgba(46, 51, 71, 0.5);
  vertical-align: middle;
}

tr:hover td {
  background: rgba(255, 255, 255, 0.025);
}

.score-cell {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.score-btn {
  width: 22px;
  height: 22px;
  border-radius: 5px;
  border: none;
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.score-btn.up {
  background: rgba(67, 217, 143, 0.2);
  color: var(--green);
}

.score-btn.down {
  background: rgba(255, 92, 92, 0.2);
  color: var(--red);
}

.score-btn:hover {
  opacity: 0.8;
}

.team-badge {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 600;
}

.status-badge {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 600;
}

.status-badge.buzzed {
  background: rgba(108, 99, 255, 0.2);
  color: var(--accent);
}

.status-badge.locked {
  background: rgba(255, 92, 92, 0.15);
  color: var(--red);
}

.status-badge.ready {
  background: rgba(67, 217, 143, 0.15);
  color: var(--green);
}

.team-select {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  padding: 0.2rem 0.4rem;
  font-size: 0.8rem;
  outline: none;
}

/* ── PLAYER SCREEN ── */
#screen-player {
  align-items: center;
  justify-content: flex-start;
  padding-top: 0;
  background: radial-gradient(ellipse at 50% 80%, #1e1040 0%, #0f1117 60%);
}

.player-topbar {
  width: 100%;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0.7rem 1.2rem;
  display: flex;
  align-items: center;
  gap: 0.8rem;
}

.player-topbar .pname {
  font-weight: 700;
  font-size: 0.97rem;
}

.player-topbar .pscore {
  margin-left: auto;
  font-size: 0.9rem;
  color: var(--text2);
}

.player-topbar .pscore strong {
  color: var(--yellow);
}

.player-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1.5rem;
  padding: 2rem 1rem;
}

.player-status-msg {
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--text2);
  text-align: center;
  min-height: 1.6em;
}

.player-status-msg.success {
  color: var(--green);
}

.player-status-msg.locked-msg {
  color: var(--red);
}

.player-status-msg.queued {
  color: var(--yellow);
}

.buzzer-btn {
  width: min(280px, 75vw);
  height: min(280px, 75vw);
  border-radius: 50%;
  border: none;
  cursor: pointer;
  background: radial-gradient(circle at 38% 38%, #8b83ff, var(--accent) 60%, #3a33c0);
  box-shadow: 0 0 0 12px rgba(108, 99, 255, 0.15), 0 0 60px rgba(108, 99, 255, 0.35), var(--shadow);
  font-size: 2rem;
  font-weight: 900;
  color: #fff;
  letter-spacing: 0.05em;
  transition: transform 0.1s, box-shadow 0.15s;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.3rem;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

.buzzer-btn:active,
.buzzer-btn.pressed {
  transform: scale(0.94);
  box-shadow: 0 0 0 6px rgba(108, 99, 255, 0.15), 0 0 30px rgba(108, 99, 255, 0.25), var(--shadow);
}

.buzzer-btn.disabled {
  background: radial-gradient(circle at 38% 38%, #3a3a4a, #2a2a3a);
  box-shadow: 0 0 0 8px rgba(0, 0, 0, 0.2), var(--shadow);
  cursor: not-allowed;
  opacity: 0.6;
}

.buzzer-btn.locked-btn {
  background: radial-gradient(circle at 38% 38%, #7a2a2a, var(--red) 60%, #5a1a1a);
  box-shadow: 0 0 0 12px rgba(255, 92, 92, 0.15), 0 0 60px rgba(255, 92, 92, 0.25), var(--shadow);
  cursor: not-allowed;
}

.buzzer-btn.first-btn {
  background: radial-gradient(circle at 38% 38%, #ffe066, var(--yellow) 60%, #b8880a);
  box-shadow: 0 0 0 12px rgba(245, 197, 66, 0.2), 0 0 80px rgba(245, 197, 66, 0.4), var(--shadow);
}

.buzzer-btn.active-btn {
  animation: buzzerGlow 1.5s infinite alternate ease-in-out;
}

@keyframes buzzerGlow {
  0% {
    box-shadow: 0 0 0 12px rgba(108, 99, 255, 0.2), 0 0 40px rgba(108, 99, 255, 0.4), var(--shadow);
    transform: scale(1);
  }

  100% {
    box-shadow: 0 0 0 20px rgba(108, 99, 255, 0.35), 0 0 80px rgba(108, 99, 255, 0.7), var(--shadow);
    transform: scale(1.03);
  }
}

.buzzer-icon {
  font-size: 3rem;
  line-height: 1;
}

.buzzer-label {
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.player-timer {
  font-size: 3rem;
  font-weight: 900;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.player-timer.warning {
  color: var(--yellow);
}

.player-timer.danger {
  color: var(--red);
  animation: pulse 0.5s infinite alternate;
}

.player-queue-pos {
  font-size: 1rem;
  color: var(--text2);
  text-align: center;
}

.player-queue-pos strong {
  color: var(--accent);
  font-size: 1.3rem;
}

.player-scoreboard {
  width: min(480px, 96vw);
}

.scoreboard-title {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text2);
  margin-bottom: 0.5rem;
  text-align: center;
}

.scoreboard-list {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.sb-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.45rem 0.9rem;
  display: flex;
  align-items: center;
  gap: 0.7rem;
  font-size: 0.88rem;
}

.sb-item.me {
  border-color: var(--accent);
  background: rgba(108, 99, 255, 0.1);
}

.sb-rank {
  color: var(--text2);
  min-width: 1.5ch;
  font-size: 0.8rem;
}

.sb-name {
  flex: 1;
  font-weight: 600;
}

.sb-score {
  color: var(--yellow);
  font-weight: 700;
}

/* ── DONATE CARD ── */
.donate-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.2rem 1.5rem;
  text-align: center;
  margin-top: 1rem;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25);
  transition: transform 0.2s, border-color 0.2s;
}

.donate-card:hover {
  border-color: var(--accent);
}

.donate-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 0.25rem;
}

.donate-sub {
  font-size: 0.82rem;
  color: var(--text2);
  margin-bottom: 0.9rem;
}

.donate-qr-container {
  display: inline-block;
  background: #fff;
  padding: 0.6rem;
  border-radius: 12px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
}

.donate-qr-img {
  width: min(500px, 50vw);
  height: auto;
  display: block;
  border-radius: 6px;
}

.donate-tag {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--accent);
  margin-top: 0.7rem;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.2rem;
}

.panel-title {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text2);
  margin-bottom: 0.9rem;
}

#toast-container {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  pointer-events: none;
}

.toast {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.65rem 1.1rem;
  font-size: 0.88rem;
  box-shadow: var(--shadow);
  animation: slideInRight 0.25s ease;
  max-width: 280px;
  pointer-events: auto;
}

.toast.success {
  border-color: var(--green);
}

.toast.error {
  border-color: var(--red);
}

.divider {
  height: 1px;
  background: var(--border);
  margin: 0.5rem 0;
}

.penalty-overlay {
  font-size: 0.78rem;
  color: var(--red);
  text-align: center;
}

/* ── ANIMATIONS ── */
@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes slideInRight {
  from {
    opacity: 0;
    transform: translateX(20px);
  }

  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes pulse {
  from {
    opacity: 1;
  }

  to {
    opacity: 0.5;
  }
}

@keyframes buzz {

  0%,
  100% {
    transform: rotate(0deg);
  }

  20% {
    transform: rotate(-8deg);
  }

  40% {
    transform: rotate(8deg);
  }

  60% {
    transform: rotate(-5deg);
  }

  80% {
    transform: rotate(5deg);
  }
}

.buzz-anim {
  animation: buzz 0.4s ease;
}

/* ── SCROLLBAR ── */
::-webkit-scrollbar {
  width: 6px;
}

::-webkit-scrollbar-track {
  background: var(--bg);
}

::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 3px;
}

/* ── TRIVIA / QUESTION DECK ── */
.deck-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.6rem;
}

.question-meta-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.6rem;
  flex-wrap: wrap;
}

.q-chip {
  display: inline-block;
  background: var(--surface2);
  border: 1px solid var(--border);
  padding: 0.2rem 0.6rem;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--accent);
}

.q-chip.difficulty {
  text-transform: capitalize;
  color: var(--yellow);
}

.q-number {
  margin-left: auto;
  font-size: 0.82rem;
  color: var(--text2);
  font-weight: 600;
}

.question-text-display {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1.4;
  margin-bottom: 0.9rem;
  padding: 0.8rem 1rem;
  background: var(--surface2);
  border-radius: 8px;
  border-left: 3px solid var(--accent);
}

.options-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 0.5rem;
  margin-bottom: 0.9rem;
}

.option-pill {
  background: var(--surface2);
  border: 1px solid var(--border);
  padding: 0.55rem 0.8rem;
  border-radius: 8px;
  font-size: 0.88rem;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  transition: border-color 0.2s, background 0.2s;
}

.option-pill.correct {
  border-color: var(--green);
  background: rgba(67, 217, 143, 0.15);
  color: var(--green);
  font-weight: 700;
}

.deck-controls-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.auto-reset-check {
  font-size: 0.82rem;
  color: var(--text2);
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  cursor: pointer;
  user-select: none;
}

/* ── PLAYER QUESTION CARD ── */
.player-q-card {
  width: min(480px, 96vw);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.1rem 1.3rem;
  margin-bottom: 1rem;
  box-shadow: var(--shadow);
  animation: slideIn 0.25s ease;
}

.player-q-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.5rem;
}

.player-q-text {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1.4;
  margin-bottom: 0.8rem;
  text-align: center;
}

.player-options-grid {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.player-option {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.5rem 0.8rem;
  font-size: 0.88rem;
  color: var(--text2);
  text-align: left;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  transition: all 0.2s;
}

.player-option.correct {
  border-color: var(--green);
  background: rgba(67, 217, 143, 0.18);
  color: #fff;
  font-weight: 700;
}

.player-answer-banner {
  margin-top: 0.8rem;
  padding: 0.5rem 0.8rem;
  border-radius: 8px;
  background: rgba(67, 217, 143, 0.2);
  border: 1px solid var(--green);
  color: var(--green);
  font-weight: 700;
  text-align: center;
  font-size: 0.9rem;
  animation: slideIn 0.2s ease;
}

/* ── MODAL DIALOG ── */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 10000;
  background: rgba(10, 10, 18, 0.85);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.modal-overlay.hidden {
  display: none;
}

.modal-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.8rem 2.2rem;
  width: min(640px, 96vw);
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow);
}

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

.modal-header h2 {
  font-size: 1.3rem;
  color: var(--text);
}

.modal-close-btn {
  background: none;
  border: none;
  color: var(--text2);
  font-size: 1.3rem;
  cursor: pointer;
  padding: 0.2rem 0.5rem;
  border-radius: 6px;
  transition: color 0.15s;
}

.modal-close-btn:hover {
  color: var(--red);
}

.modal-tabs {
  display: flex;
  border-bottom: 1px solid var(--border);
  margin-bottom: 1.2rem;
  gap: 0.4rem;
}

.modal-tab {
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  padding: 0.5rem 1rem;
  color: var(--text2);
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.2s;
}

.modal-tab:hover {
  color: var(--text);
}

.modal-tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.8rem;
}

@media (max-width: 600px) {
  .form-grid {
    grid-template-columns: 1fr;
  }
}

.form-label {
  display: block;
  font-size: 0.78rem;
  color: var(--text2);
  margin-bottom: 0.35rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.form-select {
  width: 100%;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  padding: 0.55rem 0.8rem;
  font-size: 0.9rem;
  outline: none;
  transition: border-color 0.2s;
}

.form-select:focus {
  border-color: var(--accent);
}

.deck-textarea {
  width: 100%;
  min-height: 140px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  padding: 0.7rem 0.9rem;
  font-family: 'Consolas', monospace;
  font-size: 0.84rem;
  outline: none;
  resize: vertical;
  transition: border-color 0.2s;
}

.deck-textarea:focus {
  border-color: var(--accent);
}

.sample-decks-grid {
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
}

.sample-card {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1rem 1.2rem;
  cursor: pointer;
  transition: border-color 0.2s, transform 0.15s;
}

.sample-card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
}

.sample-card h3 {
  font-size: 1.05rem;
  margin-bottom: 0.25rem;
  color: var(--text);
}

.sample-card p {
  font-size: 0.82rem;
  color: var(--text2);
}