:root {
  --bg: #111827;
  --panel: #1f2937;
  --panel-2: #111827;
  --text: #f9fafb;
  --muted: #cbd5e1;
  --red: #ef4444;
  --blue: #3b82f6;
  --yellow: #f59e0b;
  --green: #22c55e;
  --purple: #8b5cf6;
  --pink: #ec4899;
  --radius: 24px;
  --shadow: 0 20px 50px rgba(0,0,0,.3);
}
* { box-sizing: border-box; }
html, body {
  margin: 0; padding: 0;
  font-family: Arial, Helvetica, sans-serif;
  background: radial-gradient(circle at top, #1d4ed8 0%, #111827 45%, #020617 100%);
  color: var(--text);
}
button, input, textarea, select { font: inherit; }
a { color: inherit; }

.hidden { display: none !important; }
.page { min-height: 100vh; padding: 20px; }
.card {
  background: rgba(17,24,39,.88);
  border: 1px solid rgba(255,255,255,.08);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.toolbar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  margin-bottom: 18px;
}
.brand {
  display:flex; align-items:center; gap:12px;
}
.logo {
  width: 52px; height:52px; border-radius: 16px;
  display:grid; place-items:center; font-weight: 800; font-size: 28px;
  background: linear-gradient(135deg, var(--pink), var(--purple), var(--blue));
}
.title h1 { margin: 0; font-size: 30px; }
.title p { margin: 4px 0 0 0; color: var(--muted); }
.btn {
  border:none; border-radius: 18px; padding: 12px 18px; cursor:pointer;
  color:#fff; font-weight:700;
  background: #334155;
}
.btn.primary { background: linear-gradient(135deg, var(--pink), var(--purple)); }
.btn.green { background: linear-gradient(135deg, #16a34a, #22c55e); }
.btn.red { background: linear-gradient(135deg, #dc2626, #ef4444); }
.btn.blue { background: linear-gradient(135deg, #2563eb, #3b82f6); }
.btn.yellow { background: linear-gradient(135deg, #d97706, #f59e0b); color:#111827; }
.btn.small { padding: 8px 12px; border-radius: 14px; font-size: 14px; }
.btn.ghost { background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.14); }
.btn:disabled { opacity:.5; cursor:not-allowed; }

.layout-3 {
  display:grid;
  grid-template-columns: 280px minmax(420px, 1fr) 320px;
  gap: 18px;
}
.panel { padding: 18px; }
.section-title { margin: 0 0 10px 0; font-size: 22px; }
.muted { color: var(--muted); }

.quiz-list, .question-list, .player-list, .chat-list { display:flex; flex-direction:column; gap:10px; }
.item {
  padding: 14px; border-radius: 18px;
  background: rgba(255,255,255,.06);
  border: 1px solid transparent;
  cursor: pointer;
}
.item.active { border-color: rgba(255,255,255,.35); background: rgba(255,255,255,.12); }
.item h3, .item p { margin:0; }
.item p { color: var(--muted); font-size: 14px; }

.field { margin-bottom: 14px; }
.field label { display:block; margin-bottom: 6px; font-weight:700; }
.field input[type=text], .field input[type=number], .field textarea, .field select {
  width: 100%; border:none; background:#0f172a; color:#fff; border-radius: 16px;
  padding: 12px 14px; border:1px solid rgba(255,255,255,.08);
}
.field textarea { min-height: 88px; resize: vertical; }

.switch-row, .slider-row, .inline { display:flex; align-items:center; gap:12px; flex-wrap:wrap; }
.switch-row input { transform: scale(1.3); }
.slider-row input[type=range] { flex: 1; }

.answer-grid {
  display:grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}
.answer-card {
  padding: 16px; border-radius: 22px; min-height: 96px;
  border: 4px solid transparent;
  color:#fff; font-weight:700; display:flex; align-items:center; justify-content:center;
  text-align:center;
  position:relative;
}
.answer-card.red { background: linear-gradient(135deg, #dc2626, #ef4444); }
.answer-card.blue { background: linear-gradient(135deg, #2563eb, #3b82f6); }
.answer-card.yellow { background: linear-gradient(135deg, #d97706, #f59e0b); color:#111827; }
.answer-card.green { background: linear-gradient(135deg, #15803d, #22c55e); }
.answer-card.selected { border-color: #fff; box-shadow: 0 0 0 5px rgba(255,255,255,.22); }
.answer-card.correct { border-color: #86efac; box-shadow: 0 0 0 5px rgba(34,197,94,.25); }
.answer-card.dimmed { opacity: .5; }

.kahoot-shell {
  display:grid;
  grid-template-columns: 1fr;
  gap: 18px;
}
.hero {
  padding: 22px;
}
.hero-top {
  display:flex; justify-content:space-between; align-items:center; gap:14px; flex-wrap:wrap;
}
.hero h2 { margin:0; font-size: 40px; }
.hero p { margin:6px 0 0 0; color: var(--muted); }

.lobby-grid {
  display:grid; grid-template-columns: 1fr 320px;
  gap: 18px;
}
.big-code {
  font-size: 72px; font-weight: 800; letter-spacing: 6px;
  text-align:center; padding: 16px; background: rgba(255,255,255,.08); border-radius: 24px;
}
.url-box {
  margin-top: 12px;
  background:#0f172a; border-radius: 18px; padding: 12px 14px; word-break:break-all;
}
.qr-wrap {
  display:grid; place-items:center;
  padding: 16px; background: rgba(255,255,255,.08); border-radius: 24px;
}
.qr-wrap img { max-width: 100%; border-radius: 16px; background: white; padding: 8px; }
.stats-row {
  display:flex; gap:12px; flex-wrap:wrap; align-items:center;
}
.pill {
  padding: 10px 14px; border-radius: 999px; background: rgba(255,255,255,.08);
}
.player-pill { display:inline-flex; align-items:center; gap:8px; padding:8px 12px; border-radius:999px; background:rgba(255,255,255,.1); }

.question-stage {
  display:grid;
  grid-template-columns: minmax(0,1fr) 240px;
  gap: 18px;
  align-items:start;
}
.question-box { padding: 22px; }
.question-box h3 { font-size: 46px; margin: 0 0 14px 0; line-height:1.1; }
.question-meta { display:flex; gap:12px; flex-wrap:wrap; align-items:center; margin-bottom: 18px; }
.question-image {
  width:100%; max-height: 320px; object-fit: contain; border-radius: 24px; background: rgba(255,255,255,.06); margin-bottom: 18px;
}
.timer-card {
  padding: 22px; text-align:center;
}
.timer-ring {
  width: 160px; height: 160px; border-radius: 50%; margin: 0 auto 12px auto;
  display:grid; place-items:center; font-size: 52px; font-weight:800;
  background: radial-gradient(circle, rgba(255,255,255,.12) 0%, rgba(255,255,255,.05) 65%, rgba(255,255,255,.02) 100%);
  border: 8px solid rgba(255,255,255,.2);
}
.percent-list { display:grid; gap:10px; }
.percent-row {
  display:grid; grid-template-columns: 1fr 70px;
  gap:10px; align-items:center;
}
.percent-bar {
  background: rgba(255,255,255,.08); border-radius: 999px; overflow:hidden; height: 24px;
}
.percent-fill { height: 100%; display:flex; align-items:center; padding-left: 10px; font-weight:700; }

.countdown-screen, .center-screen {
  min-height: 70vh; display:grid; place-items:center; text-align:center; padding:30px;
}
.countdown-number { font-size: 120px; font-weight: 800; margin: 8px 0; }
.podium {
  display:grid; grid-template-columns: repeat(3, 1fr); gap: 18px; align-items:end;
}
.podium-card {
  padding: 18px; text-align:center; border-radius: 24px;
}
.podium-card.first { background: linear-gradient(180deg,#fde68a,#f59e0b); color:#111827; min-height: 280px; }
.podium-card.second { background: linear-gradient(180deg,#e5e7eb,#9ca3af); color:#111827; min-height: 220px; }
.podium-card.third { background: linear-gradient(180deg,#fdba74,#b45309); color:#111827; min-height: 190px; }

.mobile-shell { max-width: 520px; margin: 0 auto; }
.mobile-card { padding: 20px; }
.mobile-title { font-size: 28px; margin: 0 0 8px 0; text-align:center; }
.mobile-subtitle { color: var(--muted); text-align:center; margin:0 0 16px 0; }
.mobile-answer-grid { display:grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.mobile-answer {
  min-height: 120px; border-radius: 28px; border: 5px solid transparent;
  display:flex; align-items:center; justify-content:center; text-align:center; padding: 14px;
  font-size: 22px; font-weight: 800;
}
.mobile-answer.selected { border-color: white; box-shadow: 0 0 0 6px rgba(255,255,255,.20); }
.mobile-answer.correct { border-color: #86efac; box-shadow: 0 0 0 6px rgba(34,197,94,.2); }
.mobile-answer.disabled { opacity: .55; }
.notice {
  padding: 12px 14px; border-radius: 16px; background: rgba(255,255,255,.08); color: var(--text);
}

.chat-box {
  display:grid; gap:10px;
}
.chat-list {
  max-height: 220px; overflow:auto; padding-right: 4px;
}
.chat-item {
  padding:10px 12px; border-radius:16px; background: rgba(255,255,255,.08);
}
.chat-author { font-weight: 700; }
.chat-text { color: var(--muted); margin-top: 4px; }
.admin-mini {
  position: fixed; top: 16px; right: 16px; z-index: 50;
}

@media (max-width: 1100px) {
  .layout-3, .lobby-grid, .question-stage { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .page { padding: 12px; }
  .big-code { font-size: 48px; }
  .question-box h3 { font-size: 30px; }
  .countdown-number { font-size: 88px; }
}