/* ============================================================
   EasyWin Mini App — «Сукно и золото»
   Дизайн-система: зал казино. Глубокое зелёное сукно, слоновая
   кость, золото для денег и главного действия, мята для выигрыша,
   красный только для проигрыша и опасности.
   Дисплейная антиква Prata (кириллица, OFL) — бренд, заголовки,
   суммы и множители. Управление и текст — системный гротеск.
   Mobile-first; desktop enhancements at >=900px.
   ============================================================ */

/* Premium emoji images (real pack thumbnails; standard emoji fallback) */
.pemoji,
.pemoji-lg {
    width: 1.15em;
    height: 1.15em;
    vertical-align: -0.22em;
    object-fit: contain;
    display: inline-block;
    user-select: none;
}

.pemoji-fallback {
    display: inline-block;
}

@font-face {
    font-family: "Prata";
    src: url("fonts/Prata-Regular.ttf") format("truetype");
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

:root {
    /* Сукно (фон и поверхности) */
    --bg: #0c3a2c;
    --bg-2: #082b20;
    --card: #114634;
    --card-2: #175239;
    --well: #0a3226;
    /* утопленные столы: сцена, сектора */
    --border: rgba(241, 235, 219, 0.16);
    --stitch: rgba(227, 180, 91, 0.2);
    /* стёжка столов */

    /* Текст */
    --text: #f1ebdb;
    /* слоновая кость */
    --muted: #9fb8a6;
    /* шалфей */

    /* Деньги и состояния */
    --accent: #e3b45b;
    /* золото */
    --accent-dim: #c9963f;
    --gold: #e3b45b;
    --green: #5fd6a4;
    /* мятный выигрыш */
    --red: #e4685c;
    /* проигрыш / опасность (текст) */
    --red-pocket: #c0392f;
    /* красный сектор колеса */
    --zero-pocket: #2e9e63;
    /* зелёный сектор колеса */
    --pocket-black: #191c22;
    /* чёрный сектор колеса */
    --ink-on-gold: #143526;
    /* тёмный текст на золоте */

    --font-display: "Prata", Georgia, "Times New Roman", serif;
    --radius: 14px;
    --radius-sm: 10px;
    --nav-h: 60px;
}

* {
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

html,
body {
    margin: 0;
    padding: 0;
    min-height: 100%;
}

body {
    font-family: -apple-system, "SF Pro Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    color: var(--text);
    background: var(--bg);
    font-size: 15px;
    line-height: 1.45;
    overscroll-behavior: none;
    -webkit-font-smoothing: antialiased;
}

:focus-visible {
    outline: 2px solid var(--gold);
    outline-offset: 2px;
}

.app {
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    max-width: 640px;
    margin: 0 auto;
    padding-bottom: calc(var(--nav-h) + env(safe-area-inset-bottom, 0px));
}

/* ============================= Top bar ============================= */

.topbar {
    position: sticky;
    top: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 12px 16px;
    padding-top: calc(12px + env(safe-area-inset-top, 0px));
    background: var(--bg);
    border-bottom: 1px solid rgba(227, 180, 91, 0.28);
}

.brand {
    display: flex;
    align-items: center;
    gap: 8px;
}

.brand-name {
    font-family: var(--font-display);
    font-size: 21px;
    font-weight: 400;
    letter-spacing: 0.4px;
    line-height: 1;
}

.brand-name b {
    font-weight: 400;
    color: var(--gold);
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Баланс — фишка: золотой обод, тёмное поле, антиква в цифрах */
.balance-chip {
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 6px 14px 6px 11px;
    border-radius: 999px;
    background: var(--well);
    border: 1px solid rgba(227, 180, 91, 0.55);
    box-shadow: inset 0 0 0 3px rgba(227, 180, 91, 0.1);
}

.balance-coin {
    font-size: 15px;
    line-height: 1;
}

.balance-value {
    font-family: var(--font-display);
    font-size: 15px;
    color: var(--gold);
    font-variant-numeric: tabular-nums;
    line-height: 1;
}

.balance-cur {
    color: var(--muted);
    font-size: 12px;
    font-weight: 500;
    line-height: 1;
}

.icon-btn {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--card);
    color: var(--text);
    font-size: 17px;
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease;
}

.icon-btn:hover {
    background: var(--card-2);
    border-color: rgba(227, 180, 91, 0.35);
}

.icon-btn:active {
    background: var(--card-2);
}

/* ============================= Main / screens ============================= */

.main {
    flex: 1;
    padding: 18px 16px;
}

.screen.hidden {
    display: none;
}

.section-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    margin: 2px 0 14px;
}

.section-head h2 {
    margin: 0;
    font-family: var(--font-display);
    font-size: 23px;
    font-weight: 400;
    letter-spacing: 0.3px;
}

.link-btn {
    background: none;
    border: none;
    color: var(--muted);
    font-size: 14px;
    cursor: pointer;
    padding: 6px 8px;
    border-radius: var(--radius-sm);
    font-family: inherit;
}

.link-btn b {
    color: var(--gold);
    font-family: var(--font-display);
    font-weight: 400;
    font-size: 15px;
    font-variant-numeric: tabular-nums;
}

.link-btn:hover {
    background: var(--card);
    color: var(--text);
}

.footnote {
    color: var(--muted);
    font-size: 12px;
    text-align: center;
    margin: 18px 0 0;
}

/* ============================= Cards ============================= */

.card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
}

