/* =========================================
   1. Переменные (Ночной режим по умолчанию + Дневной)
   ========================================= */
:root {
    --bg: #0b110d;
    --card: #131c16;
    --card-soft: #1a261e;
    --text: #eef3f0;
    --muted: #98aba0;
    --border: #26382c;
    --brand: #043906;
    --brand-grad: linear-gradient(to right, rgb(24, 65, 0) 0%, rgb(45, 0, 0) 100%);
    --accent: #ffd500;
    --accent-soft: rgba(255, 213, 0, 0.14);
    --link: #ffd500;
    --ok: #4ade80;
    --shadow: 0 8px 24px rgba(0, 0, 0, 0.38);
}

body.day-mode {
    --bg: #f2f5f3;
    --card: #ffffff;
    --card-soft: #f7faf8;
    --text: #18231d;
    --muted: #5a6c62;
    --border: #dce4df;
    --brand: #043906;
    --brand-grad: linear-gradient(to right, #1b4d1a 0%, #4d1919 100%);
    --accent: #1b5e20;
    --accent-soft: rgba(27, 94, 32, 0.1);
    --link: #1b5e20;
    --ok: #15803d;
    --shadow: 0 6px 20px rgba(15, 23, 42, 0.06);
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    padding: 0;
    overflow-x: hidden;
    max-width: 100%;
}

body {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    font-size: 15px;
    line-height: 1.55;
    transition: background 0.25s ease, color 0.25s ease;
}

/* =========================================
   2. Шапка и навигация (откреплена везде)
   ========================================= */
.site-header {
    background: var(--brand-grad);
    border-bottom: 1px solid #6b6d19;
    width: 100%;
}

.header-inner {
    max-width: 1180px;
    margin: 0 auto;
    padding: 0 20px;
    min-height: 62px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.logo {
    font-size: 21px;
    font-weight: 900;
    letter-spacing: 2px;
    color: #ffd500;
    text-decoration: none;
}

.main-nav {
    display: flex;
    align-items: center;
    gap: 18px;
}

.nav-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    align-items: center;
    gap: 18px;
}

.nav-list a {
    color: #ffd500;
    text-decoration: none;
    font-size: 14px;
    font-weight: 700;
    transition: color 0.2s;
    white-space: nowrap;
}

.nav-list a:hover,
.nav-list a.active {
    color: #ffffff;
}

.theme-toggle,
.menu-toggle {
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 213, 0, 0.45);
    color: #ffd500;
    width: 36px;
    height: 36px;
    border-radius: 8px;
    font-size: 17px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.menu-toggle {
    display: none;
    font-size: 20px;
}

/* =========================================
   3. Основной контент и карточки
   ========================================= */
.main-wrap {
    flex: 1 0 auto;
    width: 100%;
    max-width: 1100px;
    margin: 0 auto;
    padding: 26px 16px 46px;
}

.card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 22px;
    margin-bottom: 18px;
    box-shadow: var(--shadow);
}

.hero-card {
    text-align: center;
}

.hero-card h1 {
    margin: 0 0 8px;
    font-size: clamp(24px, 3.5vw, 34px);
    color: var(--accent);
}

.hero-card p {
    margin: 0 auto 18px;
    max-width: 660px;
    color: var(--muted);
    font-size: 15px;
}

.mode-tabs {
    display: flex;
    justify-content: center;
    gap: 10px;
    flex-wrap: wrap;
}

.tab-btn {
    padding: 9px 18px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: var(--card-soft);
    color: var(--text);
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
}

.tab-btn.active {
    background: var(--accent);
    color: #0b110d;
    border-color: var(--accent);
}

body.day-mode .tab-btn.active {
    color: #ffffff;
}

.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* Форма */
.date-form {
    display: flex;
    align-items: flex-end;
    gap: 14px;
    flex-wrap: wrap;
}

.field {
    flex: 1 1 200px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.field label {
    font-size: 13px;
    font-weight: 600;
    color: var(--muted);
}

.field input {
    padding: 11px 14px;
    border-radius: 9px;
    border: 1px solid var(--border);
    background: var(--card-soft);
    color: var(--text);
    font-size: 15px;
    font-family: inherit;
    outline: none;
}

.field input:focus {
    border-color: var(--accent);
}

.form-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.btn {
    padding: 11px 22px;
    border-radius: 9px;
    border: 1px solid var(--border);
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: opacity 0.2s, transform 0.15s;
}

.btn:hover { opacity: 0.92; }

.btn-primary {
    background: var(--accent);
    color: #0b110d;
    border-color: transparent;
}

body.day-mode .btn-primary {
    color: #ffffff;
}

.btn-sec {
    background: var(--card-soft);
    color: var(--text);
}

.hidden { display: none !important; }

.error-box {
    margin-top: 14px;
    padding: 12px 14px;
    border-radius: 9px;
    background: rgba(220, 38, 38, 0.15);
    border: 1px solid rgba(220, 38, 38, 0.4);
    color: #f87171;
    font-weight: 600;
    font-size: 14px;
}

body.day-mode .error-box {
    color: #b91c1c;
}

/* Главная карточка результата */
.main-result-card {
    text-align: center;
    border-top: 4px solid var(--accent);
}

.main-days-label {
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--muted);
}

