/* =============================================================
   DengiQuiz — основной домен: витрина, игры, калькуляторы, статьи.
   Палитра общая с разделом квизов, чтобы переход между доменами
   не читался как уход на чужой сайт.
   ============================================================= */

:root {
    --bg:         #0e1116;
    --bg-soft:    #151a22;
    --card:       #1b212b;
    --card-hi:    #232b38;
    --border:     #2c3543;
    --text:       #eef2f7;
    --text-dim:   #c3ccd8;
    --text-muted: #8d99ab;

    --gold:       #f5c451;
    --gold-dim:   #c99b32;
    --gold-glow:  rgba(245, 196, 81, 0.4);
    --cyan:       #38d9a9;
    --loss:       #ff6b6b;
    --violet:     #9b8cf7;

    --radius:     16px;
    --shadow:     0 12px 34px rgba(0, 0, 0, 0.45);
    --wrap:       1080px;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html { scroll-behavior: smooth; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    font-size: 16px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

img, svg, canvas { max-width: 100%; }

a { color: var(--gold); text-decoration: none; }
a:hover { text-decoration: underline; }

.wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 18px; }
.wrap--narrow { max-width: 760px; }

.visually-hidden {
    position: absolute !important;
    width: 1px; height: 1px;
    padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0 0 0 0);
    white-space: nowrap; border: 0;
}

/* ---------------- Шапка ---------------- */

.site-header {
    position: sticky;
    top: 0;
    z-index: 50;
    background: rgba(14, 17, 22, 0.92);
    backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--border);
}

.site-header .wrap {
    display: flex;
    align-items: center;
    gap: 14px;
    min-height: 58px;
}

.brand {
    font-weight: 800;
    font-size: 18px;
    color: var(--text);
    letter-spacing: -0.2px;
    white-space: nowrap;
}
.brand b { color: var(--gold); }
.brand:hover { text-decoration: none; }

.nav-menu {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-left: auto;
}

.nav-menu a {
    padding: 8px 12px;
    border-radius: 10px;
    color: var(--text-muted);
    font-size: 14.5px;
    font-weight: 600;
}
.nav-menu a:hover { color: var(--text); background: var(--card); text-decoration: none; }
.nav-menu a.is-current { color: var(--gold); }

.nav-cta {
    padding: 8px 16px !important;
    border-radius: 999px !important;
    background: var(--gold);
    color: #1a1206 !important;
}
.nav-cta:hover { background: #ffd469; }

.balance-pill {
    padding: 6px 13px;
    border-radius: 999px;
    background: var(--card-hi);
    border: 1px solid var(--gold-dim);
    color: var(--gold);
    font-weight: 800;
    font-size: 13.5px;
    white-space: nowrap;
}
.balance-pill::before { content: '◈ '; opacity: 0.8; }

.nav-toggle {
    display: none;
    margin-left: auto;
    width: 40px; height: 36px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: var(--card);
    color: var(--text);
    font-size: 17px;
    cursor: pointer;
}

@media (max-width: 860px) {
    .nav-toggle { display: block; }
    .nav-menu {
        position: absolute;
        top: 100%; left: 0; right: 0;
        flex-direction: column;
        align-items: stretch;
        gap: 2px;
        margin: 0;
        padding: 10px 14px 16px;
        background: var(--bg-soft);
        border-bottom: 1px solid var(--border);
        display: none;
    }
    .nav-menu.is-open { display: flex; }
    .nav-menu a { padding: 11px 12px; }
    .nav-cta { text-align: center; margin-top: 6px; }
}

/* ---------------- Герой ---------------- */

.hero {
    padding: 54px 0 40px;
    background:
        radial-gradient(60% 120% at 50% -20%, rgba(245, 196, 81, 0.16), transparent 62%),
        radial-gradient(40% 90% at 90% 10%, rgba(56, 217, 169, 0.10), transparent 60%);
    text-align: center;
}

.hero-kicker {
    display: inline-block;
    padding: 5px 14px;
    border-radius: 999px;
    background: rgba(245, 196, 81, 0.13);
    border: 1px solid rgba(245, 196, 81, 0.28);
    color: var(--gold);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 1.3px;
    text-transform: uppercase;
}

.hero h1 {
    margin: 16px 0 12px;
    font-size: clamp(28px, 5.4vw, 46px);
    line-height: 1.14;
    letter-spacing: -0.5px;
}
.hero h1 b { color: var(--gold); font-weight: 800; }

.hero-sub {
    max-width: 620px;
    margin: 0 auto;
    color: var(--text-dim);
    font-size: clamp(15px, 2vw, 18px);
}

.hero-actions {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 24px;
}

.hero-facts {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 10px 26px;
    margin-top: 26px;
    color: var(--text-muted);
    font-size: 13.5px;
}
.hero-facts b { color: var(--text); }

/* ---------------- Кнопки ---------------- */

.btn {
    display: inline-block;
    padding: 13px 24px;
    border-radius: 999px;
    border: 1px solid transparent;
    font-size: 15px;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
    transition: transform 0.12s ease, box-shadow 0.2s ease, background 0.2s ease;
}
.btn:hover { text-decoration: none; }
.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: 0.5; cursor: default; }

