/* ============================================================
   ОСНОВНЫЕ СТИЛИ
   ============================================================ */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    user-select: none;
    -webkit-touch-callout: none;
    -webkit-tap-highlight-color: transparent;
}

body {
    background: #0a0a1a;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    overflow: hidden;
    touch-action: none;
}

#gameContainer {
    position: relative;
    width: 420px;
    height: 100vh;
    max-height: 800px;
    background: #080818;
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 0 60px rgba(0, 200, 255, 0.1), inset 0 0 60px rgba(0, 100, 200, 0.05);
    touch-action: none;
}

#gameContainer canvas {
    display: block;
    width: 100%;
    height: 100%;
}

/* ============================================================
   СТАРТОВЫЙ ЭКРАН
   ============================================================ */
#startScreen {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('../assets/menu_bg.webp?v=1') center / cover no-repeat, rgba(8, 8, 24, 0.95);
    /* backdrop-filter blur(2px) убран (этап 22, FPS телефонов) */
    display: flex;
    flex-direction: column;
    /* ПОСЛЕ замечания владельца (этап 2): startTopBar — обычная первая строка
       колонки (НЕ sticky), скроллится вместе с меню — заголовок никогда не
       заходит под панель рейтинга. Переполнение уходит только вниз; на
       свободных экранах центр вида дают auto-поля (см. h1/#oauthBlock ниже). */
    justify-content: flex-start;
    align-items: center;
    z-index: 1000;
    padding: 20px;
    /* Низкие/узкие окна: меню скроллится ЦЕЛИКОМ — ничего не обрезается намертво */
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}
/* Ловушка flex+overflow: дети со shrink по умолчанию СЖАЛИСЬ бы вместо скролла */
#startScreen > * { flex-shrink: 0; }
/* Центрирование меню на свободных экранах без justify-content:center:
   auto-поля съедают свободное место, при переполнении схлопываются в 0.
   (Этап 13: заголовок уехал в .menu-body — пара auto-полей теперь на нём.) */
.menu-body { margin-top: auto; margin-bottom: auto; }

#startScreen h1 {
    font-size: 28px;
    color: #fff;
    text-shadow: 0 0 40px rgba(0, 200, 255, 0.3);
    margin-bottom: 5px;
    text-align: center;
}

#startScreen p {
    color: rgba(255,255,255,0.5);
    font-size: 14px;
    margin-bottom: 20px;
}

#heroSelection {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 20px;
    width: 100%;
    max-width: 340px;
}

.hero-card {
    background: rgba(255, 255, 255, 0.05);
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    padding: 15px 10px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
}

.hero-card:hover {
    transform: translateY(-2px);
    border-color: rgba(0, 200, 255, 0.3);
}

.hero-card.selected {
    border-color: #00ccff;
    box-shadow: 0 0 40px rgba(0, 200, 255, 0.2);
    background: rgba(0, 200, 255, 0.05);
}

.hero-card[data-hero="FireBall"].selected {
    border-color: #ff4400;
    box-shadow: 0 0 40px rgba(255, 68, 0, 0.2);
    background: rgba(255, 68, 0, 0.05);
}

.hero-card[data-hero="LightningBall"].selected {
    border-color: #00ddff;
    box-shadow: 0 0 40px rgba(0, 200, 255, 0.2);
    background: rgba(0, 200, 255, 0.05);
}

.hero-card[data-hero="WindBall"].selected {
    border-color: #ccccdd;
    box-shadow: 0 0 40px rgba(200, 200, 255, 0.2);
    background: rgba(200, 200, 255, 0.05);
}

.hero-card .hero-icon {
    font-size: 36px;
    margin-bottom: 6px;
}

.hero-card .hero-name {
    font-size: 14px;
    font-weight: 700;
    color: #fff;
    margin-bottom: 2px;
}

.hero-card .hero-desc {
    font-size: 10px;
    color: rgba(255, 255, 255, 0.4);
}

.hero-card .hero-color {
    width: 30px;
    height: 3px;
    border-radius: 2px;
    margin: 6px auto 0;
}

.btn {
    padding: 14px 40px;
    border: 2px solid #00ccff;
    border-radius: 30px;
    background: transparent;
    color: #00ccff;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    touch-action: manipulation;
    text-shadow: 0 0 20px rgba(0, 200, 255, 0.2);
    box-shadow: 0 0 30px rgba(0, 200, 255, 0.05);
    margin: 5px;
    min-width: 200px;
}

.btn:active {
    transform: scale(0.95);
    background: #00ccff;
    color: #050510;
}

.btn-red {
    border-color: #ff0055;
    color: #ff0055;
    text-shadow: 0 0 20px rgba(255, 0, 85, 0.2);
    box-shadow: 0 0 30px rgba(255, 0, 85, 0.05);
}

.btn-red:active {
    background: #ff0055;
    color: #fff;
}

.btn-back {
    border-color: rgba(255,255,255,0.2);
    color: rgba(255,255,255,0.5);
    min-width: 150px;
    font-size: 14px;
}

.btn-back:active {
    background: rgba(255,255,255,0.1);
    color: #fff;
}

/* ============================================================
   ПОИСК
   ============================================================ */
#searchScreen {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(8, 8, 24, 0.95);
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

#searchScreen h2 {
    color: #00ccff;
    font-size: 24px;
    margin: 15px 0;
}

#searchScreen p {
    color: rgba(255,255,255,0.5);
    font-size: 14px;
    margin-bottom: 20px;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(0, 200, 255, 0.1);
    border-top: 4px solid #00ccff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ============================================================
   HP БАРЫ (актуальная панель описана ниже в «ВЕРХНЯЯ ПАНЕЛЬ»)
   ============================================================ */

/* ============================================================
   КНОПКА МЕНЮ (СДАТЬСЯ) — слева вверху под миникартой
   ============================================================ */
/* ============================================================
   HUD — ЭТАП 16 (расстановка владельца по плейтесту карты 3600×3600).
   Каждый элемент HUD — самостоятельный, позиция В ПРОЦЕНТАХ окна
   (масштабируется на любой телефон). Схема (left/top в %):
     ряд 1 (top 1.4%):  миникарта 0.6% → панель ХП 23% → таймер 41%
                        → соперник 64%;
     ряд 2 (top 26%):   магазин + золото (left 23%).
   #topHP — прозрачный слой на весь экран: pointer-events:none (клики
   уходят в игру), тапы ловят только сами кнопки (auto). НЕ пересекаются —
   гейт: tools/tmp-viewport-test.js (780×360 и 1280×720).
   ============================================================ */
#topHP {
    pointer-events: none;
    /* Полноэкранный канвас (этап 14) занял весь #gameContainer — слой
       абсолютом поверх канваса; % детей считаются от всего окна. */
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 45;
}
#hudMySide {
    position: absolute;
    /* правка владельца 18.10: панель ХП ВПЛОТНУЮ к миникарте (107px ≈ 14.3%
       на 780px) — большие пустые промежутки в ряду убраны */
    left: 15%;
    top: 1.4%;
    width: 20%;
    background: rgba(12,18,40,.78);
    border: 1px solid #2c3a6a;
    border-radius: 12px;
    padding: 7px 10px;
}
/* золотая шкала опыта — над шкалой ХП */
#xpBar {
    height: 3px;
    background: #222;
    border-radius: 2px;
    overflow: hidden;
    margin-bottom: 3px;
}
#xpFill {
    display: block;
    height: 100%;
    background: #ffd94a;
    width: 0%;
    transition: width .3s;
}
#hudMySide .name-row {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-bottom: 3px;
}
#hudMySide .name {
    flex: 1;
    min-width: 0;
    font-size: 12px;
    font-weight: bold;
    color: #9fe8ff;
    text-shadow: 0 1px 3px #000;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
#hudMySide .lvl-badge {
    flex-shrink: 0;
    font-size: 9px;
    font-weight: bold;
    color: #ffd94a;
    background: rgba(255, 217, 74, .12);
    border: 1px solid rgba(255, 217, 74, .4);
    border-radius: 6px;
    padding: 1px 5px;
    white-space: nowrap;
}
#hudMySide .bar-bg {
    height: 10px;
    background: #222;
    border-radius: 5px;
    overflow: hidden;
    border: 1px solid #000;
}
#hudMySide .bar-fill {
    height: 100%;
    background: linear-gradient(#4cd964, #2aa845);
    width: 100%;
    transition: width .2s;
}
#hudMySide .hp-text {
    font-size: 10px;
    color: #cfe0ff;
    text-align: center;
    margin-top: 2px;
    text-shadow: 0 1px 2px #000;
}
#hudStats {
    margin-top: 4px;
    font-size: 10px;
    color: #aab8e0;
    text-align: center;
    text-shadow: 0 1px 2px #000;
}
/* таймер + сдача: ряд 1, правее панели ХП (самостоятельный элемент);
   37% — подтянуто к панели ХП (15%+20%) по правке владельца 18.10 */
