/* ========== БАЗОВЫЕ ПЕРЕМЕННЫЕ ========== */
:root {
    /* Цветовая схема */
    --primary: #FF6A61;
    --accent: #FF6A61;
    --fire: #ff4d4d;
    --gold: #ffd700;
    --neon: #00f2fe;
    --glass-bg: rgba(10, 14, 26, 0.95);
    --glass-card: rgba(255, 255, 255, 0.15);
    --glass-border: rgba(255, 255, 255, 0.2);
    --text-light: #ffffff;
    --text-dim: rgba(255, 255, 255, 0.85);
    --text-primary: rgba(255, 106, 97, 0.95);
    --matte-bg: #0a0e1a;
    --blur-intensity: 8px;

    /* Типография */
    --font-main: 'Montserrat', sans-serif;
    --base-font-size: clamp(12px, 3vw, 16px);
    --h1-size: clamp(18px, 5vw, 24px);
    --h2-size: clamp(16px, 4vw, 20px);
    --small-text: clamp(10px, 2.5vw, 14px);

    /* Размеры */
    --btn-height: clamp(44px, 12vw, 56px);
    --btn-padding: clamp(10px, 3vw, 14px);
    --btn-font-size: clamp(12px, 3vw, 14px);
    --icon-size: clamp(20px, 6vw, 32px);
    --avatar-size: clamp(40px, 10vw, 56px);
    --dock-height: clamp(60px, 15vw, 80px);
    --screen-padding: clamp(10px, 3vw, 25px);
    --card-radius: clamp(12px, 4vw, 20px);

    /* Тени и эффекты */
    --shadow-light: 0 4px 6px rgba(0, 0, 0, 0.1);
    --shadow-medium: 0 10px 25px rgba(0, 0, 0, 0.3);
    --shadow-heavy: 0 20px 40px rgba(0, 0, 0, 0.5);
    --glow-primary: 0 0 20px rgba(255, 106, 97, 0.3);
    --vh: 1vh;          /* перезапишется JS до рендера */
    --safe-bottom: 0px; /* перезапишется JS до рендера */
}

:root {
    --hud-height: 70px;
}
/* ========== БАЗОВЫЕ СТИЛИ ========== */
* {
    font-family: var(--font-main);
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
    outline: none;
    -webkit-text-size-adjust: 100%;
    -moz-text-size-adjust: 100%;
    -ms-text-size-adjust: 100%;
}

/* Оптимизация прокрутки и рендеринга */
.stage-card,
.gift,
.modal-overlay,
.hero-stage {
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
}

.screen,
.modal-body,
#tree-list,
#rank-content,
#inv-grid,
#gifts-grid {
    -webkit-overflow-scrolling: touch;
    will-change: scroll-position;
    contain: content;
}

/* Оптимизация теней и блюра */
.glass-btn,
.stage-card,
.auth-card {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2) !important;
    background: rgba(255, 255, 255, 0.12) !important;
}

/* ========== ПРИНУДИТЕЛЬНАЯ СВЕТЛАЯ ТЕМА ДЛЯ 2048 ========== */
/* ========== СТИЛИ 2048 ========== */
#modal-2048,
#modal-2048 *,
#modal-2048 *::before,
#modal-2048 *::after {
    color-scheme: light !important;
    -webkit-color-scheme: light !important;
}

/* Модальное окно с прозрачностью и блюром */
#modal-2048 {
    background: rgba(10, 14, 26, 0.75) !important;
    background: rgba(10, 14, 26, 0.95) !important;

}

/* Контейнер игры - прозрачный */
#modal-2048>div:first-child {
    background: transparent !important;
}

/* Тёмное игровое поле */
#g2048-board {
    background: #1a1d2e !important;
    border: 2px solid rgba(255, 255, 255, 0.1) !important;
    box-shadow: 0 15px 50px rgba(0, 0, 0, 0.7) !important;
}

/* Шапка с счётом - стеклянный эффект */
#modal-2048>div>div:first-child {
    background: rgba(26, 29, 46, 0.7) !important;
    background: rgba(26, 29, 46, 0.9) !important;

    border: 2px solid rgba(255, 255, 255, 0.15) !important;
}

/* Заголовок 2048 - больше и ярче */
#modal-2048>div>div:first-child>div:first-child>div:first-child {
    color: #ffffff !important;
    text-shadow: 0 0 20px rgba(255, 255, 255, 0.3) !important;
}

/* Счётчики - стеклянный эффект с неоном */
#modal-2048 [style*="background: #bbada0"] {

    background: rgba(58, 61, 78, 0.8) !important;

    box-shadow: 0 0 15px rgba(77, 158, 255, 0.2) !important;
}

#modal-2048 [style*="background: #8f7a66"] {
    background: rgba(255, 136, 77, 0.2) !important;
    background: rgba(58, 61, 78, 0.8) !important;

    border: 2px solid rgba(255, 136, 77, 0.4) !important;
    box-shadow: 0 0 15px rgba(255, 136, 77, 0.2) !important;
}

/* Цифры в счётчиках - больше и ярче */
#g2048-score,
#g2048-best,
#g2048-xp {
    font-size: clamp(22px, 6vw, 28px) !important;
    font-weight: 900 !important;
    color: #ffffff !important;
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.3) !important;
}

/* Подписи счётчиков */
#modal-2048 [style*="background: #bbada0"]>div:first-child,
#modal-2048 [style*="background: #8f7a66"]>div:first-child {
    color: rgba(255, 255, 255, 0.7) !important;
    font-weight: 800 !important;
}

/* Кнопки - стеклянный эффект */
#modal-2048 button {
    background: rgba(58, 61, 78, 0.6) !important;
    background: rgba(58, 61, 78, 0.8) !important;

    border: 2px solid rgba(255, 255, 255, 0.25) !important;
    color: #ffffff !important;
    transition: all 0.3s ease !important;
    font-weight: 800 !important;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3) !important;
}

#modal-2048 button:hover {
    background: rgba(78, 81, 98, 0.8) !important;
    border-color: rgba(255, 255, 255, 0.4) !important;
    transform: translateY(-2px) !important;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4) !important;
}

#modal-2048 button:active {
    transform: scale(0.95) !important;
}

/* Overlay при победе/поражении */
#g2048-overlay {
    background: rgba(26, 29, 46, 0.95) !important;
    background: rgba(26, 29, 46, 0.9) !important;

    border: 2px solid rgba(255, 255, 255, 0.1) !important;
}

#g2048-overlay-title {
    color: #ffffff !important;
    text-shadow: 0 0 20px rgba(255, 255, 255, 0.5) !important;
}

#g2048-overlay-sub {
    color: rgba(255, 255, 255, 0.8) !important;
}

/* Подсказка */
#modal-2048 span[style*="rgba(255,255,255,0.4)"] {
    color: rgba(255, 255, 255, 0.5) !important;
    font-weight: 700 !important;
}

/* Убираем лишние стили у плиток */
#g2048-board>div {
    box-sizing: border-box !important;
}

/* Дополнительные стили для подарков */
.gift {
    position: absolute;
    z-index: 100;
    pointer-events: auto;
    user-select: none;
    cursor: pointer;
    transition: all 0.3s ease;
    will-change: transform, opacity;
    text-shadow: 0 0 10px currentColor;
}

.gift:hover {
    transform: scale(1.2) !important;
    filter: brightness(1.3);
}

.gift-large {
    font-size: 32px;
}

.gift-medium {
    font-size: 24px;
}

.gift-small {
    font-size: 18px;
}

/* Универсальные стили для кнопки закрытия НАД окном */
.modal-close-top {
    position: absolute;
    top: max(clamp(15px, 6vw, 25px), env(safe-area-inset-top, 15px));
    right: clamp(15px, 6vw, 25px);
    background: rgba(255, 255, 255, 0.15);
    border: 2px solid rgba(255, 255, 255, 0.3);
    color: white;
    padding: clamp(10px, 3vw, 14px) clamp(16px, 4vw, 20px);
    border-radius: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    cursor: pointer;
    font-weight: 700;
    font-size: clamp(14px, 4vw, 16px);
    transition: all 0.3s ease;
    will-change: transform, opacity;
    z-index: 10001;
    background: rgba(255, 255, 255, 0.15) !important;

    min-width: 20px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.4);
}

.modal-close-top:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: translateY(-2px);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.5);
}

.modal-close-top:active {
    transform: translateY(0) scale(0.95);
}

/* Улучшенные стили для сетки крафта */
.craft-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: clamp(10px, 3vw, 15px);
    margin-bottom: clamp(12px, 4vw, 16px);
}

.craft-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: clamp(90px, 25vw, 110px);
    border-radius: clamp(12px, 4vw, 16px);
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    transition: all 0.2s;
    cursor: pointer;
    background: rgba(255, 255, 255, 0.15) !important;

    padding: 10px;
}

.craft-item.craftable-item:hover {
    border-color: var(--neon);
    transform: translateY(-2px);
    background: rgba(255, 255, 255, 0.08);
}

/* Улучшенная адаптивность для подарков */
@media (max-width: 480px) {
    .gift {
        font-size: 22px !important;
    }

    .gift-large {
        font-size: 20px;
    }

    .gift-medium {
        font-size: 18px;
    }

    .gift-small {
        font-size: 14px;
    }
}

/* Фикс для выходящих за пределы подарков */
@media (max-height: 700px) {
    .hero-stage {
        transform: translate(-50%, -50%) scale(0.9);
    }

    .gift {
        transform: scale(0.8);
    }
}

@media (max-height: 600px) {
    .hero-stage {
        transform: translate(-50%, -50%) scale(0.8);
    }

    .gift {
        transform: scale(0.7);
    }
}

/* ========== СТИЛИ ДЛЯ FLAPPY BIRD ========== */
#modal-flappy {
    background: rgba(10, 14, 26, 0.75) !important;
    background: rgba(10, 14, 26, 0.95) !important;

}

#flappy-canvas {
    border-radius: 20px;
    box-shadow: 0 15px 50px rgba(0, 0, 0, 0.7);
    cursor: pointer;
    touch-action: none;
}

.flappy-instruction {
    color: rgba(255, 255, 255, 0.6);
    font-size: clamp(11px, 3vw, 13px);
    font-weight: 600;
    text-align: center;
    margin-top: 12px;
    animation: pulse 2s ease-in-out infinite;
    will-change: opacity;
}

@keyframes fly {
    0% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-5px);
    }

    100% {
        transform: translateY(0);
    }
}

/* Улучшенные позиции подарков для маленьких экранов */
.gift-position-fix {
    position: absolute;
    z-index: 100;
}

/* Простые стили для картинок в вопросах */
#m-text img {
    display: block;
    margin: 0 auto 15px;
    max-height: 200px;
    max-width: 100%;
    object-fit: contain;
    border-radius: 8px;
}

@media (max-width: 480px) {
    #m-text img {
        max-height: 150px;
        margin-bottom: 12px;
    }
}

/* Стили для формы обратной связи */
.form-field {
    margin-bottom: clamp(12px, 3vw, 16px);
    text-align: left;
}

.form-field label {
    display: block;
    color: var(--text-dim);
    font-size: clamp(11px, 2.8vw, 13px);
    margin-bottom: 6px;
    font-weight: 600;
}

.form-field .form-value {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: clamp(10px, 3vw, 12px);
    color: var(--text-light);
    font-size: clamp(12px, 3vw, 14px);
    font-weight: 500;
    word-break: break-word;
}

.form-field textarea {
    width: 100%;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: clamp(10px, 3vw, 12px);
    color: white;
    font-size: clamp(12px, 3vw, 14px);
    font-family: 'Montserrat', sans-serif;
    resize: vertical;
    min-height: 120px;
    transition: all 0.3s ease;
    will-change: transform, opacity;
}

.form-field textarea:focus {
    outline: none;
    border-color: var(--text-light);
    background: rgba(255, 255, 255, 0.08);
}

.form-notice {
    background: rgba(0, 242, 254, 0.1);
    border: 1px solid rgba(0, 242, 254, 0.2);
    border-radius: 12px;
    padding: 12px;
    margin: 15px 0;
    color: var(--text-light);
    font-size: clamp(10px, 2.5vw, 12px);
    text-align: left;
}

/* Стили для выбора скина */
.skin-item {
    transition: all 0.3s ease;
    will-change: transform, opacity;
}

.skin-item.available:hover {
    transform: translateY(-5px);
    background: rgba(255, 255, 255, 0.08) !important;
    border-color: rgba(255, 255, 255, 0.2) !important;
}

.skin-item.selected {
    background: rgba(255, 106, 97, 0.1) !important;
    border-color: var(--primary) !important;
    box-shadow: 0 0 15px rgba(255, 106, 97, 0.2);
}

.skin-item.available:active {
    transform: scale(0.95);
}

.skin-item img {
    border-radius: 8px;
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.3));
}

.skin-item.selected img {
    filter: drop-shadow(0 4px 12px rgba(255, 106, 97, 0.4));
}