.btn-gold {
    background: linear-gradient(180deg, var(--gold), var(--gold-dim));
    color: #1a1206;
    box-shadow: 0 8px 22px rgba(245, 196, 81, 0.24);
}
.btn-gold:hover { box-shadow: 0 8px 30px rgba(245, 196, 81, 0.42); }

.btn-ghost {
    background: transparent;
    border-color: var(--border);
    color: var(--text);
}
.btn-ghost:hover { background: var(--card); }

.btn-block { display: block; width: 100%; text-align: center; }
.btn-sm { padding: 9px 16px; font-size: 13.5px; }

/* ---------------- Секции ---------------- */

.section { padding: 46px 0; }
.section--soft { background: var(--bg-soft); border-block: 1px solid var(--border); }

.section-head { margin-bottom: 22px; }
.section-head h2 {
    margin: 0 0 6px;
    font-size: clamp(21px, 3.4vw, 29px);
    letter-spacing: -0.3px;
}
.section-head p { margin: 0; color: var(--text-muted); font-size: 15px; }

.section-head--split {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
}

/* ---------------- Задание дня ---------------- */

.daily-task {
    display: flex;
    align-items: center;
    gap: 18px;
    flex-wrap: wrap;
    padding: 20px 22px;
    border-radius: var(--radius);
    background: linear-gradient(120deg, rgba(245,196,81,0.13), rgba(56,217,169,0.09));
    border: 1px solid rgba(245, 196, 81, 0.3);
}

.daily-task-icon {
    flex: none;
    width: 50px; height: 50px;
    display: grid; place-items: center;
    border-radius: 14px;
    background: rgba(245, 196, 81, 0.16);
    font-size: 24px;
}
.daily-task-body { flex: 1 1 240px; min-width: 0; }
.daily-task-label {
    margin: 0;
    font-size: 11.5px;
    letter-spacing: 1.6px;
    text-transform: uppercase;
    color: var(--gold);
    font-weight: 700;
}
.daily-task-body h3 { margin: 3px 0 2px; font-size: 18px; }
.daily-task-body p { margin: 0; color: var(--text-muted); font-size: 14px; }

/* ---------------- Сетки карточек ---------------- */

.grid {
    display: grid;
    gap: 16px;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
}
.grid--wide { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }

.card {
    display: flex;
    flex-direction: column;
    padding: 20px;
    border-radius: var(--radius);
    background: var(--card);
    border: 1px solid var(--border);
    transition: border-color 0.18s ease, transform 0.18s ease;
}
a.card:hover {
    border-color: var(--gold-dim);
    transform: translateY(-2px);
    text-decoration: none;
}

