/* ============================================================
   EasyWin Mini App — dark casino theme
   Mobile-first; desktop enhancements at >=900px.
   ============================================================ */

:root {
    --bg: #0a0d1c;
    --bg-2: #10142a;
    --card: rgba(255, 255, 255, 0.045);
    --card-solid: #161b33;
    --border: rgba(255, 255, 255, 0.09);
    --text: #eef0ff;
    --muted: #9aa0c3;
    --accent: #7c5cff;
    --accent-2: #22d3ee;
    --gold: #f5c542;
    --green: #34d399;
    --red: #ff4d67;
    --radius: 16px;
    --radius-sm: 10px;
    --shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
    --nav-h: 62px;
}

* {
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

html,
body {
    margin: 0;
    padding: 0;
    min-height: 100%;
}

body {
    font-family: "SF Pro Display", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    color: var(--text);
    background:
        radial-gradient(900px 500px at 85% -10%, rgba(124, 92, 255, 0.22), transparent 60%),
        radial-gradient(700px 420px at -10% 15%, rgba(34, 211, 238, 0.14), transparent 55%),
        radial-gradient(800px 600px at 50% 110%, rgba(245, 197, 66, 0.08), transparent 60%),
        linear-gradient(180deg, var(--bg) 0%, var(--bg-2) 100%);
    background-attachment: fixed;
    overscroll-behavior: none;
}

.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: rgba(10, 13, 28, 0.75);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border-bottom: 1px solid var(--border);
}

.brand {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 18px;
}

.brand-icon {
    font-size: 22px;
}

.brand-name {
    font-weight: 300;
    letter-spacing: 0.4px;
}

.brand-name b {
    font-weight: 800;
    color: var(--gold);
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.balance-chip {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    border-radius: 999px;
    background: linear-gradient(135deg, rgba(124, 92, 255, 0.25), rgba(34, 211, 238, 0.15));
    border: 1px solid rgba(124, 92, 255, 0.45);
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.balance-coin {
    font-size: 15px;
}

.balance-cur {
    color: var(--muted);
    font-weight: 500;
}

.icon-btn {
    width: 38px;
    height: 38px;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: var(--card);
    color: var(--text);
    font-size: 18px;
    cursor: pointer;
    transition: transform 0.15s ease, background 0.15s ease;
}

.icon-btn:hover {
    background: rgba(255, 255, 255, 0.1);
}

.icon-btn:active {
    transform: scale(0.92);
}

/* ============================= Main / screens ============================= */

.main {
    flex: 1;
    padding: 16px;
}

.screen.hidden {
    display: none;
}

.hero {
    position: relative;
    overflow: hidden;
    border-radius: 20px;
    padding: 22px 20px;
    margin-bottom: 18px;
    background: linear-gradient(135deg, rgba(124, 92, 255, 0.35), rgba(34, 211, 238, 0.18));
    border: 1px solid rgba(124, 92, 255, 0.4);
    box-shadow: var(--shadow);
}

.hero h1 {
    margin: 0 0 6px;
    font-size: 24px;
    line-height: 1.2;
}

.hero p {
    margin: 0;
    color: var(--muted);
    font-size: 14px;
}

.hero-glow {
    position: absolute;
    right: -40px;
    top: -40px;
    width: 160px;
    height: 160px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(245, 197, 66, 0.35), transparent 70%);
    filter: blur(6px);
}

.section-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin: 6px 2px 12px;
}

.section-head h2 {
    margin: 0;
    font-size: 18px;
}

.link-btn {
    background: none;
    border: none;
    color: var(--muted);
    font-size: 14px;
    cursor: pointer;
    padding: 6px 8px;
    border-radius: 8px;
}

.link-btn b {
    color: var(--gold);
}

.link-btn:hover {
    background: var(--card);
    color: var(--text);
}

/* ============================= Cards ============================= */

.card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

/* ============================= Games grid ============================= */

.games-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

.game-card {
    position: relative;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: linear-gradient(160deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.02));
    padding: 18px 14px 14px;
    cursor: pointer;
    text-align: center;
    transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
    overflow: hidden;
}

.game-card::before {
    content: "";
    position: absolute;
    inset: 0;
    background: radial-gradient(120px 80px at 50% 0%, var(--glow, rgba(124, 92, 255, 0.25)), transparent 75%);
    opacity: 0.8;
    pointer-events: none;
}