/* Анимация кругового лоадера */
.loader-circle {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(255, 255, 255, 0.1);
    border-left-color: #ff6a61;

    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* Плавное исчезновение */
.loader-fade-out {
    opacity: 0;
    transition: opacity 0.5s ease;
    pointer-events: none;
}

body,
html {
    height: calc(var(--vh, 1vh) * 100);
    min-height: calc(var(--vh, 1vh) * 100);
    width: 100vw;
    overflow: hidden;
    background: var(--matte-bg);
    color: var(--text-light);
    font-size: var(--base-font-size);
    touch-action: manipulation;
    margin: 0;
    padding: 0;
}

/* Отключение анимаций при предпочтении reduced-motion */
@media (prefers-reduced-motion: reduce) {

    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* ========== ФОН И ЧАСТИЦЫ ========== */
.bg-gradient {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100dvh; /* Dynamic Viewport Height для iOS */
    min-height: 100dvh;
    background: radial-gradient(circle at 50% 50%, #111827 0%, #0a0e1a 100%);
    z-index: 0;
}

/* ========== ГЛАВНЫЙ КОНТЕЙНЕР ========== */
.ui-wrapper {
    position: relative;
    z-index: 10;
    height: calc(var(--vh, 1vh) * 100);
    width: 100vw;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.content-limit {
    width: 100%;
    max-width: min(500px, 100vw);
    height: calc(var(--vh, 1vh) * 100);
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    position: relative;
    padding-top: max(var(--screen-padding), env(safe-area-inset-top));
    padding-right: max(var(--screen-padding), env(safe-area-inset-right));
    padding-bottom: max(var(--screen-padding), env(safe-area-inset-bottom));
    padding-left: max(var(--screen-padding), env(safe-area-inset-left));
}

/* ========== ЗАГОЛОВОК ИГРОКА ========== */
.hud {
    padding: var(--screen-padding);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: clamp(8px, 2vw, 15px);
    position: relative;
    z-index: 200;
    background: linear-gradient(to bottom, rgba(10, 14, 26, 0.95), transparent);
    backdrop-filter: blur(10px);
    min-height: 70px;
}

.user-info {
    display: flex;
    align-items: center;
    gap: clamp(8px, 2vw, 12px);
    flex: 1;
    min-width: 0;
}

.avatar-btn {
    width: var(--avatar-size);
    height: var(--avatar-size);
    min-width: 40px;
    min-height: 40px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.15);

    border: 2px solid var(--primary);
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: var(--glow-primary);
    flex-shrink: 0;
    overflow: visible;
    transition: transform 0.2s ease;
    animation: avatarGlow 6s infinite alternate;
}

@keyframes avatarGlow {
    0% {
        box-shadow: 0 0 15px rgba(255, 106, 97, 0.2);
    }

    100% {
        box-shadow: 0 0 25px rgba(255, 106, 97, 0.4);
    }
}

.avatar-btn:active {
    transform: scale(0.95);
}

.avatar-btn img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
}

.avatar-badge {
    position: absolute;
    bottom: -8px;
    right: -8px;
    background: linear-gradient(135deg, var(--gold), #ff4a3d) !important;
    /* ВАЖНО: !important */
    color: #000 !important;
    font-size: clamp(9px, 2.5vw, 11px);
    font-weight: 800;
    padding: clamp(3px, 1vw, 4px) clamp(5px, 1.5vw, 7px);
    border-radius: clamp(8px, 2vw, 10px);
    box-shadow: 0 3px 10px rgba(255, 106, 97, 0.3);
    z-index: 20;
    min-width: clamp(20px, 5vw, 22px);
    text-align: center;
    line-height: 1;
    border: 2px solid var(--matte-bg);
}

.user-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
    flex: 1;
}

.user-name {
    font-weight: 700;
    font-size: clamp(12px, 3vw, 14px);
    color: var(--text-light);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-class {
    font-weight: 500;
    font-size: clamp(10px, 2.5vw, 12px);
    color: var(--gold);
    opacity: 0.9;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    text-shadow: 0 0 8px rgba(255, 106, 97, 0.2);
}

.xp-display {
    background: rgba(255, 255, 255, 0.15);

    border: 1px solid rgba(255, 215, 0, 0.3);
    padding: clamp(6px, 2vw, 8px) clamp(8px, 2.5vw, 12px);
    border-radius: clamp(8px, 3vw, 12px);
    font-weight: 800;
    color: var(--gold);
    font-size: clamp(14px, 2.5vw, 12px);
    white-space: nowrap;
    backdrop-filter: blur(10px);
    flex-shrink: 0;
}

/* ========== ГЕРОЙ И ПОДАРКИ ========== */
.hero-stage {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: min(90vw, 400px);
    max-width: 400px;
    z-index: 5;
    pointer-events: auto;
    transition: 0.5s;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
}

/* Анимация тапа — лёгкий scale через transition, без reflow */
.hero-stage.hero-tap-press {
    transform: translate(-50%, -50%) scale(0.97) !important;
    transition: transform 0.05s ease-out !important;
}
.hero-stage {
    transition: transform 0.12s ease-out, opacity 0.5s;
}

/* Всплывающий +1 XP */
.tap-xp-float {
    position: fixed;
    font-size: 22px;
    font-weight: 900;
    color: #fff;
    text-shadow: 0 0 12px rgba(255, 106, 97, 0.9), 0 2px 8px rgba(0,0,0,0.5);
    letter-spacing: 1px;
    pointer-events: none;
    z-index: 9999;
    animation: tapXpFloat 0.9s ease-out forwards;
    white-space: nowrap;
}
@keyframes tapXpFloat {
    0%   { opacity: 1;   transform: translateY(0)   scale(1); }
    30%  { opacity: 1;   transform: translateY(-18px) scale(1.15); }
    100% { opacity: 0;   transform: translateY(-60px) scale(0.9); }
}

.hero-stage img {
    width: 100%;
    height: auto;
    max-height: 50vh;
    object-fit: contain;
    filter: drop-shadow(0 0 40px rgba(255, 106, 97, 0.25));
}

.hero-glow {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: min(120vw, 500px);
    height: min(120dvh, 500px); /* Dynamic Viewport Height для iOS */
    background: radial-gradient(circle, rgba(255, 106, 97, 0.15) 0%, transparent 70%);
    filter: blur(40px);
    z-index: 4;
    opacity: 0.6;
}

.hero-blur {
    opacity: 0.8 !important;
    filter: brightness(0.6) contrast(1) !important;

    transition: all 0.3s ease;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
}

.gift {
    position: absolute;
    z-index: 1000;
    font-size: 14px;
    filter:
        drop-shadow(0 0 5px rgba(255, 255, 255, 0.75))
        brightness(1.1);
    animation: float 3s ease-in-out infinite;
    cursor: pointer;
    transition: transform 0.3s ease;
    pointer-events: auto;
    transform-origin: center;
    user-select: none;
    display: block !important;
    opacity: 1 !important;
    visibility: visible !important;
    width: 36px;
    height: 36px;
    text-align: center;
    line-height: 36px;
    color: var(--primary);
    background: transparent !important;
}

/* АЛЬТЕРНАТИВНЫЙ ВАРИАНТ - БЕЗ РАЗМЫТИЯ ГРАДИЕНТА */
.gift.alternative::before {
    background: radial-gradient(circle at center,
            currentColor 0%,
            rgba(255, 255, 255, 0.9) 30%,
            rgba(255, 255, 255, 0.5) 50%,
            rgba(0, 0, 0, 0.4) 55%,
            /* Резкий переход к темному */
            transparent 60%
            /* Четкая граница */
        );
    filter: none;
    /* БЕЗ РАЗМЫТИЯ */
    opacity: 0.9;
}

.gift:active {
    transform: scale(1.2);
}

.gift:hover {
    transform: scale(1.2);
    /* Немного светлее при наведении, но все еще темное */
    filter:
        drop-shadow(0 0 4px rgba(255, 255, 255, 0.7)) drop-shadow(0 0 8px rgba(255, 106, 97, 0.6)) drop-shadow(0 0 14px rgba(0, 0, 0, 0.8)) drop-shadow(0 0 3px rgba(0, 0, 0, 0.95)) brightness(1.05);
}

.gift:hover::before {
    opacity: 0.8;
    background: radial-gradient(circle at center,
            rgba(255, 106, 97, 0.5) 0%,
            rgba(255, 106, 97, 0.4) 20%,
            rgba(255, 106, 97, 0.3) 40%,
            rgba(0, 0, 0, 0.6) 60%,
            transparent 70%);
}

.gift img {
    filter:
        drop-shadow(0 0 2px rgba(255, 255, 255, 0.5))
        /* ТЕМНЕЕ */
        drop-shadow(0 0 4px rgba(255, 106, 97, 0.4)) drop-shadow(0 0 6px rgba(0, 0, 0, 0.6)) brightness(0.9);

}

.gift:hover img {
    transform: scale(1.2);
    filter: drop-shadow(0 0 15px rgba(255, 106, 97, 0.5));
}

/* Размеры подарков */
.gift-small {
    font-size: 16px;
    width: 30px;
    height: 30px;
    line-height: 30px;
}

.gift-medium {
    font-size: 24px;
    width: 40px;
    height: 40px;
    line-height: 40px;
}

.gift-large {
    font-size: 32px;
    width: 50px;
    height: 50px;
    line-height: 50px;
}

.gift::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
   width: 55px;
    height: 55px;
    border-radius: 50%;
    background: radial-gradient(circle at center,
            color-mix(in srgb, currentColor, transparent 10%) 0%,
            color-mix(in srgb, currentColor, transparent 50%) 35%,
            color-mix(in srgb, currentColor, transparent 80%) 60%,
            transparent 75%);
    filter: blur(8px);
    opacity: 0.05;
    z-index: -1;
    pointer-events: none;
}
/* ИСКОРКИ вокруг подарка */
.gift::after {
    content: '✦';
    position: absolute;
    top: -10px;
    right: -12px;
    font-size: 10px;
    color: currentColor;
    opacity: 0.7;
    animation: sparkle 2s ease-in-out infinite;
    pointer-events: none;
    z-index: 1;
    text-shadow: -18px 28px 0 currentColor, 22px 20px 0 currentColor;
    font-style: normal;
}

@keyframes sparkle {
    0%, 100% { opacity: 0.7; transform: scale(1); }
    50% { opacity: 0.2; transform: scale(0.6); }
}

/* ========== ЭКРАНЫ ========== */
.screen {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    padding: clamp(70px, 20vw, 100px) var(--screen-padding) 0;
    display: none;
    overflow-y: auto;
    z-index: 20;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
}

.screen.active {
    opacity: 1 !important;
    display: block;
}

#scr-home.active {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
    padding-bottom: clamp(150px, 40vw, 200px);
}

/* ТОЛЬКО главный экран имеет отступ снизу */
#scr-home.screen {
    padding-bottom: 180px !important;
}

.screen:not(#scr-home) {
    padding-top: calc(var(--hud-height) + 16px) !important;
    padding-bottom: 120px !important;
}

.screen-title {
    text-align: center;
    margin-bottom: clamp(15px, 5vw, 25px);
    font-weight: 800;
    font-size: clamp(16px, 5vw, 20px);
    color: var(--text-light);
    padding: 10px 10px;
    background: transparent !important;
    text-shadow: 0 0 10px rgba(255, 106, 97, 0.2);
}

/* ========== КАРТОЧКИ ========== */
/* Базовый стиль карточки */
.glass-card {
    background: var(--glass-card);
    border: 1px solid var(--glass-border);
    border-radius: var(--card-radius);
    backdrop-filter: blur(var(--blur-intensity));
    -webkit-backdrop-filter: blur(var(--blur-intensity));
    box-shadow: var(--shadow-light),
        0 1px 3px rgba(255, 255, 255, 0.05),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Ежедневный вызов */
.urgent-card {
    background: rgba(255, 77, 77, 0.15);

    border: 1px solid var(--fire);
    color: var(--text-light);
    width: 70%;
    max-width: 350px;
    border-radius: var(--card-radius);
    padding: clamp(10px, 2.5vw, 14px);
    display: flex;
    align-items: center;
    gap: clamp(8px, 2vw, 12px);
    cursor: pointer;
    backdrop-filter: blur(var(--blur-intensity));
    -webkit-backdrop-filter: blur(var(--blur-intensity));
    margin-top: auto;
    margin-bottom: clamp(10px, 5vw, 10px);
    animation: pulse 2s infinite;
}

.urgent-card:active {
    transform: scale(0.95);
}

#scr-home .urgent-card {
    display: flex !important;
    position: relative;
    bottom: -130px;
    margin: 0 auto 80px;
    width: 70%;
    max-width: 350px;
}

/* Карточка этапа */
.stage-card {
    background: var(--glass-card);
    border: 1px solid var(--glass-border);
    border-radius: var(--card-radius);
    backdrop-filter: blur(var(--blur-intensity));
    -webkit-backdrop-filter: blur(var(--blur-intensity));
    box-shadow: var(--shadow-light),
        0 1px 3px rgba(255, 255, 255, 0.05),
        inset 0 1px 0 rgba(255, 255, 255, 0.05);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    padding: clamp(12px, 3vw, 16px);
    margin-bottom: clamp(8px, 2vw, 10px);
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    min-height: clamp(56px, 15vw, 70px);
}

.stage-card:active {
    transform: scale(0.95);
    background: rgba(255, 255, 255, 0.2);
}

/* Варианты карточек */
.stage-done {
    border-color: #00848C;
    background: #00CF91;
}

.stage-lock {
    opacity: 0.4;
    pointer-events: none;
    filter: grayscale(1);
}

.stage-ready {
    border-color: rgba(255, 106, 97, 0.3);
}

/* Элементы карточки */
.card-number {
    font-size: clamp(12px, 3vw, 14px);
    font-weight: 800;
    color: var(--text-light);
    margin-right: clamp(10px, 3vw, 15px);
    width: clamp(20px, 6vw, 30px);
    text-align: center;
    flex-shrink: 0;
    background: transparent !important;
    text-shadow: 0 0 8px rgba(255, 106, 97, 0.3);
}

