/* --- ГЛОБАЛЬНЫЕ ПЕРЕМЕННЫЕ (ALTUSHKA COLORS) --- */
:root {
    --bg-deep: #0a0a0f;
    --bg-card: #12121a;
    --accent-pink: #ff00cc;
    --accent-purple: #9d00ff;
    --neon-blue: #c04dff;
    --text-main: #ffffff;
    --text-dim: #8a8a9e;
    --gold: #ffcc00;
    --danger: #ff3b30;
    --success: #00ff88;
    --glass: rgba(255, 255, 255, 0.03);
    --glass-border: rgba(255, 255, 255, 0.08);
    --safe-bottom: env(safe-area-inset-bottom, 0px);
    --safe-top: env(safe-area-inset-top, 0px);
}

.case-bonus-note {
    position: absolute;
    left: 88px;
    bottom: 10px;
    font-size: 9px;
    font-style: normal;
    font-weight: 900;
    letter-spacing: .45px;
    color: #ffe9b0;
    opacity: .9;
    text-shadow: 0 0 10px rgba(255,184,86,.45);
}

.prizes-modal-card {
    max-height: 78vh;
    overflow: auto;
}

.prizes-grid {
    margin: 10px 0 14px;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}

.prize-item {
    border: 1px solid var(--glass-border);
    border-radius: 14px;
    background: rgba(255,255,255,.04);
    padding: 8px;
    text-align: center;
}

.prize-item img {
    width: 50px;
    height: 50px;
    object-fit: contain;
}

.prize-item span {
    display: block;
    margin-top: 4px;
    font-size: 11px;
    font-weight: 800;
    color: var(--gold);
}

.case-win-overlay {
    background: radial-gradient(circle at top, #2d0a4a, #120817 62%, #09090d 100%);
}

.case-win-card {
    width: min(88vw, 420px);
    text-align: center;
}

.case-win-card h2 {
    font-size: 46px;
    font-weight: 900;
    color: #fff;
    text-shadow: 0 14px 44px rgba(0,0,0,.25);
}

#case-win-image {
    width: 140px;
    height: 140px;
    margin-top: 8px;
    object-fit: contain;
}

.case-win-sum {
    margin-top: 8px;
    font-size: 32px;
    color: #ff7de6;
    font-weight: 900;
}

.case-win-card .btn-main {
    margin-top: 20px;
    background: linear-gradient(45deg, var(--accent-purple), var(--accent-pink));
    color: #fff;
    border: 1px solid rgba(255,255,255,.12);
}

.case-win-actions {
    margin-top: 14px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.case-win-actions .btn-main {
    margin-top: 0;
}

/* --- СБРОС И БАЗА --- */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Montserrat', sans-serif;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
}

body {
    background-color: var(--bg-deep);
    color: var(--text-main);
    overflow: hidden; /* Скролл только внутри контента */
    height: 100vh;
    min-height: 100dvh;
    width: 100vw;
    position: relative;
}

body::before {
    content: "";
    position: fixed;
    inset: -20%;
    background: radial-gradient(circle at 20% 10%, rgba(255,0,204,.22), transparent 35%), radial-gradient(circle at 80% 20%, rgba(0,212,255,.16), transparent 40%), radial-gradient(circle at 50% 90%, rgba(157,0,255,.22), transparent 38%);
    animation: bgShift 14s ease-in-out infinite;
    z-index: -1;
}

.loader {
    position: fixed;
    inset: 0;
    z-index: 6000;
    background: #07070d;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    transition: opacity .35s ease;
}

.loader-bg {
    position: absolute;
    inset: 0;
    background: url('assets/newic/fon/fon1.png') center/cover no-repeat;
    transform: scale(1.04);
    filter: saturate(1.08) contrast(1.05);
}

.loader-overlay {
    position: absolute;
    inset: 0;
    background:
        radial-gradient(circle at 22% 14%, rgba(255,0,204,.24), transparent 38%),
        radial-gradient(circle at 78% 24%, rgba(0,212,255,.2), transparent 42%),
        linear-gradient(to bottom, rgba(5, 6, 15, .25), rgba(5, 6, 15, .74));
    backdrop-filter: blur(1.5px);
}

.loader-card {
    position: relative;
    z-index: 2;
    width: min(88vw, 390px);
    padding: 20px 18px 16px;
    border-radius: 24px;
    border: 1px solid rgba(255,255,255,.2);
    background: linear-gradient(165deg, rgba(10,13,28,.8), rgba(10,13,28,.56));
    box-shadow: 0 18px 40px rgba(0,0,0,.42), 0 0 30px rgba(157,0,255,.24);
    text-align: center;
}

.loader-kicker {
    font-size: 11px;
    font-weight: 900;
    letter-spacing: .9px;
    color: #ffd9fa;
    opacity: .95;
}

.loader-title {
    margin-top: 6px;
    font-size: clamp(24px, 5.6vw, 34px);
    line-height: 1.04;
    font-weight: 900;
    color: #fff;
    text-shadow: 0 0 18px rgba(255,0,204,.34);
}

.loader-subtitle {
    margin-top: 8px;
    font-size: 12px;
    font-weight: 600;
    color: #d1d9ea;
    opacity: .92;
}

.loader-progress {
    margin-top: 12px;
    height: 10px;
    border-radius: 999px;
    border: 1px solid rgba(255,255,255,.18);
    background: rgba(255,255,255,.08);
    overflow: hidden;
}

.loader-progress-bar {
    width: 42%;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, #8a3bff, #ff00cc, #73d8ff);
    box-shadow: 0 0 16px rgba(255,0,204,.45);
    animation: loaderBarPulse 1.6s ease-in-out infinite;
}

.loader-text {
    margin-top: 10px;
    font-size: 11px;
    font-weight: 800;
    color: #f3f7ff;
    letter-spacing: .9px;
    opacity: .94;
}

@keyframes loaderBarPulse {
    0%, 100% { width: 34%; filter: saturate(1); }
    50% { width: 76%; filter: saturate(1.3); }
}

@keyframes caseFloat {
    0%, 100% { transform: translateY(0) scale(1); }
    50% { transform: translateY(-4px) scale(1.006); }
}

@keyframes caseNeonPulse {
    0%, 100% { filter: brightness(1); }
    50% { filter: brightness(1.14); }
}

/* Кастомный скроллбар */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: var(--bg-deep); }
::-webkit-scrollbar-thumb { 
    background: linear-gradient(var(--accent-pink), var(--accent-purple)); 
    border-radius: 10px;
}

/* --- ГЛАВНЫЙ КОНТЕЙНЕР ПРИЛОЖЕНИЯ --- */
#app {
    display: flex;
    flex-direction: column;
    height: 100dvh;
    min-height: 100vh;
    max-width: 500px; /* Для ПК-версии */
    margin: 0 auto;
    background: radial-gradient(circle at top, #1a1a2e 0%, #0a0a0f 100%);
    position: relative;
}

.content-scroll {
    flex: 1;
    min-height: 0;
}

/* --- HEADER (TOP BAR) --- */
.top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    background: rgba(10, 10, 15, 0.8);
    backdrop-filter: blur(15px);
    border-bottom: 1px solid var(--glass-border);
    z-index: 1000;
}

.music-toggle {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    border: 1px solid var(--glass-border);
    background: var(--glass);
    color: var(--gold);
    font-weight: 900;
    transition: transform .2s ease, box-shadow .3s ease;
}

.music-toggle.active {
    box-shadow: 0 0 16px rgba(255, 204, 0, .4);
    transform: scale(1.06);
}

.back-btn {
    position: fixed;
    left: 14px;
    top: 64px;
    z-index: 1200;
    width: 36px;
    height: 36px;
    display: none;
    align-items: center;
    justify-content: center;
    background: rgba(12, 12, 19, .84);
    color: #fff;
    border: 1px solid var(--glass-border);
    border-radius: 50%;
    font-size: 18px;
    font-weight: 900;
    line-height: 1;
    box-shadow: 0 8px 18px rgba(0,0,0,.35);
}

.back-btn:active {
    transform: scale(0.94);
}

.user-block { display: flex; align-items: center; gap: 10px; }
.avatar-wrapper img {
    width: 40px; height: 40px;
    border-radius: 12px;
    border: 2px solid var(--accent-pink);
    box-shadow: 0 0 15px rgba(255, 0, 204, 0.3);
}

.nickname { font-weight: 800; font-size: 14px; display: block; }
.status { font-size: 9px; color: var(--success); text-transform: uppercase; letter-spacing: 1px; }

.balance-block {
    background: var(--glass);
    padding: 8px 15px;
    border-radius: 20px;
    display: flex;
    align-items: center;
    gap: 8px;
    border: 1px solid var(--glass-border);
    transition: transform 0.2s;
}
.balance-block:active { transform: scale(0.95); }

.deposit-btn {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    border: none;
    background: linear-gradient(45deg, var(--accent-pink), var(--accent-purple));
    color: #fff;
    font-weight: 900;
    font-size: 13px;
    line-height: 1;
}

#balance { font-weight: 900; color: var(--gold); font-size: 16px; }
.coin-icon { width: 20px; height: 20px; animation: pulse 2s infinite; }

/* --- КНОПКИ --- */
.btn-main {
    background: linear-gradient(45deg, var(--accent-purple), var(--accent-pink));
    border: none;
    border-radius: 16px;
    color: white;
    font-weight: 800;
    font-size: 16px;
    padding: 15px;
    width: 100%;
    min-height: 46px;
    cursor: pointer;
    box-shadow: 0 8px 24px rgba(157, 0, 255, 0.42), inset 0 0 0 1px rgba(255,255,255,.08);
    transition: transform .18s ease, filter .18s ease, box-shadow .2s ease;
}
.btn-main:active { transform: scale(0.97); filter: brightness(1.14); }

.btn-main:disabled {
    opacity: .65;
    box-shadow: none;
}

/* --- КАРТОЧКИ ИГР (ГРИД) --- */
.game-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    padding: 20px;
}

#screen-games {
    position: relative;
    overflow: hidden;
}

#screen-games::before,
#screen-games::after {
    content: "";
    position: absolute;
    width: 72vw;
    height: 72vw;
    border-radius: 50%;
    pointer-events: none;
    z-index: 0;
    filter: blur(22px);
    opacity: .44;
}

#screen-games::before {
    left: -26vw;
    top: -18vw;
    background: radial-gradient(circle, rgba(157, 0, 255, .45), transparent 68%);
    animation: liveBlobOne 12s ease-in-out infinite;
}