#hudTimerRow {
    position: absolute;
    left: 37%;
    top: 1.4%;
    display: flex;
    align-items: stretch;
    gap: 6px;
}
#hudTimer {
    font-size: 13px;
    font-weight: 900;
    color: #eaf0ff;
    background: rgba(12,18,40,.78);
    border: 1px solid #2c3a6a;
    border-radius: 10px;
    padding: 7px 9px;
    text-shadow: 0 1px 3px #000;
    letter-spacing: 1px;
    display: flex;
    align-items: center;
}
#surrenderBtn {
    position: static;
    width: 38px;
    border-radius: 10px;
    border: 1px solid #3a4a7a;
    background: rgba(12,18,40,.78);
    color: #ffffff;
    font-size: 17px;
    line-height: 1;
    z-index: 50;
    padding: 0;
    cursor: pointer;
    pointer-events: auto; /* #topHP имеет pointer-events:none — иначе клик уходит в PIXI-канвас */
}
#surrenderBtn:active { background: rgba(40,55,110,.85); }

/* ЗАВЕРШИТЬ ИГРУ (01.12): кнопка ПОД сдачей, появляется только когда кто-то
   отсутствует 5+ минут. В 1x1 стек — display:contents, поэтому привязываем
   её абсолютно под кнопкой сдачи (right:0 = правый край ряда). */
#abandonEndBtn {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 4px;
    padding: 4px 8px;
    font-size: 10px;
    font-weight: 900;
    white-space: nowrap;
    border-radius: 8px;
    border: 1px solid #c98a2a;
    background: rgba(70,42,8,.9);
    color: #ffd98a;
    cursor: pointer;
    pointer-events: auto;
    z-index: 51;
}
#abandonEndBtn:active { background: rgba(110,66,12,.95); }
.mode-3x3 #abandonEndBtn { position: static; margin-top: 2px; }

/* ВОЗВРАТ В МАТЧ: заметная кнопка в меню, пока матч жив на сервере */
#rejoinBtn {
    animation: rejoinPulse 1.6s ease-in-out infinite;
    font-weight: 900;
}
@keyframes rejoinPulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(73,224,122,.55); }
    50% { box-shadow: 0 0 0 8px rgba(73,224,122,0); }
}

/* ============================================================
   РЕЖИМ 3x3 — счёт убийств и центр верхней панели (30.11):
   таймер ПО ЦЕНТРУ, счёт нашей команды слева, врагов справа,
   сдача — под таймером; одиночный ник соперника сверху убран
   (есть плашки 3 союзников и 3 врагов).
   ============================================================ */
#hudTimerStack { display: contents; }
#scoreAlly, #scoreEnemy { display: none; }

.mode-3x3 #hudTimerRow {
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 10px;
}
.mode-3x3 #hudTimerStack {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}
.mode-3x3 #surrenderBtn {
    width: 52px;
    height: 24px;
    font-size: 14px;
    border-radius: 8px;
}
.mode-3x3 #hudOpponent { display: none; }
.mode-3x3 #scoreAlly,
.mode-3x3 #scoreEnemy {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 42px;
    height: 34px;
    padding: 0 8px;
    border-radius: 10px;
    font-size: 20px;
    font-weight: 900;
    letter-spacing: 0.5px;
    text-shadow: 0 1px 3px #000;
    border: 1px solid;
}
.mode-3x3 #scoreAlly {
    color: #9fe8ff;
    background: rgba(6, 26, 42, 0.78);
    border-color: rgba(90, 200, 255, 0.45);
}
.mode-3x3 #scoreEnemy {
    color: #ffb0a0;
    background: rgba(38, 8, 12, 0.78);
    border-color: rgba(255, 110, 110, 0.45);
}

/* ЭТАП 16: обёртка #hudRow2 удалена — миникарта, магазин и золото теперь
   самостоятельные абсолютно-позиционированные элементы (см. ниже и #minimap). */

/* соперник: ряд 1, правее таймера (самостоятельный элемент); 52% — таймер
   кончается ~50.4% на 780px, 52% даёт зазор ~12px без пересечения */
#hudOpponent {
    position: absolute;
    left: 52%;
    top: 1.4%;
    max-width: 33%; /* до 97% окна: длинный ник — в ellipsis, за край не едет */
    display: flex;
    align-items: center;
    gap: 6px;
    background: rgba(12,18,40,.78);
    border: 1px solid #2c3a6a;
    border-radius: 12px;
    padding: 7px 10px;
    font-size: 12px;
    font-weight: bold;
    color: #ffb0a0;
    text-shadow: 0 1px 3px #000;
    white-space: nowrap;
}
#hudOpponent #oppHeroIcon { font-size: 16px; }
#hudOpponent #opponentName {
    overflow: hidden;
    text-overflow: ellipsis;
}
/* FPS / мс рядом с блоком врагов (02.12). Позицию считает layoutFpsMeter(). */
#fpsMeter {
    position: absolute;
    z-index: 60;
    pointer-events: none;
    white-space: nowrap;
    padding: 2px 6px;
    border-radius: 7px;
    background: rgba(8,12,28,.72);
    border: 1px solid #2c3a6a;
    color: #b9e7ff;
    font: 900 10px/1.2 Arial, sans-serif;
    letter-spacing: .3px;
    text-shadow: 0 1px 3px #000;
    opacity: .9;
}
/* ЭТАП 16: #hudMySide/#hudOpponent позиционируются в своих правилах (absolute),
   оверлею респауна они — positioned-предки, отдельное правило relative не нужно. */
/* оверлей респауна: рамка мутнеет, в центре — таймер до возрождения */
.respawn-overlay {
    position: absolute;
    inset: 0;
    background: rgba(8,12,28,.72);
    border-radius: inherit;
    display: none;
    align-items: center;
    justify-content: center;
    font-size: 15px;
    font-weight: 900;
    color: #ffb0b0;
    text-shadow: 0 1px 4px #000;
    z-index: 6;
    pointer-events: none;
}
.respawn-overlay.visible { display: flex; }

/* ЭТАП 16: магазин и золото — ряд 2 под панелью ХП, самостоятельные элементы
   (раньше жили во второй строке hudRow2: миникарта → магазин → золото) */

/* магазин: ряд 2, ПОД панелью ХП (той же ширины 15%) — правка владельца 18.10 */
#shopBtn {\n    touch-action: manipulation;
    position: absolute;
    left: 15%;
    top: 26%;
    pointer-events: auto;
    width: 34px;
    height: 34px;
    border-radius: 10px;
    border: 1px solid #3a4a7a;
    background: rgba(20,28,60,.7);
    color: #cfe0ff;
    font-size: 15px;
    line-height: 1;
    padding: 0;
}
#shopBtn:active { background: rgba(40,55,110,.85); }

/* золото: ряд 2, правее кнопки магазина (34px кнопка + 8px зазор) */
#goldBar {
    position: absolute;
    left: calc(15% + 42px);
    top: 26%;
    display: flex;
    align-items: center;
    gap: 4px;
    white-space: nowrap;
    padding: 5px 10px;
    border-radius: 10px;
    border: 1px solid #6a5a1a;
    background: rgba(40,34,10,.7);
    color: #ffd94a;
    font-size: 13px;
    font-weight: bold;
}

/* Уровень теперь в скобках после ника; чип удалён */

/* Счётчик онлайна на главном экране */

/* Кнопка рейтинга над заголовком */
#leaderboardBtn {
    display: block;
    margin: 0 auto 6px;
    padding: 5px 14px;
    border-radius: 16px;
    border: 1px solid #6a5a1a;
    background: rgba(40,34,10,.7);
    color: #ffd94a;
    font-size: 12px;
    font-weight: bold;
    cursor: pointer;
}
#leaderboardBtn:active { background: rgba(70,60,20,.85); }