.game-card:hover {
    transform: translateY(-3px);
    border-color: rgba(124, 92, 255, 0.55);
    box-shadow: var(--shadow);
}

.game-card:active {
    transform: scale(0.97);
}

.game-card.disabled {
    opacity: 0.45;
    cursor: not-allowed;
    filter: grayscale(0.6);
}

.game-card-emoji {
    font-size: 42px;
    display: block;
    margin-bottom: 8px;
    position: relative;
}

.game-card-name {
    font-weight: 700;
    font-size: 15px;
    position: relative;
}

.game-card-tag {
    position: relative;
    display: inline-block;
    margin-top: 6px;
    font-size: 11px;
    color: var(--muted);
    border: 1px solid var(--border);
    padding: 2px 8px;
    border-radius: 999px;
}

.game-card-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.5px;
    color: #0a0d1c;
    background: var(--gold);
    border-radius: 999px;
    padding: 3px 8px;
}

/* ============================= 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;
}

.game-emoji {
    font-size: 28px;
}

.game-title h2 {
    margin: 0;
    font-size: 20px;
}

.game-bet {
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    padding: 8px 12px;
    border-radius: 12px;
    background: var(--card);
    border: 1px solid var(--border);
}

.game-layout {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.game-side {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.side-card h3 {
    margin: 0 0 10px;
    font-size: 14px;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.6px;
}

.game-stage {
    min-height: 320px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    position: relative;
    overflow: hidden;
}

.game-info {
    font-size: 14px;
    color: var(--muted);
    line-height: 1.6;
}

.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: linear-gradient(160deg, rgba(255, 255, 255, 0.07), rgba(255, 255, 255, 0.02));
    font-size: 24px;
    cursor: pointer;
    transition: transform 0.12s ease, background 0.2s ease, border-color 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.mine-cell:hover {
    border-color: rgba(124, 92, 255, 0.6);
}

.mine-cell:active {
    transform: scale(0.93);
}

.mine-cell.revealed {
    background: linear-gradient(160deg, rgba(52, 211, 153, 0.18), rgba(52, 211, 153, 0.05));
    border-color: rgba(52, 211, 153, 0.5);
    cursor: default;
    animation: pop 0.25s ease;
}

.mine-cell.mine {
    background: linear-gradient(160deg, rgba(255, 77, 103, 0.25), rgba(255, 77, 103, 0.08));
    border-color: rgba(255, 77, 103, 0.6);
    animation: shake 0.4s ease;
}

.mine-cell.dim {
    opacity: 0.55;
}

@keyframes pop {
    0% {
        transform: scale(0.6);
    }

    60% {
        transform: scale(1.12);
    }

    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: var(--card);
    border: 1px solid var(--border);
}

.stat-box .label {
    font-size: 11px;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-box .value {
    font-size: 18px;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
    margin-top: 2px;
}

.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(245, 197, 66, 0.65);
    position: relative;
    transition: transform 4.2s cubic-bezier(0.15, 0.9, 0.25, 1);
    box-shadow: 0 0 40px rgba(124, 92, 255, 0.35), inset 0 0 30px rgba(0, 0, 0, 0.6);
    background: conic-gradient(rgba(124, 92, 255, 0.16) 0deg, rgba(34, 211, 238, 0.12) 90deg,
            rgba(124, 92, 255, 0.16) 180deg, rgba(34, 211, 238, 0.12) 270deg, rgba(124, 92, 255, 0.16) 360deg);
}

.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: #fff;
}

.wheel-num.red {
    background: var(--red);
}

.wheel-num.black {
    background: #23263d;
    border: 1px solid var(--border);
}

.wheel-num.green {
    background: var(--green);
    color: #06281c;
}

.wheel-pointer {
    position: absolute;
    top: -10px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 22px;
    z-index: 2;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.6));
}

.wheel-hub {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: linear-gradient(135deg, #1b2040, #10142a);
    border: 2px solid rgba(245, 197, 66, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 26px;
    z-index: 1;
}

.roulette-result {
    min-height: 30px;
    font-size: 17px;
    font-weight: 700;
    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: 12px;
    border: 1px solid var(--border);
    background: var(--card);
    color: var(--text);
    font-weight: 600;
    font-size: 13px;
    cursor: pointer;
    transition: border-color 0.15s ease, background 0.15s ease;
}

.bet-type-btn:hover {
    border-color: rgba(124, 92, 255, 0.6);
}

.bet-type-btn.active {
    background: linear-gradient(135deg, rgba(124, 92, 255, 0.4), rgba(34, 211, 238, 0.25));
    border-color: var(--accent);
}

.bet-type-btn.red-opt {
    color: var(--red);
}

.bet-type-btn.black-opt {
    color: var(--text);
}

.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 var(--border);
    font-size: 12px;
    font-weight: 700;
    color: #fff;
    cursor: pointer;
    background: #23263d;
    transition: transform 0.1s ease, border-color 0.15s ease;
}

.number-btn.red {
    background: var(--red);
}

.number-btn.green {
    background: var(--green);
    color: #06281c;
}

.number-btn:hover {
    border-color: var(--gold);
}

.number-btn.active {
    outline: 2px solid var(--gold);
}

.number-btn:active {
    transform: scale(0.9);
}

/* ---- Dice ---- */