#screen-games::after {
    right: -24vw;
    bottom: -22vw;
    background: radial-gradient(circle, rgba(255, 0, 204, .42), transparent 68%);
    animation: liveBlobTwo 14s ease-in-out infinite;
}

#screen-games .main-banner,
#screen-games .game-grid,
#screen-games .feed-wrap {
    position: relative;
    z-index: 1;
}

.feed-wrap {
    margin: 0 20px 16px;
    background: rgba(255,255,255,.03);
    border: 1px solid var(--glass-border);
    border-radius: 14px;
    padding: 10px;
}

.feed-head {
    font-size: 11px;
    font-weight: 900;
    color: var(--text-dim);
    margin-bottom: 8px;
}

.feed-list {
    display: grid;
    gap: 6px;
}

.feed-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 7px 8px;
    border-radius: 9px;
    font-size: 11px;
    background: rgba(0,0,0,.2);
}

.feed-row b {
    color: var(--gold);
    font-size: 11px;
}

.game-item {
    background: var(--bg-card);
    border-radius: 24px;
    padding: 20px;
    position: relative;
    overflow: hidden;
    border: 1px solid var(--glass-border);
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    transition: transform .22s ease, border-color .22s ease, box-shadow .22s ease, background .22s ease;
    min-height: 164px;
    cursor: pointer;
}

.game-item:active {
    transform: translateY(1px) scale(.985);
    border-color: rgba(255, 0, 204, .72);
    background: #161622;
    box-shadow: 0 0 26px rgba(157,0,255,.18);
}

.game-item img {
    width: 80px; height: 80px;
    object-fit: contain;
    margin-bottom: 10px;
    filter: drop-shadow(0 5px 15px rgba(0,0,0,0.5));
}

.game-item h3 { font-size: 14px; font-weight: 800; text-transform: uppercase; }
.game-item span { font-size: 10px; color: var(--text-dim); }

.badge {
    position: absolute; top: 10px; right: 10px;
    background: var(--danger);
    padding: 3px 7px; border-radius: 6px;
    font-size: 8px; font-weight: 900; color: white;
}

/* --- НИЖНЯЯ НАВИГАЦИЯ --- */
.bottom-menu {
    position: fixed;
    bottom: 0; width: 100%;
    background: linear-gradient(180deg, rgba(8, 8, 14, 0.58), rgba(8, 8, 14, 0.96));
    backdrop-filter: blur(26px) saturate(1.22);
    display: flex;
    justify-content: space-around;
    gap: 9px;
    padding: 10px 12px calc(12px + var(--safe-bottom));
    border-top: 1px solid rgba(255,255,255,.06);
    box-shadow: 0 -16px 34px rgba(0,0,0,.34);
}

.nav-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    color: var(--text-dim);
    transition: transform .18s ease, color .18s ease, background .18s ease, box-shadow .18s ease, border-color .18s ease;
    flex: 1;
    min-height: 60px;
    justify-content: center;
    border-radius: 20px;
    position: relative;
    overflow: hidden;
    background:
        linear-gradient(180deg, rgba(255,255,255,.05), rgba(255,255,255,.02)),
        rgba(255,255,255,.025);
    border: 1px solid rgba(255,255,255,.05);
    box-shadow:
        inset 0 0 0 1px rgba(255,255,255,.02),
        0 6px 16px rgba(0,0,0,.14);
    padding: 6px 4px;
}

.nav-btn::before {
    content: "";
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at top, rgba(157,0,255,.22), transparent 64%);
    opacity: 0;
    transition: opacity .2s ease;
    pointer-events: none;
}

.nav-btn::after {
    content: "";
    position: absolute;
    left: 50%;
    bottom: 6px;
    width: 34px;
    height: 3px;
    border-radius: 999px;
    transform: translateX(-50%) scaleX(0.35);
    background: linear-gradient(90deg, rgba(255,0,204,0), rgba(255,0,204,.92), rgba(157,0,255,.92), rgba(255,0,204,0));
    opacity: 0;
    transition: opacity .2s ease, transform .2s ease;
    box-shadow: 0 0 12px rgba(255,0,204,.35);
}

.nav-btn.active {
    color: #fff;
    background:
        radial-gradient(circle at top, rgba(255,0,204,.18), transparent 62%),
        linear-gradient(180deg, rgba(157,0,255,.24), rgba(255,0,204,.10));
    border-color: rgba(255,255,255,.18);
    box-shadow:
        0 10px 26px rgba(157,0,255,.22),
        0 0 0 1px rgba(255,255,255,.04) inset,
        inset 0 0 24px rgba(255,0,204,.08);
    transform: translateY(-1px);
}

.nav-btn.active::before {
    opacity: 1;
}

.nav-btn.active::after {
    opacity: 1;
    transform: translateX(-50%) scaleX(1);
}

.nav-btn:active {
    transform: translateY(1px) scale(.99);
}
.nav-icon {
    width: 26px;
    height: 26px;
    background: currentColor;
    mask-size: contain;
    mask-repeat: no-repeat;
    mask-position: center;
    -webkit-mask-size: contain;
    -webkit-mask-repeat: no-repeat;
    -webkit-mask-position: center;
}

/* Иконки (через дата-урл или маски) */
.home { mask-image: url('assets/newic/cnopa/gaming.png'); -webkit-mask-image: url('assets/newic/cnopa/gaming.png'); }
.tops { mask-image: url('assets/newic/cnopa/top-10.png'); -webkit-mask-image: url('assets/newic/cnopa/top-10.png'); }
.shop { mask-image: url('assets/newic/cnopa/shop.png'); -webkit-mask-image: url('assets/newic/cnopa/shop.png'); }
.user { mask-image: url('assets/newic/cnopa/profile.png'); -webkit-mask-image: url('assets/newic/cnopa/profile.png'); }

.nav-btn span {
    font-size: 11px;
    font-weight: 800;
    letter-spacing: .3px;
    line-height: 1;
}

.nav-btn.active span {
    text-shadow: 0 0 12px rgba(255,0,204,.32);
}

/* --- АНИМАЦИИ --- */
@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); filter: brightness(1.2); }
    100% { transform: scale(1); }
}