.card-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-width: 0;
}

.card-title {
    font-weight: 700;
    font-size: clamp(12px, 3vw, 14px);
    margin-bottom: 2px;
    color: var(--text-light);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    background: transparent !important;
}

.card-sub {
    font-size: clamp(10px, 2.5vw, 12px);
    color: var(--text-dim);
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    background: transparent !important;
}

/* Карточки подарков */
.gift-card {
    background: rgba(255, 255, 255, 0.12);

    border-radius: 10px;
    padding: clamp(15px, 4vw, 20px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    transition: all 0.3s ease;
    cursor: pointer;
    aspect-ratio: 1;
    width: 100%;
    position: relative;
    overflow: hidden;
}

.gift-card:active {
    transform: scale(0.95);
}

.gift-card:hover {
    transform: translateY(-5px);
    border-color: var(--primary);
    box-shadow: 0 10px 25px rgba(255, 106, 97, 0.2);
}

.gift-card-icon {
    font-size: clamp(32px, 8vw, 42px);
    margin: 0;
    line-height: 1;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    filter: drop-shadow(0 4px 8px rgba(255, 106, 97, 0.3));
    transition: all 0.3s ease;
    color: var(--primary);
    background: transparent !important;
}

.gift-card img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    border-radius: 12px;
    transition: transform 0.3s ease;
}

.gift-card:hover .gift-card-icon img {
    transform: scale(1.1);
}

.gift-card-name {
    display: none !important;
}

.gift-card-desc {
    display: none !important;
}

.empty-inventory {
    grid-column: 1 / -1;
    text-align: center;
    padding: 40px 20px;
    color: var(--text-dim);
}

/* ========== ЗАГОЛОВКИ ЗАДАНИЙ (ВОССТАНОВЛЕНЫ) ========== */
.branch-header {
    color: var(--text-light);
    font-weight: 800;
    margin: clamp(15px, 5vw, 25px) 0 clamp(8px, 2.5vw, 12px);
    font-size: clamp(12px, 3.5vw, 14px);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding-left: clamp(6px, 2vw, 8px);
    background: transparent !important;
    text-shadow: 0 0 8px rgba(255, 106, 97, 0.2);
}

.stages-container {
    display: flex;
    flex-direction: column;
    gap: clamp(6px, 2vw, 10px);
}

/* ========== ДОК-ПАНЕЛЬ ========== */
.dock {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    position: fixed;
    bottom: clamp(12px, 3vh, 20px);
    left: 50%;
    transform: translateX(-50%);
    height: 60px;
padding: 0 clamp(20px, 6vw, 30px);
    border-radius: clamp(30px, 10vw, 50px);
    display: flex;
    justify-content: center;
    align-items: center;
    gap: clamp(20px, 6vw, 30px);
    z-index: 1000;
    width: auto;
    min-width: min(280px, 90vw);
    max-width: 90vw;
    backdrop-filter: blur(var(--blur-intensity));
    -webkit-backdrop-filter: blur(var(--blur-intensity));
    box-sizing: border-box;
}

.dock-item {
    font-size: var(--icon-size);
    cursor: pointer;
    opacity: 0.5;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.3));
    color: var(--text-light);
    display: flex;
    justify-content: center;
    align-items: center;
    width: var(--icon-size);
    height: var(--icon-size);
    background: transparent !important;
    border: none !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    padding: 0 !important;
    margin: 0 !important;
    /* transform: translateY(4px); ← это и было причиной смещения */
}

.dock-item.active {
    opacity: 1;
    color: var(--primary) !important;
    transform: scale(1.2) translateY(-2px);
    text-shadow: 0 0 20px rgba(255, 106, 97, 0.7);
    background: transparent !important;
}

.dock-item:hover {
    opacity: 0.8;
    transform: scale(1.1);
}

.dock-item:active {
    transform: scale(0.95);
}

/* ========== КНОПКИ И ФОРМЫ ========== */
.glass-btn {
    background: rgba(255, 255, 255, 0.15);

    border: 1px solid var(--glass-border);
    color: var(--text-light);
    padding: var(--btn-padding);
    border-radius: var(--card-radius);
    font-weight: 600;
    text-align: center;
    width: 100%;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    font-size: var(--btn-font-size);
    height: var(--btn-height);
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.glass-btn:active {
    transform: scale(0.95);
    background: rgba(255, 255, 255, 0.2);
}

.btn-primary {
    background: #922D25;
    color: #ffffff;
    border: none;
    font-weight: 700;
    transition: transform 0.15s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn-primary:active {
    transform: scale(0.95);
}

input[type="text"],
input[type="number"],
textarea {
    font-size: clamp(14px, 4vw, 16px);
    height: var(--btn-height);
    min-height: 44px;
    width: 100%;
    padding: 0 clamp(12px, 3vw, 16px);
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid var(--glass-border);
    border-radius: var(--card-radius);
    color: var(--text-light);
    font-family: var(--font-main);
}

/* ========== АВТОРИЗАЦИЯ ========== */
#auth-wrapper {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100dvh; /* Dynamic Viewport Height для iOS */
    min-height: 100dvh;
    min-height: -webkit-fill-available;
    z-index: 99999;
    background: radial-gradient(circle at 50% 50%, #111827 0%, #0a0e1a 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--screen-padding);
    backdrop-filter: blur(10px);
}

.auth-card {
    background: rgba(10, 14, 26, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: var(--card-radius);
    backdrop-filter: blur(var(--blur-intensity));
    -webkit-backdrop-filter: blur(var(--blur-intensity));
    box-shadow: var(--shadow-light),
        0 1px 3px rgba(255, 255, 255, 0.05),
        inset 0 1px 0 rgba(255, 255, 255, 0.05);
    width: 100%;
    max-width: min(340px, 90vw);
    border-radius: clamp(16px, 6vw, 24px);
    padding: clamp(20px, 6vw, 30px) clamp(15px, 4vw, 20px);
    text-align: center;
    position: relative;
    overflow: hidden;
}

.scanner-line {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--primary), transparent);
    box-shadow: 0 0 12px var(--primary);
    animation: scan 3s infinite ease-in-out;
    opacity: 0.5;
    pointer-events: none;
}

.auth-title {
    font-size: clamp(20px, 6vw, 24px);
    margin-bottom: 5px;
    line-height: 1.2;
    font-weight: 700;
    color: var(--text-light);
}

.auth-sub {
    font-size: clamp(12px, 3vw, 14px);
    margin-bottom: 25px;
    line-height: 1.3;
    padding: 0 10px;
    color: rgba(255, 255, 255, 0.8);
}

.auth-toggle {
    font-size: clamp(13px, 3.5vw, 15px);
    color: var(--primary);
    margin-top: clamp(15px, 4vw, 20px);
    opacity: 0.9;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.3s ease;
    background: rgba(255, 106, 97, 0.2);
    border: 1px solid rgba(255, 106, 97, 0.3);
    border-radius: clamp(10px, 3vw, 12px);
    padding: clamp(10px, 3vw, 12px);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    text-align: center;
    display: block;
    width: 100%;
    box-shadow: 0 4px 12px rgba(255, 106, 97, 0.2);
    backdrop-filter: blur(10px);
}

.auth-toggle:active {
    transform: translateY(0) scale(0.95);
    opacity: 1;
}

/* ========== МОДАЛЬНЫЕ ОКНА ========== */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100dvh; /* Dynamic Viewport Height для iOS */
    min-height: 100dvh;
    min-height: -webkit-fill-available;
    z-index: 5000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: var(--screen-padding);
    background: rgba(0, 0, 0, 0.8);

    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    animation: fadeIn 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow-y: auto;
}

.modal-window {
    background: rgba(10, 14, 26, 0.48);

    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: var(--card-radius);
    backdrop-filter: blur(25px);
    -webkit-backdrop-filter: blur(25px);
    box-shadow: var(--shadow-medium),
        0 2px 8px rgba(255, 255, 255, 0.05),
        inset 0 1px 0 rgba(255, 255, 255, 0.05);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: clamp(16px, 6vw, 24px);
    width: 100%;
    max-width: min(400px, 95vw);
    overflow: hidden;
    transform: scale(0.95);
    animation: popIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
    position: relative;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-header {
    padding: clamp(16px, 5vw, 20px) clamp(16px, 5vw, 20px) clamp(12px, 4vw, 16px);
    text-align: center;
    background: linear-gradient(to bottom, rgba(255, 255, 255, 0.05), transparent);
}

.modal-header h2 {
    font-weight: 800;
    font-size: clamp(16px, 4vw, 18px);
    color: var(--text-light);
    letter-spacing: 0.5px;
    background: transparent !important;
    text-shadow: 0 0 10px rgba(255, 106, 97, 0.2);
}

.modal-body {
    padding: clamp(16px, 5vw, 20px);
}

/* Кнопка закрытия */
.window-close {
    position: absolute;
    top: clamp(12px, 4vw, 16px);
    right: clamp(12px, 4vw, 16px);
    width: clamp(24px, 6vw, 28px);
    height: clamp(24px, 6vw, 28px);
    border-radius: 50%;
    background: rgba(255, 106, 97, 0.2);
    border: 1px solid rgba(255, 106, 97, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: clamp(12px, 3.5vw, 14px);
    cursor: pointer;
    color: var(--text-light);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 100;
    backdrop-filter: blur(10px);
    flex-shrink: 0;
}

.window-close:active {
    transform: scale(0.95);
    background: rgba(255, 106, 97, 0.25);
}

/* Кнопка закрытия сверху */
.modal-close-top {
    position: absolute;
    top: clamp(15px, 6vw, 25px);
    right: clamp(15px, 6vw, 25px);
    background: rgba(255, 255, 255, 0.2);
    border: 2px solid rgba(255, 255, 255, 0.3);
    color: white;
    padding: clamp(10px, 3vw, 14px) clamp(16px, 4vw, 20px);
    border-radius: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    cursor: pointer;
    font-weight: 700;
    font-size: clamp(14px, 4vw, 16px);
    transition: all 0.3s ease;
    z-index: 10001;
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    min-width: 20px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.4);
}

.modal-close-top:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateY(-2px);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.5);
}

.modal-close-top:active {
    transform: translateY(0) scale(0.95);
}

/* Окно подарка */
.gift-popup {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    z-index: 10000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: var(--screen-padding);
    animation: fadeIn 0.3s ease;
}

.gift-popup-content {
    background: rgba(10, 14, 26, 0.98);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: clamp(20px, 6vw, 24px);
    width: 100%;
    max-width: min(380px, 90vw);
    overflow: hidden;
    position: relative;

    box-shadow: var(--shadow-heavy);
    backdrop-filter: blur(25px);
    -webkit-backdrop-filter: blur(25px);
}

.gift-popup-header {
    padding: clamp(25px, 8vw, 35px) clamp(20px, 6vw, 30px) clamp(15px, 5vw, 20px);
    text-align: center;
    background: linear-gradient(to bottom, rgba(255, 255, 255, 0.05), transparent);
}

.gift-popup-icon {
    font-size: clamp(60px, 15vw, 80px);
    margin: 0 auto clamp(10px, 3vw, 15px);
    /* animation: float 3s ease-in-out infinite, giftGlow 2s ease-in-out infinite; */
    display: inline-block;
    filter: drop-shadow(0 10px 20px rgba(255, 106, 97, 0.3));
    color: var(--primary);
    background: transparent !important;
}

@keyframes giftGlow {

    0%,
    100% {
        filter: drop-shadow(0 10px 20px rgba(255, 106, 97, 0.3));
        transform: scale(1);
    }

    50% {
        filter: drop-shadow(0 15px 30px rgba(255, 106, 97, 0.5));
        transform: scale(1.05);
    }
}

.gift-popup-body {
    padding: 0 clamp(20px, 6vw, 30px) clamp(20px, 6vw, 30px);
    text-align: center;
    overflow-wrap: break-word;
    word-wrap: break-word;
    word-break: break-word;
    hyphens: auto;
}

.gift-popup-body h2 {
    color: var(--texl-light);
    font-weight: 800;
    font-size: clamp(18px, 5vw, 22px);
    margin-bottom: clamp(10px, 3vw, 15px);
    line-height: 1.3;
    background: transparent !important;
    text-shadow: 0 0 10px rgba(255, 106, 97, 0.2);
}

.gift-popup-body p {
    color: var(--text-dim);
    font-size: clamp(14px, 4vw, 16px);
    line-height: 1.5;
    margin-bottom: clamp(20px, 6vw, 25px);
    padding: 0 clamp(5px, 2vw, 10px);
    opacity: 0.9;
    background: transparent !important;
}
.gift-rarity-block {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: linear-gradient(135deg, rgba(34, 197, 94, 0.15), rgba(16, 185, 129, 0.1));
    border: 1px solid rgba(34, 197, 94, 0.3);
    border-radius: 14px;
    padding: 12px 18px;
    margin-bottom: clamp(15px, 5vw, 20px);
}

.gift-rarity-label {
    font-size: clamp(12px, 3.5vw, 14px);
    color: rgba(134, 239, 172, 0.9);
    font-weight: 600;
}

