/**
 * mobile.css — единый файл мобильной адаптации.
 *
 * Подключается в base.html ПОСЛЕ duolingo-theme.css.
 * Содержит:
 *   1. Burger-меню (drawer справа) + затемнение фона
 *   2. Bottom-bar — нижняя панель навигации
 *   3. Адаптация навбара (скрытие пилюль, ссылок)
 *   4. Общие правила: контейнеры, заголовки, формы, кнопки
 *   5. Адаптация всех страниц: лендинг, дашборд, рейтинг,
 *      4 уровня, финальный тест, авторизация, админка
 *   6. Поддержка экранов от 360px
 *
 * Чтобы откатить — закомментировать <link> в base.html.
 */

/* =========================================================================
   БРЕЙКПОИНТЫ И ОСНОВНЫЕ ПРИНЦИПЫ
   ─────────────────────────────────────────────────────────────────────────
   Основной мобильный breakpoint — 768px (md в Tailwind).
   Малые экраны — 480px и ниже (компактный шрифт, уплотнённые отступы).
   ========================================================================= */

/* По умолчанию burger и bottom-bar СКРЫТЫ (desktop) */
.burger-btn,
.mobile-drawer,
.mobile-drawer-backdrop,
.bottom-bar {
    display: none;
}

/* =========================================================================
   ОБЩИЕ ПРАВИЛА — действуют на всех ширинах
   ========================================================================= */

/* Запрещаем горизонтальную прокрутку */
html,
body {
    overflow-x: hidden;
    max-width: 100vw;
}

/* Безопасная зона iPhone (notch / home indicator) */
@supports (padding: max(0px)) {
    .bottom-bar {
        padding-bottom: max(8px, env(safe-area-inset-bottom));
    }
}

/* =========================================================================
   MOBILE (≤ 768px) — основной блок адаптации
   ========================================================================= */
