@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;600;700;800;900&display=swap');

/* Гамма Чащи: полированное золото ринга, мох и кора.
   Структура файла повторяет archimed-match3: сначала токены, потом кадр 960x540,
   потом сцены. Главное отличие рескина -- НИ ОДНОЙ полупрозрачной панели:
   все плашки, карточки, кнопки и HUD залиты сплошным цветом, иначе на подвижной
   3D-сцене под ними текст плывёт и не читается. */
:root {
    --gold: #ffd75e;
    --gold-light: #fff2c0;
    --gold-deep: #e0a92f;
    --gold-dark: #7a4f1d;

    /* Зелень -- второстепенное действие и панели. */
    --green-light: #a8d86a;
    --green: #5f9a3a;
    --green-deep: #3a6a22;
    --green-dark: #1e3b12;

    /* Красное -- опасность, урон, отмена. */
    --red-light: #ff9b7a;
    --red: #e0603f;
    --red-deep: #a8331c;

    --blue: #7ec8ff;
    --blue-deep: #2e7cc4;

    /* Сплошные заливки панелей. Никаких rgba -- см. шапку файла. */
    --panel: #1b2f12;
    --panel-2: #24401a;
    --panel-3: #2d4d20;
    --bark: #2e2013;
    --ink: #0d1a07;

    --text: #f6f0dc;
    --text-dim: #b9c9a2;

    /* Рамки всегда с альфой 1: полупрозрачная рамка читается как «недоступно». */
    --btn-border: #c8a24a;
    --btn-border-bright: #ffe9a8;

    /* Единая обводка заголовков -- та же, что в archimed-match3. */
    --title-outline: drop-shadow(0 0 18px rgba(255, 215, 94, .55)) drop-shadow(2px 3px 0 rgba(0, 0, 0, .92));
}

*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

html,
body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    background: #06120a;
    font-family: 'Inter', sans-serif;
    color: var(--text);
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
    touch-action: none;
    overscroll-behavior: none;
}

/* ═══════════════ ЭКРАН ЗАГРУЗКИ ═══════════════ */
#loading-screen {
    position: fixed;
    inset: 0;
    z-index: 999999;
    background: #0d1f0a;
    display: flex;
    align-items: center;
    justify-content: center;
}

.loading-spinner {
    width: 60px;
    height: 60px;
    border: 4px solid rgba(255, 255, 255, .2);
    border-top-color: var(--gold);
    border-radius: 50%;
    animation: spin .8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ═══════════════ КАДР 16:9 ═══════════════ */
#game-wrapper {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

#game-board {
    position: absolute;
    width: 960px;
    height: 540px;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    transform-origin: center center;
    background: #0d1f0a;
    box-shadow: 0 0 60px rgba(0, 0, 0, .85);
    overflow: hidden;
}

#game-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: block;
}