.gift-rarity-value {
    font-size: clamp(14px, 4vw, 16px);
    color: #4ade80;
    font-weight: 800;
    letter-spacing: 0.5px;
}
.craft-cost-block {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    background: rgba(255, 215, 0, 0.07);
    border: 1px solid rgba(255, 215, 0, 0.2);
    border-radius: 14px;
    padding: 10px 18px;
    font-size: clamp(13px, 3.5vw, 15px);
    color: var(--gold);
    font-weight: 700;
}
.gift-popup-footer {
    margin-top: clamp(15px, 5vw, 20px);
}

.gift-popup-footer .glass-btn {
    height: clamp(44px, 12vw, 52px);
    font-size: clamp(14px, 4vw, 16px);
    font-weight: 700;
    letter-spacing: 0.5px;
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

/* ========== ОКНО МИССИИ ========== */
.mission-step {
    text-align: center;
    color: var(--gold);
    font-weight: 800;
    margin-bottom: clamp(15px, 4vw, 20px);
    font-size: clamp(10px, 2.5vw, 12px);
    letter-spacing: 0.5px;
    text-transform: uppercase;
    background: transparent !important;
}

.mission-question {
    padding: 0;
    text-align: center;
    font-size: clamp(14px, 4vw, 16px);
    font-weight: 700;
    margin-bottom: clamp(15px, 4vw, 20px);
    line-height: 1.4;
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    background: rgba(255, 255, 255, 0.12) !important;
    border-radius: 0 !important;
}

.mission-question img {
    display: block;
    margin: 0 auto 15px;
    max-height: 200px;
    max-width: 100%;
    object-fit: contain;
    border-radius: 8px;
    animation: fadeIn 0.3s ease-out;
}

.mission-answer {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: clamp(12px, 4vw, 18px);
    backdrop-filter: blur(var(--blur-intensity));
    padding: clamp(12px, 3vw, 16px);
    text-align: left;
    font-size: clamp(13px, 3.5vw, 14px);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    min-height: 50px;
    display: flex;
    align-items: center;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.mission-answer:active {
    transform: scale(0.95);
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 106, 97, 0.3);
}

.mission-answers {
    display: flex;
    flex-direction: column;
    gap: clamp(8px, 2.5vw, 12px);
}

/* ========== ПРОФИЛЬ ИГРОКА ========== */
.player-profile {
    text-align: center;
}

.player-avatar {
    width: clamp(56px, 15vw, 72px);
    height: clamp(56px, 15vw, 72px);
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.15);
    border: 2px solid var(--primary);
    margin: 0 auto clamp(8px, 2.5vw, 12px);
    overflow: hidden;
    backdrop-filter: blur(10px);
    box-shadow: 0 0 20px rgba(255, 106, 97, 0.2);
}

.player-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.player-name {
    font-weight: 800;
    font-size: clamp(16px, 4.5vw, 18px);
    color: var(--text-light);
    margin-bottom: 2px;
    background: transparent !important;
}

.player-level {
    font-weight: 600;
    font-size: clamp(12px, 3.5vw, 14px);
    color: var(--text-light);
    margin-bottom: clamp(15px, 4vw, 20px);
    opacity: 0.9;
    background: transparent !important;
    text-shadow: 0 0 8px rgba(255, 106, 97, 0.2);
}

.player-stats {
    display: flex;
    justify-content: space-around;
    margin: clamp(12px, 4vw, 16px) 0;
    padding: clamp(10px, 3vw, 12px);
    background: rgba(255, 255, 255, 0.1);
    border-radius: clamp(12px, 4vw, 16px);
    border: 1px solid rgba(255, 255, 255, 0.12);
    backdrop-filter: blur(10px);
}

.stat-item {
    text-align: center;
    flex: 1;
    min-width: 0;
    padding: 0 5px;
}

.stat-value {
    font-weight: 800;
    font-size: clamp(16px, 4.5vw, 18px);
    color: var(--text-light);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    background: transparent !important;
    text-shadow: 0 0 8px rgba(255, 106, 97, 0.2);
}

.stat-label {
    font-size: clamp(12px, 2.7vw, 11px);
    color: var(--text-dim);
    margin-top: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    background: transparent !important;
}

.progress-section {
    margin: clamp(15px, 4vw, 20px) 0;
}

.progress-title {
    font-weight: 600;
    font-size: clamp(10px, 2.8vw, 12px);
    color: var(--text-dim);
    margin-bottom: clamp(6px, 2vw, 8px);
    text-align: left;
    background: transparent !important;
}

.progress-bar {
    height: clamp(4px, 1.5vw, 6px);
    background: rgba(255, 255, 255, 0.15);
    border-radius: clamp(2px, 1vw, 3px);
    overflow: hidden;
    margin-bottom: clamp(8px, 2.5vw, 12px);
    backdrop-filter: blur(5px);
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), #ff4a3d);
    border-radius: inherit;
    transition: width 0.5s ease;
}

.progress-info {
    display: flex;
    justify-content: space-between;
    font-size: clamp(9px, 2.5vw, 11px);
    color: var(--text-dim);
    background: transparent !important;
}

/* ========== ИНВЕНТАРЬ ========== */
.tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.tab {
    padding: 10px 20px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.1);
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: clamp(12px, 3vw, 14px);
    border: 1px solid rgba(255, 255, 255, 0.12);
    text-align: center;
    flex: 1;
}

.tab.active {
    background: rgba(255, 106, 97, 0.2);
    border-color: rgba(255, 106, 97, 0.35);
    color: #ffffff;
    font-weight: 600;
}

.tab:active {
    transform: scale(0.95);
}

/* Сетки */
#inv-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: clamp(8px, 2.5vw, 12px);
    margin-bottom: clamp(12px, 4vw, 16px);
}

#gifts-grid,
#profile-gifts-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: clamp(8px, 2.5vw, 12px);
    margin-bottom: clamp(12px, 4vw, 16px);
}

.inv-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: clamp(70px, 22vw, 100px);
    aspect-ratio: 1;
    border-radius: clamp(12px, 4vw, 16px);
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.12);
    transition: all 0.3s ease;
    cursor: pointer;
    backdrop-filter: blur(10px);
    padding: 10px;
}

.inv-item:hover {
    border-color: var(--primary);
    transform: translateY(-2px);
    background: rgba(255, 255, 255, 0.15);
}

.inv-item:active {
    transform: scale(0.95);
}

.inv-item-gold {
    background: linear-gradient(135deg, rgba(255, 215, 0, 0.15), rgba(255, 215, 0, 0.05));
    border-color: rgba(255, 215, 0, 0.35);
    box-shadow: 0 0 20px rgba(255, 215, 0, 0.2);
}

.craft-available {
    border-color: var(--gold);
    box-shadow: 0 0 15px rgba(255, 215, 0, 0.25);
}

/* ========== УВЕДОМЛЕНИЯ ========== */
#toast {
    position: fixed;
    top: clamp(70px, 20vw, 100px);
    left: 0;
    right: 0;
    text-align: center;
    z-index: 10000;
    display: none;
    pointer-events: none;
    padding: 0 var(--screen-padding);
}

.toast-content {
    display: inline-block;
    background: rgba(255, 255, 255, 0.15);
    color: #ffffff;
    padding: clamp(10px, 3vw, 12px) clamp(15px, 5vw, 24px);
    border-radius: clamp(20px, 8vw, 24px);
    font-weight: 800;
    font-size: clamp(11px, 3vw, 13px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
    animation: toastSlideIn 0.3s cubic-bezier(0.4, 0, 0.2, 1),
        toastSlideOut 0.3s cubic-bezier(0.4, 0, 0.2, 1) 1.7s;
    white-space: nowrap;
    max-width: 90vw;
    overflow: hidden;
    text-overflow: ellipsis;
    border: 1px solid rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

.toast-content.toast-success {
    background: rgba(34, 197, 94, 0.35);
    border-color: rgba(34, 197, 94, 0.4);
    box-shadow: 0 8px 24px rgba(34, 197, 94, 0.2);
}

.toast-content.toast-error {
    background: rgba(239, 68, 68, 0.35);
    border-color: rgba(239, 68, 68, 0.4);
    box-shadow: 0 8px 24px rgba(239, 68, 68, 0.2);
}

.toast-content.toast-multiline {
    white-space: normal;
    text-overflow: unset;
    overflow: visible;
    max-width: 82vw;
    text-align: left;
    line-height: 1.5;
}

/* ========== ИСТОРИИ (ВОССТАНОВЛЕНЫ СТИЛИ КАРТИНОК) ========== */
.story-page {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: none;
}

.story-page.active {
    display: block;
}

.story-image-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

.story-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        to top,
        rgba(0,0,0,0.85) 0%,
        rgba(0,0,0,0.55) 28%,
        rgba(0,0,0,0.12) 55%,
        transparent 100%
    );
    z-index: 1;
    pointer-events: none;
}

.story-content {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    z-index: 2;
    padding: 0 clamp(16px, 4vw, 24px) clamp(32px, 10vw, 48px);
    pointer-events: none;
}

.story-text {
    background: transparent !important;
    backdrop-filter: none;
    border: none;
    box-shadow: none;
    padding: 0;
    max-width: 100%;
    margin: 0;
}

.story-text h1 {
    font-weight: 800;
    color: #ffffff;
    margin-bottom: clamp(5px, 1.5vw, 8px);
    font-size: clamp(17px, 5vw, 22px);
    text-shadow: 0 2px 12px rgba(0,0,0,0.8);
    line-height: 1.2;
}

.story-text p {
    font-size: clamp(13px, 3.5vw, 16px);
    color: rgba(255,255,255,0.88);
    line-height: 1.45;
    text-shadow: 0 1px 8px rgba(0,0,0,0.7);
}

/* ========== КРАФТ ========== */
.craft-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: clamp(10px, 3vw, 15px);
    margin-bottom: clamp(12px, 4vw, 16px);
}

.craft-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: clamp(90px, 25vw, 110px);
    border-radius: clamp(12px, 4vw, 16px);
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.15);
    transition: all 0.3s ease;
    cursor: pointer;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    padding: 10px;
}

.craft-item:active {
    transform: scale(0.95);
}

.craft-item.craftable-item:hover {
    border-color: var(--text-light);
    transform: translateY(-2px);
    background: rgba(255, 255, 255, 0.15);
}

.craftable-item {
    border-color: var(--text-light);
}

.already-crafted {
    opacity: 0.3;
}

/* ========== ФОРМА ОБРАТНОЙ СВЯЗИ ========== */
.form-field {
    margin-bottom: clamp(12px, 3vw, 16px);
    text-align: left;
}

.form-field label {
    display: block;
    color: var(--text-dim);
    font-size: clamp(11px, 2.8vw, 13px);
    margin-bottom: 6px;
    font-weight: 600;
    background: transparent !important;
}

.form-field .form-value {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 12px;
    padding: clamp(10px, 3vw, 12px);
    color: var(--text-light);
    font-size: clamp(12px, 3vw, 14px);
    font-weight: 500;
    word-break: break-word;
}

.form-field textarea {
    width: 100%;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 12px;
    padding: clamp(10px, 3vw, 12px);
    color: white;
    font-size: clamp(12px, 3vw, 14px);
    font-family: var(--font-main);
    resize: vertical;
    min-height: 120px;
    transition: all 0.3s ease;
}

.form-field textarea:focus {
    outline: none;
    border-color: var(--text-light);
    background: rgba(255, 255, 255, 0.15);
}

.form-notice {
    background: rgba(0, 242, 254, 0.2);
    border: 1px solid rgba(0, 242, 254, 0.3);
    border-radius: 12px;
    padding: 12px;
    margin: 15px 0;
    color: var(--text-light);
    font-size: clamp(10px, 2.5vw, 12px);
    text-align: left;
}

/* ========== УТИЛИТЫ ========== */
.no-select {
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

.text-primary {
    color: var(--primary);
}

.text-dim {
    color: var(--text-dim);
}

.text-light {
    color: var(--text-light);
}

.text-center {
    text-align: center;
}

.hidden {
    display: none !important;
}

.visible {
    display: block !important;
}

/* Скрыть скроллбары */
* {
    scrollbar-width: none;
    -ms-overflow-style: none;
}

*::-webkit-scrollbar {
    display: none;
}

/* ========== АНИМАЦИИ ========== */
@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(255, 77, 77, 0.3);
    }

    70% {
        box-shadow: 0 0 0 12px rgba(255, 77, 77, 0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(255, 77, 77, 0);
    }
}

@keyframes scan {
    0% {
        top: 0%;
        opacity: 0;
    }

    10% {
        opacity: 1;
    }

    90% {
        opacity: 1;
    }

    100% {
        top: 100%;
        opacity: 0;
    }
}

@keyframes popIn {
    to {
        transform: scale(1);
        opacity: 1;
    }
}

@keyframes toastSlideIn {
    from {
        opacity: 0;
        transform: translateY(-30px) scale(0.9);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes toastSlideOut {
    from {
        opacity: 1;
        transform: translateY(0) scale(1);
    }

    to {
        opacity: 0;
        transform: translateY(-30px) scale(0.9);
    }
}
.gift-float {
    animation: float-gentle 4s ease-in-out infinite;
    will-change: transform;
}
@keyframes float-gentle {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-8px);
    }
}

@keyframes spin {
    0% {
        transform: rotate(0deg) translateY(0);
    }

    50% {
        transform: rotate(180deg) translateY(-8px);
    }

    100% {
        transform: rotate(360deg) translateY(0);
    }
}