.card-icon {
    width: 46px; height: 46px;
    display: grid; place-items: center;
    border-radius: 13px;
    background: var(--card-hi);
    font-size: 23px;
    margin-bottom: 12px;
}

.card h3 { margin: 0 0 6px; font-size: 17px; color: var(--text); }
.card p  { margin: 0; color: var(--text-muted); font-size: 14px; flex: 1; }

.card-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 14px;
    font-size: 12px;
    color: var(--text-muted);
}

.tag {
    padding: 3px 10px;
    border-radius: 999px;
    background: var(--card-hi);
    border: 1px solid var(--border);
    font-size: 11.5px;
    color: var(--text-muted);
}
.tag--gold  { color: var(--gold);   border-color: rgba(245,196,81,0.35); }
.tag--cyan  { color: var(--cyan);   border-color: rgba(56,217,169,0.35); }
.tag--violet{ color: var(--violet); border-color: rgba(155,140,247,0.35); }

/* ---------------- Хлебные крошки ---------------- */

.breadcrumbs {
    padding: 16px 0 0;
    font-size: 13px;
    color: var(--text-muted);
}
.breadcrumbs ol {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 0;
    padding: 0;
    list-style: none;
}
.breadcrumbs li::after { content: '›'; margin-left: 6px; opacity: 0.6; }
.breadcrumbs li:last-child::after { content: ''; }
.breadcrumbs a { color: var(--text-muted); }
.breadcrumbs a:hover { color: var(--gold); }

/* ---------------- Рекламные слоты ---------------- */

.ad-slot {
    margin: 22px auto;
    max-width: var(--wrap);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius);
    overflow: hidden;
}
.ad-slot--rect   { min-height: 250px; }
.ad-slot--banner { min-height: 100px; }
.ad-slot--empty  { min-height: 0; margin: 0; }

.ad-slot--placeholder {
    border: 1px dashed var(--border);
    background: repeating-linear-gradient(45deg, transparent, transparent 10px, rgba(255,255,255,0.02) 10px, rgba(255,255,255,0.02) 20px);
}
.ad-placeholder-note { color: var(--text-muted); font-size: 12px; }
.yan-ad-unit { width: 100%; }

/* ---------------- Статьи и текстовые страницы ---------------- */

.article { padding: 10px 0 50px; }
.article h1 { font-size: clamp(26px, 4.6vw, 38px); margin: 18px 0 8px; letter-spacing: -0.4px; }
.article h2 { font-size: clamp(19px, 3vw, 24px); margin: 34px 0 10px; color: var(--gold); }
.article h3 { font-size: 17px; margin: 24px 0 6px; }
.article p, .article li { color: var(--text-dim); }
.article ul, .article ol { padding-left: 22px; }
.article li { margin-bottom: 7px; }

.lead { font-size: 17.5px; color: var(--text-dim); }

.callout {
    margin: 22px 0;
    padding: 16px 18px;
    border-radius: var(--radius);
    background: var(--card);
    border: 1px solid var(--border);
    border-left: 3px solid var(--gold);
}
.callout p:first-child { margin-top: 0; }
.callout p:last-child { margin-bottom: 0; }
.callout--warn { border-left-color: var(--loss); }

.updated { color: var(--text-muted); font-size: 13px; margin: 0 0 8px; }

/* ---------------- FAQ ---------------- */