.scene {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.hidden {
    display: none !important;
}

/* ═══════════════ КНОПКИ ═══════════════ */
.btn {
    min-width: 300px;
    padding: 15px 32px;
    border-radius: 12px;
    font-family: 'Inter', sans-serif;
    font-size: 22px;
    font-weight: 800;
    letter-spacing: 1px;
    border: 3px solid var(--btn-border);
    color: var(--text);
    cursor: pointer;
    margin: 7px;
    transition: transform .12s ease, filter .12s ease, box-shadow .12s ease;
}

.btn-primary {
    background: linear-gradient(180deg, var(--gold) 0%, var(--gold-deep) 100%);
    border-color: var(--btn-border-bright);
    color: #34210a;
    /* Тень под текстом обязательна: тёмный по золоту иначе размывается. */
    text-shadow: 0 1px 0 rgba(255, 245, 200, .55);
    box-shadow: 0 0 22px rgba(255, 215, 94, .3), inset 0 2px 0 rgba(255, 255, 255, .45);
}

.btn-primary:hover {
    background: linear-gradient(180deg, var(--gold-light) 0%, var(--gold) 100%);
    box-shadow: 0 0 34px rgba(255, 215, 94, .55);
    transform: scale(1.04);
}

.btn-secondary {
    background: linear-gradient(180deg, var(--green) 0%, var(--green-dark) 100%);
    text-shadow: 0 2px 3px rgba(8, 20, 6, .85);
    box-shadow: inset 0 2px 0 rgba(255, 255, 255, .18);
}

.btn-secondary:hover {
    background: linear-gradient(180deg, var(--green-light) 0%, var(--green-deep) 100%);
    box-shadow: 0 0 24px rgba(95, 154, 58, .55);
    transform: scale(1.03);
}

.btn-danger {
    background: linear-gradient(180deg, var(--red) 0%, var(--red-deep) 100%);
    text-shadow: 0 2px 3px rgba(60, 12, 4, .8);
    box-shadow: inset 0 2px 0 rgba(255, 255, 255, .2);
}

.btn-danger:hover {
    background: linear-gradient(180deg, var(--red-light) 0%, #8f2a15 100%);
    transform: scale(1.03);
}

.btn:active {
    transform: scale(.97) !important;
}

.btn:disabled {
    filter: grayscale(1) brightness(.62);
    cursor: default;
    transform: none !important;
    box-shadow: none;
}

.btn-sm {
    min-width: 170px;
    padding: 10px 20px;
    font-size: 17px;
    border-width: 2px;
    border-radius: 10px;
}

.btn-xs {
    min-width: 0;
    padding: 8px 16px;
    font-size: 15px;
    border-width: 2px;
    border-radius: 9px;
    margin: 0;
}

/* Кнопка «назад» -- та же геометрия, что в archimed. */
.btn-back {
    position: absolute;
    top: 12px;
    left: 12px;
    width: 46px;
    height: 46px;
    padding: 8px;
    border: 3px solid var(--btn-border);
    border-radius: 12px;
    background: linear-gradient(180deg, var(--green) 0%, var(--green-dark) 100%);
    cursor: pointer;
    z-index: 40;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform .18s, background .18s;
}

.btn-back svg {
    width: 26px;
    height: 26px;
    color: #eaf7d8;
}

.btn-back:hover {
    background: linear-gradient(180deg, var(--green-light) 0%, var(--green-deep) 100%);
    transform: scale(1.08);
}

.btn-back:active {
    transform: scale(.95) !important;
}

/* ═══════════════ ЗАГОЛОВКИ ═══════════════ */
.menu-title {
    font-size: 60px;
    font-weight: 900;
    letter-spacing: 3px;
    text-align: center;
    line-height: 1.02;
    background: linear-gradient(180deg, #fff3bc 0%, #ffd75e 45%, #a8721c 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    filter: var(--title-outline);
    margin-bottom: 6px;
}

.menu-subtitle {
    font-size: 20px;
    font-weight: 800;
    letter-spacing: 3px;
    text-align: center;
    margin-bottom: 22px;
    color: #d8e9bc;
    filter: drop-shadow(2px 3px 0 rgba(0, 0, 0, .92));
}

.scene-header {
    font-size: 30px;
    font-weight: 900;
    letter-spacing: 2px;
    text-align: center;
    background: linear-gradient(180deg, #fff3bc 0%, #ffd75e 50%, #a8721c 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    filter: var(--title-outline);
    padding: 10px 0 8px;
}

/* ═══════════════ ОБЩИЕ ПАНЕЛИ ═══════════════ */
.panel {
    background: var(--panel);
    border: 3px solid var(--btn-border);
    border-radius: 18px;
    padding: 14px 22px 18px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, .75), inset 0 2px 0 rgba(255, 255, 255, .07);
}

/* ═══════════════ ГЛАВНОЕ МЕНЮ ═══════════════ */
#scene-menu {
    justify-content: center;
    padding-top: 6px;
}

#scene-menu.has-bg {
    background: url('../assets/bg/menu_bg.webp') center/cover no-repeat;
}

.menu-plate {
    display: flex;
    flex-direction: column;
    align-items: center;
    background: var(--ink);
    border: 3px solid var(--btn-border);
    border-radius: 22px;
    padding: 18px 46px 24px;
    box-shadow: 0 12px 48px rgba(0, 0, 0, .8);
}

/* Верхняя строка: жёлуди слева, звук справа -- одинаково на всех экранах. */
.top-bar {
    position: absolute;
    top: 12px;
    right: 12px;
    display: flex;
    gap: 10px;
    align-items: center;
    z-index: 40;
}

.coins-badge {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--bark);
    border: 3px solid var(--btn-border);
    border-radius: 24px;
    padding: 7px 18px;
    color: var(--gold);
    font-size: 22px;
    font-weight: 900;
    text-shadow: 0 2px 3px rgba(0, 0, 0, .9);
}

