:root{--glass:rgba(255,255,255,.12);--brd:rgba(255,255,255,.28)}
*{box-sizing:border-box}
html,body{height:100%}
body{margin:0;font-family:Inter,Segoe UI,Calibri,Arial,sans-serif;background:#070a0e;color:#fff}

.topbar {
    position: fixed;
    top: 14px;
    left: 50%;
    transform: translateX(-50%);
    width: min(1180px, 94%);
    z-index: 10;
    display: flex;
    align-items: center;
    padding: 10px 14px;
    border-radius: 16px;
    background: var(--glass);
    border: 1px solid var(--brd);
    backdrop-filter: blur(14px);
    box-shadow: 0 10px 30px rgba(0,0,0,.35);
    transition: transform .3s ease,opacity .3s ease;
}

.topbar .brand {
    font-weight: 900;
    color: #fff;
    text-decoration: none;
    margin-right: auto;
}

.topbar nav {
    display: flex;
    gap: 10px;
    margin-right: 15px;
}

.topbar a.link{
    color:#fff;
    text-decoration:none;
    font-weight:800;
    padding:8px 12px;
    border:1px solid var(--brd);
    border-radius:12px;
    background:rgba(255,255,255,.08);
    transition:.18s;
}
.topbar a.link:hover{
    transform:translateY(-1px);
    background:rgba(255,255,255,.18);
}
.spacer{height:66px}

/* Скрываем меню по умолчанию */
.timer .topbar.hidden-on-timer{
    transform:translate(-50%,-140%);
    opacity:0;
    pointer-events: none;
}

/* Триггерная зона вверху экрана */
.topbar-trigger{
    position:fixed;
    top:0;
    left:0;
    right:0;
    height: 60px;
    z-index:9;
    background:transparent;
}

/* Показываем меню при ховере на триггерную зону ИЛИ на само меню */
.topbar-trigger:hover ~ .topbar.hidden-on-timer,
.topbar.hidden-on-timer:hover{
    transform:translate(-50%,0);
    opacity:1;
    pointer-events: auto;
}

/* ===== BURGER MENU ===== */
.burger-menu {
    position: relative;
    margin-left: 10px;
    display: block; /* Всегда показываем */
}

.burger-icon {
    cursor: pointer;
    padding: 10px;
    font-size: 22px;
    color: white;
    border-radius: 8px;
    transition: background 0.2s;
    display: block; /* Всегда показываем */
}

.burger-icon:hover {
    background: rgba(255,255,255,0.1);
}

.burger-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    background: rgba(20, 25, 40, 0.98);
    border: 1px solid rgba(100, 150, 255, 0.2);
    border-radius: 12px;
    padding: 12px 0;
    min-width: 220px;
    backdrop-filter: blur(20px);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4);
    z-index: 1100;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* На ПК: открытие по наведению */
@media (min-width: 769px) {
    .burger-menu:hover .burger-dropdown {
        opacity: 1;
        visibility: visible;
        transform: translateY(5px);
    }
}

/* На мобильных: открытие по клику */
@media (max-width: 768px) {
    .burger-menu.active .burger-dropdown {
        opacity: 1;
        visibility: visible;
        transform: translateY(5px);
    }
    
    .topbar nav {
        display: none;
    }
}

.burger-dropdown a {
    display: block;
    padding: 12px 20px;
    color: rgba(255,255,255,0.95);
    text-decoration: none;
    font-weight: 500;
    transition: all 0.2s;
    border-left: 3px solid transparent;
}

.burger-dropdown a:hover {
    background: rgba(255,255,255,0.1);
    border-left-color: #9efcff;
    padding-left: 25px;
}

.burger-copyright {
    padding: 12px 20px;
    border-top: 1px solid rgba(255,255,255,0.15);
    margin-top: 8px;
    font-size: 11px;
    opacity: 0.6;
    color: rgba(255,255,255,0.8);
}

/* Улучшенное бургер-меню для всех страниц */
.burger-menu {
    position: relative;
    margin-left: 10px;
    display: flex;
    align-items: center;
}

.burger-icon {
    cursor: pointer;
    padding: 10px;
    font-size: 22px;
    color: white;
    border-radius: 8px;
    transition: background 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
}

.burger-icon:hover {
    background: rgba(255,255,255,0.1);
}

/* Активное состояние для мобильных */
.burger-menu.active .burger-dropdown {
    opacity: 1;
    visibility: visible;
    transform: translateY(5px);
}