/* ============================= Games grid («столы» зала) ============================= */

.games-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}

.game-card {
    position: relative;
    border: 1px solid var(--border);
    border-radius: 16px;
    background: var(--card);
    padding: 20px 12px 16px;
    cursor: pointer;
    text-align: center;
    transition: border-color 0.15s ease, background 0.15s ease, transform 0.12s ease;
    overflow: hidden;
}

/* стёжка по сукну — золотой пунктирный кант стола */
.game-card::after {
    content: "";
    position: absolute;
    inset: 6px;
    border: 1px dashed var(--stitch);
    border-radius: 11px;
    pointer-events: none;
}

.game-card:hover {
    background: var(--card-2);
    border-color: rgba(227, 180, 91, 0.4);
}

.game-card:active {
    transform: scale(0.98);
}

.game-card.disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.game-card-emoji {
    font-size: 40px;
    line-height: 1;
    display: block;
    margin-bottom: 10px;
    position: relative;
}

.game-card-name {
    font-family: var(--font-display);
    font-weight: 400;
    font-size: 15px;
    letter-spacing: 0.3px;
    position: relative;
}

.game-card-tag {
    position: relative;
    display: inline-block;
    margin-top: 8px;
    font-size: 11px;
    color: var(--muted);
    padding: 3px 9px;
    border-radius: 999px;
    background: rgba(0, 0, 0, 0.28);
}

.game-card-badge {
    position: absolute;
    top: 12px;
    right: 12px;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.8px;
    color: var(--ink-on-gold);
    background: var(--gold);
    border-radius: 999px;
    padding: 3px 8px;
    z-index: 1;
}

/* ============================= Game screen ============================= */

.game-head {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 14px;
}

.game-title {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
    min-width: 0;
}

.game-emoji {
    font-size: 26px;
    line-height: 1;
}