.coins-badge .cur-icon {
    width: 26px;
    height: 26px;
}

.icon-btn {
    width: 46px;
    height: 46px;
    border: 3px solid var(--btn-border);
    border-radius: 12px;
    background: linear-gradient(180deg, var(--green) 0%, var(--green-dark) 100%);
    color: #eaf7d8;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform .15s, background .15s;
}

.icon-btn svg {
    width: 24px;
    height: 24px;
}

.icon-btn:hover {
    background: linear-gradient(180deg, var(--green-light) 0%, var(--green-deep) 100%);
    transform: scale(1.07);
}

/* ═══════════════ ВЫБОР БОЙЦА ═══════════════ */
#scene-roster,
#scene-campaign,
#scene-gym,
#scene-shop {
    background: var(--ink);
    justify-content: flex-start;
    padding-top: 4px;
}

/* Класс вешает game.js, когда assets/bg/menu_bg.webp реально загрузился.
   Плотная заливка поверх картинки — тот же приём, что в archimed-match3:
   фон остаётся фоном и не спорит с карточками за внимание.

   Селекторы перечислены по id намеренно: правило выше задаёт этим же экранам
   background шорткатом, а он сбрасывает background-image в none. У .scene.has-bg
   специфичность ниже, чем у #scene-*, и картинка не появлялась вовсе. */
#scene-roster.has-bg,
#scene-campaign.has-bg,
#scene-gym.has-bg,
#scene-shop.has-bg {
    background-image: linear-gradient(rgba(9, 20, 6, .78), rgba(9, 20, 6, .78)),
        url('../assets/bg/menu_bg.webp');
    background-size: cover;
    background-position: center;
}

#roster-grid {
    margin-top: 5px;
    display: grid;
    grid-template-columns: repeat(4, 214px);
    grid-auto-rows: 228px;
    gap: 12px;
    justify-content: center;
}