/* Панель рейтинга игроков */
#leaderboardPanel {
    position: absolute;
    inset: 0;
    z-index: 1100;
    background: rgba(8,8,24,.96);
    display: none;
    flex-direction: column;
    padding: 16px;
    overflow: hidden;
}
#lbHeader {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 15px;
    font-weight: bold;
    color: #ffd94a;
    margin-bottom: 12px;
}
#lbClose {
    background: none;
    border: none;
    color: #8899cc;
    font-size: 16px;
    cursor: pointer;
}
#leaderboardList {
    overflow-y: auto;
    flex: 1;
}
.lb-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 8px;
    margin-bottom: 5px;
    border-radius: 10px;
    border: 1px solid #2a3560;
    background: rgba(20,28,60,.5);
}
.lb-row.me { border-color: #ffd94a; background: rgba(60,50,10,.5); }
.lb-place {
    width: 26px;
    font-size: 12px;
    font-weight: 900;
    color: #ffd94a;
    text-align: center;
    flex-shrink: 0;
}
.lb-avatar {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    flex-shrink: 0;
    background: #2a3560;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: bold;
    color: #cfe0ff;
    overflow: hidden;
}
.lb-avatar img { width: 100%; height: 100%; object-fit: cover; }
.lb-info { flex: 1; min-width: 0; }
.lb-name {
    font-size: 12px;
    font-weight: bold;
    color: #dfe8ff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.lb-rankname { font-size: 10px; color: #8899cc; }
.lb-rating {
    font-size: 13px;
    font-weight: 900;
    color: #ffd94a;
    text-align: right;
    flex-shrink: 0;
}
.lb-wl { font-size: 9px; color: #8899aa; text-align: right; }
#onlineCounter {
    display: none;
    margin: 4px auto 10px;
    padding: 6px 16px;
    width: fit-content;
    border-radius: 20px;
    border: 1px solid rgba(0, 255, 100, 0.25);
    background: rgba(0, 40, 15, 0.5);
    color: #4aff8a;
    font-size: 13px;
    font-weight: bold;
    text-shadow: 0 0 10px rgba(0, 255, 100, 0.3);
}

/* Панель магазина */
#shopPanel {
    position: absolute;
    pointer-events: auto;
    touch-action: manipulation;
    top: 150px;
    right: 6px;
    width: 240px;
    max-height: 55%;
    z-index: 210; /* выше #controls (200): открытый магазин не перекрывается кнопками */
    background: rgba(12,16,36,.96);
    border: 1px solid #3a4a7a;
    border-radius: 12px;
    display: none;
    flex-direction: column;
    overflow: hidden;
}
#shopHeader {
    display: flex; justify-content: space-between; align-items: center;
    padding: 8px 10px; font-size: 13px; font-weight: bold; color: #cfe0ff;
    border-bottom: 1px solid #2a3560;
}
#shopClose { background:none; border:none; color:#8899cc; font-size:14px; cursor:pointer; }
#shopSlotsRow {
    display: flex; align-items: center; gap: 6px;
    padding: 8px 10px 2px;
}
#shopSlots { display:flex; gap:4px; flex:1 1 auto; min-width:0; }
#shopSlots .slot {
    width: 26px; height: 26px; border-radius: 6px;
    border: 1px dashed #3a4a7a; background: rgba(20,28,60,.6);
    display:flex; align-items:center; justify-content:center;
    font-size: 9px; color:#8899cc; text-align:center; overflow:hidden;
    cursor: pointer;
}
#shopSlots .slot.filled { border-style: solid; border-color: #6a7ab0; }
#shopSlots .slot.selected {
    border-color: #ffd94a;
    box-shadow: 0 0 0 2px rgba(255,217,74,.45);
    background: rgba(70,58,20,.75);
}
#shopSlots .slot:not(.filled) { cursor: default; opacity: .55; }
#sellItemBtn {
    flex: 0 0 auto;
    height: 26px; min-width: 64px; padding: 0 6px;
    border-radius: 6px; border: 1px solid #8a5a2a;
    background: rgba(88,48,18,.9); color: #ffd94a;
    font-size: 8px; font-weight: 900; letter-spacing: .3px;
    cursor: pointer; touch-action: manipulation;
}
#sellItemBtn:disabled { opacity: .35; cursor: default; }
#sellItemBtn:not(:disabled):active { transform: scale(.95); }
#shopList { flex: 1 1 auto; min-height: 0; touch-action: pan-y; overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 6px; }
.shop-item {
    padding: 6px 8px; margin-bottom: 5px; border-radius: 8px;
    border: 1px solid #2a3560; background: rgba(20,28,60,.5);
    color: #dfe8ff; font-size: 11px; cursor: pointer;
}
.shop-item:hover { border-color: #5a6ab0; }
.shop-item .nm { font-weight: bold; font-size: 12px; }
.shop-item .bonus { color: #7fd48a; }
.shop-item .cost { color: #ffd94a; }
.shop-item { touch-action: manipulation; }\n.shop-item.poor { opacity: .45; cursor: default; }
.shop-item.owned { border-color: #4a7a5a; }
/* Состояние «каталог не загрузился» (03.12): вместо пустого списка — текст и повтор */
.shop-empty { padding: 14px 10px; color: #9fb0d8; font-size: 12px; text-align: center; line-height: 1.5; }
.shop-retry { color: #ffd94a; font-weight: bold; text-decoration: underline; cursor: pointer; }

/* ============================================================
   ПРОКАЧКА СКИЛЛОВ: кнопки «+» и ранги, ульта
   ============================================================ */
.skill-wrap { position: relative; display: inline-block; --sk: 64px; --plus: calc(var(--sk) * 0.7); }
/* «+» — ОТДЕЛЬНАЯ мини-кнопка (02.12 увеличена x2: 70% от скилла), по диагонали
   СВЕРХУ-СЛЕВА, не касается круга скилла (центр по углу 135°, зазор 4px). */
.skill-up {
    position: absolute;
    width: var(--plus);
    height: var(--plus);
    left: calc(var(--sk) * 0.5 - (var(--sk) * 0.5 + var(--plus) * 0.5 + 4px) * 0.707 - var(--plus) * 0.5);
    top: calc(var(--sk) * 0.5 - (var(--sk) * 0.5 + var(--plus) * 0.5 + 4px) * 0.707 - var(--plus) * 0.5);
    right: auto;
    transform: none;
    border-radius: 50%;
    border: 1px solid #b8e986;
    background: radial-gradient(circle at 35% 30%, #4f8f3f, #1e4628 75%);
    color: #eaffb0;
    font-size: calc(var(--plus) * 0.7);
    font-weight: 900;
    line-height: 1;
    z-index: 9;
    display: none; /* появляется, когда есть очко навыка */
    padding: 0;
    box-shadow: 0 0 8px rgba(160,255,90,.9), 0 0 16px rgba(120,255,60,.5);
    animation: skillPlusPulse 1.1s ease-in-out infinite alternate;
}
.skill-up.visible { display: flex; align-items: center; justify-content: center; }
@keyframes skillPlusPulse {
    0% { transform: scale(1); box-shadow: 0 0 8px rgba(160,255,90,.7), 0 0 16px rgba(120,255,60,.35); }
    100% { transform: scale(1.14); box-shadow: 0 0 16px rgba(190,255,120,1), 0 0 30px rgba(120,255,60,.65); }
}
.skill-rank {
    display: none; /* уровень показывают точки по окружности */
}
/* УРОВЕНЬ СКИЛЛА — ТОЧКИ ПО ОКРУЖНОСТИ (02.12): 4 точки в правом нижнем
   секторе ВНЕ круга скилла (радиус = sk/2 + 6px), на сам скилл не заходят.
   Заполненные — золотые с ореолом, пустые — тёмные. */
.skill-level-bar {
    position: absolute;
    inset: 0;
    z-index: 8;
    pointer-events: none;
}
.skill-level-bar i {
    position: absolute;
    width: calc(var(--sk) * 0.07);
    height: calc(var(--sk) * 0.07);
    border-radius: 50%;
    background: rgba(8, 12, 24, 0.9);
    border: 1px solid rgba(120, 140, 190, 0.5);
    box-shadow: inset 0 1px 2px rgba(0,0,0,.6);
    transition: background .18s ease, box-shadow .18s ease;
}
.skill-level-bar i:nth-child(1) {
    left: calc(var(--sk) * 0.5 + (var(--sk) * 0.5 + 10px) * 0.940 - var(--sk) * 0.035);
    top:  calc(var(--sk) * 0.5 + (var(--sk) * 0.5 + 10px) * 0.342 - var(--sk) * 0.035);
}
.skill-level-bar i:nth-child(2) {
    left: calc(var(--sk) * 0.5 + (var(--sk) * 0.5 + 10px) * 0.819 - var(--sk) * 0.035);
    top:  calc(var(--sk) * 0.5 + (var(--sk) * 0.5 + 10px) * 0.574 - var(--sk) * 0.035);
}
.skill-level-bar i:nth-child(3) {
    left: calc(var(--sk) * 0.5 + (var(--sk) * 0.5 + 10px) * 0.643 - var(--sk) * 0.035);
    top:  calc(var(--sk) * 0.5 + (var(--sk) * 0.5 + 10px) * 0.766 - var(--sk) * 0.035);
}
.skill-level-bar i:nth-child(4) {
    left: calc(var(--sk) * 0.5 + (var(--sk) * 0.5 + 10px) * 0.423 - var(--sk) * 0.035);
    top:  calc(var(--sk) * 0.5 + (var(--sk) * 0.5 + 10px) * 0.906 - var(--sk) * 0.035);
}
.skill-level-bar i.on {
    background: radial-gradient(circle at 35% 30%, #fff3b0, #ffb728 70%);
    border-color: rgba(255, 225, 140, 0.95);
    box-shadow: 0 0 6px rgba(255, 200, 60, 0.95), 0 0 12px rgba(255, 180, 40, 0.5);
}
.skill-wrap .action-btn {
    box-shadow: 0 0 0 3px rgba(10, 14, 30, 0.55), 0 4px 12px rgba(0,0,0,.45);
}
.skill-wrap .action-btn:not(.unlearned) {
    border-color: rgba(255, 226, 150, 0.55);
    box-shadow: 0 0 0 3px rgba(10, 14, 30, 0.55), 0 0 14px rgba(255, 200, 80, 0.28), 0 4px 12px rgba(0,0,0,.45);
}
.ult-btn { border-color: #7a4a9a !important; }
.ult-btn .label { color: #d0aaff !important; }
.skill-wrap.ult.locked { opacity: .4; }
/* НЕИЗУЧЕННЫЙ СКИЛЛ: тёмный, обесцвечен, почти не виден — пока не прокачаешь */
.action-btn.unlearned {
    opacity: .34;
    filter: grayscale(1) brightness(.55);
}
.action-btn.unlearned .label { color: #8899aa !important; }
.skill-wrap.skill-locked .skill-level-bar { opacity: .35; }

/* ЗАЛИВКА КНОПОК СКИЛЛОВ (02.12): непрокачанный — ЧЁРНЫЙ, иконка видна;
   после прокачки — плотная цветная заливка (цвет героя, --sk-hi/--sk-lo). */
.skill-btn {
    background: radial-gradient(circle at 35% 28%, #1a2030, #070a12 80%);
    border: 2px solid rgba(150, 170, 220, 0.28);
    box-shadow: inset 0 -6px 14px rgba(0,0,0,.6), 0 0 0 3px rgba(8,10,18,.85), 0 4px 12px rgba(0,0,0,.5);
}
.skill-btn.learned {
    background: radial-gradient(circle at 35% 28%, var(--sk-hi, #5fd6ff), var(--sk-lo, #0a3a5a) 78%);
    border-color: rgba(255, 255, 255, 0.4);
    box-shadow: inset 0 -8px 16px rgba(0,0,0,.45), 0 0 0 3px rgba(8,10,18,.85), 0 0 16px var(--sk-glow, rgba(80,200,255,.45)), 0 4px 12px rgba(0,0,0,.5);
}
.skill-btn.unlearned {
    opacity: 1;
    filter: none;
    background: radial-gradient(circle at 35% 28%, #191d27, #05070c 80%);
    border-color: rgba(90, 105, 135, 0.4);
}
.skill-btn.unlearned .icon { opacity: .8; filter: grayscale(.5); }

/* ============================================================
   МИНИКАРТА (этап 16 + правка владельца 18.10: +30% = 107px,
   чтобы карта 3600×3600 лучше читалась): самостоятельный элемент,
   левый верхний угол. Низ (1.4%+107px ≈ 31% высоты при 360px)
   НЕ заходит в зону джойстика (нижняя левая четверть, y>50%).
   ============================================================ */
#minimap {
    position: absolute;
    left: 0.6%;
    top: 1.4%;
    z-index: 50;
    pointer-events: none;
    border-radius: 6px;
    overflow: hidden;
    box-shadow: 0 0 20px rgba(0, 200, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.05);
    background: rgba(0, 0, 0, 0.6);
    /* backdrop-filter blur(4px) убран (этап 22, FPS телефонов: размытие
       пересчитывается каждый кадр и сильно бьёт по мобильным GPU) */
    width: 107px;
    height: 107px;
}

#minimap canvas {
    width: 100%;
    height: 100%;
    display: block;
}

/* ЗУМ КАМЕРЫ (02.12): +/− справа по центру высоты экрана.
   Декоративный контейнер не ловит тапы (pointer-events:none), кнопки — auto.
   z-index 55: выше HUD, но ниже модалок (60+) и ресайна. */
#zoomControls {
    position: fixed;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    z-index: 55;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    pointer-events: none;
    user-select: none;
}
#zoomControls .zoom-btn {
    pointer-events: auto;
    width: 38px;
    height: 38px;
    border-radius: 10px;
    border: 1px solid #3a4a7a;
    background: rgba(12, 18, 40, 0.72);
    color: #eaf0ff;
    font-size: 20px;
    font-weight: 900;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    text-shadow: 0 1px 3px #000;
}
#zoomControls .zoom-btn:active { background: rgba(40, 55, 110, 0.9); }
#zoomControls .zoom-btn:disabled { opacity: 0.35; cursor: default; }
#zoomValue {
    font-size: 10px;
    font-weight: 900;
    color: #cfe0ff;
    background: rgba(12, 18, 40, 0.6);
    border-radius: 6px;
    padding: 1px 4px;
    pointer-events: none;
}
/* Короткие экраны телефона: компактнее, чтобы не задевать джойстик/скиллы */
@media (max-height: 430px) {
    /* Скиллы выросли ×1.5 — на коротком экране зум-кнопки поднимаем выше панели,
       чтобы не перекрывать верхний скилл. */
    #zoomControls { gap: 4px; right: 0; top: 50%; }
    #zoomControls .zoom-btn { width: 32px; height: 32px; font-size: 17px; border-radius: 8px; }
    #zoomValue { font-size: 9px; }
}

/* ============================================================
   ПАНЕЛИ СОСТАВА 3x3 (30.11, требование владельца): союзники слева под
   миникартой, противники справа. Без подписей-заголовков, зато с мини-иконкой
   героя, ником, УРОВНЕМ и полосой ХП.
   ============================================================ */
#allyPanel,
#enemyPanel {
    position: absolute;
    top: 118px;
    z-index: 50;
    pointer-events: none;
    width: 158px;
    padding: 6px 7px;
    border-radius: 8px;
    font-family: 'Segoe UI', Arial, sans-serif;
    font-size: 10px;
    color: #dfefff;
}
#allyPanel { left: 0.6%; background: rgba(6, 26, 42, 0.6); border: 1px solid rgba(90, 200, 255, 0.28); }
#enemyPanel { right: 0.6%; top: 1.4%; background: rgba(38, 8, 12, 0.6); border: 1px solid rgba(255, 110, 110, 0.28); }
#allyPanel .team-row,
#enemyPanel .team-row { margin-bottom: 5px; }
#allyPanel .team-row:last-child,
#enemyPanel .team-row:last-child { margin-bottom: 0; }
#allyPanel .team-row.dead,
#enemyPanel .team-row.dead { opacity: 0.45; }
#allyPanel .team-top,
#enemyPanel .team-top {
    display: flex; align-items: center; gap: 4px;
    margin-bottom: 2px; white-space: nowrap;
}
#allyPanel .team-icon,
#enemyPanel .team-icon { font-size: 12px; line-height: 1; }
#allyPanel .team-name,
#enemyPanel .team-name {
    flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis;
    font-weight: 600; letter-spacing: 0.2px;
}
#allyPanel .team-lvl,
#enemyPanel .team-lvl {
    font-weight: 700; font-size: 9px; padding: 0 4px; border-radius: 6px;
    background: rgba(255, 255, 255, 0.14);
}
#allyPanel .team-kills,
#enemyPanel .team-kills {
    font-weight: 700; font-size: 9px; color: #ffd94a;
    text-shadow: 0 1px 2px #000; margin-right: 2px;
}
#allyPanel .team-resp,
#enemyPanel .team-resp {
    height: 5px; line-height: 5px; font-size: 8px; font-weight: 700;
    color: #ffd94a; text-align: center; letter-spacing: 0.3px;
}
#allyPanel .team-bar,
#enemyPanel .team-bar {
    height: 5px; border-radius: 3px; overflow: hidden;
    background: rgba(255, 255, 255, 0.12);
}
#allyPanel .team-bar i {
    display: block; height: 100%; width: 100%;
    transform-origin: left center; will-change: transform;
    background: linear-gradient(90deg, #1fd1ff, #5cffb0);
}
#enemyPanel .team-bar i {
    display: block; height: 100%; width: 100%;
    transform-origin: left center; will-change: transform;
    background: linear-gradient(90deg, #ff6a4d, #ffb36b);
}

/* Короткие экраны (телефон в ландшафте 780x360): панели уже и компактнее —
   не задевают кнопку магазина (x≈117) и джойстик (низ-лево). */
@media (max-height: 430px) {
    #allyPanel,
    #enemyPanel {
        width: 110px;
        font-size: 9px;
        padding: 4px 5px;
        top: 116px;
    }
    /* Панель ПРОТИВНИКОВ — вровень с таймером и миникартой (top 1.4%) */
    #enemyPanel { top: 1.4%; }
    #allyPanel .team-icon,
    #enemyPanel .team-icon { font-size: 10px; }
    #allyPanel .team-lvl,
    #enemyPanel .team-lvl { font-size: 8px; padding: 0 3px; }
    #allyPanel .team-bar,
    #enemyPanel .team-bar { height: 4px; }
    #allyPanel .team-row,
    #enemyPanel .team-row { margin-bottom: 3px; }
}

/* ЭТАП 16: прежний media (max-height:430px) со сжатием миникарты до 120px
   удалён — владелец зафиксировал размер 165×165 и %-раскладку; непересечение
   с джойстиком проверяется гейтом tools/tmp-viewport-test.js на 780×360. */

/* ============================================================
   УПРАВЛЕНИЕ
   ============================================================ */
#controls {
    position: absolute;
    bottom: 15px;
    left: 0;
    right: 0;
    display: flex;
    /* ЭТАП 22: фиксированный джойстик удалён — остался один ребёнок
       (#actionBtns), держим его справа */
    justify-content: flex-end;
    align-items: flex-end;
    padding: 0 15px;
    z-index: 200;
    gap: 10px;
    pointer-events: none; /* полоса прозрачна для кликов — тапы идут в игру */
}

/* ============================================================
   ДИНАМИЧЕСКИЙ ДЖОЙСТИК (этап 22, аналог Magic Legends): спавнится
   в точке тапа по пустому месту в нижней левой четверти, исчезает при
   отпускании (логика в js/Game.js). Декоративный: pointer-events:none —
   урока про мёртвые зоны тапов; ввод ловят канвас + window-слушатели.
   ============================================================ */
#dynamicJoystick {
    pointer-events: none;
    position: fixed;
    width: 140px;
    height: 140px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(0, 200, 255, 0.08), rgba(0, 100, 200, 0.15));
    border: 2px solid rgba(0, 200, 255, 0.2);
    z-index: 190; /* над канвасом; под #controls (200) */
    display: none;
    touch-action: none;
    box-shadow: 0 0 40px rgba(0, 200, 255, 0.05), inset 0 0 40px rgba(0, 200, 255, 0.05);
}