.dice-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 18px;
}

.dice {
    width: 110px;
    height: 110px;
    border-radius: 22px;
    background: linear-gradient(145deg, #ffffff, #d7dcef);
    color: #1c2040;
    font-size: 54px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 14px 30px rgba(0, 0, 0, 0.5), inset 0 -6px 12px rgba(0, 0, 0, 0.12);
}

.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: radial-gradient(circle at 35% 30%, #3a4066, #171b33 70%);
    border: 4px solid rgba(245, 197, 66, 0.4);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.55);
    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: #0c0f20;
    border: 2px solid rgba(255, 255, 255, 0.14);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
}

.chamber.loaded {
    border-color: rgba(255, 77, 103, 0.7);
}

.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:
        radial-gradient(300px 160px at 50% 100%, rgba(124, 92, 255, 0.18), transparent 70%),
        var(--card-solid);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 14px;
    font-size: 44px;
    padding: 20px;
    flex-wrap: wrap;
}

.simple-scene .spin-reel {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 84px;
    height: 84px;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.05);
    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% {
        box-shadow: 0 0 0 rgba(52, 211, 153, 0);
    }

    30% {
        box-shadow: 0 0 45px rgba(52, 211, 153, 0.55);
    }

    100% {
        box-shadow: 0 0 0 rgba(52, 211, 153, 0);
    }
}

.simple-scene.lose-flash {
    animation: loseflash 0.7s ease;
}

@keyframes loseflash {
    0% {
        box-shadow: 0 0 0 rgba(255, 77, 103, 0);
    }

    30% {
        box-shadow: 0 0 45px rgba(255, 77, 103, 0.5);
    }

    100% {
        box-shadow: 0 0 0 rgba(255, 77, 103, 0);
    }
}

.simple-caption {
    color: var(--muted);
    font-size: 14px;
    min-height: 20px;
}

/* ============================= Buttons ============================= */

.btn {
    border: none;
    border-radius: 14px;
    padding: 14px 22px;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    color: #fff;
    transition: transform 0.12s ease, filter 0.15s ease, opacity 0.15s ease;
    font-family: inherit;
}

.btn:active {
    transform: scale(0.96);
}

.btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent), #5a3df0);
    box-shadow: 0 8px 24px rgba(124, 92, 255, 0.4);
}

.btn-primary:hover {
    filter: brightness(1.1);
}