/* ========== МЕДИА ЗАПРОСЫ ========== */
/* Маленькие телефоны (до 320px) */
@media (max-width: 320px) {
    :root {
        --base-font-size: 11px;
        --icon-size: 18px;
        --avatar-size: 36px;
    }

    

    .avatar-btn {
        width: 36px;
        height: 36px;
    }

    .gift {
        font-size: 14px;
        width: 30px;
        height: 30px;
    }

    #gifts-grid,
    #profile-gifts-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Телефоны (до 480px) */
@media (max-width: 480px) {
    .mission-question img {
        max-height: 150px;
        margin-bottom: 12px;
    }

    .gift-popup-content {
        max-width: 95vw;
    }

    .gift-popup-body h2 {
        font-size: 18px;
    }

    .gift-popup-body p {
        font-size: 14px;
    }

    #gifts-grid,
    #profile-gifts-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 10px;
    }

    .gift-card {
        padding: 12px;
    }

    .gift-card-icon {
        font-size: 28px;
    }

    .gift img {
        max-width: 40px;
        max-height: 40px;
    }

    .gift-card-icon img {
        max-width: 48px;
        max-height: 48px;
    }

    .gift-popup-header img {
        width: 80px;
        height: 80px;
    }

    /* Исправление для маленьких экранов */
    .gift {
        font-size: 22px !important;
    }

    .gift-large {
        font-size: 20px;
    }

    .gift-medium {
        font-size: 18px;
    }

    .gift-small {
        font-size: 14px;
    }

    /* Фикс для выходящих за пределы подарков */
    @media (max-height: 700px) {
        .hero-stage {
            transform: translate(-50%, -50%) scale(0.9);
        }

        .gift {
            transform: scale(0.8);
        }
    }

    @media (max-height: 600px) {
        .hero-stage {
            transform: translate(-50%, -50%) scale(0.8);
        }

        .gift {
            transform: scale(0.7);
        }
    }
}

/* Планшеты (от 768px) */
@media (min-width: 768px) {
    .gift-card-icon {
        font-size: 48px;
    }

    .auth-toggle {
        font-size: 15px;
        padding: 14px;
    }
}

/* Высокие экраны */
@media (min-height: 800px) {
    .hero-stage img {
        max-height: 60vh;
    }

    #scr-home.active {
        padding-bottom: 180px;
    }
}

@media (min-height: 900px) {
    .hero-stage img {
        max-height: 65vh;
    }
}

/* Ландшафтная ориентация */
@media (orientation: landscape) and (max-height: 500px) {
    .hud {
        padding: 8px 15px;
        min-height: 50px;
    }

    .avatar-btn {
        width: 36px;
        height: 36px;
    }

    .hero-stage {
        width: 40%;
        top: 40%;
    }

    .hero-stage img {
        max-height: 40vh;
    }

    .screen {
        padding: 60px 15px 80px;
    }

    #scr-home.active {
        padding-bottom: 100px;
    }

    

    .urgent-card,
    .stage-card,
    .gift {
        font-size: 14px;
    }

    #gifts-grid,
    #profile-gifts-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* Поддержка safe-area для iOS */
@supports (padding: max(0px)) {
    .hud {
        padding-top: max(10px, env(safe-area-inset-top));
        padding-left: max(10px, env(safe-area-inset-left));
        padding-right: max(10px, env(safe-area-inset-right));
    }

    .screen {
        padding-top: max(70px, calc(env(safe-area-inset-top) + 60px));
        padding-bottom: max(100px, calc(env(safe-area-inset-bottom) + 80px));
    }
}

/* iOS Safari специфичные фиксы */
@supports (-webkit-touch-callout: none) {

    /* НЕ перебиваем --vh который ставит JS */

    .modal-window {
        max-height: 85vh;
    }

    input,
    textarea,
    select {
        font-size: 16px !important;
    }

    /* dock прибит к низу через bottom:0 + padding-bottom в основных стилях */

    .screen:not(#scr-home) {
        padding-bottom: calc(var(--dock-height) + var(--safe-bottom, 34px) + 20px) !important;
    }
}

/* Экономный режим (если пользователь включил экономию данных) */
@media (prefers-reduced-data: reduce) {

    .gift,
    .hero-glow,
    .scanner-line {
        display: none !important;
    }

    .glass-card,
    .glass-btn {
        backdrop-filter: none;
        -webkit-backdrop-filter: none;
    }
}

/* Высококонтрастный режим */
@media (prefers-contrast: high) {
    :root {
        --primary: #ff0000;
        --text-light: #000000;
        --matte-bg: #ffffff;
    }

    .glass-card {
        border: 2px solid #000000;
    }
}

/* Темный режим (уже темный по умолчанию) */

/* ========== СПЕЦИАЛЬНЫЕ СТИЛИ ДЛЯ ВЕРТИКАЛЬНОГО ЦЕНТРИРОВАНИЯ ========== */
.modal-overlay {
    align-items: center !important;
    justify-content: center !important;
}

/* Исправление для мобильных */
@media (max-width: 768px) {
    .modal-overlay {
        align-items: center !important;
    }

    .modal-window {
        margin-top: 90px !important;
        margin-bottom: 20px !important;
    }
}

/* ========== СТИЛИ ДЛЯ ОКНА КРАФТА ========== */
#craft-window .modal-window {
    max-width: min(400px, 92vw);
    background: rgba(10, 14, 26, 0.98);
    border: 1px solid rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(25px);
    -webkit-backdrop-filter: blur(25px);
}

#craft-window .modal-body {
    overflow-wrap: break-word;
    word-wrap: break-word;
    word-break: break-word;
}

#craft-info {
    font-size: clamp(13px, 3.5vw, 15px);
    line-height: 1.5;
    padding: 0 5px;
}

#craft-items {
    gap: clamp(8px, 3vw, 12px);
}

#craft-items .inv-item {
    height: clamp(70px, 20vw, 90px);
    padding: clamp(10px, 3vw, 15px);
}

#craft-result {
    background: linear-gradient(135deg, rgba(255, 215, 0, 0.2), rgba(255, 215, 0, 0.08));
    border: 1px solid rgba(255, 215, 0, 0.3);
    padding: clamp(15px, 5vw, 20px);
}

#craft-result-text {
    font-size: clamp(14px, 4vw, 16px);
    line-height: 1.4;
    padding: 0 5px;
}

#craft-btn {
    height: clamp(44px, 12vw, 52px);
    font-size: clamp(14px, 4vw, 16px);
}

#craft-error {
    font-size: clamp(12px, 3.5vw, 14px);
    padding: 5px;
    line-height: 1.4;
}

/* ========== ТЕКУЩИЙ ПОЛЬЗОВАТЕЛЬ В РЕЙТИНГЕ ========== */
.current-user-card {
    border-color: rgba(255, 106, 97, 0.4) !important;
    background: rgba(255, 106, 97, 0.12) !important;
    border-radius: var(--card-radius);
    animation: neon-pulse 6s infinite alternate;
}

@keyframes neon-pulse {
    0% {
        border-color: rgba(255, 106, 97, 0.3);
    }

    100% {
        border-color: rgba(255, 106, 97, 0.5);
    }
}

.current-user-badge {
    position: absolute;
    top: -8px;
    right: 8px;
    background: linear-gradient(135deg, var(--primary), #ff4a3d) !important;
    color: #000000 !important;
    font-size: 9px;
    font-weight: 800;
    padding: 2px 6px;
    border-radius: 10px;
    z-index: 10;
    border: 2px solid var(--matte-bg);
    text-shadow: none !important;
}

/* ========== ИСПРАВЛЕНИЕ ВКЛАДКИ ПОДАРКОВ ========== */
#inv-gifts-container {
    display: none;
}

#inv-gifts-container.active {
    display: block;
}

@media (max-width: 600px) {

    /* Первоочередные стили для мобильных */
    .hud,
    .dock,
    .urgent-card,
    .hero-stage {
        opacity: 1 !important;
        visibility: visible !important;
    }
}

/* Убедиться что все текстовые элементы непрозрачные */
h1,
h2,
h3,
h4,
h5,
h6,
p,
span,
div,
.screen-title,
.branch-header,
.modal-header h2,
.user-name,
.user-class,
.card-number,
.card-title,
.card-sub,
.player-name,
.player-level,
.stat-value,
.stat-label,
.mission-step,
.mission-question,
.story-text h1,
.story-text p,
.auth-title,
.auth-sub,
.auth-toggle,
#profile-gifts-section .gifts-title,
.tab,
.tab.active,
.dock-item,
.dock-item.active,
.gift-popup-body h2,
.gift-popup-body p {
    background: transparent !important;
    background-image: none !important;
    -webkit-background-clip: initial !important;
    background-clip: initial !important;
    -webkit-text-fill-color: initial !important;
}

/* ========== ИСПРАВЛЕНИЕ АВТОРИЗАЦИИ ========== */
/* Контейнер авторизации - фиксированные размеры */
#auth-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    overflow-y: auto;
    padding: 20px;
}

.auth-card {
    width: 100%;
    max-width: 340px;
    padding: 30px 25px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* Заголовок и подзаголовок */
.auth-title {
    font-size: clamp(20px, 6vw, 24px) !important;
    margin-bottom: 5px !important;
    line-height: 1.2 !important;
}

.auth-sub {
    font-size: clamp(12px, 3vw, 14px) !important;
    margin-bottom: 25px !important;
    line-height: 1.3 !important;
    padding: 0 10px !important;
    color: rgba(255, 255, 255, 0.8) !important;
}

/* Поля ввода - фиксированная высота */
#inp-code,
#reg-name,
#reg-cls {
    height: 50px !important;
    min-height: 50px !important;
    font-size: clamp(16px, 4.5vw, 18px) !important;
    padding: 0 20px !important;
    margin-bottom: 15px !important;
    border-radius: 12px !important;
    background: rgba(255, 255, 255, 0.15) !important;
    border: 1px solid rgba(255, 255, 255, 0.2) !important;
}

/* Кнопки - фиксированная высота */
.auth-card .glass-btn {
    height: 50px !important;
    min-height: 50px !important;
    font-size: clamp(15px, 4vw, 16px) !important;
    font-weight: 700 !important;
    margin-top: 0 !important;
    margin-bottom: 10px !important;
}

/* Контейнеры для вьюшек авторизации */
#auth-view-login,
#auth-view-reg {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

/* Кнопка переключения - всегда внизу */
.auth-toggle {
    margin-top: auto !important;
    padding-top: 15px !important;
    border-top: 1px solid rgba(255, 255, 255, 0.15) !important;
}

/* Медиа-запросы для маленьких экранов */
@media (max-width: 480px) {
    .auth-card {
        padding: 25px 20px;
        gap: 15px;
    }

    #auth-view-login,
    #auth-view-reg {
        gap: 12px;
    }

    .auth-sub {
        margin-bottom: 20px !important;
    }
}

@media (max-height: 700px) {
    .auth-card {
        padding: 20px 15px;
        gap: 12px;
    }

    #inp-code,
    #reg-name,
    #reg-cls {
        height: 45px !important;
        min-height: 45px !important;
        margin-bottom: 10px !important;
    }

    .auth-card .glass-btn {
        height: 45px !important;
        min-height: 45px !important;
    }

    .auth-sub {
        margin-bottom: 15px !important;
    }
}

/* ========== ФИКС ДЛЯ КАРТИНОК ПОДАРКОВ ========== */
/* Картинки в подарках вокруг героя */
.gift img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    filter:

        drop-shadow(0 0 6px currentColor) drop-shadow(0 0 6px currentColor) drop-shadow(0 0 8px rgba(0, 0, 0, 0.3));
    /* Темный край */
    transition: transform 0.3s ease;
    border-radius: 8px;
}

.gift:hover img {
    transform: scale(1.2);
    filter: drop-shadow(0 0 15px rgba(255, 106, 97, 0.5));
}

/* Картинки в инвентаре */
.gift-card-icon img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    border-radius: 12px;
    transition: transform 0.3s ease;
}

.gift-card:hover .gift-card-icon img {
    transform: scale(1.1);
}

/* Картинка в попапе подарка */
.gift-popup-header img {
    width: 100px;
    height: 100px;
    object-fit: contain;
    margin-bottom: 15px;
    filter: drop-shadow(0 0 20px rgba(255, 106, 97, 0.4));
    animation: float 3s ease-in-out infinite;
    border-radius: 16px;
}

/* Адаптивность для маленьких экранов */
@media (max-width: 480px) {
    .gift img {
        max-width: 40px;
        max-height: 40px;
    }

    .gift-card-icon img {
        max-width: 48px;
        max-height: 48px;
    }

    .gift-popup-header img {
        width: 80px;
        height: 80px;
    }
}

/* Запасной вариант если картинка не загрузится */
.gift-card-icon img[src=""],
.gift-card-icon img:not([src]) {
    display: none;
}

/* ========== СПЕЦИАЛЬНЫЕ СТИЛИ ДЛЯ ТЕКСТА ========== */
/* Убрать градиентные фоны у текста, если они есть */
.gradient-primary,
.gradient-accent {
    background: transparent !important;
    -webkit-background-clip: initial !important;
    background-clip: initial !important;
    -webkit-text-fill-color: initial !important;
    color: var(--primary) !important;
}

/* Оставить исправление ежедневного вызова */
#scr-home .urgent-card {
    position: fixed !important;
    bottom: calc(100px + env(safe-area-inset-bottom, 0px)) !important;
    left: 50% !important;
    transform: translateX(-50%) !important;
    z-index: 900 !important;
    margin: 0 !important;
    width: 70% !important;
    max-width: 350px !important;
}