.game-title h2 {
    margin: 0;
    font-family: var(--font-display);
    font-weight: 400;
    font-size: 20px;
    letter-spacing: 0.3px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.game-bet {
    font-family: var(--font-display);
    font-weight: 400;
    font-size: 15px;
    color: var(--gold);
    font-variant-numeric: tabular-nums;
    padding: 7px 14px;
    border-radius: 999px;
    background: var(--well);
    border: 1px solid rgba(227, 180, 91, 0.45);
    white-space: nowrap;
}

.game-layout {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.game-side {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.side-card h3 {
    margin: 0 0 10px;
    font-size: 13px;
    color: var(--muted);
    font-weight: 600;
}

/* Сцена — утопленный стол с мягким светом лампы над центром */
.game-stage {
    min-height: 320px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    position: relative;
    overflow: hidden;
    background: var(--well);
    background-image: radial-gradient(90% 70% at 50% 12%, rgba(241, 235, 219, 0.05), transparent 70%);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 18px 14px;
}

.game-stage::before {
    content: "";
    position: absolute;
    inset: 8px;
    border: 1px dashed var(--stitch);
    border-radius: 11px;
    pointer-events: none;
}

.game-info {
    font-size: 14px;
    color: var(--muted);
    line-height: 1.55;
}

.game-info b {
    color: var(--text);
}

/* ---- Mines ---- */

.mines-wrap {
    display: flex;
    flex-direction: column;
    gap: 14px;
    align-items: center;
    width: 100%;
}

.mines-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 8px;
    width: 100%;
    max-width: 380px;
}

.mine-cell {
    aspect-ratio: 1;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: var(--card-2);
    font-size: 22px;
    cursor: pointer;
    transition: transform 0.12s ease, background 0.2s ease, border-color 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: inherit;
    color: var(--text);
}

.mine-cell:hover {
    border-color: rgba(227, 180, 91, 0.4);
}

.mine-cell:active {
    transform: scale(0.93);
}

.mine-cell.revealed {
    background: rgba(95, 214, 164, 0.13);
    border-color: rgba(95, 214, 164, 0.5);
    cursor: default;
    animation: pop 0.25s ease;
}

.mine-cell.mine {
    background: rgba(228, 104, 92, 0.16);
    border-color: rgba(228, 104, 92, 0.6);
    animation: shake 0.4s ease;
}

.mine-cell.dim {
    opacity: 0.55;
}

@keyframes pop {
    0% {
        transform: scale(0.6);
    }

    60% {
        transform: scale(1.1);
    }

    100% {
        transform: scale(1);
    }
}

@keyframes shake {

    0%,
    100% {
        transform: translateX(0);
    }

    25% {
        transform: translateX(-5px);
    }

    50% {
        transform: translateX(5px);
    }

    75% {
        transform: translateX(-3px);
    }
}

.mines-status {
    display: flex;
    gap: 10px;
    width: 100%;
    max-width: 380px;
}

.stat-box {
    flex: 1;
    text-align: center;
    padding: 10px 8px;
    border-radius: 12px;
    background: rgba(0, 0, 0, 0.22);
    border: 1px solid var(--border);
}

.stat-box .label {
    font-size: 12px;
    color: var(--muted);
}

.stat-box .value {
    font-family: var(--font-display);
    font-size: 18px;
    font-variant-numeric: tabular-nums;
    margin-top: 3px;
}

.stat-box .value.gold {
    color: var(--gold);
}

.stat-box .value.green {
    color: var(--green);
}

.stat-box .value.red {
    color: var(--red);
}

/* ---- Roulette ---- */

.roulette-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
    width: 100%;
}

.wheel-box {
    position: relative;
    width: 240px;
    height: 240px;
}

/* золотой обод колеса */
.wheel {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    border: 4px solid rgba(227, 180, 91, 0.55);
    position: relative;
    transition: transform 4.2s cubic-bezier(0.15, 0.9, 0.25, 1);
    background: var(--well);
}

.wheel-num {
    position: absolute;
    left: 50%;
    top: 50%;
    width: 26px;
    height: 26px;
    margin: -13px 0 0 -13px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 700;
    border-radius: 50%;
    color: #fff3ec;
}

.wheel-num.red {
    background: var(--red-pocket);
}

.wheel-num.black {
    background: var(--pocket-black);
    border: 1px solid rgba(241, 235, 219, 0.25);
}

.wheel-num.green {
    background: var(--zero-pocket);
    color: #06251a;
}

.wheel-pointer {
    position: absolute;
    top: -10px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 20px;
    z-index: 2;
    color: var(--gold);
}

.wheel-hub {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: var(--card);
    border: 2px solid rgba(227, 180, 91, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    z-index: 1;
}

.roulette-result {
    min-height: 30px;
    font-size: 16px;
    font-weight: 600;
    text-align: center;
}

.roulette-result .num-red {
    color: var(--red);
}

.roulette-result .num-black {
    color: var(--text);
}

.roulette-result .num-green {
    color: var(--green);
}

.bet-types {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    width: 100%;
    max-width: 380px;
}

.bet-type-btn {
    padding: 10px 6px;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: rgba(0, 0, 0, 0.22);
    color: var(--text);
    font-weight: 600;
    font-size: 13px;
    cursor: pointer;
    transition: border-color 0.15s ease, background 0.15s ease;
    font-family: inherit;
}

.bet-type-btn:hover {
    border-color: rgba(227, 180, 91, 0.4);
}

.bet-type-btn.active {
    background: var(--gold);
    border-color: var(--gold);
    color: var(--ink-on-gold);
}

.bet-type-btn.red-opt {
    color: var(--red);
}

.bet-type-btn.black-opt {
    color: var(--text);
}

.bet-type-btn.red-opt.active,
.bet-type-btn.black-opt.active {
    color: var(--ink-on-gold);
}

.number-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 5px;
    width: 100%;
    max-width: 380px;
}

.number-btn {
    aspect-ratio: 1;
    border-radius: 8px;
    border: 1px solid rgba(241, 235, 219, 0.2);
    font-size: 12px;
    font-weight: 700;
    color: #fff3ec;
    cursor: pointer;
    background: var(--pocket-black);
    transition: transform 0.1s ease, border-color 0.15s ease;
    font-family: inherit;
}

.number-btn.red {
    background: var(--red-pocket);
    border-color: transparent;
}

.number-btn.green {
    background: var(--zero-pocket);
    color: #06251a;
    border-color: transparent;
}

.number-btn:hover {
    border-color: var(--gold);
}

.number-btn.active {
    outline: 2px solid var(--gold);
    outline-offset: 1px;
}

.number-btn:active {
    transform: scale(0.9);
}

/* ---- Dice ---- */

.dice-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 18px;
}