.faq-item {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--card);
    margin-bottom: 10px;
    overflow: hidden;
}
.faq-item summary {
    padding: 16px 18px;
    cursor: pointer;
    font-weight: 600;
    font-size: 15.5px;
    list-style: none;
    display: flex;
    align-items: center;
    gap: 10px;
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after {
    content: '+';
    margin-left: auto;
    color: var(--gold);
    font-size: 20px;
    line-height: 1;
    flex: none;
}
.faq-item[open] summary::after { content: '−'; }
.faq-item .faq-answer { padding: 0 18px 16px; color: var(--text-dim); font-size: 14.5px; }
.faq-item .faq-answer > :first-child { margin-top: 0; }

/* ---------------- Страница игры ---------------- */

.game-layout { padding: 8px 0 40px; }

.game-head { text-align: center; margin-bottom: 16px; }
.game-head h1 { font-size: clamp(23px, 4vw, 32px); margin: 12px 0 6px; }
.game-head p  { margin: 0 auto; max-width: 560px; color: var(--text-muted); font-size: 14.5px; }

.game-stage {
    max-width: 560px;
    margin: 0 auto;
    border-radius: var(--radius);
    background: var(--card);
    border: 1px solid var(--border);
    overflow: hidden;
}

.game-hud {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 11px 15px;
    background: var(--bg-soft);
    border-bottom: 1px solid var(--border);
    font-size: 13.5px;
    font-weight: 600;
}
.game-hud span b { color: var(--gold); font-variant-numeric: tabular-nums; }
.game-hud .hud-timer.is-low b { color: var(--loss); }

.game-board {
    position: relative;
    min-height: 380px;
    display: grid;
    place-items: center;
    padding: 16px;
}
.game-board canvas {
    display: block;
    width: 100%;
    height: auto;
    border-radius: 10px;
    touch-action: none;
}

.game-overlay {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    padding: 22px;
    text-align: center;
    background: rgba(14, 17, 22, 0.93);
    z-index: 5;
}
.game-overlay h2 { margin: 0 0 6px; font-size: 22px; }
.game-overlay p  { margin: 0 0 14px; color: var(--text-muted); font-size: 14.5px; }
.game-overlay .btn { margin: 4px; }

.game-score-big {
    font-size: 46px;
    font-weight: 800;
    color: var(--gold);
    line-height: 1.1;
    text-shadow: 0 0 24px var(--gold-glow);
}

.game-actions {
    display: flex;
    justify-content: center;
    gap: 8px;
    flex-wrap: wrap;
    padding: 14px;
    border-top: 1px solid var(--border);
}

/* Игровые поля на DOM (карточки, кнопки вариантов) */
.play-grid { display: grid; gap: 10px; width: 100%; }
.play-grid--2 { grid-template-columns: repeat(2, 1fr); }
.play-grid--3 { grid-template-columns: repeat(3, 1fr); }
.play-grid--4 { grid-template-columns: repeat(4, 1fr); }

.play-question {
    text-align: center;
    font-size: 18px;
    line-height: 1.35;
    margin-bottom: 16px;
}
.play-hint { text-align: center; color: var(--text-muted); font-size: 13px; margin-bottom: 12px; }

.play-btn {
    padding: 15px 14px;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: var(--bg-soft);
    color: var(--text);
    font-size: 15px;
    font-family: inherit;
    cursor: pointer;
    transition: border-color 0.15s ease, background 0.15s ease;
    text-align: center;
}
.play-btn:hover:not(:disabled) { border-color: var(--gold-dim); background: var(--card-hi); }
.play-btn.is-correct { border-color: var(--cyan); background: rgba(56, 217, 169, 0.16); }
.play-btn.is-wrong   { border-color: var(--loss); background: rgba(255, 107, 107, 0.14); }
.play-btn:disabled { cursor: default; }

.memory-card {
    aspect-ratio: 3 / 4;
    display: grid;
    place-items: center;
    padding: 8px;
    font-size: 12.5px;
    line-height: 1.25;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: var(--card-hi);
    color: transparent;
    cursor: pointer;
    font-family: inherit;
    transition: background 0.18s ease, border-color 0.18s ease;
}
.memory-card::after { content: '◈'; color: var(--gold); font-size: 22px; }
.memory-card.is-open, .memory-card.is-done {
    color: var(--text);
    background: var(--bg-soft);
    border-color: var(--gold-dim);
}
.memory-card.is-open::after, .memory-card.is-done::after { content: ''; }
.memory-card.is-done { opacity: 0.45; border-color: var(--cyan); cursor: default; }

.swipe-card {
    width: 100%;
    padding: 20px 18px;
    border-radius: 14px;
    background: var(--bg-soft);
    border: 1px solid var(--border);
    font-size: 15px;
    line-height: 1.45;
    color: var(--text-dim);
    margin-bottom: 16px;
}
.swipe-card b { color: var(--text); }

/* ---------------- Калькулятор ---------------- */

.calc {
    max-width: 620px;
    margin: 0 auto;
    padding: 22px;
    border-radius: var(--radius);
    background: var(--card);
    border: 1px solid var(--border);
}

.calc-field { margin-bottom: 16px; }
.calc-field label {
    display: block;
    margin-bottom: 6px;
    font-size: 13.5px;
    color: var(--text-muted);
    font-weight: 600;
}
.calc-field input[type="number"], .calc-field select {
    width: 100%;
    padding: 12px 14px;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: var(--bg-soft);
    color: var(--text);
    font-size: 16px;
    font-family: inherit;
}
.calc-field input:focus, .calc-field select:focus {
    outline: none;
    border-color: var(--gold-dim);
}
.calc-field input[type="range"] { width: 100%; accent-color: var(--gold); }
.calc-hint { font-size: 12px; color: var(--text-muted); margin-top: 5px; }

.calc-result {
    margin-top: 20px;
    padding: 20px;
    border-radius: var(--radius);
    background: var(--bg-soft);
    border: 1px solid var(--gold-dim);
    text-align: center;
}
.calc-result-label { font-size: 12px; letter-spacing: 1.5px; text-transform: uppercase; color: var(--text-muted); }
.calc-result-value {
    font-size: clamp(28px, 6vw, 40px);
    font-weight: 800;
    color: var(--gold);
    line-height: 1.15;
    text-shadow: 0 0 22px var(--gold-glow);
    font-variant-numeric: tabular-nums;
}

.calc-breakdown {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 10px;
    margin-top: 16px;
}
.calc-breakdown div {
    padding: 12px;
    border-radius: 12px;
    background: var(--card);
    border: 1px solid var(--border);
}
.calc-breakdown span { display: block; font-size: 11.5px; color: var(--text-muted); }
.calc-breakdown b { font-size: 17px; color: var(--text); font-variant-numeric: tabular-nums; }

.calc-table { width: 100%; border-collapse: collapse; margin-top: 18px; font-size: 13.5px; }
.calc-table th, .calc-table td { padding: 9px 10px; text-align: right; border-bottom: 1px solid var(--border); }
.calc-table th { color: var(--text-muted); font-weight: 600; font-size: 12px; }
.calc-table td:first-child, .calc-table th:first-child { text-align: left; }
.calc-table-wrap { overflow-x: auto; }

/* ---------------- Подвал ---------------- */

.site-footer {
    margin-top: 40px;
    padding: 40px 0 34px;
    background: var(--bg-soft);
    border-top: 1px solid var(--border);
    font-size: 14px;
}

.footer-grid {
    display: grid;
    gap: 26px;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}
.footer-grid h4 {
    margin: 0 0 10px;
    font-size: 13px;
    letter-spacing: 1.2px;
    text-transform: uppercase;
    color: var(--text-muted);
}
.footer-grid ul { list-style: none; margin: 0; padding: 0; }
.footer-grid li { margin-bottom: 7px; }
.footer-grid a { color: var(--text-dim); font-size: 14px; }
.footer-grid a:hover { color: var(--gold); }

.footer-note {
    margin-top: 28px;
    padding-top: 20px;
    border-top: 1px solid var(--border);
    color: var(--text-muted);
    font-size: 12.5px;
}

@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    a.card:hover { transform: none; }
    .btn:active { transform: none; }
}
