:root {
    --bg: #1b1f3b;
    --panel: #262b52;
    --text: #f4f5fb;
    --muted: #a8acc8;
    --accent: #ffb400;
    --ok: #2fbf71;
    --bad: #e5484d;
    --opt-a: #3b6cf6;
    --opt-b: #e5484d;
    --opt-c: #2fbf71;
    --opt-d: #f59e0b;
    --opt-e: #8b5cf6;
    --opt-f: #06b6d4;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font: 17px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    -webkit-text-size-adjust: 100%;
}

header {
    position: sticky;
    top: 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 16px;
    padding-top: max(10px, env(safe-area-inset-top));
    background: #13162c;
    font-weight: 600;
    z-index: 1;
}

.conn { width: 12px; height: 12px; border-radius: 50%; background: var(--muted); }
.conn.ok { background: var(--ok); }
.conn.slow { background: var(--accent); }
.conn.off { background: var(--bad); }

main { max-width: 560px; margin: 0 auto; padding: 16px; padding-bottom: max(24px, env(safe-area-inset-bottom)); }

h1 { font-size: 1.6rem; margin: .4em 0; }
h2 { font-size: 1.3rem; margin: .4em 0; }
.center { text-align: center; }
.muted { color: var(--muted); }
.big { font-size: 1.5rem; font-weight: 700; }

button { font: inherit; color: inherit; cursor: pointer; }

.choices { display: grid; gap: 12px; }
.choice {
    display: flex; flex-direction: column; align-items: flex-start; gap: 4px;
    padding: 16px; border: 0; border-radius: 12px; background: var(--panel); text-align: left;
}
.choice small { color: var(--muted); }

form { display: grid; gap: 12px; margin: 16px 0; }
input {
    font: inherit; font-size: 1.2rem; padding: 14px; border-radius: 10px;
    border: 2px solid var(--panel); background: #fff; color: #111;
}
button.primary {
    padding: 14px; border: 0; border-radius: 10px; background: var(--accent); color: #1b1f3b; font-weight: 700; font-size: 1.15rem;
}
button.primary:disabled { opacity: .6; }
button.link { background: none; border: 0; color: var(--muted); padding: 8px 0; text-decoration: underline; }

.notice { padding: 10px 14px; border-radius: 10px; background: var(--panel); }
.notice.error { background: rgba(229, 72, 77, .25); }
.notice.ok { background: rgba(47, 191, 113, .25); }

.me { display: flex; justify-content: space-between; color: var(--muted); font-size: .95rem; margin-bottom: 8px; }

.qmeta { display: flex; justify-content: space-between; color: var(--muted); font-size: .9rem; }
.timebar { height: 6px; background: var(--panel); border-radius: 3px; overflow: hidden; margin: 8px 0; }
.timebar span { display: block; height: 100%; background: var(--accent); transition: width .2s linear; }
.qhead { display: flex; gap: 12px; align-items: flex-start; justify-content: space-between; }
.countdown {
    min-width: 2.4em; text-align: center; font-size: 1.6rem; font-weight: 800; color: var(--accent);
    background: var(--panel); border-radius: 10px; padding: 4px 6px;
}
.countdown.hurry { color: var(--bad); }

.options { display: grid; gap: 10px; margin: 14px 0; }
.option {
    display: flex; align-items: center; gap: 12px; width: 100%;
    padding: 14px; min-height: 60px; border: 3px solid transparent; border-radius: 12px;
    background: var(--panel); text-align: left; font-size: 1.05rem;
}
.option .letter {
    flex: none; display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 8px;
    font-weight: 800; color: #fff;
}
.option:nth-child(1) .letter { background: var(--opt-a); }
.option:nth-child(2) .letter { background: var(--opt-b); }
.option:nth-child(3) .letter { background: var(--opt-c); }
.option:nth-child(4) .letter { background: var(--opt-d); }
.option:nth-child(5) .letter { background: var(--opt-e); }
.option:nth-child(6) .letter { background: var(--opt-f); }
button.option:active:not(:disabled) { transform: scale(.98); }
.option:disabled { opacity: .55; }
.option.chosen { border-color: var(--accent); opacity: 1; }
.option.correct { border-color: var(--ok); background: rgba(47, 191, 113, .2); }
.option.wrong { border-color: var(--bad); background: rgba(229, 72, 77, .2); }

.outcome { display: flex; flex-direction: column; align-items: center; padding: 18px; border-radius: 14px; margin: 8px 0 16px; font-size: 1.1rem; }
.outcome strong { font-size: 1.7rem; }
.outcome.right { background: rgba(47, 191, 113, .3); }
.outcome.wrong { background: rgba(229, 72, 77, .3); }
.outcome.none { background: var(--panel); }

.podium { text-align: left; display: inline-block; font-size: 1.15rem; }
.podium li { margin: 6px 0; }