/* костяной кубик */
.dice {
    width: 104px;
    height: 104px;
    border-radius: 22px;
    background: var(--text);
    color: var(--ink-on-gold);
    font-size: 52px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: inset 0 -6px 12px rgba(20, 53, 38, 0.18), 0 4px 14px rgba(0, 0, 0, 0.3);
}

.dice.rolling {
    animation: tumble 0.5s ease infinite;
}

@keyframes tumble {
    0% {
        transform: rotate(0) translateY(0);
    }

    25% {
        transform: rotate(-14deg) translateY(-10px);
    }

    50% {
        transform: rotate(10deg) translateY(0);
    }

    75% {
        transform: rotate(-8deg) translateY(-6px);
    }

    100% {
        transform: rotate(0) translateY(0);
    }
}

.dice-hint {
    color: var(--muted);
    font-size: 14px;
}

/* ---- Russian roulette ---- */

.rr-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
}

.revolver {
    position: relative;
    width: 190px;
    height: 190px;
}

.revolver-drum {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    background: var(--card-2);
    border: 4px solid rgba(227, 180, 91, 0.45);
    transition: transform 1.6s cubic-bezier(0.2, 0.8, 0.3, 1);
}

.chamber {
    position: absolute;
    width: 34px;
    height: 34px;
    left: 50%;
    top: 50%;
    margin: -17px 0 0 -17px;
    border-radius: 50%;
    background: var(--well);
    border: 2px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
}

.chamber.loaded {
    border-color: rgba(228, 104, 92, 0.75);
}

.rr-hint {
    color: var(--muted);
    font-size: 14px;
    text-align: center;
}

/* ---- Simple games (tower / slots / fishing / ...) ---- */

.simple-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    text-align: center;
}

.simple-scene {
    width: 100%;
    max-width: 380px;
    min-height: 190px;
    border-radius: 16px;
    border: 1px solid var(--border);
    background: rgba(0, 0, 0, 0.22);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 14px;
    font-size: 42px;
    padding: 20px;
    flex-wrap: wrap;
}

.simple-scene .spin-reel {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 80px;
    height: 80px;
    border-radius: var(--radius-sm);
    background: var(--card);
    border: 1px solid var(--border);
    animation: reel 0.35s ease infinite;
}

@keyframes reel {
    0% {
        transform: translateY(-6px);
    }

    50% {
        transform: translateY(6px);
    }

    100% {
        transform: translateY(-6px);
    }
}

.simple-scene.win-flash {
    animation: winflash 0.9s ease;
}

@keyframes winflash {
    0% {
        border-color: var(--border);
    }

    30% {
        border-color: var(--green);
    }

    100% {
        border-color: var(--border);
    }
}

.simple-scene.lose-flash {
    animation: loseflash 0.7s ease;
}

@keyframes loseflash {
    0% {
        border-color: var(--border);
    }

    30% {
        border-color: var(--red);
    }

    100% {
        border-color: var(--border);
    }
}

.simple-caption {
    color: var(--muted);
    font-size: 14px;
    min-height: 20px;
}

/* ============================= Buttons ============================= */

.btn {
    border: none;
    border-radius: 12px;
    padding: 13px 20px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    color: var(--text);
    transition: transform 0.12s ease, filter 0.15s ease;
    font-family: inherit;
}