.fighter-card {
    position: relative;
    background: var(--panel);
    border: 3px solid var(--green-deep);
    border-radius: 14px;
    padding: 8px 12px 10px;
    text-align: center;
    cursor: pointer;
    transition: transform .12s, border-color .12s;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.fighter-card:hover {
    transform: scale(1.04);
    border-color: var(--gold);
}

.fighter-card.selected {
    border-color: var(--gold);
    background: var(--panel-2);
    box-shadow: 0 0 20px rgba(255, 215, 94, .55);
}

.fighter-card.locked {
    filter: grayscale(.92) brightness(.55);
    cursor: default;
}

.fighter-card.locked:hover {
    transform: none;
    border-color: var(--green-deep);
}

/* ── Премиум-карточка: единственный боец из магазина ──────────────────────
   Заперта, но НЕ обесцвечена: серый фильтр запертых карточек с неё намеренно
   снят — иначе товар невозможно разглядеть, а карточка должна продавать.
   Характеристики показываем тоже: покупатель должен видеть, за что платит. */
.fighter-card.premium {
    border-color: var(--gold);
    background: var(--bark);
    padding-bottom: 32px;
    animation: premiumGlow 2.2s ease-in-out infinite;
}

.fighter-card.premium.selected {
    background: var(--panel-2);
}

.fighter-card.premium.locked {
    filter: none;
    cursor: pointer;
}

.fighter-card.premium.locked:hover {
    transform: scale(1.04);
    border-color: var(--gold-light);
}

/* Внутренности ужаты ровно на высоту ленты: иначе строка размаха уезжает
   под неё, а обрезанный текст выглядит как брак вёрстки.
   Под имя всегда зарезервированы ДВЕ строки: по-русски «Росомаха Гром»
   влезает в одну, по-английски «Thunder the Wolverine» переносится, и без
   резерва карточка ломалась бы только в одной локали. */
.fighter-card.premium .portrait {
    width: 54px;
    height: 54px;
    font-size: 42px;
    line-height: 54px;
}

.fighter-card.premium .fname {
    margin: 1px 0 2px;
    font-size: 15px;
    line-height: 1;
    min-height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.fighter-card.premium .stat-row {
    margin: 1px 0;
}

@keyframes premiumGlow {
    0%, 100% {
        box-shadow: 0 0 14px rgba(255, 215, 94, .45), inset 0 0 18px rgba(255, 215, 94, .10);
    }
    50% {
        box-shadow: 0 0 30px rgba(255, 215, 94, .85), inset 0 0 26px rgba(255, 215, 94, .22);
    }
}

/* Угловой значок — карточка должна читаться как особая боковым зрением. */
.premium-badge {
    position: absolute;
    top: 0;
    right: 0;
    padding: 3px 9px 4px;
    border-bottom-left-radius: 10px;
    background: linear-gradient(180deg, var(--gold-light) 0%, var(--gold-deep) 100%);
    color: #34210a;
    font-size: 11px;
    font-weight: 900;
    letter-spacing: .5px;
    text-shadow: 0 1px 0 rgba(255, 245, 200, .6);
}

/* Золотая лента снизу вместо серой надписи «закрыто». */
.premium-cta {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    padding: 6px 4px 7px;
    background: linear-gradient(180deg, var(--gold) 0%, var(--gold-deep) 100%);
    border-top: 2px solid var(--btn-border-bright);
    color: #34210a;
    font-size: 14px;
    font-weight: 900;
    letter-spacing: .3px;
    text-shadow: 0 1px 0 rgba(255, 245, 200, .55);
}

.fighter-card .portrait {
    width: 66px;
    height: 66px;
    margin: 0 auto;
    font-size: 52px;
    line-height: 66px;
    object-fit: contain;
}

.fighter-card .fname {
    color: var(--gold);
    font-weight: 900;
    font-size: 17px;
    letter-spacing: .4px;
    margin: 2px 0 5px;
    text-shadow: 0 2px 3px rgba(0, 0, 0, .9);
    line-height: 1.05;
}

.fighter-card .lock-info {
    color: var(--red-light);
    font-size: 15px;
    font-weight: 800;
    margin-top: 26px;
    text-shadow: 0 2px 3px rgba(0, 0, 0, .9);
}

.stat-row {
    display: flex;
    align-items: center;
    gap: 6px;
    margin: 2px 0;
}

.stat-row .stat-ico {
    width: 16px;
    height: 16px;
    flex: 0 0 16px;
    font-size: 13px;
    line-height: 16px;
}

.statbar {
    flex: 1;
    height: 10px;
    background: var(--ink);
    border: 1px solid var(--green-deep);
    border-radius: 5px;
    overflow: hidden;
}

.statbar>div {
    height: 100%;
}

.reach-line {
    color: var(--text-dim);
    font-size: 13px;
    font-weight: 700;
    margin-top: 4px;
}

/* ═══════════════ КАМПАНИЯ ═══════════════ */
#level-grid {
    margin-top: 25px;
    display: grid;
    grid-template-columns: repeat(5, 172px);
    grid-auto-rows: 94px;
    gap: 9px;
    justify-content: center;
}

.level-card {
    position: relative;
    background: var(--panel);
    border: 3px solid var(--green-deep);
    border-radius: 12px;
    padding: 4px 6px;
    text-align: center;
    cursor: pointer;
    transition: transform .12s, border-color .12s;
    display: flex;
    align-items: center;
    gap: 8px;
    overflow: hidden;
}

.level-card:hover {
    transform: scale(1.05);
    border-color: var(--gold);
}

.level-card.locked {
    filter: grayscale(.92) brightness(.5);
    cursor: default;
}

.level-card.locked:hover {
    transform: none;
    border-color: var(--green-deep);
}

.level-card.done {
    border-color: var(--green-light);
}

.level-card.belt {
    border-color: var(--gold);
    background: var(--bark);
}

.level-card .portrait {
    width: 54px;
    height: 54px;
    flex: 0 0 54px;
    font-size: 42px;
    line-height: 54px;
    object-fit: contain;
}

.level-card .lvl-body {
    flex: 1;
    min-width: 0;
    text-align: left;
}

.belt-ico {
    width: 15px;
    height: 15px;
    font-size: 13px;
    line-height: 15px;
    vertical-align: -2px;
    object-fit: contain;
}

.belt-ico-big {
    width: 26px;
    height: 26px;
    font-size: 22px;
    line-height: 26px;
    vertical-align: -5px;
    object-fit: contain;
}

.level-card .lvl-num {
    color: var(--gold);
    font-weight: 900;
    font-size: 14px;
    letter-spacing: .5px;
    text-shadow: 0 2px 3px rgba(0, 0, 0, .9);
}

.level-card .opp-name {
    color: #fff;
    font-size: 14px;
    font-weight: 800;
    line-height: 1.08;
    text-shadow: 0 2px 3px rgba(0, 0, 0, .95);
    overflow: hidden;
}

.level-card .lvl-foot {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 2px;
}

.level-card .stars {
    font-size: 13px;
    color: var(--gold);
    letter-spacing: -1px;
}

.level-card .stars .empty {
    color: #33501f;
}

.level-card .reward {
    color: var(--gold-deep);
    font-size: 13px;
    font-weight: 800;
    display: flex;
    align-items: center;
    gap: 3px;
}

.level-card .reward .cur-icon {
    width: 14px;
    height: 14px;
}

/* ═══════════════ ЗАЛ ═══════════════ */
.gym-hint {
    color: var(--text-dim);
    font-size: 16px;
    font-weight: 700;
    text-align: center;
    margin-bottom: 12px;
    text-shadow: 0 2px 3px rgba(0, 0, 0, .9);
}

.gym-row {
    display: flex;
    align-items: center;
    gap: 16px;
    background: var(--panel);
    border: 2px solid var(--green-deep);
    border-radius: 12px;
    padding: 8px 14px;
    margin: 8px 0;
}

.gym-row .gname {
    width: 250px;
    color: var(--gold);
    font-size: 20px;
    font-weight: 900;
    text-shadow: 0 2px 3px rgba(0, 0, 0, .9);
    display: flex;
    align-items: center;
    gap: 8px;
}

.gym-row .gname .stat-ico {
    width: 24px;
    height: 24px;
    flex: 0 0 24px;
    font-size: 20px;
    line-height: 24px;
}

.gym-row .gdesc {
    font-size: 14px;
    color: var(--text-dim);
    font-weight: 700;
    display: block;
}

.pips {
    display: flex;
    gap: 6px;
    flex: 1;
}

.pip {
    width: 26px;
    height: 26px;
    border-radius: 6px;
    background: var(--ink);
    border: 2px solid var(--green-deep);
}

.pip.on {
    background: linear-gradient(180deg, var(--gold) 0%, var(--gold-deep) 100%);
    border-color: var(--btn-border-bright);
}

.gym-row .btn {
    min-width: 150px;
    margin: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.gym-row .btn .cur-icon {
    width: 20px;
    height: 20px;
}

/* ═══════════════ МАГАЗИН ═══════════════ */
#shop-status {
    color: var(--text-dim);
    font-size: 17px;
    font-weight: 800;
    text-align: center;
    padding: 10px 0;
    text-shadow: 0 2px 3px rgba(0, 0, 0, .9);
}

/* Витрина — вертикальный список во всю ширину: описания товаров приходят из
   консоли Яндекса и бывают длинными, в узкую колонку они не помещались и
   обрезались. Строка тянется по содержимому, а список при переполнении
   прокручивается — так текст не может быть срезан ни при какой длине. */
#shop-grid {
    margin-top: 25px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 912px;
    max-height: 470px;
    overflow-y: auto;
    padding-right: 6px;
}