@keyframes slideUp {
    from { opacity: 0; transform: translateY(30px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes bgShift {
    0%,100% { transform: translate(0,0) scale(1); }
    50% { transform: translate(2%, -1.5%) scale(1.06); }
}

@keyframes battlePulse {
    0%,100% { box-shadow: 0 0 40px rgba(157,0,255,.3); }
    50% { box-shadow: 0 0 70px rgba(255,0,204,.45); }
}

@keyframes liveBlobOne {
    0%, 100% { transform: translate(0, 0) scale(1); opacity: .34; }
    50% { transform: translate(6vw, 4vw) scale(1.16); opacity: .55; }
}

@keyframes liveBlobTwo {
    0%, 100% { transform: translate(0, 0) scale(1.02); opacity: .3; }
    50% { transform: translate(-7vw, -5vw) scale(1.18); opacity: .56; }
}

body.perf-lite::before {
    animation-duration: 22s;
    opacity: .42;
}

body.perf-lite #screen-games::before,
body.perf-lite #screen-games::after {
    animation-duration: 22s;
    filter: blur(16px);
    opacity: .32;
}

body.perf-lite .spinner,
body.perf-lite .coin-icon,
body.perf-lite .result-image,
body.perf-lite .result-image-wrap::after,
body.perf-lite .case-live-icons,
body.perf-lite .canvas-container.battle,
body.perf-lite .case-card-ui {
    animation: none !important;
}

body.perf-lite .page.active.enter {
    animation-duration: .18s;
}

body.perf-lite .btn-main,
body.perf-lite .game-item,
body.perf-lite .case-card-ui,
body.perf-lite .modal-card,
body.perf-lite .crash-area .crash-rocket {
    transition-duration: .14s !important;
}

@media (prefers-reduced-motion: reduce) {
    body::before,
    #screen-games::before,
    #screen-games::after,
    .spinner,
    .coin-icon,
    .result-image,
    .result-image-wrap::after,
    .case-live-icons,
    .canvas-container.battle,
    .case-card-ui {
        animation: none !important;
    }

    .page.active.enter {
        animation-duration: .18s;
    }
}

.page {
    display: none;
    height: 100%;
    min-height: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: calc(84px + var(--safe-bottom));
    overscroll-behavior-y: contain;
    opacity: 0;
    transform: translateY(8px) scale(.995);
}
.page.active {
    display: block;
    opacity: 1;
    transform: translateY(0) scale(1);
}
.page.active.enter { animation: pageFade .32s ease-out forwards; }

@keyframes pageFade {
    from { opacity: 0; transform: translateY(8px) scale(.995); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

/* Конец 7 части (Первая половина CSS). Далее пойдут стили для Краша, Мин и Арены. */
/* --- MINES GAME (СЕТКА 5x5) --- */
.mines-container {
    padding: 14px;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    min-height: calc(100vh - 210px);
}

.mines-size-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}

.mines-size-btn {
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    background: rgba(8, 10, 20, .82);
    color: #aeb7c8;
    font-size: 12px;
    font-weight: 800;
    padding: 9px 6px;
}

.mines-size-btn.active {
    color: #ffd8fb;
    border-color: rgba(255, 0, 204, .56);
    box-shadow: inset 0 0 18px rgba(255, 0, 204, .14), 0 0 18px rgba(157, 0, 255, .18);
}

.mines-risk-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}

.mines-risk-btn {
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    background: rgba(8, 10, 20, .82);
    color: #aeb7c8;
    font-size: 12px;
    font-weight: 800;
    padding: 9px 6px;
}

.mines-risk-btn.active {
    color: #ffd8fb;
    border-color: rgba(255, 0, 204, .56);
    box-shadow: inset 0 0 20px rgba(255, 0, 204, .14), 0 0 18px rgba(157, 0, 255, .18);
}

.mines-status {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
}

.mines-status span {
    background: rgba(8, 11, 22, .9);
    border: 1px solid rgba(255,255,255,.1);
    border-radius: 12px;
    padding: 8px 6px;
    text-align: center;
    font-size: 11px;
    font-weight: 800;
    color: #d6dfef;
}

.mines-bet-panel {
    display: grid;
    gap: 8px;
}

.mines-bet-row {
    display: grid;
    grid-template-columns: minmax(122px, 1fr) minmax(0, 1.8fr);
    gap: 8px;
}

.bet-boost-row {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
    padding: 6px;
    border-radius: 14px;
    background: linear-gradient(145deg, rgba(157,0,255,.08), rgba(255,0,204,.05));
    border: 1px solid rgba(255,255,255,.08);
    box-shadow: inset 0 0 0 1px rgba(255,255,255,.03);
}

.bet-boost-row > button {
    min-height: 32px;
    padding: 0 8px;
    border-radius: 999px;
    font-size: 10px;
    font-weight: 900;
    letter-spacing: .35px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    white-space: nowrap;
    background: linear-gradient(145deg, rgba(157,0,255,.22), rgba(255,0,204,.14));
    border: 1px solid rgba(255,255,255,.14);
    color: #fff;
    box-shadow: 0 6px 16px rgba(0,0,0,.16), inset 0 0 0 1px rgba(255,255,255,.02);
}

.bet-boost-row > button:active {
    transform: translateY(1px) scale(.99);
}

.mines-bet-input-wrap {
    background: rgba(7, 9, 20, .92);
    border: 1px solid rgba(255,255,255,.15);
    border-radius: 12px;
    padding: 9px 10px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.mines-bet-input-wrap input {
    width: 100%;
    border: none;
    outline: none;
    background: transparent;
    color: #fff;
    font-size: 15px;
    font-weight: 900;
}

.mines-bet-input-wrap span {
    color: var(--gold);
    font-size: 13px;
    font-weight: 900;
}

.mines-action-btn {
    min-height: 44px;
}

.mines-quick-bets {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 6px;
}

.mines-q-btn {
    border: 1px solid rgba(255,255,255,.16);
    border-radius: 10px;
    background: linear-gradient(145deg, rgba(157,0,255,.16), rgba(255,0,204,.1));
    color: #e9e4ff;
    font-size: 11px;
    font-weight: 800;
    min-height: 36px;
}

.mines-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 9px;
    width: 100%;
    max-width: 100%;
    aspect-ratio: 1;
    max-height: 44vh;
}

.mines-grid.size-9 {
    grid-template-columns: repeat(3, 1fr);
    max-width: min(320px, 64vw);
    margin: 0 auto;
}

.mines-grid.size-25 {
    grid-template-columns: repeat(5, 1fr);
    max-width: min(366px, 86vw);
    margin: 0 auto;
    max-height: 42vh;
}

.mines-grid.size-100 {
    grid-template-columns: repeat(10, 1fr);
    gap: 4px;
    max-width: min(300px, 74vw);
    margin: 0 auto;
    max-height: min(46vh, 300px);
}

.mines-grid.size-100 .mine-cell {
    border-radius: 7px;
    border-width: 1px;
}

.mines-grid.size-100 .mine-x {
    font-size: 8px;
    letter-spacing: 0;
}

.mines-grid.size-100 .mine-cashout {
    font-size: 6px;
}

.mine-cell {
    background: radial-gradient(circle at 50% 68%, rgba(255, 0, 204, .2), rgba(14, 16, 25, .98) 62%);
    border-radius: 16px;
    border: 1px solid rgba(255,255,255,.08);
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    transition: transform .16s ease, border-color .18s ease, box-shadow .18s ease, background .18s ease;
    position: relative;
    overflow: hidden;
    color: #b7c1d9;
    font-size: 24px;
    font-weight: 900;
}

.mine-cell.opening {
    animation: mineFlip .26s ease;
}

.mine-cell::before {
    content: "◈";
    opacity: .9;
    color: #ff7be8;
    text-shadow: 0 0 14px rgba(255,0,204,.35);
}

.mine-cell:active { transform: scale(0.94); }

.mine-cell.revealed {
    background: radial-gradient(circle at 30% 22%, rgba(255,0,204,.3), rgba(30,15,42,.95));
    border-color: rgba(255,0,204,.58);
    color: #ffe1fb;
    box-shadow: 0 0 24px rgba(157,0,255,.28);
    flex-direction: column;
    gap: 1px;
}

.mine-cell.revealed::before,
.mine-cell.boom::before {
    display: none;
}

.mine-cell.boom {
    background: radial-gradient(circle at 30% 20%, rgba(255,59,48,.26), rgba(35,15,18,.96));
    border-color: rgba(255,59,48,.64);
    color: #ffd6d3;
    box-shadow: 0 0 20px rgba(255,59,48,.2);
}

.mine-x {
    font-size: 15px;
    font-weight: 900;
    letter-spacing: .2px;
    color: #ffd2f5;
    text-shadow: 0 0 10px rgba(255,0,204,.35);
}

.mine-cashout {
    font-size: 9px;
    font-weight: 800;
    color: #ffd86f;
    line-height: 1.05;
    text-shadow: 0 0 8px rgba(255, 181, 61, .24);
}

.mines-feed-card {
    margin-top: 2px;
    border-radius: 18px;
    border: 1px solid rgba(255,0,204,.2);
    background: linear-gradient(180deg, rgba(13,16,28,.97), rgba(9,11,20,.97));
    box-shadow: inset 0 0 0 1px rgba(255,255,255,.03), 0 10px 24px rgba(0,0,0,.28);
    overflow: hidden;
    min-height: 166px;
    transition: max-height .22s ease, opacity .2s ease, transform .2s ease;
}

.mines-feed-card.compact {
    max-height: 86px;
}

.mines-feed-card.compact .mines-feed-table-head,
.mines-feed-card.compact .mines-feed-list {
    opacity: 0;
    pointer-events: none;
}

.mines-feed-card.compact .mines-feed-list {
    max-height: 0;
    padding-top: 0;
    padding-bottom: 0;
}

.mines-feed-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 10px 6px;
}

.mines-feed-brand {
    font-size: 11px;
    font-weight: 900;
    letter-spacing: .8px;
    color: #ff9cf0;
}

.mines-feed-tabs {
    display: inline-grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
}

.mines-feed-tab {
    border: 1px solid rgba(255,255,255,.12);
    background: rgba(255,255,255,.03);
    color: #9aa4bc;
    border-radius: 9px;
    padding: 5px 11px;
    font-size: 11px;
    font-weight: 800;
}

.mines-feed-tab.active {
    border-color: rgba(255,0,204,.62);
    color: #ffd8fb;
    box-shadow: inset 0 0 18px rgba(157,0,255,.2);
}

.mines-feed-table-head {
    display: grid;
    grid-template-columns: 1.2fr .8fr .8fr .8fr;
    gap: 6px;
    padding: 0 10px 7px;
    color: var(--text-dim);
    font-size: 10px;
    font-weight: 800;
}

.mines-feed-list {
    display: grid;
    gap: 5px;
    padding: 0 10px 10px;
    max-height: 170px;
    overflow-y: auto;
}

.mines-feed-row {
    display: grid;
    grid-template-columns: 1.2fr .8fr .8fr .8fr;
    gap: 6px;
    align-items: center;
    border-radius: 9px;
    padding: 7px 8px;
    background: rgba(255,255,255,.025);
    border: 1px solid rgba(255,255,255,.08);
    font-size: 11px;
}

.mines-feed-row .profit-win {
    color: var(--success);
    font-weight: 900;
}

.mines-feed-row .profit-lose {
    color: var(--danger);
    font-weight: 900;
}

.mines-feed-row.empty {
    display: block;
    text-align: center;
    color: var(--text-dim);
    font-size: 11px;
}

@keyframes mineFlip {
    from { transform: perspective(420px) rotateY(70deg) scale(.96); }
    to { transform: perspective(420px) rotateY(0deg) scale(1); }
}

/* Эффект для алмаза */
.mine-cell .gem { width: 70%; filter: drop-shadow(0 0 10px var(--accent-pink)); animation: bounce 2s infinite; }
/* Эффект для бомбы */
.mine-cell .bomb { width: 70%; filter: drop-shadow(0 0 10px var(--danger)); }

/* --- CRASH ENGINE (PRO VISUAL) --- */
#screen-crash {
    flex-direction: column;
    gap: 8px;
    padding-top: 6px;
}

#screen-crash.page.active {
    display: flex;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: calc(92px + var(--safe-bottom));
}

.crash-area {
    flex: 0 0 auto;
    height: clamp(200px, 30dvh, 280px);
    margin: 4px 14px 0;
    background: radial-gradient(circle at 60% 20%, rgba(157, 0, 255, 0.15), rgba(4, 7, 28, 0.92) 56%, rgba(3, 4, 14, 0.98));
    border-radius: 26px;
    position: relative;
    border: 2px solid var(--glass-border);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    box-shadow: inset 0 0 50px rgba(157, 0, 255, 0.1), 0 16px 32px rgba(0, 0, 0, 0.35);
}

.crash-area > * {
    position: relative;
    z-index: 2;
}

.crash-area::after {
    content: "";
    position: absolute;
    inset: auto 0 0 0;
    height: 72px;
    background: linear-gradient(to top, rgba(3,4,14,.95), transparent);
    pointer-events: none;
    z-index: 1;
}

.crash-area::before {
    content: "";
    position: absolute;
    inset: 0;
    background-image: radial-gradient(circle, rgba(255,255,255,.9) 1px, transparent 1px);
    background-size: 60px 60px;
    opacity: .25;
    pointer-events: none;
}

.crash-area .crash-multiplier {
    position: absolute;
    left: 50%;
    bottom: 6px;
    transform: translateX(-50%);
    font-size: 18px;
    font-weight: 900;
    z-index: 20;
    text-shadow: 0 0 12px var(--accent-purple);
    font-variant-numeric: tabular-nums;
    transition: color .2s ease;
    pointer-events: none;
}

.crash-area .timer-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    z-index: 15;
    background: rgba(3, 4, 14, .55);
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
    border-radius: inherit;
    pointer-events: none;
}
.crash-area .timer-overlay span {
    font-size: clamp(28px, 8vw, 42px);
    font-weight: 900;
    color: #fff;
    text-shadow: 0 2px 10px rgba(0,0,0,.6);
    line-height: 1;
}
.crash-area .timer-overlay p {
    font-size: 11px;
    font-weight: 900;
    letter-spacing: 1.2px;
    color: var(--text-dim);
    text-transform: uppercase;
    margin: 0;
}

.crash-area .crash-rocket {
    position: absolute !important;
    width: clamp(100px, 35vw, 160px);
    left: 50%;
    bottom: 34px;
    transform: translateX(-50%);
    z-index: 12;
    filter: drop-shadow(0 14px 28px rgba(27, 133, 255, 0.45));
    will-change: transform;
    transform-origin: 50% 72%;
}

.crash-history {
    order: 2;
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 6px;
    padding: 0 14px;
    overflow: hidden;
}