#joyKnob {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(0, 200, 255, 0.4), rgba(0, 100, 200, 0.2));
    border: 2px solid rgba(0, 200, 255, 0.3);
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    transition: none;
    touch-action: none;
    box-shadow: 0 0 30px rgba(0, 200, 255, 0.15);
    pointer-events: none;
}

#actionBtns {
    /* Кнопки вокруг Атаки (02.12): Атака +15% = 88px (доминирует),
       скиллы ×1.5 = 72/66/78px. Контейнер расширен до 220×265,
       зазоры между кнопками 8–12px, без пересечений. */
    pointer-events: none; /* пустая область контейнера НЕ ловит тапы —
                             иначе она перекрывает нижние строки магазина */
    position: relative;
    width: 220px;
    height: 265px;
    flex-shrink: 0;
}
#actionBtns .action-btn,
#actionBtns .skill-up {
    pointer-events: auto; /* кликабельны только сами кнопки */
}

.action-btn {
    border-radius: 50%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    touch-action: manipulation;
    transition: all 0.15s ease;
    border: 2px solid rgba(255,255,255,0.15);
    background: rgba(255,255,255,0.05);
    color: #fff;
    font-size: 8px;
    font-weight: 600;
    text-shadow: 0 0 20px rgba(255,255,255,0.1);
}