@media (max-width: 768px) {

    /* ---------------------------------------------------------------------
       НАВБАР — компактный, только логотип и пилюли, без ссылок
       --------------------------------------------------------------------- */
    .navbar {
        padding: 0.5rem 0.75rem !important;
    }
    .nav-container {
        gap: 8px;
    }
    .nav-logo {
        font-size: 1.1rem !important;
    }
    .nav-logo img {
        width: 32px !important;
        height: 32px !important;
    }

    /* Скрываем все ссылки и большие пилюли в навбаре */
    .nav-menu .nav-link,
    .nav-menu .nav-pill-xp,
    .nav-menu .nav-logout,
    .nav-menu .nav-cta {
        display: none !important;
    }

    /* Оставляем только баланс (если есть) — компактнее, менее «капсульной» формы */
    .nav-menu .nav-pill-balance {
        display: inline-flex !important;
        padding: 5px 10px;
        font-size: 13px;
        border-radius: 10px !important;   /* было 999px → теперь скруглённый прямоугольник */
        border-width: 2px !important;
    }
    .nav-menu .nav-pill-balance .nav-pill-icon {
        font-size: 14px;
    }

    /* Звук — компактнее, строго круглый (симметричный border + border-box) */
    .nav-sound-toggle {
        width: 36px !important;
        height: 36px !important;
        font-size: 16px !important;
        border-width: 2px !important;
        border-bottom-width: 2px !important;   /* было 3px → теперь равно остальным */
        box-sizing: border-box !important;
        padding: 0 !important;
        line-height: 1 !important;
    }
    .nav-sound-toggle:active {
        border-bottom-width: 2px !important;
    }

    /* Burger — показываем (строго квадратный, без «приплюснутости» снизу) */
    .burger-btn {
        display: inline-flex !important;
        align-items: center;
        justify-content: center;
        width: 40px;
        height: 40px;
        min-width: 40px;
        border-radius: 12px;
        background: #fff;
        border: 2px solid var(--duo-border, #E5E5E5);
        cursor: pointer;
        color: var(--duo-text, #3C3C3C);
        padding: 0;
        flex-shrink: 0;
        box-sizing: border-box;
        transition: transform 0.08s ease, border-color 0.15s ease;
    }
    .burger-btn:hover {
        border-color: var(--duo-green, #58CC02);
    }
    .burger-btn:active {
        transform: translateY(1px);
    }
    .burger-btn .burger-icon {
        display: inline-block;
        width: 20px;
        height: 14px;
        position: relative;
    }
    .burger-btn .burger-icon::before,
    .burger-btn .burger-icon::after,
    .burger-btn .burger-icon span {
        content: '';
        display: block;
        position: absolute;
        left: 0;
        width: 100%;
        height: 2.5px;
        background: currentColor;
        border-radius: 2px;
        transition: transform 0.25s ease, opacity 0.2s ease, top 0.25s ease;
    }
    .burger-btn .burger-icon::before { top: 0; }
    .burger-btn .burger-icon span    { top: 6px; }
    .burger-btn .burger-icon::after  { top: 12px; }

    .burger-btn[aria-expanded="true"] .burger-icon::before {
        top: 6px;
        transform: rotate(45deg);
    }
    .burger-btn[aria-expanded="true"] .burger-icon span {
        opacity: 0;
    }
    .burger-btn[aria-expanded="true"] .burger-icon::after {
        top: 6px;
        transform: rotate(-45deg);
    }

    /* ---------------------------------------------------------------------
       DRAWER — выезжающее меню справа
       --------------------------------------------------------------------- */
    .mobile-drawer-backdrop {
        display: block;
        position: fixed;
        inset: 0;
        background: rgba(15, 23, 42, 0.5);
        backdrop-filter: blur(2px);
        z-index: 1100;
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.25s ease;
    }
    .mobile-drawer-backdrop.is-open {
        opacity: 1;
        pointer-events: auto;
    }

    .mobile-drawer {
        display: flex;
        flex-direction: column;
        position: fixed;
        top: 0;
        right: 0;
        bottom: 0;
        width: min(320px, 86vw);
        background: #fff;
        z-index: 1101;
        box-shadow: -8px 0 24px rgba(0, 0, 0, 0.1);
        transform: translateX(100%);
        transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
        padding: 16px 16px max(16px, env(safe-area-inset-bottom)) 16px;
        overflow-y: auto;
    }
    .mobile-drawer.is-open {
        transform: translateX(0);
    }

    .mobile-drawer-header {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding-bottom: 14px;
        border-bottom: 2px solid var(--duo-border, #E5E5E5);
        margin-bottom: 14px;
    }
    .mobile-drawer-title {
        font-family: 'Manrope', sans-serif;
        font-weight: 900;
        font-size: 18px;
        color: var(--duo-text, #3C3C3C);
        margin: 0;
    }
    .mobile-drawer-close {
        width: 36px;
        height: 36px;
        min-width: 36px;            /* фиксируем — не даём flex/контенту растянуть */
        border-radius: 50%;
        border: 2px solid var(--duo-border, #E5E5E5);
        background: #fff;
        font-size: 18px;
        line-height: 1;
        cursor: pointer;
        color: var(--duo-text-muted, #777);
        box-sizing: border-box;     /* чтобы border не «съедал» внутрь и не делал овал */
        padding: 0;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        flex-shrink: 0;
    }
    .mobile-drawer-close:hover { background: var(--duo-bg-soft, #F7F7F7); }

    .mobile-drawer-user {
        display: flex;
        align-items: center;
        gap: 12px;
        padding: 12px 14px;
        background: var(--duo-bg-soft, #F7F7F7);
        border-radius: 16px;
        margin-bottom: 14px;
    }
    .mobile-drawer-avatar {
        width: 44px;
        height: 44px;
        border-radius: 50%;
        background: var(--duo-green, #58CC02);
        color: #fff;
        display: flex;
        align-items: center;
        justify-content: center;
        font-weight: 900;
        font-size: 18px;
        flex-shrink: 0;
    }
    .mobile-drawer-user-info {
        flex: 1;
        min-width: 0;
    }
    .mobile-drawer-user-name {
        font-weight: 800;
        color: var(--duo-text, #3C3C3C);
        font-size: 14px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
    .mobile-drawer-user-stats {
        font-size: 12px;
        color: var(--duo-text-muted, #777);
        font-weight: 700;
        margin-top: 2px;
        font-variant-numeric: tabular-nums;
    }

    .mobile-drawer-links {
        display: flex;
        flex-direction: column;
        gap: 4px;
    }
    .mobile-drawer-link {
        display: flex;
        align-items: center;
        gap: 12px;
        padding: 12px 14px;
        border-radius: 12px;
        font-weight: 700;
        font-size: 15px;
        color: var(--duo-text, #3C3C3C);
        text-decoration: none;
        transition: background 0.15s ease;
        min-height: 48px;
    }
    .mobile-drawer-link:hover,
    .mobile-drawer-link:focus {
        background: var(--duo-bg-soft, #F7F7F7);
        color: var(--duo-text, #3C3C3C);
    }
    .mobile-drawer-link.is-active {
        background: var(--duo-green-bg, #D7FFB8);
        color: #2D5F0A;
    }
    .mobile-drawer-link-text {
        flex: 1;
    }
    .mobile-drawer-link-arrow {
        color: var(--duo-text-soft, #AFAFAF);
        font-size: 14px;
    }

    .mobile-drawer-divider {
        height: 2px;
        background: var(--duo-border, #E5E5E5);
        margin: 12px 0;
        border-radius: 1px;
    }

    .mobile-drawer-link.is-danger {
        color: var(--duo-red, #FF4B4B);
    }
    .mobile-drawer-link.is-danger:hover {
        background: var(--duo-red-bg, #FFE0E0);
        color: var(--duo-red-dark, #EA2B2B);
    }

    /* ---------------------------------------------------------------------
       BOTTOM-BAR — нижняя панель навигации (только для авторизованных)
       --------------------------------------------------------------------- */
    .bottom-bar {
        display: flex;
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        background: #fff;
        border-top: 2px solid var(--duo-border, #E5E5E5);
        z-index: 1000;
        padding-top: 6px;
        padding-bottom: max(8px, env(safe-area-inset-bottom));
        box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.05);
    }
    .bottom-bar-item {
        flex: 1;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 2px;
        padding: 6px 4px;
        text-decoration: none;
        color: var(--duo-text-muted, #777);
        font-weight: 700;
        font-size: 11px;
        min-height: 56px;
        transition: color 0.15s ease;
        text-transform: uppercase;
        letter-spacing: 0.03em;
    }
    .bottom-bar-item:hover,
    .bottom-bar-item:focus {
        color: var(--duo-green-dark, #58A700);
    }
    .bottom-bar-item.is-active {
        color: var(--duo-green-dark, #58A700);
    }
    .bottom-bar-item.is-active .bottom-bar-icon {
        background: var(--duo-green-bg, #D7FFB8);
    }
    .bottom-bar-icon {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 44px;
        height: 28px;
        border-radius: 14px;
        font-size: 18px;
        line-height: 1;
        transition: background 0.15s ease;
    }
    .bottom-bar-icon svg,
    .bottom-bar-icon [data-lucide] {
        width: 20px;
        height: 20px;
        stroke-width: 2.2;
    }
    .mobile-drawer-link-icon {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 28px;
        text-align: center;
        font-size: 18px;
        flex-shrink: 0;
        color: currentColor;
    }
    .mobile-drawer-link-icon svg,
    .mobile-drawer-link-icon [data-lucide] {
        width: 22px;
        height: 22px;
        stroke-width: 2.2;
    }
    .bottom-bar-label {
        line-height: 1;
        white-space: nowrap;
    }

    /* Контент: отступы под navbar и bottom-bar */
    main {
        padding-top: 64px !important;
        /* +высота bottom-bar (~68px) для авторизованных */
        padding-bottom: 88px !important;
    }
    body.no-bottom-bar main {
        padding-bottom: 24px !important;
    }
    .container.mx-auto {
        padding-left: 0.875rem !important;
        padding-right: 0.875rem !important;
    }

    /* ---------------------------------------------------------------------
       MESSAGES — компактные тосты
       --------------------------------------------------------------------- */
    .fixed.top-20 {
        top: 70px !important;
        right: 0.5rem !important;
        left: 0.5rem !important;
        max-width: none !important;
    }
    .message {
        padding: 0.75rem 1rem !important;
        font-size: 0.875rem !important;
    }

    /* ---------------------------------------------------------------------
       ФУТЕР — центрирование, компактные отступы, скрываем на маленьких
       --------------------------------------------------------------------- */
    .footer {
        padding: 1.5rem 1rem 1rem !important;
    }
    .footer .grid {
        gap: 1.5rem !important;
        text-align: center;
    }
    .footer h3,
    .footer h4 {
        justify-content: center;
    }
    .footer ul {
        display: inline-block;
        text-align: left;
    }

    /* ---------------------------------------------------------------------
       ТИПОГРАФИКА — крупнее и компактнее
       --------------------------------------------------------------------- */
    h1 { font-size: 1.625rem !important; line-height: 1.25 !important; }
    h2 { font-size: 1.375rem !important; line-height: 1.3 !important; }
    h3 { font-size: 1.125rem !important; line-height: 1.35 !important; }
    h4 { font-size: 1rem !important; }

    .duo-hero-title {
        font-size: clamp(1.75rem, 8vw, 2.5rem) !important;
        line-height: 1.1 !important;
    }
    .duo-hero-subtitle {
        font-size: 1rem !important;
    }
    .duo-section-title {
        font-size: 1.5rem !important;
    }
    .duo-section-subtitle {
        font-size: 0.95rem !important;
    }
    .duo-section {
        padding: 32px 0 !important;
    }
    .duo-hero {
        padding: 28px 0 36px !important;
    }

    /* ---------------------------------------------------------------------
       КНОПКИ — компактнее, но не меньше 44px
       --------------------------------------------------------------------- */
    .btn-duo,
    .btn-duo-green,
    .btn-duo-orange,
    .btn-duo-blue,
    .btn-duo-red,
    .btn-duo-yellow,
    .btn-duo-secondary,
    .btn-gradient {
        font-size: 0.9rem !important;
        padding: 12px 18px !important;
        min-height: 48px;
        letter-spacing: 0.03em !important;
    }

    /* Кнопки во весь блок — основной приём */
    .btn-mobile-full {
        width: 100% !important;
    }

    /* ---------------------------------------------------------------------
       КАРТОЧКИ — компактные отступы
       --------------------------------------------------------------------- */
    .duo-card,
    .duo-level-card,
    .duo-feature-card,
    .glass-card,
    .stat-card,
    .game-card {
        padding: 16px !important;
        border-radius: 16px !important;
    }
    .duo-feature-icon {
        width: 56px !important;
        height: 56px !important;
        font-size: 30px !important;
        margin-bottom: 10px !important;
    }

    /* ---------------------------------------------------------------------
       ФОРМЫ — крупные тач-цели, отсутствие зума при фокусе в iOS
       --------------------------------------------------------------------- */
    input,
    textarea,
    select {
        font-size: 16px !important;   /* < 16px вызывает зум в iOS */
        padding: 12px 14px !important;
        border-radius: 12px !important;
    }
    label {
        font-size: 0.9rem !important;
    }

    /* ---------------------------------------------------------------------
       ТАБЛИЦЫ — горизонтальный скролл, sticky первой колонки если нужно
       --------------------------------------------------------------------- */
    table {
        font-size: 0.85rem !important;
    }
    .table-responsive,
    .overflow-x-auto {
        -webkit-overflow-scrolling: touch;
    }

    /* ---------------------------------------------------------------------
       МОДАЛКИ — почти fullscreen
       --------------------------------------------------------------------- */
    .modal-content-custom,
    .modal-content,
    [role="dialog"] > div {
        max-width: 100% !important;
        margin: 0.5rem !important;
        max-height: calc(100vh - 1rem);
        overflow-y: auto;
    }

    /* ---------------------------------------------------------------------
       ГРАФИКИ — фиксируем максимальную высоту
       --------------------------------------------------------------------- */
    canvas {
        max-width: 100% !important;
        height: auto !important;
    }
    .chart-wrap {
        height: 220px !important;
    }

    /* =====================================================================
       ЛЕНДИНГ
       ===================================================================== */
    /* Hero статистика 2x2 */
    .hero-stats-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 10px !important;
    }
    /* Кнопки Hero — стек, во всю ширину */
    .hero-cta-group {
        flex-direction: column !important;
        gap: 10px !important;
        width: 100%;
    }
    .hero-cta-group > * {
        width: 100% !important;
    }

    /* Lesson-path: уменьшаем узлы */
    .lesson-node {
        width: 76px !important;
        height: 76px !important;
        font-size: 32px !important;
        border-width: 3px !important;
        box-shadow: 0 4px 0 0 var(--duo-border) !important;
    }
    .lesson-node-label {
        font-size: 11px !important;
    }
    .lesson-connector {
        height: 16px !important;
    }

    /* =====================================================================
       ДАШБОРД
       ===================================================================== */
    .dashboard-stats {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 10px !important;
    }
    .dashboard-stats .stat-card {
        padding: 14px !important;
    }

    /* Карточка уровня в списке */
    .dashboard-level-row {
        flex-direction: column !important;
        align-items: stretch !important;
        text-align: left;
    }
    .dashboard-level-actions {
        width: 100%;
        justify-content: flex-start !important;
    }

    /* Карточка лиги */
    .league-card {
        flex-wrap: wrap;
        gap: 12px !important;
        padding: 14px 16px !important;
    }
    .league-card-icon {
        font-size: 36px !important;
    }
    .league-card-name {
        font-size: 18px !important;
    }
    .league-card-rank {
        font-size: 24px !important;
    }

    /* Легенда лиг */
    .league-legend {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 8px !important;
    }
    .league-legend-item {
        padding: 8px 10px !important;
        font-size: 12px !important;
    }
    .league-legend-name {
        font-size: 12px !important;
    }

    /* =====================================================================
       РЕЙТИНГ — подиум и таблица
       ===================================================================== */
    /* Подиум: компактные карточки */
    .podium-card {
        padding: 16px 12px 14px !important;
        font-size: 13px !important;
        border-radius: 16px !important;
        transform: none !important;     /* сброс приподнятой 1-й карточки */
    }
    .podium-1,
    .podium-1:hover {
        transform: none !important;
        padding: 18px 12px 16px !important;
    }
    .podium-medal {
        font-size: 36px !important;
        margin-bottom: 6px !important;
    }
    .podium-1 .podium-medal {
        font-size: 48px !important;
    }
    .podium-name {
        font-size: 15px !important;
    }
    .podium-1 .podium-name {
        font-size: 17px !important;
    }
    .podium-xp {
        font-size: 13px !important;
        padding: 3px 10px !important;
        margin-bottom: 8px !important;
    }
    .podium-meta {
        font-size: 11px !important;
        gap: 8px !important;
    }

    /* Таблица лидерборда — скрываем второстепенные колонки */
    .leaderboard-table {
        font-size: 0.85rem !important;
    }
    .leaderboard-table th,
    .leaderboard-table td {
        padding: 8px 6px !important;
    }
    .leaderboard-table .col-earned,
    .leaderboard-table .col-level {
        display: none !important;
    }

    /* =====================================================================
       АВТОРИЗАЦИЯ
       ===================================================================== */
    .auth-card {
        margin: 0 auto;
        max-width: 100% !important;
        padding: 1.25rem !important;
    }
    .auth-title {
        font-size: 1.5rem !important;
    }

    /* =====================================================================
       УРОВЕНЬ 1 — карточный
       ===================================================================== */
    .month-stage {
        padding: 0 !important;
    }
    /* Индикаторы 2x2 */
    .indicators-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 8px !important;
    }
    .indicator-card {
        padding: 10px 12px !important;
        gap: 8px !important;
        border-radius: 12px !important;
    }
    .indicator-icon {
        font-size: 22px !important;
    }
    .indicator-value {
        font-size: 16px !important;
    }
    .indicator-label {
        font-size: 10px !important;
    }

    /* Карточка события */
    .card-stage {
        padding: 16px 14px 18px !important;
        border-radius: 18px !important;
    }
    .event-card {
        padding: 14px 14px !important;
        border-radius: 14px !important;
    }
    .event-card-title {
        font-size: 17px !important;
    }
    .event-card-text {
        font-size: 14px !important;
    }
    .choice-btn {
        padding: 12px 14px !important;
        font-size: 14px !important;
        min-height: 52px;
    }

    /* =====================================================================
       УРОВЕНЬ 2 — реалтайм
       ===================================================================== */
    .time-controls {
        padding: 8px 10px !important;
        gap: 8px !important;
    }
    .time-btn {
        width: 38px !important;
        height: 38px !important;
        font-size: 16px !important;
    }
    .speed-btn {
        width: 32px !important;
        height: 30px !important;
        font-size: 14px !important;
    }
    .auto-save-toggle {
        margin-left: 0 !important;
        width: 100%;
        justify-content: space-between;
        padding-top: 4px;
    }

    .save-actions {
        grid-template-columns: repeat(3, 1fr) !important;
        gap: 6px !important;
    }
    .save-btn-big {
        padding: 10px 4px !important;
        font-size: 13px !important;
        min-height: 56px;
    }
    .save-btn-big .save-icon {
        font-size: 18px !important;
    }

    .dream-road-wrap {
        padding: 18px 12px 22px !important;
    }
    .checkpoint {
        width: 32px !important;
        height: 32px !important;
        font-size: 14px !important;
        border-width: 2px !important;
    }
    .checkpoint.final {
        width: 40px !important;
        height: 40px !important;
        font-size: 18px !important;
    }
    .checkpoint-label {
        font-size: 9px !important;
        margin-top: 4px !important;
    }

    .piggy-emoji {
        font-size: 48px !important;
    }
    .piggy-savings {
        font-size: 24px !important;
    }

    .temptation-shelf {
        padding: 12px 12px 14px !important;
    }
    .temptation-grid {
        grid-template-columns: 1fr !important;
        gap: 8px !important;
    }

    .day-strip {
        padding: 12px !important;
        gap: 10px !important;
    }
    .day-num {
        font-size: 22px !important;
    }
    .dream-actions {
        grid-template-columns: 1fr !important;
        gap: 8px !important;
    }

    /* =====================================================================
       УРОВЕНЬ 3 — викторина
       ===================================================================== */
    .quiz-question {
        font-size: 1rem !important;
        padding: 14px !important;
    }
    .quiz-option {
        padding: 12px 14px !important;
        font-size: 0.95rem !important;
        min-height: 56px;
    }
    .quiz-explanation {
        font-size: 0.9rem !important;
        padding: 12px 14px !important;
    }

    /* =====================================================================
       УРОВЕНЬ 4 — инвестиции
       ===================================================================== */
    .invest-options {
        grid-template-columns: 1fr !important;
        gap: 12px !important;
    }
    .invest-card {
        padding: 16px !important;
    }
    .invest-input-group {
        flex-direction: column !important;
        gap: 8px !important;
    }
    .invest-input-group > * {
        width: 100% !important;
    }
    .invest-history-row {
        font-size: 0.85rem !important;
    }

    /* =====================================================================
       ФИНАЛЬНЫЙ ТЕСТ
       ===================================================================== */
    .test-progress {
        font-size: 0.85rem !important;
    }
    .test-question-num {
        font-size: 1rem !important;
    }
    .test-result-grade {
        font-size: 2rem !important;
    }
    .test-result-actions {
        flex-direction: column !important;
        gap: 10px !important;
    }
    .test-result-actions > * {
        width: 100% !important;
    }

    /* =====================================================================
       АДМИН-ПАНЕЛЬ
       ===================================================================== */
    .admin-stats {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 10px !important;
    }
    .admin-filters {
        flex-direction: column !important;
        gap: 8px !important;
    }
    .admin-filters > * {
        width: 100% !important;
    }
    .admin-table {
        font-size: 0.8rem !important;
    }
    .admin-table th,
    .admin-table td {
        padding: 8px 6px !important;
    }
    /* Действия в строке — стек */
    .admin-row-actions {
        display: flex;
        flex-direction: column;
        gap: 4px;
        align-items: stretch !important;
    }

    /* Скрытие колонок таблиц для админок */
    .hide-mobile {
        display: none !important;
    }

    /* Уменьшение огромных p-8 в админке */
    .glass-card.rounded-3xl.shadow-2xl,
    .glass-card.rounded-3xl.shadow-xl {
        padding: 16px !important;
    }

    /* Огромные эмодзи уровней в admin */
    .admin-level-emoji,
    .admin-level-tile > .text-5xl {
        font-size: 32px !important;
    }
    .admin-level-tile > .text-4xl {
        font-size: 24px !important;
    }

    /* Таблица игроков: компактные строки */
    .admin-players-table th,
    .admin-players-table td {
        padding: 8px 6px !important;
        font-size: 12px !important;
    }
    .admin-players-table .player-actions {
        flex-direction: column;
        gap: 4px;
    }

    /* Модуль диалогов Финика — отдельно в dialogue.css */
}

/* =========================================================================
   ОЧЕНЬ МАЛЕНЬКИЕ ЭКРАНЫ (≤ 480px) — точечные правки
   ========================================================================= */
@media (max-width: 480px) {
    .navbar {
        padding: 0.4rem 0.625rem !important;
    }
    .nav-logo {
        font-size: 1rem !important;
    }
    .nav-logo img {
        width: 28px !important;
        height: 28px !important;
    }

    /* Скрываем «Фин» рядом с лого, оставляем только иконку */
    .nav-logo span.sm\:hidden {
        display: none !important;
    }

    /* Баланс в навбаре уменьшаем ещё */
    .nav-menu .nav-pill-balance {
        padding: 3px 8px !important;
        font-size: 12px !important;
    }

    /* Лендинг */
    .hero-stats-grid .stat-mini-value {
        font-size: 1.1rem !important;
    }
    .hero-stats-grid .stat-mini-label {
        font-size: 0.7rem !important;
    }

    /* Footer ссылки в одну колонку */
    .footer .grid {
        grid-template-columns: 1fr !important;
    }

    /* Bottom-bar: меньше иконки */
    .bottom-bar-item {
        font-size: 10px !important;
    }
    .bottom-bar-icon {
        width: 40px;
        height: 26px;
        font-size: 16px;
    }
}

/* =========================================================================
   КРАЙНИЕ МАЛЫЕ (≤ 360px) — минимальная поддержка
   ========================================================================= */
@media (max-width: 360px) {
    .container.mx-auto {
        padding-left: 0.625rem !important;
        padding-right: 0.625rem !important;
    }
    .btn-duo,
    .btn-duo-green,
    .btn-duo-orange,
    .btn-duo-blue,
    .btn-duo-red,
    .btn-duo-yellow,
    .btn-duo-secondary,
    .btn-gradient {
        font-size: 0.85rem !important;
        padding: 11px 14px !important;
    }
    .bottom-bar-label {
        display: none !important;
    }
    .bottom-bar-item {
        min-height: 52px;
    }
    .bottom-bar-icon {
        height: 32px;
    }
}

/* =========================================================================
   ЛАНДШАФТНЫЙ МОБИЛЬНЫЙ — низкая высота
   ========================================================================= */
@media (max-width: 900px) and (orientation: landscape) and (max-height: 500px) {
    main {
        padding-top: 56px !important;
        padding-bottom: 64px !important;
    }
    .duo-hero {
        padding: 16px 0 24px !important;
    }
    .duo-section {
        padding: 24px 0 !important;
    }
    .bottom-bar-item {
        min-height: 44px;
        font-size: 10px !important;
    }
    .bottom-bar-icon {
        height: 22px;
        width: 36px;
        font-size: 15px;
    }
}

/* =========================================================================
   PRINT — сертификат и отчёты должны печататься без навбара/футера
   ========================================================================= */
@media print {
    .navbar,
    .footer,
    .bottom-bar,
    .mobile-drawer,
    .mobile-drawer-backdrop,
    .burger-btn,
    .dialogue-help-btn {
        display: none !important;
    }
    main {
        padding: 0 !important;
    }
}