.history-item {
    padding: 5px 6px;
    border-radius: 999px;
    font-size: 10.5px;
    font-weight: 900;
    text-align: center;
    white-space: nowrap;
    letter-spacing: .3px;
    font-variant-numeric: tabular-nums;
    background: linear-gradient(180deg, rgba(255,255,255,.08), rgba(255,255,255,.02));
    border: 1px solid rgba(255,255,255,.10);
    box-shadow: inset 0 0 0 1px rgba(255,255,255,.02);
    color: #cfd6e8;
}
.history-item.tier-bust {
    color: #ff7a8a;
    background: linear-gradient(180deg, rgba(255,46,80,.22), rgba(255,46,80,.06));
    border-color: rgba(255,46,80,.45);
    box-shadow: 0 0 10px rgba(255,46,80,.18);
}
.history-item.tier-low {
    color: #c5cee0;
    background: linear-gradient(180deg, rgba(255,255,255,.08), rgba(255,255,255,.02));
    border-color: rgba(255,255,255,.14);
}
.history-item.tier-mid {
    color: #6ee7b7;
    background: linear-gradient(180deg, rgba(0,217,139,.22), rgba(0,217,139,.05));
    border-color: rgba(0,217,139,.4);
    box-shadow: 0 0 10px rgba(0,217,139,.18);
}
.history-item.tier-high {
    color: #b39bff;
    background: linear-gradient(180deg, rgba(157,0,255,.28), rgba(157,0,255,.08));
    border-color: rgba(157,0,255,.5);
    box-shadow: 0 0 12px rgba(157,0,255,.28);
}
.history-item.tier-mega {
    color: #ffe27a;
    background: linear-gradient(180deg, rgba(255,204,0,.32), rgba(255,128,0,.10));
    border-color: rgba(255,204,0,.55);
    box-shadow: 0 0 14px rgba(255,204,0,.35);
}
.history-item.win { color: var(--success); }
.history-item.lose { color: var(--danger); }

.crash-bets-card {
    order: 3;
    margin: 0 14px 0;
    padding: 10px;
    border-radius: 18px;
    background: rgba(30, 36, 62, 0.72);
    border: 1px solid rgba(255,255,255,.09);
}

.crash-bets-head {
    display: grid;
    grid-template-columns: 1fr auto;
    color: var(--text-dim);
    font-size: 12px;
    font-weight: 800;
    margin-bottom: 8px;
}

.crash-live-bets {
    display: grid;
    gap: 7px;
    padding-right: 2px;
}

.crash-cashout-preview {
    margin-top: 10px;
    padding: 10px;
    border-radius: 14px;
    border: 1px solid rgba(255, 204, 0, .18);
    background: linear-gradient(145deg, rgba(157,0,255,.18), rgba(255,0,204,.08));
    box-shadow: inset 0 0 0 1px rgba(255,255,255,.03), 0 8px 24px rgba(0,0,0,.18);
}

.crash-cashout-preview-label {
    font-size: 10px;
    font-weight: 900;
    color: var(--gold);
    letter-spacing: .6px;
    margin-bottom: 8px;
}

.crash-cashout-preview-body {
    display: flex;
    align-items: center;
    gap: 10px;
}

.crash-cashout-preview-body img {
    width: 54px;
    height: 54px;
    border-radius: 12px;
    object-fit: cover;
    background: rgba(0,0,0,.2);
    border: 1px solid rgba(255,255,255,.1);
    box-shadow: 0 0 16px rgba(157,0,255,.18);
}

.crash-cashout-preview-meta {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.crash-cashout-preview-meta span {
    font-size: 13px;
    font-weight: 900;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 180px;
}

.crash-cashout-preview-meta b {
    font-size: 12px;
    color: var(--gold);
    font-weight: 900;
}

/* --- SLOTS ENGINE --- */
#screen-slots {
    flex-direction: column;
    gap: 10px;
    padding-top: 6px;
}
#screen-slots.page.active {
    display: flex;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: calc(92px + var(--safe-bottom));
}

.slots-live-strip {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0 14px;
    padding: 8px 12px;
    border-radius: 16px;
    background: rgba(255,255,255,.04);
    border: 1px solid rgba(255,255,255,.08);
    overflow: hidden;
}
.slots-live-icons {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    mask-image: linear-gradient(to right, transparent, black 8%, black 92%, transparent);
    -webkit-mask-image: linear-gradient(to right, transparent, black 8%, black 92%, transparent);
}
.slots-live-icons img {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    object-fit: cover;
    flex-shrink: 0;
    border: 1px solid rgba(255,255,255,.12);
    background: rgba(0,0,0,.25);
}

.slots-machine {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    margin: 8px 14px 0;
    padding: 14px;
    border-radius: 22px;
    background: radial-gradient(circle at 50% 30%, rgba(157,0,255,.10), rgba(4,7,28,.92) 60%, rgba(3,4,14,.98));
    border: 2px solid var(--glass-border);
    box-shadow: inset 0 0 50px rgba(157,0,255,.08), 0 16px 32px rgba(0,0,0,.35);
    position: relative;
}

.slots-reel-wrap {
    width: clamp(78px, 24vw, 100px);
    height: clamp(78px, 24vw, 100px);
    border-radius: 16px;
    background: rgba(0,0,0,.35);
    border: 1px solid rgba(255,255,255,.12);
    overflow: hidden;
    position: relative;
    box-shadow: inset 0 4px 12px rgba(0,0,0,.4);
}
.slots-reel-wrap::after {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
    box-shadow: inset 0 0 18px rgba(157,0,255,.15);
    pointer-events: none;
}

.slots-reel {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform .35s cubic-bezier(.23,1,.32,1), filter .25s ease;
}
.slots-reel img {
    width: 70%;
    height: 70%;
    object-fit: contain;
    filter: drop-shadow(0 4px 8px rgba(0,0,0,.4));
    transition: transform .3s ease;
}

.slots-reel.is-spinning img {
    animation: slotsBlur .22s linear infinite;
    filter: blur(2px) brightness(1.15);
}
.slots-reel.is-snapping {
    transform: scale(1.06);
}
.slots-reel.is-win-glow {
    animation: slotsWinPulse .8s ease-in-out 2;
}
.slots-reel.is-near-miss {
    animation: slotsNearMiss .55s ease-in-out;
}

@keyframes slotsBlur {
    0% { transform: translateY(-6px) scale(.92); opacity: .7; }
    50% { transform: translateY(6px) scale(1.04); opacity: 1; }
    100% { transform: translateY(-6px) scale(.92); opacity: .7; }
}
@keyframes slotsWinPulse {
    0%, 100% { box-shadow: inset 0 0 0 0 rgba(0,217,139,0); border-color: rgba(255,255,255,.12); }
    50% { box-shadow: inset 0 0 30px rgba(0,217,139,.35); border-color: rgba(0,217,139,.6); }
}
@keyframes slotsNearMiss {
    0%, 100% { transform: translateX(0); }
    20% { transform: translateX(-6px); }
    40% { transform: translateX(6px); }
    60% { transform: translateX(-4px); }
    80% { transform: translateX(4px); }
}

.slots-divider {
    height: 1px;
    margin: 0 24px;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,.12), transparent);
}

.slots-prizes-btn {
    margin: 0 14px;
    padding: 10px 14px;
    border-radius: 14px;
    font-size: 13px;
    font-weight: 900;
    letter-spacing: .3px;
    border: 1px solid rgba(255,255,255,.12);
    background: rgba(255,255,255,.06);
    color: #d4dce8;
    cursor: pointer;
    transition: transform .12s ease, background .2s ease, border-color .2s ease;
}
.slots-prizes-btn:active {
    transform: scale(.97);
}
.slots-prizes-btn:hover {
    background: rgba(255,255,255,.10);
    border-color: rgba(255,255,255,.18);
}

.slots-prizes-head {
    font-size: 12px;
    font-weight: 900;
    color: var(--text-dim);
    letter-spacing: .35px;
    margin: 0 16px;
    text-align: center;
}
.slots-prizes-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin: 0 14px;
    padding: 8px;
    border-radius: 16px;
    background: rgba(255,255,255,.03);
    border: 1px solid rgba(255,255,255,.06);
}
.slots-prize-cell {
    display: flex;
    align-items: center;
    justify-content: center;
    aspect-ratio: 1 / 1;
    border-radius: 12px;
    background: rgba(255,255,255,.04);
    border: 1px solid rgba(255,255,255,.08);
    overflow: hidden;
}
.slots-prize-cell img {
    width: 68%;
    height: 68%;
    object-fit: contain;
    filter: drop-shadow(0 3px 6px rgba(0,0,0,.35));
}

.slots-tiers {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    margin: 0 14px;
}
.slots-tier-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 10px 0;
    border-radius: 14px;
    border: 1px solid rgba(255,255,255,.12);
    background: rgba(255,255,255,.05);
    color: #b7c1d9;
    font-size: 12px;
    font-weight: 900;
    cursor: pointer;
    transition: transform .12s ease, border-color .18s ease, background .18s ease, color .18s ease;
}
.slots-tier-btn:active { transform: scale(.96); }
.slots-tier-btn.active {
    background: linear-gradient(180deg, rgba(157,0,255,.28), rgba(157,0,255,.10));
    border-color: rgba(157,0,255,.5);
    color: #fff;
    box-shadow: 0 0 14px rgba(157,0,255,.22);
}

.slots-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 0 16px;
    font-size: 11px;
    font-weight: 800;
    color: var(--text-dim);
}
.slots-rtp {
    color: #6ee7b7;
    background: rgba(0,217,139,.12);
    padding: 3px 8px;
    border-radius: 999px;
    border: 1px solid rgba(0,217,139,.25);
}
.slots-info {
    cursor: pointer;
    opacity: .7;
    transition: opacity .2s ease;
}
.slots-info:hover { opacity: 1; }

.slots-spin-btn {
    margin: 0 14px 6px;
    padding: 14px;
    border-radius: 16px;
    font-size: 16px;
    font-weight: 900;
    letter-spacing: .4px;
    background: linear-gradient(45deg, #2b6aff, #8a3bff);
    box-shadow: 0 8px 24px rgba(43, 106, 255, .35);
    position: relative;
    overflow: hidden;
}
.slots-spin-btn:disabled {
    opacity: .55;
    filter: grayscale(.4);
    cursor: not-allowed;
}
.slots-spin-btn::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,.12), transparent);
    transform: translateX(-100%);
}
.slots-spin-btn:not(:disabled):active::after {
    transform: translateX(100%);
    transition: transform .45s ease;
}