/* Гарантия отображения на всех страницах */
.timer .burger-menu,
.links .burger-menu {
    display: block !important;
}

.timer .burger-icon,
.links .burger-icon {
    display: flex !important;
}

/* Исправление бургер-меню для страницы таймера */
body.timer .burger-menu {
    display: flex !important;
    opacity: 1 !important;
    visibility: visible !important;
}

body.timer .burger-icon {
    display: flex !important;
    opacity: 1 !important;
    visibility: visible !important;
}

/* Показываем бургер-меню даже когда topbar скрыт */
body.timer .topbar.hidden-on-timer .burger-menu,
body.timer .topbar.hidden-on-timer .burger-icon {
    display: flex !important;
    opacity: 1 !important;
    visibility: visible !important;
    pointer-events: auto !important;
}

/* Улучшенная видимость для мобильных */
@media (max-width: 768px) {
    body.timer .burger-menu {
        margin-left: auto;
        order: 2;
    }
    
    body.timer .topbar {
        display: flex;
        align-items: center;
        justify-content: space-between;
    }
    
    body.timer nav {
        display: none !important;
    }
    
    body.timer .brand {
        margin-right: 0;
        flex: 1;
    }
    
    /* Убедимся, что бургер виден */
    body.timer .burger-icon {
        background: rgba(255,255,255,0.1);
        border: 1px solid var(--brd);
        border-radius: 8px;
        width: 42px;
        height: 42px;
        display: flex !important;
        align-items: center;
        justify-content: center;
    }
}

/* Бургер-меню всегда видимое в таймере */
.burger-menu.always-visible {
    position: fixed;
    top: 24px;
    right: 20px;
    z-index: 9999;
    display: flex !important;
    opacity: 1 !important;
    visibility: visible !important;
}

.burger-menu.always-visible .burger-icon {
    background: rgba(255,255,255,0.1);
    border: 1px solid var(--brd);
    border-radius: 8px;
    width: 44px;
    height: 44px;
    display: flex !important;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

.burger-menu.always-visible .burger-dropdown {
    top: 100%;
    right: 0;
    margin-top: 10px;
}

/* Гарантия видимости на мобильных */
@media (max-width: 768px) {
    .burger-menu.always-visible {
        top: 18px;
        right: 15px;
    }
    
    .burger-menu.always-visible .burger-icon {
        width: 40px;
        height: 40px;
        font-size: 20px;
    }
}

/* === ПОЛНОЭКРАННОЕ МЕНЮ ТОЛЬКО ДЛЯ МОБИЛЬНОГО ВЕРТИКАЛЬНОГО РЕЖИМА === */

@media (max-width: 768px) and (orientation: portrait) {

    .timer-burger-modal {
        position: fixed;
        inset: 0;
        background: rgba(0,0,0,0.75);
        backdrop-filter: blur(6px);
        z-index: 99999;
        display: flex;
        justify-content: center;
        align-items: flex-start;
        padding-top: 80px;
    }

    .timer-burger-modal.hidden {
        display: none;
    }

    .timer-burger-panel {
        width: 88%;
        background: rgba(25,30,40,0.95);
        border: 1px solid rgba(255,255,255,0.25);
        border-radius: 18px;
        padding: 30px 20px;
        text-align: center;
        box-shadow: 0 12px 40px rgba(0,0,0,0.45);
        position: relative;
        animation: slideDown .25s ease;
    }

    @keyframes slideDown {
        from { transform: translateY(-20px); opacity: 0; }
        to { transform: translateY(0); opacity: 1; }
    }

    .timer-burger-panel a {
        display: block;
        padding: 14px 0;
        font-size: 20px;
        font-weight: 600;
        color: #ffffff;
        text-decoration: none;
        border-bottom: 1px solid rgba(255,255,255,0.15);
    }

    .timer-burger-panel a:last-child {
        border-bottom: none;
    }

    .timer-burger-close {
        position: absolute;
        top: 12px;
        right: 12px;
        border: none;
        background: rgba(255,255,255,0.15);
        color: white;
        width: 40px;
        height: 40px;
        border-radius: 50%;
        font-size: 22px;
        cursor: pointer;
    }

    .timer-burger-copy {
        margin-top: 20px;
        opacity: 0.6;
        font-size: 12px;
    }

    /* скрываем стандартное бургер-меню внутри topbar */
    body.timer .burger-menu {
        display: none !important;
    }
}
