:root {
  --bg: #12101c;
  --bg-soft: #1d1a2e;
  --line: #2f2a45;
  --fg: #f4f2ff;
  --muted: #a49fc0;
  --accent: #7c5cff;
  --ok: #2fbf71;
  --bad: #ef4056;
  --a: #e0455f;
  --b: #2f7ce0;
  --c: #e0a12f;
  --d: #2fa877;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100dvh;
  background: radial-gradient(1200px 600px at 50% -10%, #241f3d, var(--bg));
  color: var(--fg);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-text-size-adjust: 100%;
}

.wrap {
  max-width: 720px;
  margin: 0 auto;
  padding: 24px 16px 48px;
}

.wrap.wide { max-width: 1040px; }

h1 { font-size: 1.5rem; margin: 0 0 4px; }
h2 { font-size: 1.1rem; margin: 0 0 12px; }
.muted { color: var(--muted); }
.small { font-size: 0.85rem; }
.center { text-align: center; }

.card {
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 20px;
  margin-bottom: 16px;
}

button {
  font: inherit;
  font-weight: 600;
  color: var(--fg);
  background: var(--accent);
  border: 0;
  border-radius: 12px;
  padding: 14px 20px;
  cursor: pointer;
  transition: transform .08s ease, opacity .15s ease;
}
button:active { transform: scale(.98); }
button:disabled { opacity: .45; cursor: not-allowed; }
button.ghost { background: transparent; border: 1px solid var(--line); color: var(--muted); }
button.big { width: 100%; padding: 18px; font-size: 1.1rem; }

input[type=text] {
  font: inherit;
  width: 100%;
  padding: 14px 16px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #0f0d18;
  color: var(--fg);
}
input[type=text]:focus { outline: 2px solid var(--accent); outline-offset: 1px; }

/* Svarsalternativ */
.options { display: grid; gap: 12px; }
@media (min-width: 520px) { .options { grid-template-columns: 1fr 1fr; } }

.option {
  display: flex;
  align-items: center;
  gap: 14px;
  text-align: left;
  padding: 18px;
  min-height: 84px;
  border-radius: 14px;
  background: var(--opt, var(--bg-soft));
  font-size: 1.05rem;
  width: 100%;
}
.option .letter {
  flex: none;
  display: grid;
  place-items: center;
  width: 34px; height: 34px;
  border-radius: 9px;
  background: rgba(0,0,0,.28);
  font-weight: 800;
}
.option[data-opt="0"] { --opt: var(--a); }
.option[data-opt="1"] { --opt: var(--b); }
.option[data-opt="2"] { --opt: var(--c); }
.option[data-opt="3"] { --opt: var(--d); }
.option.dimmed { opacity: .28; }
.option.chosen { outline: 3px solid #fff; outline-offset: 2px; }

/* Timer */
.timer { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.timer .num { font-size: 2rem; font-weight: 800; font-variant-numeric: tabular-nums; min-width: 2.4ch; }
.bar { flex: 1; height: 10px; border-radius: 99px; background: #0f0d18; overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--accent); transition: width .1s linear; }
.bar.warn > i { background: var(--bad); }

/* Status */
.status { font-size: 1.4rem; font-weight: 700; text-align: center; padding: 24px 0; }
.verdict { text-align: center; padding: 12px 0 4px; }
.verdict .big { font-size: 2rem; font-weight: 800; }
.verdict.ok .big { color: var(--ok); }
.verdict.bad .big { color: var(--bad); }
.points { font-size: 2.4rem; font-weight: 800; font-variant-numeric: tabular-nums; }

/* Listor */
.list { list-style: none; margin: 0; padding: 0; }
.list li {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px;
  border-radius: 10px;
}
.list li + li { margin-top: 6px; }
.list li:nth-child(odd) { background: rgba(255,255,255,.035); }
.list .rank { width: 2.2ch; font-weight: 800; color: var(--muted); text-align: right; }
.list .name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list .score { font-variant-numeric: tabular-nums; font-weight: 700; }
.list li.me { background: rgba(124,92,255,.22); }
.list li.top1 .rank { color: #ffd54a; }

.dot { width: 8px; height: 8px; border-radius: 99px; background: var(--muted); flex: none; }
.dot.on { background: var(--ok); }
.dot.answered { background: var(--accent); }

.stats { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; }
.stat {
  flex: 1 1 130px;
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 14px;
}
.stat b { display: block; font-size: 1.7rem; font-variant-numeric: tabular-nums; }

.row { display: flex; gap: 10px; flex-wrap: wrap; }
.row > * { flex: 1; }

.banner {
  border-radius: 12px;
  padding: 12px 14px;
  margin-bottom: 16px;
  background: rgba(239,64,86,.15);
  border: 1px solid var(--bad);
}
.hidden { display: none !important; }

.dist { display: grid; gap: 6px; margin-top: 12px; }
.dist .d { display: flex; align-items: center; gap: 10px; font-size: .9rem; }
.dist .d .meter { flex: 1; height: 8px; background: #0f0d18; border-radius: 99px; overflow: hidden; }
.dist .d .meter > i { display: block; height: 100%; background: var(--accent); }
.dist .d.correct { color: var(--ok); font-weight: 700; }
.dist .d.correct .meter > i { background: var(--ok); }