.slots-result-modal .result-modal-card.is-win {
    border-color: rgba(0,217,139,.45);
    box-shadow: 0 0 40px rgba(0,217,139,.18);
}

@media (max-width: 380px) {
    .slots-reel-wrap {
        width: clamp(64px, 22vw, 84px);
        height: clamp(64px, 22vw, 84px);
    }
    .slots-tier-btn {
        font-size: 11px;
        padding: 8px 0;
    }
    .slots-prizes-grid {
        gap: 6px;
    }
}

.crash-bet-row {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 8px;
    align-items: center;
    padding: 8px 10px;
    border-radius: 12px;
    background: rgba(8, 10, 22, 0.55);
    border: 1px solid rgba(255,255,255,.06);
}

.crash-bet-row.is-live {
    border-color: rgba(157,0,255,.18);
    background: linear-gradient(145deg, rgba(18, 16, 38, 0.72), rgba(8, 10, 22, 0.56));
    box-shadow: inset 0 0 0 1px rgba(255,255,255,.02);
}

.crash-bet-row.is-live .crash-status.pending {
    animation: crashLivePulse 1.05s ease-in-out infinite;
}

.crash-x-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    align-self: flex-end;
    min-width: 58px;
    padding: 4px 9px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 900;
    letter-spacing: .3px;
    border: 1px solid rgba(255,255,255,.08);
    background: rgba(255,255,255,.04);
    box-shadow: inset 0 0 0 1px rgba(255,255,255,.03);
}

.crash-x-badge.is-live {
    color: #ffffff;
    background: linear-gradient(145deg, rgba(157,0,255,.35), rgba(255,0,204,.18));
    border-color: rgba(157,0,255,.26);
    box-shadow: 0 0 14px rgba(157,0,255,.22), inset 0 0 0 1px rgba(255,255,255,.04);
}

.crash-x-badge.is-cashout {
    color: var(--success);
    background: linear-gradient(145deg, rgba(0,255,136,.18), rgba(0,255,136,.08));
    border-color: rgba(0,255,136,.24);
    box-shadow: 0 0 14px rgba(0,255,136,.14), inset 0 0 0 1px rgba(255,255,255,.04);
}

.crash-x-badge.is-lost {
    color: var(--danger);
    background: linear-gradient(145deg, rgba(255,59,48,.18), rgba(255,59,48,.08));
    border-color: rgba(255,59,48,.24);
    box-shadow: 0 0 14px rgba(255,59,48,.14), inset 0 0 0 1px rgba(255,255,255,.04);
}

.crash-bet-row.is-cashout {
    border-color: rgba(0,255,136,.28);
    background: linear-gradient(145deg, rgba(0, 255, 136, 0.14), rgba(8, 10, 22, 0.6));
    box-shadow: 0 0 18px rgba(0,255,136,.08), inset 0 0 0 1px rgba(0,255,136,.06);
}

.crash-bet-row.is-lost {
    border-color: rgba(255,59,48,.28);
    background: linear-gradient(145deg, rgba(255,59,48,.12), rgba(8, 10, 22, 0.6));
    box-shadow: 0 0 18px rgba(255,59,48,.08), inset 0 0 0 1px rgba(255,59,48,.06);
}

.crash-bet-row.is-crash-impact {
    animation: crashImpactShake .42s ease-in-out var(--impact-delay, 0ms) 1 both;
}

.crash-bet-row.is-crash-impact .crash-user-dot {
    animation: crashDotFlash .42s ease-in-out var(--impact-delay, 0ms) 1 both;
}

.crash-bet-row.is-crash-impact .crash-x-badge,
.crash-bet-row.is-crash-impact .crash-prize,
.crash-bet-row.is-crash-impact .crash-status {
    animation: crashTextFlash .42s ease-in-out var(--impact-delay, 0ms) 1 both;
}

@keyframes crashImpactShake {
    0% {
        transform: translateX(0) scale(1);
        filter: saturate(1);
    }
    15% {
        transform: translateX(-4px) scale(1.01);
        filter: saturate(1.15);
    }
    30% {
        transform: translateX(4px) scale(1.01);
    }
    45% {
        transform: translateX(-3px) scale(1);
    }
    60% {
        transform: translateX(3px) scale(1);
    }
    100% {
        transform: translateX(0) scale(1);
        filter: saturate(1.05);
    }
}

@keyframes crashDotFlash {
    0% {
        background: linear-gradient(145deg, rgba(255,0,204,.3), rgba(64, 130, 255, .35));
        box-shadow: 0 0 0 rgba(255,59,48,0);
    }
    35% {
        background: linear-gradient(145deg, rgba(255,59,48,.45), rgba(255,59,48,.2));
        box-shadow: 0 0 16px rgba(255,59,48,.3);
    }
    100% {
        background: linear-gradient(145deg, rgba(255,59,48,.24), rgba(255,59,48,.12));
        box-shadow: 0 0 10px rgba(255,59,48,.18);
    }
}

@keyframes crashTextFlash {
    0% {
        opacity: 1;
        transform: translateY(0);
        text-shadow: none;
    }
    35% {
        opacity: 1;
        transform: translateY(-1px);
        text-shadow: 0 0 10px rgba(255,59,48,.32);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
        text-shadow: 0 0 6px rgba(255,59,48,.18);
    }
}

.crash-bet-left {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

.crash-user-dot {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: linear-gradient(145deg, rgba(255,0,204,.3), rgba(64, 130, 255, .35));
    border: 1px solid rgba(255,255,255,.14);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 800;
}

.crash-user-meta {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.crash-user-name {
    font-size: 13px;
    font-weight: 800;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 150px;
}

.crash-user-bet {
    font-size: 12px;
    color: var(--gold);
    font-weight: 800;
}

.crash-bet-right {
    text-align: right;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.crash-prize {
    font-size: 12px;
    color: #fff;
    font-weight: 800;
}

.crash-status {
    font-size: 12px;
    font-weight: 900;
}

.crash-status.pending { color: #9aa3b8; }
.crash-status.cashout { color: var(--success); }
.crash-status.lost { color: var(--danger); }

@keyframes crashLivePulse {
    0%, 100% {
        color: #c6ccdd;
        text-shadow: 0 0 0 rgba(157,0,255,0);
        transform: translateY(0);
    }
    50% {
        color: #ffffff;
        text-shadow: 0 0 10px rgba(157,0,255,.35);
        transform: translateY(-1px);
    }
}

.crash-bet-row.is-empty {
    display: block;
    text-align: center;
    color: var(--text-dim);
    font-size: 12px;
    font-weight: 700;
}

/* --- ARENA PvP (БИТВА) --- */
.arena-header {
    background: linear-gradient(135deg, rgba(255,0,204,.18), rgba(157,0,255,.34));
    margin: 14px 14px 10px;
    padding: 16px 18px;
    border-radius: 22px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 10px 30px rgba(0,0,0,0.45), inset 0 0 0 1px rgba(255,255,255,.06);
}

.arena-pot-title { font-size: 10px; font-weight: 800; opacity: 0.8; }
.arena-pot-value { font-size: 24px; font-weight: 900; }

.canvas-container {
    position: relative;
    width: min(92vw, 390px);
    margin: 0 auto;
    border-radius: 30px;
    border: 1px solid rgba(255,255,255,.08);
    overflow: hidden;
    box-shadow: 0 0 40px rgba(0,0,0,0.72), inset 0 0 30px rgba(157,0,255,.08);
}

#territoryCanvas { width: 100%; display: block; background: #070814; }

.arena-ball {
    position: absolute;
    left: 50%;
    top: 22%;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: radial-gradient(circle at 32% 32%, #ffffff, #edf2ff 34%, #b8c3d9 60%, #4a5264 100%);
    border: 1px solid rgba(255,255,255,.85);
    box-shadow:
        0 0 0 4px rgba(255,255,255,.06),
        0 0 18px rgba(255,255,255,.42),
        0 0 30px rgba(157,0,255,.22);
    transform: translate(-50%, -50%);
    z-index: 5;
    pointer-events: none;
    transition: none;
}

.canvas-container.battle .arena-ball {
    box-shadow:
        0 0 0 4px rgba(255,255,255,.08),
        0 0 20px rgba(255,255,255,.55),
        0 0 34px rgba(255, 181, 61, .45);
}

.arena-bet-panel {
    margin: 12px 14px 0;
    padding: 10px;
    border-radius: 16px;
    border: 1px solid var(--glass-border);
    background: rgba(10,12,22,.82);
}

.arena-bet-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 8px;
    align-items: center;
}

.arena-bet-step {
    border: 1px solid var(--glass-border);
    border-radius: 10px;
    background: rgba(255,255,255,.06);
    color: #fff;
    font-size: 20px;
    font-weight: 800;
    height: 38px;
}

.crash-bet-step,
.mines-bet-step {
    width: 38px;
    min-width: 38px;
}

.arena-bet-input-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
    border: 1px solid var(--glass-border);
    border-radius: 10px;
    background: rgba(0,0,0,.35);
    padding: 0 12px;
    height: 38px;
}

.arena-bet-input-wrap input {
    width: 100%;
    border: none;
    background: transparent;
    color: #fff;
    font-size: 14px;
    font-weight: 900;
    outline: none;
}

.arena-bet-input-wrap span {
    color: var(--gold);
    font-weight: 900;
}

.arena-quick-bets {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    margin-top: 8px;
}

.arena-q-btn {
    border: 1px solid var(--glass-border);
    border-radius: 10px;
    background: rgba(255,255,255,.06);
    color: #d7deef;
    font-size: 12px;
    font-weight: 800;
    padding: 8px 0;
}

.arena-join-btn {
    margin-top: 10px;
    background: linear-gradient(45deg, var(--accent-purple), var(--accent-pink));
    color: #fff;
    box-shadow: 0 8px 26px rgba(157,0,255,.35);
}

.canvas-container.battle {
    animation: battlePulse .9s linear infinite;
}

.arena-players-card {
    margin: 12px 14px;
    padding: 12px;
    border-radius: 16px;
    border: 1px solid var(--glass-border);
    background: rgba(255,255,255,.04);
}

.arena-players-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 11px;
    font-weight: 800;
    color: var(--text-dim);
    margin-bottom: 8px;
}

.arena-participants {
    display: grid;
    gap: 7px;
}

.arena-p-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-radius: 14px;
    background: linear-gradient(180deg, rgba(255,255,255,.05), rgba(255,255,255,.03));
    border: 1px solid rgba(255,255,255,.06);
    padding: 9px 11px;
}

.arena-p-left {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

.arena-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 900;
    color: #fff;
    border: 1px solid rgba(255,255,255,.22);
    box-shadow: 0 0 0 3px rgba(255,255,255,.04), 0 0 14px rgba(157,0,255,.16);
    flex: none;
}

.arena-name-wrap {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.arena-name {
    font-size: 13px;
    font-weight: 800;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 150px;
}

.arena-sub {
    font-size: 11px;
    font-weight: 700;
    color: #aeb4c9;
}

.bot-badge {
    margin-left: 6px;
    font-size: 9px;
    font-weight: 800;
    color: #ff9bf4;
    background: rgba(157,0,255,.2);
    border: 1px solid rgba(255,255,255,.16);
    padding: 2px 5px;
    border-radius: 999px;
}

.arena-p-right {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: #ffd9a6;
    font-weight: 900;
}

.arena-chance {
    font-size: 11px;
    color: #ffd4fb;
    font-weight: 800;
}

/* --- ПАНЕЛЬ СТАВОК (ОБЩАЯ) --- */
.bet-panel {
    position: relative;
    bottom: auto;
    left: auto;
    right: auto;
    width: calc(100% - 32px);
    margin: 12px 16px 0;
    padding: 13px 16px;
    background: rgba(14, 17, 34, 0.95);
    backdrop-filter: blur(10px);
    border-top: 1px solid var(--glass-border);
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.bet-panel-title {
    font-size: 12px;
    color: var(--text-dim);
    font-weight: 900;
    letter-spacing: .35px;
}

.input-row { display: flex; gap: 10px; }
.bet-input-wrap {
    flex: 1;
    background: #000;
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: 10px 15px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.bet-input-wrap input {
    background: transparent;
    border: none;
    color: white;
    font-weight: 800;
    width: 100%;
    outline: none;
}

.bet-input-suffix {
    color: var(--gold);
    font-weight: 900;
    font-size: 14px;
    line-height: 1;
}

#bet-panel .input-row {
    display: grid;
    grid-template-columns: minmax(132px, 1fr) minmax(0, 1.45fr);
    align-items: stretch;
}

#bet-panel .input-row .btn-main {
    width: auto;
}

.crash-controls {
    display: grid;
    grid-template-columns: 1fr 1fr minmax(96px, 1fr);
    gap: 8px;
    align-items: center;
}

.crash-cashout-btn {
    background: linear-gradient(45deg, #00d98b, #00b56f);
}

.crash-cashout-main {
    display: block;
    font-weight: 900;
    line-height: 1.05;
}

.crash-cashout-sub {
    margin-top: 2px;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 11px;
    font-weight: 800;
    opacity: .92;
}

.crash-cashout-sub img {
    width: 16px;
    height: 16px;
    border-radius: 5px;
    object-fit: cover;
    border: 1px solid rgba(255,255,255,.45);
    box-shadow: 0 0 10px rgba(255,255,255,.22);
}

.crash-auto-toggle.active {
    border-color: rgba(255, 0, 204, .55);
    box-shadow: 0 0 18px rgba(255, 0, 204, .2);
}

.crash-auto-stop-wrap {
    height: 100%;
    min-height: 46px;
    border-radius: 12px;
    border: 1px solid rgba(255,255,255,.14);
    background: rgba(6,8,22,.82);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
    padding: 8px 10px;
}

.crash-auto-stop-wrap span {
    color: var(--text-dim);
    font-size: 10px;
    font-weight: 900;
    letter-spacing: .4px;
}

.crash-auto-stop-wrap input {
    width: 68px;
    border: none;
    outline: none;
    background: transparent;
    color: #fff;
    font-size: 14px;
    font-weight: 900;
    text-align: right;
}

.quick-bets { display: flex; gap: 5px; width: 100%; }
.q-btn {
    flex: 1;
    background: linear-gradient(145deg, rgba(157,0,255,.16), rgba(255,0,204,.1));
    border: 1px solid rgba(255,255,255,.18);
    color: #e9e4ff;
    font-size: 11px;
    padding: 8px 6px;
    border-radius: 999px;
    font-weight: 800;
    min-height: 34px;
    letter-spacing: .25px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    white-space: nowrap;
}

.arena-q-btn,
.case-soft-btn,
.inv-actions button,
.mines-size-btn,
.mines-risk-btn,
.mines-feed-tab {
    min-height: 38px;
}

button,
.game-item,
.nav-btn,
.gift-card,
.case-card-ui {
    touch-action: manipulation;
}

/* --- МОДАЛКИ (РЕЗУЛЬТАТЫ) --- */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.9);
    z-index: 2000;
    display: none;
    justify-content: center;
    align-items: center;
    backdrop-filter: blur(8px);
}

.modal-overlay-soft {
    background: rgba(5,5,8,0.78);
}

.modal-card {
    background: var(--bg-card);
    width: 85%;
    border-radius: 32px;
    padding: 30px;
    text-align: center;
    border: 2px solid var(--accent-pink);
    box-shadow: 0 0 50px rgba(255, 0, 204, 0.2);
}

.result-modal-card {
    position: relative;
    width: min(88vw, 360px);
    padding: 24px 20px 18px;
    border-radius: 24px;
    transform: translateY(22px) scale(.94);
    opacity: 0;
    transition: transform .35s cubic-bezier(.21,.81,.29,.98), opacity .26s ease, border-color .24s ease, box-shadow .24s ease;
}

#modal-res.is-open .result-modal-card {
    transform: translateY(0) scale(1);
    opacity: 1;
}