.action-btn:active {
    transform: scale(0.9);
}

.action-btn .icon {
    font-size: 18px;
    line-height: 1;
    margin-bottom: 1px;
}

.action-btn .label {
    font-size: 7px;
    opacity: 0.7;
    line-height: 1.1;
}

#attackBtn {
    position: absolute;
    right: 0;
    bottom: 0;
    width: 88px;   /* 76px +15% */
    height: 88px;
    border: none;
    touch-action: none; /* второй палец по атаке не должен отменять джойстик */
    /* pressed-картинка должна меняться сразу; transform/тень — коротко */
    transition: transform .08s ease, box-shadow .15s ease;
    background: url('../assets/ui/attack_normal.webp?v=1') center / 100% 100% no-repeat;
    box-shadow: 0 0 24px rgba(140, 30, 20, 0.45);
}

#attackBtn .icon,
#attackBtn .label {
    display: none;
}

#attackBtn:active,
#attackBtn.pressed {
    background: url('../assets/ui/attack_pressed.webp?v=1') center / 100% 100% no-repeat;
    border-color: transparent;
    box-shadow: 0 0 34px rgba(255, 60, 30, 0.55);
    transform: scale(0.95);
}

/* 02.12: отдельная КАРТИНКА для «Взрыва» Водяного удалена — у всех героев
   первый скилл рисуется обычной emoji-иконкой в круглой кнопке. */

/* КУЛДАУН-«ЧАСИКИ» У ВСЕХ СКИЛЛОВ (02.12): тёмный сектор тает, в центре секунды. */
.skill-btn .cd-overlay {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    display: none;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    font-weight: 900;
    color: #eaf4ff;
    text-shadow: 0 1px 4px rgba(0, 20, 60, 0.95), 0 0 6px rgba(0,0,0,.8);
    pointer-events: none;
    z-index: 4;
}
/* СИММЕТРИЧНАЯ ДУГА вокруг центра атаки (02.12): R=108, все скиллы ОДНОГО
   размера 80px. Центр атаки (176,221) → кнопки почти вплотную (зазор к атаке
   24px, между скиллами ~3px), пустых зон между кнопками минимум. */
#wrap1 { position: absolute; left: 36px; top: 189px; --sk: 64px; }
#wrap2 { position: absolute; left: 68px; top: 113px; --sk: 64px; }
#wrap3 { position: absolute; left: 144px; top: 81px; right: auto; --sk: 64px; }

#skill1, #skill2, #skill3 { width: 64px; height: 64px; }
#skill1 .icon, #skill2 .icon, #skill3 .icon { font-size: 21px; }

/* Ульт (жёлтый) — над розовым */
#wrap4 { position: absolute; right: 0; bottom: 164px; }
#skill4 {
    width: 50px;
    height: 50px;
}

#skill4 .icon {
    font-size: 17px;
}

#skill2 .icon {
    font-size: 20px;
}

/* Активное состояние щита */
#skill2.active {
    border-color: #00ff00;
    box-shadow: 0 0 30px rgba(0, 255, 0, 0.3);
    animation: shieldPulse 0.5s ease-in-out infinite alternate;
}

@keyframes shieldPulse {
    0% { box-shadow: 0 0 20px rgba(0, 255, 200, 0.2); }
    100% { box-shadow: 0 0 50px rgba(0, 255, 200, 0.5); }
}

/* ============================================================
   GAME OVER
   ============================================================ */
#gameOver {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(20px);
    display: none;
    justify-content: center;
    align-items: center;
    flex-direction: column;
    z-index: 1000;
    padding: 30px;
}

#gameOver.show {
    display: flex;
    animation: fadeIn 0.5s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}

#gameOver h1 {
    font-size: 36px;
    margin-bottom: 10px;
    text-shadow: 0 0 60px currentColor;
}

#gameOver #resultTitle.win {
    color: #00ff88;
}

#gameOver #resultTitle.lose {
    color: #ff4400;
}

#gameOver p {
    color: rgba(255, 255, 255, 0.6);
    font-size: 16px;
    margin-bottom: 25px;
}

/* ============================================================
   АДАПТАЦИЯ
   ============================================================ */
@media (max-width: 440px) {
    #gameContainer {
        width: 100vw;
        height: 100vh;
        max-height: 100vh;
        border-radius: 0;
    }
    #actionBtns {
        transform: scale(0.9);
        transform-origin: bottom right;
    }

}

@media (max-height: 700px) {
    #gameContainer {
        width: 100vw;
        height: 100vh;
        max-height: 100vh;
        border-radius: 0;
    }
    #actionBtns {
        transform: scale(0.82);
        transform-origin: bottom right;
    }

}

/* Золотые шары — в верхней полосе главного экрана */
#goldBallsBar {
    display: none;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    border-radius: 14px;
    border: 1px solid #6a5a1a;
    background: rgba(40,34,10,.75);
    color: #ffd94a;
    font-size: 14px;
    font-weight: bold;
    text-shadow: 0 0 8px rgba(255,217,74,.3);
}
.gb-icon {
    display: inline-block;
    width: 15px;
    height: 15px;
    border-radius: 50%;
    background: radial-gradient(circle at 35% 30%, #fff3b0, #ffd94a 45%, #c9962a 80%, #8a6400);
    box-shadow: 0 0 8px rgba(255,217,74,.6), inset 0 -2px 3px rgba(120,80,0,.6);
}

/* ============================================================
   ВЕРХНЯЯ ПОЛОСА ГЛАВНОГО ЭКРАНА: рейтинг → профиль → шары
   ============================================================ */
#startTopBar {
    /* Обычная первая строка колонки (НЕ sticky/absolute): скроллится вместе с
       меню, поэтому заголовок физически не может оказаться под панелью */
    position: static;
    align-self: stretch;   /* ширина как раньше (left/right:10px → margin) */
    margin: 0 10px 12px;
    z-index: 60;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}
#leaderboardBtn {
    display: inline-block;
    margin: 0;
    padding: 6px 12px;
    border-radius: 16px;
    border: 1px solid #6a5a1a;
    background: rgba(40,34,10,.7);
    color: #ffd94a;
    font-size: 12px;
    font-weight: bold;
    cursor: pointer;
    white-space: nowrap;
}
#leaderboardBtn:active { background: rgba(70,60,20,.85); }
#goldBallsBar {
    position: static;
    display: flex;
    padding: 6px 12px;
    border-radius: 14px;
    border: 1px solid #6a5a1a;
    background: rgba(40,34,10,.75);
    color: #ffd94a;
    font-size: 14px;
    font-weight: bold;
    text-shadow: 0 0 8px rgba(255,217,74,.3);
    white-space: nowrap;
}
#profileBar {
    display: none;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    border-radius: 14px;
    border: 1px solid #4a5a8a;
    background: rgba(16,24,52,.75);
    font-size: 13px;
    font-weight: bold;
    white-space: nowrap;
}
#profileBar #pbEmblem { font-size: 15px; }
#profileBar #pbRating { color: #ffd94a; }
#profileBar #pbWL { color: #9fe8ff; }
/* ============================================================
   КНОПКА ЗВАНИЯ (центр верхней полосы) + ЛЕСТНИЦА ЗВАНИЙ
   ============================================================ */
#rankBtn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    border-radius: 14px;
    border: 1px solid #4a5a8a;
    background: rgba(16,24,52,.78);
    color: #dfe8ff;
    font-size: 13px;
    font-weight: bold;
    cursor: pointer;
    white-space: nowrap;
    text-shadow: 0 1px 3px #000;
}
#rankBtn:hover { border-color: #ffd94a; }
#rankBtn #rankBtnEmblem { font-size: 16px; }

