:root {
    --color-black: #000000;
    --color-white: #ffffff;
    --color-gold: #d4af37;
    --color-brown: #4e342e;

    --bg-dark: #050608;
    --bg-light: #f5f5f5;

    --text-dark: #fefefe;
    --text-light: #111111;

    --shadow-3d-dark: 0 8px 20px rgba(0,0,0,0.6);
    --shadow-3d-light: 0 8px 20px rgba(0,0,0,0.25);

    --transition-fast: 0.2s ease;
    --transition-normal: 0.3s ease;
}

/* Темы */

body.theme-dark {
    background: radial-gradient(circle at top, #222, #000);
    color: var(--text-dark);
}

body.theme-light {
    background: radial-gradient(circle at top, #ffffff, #dddddd);
    color: var(--text-light);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html, body {
    height: 100%;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.page-container {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Верхний футер (общий каркас) */

.top-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 16px;
    background: rgba(0,0,0,0.6);
    color: var(--color-gold);
    box-shadow: 0 2px 8px rgba(0,0,0,0.7);
    backdrop-filter: blur(10px);
}

body.theme-light .top-footer {
    background: rgba(255,255,255,0.9);
    color: var(--color-brown);
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

.top-left, .top-center, .top-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

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

.geo-flag {
    width: 24px;
    height: 16px;
    background-size: cover;
    background-position: center;
    border-radius: 3px;
    box-shadow: var(--shadow-3d-dark);
}

body.theme-light .geo-flag {
    box-shadow: var(--shadow-3d-light);
}

.geo-city {
    min-width: 150px;
    font-size: 0.9rem;
}

/* Переключатель темы (шапка, неавторизованный) */

.theme-switcher {
    display: flex;
    align-items: center;
    gap: 8px;
}

.theme-label {
    font-size: 0.9rem;
}

.theme-slider {
    position: relative;
    width: 52px;
    height: 26px;
    display: inline-block;
}

.theme-slider input {
    opacity: 0;
    width: 0;
    height: 0;
}

.theme-slider .slider {
    position: absolute;
    cursor: pointer;
    inset: 0;
    background: linear-gradient(135deg, #333, #000);
    border-radius: 999px;
    box-shadow: var(--shadow-3d-dark);
    transition: background var(--transition-normal), box-shadow var(--transition-normal);
}

body.theme-light .theme-slider .slider {
    background: linear-gradient(135deg, #fff, #ddd);
    box-shadow: var(--shadow-3d-light);
}

.theme-slider .slider::before {
    content: "";
    position: absolute;
    height: 20px;
    width: 20px;
    left: 3px;
    top: 3px;
    background: radial-gradient(circle at 30% 30%, #fff, #ccc);
    border-radius: 50%;
    box-shadow: 0 4px 10px rgba(0,0,0,0.6);
    transition: transform var(--transition-normal);
}

.theme-slider input:checked + .slider::before {
    transform: translateX(24px);
}

/* Основная раскладка (ПК по умолчанию) */

.main-layout {
    flex: 1;
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 2fr) minmax(0, 1fr);
    gap: 16px;
    padding: 16px;
}

.side-block {
    min-height: 200px;
    background: rgba(0,0,0,0.35);
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.6);
    backdrop-filter: blur(6px);
}

body.theme-light .side-block {
    background: rgba(255,255,255,0.85);
    box-shadow: var(--shadow-3d-light);
}

.center-block {
    display: flex;
    justify-content: center;
    align-items: center;
    background: radial-gradient(circle at top, rgba(212,175,55,0.3), rgba(0,0,0,0.8));
    border-radius: 16px;
    box-shadow: 0 16px 40px rgba(0,0,0,0.8);
    text-align: center;
}

body.theme-light .center-block {
    background: radial-gradient(circle at top, rgba(212,175,55,0.25), #ffffff);
    box-shadow: var(--shadow-3d-light);
}

/* Кнопки 3D с сиянием */

.btn-3d {
    position: relative;
    padding: 14px 30px;
    border-radius: 999px;
    border: none;
    font-size: 1rem;
    cursor: pointer;
    color: var(--color-black);
    text-transform: uppercase;
    letter-spacing: 1px;
    transition: transform var(--transition-fast), box-shadow var(--transition-fast), background var(--transition-fast);
    box-shadow: 0 12px 25px rgba(0,0,0,0.7);
    background: linear-gradient(135deg, #f7e39a, #d4af37);
    overflow: hidden;
}

.btn-3d.primary {
    background: linear-gradient(135deg, #f7e39a, #d4af37);
}

.btn-3d.secondary {
    background: linear-gradient(135deg, #c0a17b, #4e342e);
    color: #fff;
}

/* Сияние снизу, даже без нажатия */
.btn-3d::after {
    content: "";
    position: absolute;
    left: 50%;
    bottom: -30%;
    width: 160%;
    height: 80%;
    transform: translateX(-50%);
    background: radial-gradient(circle, rgba(255,255,255,0.6), transparent 60%);
    opacity: 0.8;
    pointer-events: none;
    filter: blur(10px);
}

.btn-3d:hover {
    transform: translateY(-2px);
    box-shadow: 0 16px 30px rgba(0,0,0,0.85);
}

/* Центральная зона для неавторизованного */

.auth-entry {
    text-align: center;
}

/* Нижний футер */

.bottom-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 16px;
    background: rgba(0,0,0,0.9);
    color: var(--color-gold);
    font-size: 0.85rem;
}

body.theme-light .bottom-footer {
    background: rgba(255,255,255,0.95);
    color: var(--color-brown);
}

.bottom-center {
    text-align: center;
    flex: 1;
    margin: 0 12px;
}

/* Переключатель языка (кнопки-флаги) */

.lang-switcher {
    display: flex;
    gap: 4px;
}

.lang-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    border: none;
    background: transparent;
    cursor: pointer;
    color: inherit;
    padding: 4px 6px;
    border-radius: 999px;
    transition: background var(--transition-fast);
    font-size: 0.85rem;
}

.lang-btn:hover {
    background: rgba(255,255,255,0.1);
}

.flag {
    width: 20px;
    height: 14px;
    background-size: cover;
    background-position: center;
    border-radius: 2px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.7);
}

/* PNG-флаги языков */
.flag-ru { background-image: url('/assets/img/flags/ru.png'); }
.flag-en { background-image: url('/assets/img/flags/en.png'); }
.flag-zh { background-image: url('/assets/img/flags/zh.png'); }

/* Модалки (общие) */

.modal {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 50;
}

.modal.hidden {
    display: none;
}

.modal-content {
    background: #111;
    border-radius: 16px;
    padding: 20px;
    max-width: 500px;
    width: 100%;
    color: #fff;
    box-shadow: 0 16px 40px rgba(0,0,0,0.8);
    position: relative;
    max-height: 90vh;
    overflow-y: auto;
}

body.theme-light .modal-content {
    background: #fafafa;
    color: #111;
    box-shadow: var(--shadow-3d-light);
}

.modal-close {
    position: absolute;
    right: 12px;
    top: 8px;
    border: none;
    background: transparent;
    color: inherit;
    font-size: 1.4rem;
    cursor: pointer;
}

.auth-step {
    margin-top: 16px;
}

.auth-choice-buttons {
    display: flex;
    justify-content: center;
    gap: 16px;
    margin-top: 20px;
}

.password-wrapper {
    position: relative;
}

.password-wrapper input {
    width: 100%;
    padding-right: 30px;
}

.toggle-password {
    position: absolute;
    right: 6px;
    top: 50%;
    transform: translateY(-50%);
    cursor: pointer;
}

/* Формы */

form label {
    display: block;
    margin-bottom: 10px;
    font-size: 0.95rem;
}

form input, form select {
    width: 100%;
    padding: 6px 8px;
    border-radius: 8px;
    border: 1px solid rgba(255,255,255,0.3);
    background: rgba(0,0,0,0.5);
    color: #fff;
}

body.theme-light form input,
body.theme-light form select {
    background: #ffffff;
    border: 1px solid #ccc;
    color: #111;
}

.gender-group {
    display: flex;
    gap: 12px;
    margin-top: 4px;
}

.gender-group label {
    margin-bottom: 0;
}

.field-status {
    display: block;
    font-size: 0.8rem;
    margin-top: 2px;
}

.form-error {
    margin-top: 8px;
    color: #ff6b6b;
    min-height: 18px;
}

/* Документы в модалке */

.doc-modal-content {
    max-width: 800px;
}

/* Cookie-баннер */

.cookie-banner {
    position: fixed;
    left: 10px;
    right: 10px;
    bottom: 10px;
    background: rgba(0,0,0,0.9);
    color: #fff;
    border-radius: 16px;
    padding: 16px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.8);
    z-index: 60;
}

body.theme-light .cookie-banner {
    background: rgba(255,255,255,0.95);
    color: #111;
}

.cookie-banner.hidden {
    display: none;
}

.cookie-actions {
    margin-top: 10px;
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

/* -------- Авторизованный верхний футер -------- */

.top-left-auth {
    display: flex;
    align-items: center;
    gap: 6px;
}

.user-nickname {
    font-weight: 600;
}

.user-gender, .user-age {
    font-size: 0.9rem;
}

/* Баланс */

.top-center-auth {
    display: flex;
    flex-direction: row;
    gap: 6px;
    justify-content: center;
    align-items: baseline;
}

.user-balance-label {
    font-size: 0.9rem;
    opacity: 0.8;
}

.user-balance-value {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--color-gold);
}

/* Бургер */

.burger-button {
    width: 32px;
    height: 28px;
    border: none;
    background: transparent;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 4px 2px;
    cursor: pointer;
}

.burger-line {
    height: 3px;
    border-radius: 999px;
    background: var(--color-gold);
}

/* Выплывающее бургер-меню */

.burger-menu {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.7);
    z-index: 40;
    display: flex;
    justify-content: flex-end;
}

.burger-menu.hidden {
    display: none;
}

.burger-menu-content {
    width: 260px;
    max-width: 80%;
    background: #111;
    color: #fff;
    box-shadow: -8px 0 20px rgba(0,0,0,0.8);
    padding: 16px;
}

body.theme-light .burger-menu-content {
    background: #fafafa;
    color: #111;
}

.burger-menu-content ul {
    list-style: none;
}

.burger-menu-content li {
    padding: 10px 8px;
    cursor: pointer;
    border-radius: 8px;
    transition: background 0.2s ease;
}

.burger-menu-content li:hover {
    background: rgba(255,255,255,0.08);
}

/* Карусель (авторизованный центр) */

.menu-carousel {
    width: 100%;
    height: 100%;
    overflow: hidden;
    position: relative;
}

.menu-carousel-track {
    display: flex;
    width: 100%;
    height: 100%;
    transition: transform 0.5s ease;
}

.menu-card {
    flex: 0 0 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    padding: 20px;
}

.menu-card-inner {
    width: 100%;
    max-width: 480px;
    padding: 40px 20px;
    border-radius: 18px;
    background: linear-gradient(145deg, rgba(212,175,55,0.25), rgba(0,0,0,0.85));
    color: #fff;
    text-align: center;
    box-shadow: 0 16px 40px rgba(0,0,0,0.9);
}

body.theme-light .menu-card-inner {
    background: linear-gradient(145deg, rgba(212,175,55,0.15), #ffffff);
    color: #111;
    box-shadow: var(--shadow-3d-light);
}

/* Общий стиль заголовков (ПК) */
.menu-card-inner h2 {
    font-size: 1.6rem;
    letter-spacing: 1px;
}

/* Универсальная карточка с видео (для всех разделов с mp4) */

.menu-card-inner-video {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
}

.menu-card-video-wrapper {
    position: relative;
    width: 100%;
    max-width: 420px;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 10px 25px rgba(0,0,0,0.8);
}

.menu-card-video {
    display: block;
    width: 100%;
    height: auto;
    object-fit: cover;
}

/* Оверлей заголовка поверх видео */

.menu-card-title-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;

    background: rgba(0, 0, 0, 0.10);  /* полупрозрачный фон ~10% */
    pointer-events: none;
}

.menu-card-title-overlay h2 {
    margin: 0;
    padding: 8px 12px;
    font-size: 1.6rem;
    letter-spacing: 1px;
    color: #fff;
    text-shadow: 0 2px 4px rgba(0,0,0,0.8);
}

/* Иконка настроек (авторизованный нижний футер) — PNG шестерёнка */

.settings-button {
    border: none;
    background: transparent;
    cursor: pointer;
    padding: 4px;
}

.settings-icon {
    display: block;
    width: 24px;
    height: 24px;
    background-image: url('/assets/img/setting.png');
    background-size: cover;
    background-position: center;
}

/* Секции настроек */

.settings-section {
    margin-top: 16px;
}

.settings-section h3 {
    margin-bottom: 8px;
}

/* ---------- Адаптивность ---------- */

/* Планшеты и небольшие ноутбуки */
@media (max-width: 1024px) {
    .main-layout {
        grid-template-columns: 1fr;
        grid-template-rows: auto auto auto;
    }

    .side-block {
        min-height: 120px;
        padding: 12px;
    }

    .center-block {
        min-height: 340px;
        padding: 20px;
    }

    .top-footer {
        padding: 8px 12px;
    }

    .top-left-auth,
    .top-center-auth,
    .top-right-auth {
        justify-content: center;
    }
}

/* Смартфоны — портрет (главный адаптив по высоте/ширине) */
@media (max-width: 600px) and (orientation: portrait) {
    html, body {
        height: 100%;
    }

    body {
        font-size: 15px;
    }

    .page-container {
        min-height: 100vh;
        display: flex;
        flex-direction: column;
    }

    /* Верхний футер: центр и компактность */
    .top-footer {
        flex-direction: column;
        justify-content: center;
        align-items: center;
        text-align: center;

        padding: 6px 8px;
        font-size: 0.85rem;

        flex-shrink: 0;
    }

    .top-left, .top-center, .top-right,
    .top-left-auth, .top-center-auth, .top-right-auth {
        width: 100%;
        display: flex;
        justify-content: center;
        flex-wrap: wrap;
    }

    .top-left-auth span {
        font-size: 0.85rem;
    }

    .user-balance-label {
        font-size: 0.8rem;
    }

    .user-balance-value {
        font-size: 0.95rem;
    }

    .burger-button {
        width: 32px;
        height: 28px;
        padding: 2px;
    }

    /* Основной layout: центральный блок «середина» между футерами */
    .main-layout {
        flex: 1 1 auto;
        display: flex;
        flex-direction: column;
        padding: 6px;
        gap: 6px;
    }

    .side-block {
        min-height: 60px;
        padding: 6px;
        border-radius: 10px;
    }

    .center-block {
        flex: 1 1 auto;
        min-height: 200px;
        padding: 6px;
        border-radius: 16px;

        display: flex;
        justify-content: center;
        align-items: center;
    }

    /* Карусель в центре: ограничиваем ширину, центрируем */
    .menu-carousel {
        width: 100%;
        max-width: 480px;
        margin: 0 auto;
        height: 100%;

        display: flex;
        align-items: center;
        justify-content: center;
    }

    .menu-carousel-track {
        height: auto;
    }

    .menu-card {
        padding: 0;
    }

    .menu-card-inner {
        max-width: 100%;
        padding: 16px 12px;
        border-radius: 16px;
        margin: 0 auto;
    }

    .menu-card-inner-video {
        gap: 10px;
    }

    .menu-card-video-wrapper {
        max-width: 100%;
        border-radius: 12px;
        box-shadow: 0 6px 16px rgba(0,0,0,0.7);
    }

    .menu-card-title-overlay h2 {
        font-size: 1.2rem;
        padding: 6px 10px;
    }

    /* Нижний футер: тоже центрированный */
    .bottom-footer {
        flex-direction: column;
        justify-content: center;
        align-items: center;
        text-align: center;

        padding: 6px 8px;
        font-size: 0.85rem;

        flex-shrink: 0;
    }

    .bottom-left,
    .bottom-center,
    .bottom-right {
        width: 100%;
        display: flex;
        justify-content: center;
    }

    /* Кнопки, флаги, иконка настроек — крупнее и по центру */
    .btn-3d {
        width: 100%;
        max-width: 280px;
        font-size: 0.95rem;
        padding: 12px 20px;
    }

    .lang-switcher {
        justify-content: center;
    }

    .settings-icon {
        width: 26px;
        height: 26px;
    }

    .flag {
        width: 22px;
        height: 16px;
    }

    .geo-flag {
        width: 26px;
        height: 18px;
    }

    /* Модалки подстраиваем под высоту экрана */
    .modal-content {
        max-width: 100%;
        width: calc(100% - 24px);
        margin: 0 12px;
        max-height: 90vh;
        overflow-y: auto;
        padding: 16px;
    }

    #auth-modal .modal-content h2 {
        font-size: 1.1rem;
        text-align: center;
    }

    .auth-choice-buttons {
        flex-direction: column;
    }

    .auth-choice-buttons .btn-3d {
        max-width: 100%;
    }
}

/* Смартфоны — общие (если без ориентации, на всякий случай) */
@media (max-width: 600px) {
    .user-time {
        font-size: 0.95rem;
        font-weight: 600;
    }

    .user-weekday {
        font-size: 0.8rem;
        opacity: 0.85;
    }

    .geo-city {
        font-size: 0.85rem;
    }
}

/* Очень маленькие экраны */
@media (max-width: 400px) {
    body {
        font-size: 14px;
    }

    .btn-3d {
        font-size: 0.9rem;
        padding: 10px 16px;
    }

    .top-footer, .bottom-footer {
        padding: 4px 8px;
    }

    .modal-content {
        width: calc(100% - 16px);
        margin: 0 8px;
        padding: 12px;
    }

    .menu-card-inner {
        padding: 14px 10px;
    }

    .menu-card-title-overlay h2 {
        font-size: 1.0rem;
        padding: 4px 8px;
    }
}

/* Горизонтальная ориентация для мобильных/планшетов */
@media (max-width: 900px) and (orientation: landscape) {
    .main-layout {
        padding: 6px;
        gap: 6px;
    }

    .center-block {
        min-height: 160px;
        padding: 6px;
    }

    .btn-3d {
        max-width: 220px;
        font-size: 0.9rem;
        padding: 10px 18px;
    }

    .top-footer, .bottom-footer {
        flex-direction: row;
        font-size: 0.8rem;
    }

    .top-center,
    .top-center-auth {
        flex-direction: row;
        gap: 6px;
    }

    .modal-content {
        max-height: 80vh;
    }

    .menu-card-inner {
        padding: 14px 10px;
    }

    .menu-card-title-overlay h2 {
        font-size: 1rem;
    }
}