.result-modal-card.is-win {
    border-color: rgba(0, 255, 136, .62);
    box-shadow: 0 0 46px rgba(0, 255, 136, .16);
}

.result-modal-card.is-lose {
    border-color: rgba(255, 59, 48, .65);
    box-shadow: 0 0 46px rgba(255, 59, 48, .16);
}

.result-game-tag {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 8px;
    padding: 4px 10px;
    border-radius: 999px;
    border: 1px solid rgba(255,255,255,.16);
    background: rgba(255,255,255,.05);
    color: var(--text-dim);
    font-size: 11px;
    font-weight: 900;
    letter-spacing: .6px;
}

.result-image-wrap {
    position: relative;
    width: 124px;
    height: 124px;
    margin: 2px auto 10px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.result-image-wrap::after {
    content: "";
    position: absolute;
    inset: 6px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(255,255,255,.16), transparent 70%);
    filter: blur(8px);
    z-index: 0;
    animation: resultHalo 1.8s ease-in-out infinite;
}

.result-image {
    position: relative;
    z-index: 1;
    width: 110px;
    height: 110px;
    object-fit: contain;
    filter: drop-shadow(0 14px 26px rgba(0,0,0,.44));
    animation: resultFloat 1.5s ease-in-out infinite;
}

.result-text {
    margin: 2px 0 14px;
    color: #cfd4e3;
    font-size: 12px;
    font-weight: 700;
}

.result-modal-card.is-win .win-sum {
    color: var(--success);
    text-shadow: 0 0 14px rgba(0,255,136,.28);
}

.result-modal-card.is-lose .win-sum {
    color: var(--danger);
    text-shadow: 0 0 14px rgba(255,59,48,.22);
}

.result-modal-card.is-win .result-image-wrap::after {
    background: radial-gradient(circle, rgba(0,255,136,.32), transparent 72%);
}

.result-modal-card.is-lose .result-image-wrap::after {
    background: radial-gradient(circle, rgba(255,59,48,.3), transparent 72%);
}

.modal-card h2 { font-size: 28px; margin-bottom: 10px; font-weight: 900; }
.modal-card .win-sum { font-size: 32px; color: var(--success); font-weight: 900; margin: 15px 0; }

.modal-close {
    position: absolute;
    right: 16px;
    top: 12px;
    border: none;
    background: transparent;
    color: #fff;
    font-size: 28px;
    line-height: 1;
    cursor: pointer;
}