/* ========== ИСТОРИИ ========== */

#stories-layer {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 99999;
    background: #000;
    display: none;
}

/* Прогресс-полоски — явные стили без инлайна */
#story-bars {
    position: absolute !important;
    top: 10px !important;
    left: 10px !important;
    right: 10px !important;
    width: calc(100% - 20px) !important;
    height: 3px !important;
    display: none;
    flex-direction: row !important;
    gap: 4px !important;
    z-index: 100 !important;
    pointer-events: none !important;
    box-sizing: border-box;
}

#story-bars.visible {
    display: flex !important;
}

.story-page {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: none;
    background-size: cover !important;
    background-position: center !important;
    background-repeat: no-repeat !important;
    user-select: none;
    -webkit-user-select: none;
}

.story-page.active {
    display: block;
}

/* Затемнение — только снизу под текст, вверх плавно уходит */
.story-gradient-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        to top,
        rgba(0, 0, 0, 0.82) 0%,
        rgba(0, 0, 0, 0.55) 25%,
        rgba(0, 0, 0, 0.18) 55%,
        transparent 100%
    );
    z-index: 1;
    pointer-events: none;
}

.story-text {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    z-index: 2;
    padding: clamp(40px, 12vw, 60px) clamp(15px, 4vw, 25px) clamp(28px, 9vw, 40px);
    text-align: left;
    pointer-events: none;
}

.story-text h1 {
    font-weight: 800;
    color: #FFFFFF;
    font-size: clamp(15px, 4.5vw, 20px);
    background: transparent !important;
    margin-bottom: 6px;
    line-height: 1.2;
}

.story-text p {
    font-size: clamp(11px, 3vw, 14px);
    color: rgba(255,255,255,0.82);
    line-height: 1.45;
    background: transparent !important;
}

.story-progress-bar {
    flex: 1;
    height: 2.5px;
    background: rgba(255,255,255,0.3);
    border-radius: 2px;
    overflow: hidden;
}

.story-progress-fill {
    height: 100%;
    background: #ffffff;
    border-radius: 2px;
    width: 0%;
}

/* Зоны клика — левая и правая половина */
.story-tap-left,
.story-tap-right {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 50%;
    z-index: 5;
    cursor: pointer;
}

.story-tap-left  { left: 0; }
.story-tap-right { right: 0; }

/* ========== ЧАСТИЦЫ КОТОРЫЕ ТОЧНО БУДУТ ВИДНЫ ========== */
.visible-particles {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100vw !important;
    height: 100dvh !important; /* Dynamic Viewport Height для iOS */
    min-height: 100dvh !important;
    z-index: 3 !important;
    /* МЕЖДУ hero-glow (4) и фоном (0) */
    pointer-events: none !important;
    opacity: 0.4 !important;
}

.visible-particles::before {
    content: '' !important;
    position: absolute !important;
    width: 100% !important;
    height: 100% !important;
    background-image:
        radial-gradient(circle at 5% 10%, rgba(255, 106, 97, 0.3) 1px, transparent 2px),
        radial-gradient(circle at 15% 30%, rgba(255, 106, 97, 0.2) 1px, transparent 2px),
        radial-gradient(circle at 25% 50%, rgba(0, 242, 254, 0.2) 1px, transparent 2px),
        radial-gradient(circle at 35% 70%, rgba(255, 215, 0, 0.15) 1px, transparent 2px),
        radial-gradient(circle at 45% 20%, rgba(255, 255, 255, 0.1) 1px, transparent 2px),
        radial-gradient(circle at 55% 40%, rgba(255, 106, 97, 0.15) 1px, transparent 2px),
        radial-gradient(circle at 65% 60%, rgba(0, 242, 254, 0.15) 1px, transparent 2px),
        radial-gradient(circle at 75% 80%, rgba(255, 215, 0, 0.1) 1px, transparent 2px),
        radial-gradient(circle at 85% 15%, rgba(255, 106, 97, 0.2) 1px, transparent 2px),
        radial-gradient(circle at 95% 35%, rgba(0, 242, 254, 0.2) 1px, transparent 2px);
    background-size: 200px 200px, 250px 250px, 350px 350px;
    animation: none !important;
}

@keyframes particles-drift {
    0% {
        background-position: 0 0, 0 0, 0 0;
    }

    100% {
        background-position: 100px 50px, -50px 100px, 50px -50px;
    }
}

.visible-particles::after {
    position: absolute !important;
    top: 50% !important;
    left: 50% !important;
    transform: translate(-50%, -50%) !important;
    color: red !important;
    font-size: 24px !important;
    font-weight: bold !important;
    z-index: 9999 !important;
    text-shadow: 0 0 10px white !important;
    display: block !important;
}

/* Стили для реакций */
.reaction-btn {
    transition: all 0.3s ease;
}

.reaction-btn:hover {
    background: rgba(255, 255, 255, 0.2) !important;
    transform: scale(1.2);
}

.reaction-btn:active {
    transform: scale(0.95);
}

.reaction-item {
    transition: all 0.3s ease;
    animation: fadeIn 0.5s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ========== ФИКС ДЛЯ ВЕРХНЕЙ ПАНЕЛИ ========== */
.content-limit {
    padding-top: 0 !important;
}

.hud {
    padding-top: 10px !important;
    margin-top: 0 !important;
    position: relative;
    top: 0;
}

/* Убрать лишний отступ на iOS */
@supports (-webkit-touch-callout: none) {
    .hud {
        padding-top: max(10px, env(safe-area-inset-top, 10px)) !important;
    }

    .content-limit {
        padding-top: env(safe-area-inset-top, 0px) !important;
    }
}

/* ========== ПРОСТАЯ ОРАНЖЕВАЯ ПЛАШКА ========== */
.orange-banner {
    position: fixed;
    top: 70px;
    /* Под панелью hud */
    left: 50%;
    transform: translateX(-50%);
    width: 90%;
    max-width: 400px;
    background: rgba(255, 107, 0, 0.2);
    border: 1px solid rgba(255, 107, 0, 0.3);
    border-radius: 12px;
    padding: 10px 15px;
    display: flex;
    align-items: center;
    gap: 10px;
    z-index: 90;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 4px 15px rgba(255, 107, 0, 0.2);
}

.orange-banner:active {
    transform: translateX(-50%) scale(0.95);
    background: rgba(255, 107, 0, 0.25);
}

.banner-icon {
    font-size: 20px;
    flex-shrink: 0;
    background: rgba(255, 107, 0, 0.3);
    width: 36px;
    height: 36px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
}

.banner-content {
    flex: 1;
    min-width: 0;
}

.banner-title {
    font-weight: 700;
    font-size: 13px;
    color: white;
    margin-bottom: 2px;
}

.banner-subtitle {
    font-weight: 500;
    font-size: 11px;
    color: rgba(255, 255, 255, 0.85);
}

.banner-arrow {
    font-size: 16px;
    color: white;
    opacity: 0.8;
}

/* Адаптивность */
@media (max-width: 480px) {
    .orange-banner {
        top: 65px;
        padding: 8px 12px;
        width: 92%;
    }
}

@media (max-height: 700px) {
    .orange-banner {
        top: 60px;
        padding: 6px 10px;
    }
}

.avatar-max {
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--primary);

}

/* Градиентная обводка + свечение для топ-3 (как у красивых аватарок) */

/* Топ-1 — яркий золотой градиент */
.stage-card.rank-top1 {
    position: relative;
    border: none !important;
    /* убираем обычную border */
    background: rgba(255, 215, 0, 0.08);
    border-radius: 16px;
    overflow: hidden;
    /* чтобы градиент не вылезал */
    box-shadow: 0 0 20px rgba(255, 215, 0, 0.5);
    transition: all 0.3s ease;
}

/* Псевдо-элемент для градиентной обводки */
.stage-card.rank-top1::before {
    content: '';
    position: absolute;
    inset: -2px;
    /* толщина обводки */
    border-radius: 18px;
    background: conic-gradient(from 90deg at 50% 50%,
            #ffd700 0deg,
            #ffaa00 60deg,
            #ffd700 120deg,
            #ffea80 180deg,
            #ffd700 240deg,
            #ffaa00 300deg,
            #ffd700 360deg);
    -webkit-mask:
        linear-gradient(#fff 0 0) padding-box,
        linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    pointer-events: none;
    z-index: -1;
}

/* Топ-2 — серебристо-золотой */
.stage-card.rank-top2 {
    position: relative;
    border: none !important;
    background: rgba(230, 194, 0, 0.06);
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 0 16px rgba(230, 194, 0, 0.4);
}

.stage-card.rank-top2::before {
    content: '';
    position: absolute;
    inset: -2px;
    border-radius: 18px;
    background: conic-gradient(from 90deg at 50% 50%,
            #e6c200 0deg,
            #d4af37 90deg,
            #e6c200 180deg,
            #c9a32f 270deg,
            #e6c200 360deg);
    -webkit-mask:
        linear-gradient(#fff 0 0) padding-box,
        linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    pointer-events: none;
    z-index: -1;
}

/* Топ-3 — бронзово-золотой */
.stage-card.rank-top3 {
    position: relative;
    border: none !important;
    background: rgba(212, 175, 55, 0.05);
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 0 14px rgba(212, 175, 55, 0.35);
}

.stage-card.rank-top3::before {
    content: '';
    position: absolute;
    inset: -2px;
    border-radius: 18px;
    background: conic-gradient(from 90deg at 50% 50%,
            #d4af37 0deg,
            #c9a32f 120deg,
            #d4af37 240deg,
            #b8972e 360deg);
    -webkit-mask:
        linear-gradient(#fff 0 0) padding-box,
        linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    pointer-events: none;
    z-index: -1;
}

/* Свечение при наведении (опционально, но красиво) */
.stage-card.rank-top1:hover::before,
.stage-card.rank-top2:hover::before,
.stage-card.rank-top3:hover::before {
    animation: glow 2s infinite alternate;
}

@keyframes glow {
    0% {
        opacity: 0.8;
        filter: brightness(1);
    }

    100% {
        opacity: 1;
        filter: brightness(1.3);
    }
}

/* УСИЛЕННЫЕ СТИЛИ ДЛЯ БИТВЫ */
#scr-city {
    position: fixed;
    /* Фиксируем поверх всего */
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #000;
    /* Черный фон, чтобы не было прозрачным */
    z-index: 9999;
    /* Самый высокий слой */
    padding: 20px;
    box-sizing: border-box;
    overflow-y: auto;
    /* Разрешаем скролл если не влезает */
    display: none;
    /* Скрыт по умолчанию */
}

#scr-city.active {
    display: block !important;
    /* Принудительно показываем */
}

/* Кнопка назад для этого экрана */
.city-back-btn {
    background: rgba(255, 255, 255, 0.1);
    padding: 10px 20px;
    border-radius: 20px;
    margin-bottom: 20px;
    display: inline-block;
    cursor: pointer;
    color: var(--neon);
    border: 1px solid var(--neon);
}

.city-canvas-container {
    width: 100%;
    max-width: 500px;
    /* Ограничим ширину на планшетах */
    margin: 0 auto;
    /* По центру */
    aspect-ratio: 1 / 1;
    /* Делаем квадратным */
    background: #111;
    border: 2px solid var(--primary);
    border-radius: 12px;
    position: relative;
    overflow: hidden;
    touch-action: none;
    box-shadow: 0 0 30px rgba(0, 242, 254, 0.1);
}

.city-canvas {
    width: 100%;
    height: 100%;
    image-rendering: pixelated;
    background-image: url('https://upload.wikimedia.org/wikipedia/commons/thumb/e/ea/Kemerovo_Oblast_relief_map.png/500px-Kemerovo_Oblast_relief_map.png');
    background-size: cover;
    background-position: center;
    filter: brightness(0.8) contrast(1.2) hue-rotate(180deg);
}

/* Сетка выбора цвета */
.color-picker-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 10px;
    margin: 20px 0;
}

.color-btn {
    aspect-ratio: 1;
    border-radius: 8px;
    border: 2px solid rgba(255, 255, 255, 0.2);
}

/* ========== ФИНАЛЬНЫЙ ПАТЧ: ПРОЗРАЧНОСТЬ БЕЗ BLUR ========== */
:root {
    --modal-bg: rgba(18, 22, 36, 0.85);
    /* 15% прозрачности (85% непрозрачности) */
    --card-bg: rgba(22, 26, 40, 0.80);
    /* 20% прозрачности (80% непрозрачности) */
    --overlay-bg: rgba(0, 0, 0, 0.75);
    /* 25% прозрачности (75% непрозрачности) */
}

/* ПОЛНОСТЬЮ УБИРАЕМ ВСЕ backdrop-filter */
.modal-overlay,
.modal-window,
.glass-card,
.stage-card,
.dock,
.auth-card,
.gift-popup-content,
#modal-2048>div>div:first-child,
#modal-flappy>div>div:first-child,
.urgent-card,
.glass-btn,
.inv-item,
.craft-item,
.tab,
.player-stats,
.modal-close-top,
.window-close {
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
}

/* ===== МОДАЛЬНЫЕ ОКНА ===== */
.modal-overlay {
    background: var(--overlay-bg) !important;
    /* Убираем старый фон с blur */
}

.modal-window {
    background: var(--modal-bg) !important;
    border: 1px solid rgba(255, 255, 255, 0.15) !important;
    box-shadow:
        0 25px 50px rgba(0, 0, 0, 0.6),
        inset 0 1px 0 rgba(255, 255, 255, 0.1) !important;
    /* Внутренняя подсветка */
}

/* ===== КАРТОЧКИ ===== */
.glass-card,
.stage-card {
    position: relative;
    background: var(--card-bg) !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
    box-shadow:
        0 10px 25px rgba(0, 0, 0, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.05) !important;
}

/* Специально для выполненных заданий */
.stage-done {
    background: rgba(46, 204, 113, 0.2) !important;
    border-color: rgba(46, 204, 113, 0.3) !important;
}

/* ===== ДОК (НИЖНЯЯ ПАНЕЛЬ) ===== */
.dock {
    background: rgba(15, 20, 40, 0.75) !important;
    border: 1px solid rgba(255, 255, 255, 0.15) !important;
    box-shadow: 0 -5px 25px rgba(0, 0, 0, 0.5) !important;
}

/* ===== АВТОРИЗАЦИЯ ===== */
.auth-card {
    background: var(--auth-bg) !important;
    border: 1px solid rgba(255, 255, 255, 0.15) !important;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.6) !important;
}

/* ===== ПОДАРКИ ===== */
.gift-popup-content {
    background: var(--modal-bg) !important;
    border: 1px solid rgba(255, 255, 255, 0.15) !important;
    box-shadow: 0 30px 60px rgba(0, 0, 0, 0.7) !important;
}

/* ===== ИГРЫ (2048, FLAPPY) ===== */
#modal-2048>div>div:first-child,
#modal-flappy>div>div:first-child {
    background: rgba(26, 29, 46, 0.85) !important;
    border: 1px solid rgba(255, 255, 255, 0.15) !important;
}

#g2048-board {
    background: rgba(26, 29, 46, 0.9) !important;
}