.shop-card {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 0 0 auto;
    background: var(--panel);
    border: 3px solid var(--green-deep);
    border-radius: 14px;
    padding: 7px 12px;
    text-align: left;
}

.shop-card.owned {
    border-color: var(--gold);
    background: var(--panel-2);
}

.shop-card .shop-img {
    width: 62px;
    height: 62px;
    flex: 0 0 62px;
    border-radius: 10px;
    object-fit: cover;
    background: var(--bark);
    border: 2px solid var(--gold-dark);
}

/* Пустой слот вместо картинки: у товара в консоли её может не быть,
   а без слота строки разъезжаются по левому краю. */
.shop-card .shop-img-empty {
    width: 62px;
    height: 62px;
    flex: 0 0 62px;
    border-radius: 10px;
    background: var(--bark);
    border: 2px dashed var(--gold-dark);
}

.shop-card .shop-body {
    flex: 1;
    min-width: 0;
}

.shop-card .shop-title {
    color: var(--gold);
    font-size: 17px;
    font-weight: 900;
    line-height: 1.12;
    margin-bottom: 2px;
    text-shadow: 0 2px 3px rgba(0, 0, 0, .9);
}

.shop-card .shop-desc {
    color: var(--text-dim);
    font-size: 13px;
    font-weight: 700;
    line-height: 1.2;
}