.btn-success {
    background: linear-gradient(135deg, #2fbf7f, #1d9e63);
    box-shadow: 0 8px 24px rgba(52, 211, 153, 0.35);
}

.btn-success:hover {
    filter: brightness(1.1);
}

.btn-danger {
    background: linear-gradient(135deg, #ff5d73, #d63a52);
    box-shadow: 0 8px 24px rgba(255, 77, 103, 0.3);
}

.btn-gold {
    background: linear-gradient(135deg, #f7d060, #e0a92e);
    color: #241c04;
    box-shadow: 0 8px 24px rgba(245, 197, 66, 0.35);
}

.btn-ghost {
    background: var(--card);
    border: 1px solid var(--border);
    color: var(--text);
}

.btn-block {
    width: 100%;
    max-width: 380px;
}

.btn-small {
    padding: 10px 16px;
    font-size: 14px;
    border-radius: 12px;
}

/* ============================= Bet controls ============================= */

.bet-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}

.bet-btn {
    padding: 12px 6px;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: var(--card);
    color: var(--text);
    font-weight: 700;
    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(124, 92, 255, 0.6);
}

.bet-btn.active {
    background: linear-gradient(135deg, rgba(124, 92, 255, 0.4), rgba(34, 211, 238, 0.25));
    border-color: var(--accent);
}

.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(--accent);
}

/* ============================= History ============================= */

.history-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.history-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    border-radius: 14px;
    border: 1px solid var(--border);
    background: var(--card);
}

.history-item .h-emoji {
    font-size: 26px;
}

.history-item .h-main {
    flex: 1;
    min-width: 0;
}

.history-item .h-game {
    font-weight: 700;
    font-size: 14px;
}

.history-item .h-sub {
    color: var(--muted);
    font-size: 12px;
    margin-top: 2px;
}

.history-item .h-amount {
    font-weight: 800;
    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: 14px;
}

.profile-card {
    text-align: center;
}

.avatar {
    width: 72px;
    height: 72px;
    margin: 0 auto 10px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 34px;
    background: linear-gradient(135deg, rgba(124, 92, 255, 0.5), rgba(34, 211, 238, 0.3));
    border: 2px solid rgba(124, 92, 255, 0.6);
}

.profile-name {
    font-weight: 800;
    font-size: 18px;
}

.profile-id {
    color: var(--muted);
    font-size: 13px;
    margin-top: 2px;
}

.vip-badge {
    display: inline-block;
    margin-top: 10px;
    padding: 5px 14px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
    background: linear-gradient(135deg, rgba(245, 197, 66, 0.25), rgba(245, 197, 66, 0.1));
    border: 1px solid rgba(245, 197, 66, 0.5);
    color: var(--gold);
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}

.stat-cell {
    padding: 12px;
    border-radius: 12px;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border);
    text-align: center;
}

.stat-cell .label {
    font-size: 11px;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-cell .value {
    font-size: 17px;
    font-weight: 800;
    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-child {
    border-bottom: none;
}

.wallet-row b {
    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: rgba(13, 16, 34, 0.92);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-top: 1px solid var(--border);
    z-index: 30;
}

.nav-btn {
    flex: 1;
    border: none;
    background: none;
    color: var(--muted);
    font-size: 12px;
    font-weight: 600;
    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;
}

.nav-btn.active {
    color: var(--text);
}

.nav-btn.active span {
    filter: drop-shadow(0 0 8px rgba(124, 92, 255, 0.8));
}

/* ============================= 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(5, 7, 16, 0.7);
    backdrop-filter: blur(4px);
}

.modal-box {
    position: relative;
    width: 100%;
    max-width: 640px;
    border-radius: 20px 20px 0 0;
    padding: 20px;
    animation: slideup 0.25s ease;
    background: var(--card-solid);
}

@keyframes slideup {
    from {
        transform: translateY(40px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-box h3 {
    margin: 0 0 14px;
}

.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: 14px;
    font-size: 14px;
    font-weight: 600;
    background: rgba(22, 27, 51, 0.95);
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
    animation: toastin 0.25s ease;
}

.toast.error {
    border-color: rgba(255, 77, 103, 0.6);
}

.toast.success {
    border-color: rgba(52, 211, 153, 0.6);
}

@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: 44px;
    height: 44px;
    margin: 0 auto 14px;
    border-radius: 50%;
    border: 4px solid rgba(124, 92, 255, 0.25);
    border-top-color: var(--accent);
    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: 24px 32px 32px;
    }

    .hero {
        padding: 30px 28px;
    }

    .hero h1 {
        font-size: 30px;
    }

    .games-grid {
        grid-template-columns: repeat(5, 1fr);
        gap: 16px;
    }

    .game-card {
        padding: 24px 16px 16px;
    }

    .game-card-emoji {
        font-size: 50px;
    }

    .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: 20px;
        max-width: 460px;
    }
}

@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: 34px;
    }

    .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;
    }
}