:root {
  --bg: #1b1030;
  --bg2: #2a1650;
  --card: #2e1b54;
  --accent: #ff5fa2;
  --accent2: #ffd166;
  --text: #f5eeff;
  --muted: #b9a8d8;
  --t0: #e8413b; /* red */
  --t1: #2575d6; /* blue */
  --t2: #f0a818; /* yellow */
  --t3: #21a35a; /* green */
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  font-family: -apple-system, "Segoe UI", system-ui, sans-serif;
  background: linear-gradient(160deg, var(--bg), var(--bg2));
  color: var(--text);
  min-height: 100vh;
}

body { padding: 16px; }

#screen { max-width: 560px; margin: 0 auto; }

h1, h2, h3 { margin: 0 0 12px; line-height: 1.15; }
p { line-height: 1.4; }
.muted { color: var(--muted); }
.center { text-align: center; }

.card {
  background: var(--card);
  border-radius: 18px;
  padding: 22px;
  box-shadow: 0 8px 30px rgba(0,0,0,.35);
  margin-bottom: 16px;
}

.brand { color: var(--accent); font-weight: 800; letter-spacing: .5px; }

input[type=text] {
  width: 100%;
  padding: 14px 16px;
  font-size: 18px;
  border-radius: 12px;
  border: 2px solid #4a2f7a;
  background: #1f123c;
  color: var(--text);
  margin-bottom: 12px;
}
input[type=text]:focus { outline: none; border-color: var(--accent); }
label { display:block; font-size: 14px; color: var(--muted); margin: 4px 0; }

button {
  cursor: pointer;
  font-family: inherit;
  font-weight: 700;
  border: none;
  border-radius: 14px;
  padding: 15px 18px;
  font-size: 18px;
  background: var(--accent);
  color: #2a0d1c;
  transition: transform .05s ease, filter .15s ease;
}
button:hover { filter: brightness(1.06); }
button:active { transform: translatey(1px); }
button:disabled { opacity: .5; cursor: default; }
.big-btn { width: 100%; padding: 18px; font-size: 22px; }
.btn-ghost { background: transparent; color: var(--text); border: 2px solid #5a3d8f; }
.btn-go { background: var(--accent2); color:#3a2700; }
.row { display: flex; gap: 10px; flex-wrap: wrap; }
.row > * { flex: 1; }

.code-pill {
  display:inline-block; font-weight:800; letter-spacing:6px;
  background:#1f123c; border:2px dashed var(--accent); border-radius:12px;
  padding:6px 14px; font-size: 28px; color: var(--accent2);
}

.qr { background:#fff; padding:14px; border-radius:16px; display:inline-block; }
.qr svg { display:block; width: 260px; height: 260px; }

/* answer tiles */
.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.tile {
  min-height: 92px; color: #fff; font-size: 19px; text-align: center;
  display:flex; align-items:center; justify-content:center; padding: 12px;
  border-radius: 16px;
}
.tile-0 { background: var(--t0); }
.tile-1 { background: var(--t1); }
.tile-2 { background: var(--t2); color:#3a2700; }
.tile-3 { background: var(--t3); }
.tile.dim { opacity: .35; }
.tile.correct { outline: 5px solid #fff; box-shadow: 0 0 0 4px var(--t3); }

.answered { text-align:center; font-size: 24px; font-weight:800; padding: 40px 10px; }
.ok { color: #7CFFB0; }
.bad { color: #ff8b8b; }

/* timer */
.timer { margin: 10px 0 18px; }
.timer-track { height: 14px; background:#1f123c; border-radius:8px; overflow:hidden; }
.timer-bar { height:100%; background: var(--accent2); width:100%; transition: width .2s linear; }
.timer-num { font-size: 22px; font-weight: 800; }

/* leaderboard */
.lb { list-style:none; padding:0; margin:0; }
.lb li { display:flex; justify-content:space-between; padding:12px 16px; background:#241445; border-radius:12px; margin-bottom:8px; font-size: 18px; }
.lb li .pos { color: var(--accent2); font-weight:800; margin-right:10px; }
.lb li.me { outline: 2px solid var(--accent); }
.lb .score { font-weight:800; }

.q-meta { color: var(--muted); font-size: 15px; margin-bottom: 6px; }
.q-text { font-size: 24px; font-weight: 800; }

.editor-q { background:#241445; border-radius:14px; padding:14px; margin-bottom:12px; }
.editor-q .qhead { display:flex; justify-content:space-between; align-items:center; gap:8px; }
.del { background:transparent; color:#ff8b8b; border:1px solid #5a3d8f; padding:8px 12px; font-size:15px; }

.spinner { width:46px;height:46px;border:5px solid #4a2f7a;border-top-color:var(--accent);border-radius:50%;animation:spin 1s linear infinite;margin:20px auto;}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- host / big screen ---------- */
body.host #screen { max-width: 1100px; }
body.host { padding: 32px; }
body.host h1 { font-size: 52px; }
body.host .q-text { font-size: 46px; }
body.host .q-meta { font-size: 22px; }
body.host .code-pill { font-size: 44px; }
body.host .qr svg { width: 360px; height: 360px; }
body.host .tiles { grid-template-columns: 1fr 1fr; gap: 18px; }
body.host .tile { min-height: 130px; font-size: 30px; }
body.host .lb li { font-size: 28px; padding: 18px 24px; }
body.host .timer-num { font-size: 40px; }
body.host .controls { position: sticky; bottom: 0; padding-top: 16px; }
body.host .controls button { font-size: 24px; padding: 18px 26px; }
body.host .big-num { font-size: 64px; font-weight: 800; color: var(--accent2); }

.podium { display:flex; justify-content:center; align-items:flex-end; gap: 18px; margin: 24px 0; }
.podium .step { background: var(--card); border-radius:14px; padding:18px; text-align:center; min-width: 160px; }
.podium .p1 { border:3px solid var(--accent2); }
.podium .bar { font-weight:800; color: var(--accent2); }
.names { display:flex; flex-wrap:wrap; gap:10px; justify-content:center; margin-top:10px; }
.chip { background:#241445; border-radius:999px; padding:8px 16px; font-size:18px; }

.short-url {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 22px;
  letter-spacing: 1px;
  margin: 10px 0;
  word-break: break-all;
  user-select: all;
}
body.host .short-url { font-size: 34px; }