.btn:active {
    transform: scale(0.97);
}

.btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

/* Золото — главное действие и деньги */
.btn-primary,
.btn-gold {
    background: var(--gold);
    color: var(--ink-on-gold);
}

.btn-primary:hover,
.btn-gold:hover {
    filter: brightness(1.07);
}

.btn-success {
    background: var(--green);
    color: #06251a;
}

.btn-success:hover {
    filter: brightness(1.07);
}

.btn-danger {
    background: #c43a30;
    color: #fff3ec;
}

.btn-danger:hover {
    filter: brightness(1.08);
}

.btn-ghost {
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border);
    color: var(--text);
}

.btn-ghost:hover {
    border-color: rgba(227, 180, 91, 0.4);
}

.btn-block {
    width: 100%;
    max-width: 380px;
}

.btn-small {
    padding: 10px 16px;
    font-size: 14px;
}

/* ============================= Bet controls (фишки) ============================= */

.bet-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}

.bet-btn {
    padding: 12px 6px;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: rgba(0, 0, 0, 0.22);
    color: var(--text);
    font-weight: 600;
    font-size: 14px;
    font-variant-numeric: tabular-nums;
    cursor: pointer;
    transition: border-color 0.15s ease, background 0.15s ease;
    font-family: inherit;
}

.bet-btn:hover {
    border-color: rgba(227, 180, 91, 0.4);
}

.bet-btn.active {
    background: var(--gold);
    border-color: var(--gold);
    color: var(--ink-on-gold);
}

.bet-custom {
    display: flex;
    gap: 8px;
    margin-top: 10px;
}

.bet-custom input {
    flex: 1;
    padding: 12px 14px;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: rgba(0, 0, 0, 0.25);
    color: var(--text);
    font-size: 15px;
    font-family: inherit;
    outline: none;
    min-width: 0;
}

.bet-custom input:focus {
    border-color: var(--gold);
}

.bet-custom input::placeholder {
    color: var(--muted);
}

/* ============================= History ============================= */

.history-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.history-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    background: var(--card);
}

.history-item .h-emoji {
    font-size: 24px;
    line-height: 1;
}

.history-item .h-main {
    flex: 1;
    min-width: 0;
}

.history-item .h-game {
    font-weight: 600;
    font-size: 14px;
}

.history-item .h-sub {
    color: var(--muted);
    font-size: 12px;
    margin-top: 2px;
}

.history-item .h-amount {
    font-family: var(--font-display);
    font-weight: 400;
    font-size: 15px;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.history-item .h-amount.win {
    color: var(--green);
}

.history-item .h-amount.lose {
    color: var(--red);
}

.history-empty {
    text-align: center;
    color: var(--muted);
    padding: 30px 0;
}

/* ============================= Profile ============================= */

.profile-grid {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.profile-card {
    text-align: center;
}

.avatar {
    width: 68px;
    height: 68px;
    margin: 0 auto 10px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    background: var(--card-2);
    border: 1px solid rgba(227, 180, 91, 0.4);
}

.profile-name {
    font-family: var(--font-display);
    font-weight: 400;
    font-size: 18px;
    letter-spacing: 0.3px;
}

.profile-id {
    color: var(--muted);
    font-size: 13px;
    margin-top: 3px;
}

.vip-badge {
    display: inline-block;
    margin-top: 10px;
    padding: 4px 12px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
    background: rgba(227, 180, 91, 0.12);
    border: 1px solid rgba(227, 180, 91, 0.45);
    color: var(--gold);
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
}

.stat-cell {
    padding: 12px;
    border-radius: 12px;
    background: rgba(0, 0, 0, 0.22);
    border: 1px solid var(--border);
    text-align: center;
}

.stat-cell .label {
    font-size: 12px;
    color: var(--muted);
}

.stat-cell .value {
    font-family: var(--font-display);
    font-size: 16px;
    margin-top: 4px;
    font-variant-numeric: tabular-nums;
}

.wallet-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 2px;
    border-bottom: 1px solid var(--border);
    font-size: 14px;
}

.wallet-row:last-of-type {
    border-bottom: none;
}

.wallet-row b {
    font-family: var(--font-display);
    font-weight: 400;
    font-size: 15px;
    font-variant-numeric: tabular-nums;
}

/* ============================= Bottom nav ============================= */

.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: 640px;
    height: calc(var(--nav-h) + env(safe-area-inset-bottom, 0px));
    padding-bottom: env(safe-area-inset-bottom, 0px);
    display: flex;
    background: var(--bg-2);
    border-top: 1px solid rgba(227, 180, 91, 0.25);
    z-index: 30;
}