.shop-card .btn {
    flex: 0 0 144px;
    min-width: 0;
    margin: 0;
    padding: 9px 8px;
    font-size: 16px;
}

/* ═══════════════ HUD БОЯ ═══════════════ */
#hud {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 20;
}

#hud>* {
    pointer-events: auto;
}

.hp-wrap {
    position: absolute;
    top: 10px;
    width: 356px;
    background: var(--ink);
    border: 3px solid var(--btn-border);
    border-radius: 12px;
    padding: 6px 10px 7px;
}

.hp-wrap.left { left: 10px; }
.hp-wrap.right { right: 10px; }

.hp-name {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #fff;
    font-weight: 900;
    font-size: 18px;
    letter-spacing: .5px;
    text-shadow: 0 2px 3px rgba(0, 0, 0, .95);
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
}

.hp-wrap.right .hp-name {
    flex-direction: row-reverse;
}

.hp-name .portrait {
    width: 26px;
    height: 26px;
    flex: 0 0 26px;
    font-size: 22px;
    line-height: 26px;
    object-fit: contain;
}

.hpbar {
    height: 24px;
    background: #1b1109;
    border: 2px solid #e8e2d4;
    border-radius: 7px;
    overflow: hidden;
}

.hpbar>div {
    height: 100%;
    transition: width .15s;
}

.hp-wrap.right .hpbar>div {
    margin-left: auto;
}

.stbar {
    height: 11px;
    background: #1b1109;
    border: 2px solid #8fa2b8;
    border-radius: 6px;
    overflow: hidden;
    margin-top: 4px;
}

.stbar>div {
    height: 100%;
    background: linear-gradient(180deg, var(--blue) 0%, var(--blue-deep) 100%);
    transition: width .1s;
}

.hp-wrap.right .stbar>div {
    margin-left: auto;
}

#round-info {
    position: absolute;
    top: 10px;
    left: 50%;
    transform: translateX(-50%);
    text-align: center;
    background: var(--ink);
    border: 3px solid var(--btn-border);
    border-radius: 12px;
    padding: 4px 18px 6px;
    min-width: 132px;
}

#round-num {
    color: var(--gold);
    font-size: 15px;
    font-weight: 900;
    letter-spacing: 1px;
    text-shadow: 0 2px 3px rgba(0, 0, 0, .9);
}

#round-timer {
    color: #fff;
    font-size: 36px;
    font-weight: 900;
    line-height: 1;
    text-shadow: 0 3px 0 rgba(0, 0, 0, .9);
}

#round-timer.low {
    color: var(--red-light);
}

#announce {
    position: absolute;
    top: 33%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 74px;
    font-weight: 900;
    letter-spacing: 4px;
    text-align: center;
    white-space: nowrap;
    opacity: 0;
    transition: opacity .15s;
    background: linear-gradient(180deg, #fff3bc 0%, #ffd75e 45%, #a8721c 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    filter: drop-shadow(0 0 22px rgba(255, 215, 94, .6)) drop-shadow(3px 4px 0 rgba(0, 0, 0, .95));
}