/* ===== КНОПКА ЗАКРЫТИЯ ===== */
.modal-close-top {
    background: rgba(0, 0, 0, 0.5) !important;
    border: 1px solid rgba(255, 255, 255, 0.2) !important;
}

/* ===== ЭФФЕКТ ГЛУБИНЫ (ОПЦИОНАЛЬНО) ===== */
.modal-window::after,
.glass-card::after,
.stage-card::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg,
            transparent,
            rgba(255, 255, 255, 0.1),
            transparent);
    pointer-events: none;
}

/* ===== ЕЖЕДНЕВНЫЙ ВЫЗОВ ===== */
.urgent-card {
    background: rgba(255, 77, 77, 0.25) !important;
    border: 1px solid var(--fire) !important;
    box-shadow: 0 10px 25px rgba(255, 77, 77, 0.3) !important;
}

/* ===== КНОПКИ ===== */
.glass-btn {
    background: rgba(255, 255, 255, 0.12) !important;
    border: 1px solid rgba(255, 255, 255, 0.15) !important;
}

.btn-primary {
    background: #922D25 !important;
    border: none !important;
}

/* Убираем все свечения и тени */
.stage-card,
.branch-header {
    box-shadow: none !important;
    text-shadow: none !important;
    filter: none !important;
}

/* Убираем псевдоэлементы */
.stage-card::before,
.stage-card::after,
.branch-header::before,
.branch-header::after {
    display: none !important;
    content: none !important;
}

/* 1. Убираем эффекты у героя */
.hero-blur {
    opacity: 1 !important;
    filter: none !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
}

/* 2. Делаем фон у всех страниц, кроме главной */
.screen:not(#scr-home) {
    background: rgba(10, 14, 26, 0.9) !important;
    /* 90% непрозрачности */
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    padding-top: calc(var(--hud-height) + 16px) !important;
}

/* 3. Главная страница - прозрачная */
#scr-home {
    background: transparent !important;
}

/* 4. Док оставляем как есть (он и так поверх) */
.dock {
    z-index: 1000;
}

/* 5. Опционально: добавляем легкую тень для контента */
.screen:not(#scr-home) .screen-title,
.screen:not(#scr-home) .branch-header {
    text-shadow: 0 2px 5px rgba(0, 0, 0, 0.5);
}

/* Оптимизация Flappy Bird для мобильных */
@media (max-width: 768px) {
    #flappy-canvas {
        image-rendering: crisp-edges;
        /* Более четкое, менее ресурсоемкое */
        transform: translateZ(0);
        /* Аппаратное ускорение */
    }

    .flappy-instruction {
        animation: none;
        /* Убираем пульсацию текста */
    }
}

/* Анимация для красной кнопки срочного вызова */
@keyframes pulse-red {
    0% {
        box-shadow: 0 0 0 0 rgba(255, 77, 77, 0.7);
        background: rgba(255, 77, 77, 0.2);
    }

    50% {
        box-shadow: 0 0 20px 10px rgba(255, 77, 77, 0.4);
        background: rgba(255, 77, 77, 0.4);
        transform: scale(1.05);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(255, 77, 77, 0.7);
        background: rgba(255, 77, 77, 0.2);
    }
}

/* Скрываем старую плашку */
#daily-challenge-container {
    display: none !important;
}

/* ========== ОТКЛЮЧЕНИЕ АНИМАЦИИ ПОДАРКОВ ========== */
.gift {
    animation: none !important;
    transition: none !important;
    transform: none !important;
    will-change: auto !important;
}

/* Отключаем все hover-эффекты */
.gift:hover {
    transform: none !important;
    filter: none !important;
}

/* Отключаем псевдоэлементы */
.gift::before,
.gift::after {
    display: none !important;
}

/* Если есть картинки внутри */
.gift img {
    transition: none !important;
    transform: none !important;
}

.gift:hover img {
    transform: none !important;
    filter: none !important;
}

    /* Анимация появления победного экрана */
    @keyframes victoryFade {
        from {
            opacity: 0;
            transform: scale(0.9);
        }

        to {
            opacity: 1;
            transform: scale(1);
        }
    }

    /* Анимация подпрыгивания эмодзи */
    @keyframes bounce {

        0%,
        100% {
            transform: translateY(0);
        }

        50% {
            transform: translateY(-20px);
        }
    }

    /* Анимация плавающих частиц */
    @keyframes floatParticles {

        0%,
        100% {
            transform: translateY(0) rotate(0deg);
            opacity: 0;
        }

        10% {
            opacity: 1;
        }

        90% {
            opacity: 1;
        }

        100% {
            transform: translateY(-100px) rotate(360deg);
            opacity: 0;
        }
    }
    /* --- КНОПКА-ГАЛОЧКА ДЛЯ ПОДАРКОВ --- */
    .gift-toggle-btn {
        position: absolute;
        /* Подвинули ближе к центру: было -8px, стало 4px */
        top: 4px; 
        right: 4px; 
        width: 22px;
        height: 22px;
        background: rgba(0, 0, 0, 0.8); /* Сделали чуть темнее для контраста */
        border: 2px solid rgba(255, 255, 255, 0.5);
        border-radius: 50%;
        cursor: pointer;
        z-index: 10;
        display: flex;
        align-items: center;
        justify-content: center;
        transition: all 0.2s;
    }
    /* Включенный подарок (зеленая галочка) */
    .gift-toggle-btn.active {
        background: #4CAF50;
        border-color: #fff;
        box-shadow: 0 0 8px #4CAF50;
    }
    .gift-toggle-btn.active::after {
        content: '✓';
        color: white;
        font-size: 14px;
        font-weight: 900;
    }
    /* Выключенный подарок (серый крестик) */
    .gift-toggle-btn:not(.active)::after {
        content: '✕';
        color: rgba(255, 255, 255, 0.5);
        font-size: 10px;
        font-weight: bold;
    }
/* ===== БЛОК СТОРИС "АКТУАЛЬНО" ===== */
.stories-bar-wrapper {
    overflow: hidden;
    width: 100%;
    margin-bottom: 8px;
}

.stories-bar {
    display: flex;
    gap: 14px;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    padding: 10px 4px 14px;
    scrollbar-width: none;
}

.stories-bar::-webkit-scrollbar {
    display: none;
}

.story-bubble {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    flex-shrink: 0;
    scroll-snap-align: start;
    transition: transform 0.15s ease;
    width: 68px;
}

.story-bubble:active {
    transform: scale(0.93);
}

.story-bubble-ring {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    position: relative;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #0a0e1a;
    border: 3px solid transparent;
    background-clip: padding-box;
    box-shadow: 0 0 0 2px #2ecc71;
}

.story-bubble-ring.seen {
    box-shadow: 0 0 0 2px rgba(255,255,255,0.2);
}

.story-bubble-inner {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: #0a0e1a;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 26px;
    overflow: hidden;
}

.story-bubble-label {
    font-size: 10px;
    font-weight: 700;
    color: var(--text-dim, rgba(255,255,255,0.6));
    text-align: center;
    max-width: 68px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    letter-spacing: 0.3px;
}

.story-bubble.has-new .story-bubble-label {
    color: #fff;
}
/* ========== ГОЛОСОВАНИЯ ========== */
#polls-list .stage-card:active {
    transform: scale(0.95);
}
#poll-reactions button:active {
    transform: scale(0.95);
}
#poll-modal .modal-window {
    scrollbar-width: none;
}
#poll-modal .modal-window::-webkit-scrollbar {
    display: none;
}
/* Бейдж на реакциях голосования */
.poll-reaction-badge {
    position: absolute;
    top: -6px;
    right: -6px;
    background: linear-gradient(135deg, var(--gold), #ff4a3d) !important;
    color: #000 !important;
    font-size: clamp(9px, 2.5vw, 11px);
    font-weight: 800;
    padding: clamp(3px, 1vw, 4px) clamp(5px, 1.5vw, 7px);
    border-radius: clamp(8px, 2vw, 10px);
    box-shadow: 0 3px 10px rgba(255, 106, 97, 0.3);
    z-index: 20;
    min-width: clamp(20px, 5vw, 22px);
    text-align: center;
    line-height: 1;
    border: 2px solid var(--matte-bg);
}
/* ========== КАРУСЕЛЬ ПОДАРКОВ В ПРОФИЛЯХ ========== */
.gifts-carousel-container {
    position: relative;
    width: 100%;
    display: flex;
    align-items: center;
    padding: 0 28px; /* Выделили места по бокам специально под стрелочки */
    box-sizing: border-box;
}

.gifts-carousel-track {
    display: flex;
    gap: 10px; /* Отступ между карточками ровно 10px */
    overflow-x: auto;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
    padding: 10px 0;
    scrollbar-width: none; 
    width: 100%;
    scroll-snap-type: x mandatory; /* Магия "доводчика" (свайп прилипает к карточкам) */
}

.gifts-carousel-track::-webkit-scrollbar {
    display: none; 
}

/* Формула для ровно 4-х карточек */
.gifts-carousel-track .gift-card {
    /* 100% ширины минус 3 отступа по 10px, разделить на 4 карточки */
    flex: 0 0 calc((100% - 30px) / 4); 
    scroll-snap-align: start; /* Карточка всегда встает ровно к левому краю */
    padding: 8px; /* Чуть уменьшили внутренний отступ, чтобы иконке не было тесно */
    aspect-ratio: 1; /* Сохраняем карточки квадратными */
    box-sizing: border-box;
}

/* Стрелки карусели подарков */
.carousel-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 2;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: none;
    background: rgba(255, 255, 255, 0.12);
    backdrop-filter: blur(6px);
    color: rgba(255, 255, 255, 0.75);
    font-size: 16px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    padding: 0;
    transition: background 0.18s, color 0.18s, transform 0.18s;
    flex-shrink: 0;
}
.carousel-arrow:active {
    background: rgba(255, 106, 97, 0.35);
    color: #fff;
    transform: translateY(-50%) scale(0.92);
}
.carousel-arrow.left  { left: 0; }
.carousel-arrow.right { right: 0; }
.carousel-arrow.hidden { opacity: 0; pointer-events: none; }

/* Кнопки перелистывания */
#special-carousel {
    display: flex;
    gap: 10px;
    overflow-x: scroll;
    overflow-y: hidden;
    touch-action: pan-x;
    will-change: scroll-position;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    scroll-behavior: smooth;
    padding: 0 2px;
}
#special-carousel::-webkit-scrollbar { display: none; }
.special-dot {
    width: 6px; height: 6px;
    border-radius: 50%;
    background: rgba(255,255,255,0.2);
    transition: all 0.25s;
    flex-shrink: 0;
}
.special-dot.active {
    background: #fff;
    width: 16px;
    border-radius: 3px;
}
/* ===== ЗОЛОТАЯ ОБВОДКА ЦАРЯ ГОРЫ ===== */
.king-gold-border {
    border-radius: 50% !important;
    position: relative !important;
    overflow: visible !important;
    border: none !important;
    padding: 2px !important;
    background: linear-gradient(135deg, #FFD700, #FFA500, #FFEC6E, #FF8C00, #FFD700) !important;
    background-size: 300% 300% !important;
    animation: kingGradientMove 2s linear infinite !important;
    box-shadow: 0 0 12px rgba(255, 215, 0, 0.6) !important;
}

.king-gold-border img {
    border-radius: 50%;
    display: block;
    width: 100% !important;
    height: 100% !important;
    object-fit: cover;
    background: #0a0e1a;
}

@keyframes kingGradientMove {
    0%   { background-position: 0% 0%; }
    50%  { background-position: 100% 100%; }
    100% { background-position: 0% 0%; }
}

/* ========== ПОЛОСА ПРОГРЕССА МИССИЙ ========== */
#missions-progress-fill {
    height: 8px !important;
    border-radius: 99px !important;
    background: linear-gradient(90deg, #00f2fe, #a259ff, #ff6a61) !important;
    box-shadow: none !important; /* глобальный !important не мешает */
    min-width: 0;
    display: block !important;
}

/* ========== ПОЛОСА ПРОГРЕССА ДОСТИЖЕНИЙ ========== */
#ach-overall-fill {
    background: linear-gradient(90deg, #ffd700, #ff6a61, #c850c0) !important;
    box-shadow: none !important;
    display: block !important;
    transition: width 1.2s cubic-bezier(0.22, 1, 0.36, 1) !important;
}

/* ========== ГЛОБАЛЬНАЯ АНИМАЦИЯ ПРОЖАТИЯ КНОПОК ========== */
/* Покрывает все button-элементы, не имеющие специфичного :active */
button:not([class]):active,
[role="button"]:active {
    transform: scale(0.95);
    transition: transform 0.12s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ========== СТИЛИ ИЗ INDEX ========== */
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

#inv-achievements-container {
    margin-top: -40px !important;
}

#duel-cards-bar {
    display: flex;
    gap: 10px;
    overflow-x: scroll;
    overflow-y: hidden;
    touch-action: pan-x;
    will-change: scroll-position;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    scroll-behavior: smooth;
    padding: 0 2px;
}
#duel-cards-bar::-webkit-scrollbar { display: none; }