.nav-btn {
    flex: 1;
    border: none;
    background: none;
    color: var(--muted);
    font-size: 12px;
    font-weight: 500;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    cursor: pointer;
    font-family: inherit;
    transition: color 0.15s ease;
}

.nav-btn span {
    font-size: 20px;
    line-height: 1;
}

/* точка-индикатор под активным разделом */
.nav-btn::after {
    content: "";
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: transparent;
    margin-top: 1px;
}

.nav-btn.active {
    color: var(--gold);
}

.nav-btn.active::after {
    background: var(--gold);
}

/* ============================= Modal ============================= */

.modal {
    position: fixed;
    inset: 0;
    z-index: 50;
    display: flex;
    align-items: flex-end;
    justify-content: center;
}

.modal.hidden {
    display: none;
}

.modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(4, 20, 14, 0.7);
}

.modal-box {
    position: relative;
    width: 100%;
    max-width: 640px;
    border-radius: 18px 18px 0 0;
    padding: 20px;
    animation: slideup 0.25s ease;
    background: var(--card);
    border: 1px solid var(--border);
    border-bottom: none;
}

@keyframes slideup {
    from {
        transform: translateY(40px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-box h3 {
    margin: 0 0 14px;
    font-family: var(--font-display);
    font-weight: 400;
    font-size: 19px;
    letter-spacing: 0.3px;
}

.hint {
    color: var(--muted);
    font-size: 12px;
    margin: 10px 0 0;
}

/* ============================= Toasts ============================= */

.toast-container {
    position: fixed;
    top: calc(70px + env(safe-area-inset-top, 0px));
    left: 50%;
    transform: translateX(-50%);
    z-index: 60;
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: min(92vw, 420px);
    pointer-events: none;
}

.toast {
    padding: 12px 16px;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 500;
    background: var(--card-2);
    border: 1px solid var(--border);
    border-left: 3px solid var(--muted);
    animation: toastin 0.25s ease;
}

.toast.error {
    border-left-color: var(--red);
}

.toast.success {
    border-left-color: var(--green);
}

@keyframes toastin {
    from {
        transform: translateY(-12px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* ============================= Gate ============================= */

.gate {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 60vh;
}

.gate-box {
    text-align: center;
    max-width: 320px;
    width: 100%;
}

.gate-box p {
    color: var(--muted);
}

.gate-spinner {
    width: 36px;
    height: 36px;
    margin: 0 auto 14px;
    border-radius: 50%;
    border: 3px solid var(--border);
    border-top-color: var(--gold);
    animation: spin 0.9s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* ============================= Desktop ============================= */

@media (min-width: 900px) {
    .app {
        max-width: 1100px;
    }

    .bottom-nav {
        max-width: 1100px;
        height: 58px;
        padding-bottom: 0;
    }

    .main {
        padding: 26px 32px 34px;
    }

    .games-grid {
        grid-template-columns: repeat(5, 1fr);
        gap: 12px;
    }

    .game-card {
        padding: 24px 14px 18px;
    }

    .game-card-emoji {
        font-size: 46px;
    }

    .game-layout {
        flex-direction: row;
        align-items: flex-start;
    }

    .game-stage {
        flex: 1;
        min-height: 460px;
    }

    .game-side {
        width: 300px;
        flex-shrink: 0;
    }

    .mines-grid {
        max-width: 440px;
    }

    .wheel-box {
        width: 300px;
        height: 300px;
    }

    .profile-grid {
        display: grid;
        grid-template-columns: 300px 1fr;
        align-items: start;
    }

    .wallets-card {
        grid-column: 1 / -1;
    }

    .modal {
        align-items: center;
    }

    .modal-box {
        border-radius: 18px;
        max-width: 460px;
        border-bottom: 1px solid var(--border);
    }
}

@media (min-width: 640px) and (max-width: 899px) {
    .games-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* Small phones */
@media (max-width: 360px) {
    .games-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }

    .game-card-emoji {
        font-size: 32px;
    }

    .wheel-box {
        width: 200px;
        height: 200px;
    }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {

    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
}