#combo-ind {
    position: absolute;
    top: 50%;
    left: 8%;
    font-size: 34px;
    font-weight: 900;
    color: #ff9b3d;
    text-shadow: 0 3px 0 rgba(0, 0, 0, .95);
    opacity: 0;
    transition: opacity .2s;
}

#controls-hint {
    position: absolute;
    bottom: 8px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--ink);
    border: 2px solid var(--gold-dark);
    border-radius: 10px;
    padding: 5px 14px;
    color: #cfe0b4;
    font-size: 14px;
    font-weight: 700;
    white-space: nowrap;
}

#getup-wrap {
    position: absolute;
    top: 58%;
    left: 50%;
    transform: translateX(-50%);
    display: none;
    text-align: center;
}

#getup-wrap .lbl {
    color: #fff;
    background: var(--red-deep);
    border: 3px solid var(--btn-border-bright);
    border-radius: 12px;
    padding: 6px 20px;
    font-size: 26px;
    font-weight: 900;
    text-shadow: 0 2px 3px rgba(0, 0, 0, .9);
    margin-bottom: 10px;
    animation: blink .5s infinite alternate;
}

@keyframes blink {
    from { opacity: 1; }
    to { opacity: .55; }
}

#getup-bar {
    width: 340px;
    height: 30px;
    background: var(--ink);
    border: 3px solid #fff;
    border-radius: 10px;
    overflow: hidden;
    margin: 0 auto;
}

#getup-bar>div {
    height: 100%;
    width: 0%;
    background: linear-gradient(180deg, var(--gold-light) 0%, var(--gold-deep) 100%);
}

/* Всплывающие цифры урона */
#fx-layer {
    position: absolute;
    inset: 0;
    z-index: 25;
    pointer-events: none;
    overflow: hidden;
}

.floater {
    position: absolute;
    font-weight: 900;
    font-size: 32px;
    text-shadow: 0 3px 0 rgba(0, 0, 0, .95);
    animation: floatUp .8s ease-out forwards;
}

@keyframes floatUp {
    from { transform: translate(-50%, 0); opacity: 1; }
    to { transform: translate(-50%, -70px); opacity: 0; }
}

/* ═══════════════ СЕНСОРНОЕ УПРАВЛЕНИЕ ═══════════════ */
#touch-ui {
    position: absolute;
    inset: 0;
    display: none;
    z-index: 22;
    pointer-events: none;
}

#touch-ui.on {
    display: block;
}

#touch-pad {
    position: absolute;
    left: 18px;
    bottom: 16px;
    width: 168px;
    height: 168px;
    border-radius: 50%;
    background: var(--ink);
    border: 3px solid var(--btn-border);
    pointer-events: auto;
}

#touch-stick {
    position: absolute;
    left: 50%;
    top: 50%;
    width: 68px;
    height: 68px;
    margin: -34px 0 0 -34px;
    border-radius: 50%;
    background: linear-gradient(180deg, var(--green-light) 0%, var(--green-deep) 100%);
    border: 3px solid var(--btn-border-bright);
    pointer-events: none;
}

#touch-actions {
    position: absolute;
    right: 16px;
    bottom: 14px;
    width: 220px;
    height: 200px;
    pointer-events: none;
}

/* На сенсоре подсказки нет вовсе: управление и так на экране кнопками,
   а строка только отъедает место и накладывается на кулаки. */
#hud.touch-mode #controls-hint {
    display: none;
}

.tbtn {
    position: absolute;
    border-radius: 50%;
    border: 3px solid var(--btn-border-bright);
    color: #34210a;
    font-size: 30px;
    font-weight: 900;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: auto;
    text-shadow: 0 1px 0 rgba(255, 245, 200, .5);
}

.tbtn:active {
    filter: brightness(1.2);
    transform: scale(.94);
}

