:root {
    --bg: #eef3f8;
    --panel: #ffffff;
    --ink: #1d2733;
    --muted: #6a7a8c;
    --line: #d5dfea;
    --brand: #0f4c81;
    --brand-soft: #e6eef7;
    --accent: #1a9e8f;
    --warn: #c2410c;
    --err: #d64545;
    --ok: #2f9e44;
    --card: #f4f8fc;
    --radius: 10px;
    --shadow: 0 1px 2px rgba(20, 40, 70, .08), 0 6px 18px rgba(20, 40, 70, .06);
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
}

body {
    background: var(--bg);
    color: var(--ink);
    font: 15px/1.5 -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    -webkit-text-size-adjust: 100%;
}

a { color: var(--brand); }

.wrap {
    max-width: 1480px;
    margin: 0 auto;
    padding: 16px 18px 40px;
}

/* ---------- шапка ---------- */
.top {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px 18px;
    padding: 6px 0 14px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-right: auto;
}
.home-link {
    color: var(--muted, #64748b);
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    white-space: nowrap;
    align-self: center;
}
.home-link:hover { color: var(--brand); text-decoration: none; }


.brand .mark {
    width: 38px;
    height: 38px;
    border-radius: 9px;
    background: var(--brand);
    color: #fff;
    display: grid;
    place-items: center;
    font-weight: 700;
    font-size: 17px;
    letter-spacing: .5px;
}

.brand h1 {
    margin: 0;
    font-size: 19px;
    line-height: 1.2;
}

.brand p {
    margin: 2px 0 0;
    font-size: 12.5px;
    color: var(--muted);
}

.lang button,
.mode button,
.btn {
    font: inherit;
    cursor: pointer;
    border: 1px solid var(--line);
    background: var(--panel);
    color: var(--ink);
    border-radius: 8px;
    padding: 8px 13px;
    transition: background .15s, border-color .15s, color .15s;
}

.btn:hover,
.lang button:hover,
.mode button:hover { border-color: var(--brand); }

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

.btn.primary:hover { background: #0c3d68; }

.mode, .lang {
    display: inline-flex;
    border: 1px solid var(--line);
    background: var(--panel);
    border-radius: 9px;
    overflow: hidden;
}

.mode button, .lang button {
    border: 0;
    border-radius: 0;
    padding: 8px 14px;
}

.mode button + button, .lang button + button { border-left: 1px solid var(--line); }

.mode button.on, .lang button.on {
    background: var(--brand);
    color: #fff;
}



.bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    padding: 12px 14px;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-bottom: 12px;
}

.bar .spacer { flex: 1; }

.score {
    font-size: 13.5px;
    color: var(--muted);
    white-space: nowrap;
}

.score b { color: var(--ink); }

.points {
    display: inline-block;
    padding: 2px 9px;
    border-radius: 20px;
    background: var(--brand-soft);
    color: var(--brand);
    font-weight: 600;
}

.points b { color: var(--brand); }

.points.low {
    background: #fdeaea;
    color: var(--err);
}

.points.low b { color: var(--err); }

/* ---------- ссылка на парную игру ---------- */
/* ---------- сообщение ---------- */
.msg {
    min-height: 20px;
    margin: 0 0 12px;
    padding: 10px 14px;
    border-radius: var(--radius);
    background: var(--brand-soft);
    border: 1px solid #cfe0f0;
    color: #1b3c5c;
    font-size: 14px;
}

.msg.ok { background: #e7f6ea; border-color: #bfe3c6; color: #1f6b2c; }
.msg.err { background: #fdeaea; border-color: #f3c4c4; color: #9c2b2b; }

/* ---------- раунды ---------- */
.rounds {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 10px;
}

.rounds button {
    font: inherit;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    border: 1px solid var(--line);
    background: var(--panel);
    color: var(--ink);
    border-radius: 9px;
    padding: 9px 14px;
}

.rounds button:hover { border-color: var(--brand); }
.rounds button.on { background: var(--brand); border-color: var(--brand); color: #fff; }
.rounds button.done:not(.on) { border-color: #bfe3c6; background: #f1fbf3; color: #1f6b2c; }

.roundIntro {
    padding: 12px 14px;
    margin: 0 0 12px;
    background: var(--brand-soft);
    border: 1px solid var(--line);
    border-left: 4px solid var(--brand);
    border-radius: var(--radius);
    font-size: 13.5px;
    line-height: 1.55;
}

/* ---------- поле игры ----------
   Стопка слева, колонки раунда — сеткой справа. В первом раунде колонок
   четырнадцать, поэтому они переносятся рядами; во втором шесть, в третьем
   три, и сетка растягивает их на всю ширину. */

/* ---------- правила ---------- */
details.rules {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 12px 16px;
    margin-bottom: 12px;
}

details.rules summary {
    cursor: pointer;
    font-weight: 600;
    color: var(--brand);
}

details.rules ol { margin: 10px 0 0; padding-left: 20px; }
details.rules li { margin-bottom: 5px; }

footer {
    margin-top: 26px;
    padding-top: 14px;
    border-top: 1px solid var(--line);
    font-size: 12.5px;
    color: var(--muted);
}

footer a { color: var(--muted); }

/* Юридическая строка: тише основного текста подвала, но читаемая. */
footer .legal {
    margin-top: 10px;
    font-size: 11.5px;
    opacity: .8;
}


/* ══════════ Comms Channels: свои блоки ══════════ */

/* сообщение-всплывашка (режим теста: «ответ принят») */
.msg {
    position: fixed;
    left: 50%;
    bottom: 18px;
    transform: translate(-50%, 20px);
    margin: 0;
    min-height: 0;
    opacity: 0;
    pointer-events: none;
    z-index: 80;
    box-shadow: var(--shadow);
    transition: opacity .2s, transform .2s;
}
.msg.show { opacity: 1; transform: translate(-50%, 0); }

/* поле: карточка слева, хаос-метр справа */
.play {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 290px;
    gap: 14px;
    align-items: start;
}

.stage { min-width: 0; }

.qcard, .pitch, .summary {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 14px;
    box-shadow: var(--shadow);
    padding: 20px 22px;
}

.qcard.enter { animation: cardIn .35s ease; }
.qcard.shake { animation: shake .45s ease; }

@keyframes cardIn {
    from { opacity: 0; transform: translateY(10px) scale(.99); }
    to { opacity: 1; transform: none; }
}
@keyframes shake {
    0%, 100% { transform: translateX(0); }
    20% { transform: translateX(-7px); }
    40% { transform: translateX(6px); }
    60% { transform: translateX(-4px); }
    80% { transform: translateX(3px); }
}

.qhead {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    font-size: 12.5px;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: .5px;
    font-weight: 600;
}

.timer {
    font-variant-numeric: tabular-nums;
    color: var(--brand);
    font-size: 14px;
    letter-spacing: 0;
}

.timerTrack {
    height: 6px;
    margin-top: 8px;
    border-radius: 6px;
    background: var(--brand-soft);
    overflow: hidden;
}
.timerBar {
    height: 100%;
    width: 100%;
    background: var(--accent);
    transition: width .2s linear, background .3s;
}
.timerBar.low { background: var(--err); }

.qtext {
    font-size: 18px;
    line-height: 1.45;
    margin: 14px 0 16px;
    font-weight: 600;
}

.opts {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
    gap: 10px;
}
.opts.nums { grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); }

.opt {
    font: inherit;
    text-align: left;
    cursor: pointer;
    min-height: 48px;
    padding: 11px 14px;
    border: 1.5px solid var(--line);
    border-left: 4px solid var(--brand);
    border-radius: 10px;
    background: var(--card);
    color: var(--ink);
    transition: transform .12s, border-color .15s, background .15s;
}
.opts.nums .opt {
    text-align: center;
    font-size: 22px;
    font-weight: 700;
    border-left-width: 1.5px;
    font-variant-numeric: tabular-nums;
}
.opt:hover:not([disabled]) { border-color: var(--brand); background: #fff; transform: translateY(-1px); }
.opt:active:not([disabled]) { transform: scale(.98); }
.opt[disabled] { cursor: default; }
.opt.right { border-color: #9fd5aa; border-left-color: var(--ok); background: #eaf7ed; animation: pop .35s ease; }
.opt.wrong { border-color: #f0b4b4; border-left-color: var(--err); background: #fdecec; }
.opt.dim { opacity: .55; }

@keyframes pop {
    0% { transform: scale(1); }
    50% { transform: scale(1.03); }
    100% { transform: scale(1); }
}

.hint {
    margin: 14px 0 0;
    font-size: 13px;
    color: var(--muted);
}

/* обратная связь под карточкой */
.fb {
    margin-top: 16px;
    padding: 14px 16px;
    border-radius: 10px;
    border: 1px solid var(--line);
    background: #fafcfe;
    animation: cardIn .3s ease;
}
.fb.ok { border-color: #bfe3c6; background: #f3fbf5; }
.fb.err { border-color: #f3c4c4; background: #fff7f7; }
.fb .verdict { margin: 0 0 8px; font-weight: 700; }
.fb.ok .verdict { color: #1f6b2c; }
.fb.err .verdict { color: #9c2b2b; }

.bonus {
    display: inline-block;
    margin: 0 6px 8px 0;
    padding: 2px 9px;
    border-radius: 20px;
    background: #fff4d6;
    color: #8a5a00;
    font-size: 12.5px;
    font-weight: 700;
    animation: pop .4s ease;
}

.event {
    margin: 0 0 10px;
    padding: 8px 12px;
    border-radius: 8px;
    background: #fff;
    border: 1px dashed #e0a3a3;
    font-size: 13.5px;
    font-style: italic;
}
.event::before { margin-right: 6px; font-style: normal; }
.event.ev-rumour::before { content: "💬"; }
.event.ev-dupe::before { content: "📧"; }
.event.ev-missed::before { content: "⏰"; }

.why h4, .others h4 {
    margin: 10px 0 4px;
    font-size: 12.5px;
    text-transform: uppercase;
    letter-spacing: .5px;
    color: var(--muted);
}
.why p { margin: 0 0 6px; }
.calc {
    font-family: Consolas, "SFMono-Regular", Menlo, monospace;
    font-size: 13.5px;
    background: var(--brand-soft);
    border-radius: 6px;
    padding: 6px 10px;
    overflow-wrap: anywhere;
}
.calc span { font-family: inherit; font-weight: 700; color: var(--brand); }
.others ul { margin: 0; padding-left: 18px; }
.others li { margin-bottom: 5px; font-size: 14px; }
.others li b { margin-right: 4px; }
.others li b::after { content: ":"; }
.others li.picked { color: #9c2b2b; }

.fb .btn { margin-top: 10px; }

/* стартовый экран */
.pitch { text-align: center; padding: 30px 24px; }
.pitch h2 { margin: 8px 0; color: var(--brand); font-size: 23px; }
.pitch p { max-width: 640px; margin: 0 auto 18px; font-size: 15.5px; }
.pitchIcon { font-size: 46px; animation: float 2.4s ease-in-out infinite; }
.btn.big { font-size: 17px; padding: 12px 28px; border-radius: 10px; }

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-6px); }
}

/* итог раунда и разбор */
.summary h2 { margin: 0 0 6px; font-size: 20px; color: var(--brand); }
.summary h3 { margin: 14px 0 8px; font-size: 15px; }
.reviewList { display: grid; gap: 8px; margin-bottom: 14px; }
.rv {
    border: 1px solid var(--line);
    border-left: 4px solid var(--ok);
    border-radius: 9px;
    padding: 8px 12px;
    background: #fbfdff;
}
.rv.err { border-left-color: var(--err); }
.rv summary { cursor: pointer; font-weight: 600; }
.rv .mark { display: inline-block; width: 18px; font-weight: 700; }
.rv.ok .mark { color: var(--ok); }
.rv.err .mark { color: var(--err); }
.rv .pick { margin: 8px 0; font-size: 13.5px; color: var(--muted); }

/* хаос-метр */
.chaos {
    position: sticky;
    top: 12px;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 14px;
    box-shadow: var(--shadow);
    padding: 14px 16px;
    overflow: hidden;
}
.chaos h3 { margin: 0 0 10px; font-size: 15px; }
.chaos.bump { animation: shake .45s ease; }
.chaos[data-tier="3"] { border-color: #f0b4b4; background: #fff8f8; }

.meter {
    height: 16px;
    border-radius: 10px;
    background: repeating-linear-gradient(90deg, #eef3f8 0 10px, #e6edf5 10px 20px);
    overflow: hidden;
    border: 1px solid var(--line);
}
.meter .fill {
    height: 100%;
    width: 0;
    border-radius: 10px;
    transition: width .6s cubic-bezier(.2, .9, .3, 1.2), background .4s;
}
.meter .fill.t0 { background: var(--accent); }
.meter .fill.t1 { background: #e0b100; }
.meter .fill.t2 { background: #e07a00; }
.meter .fill.t3 { background: var(--err); animation: pulse 1s ease-in-out infinite; }

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: .65; }
}

.meterRow {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    margin: 6px 0 10px;
    font-size: 13px;
    color: var(--muted);
}
.counters { list-style: none; margin: 0; padding: 0; }
.counters li {
    display: flex;
    justify-content: space-between;
    padding: 6px 0;
    border-top: 1px solid var(--line);
    font-size: 13.5px;
}
.counters b { font-variant-numeric: tabular-nums; }

.particle {
    position: absolute;
    bottom: 10px;
    font-size: 20px;
    pointer-events: none;
    animation: rise 1.4s ease-out forwards;
}
@keyframes rise {
    from { opacity: 1; transform: translateY(0) rotate(0); }
    to { opacity: 0; transform: translateY(-120px) rotate(25deg); }
}

/* вердикт */
.winBox {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 90;
    background: rgba(16, 30, 48, .55);
    align-items: center;
    justify-content: center;
    padding: 16px;
    overflow-y: auto;
}
.winCard {
    max-width: 460px;
    width: 100%;
    background: var(--panel);
    border-radius: 16px;
    box-shadow: 0 24px 60px rgba(10, 25, 45, .35);
    padding: 24px 22px 20px;
    text-align: center;
    animation: winPop .35s ease;
    margin: auto;
}
@keyframes winPop {
    from { transform: scale(.9) translateY(12px); opacity: 0; }
    to { transform: scale(1) translateY(0); opacity: 1; }
}
.winIcon { font-size: 54px; line-height: 1; animation: float 2.4s ease-in-out infinite; }
.winKicker { margin: 10px 0 0; font-size: 12px; text-transform: uppercase; letter-spacing: .8px; color: var(--muted); font-weight: 700; }
.winTitle { margin: 4px 0 8px; font-size: 22px; color: var(--brand); }
.winText { margin: 0 0 12px; font-size: 14.5px; }
.winStats { margin: 0 0 4px; font-weight: 700; }
.winChaos, .winBest { margin: 0 0 4px; font-size: 13.5px; color: var(--muted); }
.winHook { margin: 10px 0 16px; font-size: 13.5px; font-style: italic; }
.winBtns { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
.winBox[data-tier="0"] .winCard { border-top: 6px solid var(--ok); }
.winBox[data-tier="3"] .winCard { border-top: 6px solid var(--err); }

.rounds button[disabled] { opacity: .55; cursor: default; }

/* ---------- телефон ---------- */
@media (max-width: 820px) {
    .play { grid-template-columns: 1fr; }
    .chaos { position: static; order: -1; padding: 10px 12px; }
    .chaos h3 { margin-bottom: 6px; }
    .counters { display: flex; gap: 10px; flex-wrap: wrap; }
    .counters li { border-top: 0; padding: 0; gap: 4px; font-size: 12.5px; }
}

@media (max-width: 560px) {
    .wrap { padding: 12px 12px 30px; }
    .top { gap: 10px; }
    .brand h1 { font-size: 17px; }
    .mode, .lang { width: 100%; }
    .mode button, .lang button { flex: 1; padding: 9px 6px; }
    .home-link { order: 5; }
    .qcard, .pitch, .summary { padding: 16px 14px; }
    .qtext { font-size: 16.5px; }
    .opts { grid-template-columns: 1fr; }
    .opts.nums { grid-template-columns: 1fr 1fr; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation: none !important; transition: none !important; }
}