#ranksPanel {
    position: absolute;
    top: 64px;
    left: 50%;
    transform: translateX(-50%);
    width: 300px;
    max-height: 60%;
    overflow-y: auto;
    z-index: 850;
    background: rgba(10,14,32,.97);
    border: 1px solid #4a5a8a;
    border-radius: 14px;
    padding: 10px;
    box-shadow: 0 10px 40px rgba(0,0,0,.6);
}
.ranks-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 7px 10px;
    margin-bottom: 4px;
    border-radius: 10px;
    border: 1px solid #2a3560;
    background: rgba(20,28,60,.5);
}
.ranks-row.current {
    border-color: #ffd94a;
    background: rgba(60,50,10,.5);
}
.ranks-row .r-emblem { font-size: 20px; width: 26px; text-align: center; flex-shrink: 0; }
.ranks-row .r-name { flex: 1; font-size: 12px; font-weight: bold; color: #dfe8ff; }
.ranks-row .r-range { font-size: 10px; color: #8899cc; white-space: nowrap; }
.ranks-row.current .r-range { color: #ffd94a; }
/* Очки и счёт в кнопке звания */
#rankBtnStats {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-left: 4px;
    padding-left: 8px;
    border-left: 1px solid #4a5a8a;
    font-size: 12px;
}
#rankBtnRating { color: #ffd94a; }
.wl .win-num { color: #4aff8a; }
.wl .lose-num { color: #ff6655; }

/* Клик мимо лестницы званий закрывает её (перехват на body) */
body.ranks-open #ranksPanel { display: block; }

/* ============================================================
   ЭКРАН ВОЗВРАТА В МАТЧ после отключения
   ============================================================ */
#rejoinOverlay {
    position: absolute;
    inset: 0;
    z-index: 1200;
    background: rgba(5,8,20,.9);
    backdrop-filter: blur(8px);
    display: none;
    align-items: center;
    justify-content: center;
}
#rejoinBox {
    background: #141c3c;
    border: 1px solid #4a5a8a;
    border-radius: 18px;
    padding: 26px 28px;
    max-width: 330px;
    text-align: center;
    color: #dfe8ff;
}
#rejoinTitle { font-size: 17px; font-weight: bold; margin-bottom: 10px; color: #ffd94a; }
#rejoinText { font-size: 13px; line-height: 1.6; margin-bottom: 20px; color: #cfe0ff; }
#rejoinBtn {
    width: 100%;
    padding: 13px 20px;
    border-radius: 14px;
    border: 2px solid #00ccff;
    background: rgba(0, 204, 255, 0.12);
    color: #00ccff;
    font-size: 15px;
    font-weight: bold;
    cursor: pointer;
    transition: all .15s ease;
}
#rejoinBtn:active { background: #00ccff; color: #050510; }

/* ============ НАГРАДЫ (скины за золотые шары) ============ */
#rewardsBtn {
    margin-top: 10px;
    background: linear-gradient(180deg, #3a2e08, #241c04);
    border-color: #ffd94a;
}
.rewards-btn { font-size: 15px; }

#rewardsPanel {
    position: absolute;
    inset: 0;
    z-index: 1100;
    background: rgba(8,8,24,.97);
    display: none;
    flex-direction: column;
    padding: 16px;
    overflow: hidden;
}
#rewardsHeader {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    font-size: 15px;
    font-weight: bold;
    color: #ffd94a;
    margin-bottom: 12px;
}
#rewardsBack {
    background: rgba(40,50,90,.6);
    border: 1px solid #2a3560;
    color: #aab6dd;
    border-radius: 10px;
    padding: 8px 14px;
    font-size: 14px;
    cursor: pointer;
    flex: 0 0 auto;
}
#rewardsBalance {
    color: #ffd94a;
    background: rgba(60,48,8,.6);
    border: 1px solid #6b5a14;
    border-radius: 10px;
    padding: 6px 12px;
    flex: 0 0 auto;
}
/* Тот же макет, что #heroSelection: сетка 2 столбца, скролл ВНИЗ */
#rewardsList {
    flex: 1;
    overflow-y: auto;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    align-content: start;
    width: 100%;
    max-width: 340px;
    margin: 0 auto;
    padding-bottom: 16px;
}
/* Карточка 1-в-1 как .hero-card */
.reward-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 15px 10px;
    border-radius: 16px;
    border: 2px solid rgba(255, 255, 255, 0.1);
    background: rgba(255, 255, 255, 0.05);
}
.reward-card.active {
    border-color: #ffd94a;
    box-shadow: 0 0 30px rgba(255,217,74,.18);
}
/* Превью — размер иконки героя (.hero-icon, 36px) */
.reward-preview {
    width: 48px;
    height: 48px;
    margin-bottom: 6px;
    border-radius: 50%;
    background: none;
}
.reward-name { font-size: 14px; font-weight: 700; color: #fff; }
.reward-hero { font-size: 10px; color: rgba(255,255,255,.5); margin-top: 2px; }
.reward-desc { font-size: 10px; color: rgba(255,255,255,.4); margin-top: 4px; min-height: 24px; }
.reward-status { font-size: 12px; color: #ffd94a; margin-top: 6px; }
/* Кнопка строго в пределах карточки (перебиваем .btn: min-width:200px и padding 40px) */
.reward-btn {
    min-width: 0;
    width: 100%;
    max-width: 100%;
    margin: 8px 0 0;
    padding: 9px 6px;
    font-size: 13px;
    line-height: 1.2;
    box-sizing: border-box;
}

/* Выравнивание верхней полосы: счётчик шаров всегда виден целиком */
#startTopBar { flex-wrap: nowrap; }
#leaderboardBtn, #goldBallsBar { flex-shrink: 0; }
#rankBtn {
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    justify-content: center;
}
#rankBtnName {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
@media (max-width: 420px) {
    #rankBtn { padding: 6px 8px; gap: 4px; font-size: 12px; }
    #leaderboardBtn { padding: 6px 8px; font-size: 11px; }
    #goldBallsBar { padding: 6px 8px; font-size: 13px; }
}

/* ============ МОДАЛКА ВЫБОРА СКИНА ============ */
#skinPickerModal {
    position: absolute;
    inset: 0;
    z-index: 1200;
    background: rgba(5,6,18,.72);
    display: none;
    align-items: center;
    justify-content: center;
}
#skinPickerBox {
    width: 380px;
    max-width: calc(100% - 32px);
    max-height: 70%;
    overflow-y: auto;
    background: rgba(12,16,38,.97);
    border: 1px solid #4a5a8a;
    border-radius: 16px;
    padding: 12px;
    box-shadow: 0 10px 40px rgba(0,0,0,.6);
}
#skinPickerHead {
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: #ffd94a;
    font-weight: bold;
    font-size: 14px;
    margin-bottom: 10px;
}
#skinPickerClose {
    background: none;
    border: none;
    color: #8899cc;
    font-size: 16px;
    cursor: pointer;
}
#skinPickerGrid {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
    padding-bottom: 6px;
}
.skin-tile {
    width: 116px;
    padding: 10px 8px 8px;
    border-radius: 14px;
    border: 2px solid rgba(255,255,255,.1);
    background: rgba(255,255,255,.05);
    text-align: center;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}
.skin-tile.selected {
    border-color: #ffd94a;
    box-shadow: 0 0 20px rgba(255,217,74,.25);
}
.skin-tile-preview {
    width: 72px;
    height: 72px;
    margin: 0 auto;
    display: block;
    object-fit: contain;
}
.skin-tile-name {
    font-size: 11px;
    color: #dfe8ff;
    line-height: 1.3;
    width: 100%;
    overflow: hidden;
}
.hero-skin {
    font-size: 10px;
    color: #ffd94a;
    margin-top: 6px;
}

/* Награды: карточка, выбранная кликом (рамка следует за курсором-тапом) */
.reward-card.picked {
    border-color: #ffd94a;
    box-shadow: 0 0 30px rgba(255,217,74,.18);
}


/* ===== Главный экран: стиль «Награды» (тёмный + золотая рамка) ===== */
/* Карточки героев */
#startScreen .hero-card {
    background: linear-gradient(180deg, #3a2e08, #241c04);
    border-color: #ffd94a;
}
#startScreen .hero-card.selected {
    border-color: #00ccff;
    box-shadow: 0 0 30px rgba(0, 200, 255, 0.25);
}
#startScreen .hero-card[data-hero="FireBall"].selected {
    border-color: #ff4400;
    box-shadow: 0 0 30px rgba(255, 68, 0, 0.25);
}
#startScreen .hero-card[data-hero="LightningBall"].selected {
    border-color: #00ddff;
    box-shadow: 0 0 30px rgba(0, 221, 255, 0.25);
}
#startScreen .hero-card[data-hero="WindBall"].selected {
    border-color: #ccccdd;
    box-shadow: 0 0 30px rgba(204, 204, 221, 0.25);
}
/* Кнопка «Найти соперника» — как «Награды» */
#startBtn {
    background: linear-gradient(180deg, #3a2e08, #241c04);
    border-color: #ffd94a;
    color: #ffd94a;
}
/* Заголовок и подзаголовок — в рамке с тёмным фоном */
#startScreen h1 {
    background: linear-gradient(180deg, #3a2e08, #241c04);
    border: 2px solid #ffd94a;
    border-radius: 14px;
    padding: 10px 26px;
    color: #ffd94a;
}
#startScreen h1 + p,
#startScreen p {
    background: linear-gradient(180deg, #2a2210, #1a1404);
    border: 1px solid #8a7420;
    border-radius: 10px;
    padding: 6px 18px;
    color: #e8d98a;
}