.input-modal-card {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.confirm-modal-card {
    display: flex;
    flex-direction: column;
    gap: 12px;
    transform: translateY(12px) scale(.98);
    opacity: 0;
    transition: transform .22s ease, opacity .22s ease, border-color .2s ease, box-shadow .2s ease;
}

.confirm-modal-card.show {
    transform: translateY(0) scale(1);
    opacity: 1;
}

.confirm-modal-card.variant-sell {
    border-color: rgba(0,255,136,.45);
    box-shadow: 0 0 40px rgba(0,255,136,.12);
}

.confirm-modal-card.variant-withdraw {
    border-color: rgba(157,0,255,.45);
    box-shadow: 0 0 40px rgba(157,0,255,.15);
}

.confirm-modal-card.variant-buy {
    border-color: rgba(255,204,0,.5);
    box-shadow: 0 0 40px rgba(255,204,0,.16);
}

.confirm-modal-card.variant-buy .confirm-preview {
    background: linear-gradient(145deg, rgba(255,204,0,.08), rgba(157,0,255,.08));
}

.confirm-modal-card.variant-buy .confirm-text {
    color: #f3e9ff;
}

.confirm-preview {
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(255,255,255,.03);
    border: 1px solid var(--glass-border);
    border-radius: 14px;
    padding: 10px;
}

.confirm-preview img {
    width: 52px;
    height: 52px;
    border-radius: 12px;
    object-fit: contain;
    background: rgba(255,255,255,.04);
    transform: scale(.96);
    transition: transform .22s ease;
}

.confirm-modal-card.show .confirm-preview img {
    transform: scale(1);
}

@keyframes resultFloat {
    0%, 100% { transform: translateY(0) scale(1); }
    50% { transform: translateY(-4px) scale(1.02); }
}

@keyframes resultHalo {
    0%, 100% { transform: scale(.92); opacity: .66; }
    50% { transform: scale(1.06); opacity: 1; }
}

.confirm-meta {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.confirm-meta span {
    font-size: 12px;
    font-weight: 700;
}

.confirm-meta b {
    font-size: 12px;
    color: var(--gold);
}

.confirm-text {
    font-size: 12px;
    color: var(--text-dim);
}

#input-modal-field {
    width: 100%;
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    background: rgba(255,255,255,.03);
    color: #fff;
    font-size: 16px;
    font-weight: 800;
    padding: 12px;
    outline: none;
}

.input-modal-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.btn-ghost {
    background: rgba(255,255,255,.06);
    box-shadow: none;
}

.toast-root {
    position: fixed;
    left: 50%;
    bottom: 105px;
    transform: translateX(-50%);
    z-index: 6500;
    display: grid;
    gap: 8px;
    width: min(92vw, 360px);
    pointer-events: none;
}

.big-win-root {
    position: fixed;
    top: 80px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 6600;
    pointer-events: none;
}

.big-win-card {
    min-width: 240px;
    max-width: 88vw;
    background: linear-gradient(145deg, rgba(255,0,204,.18), rgba(157,0,255,.18));
    border: 1px solid rgba(255,255,255,.24);
    border-radius: 14px;
    padding: 10px 12px;
    opacity: 0;
    transform: translateY(-8px) scale(.98);
    transition: opacity .26s ease, transform .26s ease;
    box-shadow: 0 14px 30px rgba(0,0,0,.35);
}

.big-win-card.show {
    opacity: 1;
    transform: translateY(0) scale(1);
}

.big-win-title {
    font-size: 10px;
    font-weight: 900;
    letter-spacing: 1.2px;
    color: #ffd2f5;
}

.big-win-text {
    margin-top: 3px;
    font-size: 12px;
    color: #fff;
}

.big-win-val {
    margin-top: 5px;
    font-size: 14px;
    font-weight: 900;
    color: #ff93ea;
}

.toast-item {
    background: rgba(12,12,18,.92);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: 10px 12px;
    font-size: 12px;
    font-weight: 700;
    opacity: 0;
    transform: translateY(8px) scale(.98);
    transition: opacity .24s ease, transform .24s ease;
}

.toast-item.show {
    opacity: 1;
    transform: translateY(0) scale(1);
}

.toast-item.success {
    border-color: rgba(0,255,136,.45);
    color: #b8ffd8;
    animation: toastSlideIn .26s ease-out;
}

.toast-item.error {
    border-color: rgba(255,59,48,.45);
    color: #ffd2cf;
}

@keyframes toastSlideIn {
    from { transform: translateY(8px) scale(.96); opacity: 0; }
    to { transform: translateY(0) scale(1); opacity: 1; }
}

.mine-cell.boom {
    background: rgba(255, 59, 48, .2);
    border-color: rgba(255, 59, 48, .8);
}

/* Конец 8 части. Стили готовы. Переходим к верстке структуры! */

.section-head {
    padding: 18px 20px 10px;
}

.section-head h2 {
    font-size: 20px;
    font-weight: 900;
}

.section-head p {
    margin-top: 6px;
    font-size: 12px;
    color: var(--text-dim);
}

.gift-shop-head {
    padding: 20px 20px 10px;
    text-align: center;
}

.gift-shop-head h2 {
    font-size: 32px;
    font-weight: 900;
}

.gift-shop-head p {
    margin-top: 8px;
    font-size: 14px;
    color: var(--text-dim);
}

.gift-sort-row {
    margin-top: 10px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.gift-sort-btn {
    border: 1px solid rgba(255,255,255,.16);
    background: rgba(255,255,255,.04);
    color: #aeb7c8;
    border-radius: 10px;
    min-height: 34px;
    font-size: 11px;
    font-weight: 800;
}

.gift-sort-btn.active {
    color: #ffe4fd;
    border-color: rgba(255,0,204,.5);
    box-shadow: inset 0 0 16px rgba(157,0,255,.22), 0 0 14px rgba(255,0,204,.16);
}

.gift-shop-grid {
    margin: 10px 14px 24px;
    padding: 14px;
    border-radius: 28px;
    border: 1px solid var(--glass-border);
    background: rgba(22, 26, 44, .82);
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px 12px;
    content-visibility: auto;
    contain-intrinsic-size: 520px;
}

.gift-card {
    border: none;
    background: transparent;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    color: #fff;
    contain: layout paint;
}

.gift-card img {
    width: 92px;
    height: 92px;
    object-fit: contain;
    filter: drop-shadow(0 12px 22px rgba(0,0,0,.34));
    backface-visibility: hidden;
}

.gift-price {
    width: 100%;
    border-radius: 14px;
    background: rgba(255,255,255,.18);
    border: 1px solid rgba(255,255,255,.14);
    padding: 7px 6px;
    text-align: center;
    font-size: 30px;
    font-weight: 900;
}

.gift-card.loading {
    grid-column: 1 / -1;
    min-height: 92px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 14px;
    background: rgba(0,0,0,.24);
    border: 1px dashed rgba(255,255,255,.22);
    color: var(--text-dim);
    font-size: 12px;
    font-weight: 800;
}

.case-grid {
    padding: 10px 20px 24px;
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
    position: relative;
    border-radius: 20px;
    border: 1px solid rgba(255,255,255,.08);
    background: linear-gradient(155deg, rgba(8,10,22,.72), rgba(16,12,30,.48));
    box-shadow: inset 0 0 24px rgba(157,0,255,.08), 0 0 28px rgba(157,0,255,.16);
}

.case-grid.case-grid-regular {
    padding-top: 8px;
    margin: 0 20px 20px;
    padding-left: 12px;
    padding-right: 12px;
    background: linear-gradient(165deg, rgba(8,10,22,.6), rgba(12,8,26,.42));
}

.case-subhead {
    margin: 2px 20px 0;
    font-size: 11px;
    font-weight: 900;
    letter-spacing: .35px;
    color: var(--text-dim);
    text-transform: uppercase;
    text-shadow: 0 0 12px rgba(157,0,255,.26);
}

.cases-live-strip {
    margin: 10px 20px 0;
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(255,255,255,.04);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: 7px 10px;
    overflow: hidden;
}

.live-label {
    font-size: 11px;
    font-weight: 900;
    color: #fff;
}

.case-live-icons {
    display: flex;
    gap: 7px;
    white-space: nowrap;
    animation: feedScroll 18s linear infinite;
}

.case-live-icons span {
    font-size: 14px;
    opacity: .95;
}

@keyframes feedScroll {
    from { transform: translateX(0); }
    to { transform: translateX(-40%); }
}

.case-hero-wrap {
    position: relative;
    margin: 18px auto 8px;
    width: min(260px, 72vw);
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.case-hero-glow {
    position: absolute;
    inset: 18%;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(255,0,204,.25), rgba(157,0,255,.1));
    filter: blur(16px);
}

.case-hero-image {
    position: relative;
    width: 100%;
    height: 100%;
    object-fit: contain;
    filter: drop-shadow(0 12px 28px rgba(0,0,0,.45));
}

.case-actions-row {
    margin: 0 20px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.case-soft-btn {
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    background: rgba(255,255,255,.06);
    color: #fff;
    font-size: 12px;
    font-weight: 700;
    padding: 10px;
}

.case-speed-row {
    margin: 10px 20px 0;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.case-speed-btn {
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    background: rgba(255,255,255,.04);
    color: #d9deef;
    font-size: 12px;
    font-weight: 800;
    padding: 9px 10px;
    transition: border-color .18s ease, box-shadow .2s ease, transform .14s ease, color .18s ease, background .18s ease;
}

.case-speed-btn:active {
    transform: scale(.98);
}

.case-speed-btn.active {
    color: #fff;
    border-color: rgba(255, 0, 204, .55);
    background: linear-gradient(145deg, rgba(157,0,255,.35), rgba(255,0,204,.2));
    box-shadow: 0 0 16px rgba(157,0,255,.3);
}

.case-open-btn {
    margin: 12px 20px 0;
    width: calc(100% - 40px);
    background: linear-gradient(45deg, var(--accent-purple), var(--accent-pink));
    color: #fff;
    box-shadow: 0 6px 22px rgba(157,0,255,.35);
}

.case-card-ui {
    background: linear-gradient(145deg, rgba(255,255,255,0.04), rgba(255,255,255,0.01));
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    padding: 14px;
    display: flex;
    align-items: center;
    gap: 12px;
    transition: transform .2s ease, border-color .2s ease, box-shadow .2s ease;
    animation: caseFloat 4.8s ease-in-out infinite;
}

.case-card-ui:nth-child(2n) { animation-delay: .55s; }
.case-card-ui:nth-child(3n) { animation-delay: 1.1s; }

.case-card-ui:active {
    transform: scale(.98);
    border-color: rgba(255,255,255,.2);
    box-shadow: 0 0 24px rgba(157,0,255,.2);
}

.case-card-ui.active {
    border-color: rgba(255,255,255,.28);
    box-shadow: 0 0 24px rgba(157,0,255,.24);
    animation: caseFloat 4.8s ease-in-out infinite, caseNeonPulse 2.25s ease-in-out infinite;
}

.case-card-ui.bonus {
    position: relative;
    border-color: rgba(255, 215, 90, .5);
    background: linear-gradient(145deg, rgba(255,204,0,.13), rgba(255,0,204,.12) 58%, rgba(157,0,255,.1));
    box-shadow: 0 0 24px rgba(255, 204, 0, .17), 0 0 28px rgba(157,0,255,.2);
}

.case-card-ui.bonus.locked {
    border-color: rgba(255, 149, 0, .62);
    box-shadow: 0 0 24px rgba(255, 149, 0, .24), 0 0 28px rgba(157,0,255,.14);
}

.case-card-ui.bonus::before {
    content: "BONUS";
    position: absolute;
    top: -8px;
    right: 10px;
    padding: 2px 8px;
    border-radius: 999px;
    border: 1px solid rgba(255,255,255,.32);
    background: linear-gradient(145deg, rgba(255,204,0,.8), rgba(255,131,0,.72));
    color: #19110a;
    font-size: 9px;
    font-weight: 900;
    letter-spacing: .35px;
}

.case-card-ui.bonus-top-1 { order: -2; }
.case-card-ui.bonus-top-2 { order: -1; }

.case-cooldown {
    position: absolute;
    left: 12px;
    right: 12px;
    bottom: 7px;
    padding: 4px 8px;
    border-radius: 10px;
    border: 1px solid rgba(255,255,255,.18);
    background: rgba(5, 7, 16, .72);
    color: #ffd792;
    font-size: 10px;
    font-weight: 900;
    text-align: center;
    letter-spacing: .25px;
    backdrop-filter: blur(5px);
}

.case-card-ui.regular {
    border-color: rgba(255,255,255,.12);
    background: linear-gradient(145deg, rgba(255,255,255,.05), rgba(255,255,255,.015));
}

.case-card-ui.regular.tone-violet { box-shadow: 0 0 20px rgba(157,0,255,.24), inset 0 0 16px rgba(157,0,255,.12); border-color: rgba(157,0,255,.45); }
.case-card-ui.regular.tone-azure { box-shadow: 0 0 20px rgba(0,160,255,.22), inset 0 0 16px rgba(0,160,255,.12); border-color: rgba(0,160,255,.44); }
.case-card-ui.regular.tone-pink { box-shadow: 0 0 20px rgba(255,0,204,.24), inset 0 0 16px rgba(255,0,204,.12); border-color: rgba(255,0,204,.46); }
.case-card-ui.regular.tone-gold { box-shadow: 0 0 20px rgba(255,193,7,.24), inset 0 0 16px rgba(255,193,7,.12); border-color: rgba(255,193,7,.46); }
.case-card-ui.regular.tone-cyan { box-shadow: 0 0 20px rgba(0,212,255,.24), inset 0 0 16px rgba(0,212,255,.12); border-color: rgba(0,212,255,.46); }
.case-card-ui.regular.tone-red { box-shadow: 0 0 20px rgba(255,82,82,.23), inset 0 0 16px rgba(255,82,82,.12); border-color: rgba(255,82,82,.44); }

.case-card-ui.regular.active {
    filter: saturate(1.15);
    transform: translateY(-1px);
}

.case-card-ui img {
    width: 64px;
    height: 64px;
    object-fit: contain;
}

.case-card-ui h3 {
    font-size: 14px;
    font-weight: 900;
}

.case-card-ui span {
    margin-left: auto;
    font-weight: 900;
    color: var(--gold);
    font-size: 13px;
}

.leaders-wrap {
    margin: 14px;
    padding: 12px;
    background: var(--glass);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
}

.leaders-title {
    font-size: 12px;
    color: var(--text-dim);
    margin-bottom: 8px;
    font-weight: 800;
}

.leaders-list {
    display: grid;
    gap: 7px;
}

.leader-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    background: rgba(0,0,0,0.2);
    border-radius: 10px;
    padding: 8px 10px;
    font-size: 12px;
    border: 1px solid rgba(255,255,255,.05);
}

.leader-row b {
    color: var(--gold);
}

.leader-row > div {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.leader-row small {
    font-size: 10px;
    color: var(--text-dim);
    font-weight: 600;
}

.leader-row.demo {
    background: linear-gradient(145deg, rgba(255,0,204,.09), rgba(157,0,255,.09));
    border-color: rgba(255,255,255,.12);
}

.demo-mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-left: 6px;
    padding: 1px 6px;
    border-radius: 999px;
    border: 1px solid rgba(255,255,255,.22);
    background: rgba(157,0,255,.22);
    color: #ffd2f5;
    font-size: 9px;
    font-style: normal;
    font-weight: 800;
}

.profile-card {
    margin: 14px;
    background: rgba(18, 18, 26, 0.9);
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    padding: 16px;
}

.user-info-large {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    margin-bottom: 14px;
}

.p-avatar {
    width: 72px;
    height: 72px;
    border-radius: 20px;
    border: 2px solid var(--accent-pink);
}

.badge-lvl {
    font-size: 11px;
    color: var(--text-dim);
}

.stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 16px;
}

.stat-item {
    background: rgba(255,255,255,0.03);
    border: 1px solid var(--glass-border);
    border-radius: 14px;
    padding: 10px;
}

.stat-item .label {
    color: var(--text-dim);
    font-size: 10px;
    display: block;
}

.stat-item .val {
    margin-top: 5px;
    display: block;
    font-weight: 900;
    font-size: 12px;
}

.inventory-section h3 {
    font-size: 14px;
    margin-bottom: 10px;
}

.inv-grid {
    display: grid;
    gap: 10px;
    content-visibility: auto;
    contain-intrinsic-size: 560px;
}

.inv-item {
    background: rgba(255,255,255,0.03);
    border: 1px solid var(--glass-border);
    border-radius: 14px;
    padding: 10px;
    display: grid;
    grid-template-columns: 42px 1fr;
    gap: 8px 10px;
    align-items: center;
    contain: layout paint;
}

.inv-item img {
    width: 42px;
    height: 42px;
    object-fit: contain;
    grid-row: 1 / 3;
}

.inv-name {
    font-size: 12px;
    font-weight: 800;
}

.inv-price {
    font-size: 11px;
    color: var(--gold);
}

.inv-actions {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.inv-actions button {
    border: 1px solid var(--glass-border);
    background: rgba(255,255,255,0.04);
    color: white;
    border-radius: 10px;
    padding: 8px;
    font-size: 11px;
    font-weight: 700;
}

.empty-text {
    color: var(--text-dim);
    font-size: 12px;
}

.case-opening-vfx {
    position: fixed;
    inset: 0;
    z-index: 5000;
    background: radial-gradient(circle at center, rgba(20,20,28,.95), rgba(8,8,12,.98));
    backdrop-filter: blur(4px);
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 1;
    transition: opacity .32s ease;
}

.case-opening-vfx.done {
    opacity: 0;
}

.opening-content-box {
    width: 100%;
    max-width: 420px;
    padding: 0 16px;
}

.opening-title {
    text-align: center;
    font-size: 14px;
    letter-spacing: 1.6px;
    color: var(--text-dim);
}

.case-viewport {
    position: relative;
    width: 100%;
    height: 128px;
    margin-top: 14px;
    border-radius: 18px;
    border: 1px solid var(--glass-border);
    overflow: hidden;
    background: rgba(255,255,255,.02);
    mask-image: linear-gradient(to right, transparent, black 12%, black 88%, transparent);
    -webkit-mask-image: linear-gradient(to right, transparent, black 12%, black 88%, transparent);
}

.case-reel {
    position: absolute;
    left: 0;
    top: 14px;
    display: flex;
    align-items: center;
    transition: transform var(--case-spin-duration, 5.8s) cubic-bezier(.06,.82,.17,1);
    will-change: transform;
}

.case-opening-vfx .case-reel {
    transition-duration: var(--case-spin-duration, 5.8s) !important;
}

.item-card {
    width: 90px;
    min-width: 90px;
    height: 90px;
    margin: 0 5px;
    border-radius: 14px;
    background: #1d1d27;
    border: 1px solid rgba(255,255,255,.08);
    display: flex;
    justify-content: center;
    align-items: center;
}

.item-card.is-near-win {
    border-color: rgba(255, 204, 0, .3);
}

.item-card.is-win {
    border-color: rgba(255, 204, 0, .8);
    box-shadow: 0 0 16px rgba(255, 204, 0, .35), inset 0 0 18px rgba(255, 204, 0, .16);
}

.item-card.is-win.reveal {
    animation: caseWinReveal .58s cubic-bezier(.18,.92,.22,1) both;
}

@keyframes caseWinReveal {
    0% {
        transform: scale(1);
        filter: brightness(1);
        box-shadow: 0 0 16px rgba(255, 204, 0, .35), inset 0 0 18px rgba(255, 204, 0, .16);
    }
    48% {
        transform: scale(1.1);
        filter: brightness(1.25);
        box-shadow: 0 0 26px rgba(255, 204, 0, .62), 0 0 42px rgba(255, 0, 204, .28), inset 0 0 24px rgba(255, 204, 0, .25);
    }
    100% {
        transform: scale(1.04);
        filter: brightness(1.12);
        box-shadow: 0 0 20px rgba(255, 204, 0, .48), 0 0 30px rgba(255, 0, 204, .2), inset 0 0 20px rgba(255, 204, 0, .18);
    }
}

.item-card img {
    width: 58px;
    height: 58px;
    object-fit: contain;
}

.case-pointer {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 50%;
    width: 2px;
    transform: translateX(-50%);
    background: linear-gradient(to bottom, transparent, var(--gold), transparent);
    box-shadow: 0 0 18px rgba(255,204,0,.5);
    animation: casePointerPulse 1.2s ease-in-out infinite;
    z-index: 3;
}

@keyframes casePointerPulse {
    0%, 100% { opacity: .68; box-shadow: 0 0 14px rgba(255,204,0,.34); }
    50% { opacity: 1; box-shadow: 0 0 22px rgba(255,204,0,.62); }
}

@media (max-width: 430px) {
    .top-bar {
        padding: calc(10px + var(--safe-top)) 12px 10px;
    }

    .back-btn {
        top: calc(58px + var(--safe-top));
        left: 10px;
    }

    .game-grid {
        gap: 10px;
        padding: 14px;
    }

    .game-item {
        min-height: 144px;
        border-radius: 18px;
        padding: 14px 10px;
    }

    .game-item img {
        width: 64px;
        height: 64px;
    }

    .input-row {
        gap: 8px;
    }

    #bet-panel .input-row {
        grid-template-columns: minmax(120px, 1fr) minmax(0, 1.25fr);
    }

    .mines-bet-row {
        grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr);
    }

    .bet-boost-row {
        gap: 5px;
    }

    .bet-boost-row > button,
    .q-btn,
    .mines-q-btn,
    .arena-q-btn {
        min-height: 36px;
        font-size: 11px;
    }

    .crash-area {
        height: clamp(184px, 28dvh, 244px);
    }

    .crash-area .crash-rocket {
        width: clamp(96px, 32vw, 140px);
        bottom: 28px;
    }

    .crash-history {
        grid-template-columns: repeat(5, minmax(0, 1fr));
    }

    .history-item {
        font-size: 9px;
    }

    .crash-live-bets {
        gap: 6px;
    }

    .crash-cashout-preview-body img {
        width: 48px;
        height: 48px;
    }

    .crash-cashout-preview-meta span {
        max-width: 140px;
    }

    .crash-controls {
        grid-template-columns: 1fr 1fr;
    }

    .crash-auto-stop-wrap {
        grid-column: 1 / -1;
    }

    .bet-panel {
        padding: 10px 12px;
    }

    .bottom-menu {
        padding-top: 7px;
    }

    .mines-container {
        padding: 12px;
        gap: 8px;
        min-height: calc(100vh - 198px);
    }

    .mines-grid {
        max-height: 40vh;
    }

    .mines-grid.size-9 {
        max-width: min(290px, 68vw);
        max-height: 34vh;
    }

    .mines-grid.size-25 {
        max-height: 37vh;
    }

    .mines-grid.size-100 {
        max-width: min(272px, 68vw);
        max-height: 30vh;
        gap: 4px;
    }

    .mines-feed-card {
        min-height: 150px;
    }

    .mines-feed-list {
        max-height: 145px;
    }

    .crash-area .crash-multiplier {
        font-size: 38px;
    }

    .gift-shop-head h2 {
        font-size: 26px;
    }

    .gift-shop-head p {
        font-size: 12px;
    }

    .gift-card img {
        width: 78px;
        height: 78px;
    }

    .gift-price {
        font-size: 20px;
    }

    .btn-main {
        font-size: 15px;
    }

    .arena-pot-value {
        font-size: 20px;
    }

    .modal-card {
        width: 92%;
        padding: 22px;
        border-radius: 22px;
    }
}