.tbtn-jab {
    width: 74px; height: 74px;
    right: 128px; bottom: 78px;
    background: linear-gradient(180deg, #ffe89a 0%, #e0a92f 100%);
}

.tbtn-hook {
    width: 84px; height: 84px;
    right: 46px; bottom: 104px;
    background: linear-gradient(180deg, #ffc46a 0%, #d8802a 100%);
}

.tbtn-upper {
    width: 84px; height: 84px;
    right: 4px; bottom: 8px;
    background: linear-gradient(180deg, #ff9b7a 0%, #a8331c 100%);
    color: #fff;
    text-shadow: 0 2px 3px rgba(0, 0, 0, .7);
}

.tbtn-block {
    width: 74px; height: 74px;
    right: 138px; bottom: 0px;
    background: linear-gradient(180deg, #a8d8ff 0%, #2e7cc4 100%);
    color: #08203a;
}

#touch-pause {
    position: absolute;
    top: 108px;
    right: 12px;
    width: 46px;
    height: 46px;
    border-radius: 12px;
    border: 3px solid var(--btn-border);
    background: linear-gradient(180deg, var(--green) 0%, var(--green-dark) 100%);
    color: #eaf7d8;
    font-size: 18px;
    font-weight: 900;
    pointer-events: auto;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ═══════════════ МОДАЛКИ ═══════════════ */
.modal {
    position: absolute;
    inset: 0;
    z-index: 60;
    display: none;
    align-items: center;
    justify-content: center;
    background: rgba(6, 14, 4, .82);
}

.modal.active {
    display: flex;
}

.result-title {
    font-size: 50px;
    font-weight: 900;
    letter-spacing: 3px;
    text-align: center;
    margin-bottom: 8px;
    filter: var(--title-outline);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Только background-IMAGE: шорткат background сбросил бы background-clip:text
   из базового правила, и заголовок превратился бы в цветную плашку. */
.result-title.win {
    background-image: linear-gradient(180deg, #e6ffbc 0%, #8fe36a 48%, #2c6a18 100%);
}

.result-title.lose {
    background-image: linear-gradient(180deg, #ffd0c0 0%, #ff7b6a 48%, #7a1a0c 100%);
    filter: drop-shadow(0 0 18px rgba(255, 107, 94, .5)) drop-shadow(2px 3px 0 rgba(0, 0, 0, .92));
}

.result-line {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    color: var(--text);
    font-size: 20px;
    font-weight: 800;
    text-align: center;
    margin: 5px 0;
    text-shadow: 0 2px 3px rgba(0, 0, 0, .9);
}

.result-line b {
    color: var(--gold);
}

.result-line .cur-icon,
.result-line .portrait {
    width: 24px;
    height: 24px;
    font-size: 20px;
    line-height: 24px;
    object-fit: contain;
}

.unlock-banner {
    margin: 9px auto;
    padding: 8px 18px;
    background: var(--bark);
    border: 3px dashed var(--gold);
    border-radius: 12px;
    color: var(--gold);
    font-size: 19px;
    font-weight: 900;
    text-align: center;
    text-shadow: 0 2px 3px rgba(0, 0, 0, .9);
}

.modal-buttons {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-top: 14px;
    flex-wrap: wrap;
}

.modal-buttons .btn {
    min-width: 190px;
    margin: 0;
}

/* Кнопки паузы — строго в колонку: inline-block растягивал панель на весь кадр. */
#modal-pause .panel {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 400px;
}

.pause-title {
    font-size: 42px;
    font-weight: 900;
    letter-spacing: 3px;
    text-align: center;
    margin-bottom: 14px;
    background: linear-gradient(180deg, #fff3bc 0%, #ffd75e 50%, #a8721c 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    filter: var(--title-outline);
}

/* Кнопка «за рекламу» -- визуально отделена от обычных.
   Внутри иконка киноплёнки и подпись, поэтому flex. */
.btn-ad {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    background: linear-gradient(180deg, #a8d8ff 0%, #1d5c96 100%);
    border-color: var(--btn-border-bright);
    color: #fff;
    text-shadow: 0 2px 3px rgba(4, 24, 44, .8);
}

.btn-ad:hover {
    background: linear-gradient(180deg, #c9e8ff 0%, #2e7cc4 100%);
    transform: scale(1.03);
}

.ad-icon {
    width: 21px;
    height: 21px;
    flex: 0 0 21px;
}

/* Скроллбар в панелях со списками */
::-webkit-scrollbar { width: 10px; }
::-webkit-scrollbar-track { background: var(--ink); }
::-webkit-scrollbar-thumb { background: var(--green); border-radius: 5px; }