/* ===== МАГАЗИН v2: сетка карточек, всё в одном окне без скролла ===== */
#shopPanel {
    top: auto;
    bottom: 96px;
    right: 6px;
    width: 300px;
    max-height: none;
    height: auto;
}
#shopList {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 5px;
    padding: 6px;
    overflow: visible;
}
.shop-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 6px 3px;
    border-radius: 10px;
    border: 1px solid #2a3560;
    background: rgba(20, 28, 60, 0.5);
    cursor: pointer;
}
.shop-item .shop-item-top {
    display: flex;
    align-items: center;
    gap: 3px;
    justify-content: center;
}
.shop-item .shop-ico { font-size: 17px; line-height: 1; }
.shop-item .nm { font-size: 8.5px; color: #dfe8ff; font-weight: bold; }
.shop-item .bonus { font-size: 7.5px; color: #9fe8a0; margin-top: 1px; line-height: 1.15; }
.shop-item .cost { font-size: 9px; color: #ffd94a; font-weight: bold; margin-top: 2px; }
.shop-item .cost.poor { color: #ff8080; }
.shop-item.owned .shop-item-top::after { content: '✓'; color: #9fe8a0; font-size: 9px; margin-left: 2px; }

/* ===== МАГАЗИН v3: панель по центру экрана ===== */
#shopPanel {
    top: 50%;
    left: 50%;
    right: auto;
    bottom: auto;
    transform: translate(-50%, -50%);
}
#shopSlots .slot {
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
}


/* Герой-награда: замок на карточке */
.hero-card.locked { opacity: 0.6; filter: saturate(0.6); }
.hero-card .hero-lock {
    position: absolute;
    top: 6px;
    right: 6px;
    background: rgba(255, 217, 74, 0.15);
    border: 1px solid rgba(255, 217, 74, 0.5);
    color: #ffd94a;
    font-size: 10px;
    font-weight: bold;
    padding: 2px 6px;
    border-radius: 8px;
}

/* Описание скилла (удержание 2с) */
#skillDescModal {
    position: absolute;
    bottom: 210px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 210;
    max-width: 300px;
    background: rgba(12, 16, 36, 0.96);
    border: 1px solid #3a4a7a;
    border-radius: 12px;
    padding: 10px 14px;
    text-align: center;
    display: none;
    pointer-events: none;
}
#skillDescModal .sd-name { font-size: 14px; font-weight: bold; color: #ffd94a; margin-bottom: 4px; }
#skillDescModal .sd-text { font-size: 12px; color: #cfe0ff; line-height: 1.4; }


/* Компактные плитки (6 героев): 3 ряда занимают место двух, шапка меню на месте */
#heroSelection { gap: 8px; margin-bottom: 14px; }
.hero-card { padding: 8px 6px; border-radius: 12px; }
.hero-card .hero-icon { font-size: 26px; margin-bottom: 2px; }
.hero-card .hero-name { font-size: 12px; }
.hero-card .hero-desc { font-size: 9px; }
.hero-card .hero-color { margin: 3px auto 0; }


/* Кнопки наград: зелёные с белым шрифтом — бросаются в глаза */
.reward-btn {
    background: #27ae60;
    border: 2px solid #2ecc71;
    color: #ffffff;
    text-shadow: none;
}
.reward-btn:hover { background: #2ecc71; border-color: #27ae60; }
.reward-btn:disabled { background: #1a5c38; border-color: #1a5c38; color: #cfe0ff; opacity: 0.8; }

/* ============================================================
   OAUTH (VK ID / Яндекс ID): блок входа под кнопками меню.
   Обычный поток flex-колонки #startScreen — НИЧЕГО не перекрывает
   (урок про мёртвые зоны тапов): pointer-events:auto только у кнопок.
   ============================================================ */
#oauthBlock {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    margin-top: 14px;
    /* (этап 13: блок внутри колонки .menu-right; вертикальный центр меню
       держит пара auto-полей на .menu-body) */
    pointer-events: none; /* декоративный контейнер — кликуют только кнопки */
}
/* Логотипы VK / Яндекс / MAX — один горизонтальный ряд (вместо текстовых кнопок:
   меньше места, читаемые фирменные цвета). Логотип = SVG внутри круглой кнопки. */
#oauthRow {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 18px;
    pointer-events: auto;
}
#oauthBlock .oauth-logo {
    width: 56px;
    height: 56px;
    padding: 0;
    margin: 0;
    border: none;
    border-radius: 50%;
    background: transparent;
    line-height: 0;
    cursor: pointer;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.45);
    transition: transform 0.12s ease;
}
#oauthBlock .oauth-logo:hover:not(:disabled) { transform: translateY(-2px); }
#oauthBlock .oauth-logo:active:not(:disabled) { transform: scale(0.94); }
#oauthBlock .oauth-logo svg { width: 100%; height: 100%; display: block; border-radius: 50%; }
/* Не включённые провайдеры и MAX («скоро») — приглушены и некликабельны */
#oauthBlock .oauth-logo:disabled {
    cursor: default;
    opacity: 0.45;
    box-shadow: none;
}
/* «Вы вошли как <ник>» — некликабельная строка (pointer-events не нужны вовсе) */
#oauthLoggedIn {
    font-size: 13px;
    color: #ffd94a;
    background: linear-gradient(180deg, #2a2210, #1a1404);
    border: 1px solid #8a7420;
    border-radius: 10px;
    padding: 6px 16px;
    text-align: center;
}

/* ЭКРАН/УСТАНОВКА: компактные кнопки «ВЕСЬ ЭКРАН» и «УСТАНОВИТЬ» в правой колонке
   меню. Фуллскрин прячет панели браузера на телефоне (жалоба владельца 2026-10-17). */
#screenTools {
    display: flex;
    gap: 8px;
    justify-content: center;
    margin-top: 10px;
    pointer-events: none;
}
#screenTools .tool-btn {
    pointer-events: auto;
    background: rgba(22, 32, 58, .85);
    border: 1px solid #3a4a7a;
    color: #cdd8ff;
    font-size: 11px;
    font-weight: bold;
    padding: 7px 12px;
    border-radius: 8px;
    cursor: pointer;
    letter-spacing: .4px;
    /* Ссылка-кнопка скачивания APK: <a> по умолчанию подчёркнута и синяя */
    text-decoration: none;
    display: inline-block;
    line-height: normal;
}
#screenTools .tool-btn:hover { background: #26386a; color: #fff; }
/* Кнопка «скачать приложение» — акцентная, но в тон остальному меню */
#screenTools #apkDownloadBtn {
    border-color: #2f7fd0;
    color: #9fd4ff;
    background: rgba(20, 45, 80, .85);
}
#screenTools #apkDownloadBtn:hover { background: #1d4d80; color: #fff; }

/* ============================================================
   ЭТАП 13: ГОРИЗОНТАЛЬНОЕ МЕНЮ (решение владельца: игра ВСЕГДА
   в ландшафте, портрет не поддерживается).
   Телефон 740×360 — меню видно без скролла; десктоп 1280×720 —
   просторно. Портрету остаётся прежняя колонка (деградация без поломки).
   Схема: [верхняя панель] / [заголовок | герои 2×N | кнопки+oauth].
   ============================================================ */
@media (orientation: landscape) {
    /* Контейнер — на всё окно: и телефон в руке, и десктоп. Уже был такой
       режим для низких окон (max-height:700px) — теперь он единственный. */
    #gameContainer {
        width: 100vw;
        height: 100vh;
        max-height: 100vh;
        border-radius: 0;
    }

    #startScreen { padding: 8px 14px 10px; }

    /* --- Верхняя панель: компактнее по высоте --- */
    #startTopBar { margin: 0 0 6px; gap: 6px; }
    #leaderboardBtn { padding: 3px 10px; font-size: 11px; }
    #rankBtn { padding: 3px 10px; gap: 5px; font-size: 12px; }
    #rankBtn #rankBtnEmblem { font-size: 14px; }
    #rankBtnStats { font-size: 11px; }
    #goldBallsBar { padding: 3px 10px; font-size: 12px; }
    #ranksPanel { top: 44px; }

    /* --- Тело меню: заголовок | сетка героев | кнопки (один ряд) --- */
    .menu-body {
        width: 100%;
        display: flex;
        flex-direction: row;
        align-items: center;
        justify-content: center;
        gap: 14px;
    }
    .menu-left {
        flex: 0 1 auto;
        min-width: 0;
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 6px;
        max-width: 190px;
    }
    .menu-right {
        flex: 0 0 auto;
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 8px;
    }

    /* Заголовок — компактный, слева по центру своей колонки */
    #startScreen h1 { font-size: 19px; padding: 7px 16px; margin-bottom: 0; }
    #startScreen p { font-size: 11px; padding: 4px 12px; margin-bottom: 0; }
    #onlineCounter { margin: 0 auto; padding: 3px 12px; font-size: 12px; }

    /* Сетка героев 2×N по центру, карты компактнее */
    #heroSelection { flex: 0 1 auto; margin-bottom: 0; gap: 8px; max-width: 300px; }
    .hero-card { padding: 6px 5px; }
    .hero-card .hero-icon { font-size: 22px; margin-bottom: 2px; }
    .hero-card .hero-name { font-size: 11px; }

    /* Кнопки и oauth — компактный блок справа */
    .menu-right .btn { min-width: 176px; padding: 10px 16px; font-size: 14px; margin: 0; }
    #rewardsBtn { margin-top: 0; }
    #oauthBlock { margin-top: 4px; gap: 6px; }
    #oauthRow { gap: 10px; }
    #oauthBlock .oauth-logo { width: 38px; height: 38px; }
    #oauthLoggedIn { font-size: 11px; padding: 4px 10px; }

    /* --- Поиск соперника: компактнее, влезает в 360px по высоте --- */
    .spinner { width: 38px; height: 38px; border-width: 3px; }
    #searchScreen h2 { font-size: 19px; margin: 10px 0 6px; }
    #searchScreen p { font-size: 13px; margin-bottom: 14px; }

    /* --- Награды: шапка компактнее, список 3 колонки, скролл внутри --- */
    #rewardsPanel { padding: 10px 14px; }
    #rewardsHeader { font-size: 14px; margin-bottom: 8px; }
    #rewardsList {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        max-width: 620px;
        gap: 10px;
    }
    .reward-card { padding: 10px 8px; }
    .reward-preview { width: 42px; height: 42px; }
    .reward-desc { min-height: 0; }

    /* --- Магазин: не выше экрана, список скроллится внутри --- */
    #shopPanel { max-height: calc(100% - 20px); }
    #shopList { overflow-y: auto; min-height: 0; }
}