/* ========== ЛОАДЕР ========== */
#main-loader {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: var(--matte-bg);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 99999;
}
#main-loader .loader-label {
    color: white;
    margin-top: 20px;
    font-family: var(--font-main);
    font-weight: 600;
    letter-spacing: 1px;
    opacity: 0.8;
}
/* ============================================================
   РЕФАКТОРИНГ ИНЛАЙН-СТИЛЕЙ ИЗ game.js
   Префикс .fl- = "Flicker", чтобы не пересекаться с существующими.
   Везде где есть динамическое значение — пробрасывается через
   CSS-переменную (style="--c: red; --pct: 75%").
   ============================================================ */

/* ---------- Универсальные служебные сообщения ---------- */
.fl-msg {
    text-align: center;
    font-size: 13px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.3);
    padding: 30px 20px;
    line-height: 1.4;
}
.fl-msg--lg     { padding: 40px 20px; }
.fl-msg--md     { padding: 20px; }
.fl-msg--sm     { padding: 10px; font-size: 12px; }
.fl-msg--left   { text-align: left; }
.fl-msg--dim    { color: var(--text-dim); }
.fl-msg--error  { color: var(--fire); }
.fl-msg--error-soft { color: rgba(244, 67, 54, 0.6); }
.fl-msg--success { color: #4CAF50; font-size: 14px; font-weight: 700; }
.fl-msg--loading { color: rgba(255, 255, 255, 0.4); font-weight: 600; }
.fl-msg__emoji {
    font-size: 28px;
    margin-bottom: 8px;
    line-height: 1;
}
.fl-msg__emoji--lg { font-size: 44px; margin-bottom: 14px; }

/* ---------- Результаты этапа (счёт + полоска прогресса) ---------- */
.fl-stage-score {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}
.fl-stage-score__row {
    display: flex;
    align-items: baseline;
    gap: 6px;
}
.fl-stage-score__num {
    font-size: 48px;
    font-weight: 900;
    line-height: 1;
    color: var(--score-color, #fff);
}
.fl-stage-score__total {
    font-size: 24px;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.4);
}
.fl-stage-score__meta {
    font-size: 13px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.5);
}
.fl-stage-score__bar {
    width: 100%;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 99px;
    height: 6px;
    margin-top: 4px;
    overflow: hidden;
}
.fl-stage-score__fill {
    height: 100%;
    width: var(--pct, 0%);
    background: var(--score-color, #4CAF50);
    border-radius: 99px;
    transition: width 0.6s ease;
}
.fl-stage-fail-note {
    margin-top: 10px;
    padding: 10px 16px;
    background: rgba(244, 67, 54, 0.12);
    border: 1.5px solid rgba(244, 67, 54, 0.3);
    border-radius: 12px;
    font-size: 13px;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.8);
    text-align: center;
    line-height: 1.5;
}

/* ---------- Модификаторы для ответов в разборе ошибок ---------- */
.mission-answer--locked   { pointer-events: none; }
.mission-answer--dim      { opacity: 0.4; }
.mission-answer--correct  {
    background: rgba(76, 175, 80, 0.3);
    border-color: #4CAF50;
    color: #fff;
}
.mission-answer--wrong    {
    background: rgba(244, 67, 54, 0.3);
    border-color: #f44336;
    color: #fff;
}

/* ---------- Кнопка "Где я ошибся?" + скрываемый блок деталей ---------- */
.fl-mistakes-toggle {
    width: 100%;
    padding: 12px;
    margin: 0 0 16px 0;
    background: rgba(244, 67, 54, 0.1);
    border: 1.5px solid rgba(244, 67, 54, 0.3);
    color: #fff;
    font-size: 13px;
    font-weight: 800;
    border-radius: 12px;
    cursor: pointer;
    letter-spacing: 1px;
}
.fl-mistakes-detail[hidden] { display: none; }

/* ---------- Уведомления ---------- */
.fl-notif-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 14px;
    margin-bottom: 8px;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.08);
}
.fl-notif-row--unread {
    background: rgba(255, 106, 97, 0.1);
    border-color: rgba(255, 106, 97, 0.25);
}
.fl-notif-content {
    flex: 1;
    min-width: 0;
}
.fl-notif-title {
    font-weight: 700;
    font-size: 14px;
    color: #fff;
    margin-bottom: 4px;
    line-height: 1.3;
}
.fl-notif-text {
    font-size: 13px;
    color: rgba(255, 255, 255, 0.6);
    line-height: 1.5;
}
.fl-notif-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #ff6a61;
    flex-shrink: 0;
}

/* ---------- Achievement popup внутренности (сам popup в game.js cssText) ---------- */
.fl-ach-pop__icon {
    font-size: 36px;
    line-height: 1;
    flex-shrink: 0;
}
.fl-ach-pop__body {
    min-width: 0;
}
.fl-ach-pop__name {
    font-size: 14px;
    font-weight: 800;
    color: #fff;
    margin-bottom: 3px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.fl-ach-pop__meta {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.55);
    line-height: 1.35;
}
.fl-xp-amount {
    color: #ffd700;
    font-weight: 700;
}

/* ---------- Ячейки бонуса за вход ---------- */
.fl-lb-cell {
    border-radius: 12px;
    padding: 11px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(255, 255, 255, 0.04);
    border: 1.5px solid rgba(255, 255, 255, 0.06);
    transition: opacity 0.2s;
}
.fl-lb-cell--current {
    background: linear-gradient(135deg, rgba(0, 198, 251, 0.18), rgba(0, 91, 234, 0.18));
    border-color: rgba(0, 210, 255, 0.6);
    box-shadow: 0 0 16px rgba(0, 180, 255, 0.2);
}
.fl-lb-cell--past {
    border-color: rgba(255, 255, 255, 0.08);
    opacity: 0.45;
}
.fl-lb-cell__left {
    display: flex;
    align-items: center;
    gap: 12px;
}
.fl-lb-cell__num {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.08);
    font-size: 11px;
    font-weight: 800;
    color: rgba(255, 255, 255, 0.4);
}
.fl-lb-cell--current .fl-lb-cell__num {
    background: linear-gradient(135deg, #00c6fb, #005bea);
    border-color: rgba(0, 210, 255, 0.5);
    color: #fff;
}
.fl-lb-cell--past .fl-lb-cell__num {
    background: rgba(255, 255, 255, 0.08);
}
.fl-lb-cell__day {
    font-size: 12px;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.55);
}
.fl-lb-cell--current .fl-lb-cell__day { color: #fff; }
.fl-lb-cell__status {
    font-size: 10px;
    margin-top: 1px;
    color: rgba(255, 255, 255, 0.25);
}
.fl-lb-cell--current .fl-lb-cell__status { color: #7df0ff; }
.fl-lb-cell--past .fl-lb-cell__status { color: rgba(255, 255, 255, 0.4); }
.fl-lb-cell__right {
    text-align: right;
}
.fl-lb-cell__xp {
    font-size: 15px;
    font-weight: 800;
    color: rgba(255, 255, 255, 0.3);
}
.fl-lb-cell--current .fl-lb-cell__xp { color: #7df0ff; }
.fl-lb-cell--past .fl-lb-cell__xp { color: rgba(255, 255, 255, 0.4); }
.fl-lb-cell__xp-label {
    font-size: 10px;
    color: rgba(255, 255, 255, 0.3);
    margin-top: 1px;
}

/* ---------- Чипы тем для дуэли ---------- */
.duel-theme-chip {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.15s;
    flex-shrink: 0;
    background: rgba(255, 255, 255, 0.04);
    border: 1.5px solid rgba(255, 255, 255, 0.07);
}
.duel-theme-chip--selected {
    background: rgba(0, 198, 251, 0.15);
    border-color: rgba(0, 210, 255, 0.5);
}
.fl-duel-theme-chip__icon {
    font-size: 18px;
    flex-shrink: 0;
}
.fl-duel-theme-chip__name {
    font-size: 13px;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.85);
    line-height: 1.2;
}
.duel-theme-chip--selected .fl-duel-theme-chip__name { color: #7df0ff; }
.fl-duel-theme-grid {
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-height: 55vh;
    overflow-y: auto;
    padding-right: 4px;
}

/* ---------- Строка игрока в списке для дуэли ---------- */
.fl-dp-avatar-wrap {
    position: relative;
    flex-shrink: 0;
    width: 40px;
    height: 40px;
}
.fl-dp-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid var(--primary);
    overflow: hidden;
}
.fl-dp-avatar img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
}
.fl-dp-info {
    flex: 1;
    min-width: 0;
    margin-left: 12px;
}
.fl-dp-name {
    font-weight: 800;
    color: var(--text-light);
    font-size: clamp(12px, 3.5vw, 14px);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.fl-dp-meta {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.4);
    margin-top: 2px;
}
.fl-dp-rank-wrap {
    text-align: right;
    flex-shrink: 0;
}
.fl-dp-rank {
    color: var(--gold);
    font-weight: 800;
    font-size: 14px;
}

/* ---------- Заголовок выбора темы (дуэль, шаг 2) ---------- */
.fl-duel-step-meta {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.4);
    margin-top: 4px;
    font-weight: 600;
}
.fl-duel-step-meta__theme {
    color: rgba(0, 210, 255, 0.8);
}
.fl-duel-step-meta__change {
    cursor: pointer;
    text-decoration: underline;
    color: rgba(255, 255, 255, 0.4);
}
.fl-duel-players-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 16px;
    max-height: 55vh;
    overflow-y: auto;
}

/* ---------- Универсальный padding для modal-body в дуэлях ---------- */
.fl-modal-body-padded {
    padding: 0 16px 20px;
}
.fl-modal-header-tight {
    padding-bottom: 8px;
}

.duel-player-row {
    cursor: pointer;
    margin-bottom: 0;
}

/* Модификатор для блока провала миссии: чуть смещает row */
.fl-stage-score--fail .fl-stage-score__row { margin-top: 4px; }

/* Блок одной ошибки в разборе результатов этапа */
.fl-mistakes-item .mission-step { margin-bottom: 6px; }
.fl-mistakes-item .mission-question { margin-bottom: 12px; }
.fl-mistakes-item .mission-answers { margin-bottom: 24px; }

/* ============================================================
   АНИМАЦИЯ ПОСТРОЕНИЯ РЕЙТИНГА
   Дёшевая GPU-only анимация: transform + opacity, без reflow.
   Через CSS-var --i задаём индекс ряда → animation-delay.
   Потолок 1.5с защищает от длинных списков (после 43-го ряда
   delay перестаёт расти, чтобы хвост не "стартовал" через 10 сек).
   ============================================================ */
.fl-rank-row {
    opacity: 0;
    /* Можно переопределить для конкретного ряда (locked achievement и т.п.):
       style="--final-opacity: 0.5" → ряд после анимации станет полупрозрачным. */
    --final-opacity: 1;
    transform: translateY(14px) scale(0.985);
    animation: flRankRowIn 0.5s cubic-bezier(0.22, 1, 0.36, 1) forwards;
    animation-delay: calc(min(var(--i, 0) * 35, 1500) * 1ms);
    /* will-change только на время самой анимации, потом снимется */
    will-change: transform, opacity;
}
.fl-rank-row.fl-rank-row--done {
    /* Когда анимация закончилась, will-change снимаем
       (см. animationend-обработчик в game.js) */
    will-change: auto;
}

@keyframes flRankRowIn {
    0% {
        opacity: 0;
        transform: translateY(14px) scale(0.985);
    }
    60% {
        opacity: var(--final-opacity);
    }
    100% {
        opacity: var(--final-opacity);
        transform: translateY(0) scale(1);
    }
}

/* Re-trigger: добавляем модификатор на контейнер → потомки начинают
   анимацию заново. Старая анимация сбрасывается через animation: none. */
.fl-rank-anim-reset .fl-rank-row {
    animation: none !important;
}

/* Пользователи с настройкой "уменьшить движение" анимацию не получают */
@media (prefers-reduced-motion: reduce) {
    .fl-rank-row {
        animation: none;
        opacity: 1;
        transform: none;
    }
}