.main-days-value {
    font-size: clamp(32px, 6vw, 52px);
    font-weight: 900;
    color: var(--accent);
    margin: 6px 0;
    line-height: 1.15;
}

.main-exact-age {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 8px;
}

.birth-meta {
    font-size: 13.5px;
    color: var(--muted);
}

/* Сетка живых счётчиков */
.metrics-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 14px;
    margin-bottom: 18px;
}

.metric-card {
    margin-bottom: 0;
    text-align: center;
    padding: 16px 12px;
}

.m-label {
    display: block;
    font-size: 12.5px;
    color: var(--muted);
    margin-bottom: 6px;
}

.m-val {
    font-size: 20px;
    font-weight: 800;
    word-break: break-word;
}

.live-sec {
    color: var(--ok);
}

/* Заголовки секций */
.section-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 14px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border);
}

.section-head h2 {
    margin: 0;
    font-size: 18px;
}

.badge {
    font-size: 12px;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: 999px;
    background: var(--accent-soft);
    color: var(--accent);
}

/* Прогресс года */
.bday-info {
    margin: 0 0 12px;
    font-size: 15px;
}

.progress-bar {
    width: 100%;
    height: 12px;
    background: var(--card-soft);
    border: 1px solid var(--border);
    border-radius: 999px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #16a34a, #ffd500);
    transition: width 0.5s ease;
}

.progress-caption {
    display: flex;
    justify-content: space-between;
    margin-top: 6px;
    font-size: 12.5px;
    color: var(--muted);
}

/* Сетки юбилеев, фактов и планет */
.milestones-grid,
.facts-grid,
.planets-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
    gap: 12px;
}

.info-tile {
    background: var(--card-soft);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.info-tile.is-past {
    opacity: 0.72;
}

.info-tile.is-next {
    border-color: var(--accent);
}

.tile-top {
    font-size: 13px;
    color: var(--muted);
    font-weight: 600;
}

.tile-val {
    font-size: 18px;
    font-weight: 800;
}

.tile-sub {
    font-size: 12px;
    color: var(--muted);
}

/* Сравнение дат */
.compare-result {
    margin-top: 18px;
    padding: 18px;
    border-radius: 12px;
    background: var(--card-soft);
    border: 1px solid var(--border);
    text-align: center;
}

.compare-big {
    font-size: 24px;
    font-weight: 800;
    color: var(--accent);
    margin-bottom: 6px;
}

/* Цитата */
.quote-card {
    text-align: center;
}

.quote-text {
    font-size: 17px;
    font-weight: 700;
    color: var(--accent);
    margin: 0 0 6px;
}

.quote-sub {
    margin: 0;
    font-size: 13.5px;
    color: var(--muted);
}

/* =========================================
   4. Футер (откреплен на всех устройствах)
   ========================================= */
.site-footer {
    background: var(--brand-grad);
    border-top: 1px solid #6b6d19;
    padding: 18px 20px;
    font-size: 14px;
    color: #e2e8e4;
    margin-top: auto;
}

.footer-inner {
    max-width: 1180px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
}

.site-footer a {
    color: #ffd500;
    text-decoration: none;
    margin: 0 4px;
}

.site-footer a:hover {
    color: #ffffff;
}

/* =========================================
   5. Адаптив: смартфоны и планшеты (<= 820px)
   Горизонтальное мобильное меню
   ========================================= */
@media (max-width: 820px) {
    .header-inner {
        padding: 10px 16px;
        flex-wrap: wrap;
        gap: 10px;
    }

    .menu-toggle {
        display: inline-flex;
    }

    .main-nav {
        display: none;
        width: 100%;
        padding: 12px 0 4px;
        border-top: 1px solid rgba(255, 255, 255, 0.15);
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: center;
        align-items: center;
        gap: 10px 12px;
    }

    .main-nav.show {
        display: flex;
    }

    .nav-list {
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: center;
        gap: 8px;
    }

    .nav-list a {
        display: inline-block;
        padding: 6px 10px;
        border-radius: 6px;
        background: rgba(255, 255, 255, 0.08);
        font-size: 13px;
    }

    .metrics-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .form-actions {
        width: 100%;
    }

    .form-actions .btn {
        flex: 1;
    }

    .footer-inner {
        flex-direction: column;
        text-align: center;
    }
}

/* =========================================
   6. Адаптив: большие мониторы и ТВ (Full HD / 4K)
   ========================================= */
@media (min-width: 1600px) {
    body { font-size: 17px; }
    .main-wrap { max-width: 1320px; }
    .header-inner, .footer-inner { max-width: 1400px; }
}

@media (min-width: 2400px) {
    body { font-size: 21px; }
    .main-wrap { max-width: 1750px; }
    .header-inner, .footer-inner { max-width: 1800px; }
    .nav-list a { font-size: 19px; }
}