/* Десктоп 1280×720 и шире: тот же ландшафт, но просторно —
   крупнее карты, заголовок и кнопки, награды в 4 колонки */
@media (orientation: landscape) and (min-width: 1000px) {
    #startScreen { padding: 24px 48px; }
    #startTopBar { margin-bottom: 12px; }
    .menu-body { gap: 40px; }
    .menu-left { max-width: 260px; gap: 8px; }
    #startScreen h1 { font-size: 25px; padding: 10px 24px; }
    #startScreen p { font-size: 13px; padding: 6px 16px; }
    #heroSelection { max-width: 400px; gap: 12px; }
    .hero-card { padding: 10px 8px; }
    .hero-card .hero-icon { font-size: 28px; margin-bottom: 3px; }
    .hero-card .hero-name { font-size: 12px; }
    .menu-right { gap: 10px; }
    .menu-right .btn { min-width: 210px; padding: 13px 22px; font-size: 15px; }
    #oauthBlock .oauth-logo { width: 46px; height: 46px; }
    #rewardsList { grid-template-columns: repeat(4, minmax(0, 1fr)); max-width: 800px; }
}

/* ============================================================
   ИНТРО-РОЛИК ПЕРЕД ПОИСКОМ (03.12)
   Ролик с белым фоном показываем как «прожектор»: края растворяются
   радиальной маской в тёмном фоне, иначе белый прямоугольник режет глаз.
   ============================================================ */
#introOverlay {
    position: fixed; inset: 0; z-index: 99990; display: none;
    align-items: center; justify-content: center; overflow: hidden;
    background: radial-gradient(circle at 50% 45%, #2a1708 0%, #0a0b12 58%, #000 100%);
    cursor: pointer; user-select: none; touch-action: manipulation;
}
#introOverlay.show { display: flex; }
#introVideo {
    width: min(100vw, 150vh); height: auto; max-height: 100vh;
    object-fit: contain; pointer-events: none;
    -webkit-mask-image: radial-gradient(ellipse at center, #000 56%, transparent 82%);
    mask-image: radial-gradient(ellipse at center, #000 56%, transparent 82%);
}
#introSkip {
    position: absolute; left: 0; right: 0; bottom: 16px;
    text-align: center; font-size: 11px; letter-spacing: 1px;
    color: #e8d3b0; opacity: .55; pointer-events: none;
}
@media (max-height: 420px) {
    #introSkip { bottom: 8px; font-size: 10px; }
}

/* ============================================================
   ОКНО ПЕРВОГО ЗАПУСКА: СОГЛАСИЕ НА ОБРАБОТКУ ПД (03.12.2026)
   ============================================================ */
#legalGate {
    position: fixed; inset: 0; z-index: 99995; display: none;
    align-items: center; justify-content: center; padding: 12px;
    background: radial-gradient(circle at 50% 30%, #1a2547 0%, #070a14 70%);
    overflow-y: auto;
}
#legalGateCard {
    width: min(560px, 96vw); max-height: 96vh; overflow-y: auto;
    background: #101a36; border: 1px solid #2c3a6a; border-radius: 16px;
    padding: 20px 22px; color: #dfe8ff; box-shadow: 0 18px 50px rgba(0,0,0,.45);
}
.lg-brand { font-size: 11px; letter-spacing: 2px; color: #ffd94a; font-weight: 800; }
#legalGateCard h2 { margin: 6px 0 8px; font-size: 22px; color: #fff; }
.lg-intro { font-size: 13px; line-height: 1.5; color: #b9c6e6; margin: 0 0 10px; }
.lg-links { margin: 0 0 12px; padding-left: 18px; font-size: 13px; line-height: 1.5; }
.lg-links a, .lg-operator a { color: #7fc4ff; }
.lg-check { display: flex; gap: 9px; align-items: flex-start; margin: 10px 0; font-size: 12.5px; line-height: 1.45; color: #d7e2fa; cursor: pointer; }
.lg-check input { margin-top: 2px; width: 18px; height: 18px; flex: 0 0 auto; accent-color: #2fbf62; }
.lg-check b { color: #fff; font-weight: 700; }
.lg-operator { font-size: 11px; color: #8fa0c6; margin: 12px 0 10px; }
#lgAccept {
    width: 100%; padding: 13px 16px; border: 0; border-radius: 12px; cursor: pointer;
    background: linear-gradient(135deg, #1f7a3a, #2fbf62); color: #fff;
    font-size: 15px; font-weight: 800; letter-spacing: .4px;
}
#lgAccept:disabled { opacity: .4; cursor: default; }
#lgAccept:not(:disabled):active { transform: scale(.98); }
.lg-decline { margin-top: 8px; width: 100%; background: none; border: 0; color: #8fa0c6; font-size: 12px; cursor: pointer; text-decoration: underline; }
#lgDeclineMsg { display: none; margin-top: 10px; padding: 10px 12px; border-radius: 10px; background: rgba(255,80,80,.12); border: 1px solid rgba(255,80,80,.35); color: #ffc9c9; font-size: 12.5px; line-height: 1.45; }
@media (max-height: 460px) {
    #legalGateCard { padding: 14px 16px; }
    #legalGateCard h2 { font-size: 18px; margin: 2px 0 6px; }
    .lg-intro { font-size: 11.5px; }
    .lg-check { margin: 7px 0; font-size: 11.5px; }
    #lgAccept { padding: 10px 14px; font-size: 14px; }
    .lg-operator { margin: 8px 0 6px; }
}

@media (max-height: 430px) {
    .lg-operator { display: none; }
    #legalGateCard { padding: 10px 14px; }
    #legalGateCard h2 { font-size: 16px; margin: 0 0 4px; }
    .lg-intro { font-size: 11px; margin-bottom: 6px; line-height: 1.35; }
    .lg-links { font-size: 11px; margin-bottom: 6px; line-height: 1.35; }
    .lg-check { margin: 5px 0; font-size: 11px; line-height: 1.35; }
    #lgAccept { padding: 9px 12px; font-size: 13px; }
    .lg-decline { margin-top: 4px; font-size: 11px; }
}

.lg-age { font-size: 11.5px; line-height: 1.4; color: #8fa0c6; margin: 4px 0 8px; }
@media (max-height: 460px) { .lg-age { font-size: 10.5px; margin: 3px 0 6px; } }

/* СМЕНА НИКА (04.12.2026) */
#nickModal {
    position: fixed; inset: 0; z-index: 99990; display: none;
    align-items: center; justify-content: center; padding: 12px;
    background: rgba(4,7,16,.72);
}
#nickCard {
    width: min(420px, 96vw); background: #101a36; border: 1px solid #2c3a6a;
    border-radius: 14px; padding: 18px 20px; color: #dfe8ff;
    box-shadow: 0 18px 50px rgba(0,0,0,.45);
}
#nickCard h3 { margin: 0 0 8px; font-size: 19px; color: #fff; }
.nick-hint { font-size: 12px; line-height: 1.45; color: #9fb0d8; margin: 0 0 12px; }
#nickInput {
    width: 100%; box-sizing: border-box; padding: 11px 12px; border-radius: 10px;
    border: 1px solid #3a4a7a; background: #0a1230; color: #fff; font-size: 16px; outline: none;
}
#nickInput:focus { border-color: #2fbf62; }
#nickError { min-height: 18px; font-size: 12px; color: #ff9c9c; margin: 8px 0 2px; }
.nick-actions { display: flex; gap: 8px; margin-top: 8px; }
.nick-actions button {
    flex: 1; padding: 11px 12px; border: 0; border-radius: 10px; cursor: pointer;
    font-size: 14px; font-weight: 700;
}
#nickCancel { background: #1b2547; color: #b9c6e6; }
#nickSave { background: linear-gradient(135deg,#1f7a3a,#2fbf62); color: #fff; }
#nickSave:disabled { opacity: .5; cursor: default; }

#changeNickBtn { pointer-events: auto; position: relative; z-index: 2; }

#accountLine { font-size: 12px; color: #8fa0c6; margin-top: 6px; display: flex; align-items: center; justify-content: center; gap: 8px; flex-wrap: wrap; }
#accountLine b { color: #ffd94a; }
#accountAuth { color: #9fe8ff; }

#logoutBtn {
    display: none;
    pointer-events: auto;
    position: relative;
    z-index: 2;
    padding: 3px 10px;
    border-radius: 10px;
    border: 1px solid rgba(255, 120, 120, .45);
    background: rgba(120, 30, 40, .35);
    color: #ffb3b3;
    font-size: 11px;
    font-weight: 700;
    cursor: pointer;
}
#logoutBtn:hover { background: rgba(160, 40, 55, .55); color: #fff; }
