:root {
    --bg-color: #0b0e11;
    --card-bg: #151a21;
    --primary-blue: #0088cc;
    --accent-blue: #2c9aff;
    --text-color: #ffffff;
    --text-secondary: #7f8fa4;
    --danger-red: #ff3b30;
    --success-green: #34c759;
    --nav-height: 60px;
}

* {
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
}

input,
textarea,
select {
    user-select: text;
    -webkit-user-select: text;
    -moz-user-select: text;
    -ms-user-select: text;
    pointer-events: auto;
}

input:disabled,
textarea:disabled,
select:disabled {
    pointer-events: none;
}

img {
    pointer-events: none;
    -webkit-user-drag: none;
    -webkit-touch-callout: none;
}

body,
html {
    margin: 0;
    padding: 0;
    font-family: 'Outfit', sans-serif;
    background-color: #0b0e14;
    color: #fff;
    height: var(--app-h, 100vh);
    width: 100vw;
    overflow: hidden;
}

.app-container {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    position: relative;
    background-color: var(--bg-color);
    overflow: hidden;
}

.betting-sheet {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    margin: 0 auto;
    width: 100%;
    max-width: 480px;
    background: linear-gradient(180deg, #1c2533 0%, #151a21 100%);
    border-radius: 24px 24px 0 0;
    padding: 0;
    box-sizing: border-box;
    z-index: 10060;
    transform: translateY(100%);
    transition: transform 0.35s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    border-top: 2px solid rgba(0, 136, 204, 0.3);
    box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.6);
    overflow: hidden;
    padding-bottom: calc(12px + var(--tg-safe-area-inset-bottom, env(safe-area-inset-bottom, 0px)));
}

.auto-cashout-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-top: 8px;
    margin-bottom: 12px;
    padding: 12px 14px;
    border-radius: 16px;
    background: linear-gradient(180deg, rgba(40, 45, 55, 0.8) 0%, rgba(30, 35, 45, 0.8) 100%);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.auto-cashout-toggle {
    position: relative;
    width: 44px;
    height: 24px;
    display: inline-block;
    flex-shrink: 0;
}

.auto-cashout-toggle input {
    display: none;
}

.auto-cashout-toggle .toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 24px;
    transition: 0.3s;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.auto-cashout-toggle .toggle-slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 2px;
    bottom: 2px;
    background: #fff;
    border-radius: 50%;
    transition: 0.3s;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.auto-cashout-toggle input:checked + .toggle-slider {
    background: rgba(76, 217, 100, 0.8);
    border-color: rgba(76, 217, 100, 1);
}

.auto-cashout-toggle input:checked + .toggle-slider:before {
    transform: translateX(20px);
}

.auto-cashout-toggle input:not(:checked) + .toggle-slider {
    background: rgba(255, 255, 255, 0.1);
}

.betting-sheet:not(.hidden) {
    transform: translateY(0);
}

.betting-sheet.hidden {
    transform: translateY(100%);
}

.betting-sheet .sheet-header {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 12px 20px 20px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    position: relative;
}

.betting-sheet .sheet-header::before {
    content: '';
    position: absolute;
    top: 8px;
    left: 50%;
    transform: translateX(-50%);
    width: 40px;
    height: 4px;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 2px;
}

.betting-sheet .sheet-header .close-sheet-btn {
    position: absolute;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
}

.sheet-header {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 8px 20px 16px 20px;
    position: relative;
}

.sheet-header h3 {
    margin: 0;
    font-size: 1.3rem;
    font-weight: 700;
    color: #fff;
}

.close-sheet-btn {
    position: absolute;
    right: 0;
    background: rgba(255, 255, 255, 0.05);
    border: none;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: rgba(255, 255, 255, 0.5);
    font-size: 1.4rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.close-sheet-btn:active {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    transform: scale(0.9);
}

.betting-sheet .sheet-body {
    padding: 0 20px 20px 20px;
    padding-bottom: calc(20px + var(--tg-safe-area-inset-bottom, env(safe-area-inset-bottom, 0px)));
}

.input-group {
    margin-bottom: 20px;
}

#bet-input {
    width: 100%;
    background: linear-gradient(180deg, rgba(40, 45, 55, 0.95) 0%, rgba(30, 35, 45, 0.95) 100%);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 999px;
    color: #fff;
    padding: 14px 16px;
    font-size: 1.3rem;
    text-align: center;
    font-family: 'Inter', sans-serif;
    font-weight: 800;
    letter-spacing: 0.5px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2), inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

#bet-input:focus {
    outline: none;
    border-color: rgba(0, 136, 204, 0.5);
}

#bet-input:focus {
    outline: none;
}

.quick-amounts {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.quick-btn {
    flex: 1;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: rgba(255, 255, 255, 0.7);
    padding: 12px;
    border-radius: 12px;
    cursor: pointer;
    font-family: 'Inter', sans-serif;
    font-weight: 600;
    transition: all 0.2s ease;
}

.quick-btn:active {
    background: rgba(0, 136, 204, 0.2);
    border-color: rgba(0, 136, 204, 0.3);
    color: #fff;
    transform: scale(0.96);
}

.confirm-bet-btn {
    width: 100%;
    background: linear-gradient(135deg, #0088cc 0%, #006699 100%);
    color: #fff;
    border: none;
    padding: 16px;
    border-radius: 14px;
    font-size: 1rem;
    font-weight: 700;
    text-transform: uppercase;
    box-shadow: 0 4px 20px rgba(0, 136, 204, 0.3);
    cursor: pointer;
    transition: all 0.2s ease;
}

.confirm-bet-btn:active {
    transform: scale(0.98);
    box-shadow: 0 2px 10px rgba(0, 136, 204, 0.3);
}

.multiplier-control {
    display: flex;
    align-items: center;
    gap: 6px;
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 999px;
    padding: 6px 10px;
    flex: 1;
}

.multiplier-btn {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: #fff;
    font-size: 1.1rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    flex-shrink: 0;
    user-select: none;
}

.multiplier-btn:active {
    background: rgba(0, 136, 204, 0.5);
    transform: scale(0.9);
}

.multiplier-display {
    flex: 1;
    text-align: center;
    color: #ffffff;
    font-size: 1.2rem;
    font-weight: 800;
    font-family: 'Inter', sans-serif;
    min-width: 50px;
}

.top-bar {
    display: flex;
    justify-content: space-between;
    padding: 12px 16px;
    position: absolute;
    top: 12px;
    left: 0;
    right: 0;
    z-index: 20;
    background: transparent;
    border-bottom: none;
    box-shadow: none;
}

.online-users {
    background: transparent;
    backdrop-filter: none;
    padding: 0px 4px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.85rem;
    font-weight: 600;
    color: #4cd964;
    border: none;
}

.online-dot {
    width: 8px;
    height: 8px;
    background-color: #4cd964;
    border-radius: 50%;
    box-shadow: 0 0 5px #4cd964;
}

.balance-container {
    background: transparent;
    backdrop-filter: none;
    padding: 6px 6px 6px 10px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
    border: none;
}

.ton-icon-small {
    width: 14px;
    height: 14px;
    object-fit: contain;
}

.add-funds-btn {
    background: var(--primary-blue);
    border: none;
    border-radius: 8px;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    cursor: pointer;
}

.history-bar {
    position: relative;
    width: 100%;
    height: 44px;
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 16px;
    overflow-x: auto;
    scrollbar-width: none;
    z-index: 15;
    background: transparent;
    margin-bottom: 0;
    margin-top: -80px;
}

.history-bar::-webkit-scrollbar {
    display: none;
}

.history-pill {
    padding: 2px 0;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 600;
    background-color: #1e2530;
    color: #a5bddc;
    white-space: nowrap;
    border: 1px solid rgba(255, 255, 255, 0.03);
    width: 36px;
    height: 32px;
    min-width: 36px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.live-pill {
    flex: 0 0 auto;
    min-width: 44px;
    height: 32px;
    padding: 2px 8px;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 700;
    display: flex;
    justify-content: center;
    align-items: center;
    white-space: nowrap;
    color: #0088cc;
    background: rgba(0, 136, 204, 0.12);
    border: 1px solid rgba(0, 136, 204, 0.25);
    box-shadow: 0 0 8px rgba(0, 136, 204, 0.15);
    transition: color 0.4s ease, background 0.4s ease, border-color 0.4s ease, box-shadow 0.4s ease, min-width 0.3s ease;
    font-family: 'Outfit', sans-serif;
    position: relative;
    overflow: hidden;
}

.live-pill .lp-text {
    display: inline-block;
    transition: opacity 0.18s ease, transform 0.18s ease;
}

.live-pill .lp-text.out {
    opacity: 0;
    transform: scale(0.7) translateY(3px);
}

.live-pill .lp-text.in {
    opacity: 1;
    transform: scale(1) translateY(0);
    transition: opacity 0.22s ease, transform 0.22s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.live-pill.crashed {
    animation: pillShake 0.35s cubic-bezier(.36,.07,.19,.97) both;
}

.settings-btn {
    margin-left: auto;
    background: rgba(255, 255, 255, 0.05);
    padding: 6px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    color: var(--text-secondary);
}

.game-stage {
    flex: 1;
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background: radial-gradient(circle at center, #131820 0%, #060709 100%);
    overflow: hidden;
    perspective: 1000px;
    padding-top: 20px;
    padding-bottom: 80px;
}

.scanlines,
.noise {
    display: none;
}

.star-field {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
}

.meteor {
    position: absolute;
    width: 100px;
    height: 2px;
    background: linear-gradient(90deg, rgba(255, 255, 255, 1) 0%, rgba(255, 255, 255, 0) 100%);
    transform: rotate(-45deg);
    opacity: 0;
    z-index: 0;
    pointer-events: none;
    animation: meteor-fall 2s linear forwards;
}

.floating-planet {
    position: absolute;
    pointer-events: none;
    z-index: 4;
    left: 0;
    top: 0;
    will-change: transform;
}

.p-sphere {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    position: relative;
    overflow: hidden;
}

.p-detail {
    position: absolute;
    border-radius: 50%;
    pointer-events: none;
}

.p-rings-wrap {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    pointer-events: none;
}

.p-ring {
    position: absolute;
    top: 50%;
    left: 50%;
    border-radius: 50%;
    border-style: solid;
}

.p-orbit {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    pointer-events: none;
}

.p-moon {
    position: absolute;
    border-radius: 50%;
    pointer-events: none;
    animation: moonOrbit var(--orbit-dur) linear infinite;
}

.multiplier-graph {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 3;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.multiplier-graph.active {
    opacity: 1;
}

.countdown-display {
    position: absolute;
    top: 48%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 20;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    transition: opacity 0.3s ease, transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.countdown-display:not(.hidden) {
    animation: countdownAppear 0.3s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.countdown-text {
    font-size: 1rem;
    color: var(--text-secondary);
    letter-spacing: 2px;
    margin-bottom: 20px;
    text-transform: uppercase;
}

.circular-timer {
    position: relative;
    width: 150px;
    height: 150px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.circular-timer svg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    transform: rotate(-90deg);
    overflow: visible;
}

.circular-timer-bg {
    fill: none;
    stroke: rgba(0, 136, 204, 0.2);
    stroke-width: 8;
}

.circular-timer-progress {
    fill: none;
    stroke: #0088cc;
    stroke-width: 8;
    stroke-linecap: round;
    transition: stroke-dashoffset 1s linear, stroke 0.15s ease;
    will-change: stroke-dashoffset;
    filter: drop-shadow(0 0 12px currentColor);
}

.countdown-number {
    font-size: 4rem;
    font-weight: 800;
    color: #fff;
    text-shadow: 0 0 30px rgba(0, 136, 204, 0.8), 0 0 60px rgba(0, 136, 204, 0.4);
    font-family: 'Outfit', sans-serif;
    position: relative;
    z-index: 1;
    transition: color 0.15s ease, text-shadow 0.15s ease;
}

@media (max-width: 400px) {
.circular-timer {
        width: 144px;
        height: 144px;
    }

.countdown-number {
        font-size: 3.2rem;
    }
}

.countdown-display.hidden {
    display: none;
}

.rocket-container {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    width: 120px;
    height: 120px;
    z-index: 5;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: transform 0.5s ease-out;
}

.rocket-container::before {
    content: '';
    position: absolute;
    width: 136px;
    height: 136px;
    background: radial-gradient(circle, rgba(255, 149, 0, 0.12) 0%, rgba(255, 120, 0, 0.06) 30%, transparent 60%);
    border-radius: 50%;
    z-index: -1;
    pointer-events: none;
}

.rocket-container.hidden {
    display: none;
}

#rocket-lottie {
    width: 100%;
    height: 100%;
}

.explosion-container {
    position: absolute;
    top: 52%;
    left: 45%;
    transform: translate(-50%, -50%);
    width: 155px;
    height: 155px;
    z-index: 50;
    pointer-events: none;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    transition: opacity 0.1s ease-in;
}

.explosion-container.show {
    opacity: 1;
}

.explosion-container.hidden {
    display: none;
    opacity: 0;
}

#explosion-lottie {
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
}

#explosion-lottie svg {
    width: 100% !important;
    height: 100% !important;
}

.hidden {
    opacity: 0;
    pointer-events: none;
    visibility: hidden;
}

.countdown-display.hidden,
.rocket-container.hidden,
.explosion-container.hidden,
.pay-form.hidden,
.ton-pending-view.hidden,
.profile-page.hidden,
.game-stage.hidden {
    display: none !important;
}

#history-page.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    background: rgba(0, 0, 0, 0);
    backdrop-filter: blur(0px);
    -webkit-backdrop-filter: blur(0px);
}

.betting-sheet.hidden {
    display: block !important;
}

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    z-index: 10080;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    opacity: 1;
    visibility: visible;
    transition: opacity 0.25s ease, visibility 0.25s ease;
}

.modal-overlay.hidden {
    opacity: 0 !important;
    visibility: hidden !important;
    pointer-events: none !important;
}

.controls-area {
    padding: 6px 16px;
    background: rgba(21, 26, 33, 0.85);
    z-index: 30;
    position: relative;
    border-radius: 20px 20px 0 0;
    box-shadow: none;
    margin-bottom: 0;
}

body.bet-sheet-open .controls-area {
    opacity: 0;
    pointer-events: none;
    transform: translateY(10px);
}

.bet-btn {
    width: 100%;
    padding: 14px;
    border: none;
    border-radius: 14px;
    background: linear-gradient(180deg, #0088cc 0%, #006699 100%);
    color: white;
    font-size: 1.05rem;
    font-weight: 700;
    text-transform: uppercase;
    box-shadow: none;
    cursor: pointer;
    transition: transform 0.1s, box-shadow 0.1s, background 0.3s;
    letter-spacing: 0.5px;
}

.bet-btn:active {
    transform: scale(0.98);
    box-shadow: none;
}

.bet-btn.active-cashout {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: #ffffff;
    box-shadow: 0 0 20px rgba(16, 185, 129, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.bet-btn.active-cashout:active {
    transform: scale(0.98);
}

.bet-btn.disabled-grey {
    background: #2c3e50;
    color: #7f8fa4;
    cursor: not-allowed;
    border: 1px solid #34495e;
}

#history-page {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0);
    backdrop-filter: blur(0px);
    -webkit-backdrop-filter: blur(0px);
    z-index: 200;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    padding: 0;
    box-sizing: border-box;
    transition: background 0.35s ease, backdrop-filter 0.35s ease, -webkit-backdrop-filter 0.35s ease;
    opacity: 1;
    visibility: visible;
    pointer-events: none;
}

#history-page:not(.hidden) {
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    pointer-events: auto;
}

#history-page.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    background: rgba(0, 0, 0, 0);
    backdrop-filter: blur(0px);
    -webkit-backdrop-filter: blur(0px);
}

.history-header {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 12px 20px 20px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    background: transparent;
    flex-shrink: 0;
    position: relative;
    cursor: grab;
    touch-action: none;
    transition: background 0.2s ease;
    user-select: none;
    -webkit-user-select: none;
}

.history-header:active {
    cursor: grabbing;
    background: rgba(255, 255, 255, 0.02);
}

.history-header::before {
    content: '';
    position: absolute;
    top: 8px;
    left: 50%;
    transform: translateX(-50%);
    width: 40px;
    height: 4px;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 2px;
    transition: all 0.2s ease;
}

.history-header:active::before {
    width: 50px;
    height: 5px;
    background: rgba(255, 255, 255, 0.6);
    transform: translateX(-50%) scale(1.1);
}

.history-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: #fff;
    font-family: 'Outfit', sans-serif;
    margin: 0;
    pointer-events: none;
    user-select: none;
}

.history-card {
    background: rgba(255, 255, 255, 0.03);
    border-radius: 16px;
    padding: 18px;
    margin-bottom: 12px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.2s ease;
}

.history-card:active {
    transform: scale(0.98);
    background: rgba(255, 255, 255, 0.05);
}

.live-bets-panel {
    background: rgba(21, 26, 33, 0.75);
    flex: 1;
    display: flex;
    flex-direction: column;
    padding-bottom: calc(var(--nav-height) + 10px);
    min-height: 0;
    overflow: hidden;
}

.panel-header {
    display: flex;
    justify-content: space-between;
    padding: 12px 16px;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
    border-bottom: none;
}

.panel-header-left {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.total-bets-value {
    color: #fff;
    display: flex;
    align-items: center;
    gap: 4px;
}

.bets-list {
    flex: 1;
    overflow-y: auto;
    padding: 0 8px;
    min-height: 0;
    -webkit-overflow-scrolling: touch;
}

.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    height: 100%;
    min-height: 100px;
    color: var(--text-secondary);
    font-size: 0.9rem;
    opacity: 0.7;
}

.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;

    
    box-sizing: border-box;
    height: calc(var(--nav-height) + var(--tg-safe-area-inset-bottom, env(safe-area-inset-bottom, 0px)));
    background: rgb(21, 26, 33);
    display: flex;
    justify-content: space-around;
    align-items: center;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    z-index: 100;
    padding-bottom: var(--tg-safe-area-inset-bottom, env(safe-area-inset-bottom, 0px));
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #556070;
    text-decoration: none;
    gap: 4px;
    width: 33.3333%;
    -webkit-user-drag: none;
    -khtml-user-drag: none;
    -moz-user-drag: none;
    -o-user-drag: none;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    -khtml-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

.nav-item span {
    display: block;
    font-size: 0.72rem;
    line-height: 1;
    margin-top: 2px;
    opacity: 0.95;
}

.nav-item ion-icon {
    font-size: 1.5rem;
    margin-bottom: 2px;
}

.nav-item.active {
    color: var(--primary-blue);
}

body,
html {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    background-color: var(--bg-color);
    color: var(--text-color);
    font-family: 'Inter', sans-serif;
    overflow: hidden;
}

.app-container {
    display: flex;
    flex-direction: column;
    height: var(--app-h, 100vh);
    width: 100%;
    max-width: 480px;
    margin: 0 auto;
    position: relative;
    background-color: #000;
}

.top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 16px;
    position: absolute;
    top: 40px;
    padding-top: calc(10px + env(safe-area-inset-top));
    left: 0;
    right: 0;
    z-index: 9999;
}

.online-users {
    background: rgba(30, 30, 36, 0.95);
    padding: 6px 12px;
    border-radius: 20px;
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.9rem;
    font-weight: 600;
    color: #4cd964;
}

.online-dot {
    width: 8px;
    height: 8px;
    background-color: #4cd964;
    border-radius: 50%;
    box-shadow: 0 0 5px #4cd964;
}

.balance-container {
    background: rgba(30, 30, 36, 0.95);
    padding: 6px 6px 6px 12px;
    border-radius: 20px;
    display: flex;
    align-items: center;
    gap: 8px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.add-funds-btn {
    background: #fff;
    border: none;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #000;
    cursor: pointer;
}

.game-stage {
    flex: 1;
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background: radial-gradient(circle at center, #1b2735 0%, #090a0f 100%);
    overflow: hidden;
    perspective: 1000px;
}

.star-field {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
}

.explosion-container {
    position: absolute;
    top: 50%;
    left: 45%;
    transform: translate(-50%, -50%);
    width: 200px;
    height: 200px;
    z-index: 6;
    pointer-events: none;
    display: flex;
    justify-content: center;
    align-items: center;
}

.history-pill {
    flex: 0 0 auto;
    width: 50px;
    height: 30px;
    display: flex;
    justify-content: center;
    align-items: center;
    border-radius: 8px;
    font-size: 0.8rem;
    font-weight: 700;
    background-color: #232830;
    color: #556070;
    border: none;
    opacity: 1;
}

.bet-btn.disabled-grey {
    background: #232830;
    color: #556070;
    box-shadow: none;
    cursor: default;
    transform: none;
}

.bet-btn.active-cashout {
    background: linear-gradient(180deg, #ff9500 0%, #cc7a00 100%);
    box-shadow: 0 4px 0 #995c00;
    color: white;
}

.live-bets-panel {
    background: rgba(21, 26, 33, 0.75);
    flex: 1;
    display: flex;
    flex-direction: column;
    border-top: none;
    padding-bottom: var(--nav-height);
    min-height: 0;
    overflow: hidden;
}

.panel-header {
    display: flex;
    justify-content: space-between;
    padding: 10px 16px;
    font-size: 0.85rem;
    color: var(--text-secondary);
    border-bottom: none;
}

.bets-list {
    flex: 1;
    overflow-y: auto;
    min-height: 0;
    -webkit-overflow-scrolling: touch;
}

.bet-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    font-size: 0.9rem;
    margin-bottom: 8px;
    border-radius: 12px;
    background: rgba(25, 28, 35, 0.85);
    transition: all 0.3s ease;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.bet-row.my-bet {
    background: rgba(0, 136, 204, 0.12);
    border: 1px solid rgba(0, 136, 204, 0.25);
}

.bet-row.win-row {
    background: rgba(52, 199, 89, 0.12);
    border: 1px solid rgba(52, 199, 89, 0.25);
    animation: winPulse 0.5s ease;
}

.bet-row.loss-row {
    background: rgba(255, 59, 48, 0.12);
    border: 1px solid rgba(255, 59, 48, 0.25);
    opacity: 0.7;
}

.bet-card-left {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
}

.bet-avatar {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    object-fit: cover;
}

.bet-user-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.bet-username {
    color: #ffffff;
    font-size: 0.9rem;
    font-weight: 500;
}

.bet-details {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 0.85rem;
}

.bet-amount-text {
    color: #7f8fa4;
    font-weight: 500;
}

.bet-multiplier {
    color: #00d4ff;
    font-weight: 600;
}

.bet-card-right {
    display: flex;
    align-items: center;
    gap: 6px;
}

.bet-win-amount {
    color: #ffffff;
    font-weight: 600;
    font-size: 0.95rem;
}

.bet-icon-ton {
    width: 16px;
    height: 16px;
    opacity: 0.8;
}

.bet-icon-star {
    width: 16px;
    height: 16px;
    opacity: 0.8;
    border-radius: 50%;
}

.bets-list {
    padding-top: 8px;
    padding-bottom: 8px;
}

.bet-status {
    font-weight: 600;
}

.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    margin: 0 auto;
    max-width: 480px;
    width: 100%;

    
    box-sizing: border-box;
    height: calc(var(--nav-height) + var(--tg-safe-area-inset-bottom, env(safe-area-inset-bottom, 0px)));
    min-height: calc(var(--nav-height) + var(--tg-safe-area-inset-bottom, env(safe-area-inset-bottom, 0px)));
    padding-bottom: var(--tg-safe-area-inset-bottom, env(safe-area-inset-bottom, 0px));

    background: rgb(20, 20, 23);
    display: flex;
    justify-content: space-around;
    align-items: center;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    z-index: 10050;
    visibility: visible;
    opacity: 1;
    pointer-events: auto;
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 25%;
    color: #666;
    text-decoration: none;
    gap: 4px;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
}

.nav-item span {
    display: block;
    font-size: 0.72rem;
    line-height: 1;
    margin-top: 2px;
    opacity: 0.95;
}

.nav-item ion-icon {
    font-size: 1.5rem;
    margin-bottom: 2px;
}

.nav-item.active {
    color: var(--primary-blue);
}

.bet-currency-selector {
    display: flex;
    gap: 6px;
    background: linear-gradient(180deg, rgba(40, 45, 55, 0.95) 0%, rgba(30, 35, 45, 0.95) 100%);
    padding: 5px;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    margin-bottom: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2), inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.bet-curr-btn {
    flex: 1;
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.4);
    padding: 10px 16px;
    border-radius: 999px;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 6px;
    font-size: 0.9rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.25s ease;
    font-family: 'Inter', sans-serif;
}

.bet-curr-btn.active {
    background: linear-gradient(135deg, #0088cc 0%, #00aaff 100%);
    color: #fff;
    box-shadow: 0 2px 8px rgba(0, 136, 204, 0.35);
}

.bet-curr-btn:active {
    transform: scale(0.96);
}

.bet-curr-btn img {
    vertical-align: middle;
}

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    margin: 0 auto;
    width: 100%;
    max-width: 480px;
    height: 100%;
    background: rgba(0, 0, 0, 0);
    backdrop-filter: blur(0px);
    -webkit-backdrop-filter: blur(0px);
    z-index: 4999;
    transition: all 0.3s ease;
    pointer-events: none;
    opacity: 0;
    visibility: hidden;
}

.modal-overlay.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    pointer-events: auto;
}

.game-stage,
.profile-page,
.controls-area,
.live-bets-panel {
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.game-stage.hidden,
.profile-page.hidden {
    opacity: 0;
}

.game-stage {
    opacity: 1;
    transition: opacity 0.25s ease;
}

.controls-area {
    transition: opacity 0.25s ease, transform 0.25s ease;
}

.live-bets-panel {
    transition: opacity 0.25s ease, transform 0.25s ease;
}

.top-bar {
    transition: opacity 0.25s ease;
}

.history-bar {
    transition: opacity 0.25s ease;
}

.betting-sheet {
    transform: translateY(100%);
    transition: transform 0.35s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.betting-sheet:not(.hidden) {
    transform: translateY(0);
}

#history-page {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    margin: 0 auto;
    width: 100%;
    max-width: 480px;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
}

#history-page.hidden {
    display: none !important;
}

.history-modal-content {
    background: linear-gradient(180deg, rgba(28, 37, 51, 0.9) 0%, rgba(21, 26, 33, 0.95) 100%);
    border-top: 1px solid rgba(0, 136, 204, 0.3);
    border-radius: 24px 24px 0 0;
    padding: 24px 20px;
    height: 100%;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.6);
    width: 100%;
    transform: translateY(100%);
    transition: transform 0.35s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    will-change: transform;
    overflow: hidden;
}

#history-page:not(.hidden) .history-modal-content {
    transform: translateY(0);
}

.history-header {
    text-align: center;
    margin-bottom: 20px;
    position: relative;
    cursor: grab;
}

.history-header::before {
    content: '';
    position: absolute;
    top: -12px;
    left: 50%;
    transform: translateX(-50%);
    width: 40px;
    height: 4px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 2px;
}

.history-title {
    color: #fff;
    font-size: 1.3rem;
    font-weight: 700;
    margin: 0;
}

.history-card {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 16px;
    padding: 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.ton-icon-small {
    width: 16px;
    height: 16px;
    object-fit: contain;
    vertical-align: middle;
}

.currency-toggle {
    display: flex;
    align-items: center;
    background: rgba(30, 30, 36, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 24px;
    padding: 0 4px;
    position: relative;
    cursor: pointer;
    width: 76px;
    height: 36px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2), inset 0 1px 1px rgba(255, 255, 255, 0.05);
    overflow: hidden;
    text-decoration: none !important;
}

.currency-slider {
    position: absolute;
    top: 4px;
    left: 4px;
    width: 34px;
    height: 26px;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.15), rgba(255, 255, 255, 0.05));
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 18px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    z-index: 1;
}

.currency-icon {
    flex: 1;
    text-align: center;
    position: relative;
    z-index: 2;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.currency-icon img {
    width: 18px;
    height: 18px;
    opacity: 0.4;
    filter: grayscale(80%);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    object-fit: contain;
    display: block;
    border: none !important;
    outline: none !important;
    box-shadow: none !important;
    background: transparent !important;
    border-radius: 4px;
    line-height: 0;
}

.currency-icon.star img {
    border-radius: 50%;
    object-fit: contain;
    width: 18px;
    height: 18px;
}

.currency-icon.active img {
    opacity: 1;
    filter: grayscale(0%);
    transform: scale(1.15) drop-shadow(0 0 4px rgba(255, 255, 255, 0.4));
}

.currency-icon.star.active img {
    opacity: 1;
    filter: grayscale(0%);
    transform: scale(1.0) drop-shadow(0 0 4px rgba(255, 255, 255, 0.4));
}

.currency-toggle.is-star .currency-slider {
    transform: translateX(32px);
}

.currency-toggle:hover .currency-slider {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.25), rgba(255, 255, 255, 0.1));
}

.top-bar {
    transition: opacity 0.15s ease;
}

.top-bar.sheet-open {
    opacity: 0 !important;
    pointer-events: none !important;
}

@keyframes pillShake {
    0%, 100% { transform: translateX(0); }
    15%, 85% { transform: translateX(1px); }
    30%, 70% { transform: translateX(-2px); }
    45% { transform: translateX(2px); }
    60% { transform: translateX(-1px); }
}

@keyframes noise {
    0% {
        transform: translate(0, 0);
    }

    10% {
        transform: translate(-1%, -1%);
    }

    20% {
        transform: translate(1%, 1%);
    }

    30% {
        transform: translate(-2%, 2%);
    }

    40% {
        transform: translate(2%, -2%);
    }

    50% {
        transform: translate(0, 0);
    }

    60% {
        transform: translate(1%, -1%);
    }

    70% {
        transform: translate(-1%, 1%);
    }

    80% {
        transform: translate(2%, 2%);
    }

    90% {
        transform: translate(-2%, -2%);
    }

    100% {
        transform: translate(0, 0);
    }
}

@keyframes meteor-fall {
    0% {
        opacity: 1;
        transform: translate(0, 0) rotate(-45deg);
    }

    100% {
        opacity: 0;
        transform: translate(-200px, 200px) rotate(-45deg);
    }
}

@keyframes moonOrbit {
    0%   { transform: rotate(0deg)   translateX(var(--orbit-r)) rotate(0deg); }
    100% { transform: rotate(360deg) translateX(var(--orbit-r)) rotate(-360deg); }
}

@keyframes countdownAppear {
    from {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.8);
    }
    to {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
}

@keyframes winPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.02); }
}

@keyframes numberIn {
    0% {
        opacity: 0;
        transform: scale(1.8) translateY(30px) rotateX(-90deg);
    }
    100% {
        opacity: 1;
        transform: scale(1) translateY(0) rotateX(0deg);
    }
}

@keyframes numberOut {
    0% {
        opacity: 1;
        transform: scale(1) translateY(0) rotateX(0deg);
    }
    100% {
        opacity: 0;
        transform: scale(0.3) translateY(-30px) rotateX(90deg);
    }
}

@keyframes circlePulse {
    0% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.15);
        opacity: 0.8;
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}
/* ---- new: toast ---- */
.toast {
    position: fixed;
    left: 50%;
    top: calc(12px + env(safe-area-inset-top, 0px));
    transform: translate(-50%, -20px);
    max-width: min(440px, calc(100% - 32px));
    padding: 12px 16px;
    border-radius: 14px;
    background: rgba(28, 37, 51, 0.96);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
    color: #fff;
    font: 500 14px/1.4 'Inter', sans-serif;
    word-break: break-word;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease, transform 0.2s ease;
    z-index: 100000;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.error { border-color: rgba(255, 59, 48, 0.5); }

/* ---- new: Telegram fullscreen ---- */
/* status bar (safe area) + Telegram's floating close/menu buttons (content safe area) */
body.tg-fullscreen .top-bar {
    top: calc(var(--tg-safe-area-inset-top, 0px) + var(--tg-content-safe-area-inset-top, 0px));
    padding-top: 6px;
}
body.tg-fullscreen .toast {
    top: calc(8px + var(--tg-safe-area-inset-top, 0px) + var(--tg-content-safe-area-inset-top, 0px));
}


/* Rocket rides the graph tip: JS sets translate(x, y) every frame. */
.rocket-container {
    left: 0;
    top: 0;
    transition: none;
    will-change: transform;
}

/* Crash: the final multiplier in big digits where the rocket was */
.crash-big {
    position: absolute;
    left: 50%;
    top: 45%;
    transform: translate(-50%, -50%);
    z-index: 60;
    pointer-events: none;
    font-family: 'Outfit', sans-serif;
    font-weight: 800;
    font-size: 72px;
    line-height: 1;
    letter-spacing: -1px;
    white-space: nowrap;
    text-shadow: 0 0 24px currentColor, 0 4px 14px rgba(0, 0, 0, 0.6);
    font-variant-numeric: tabular-nums;
}
.crash-big.hidden {
    display: none;
}
.crash-big.pop {
    /* let the explosion flash first, then the digits pop over it */
    animation: crashBigIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) 0.35s both;
}
@keyframes crashBigIn {
    from { opacity: 0; transform: translate(-50%, -50%) scale(0.4); }
    to { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}


/* Live multiplier in the top-left corner of the top bar, level with the balance */
.live-mult {
    font-family: 'Outfit', sans-serif;
    font-weight: 800;
    font-size: 34px;
    line-height: 1;
    letter-spacing: -0.5px;
    font-variant-numeric: tabular-nums;
    pointer-events: none;
    white-space: nowrap;
}
.live-mult.hidden {
    visibility: hidden;
}
/* keep the live multiplier level with the balance pill, not centred against the whole right group */
.top-bar .top-left-group {
    align-self: flex-start;
    margin-top: 2px;
}

/* the live multiplier is shown big in the top-left corner; no duplicate pill in the history strip */
.history-bar .live-pill {
    display: none;
}

/* ---------- growth feel (driven by --fx-rgb / --fx-k set from app.js) ---------- */
/* screen edges glow in the multiplier colour, stronger as it climbs */
.stage-edge-glow {
    position: absolute;
    inset: 0;
    z-index: 2;
    pointer-events: none;
    box-shadow: inset 0 0 calc(40px + 90px * var(--fx-k, 0)) rgba(var(--fx-rgb, 0, 136, 204), calc(var(--fx-k, 0) * 0.45));
    transition: box-shadow 0.3s linear;
}
/* engine glow behind the rocket: bigger and brighter with the multiplier */
.rocket-container::before {
    background: radial-gradient(circle, rgba(var(--fx-rgb, 255, 149, 0), calc(0.18 + 0.32 * var(--fx-k, 0))) 0%, rgba(var(--fx-rgb, 255, 120, 0), calc(0.06 + 0.14 * var(--fx-k, 0))) 35%, transparent 62%);
    transform: scale(calc(1 + 0.8 * var(--fx-k, 0)));
}
/* live multiplier: small bump on every whole number, big pop on milestones */
.live-mult.tick { animation: multTick 0.25s ease-out; }
.live-mult.boost { animation: multBoost 0.5s cubic-bezier(0.34, 1.56, 0.64, 1); }
.live-mult { transform-origin: left center; }
@keyframes multTick { 50% { transform: scale(1.08); } }
@keyframes multBoost { 0% { transform: scale(1); } 35% { transform: scale(1.35); filter: brightness(1.6); } 100% { transform: scale(1); } }
/* milestone shockwave ring from the rocket */
.shockwave {
    position: absolute;
    z-index: 4;
    width: 80px;
    height: 80px;
    margin: -40px 0 0 -40px;
    border-radius: 50%;
    border: 3px solid rgba(var(--fx-rgb, 255, 255, 255), 0.9);
    box-shadow: 0 0 18px rgba(var(--fx-rgb, 255, 255, 255), 0.7);
    pointer-events: none;
    animation: shockwave 0.8s ease-out forwards;
}
.shockwave.big { border-width: 4px; animation-duration: 0.9s; }
@keyframes shockwave {
    from { transform: scale(0.3); opacity: 1; }
    to { transform: scale(3.2); opacity: 0; }
}

/* ---------- wallet: [gram | stars] toggle + balance of the chosen one + (+), top-right ---------- */
.wallet-capsule {
    display: flex;
    align-items: center;
    gap: 6px;
    height: 38px;
    padding: 0 4px;
    border-radius: 19px;
    background: rgba(30, 34, 42, 0.55);
    border: 1px solid rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}
.wallet-toggle {
    position: relative;
    display: flex;
    height: 30px;
    padding: 2px;
    border-radius: 15px;
    background: rgba(0, 0, 0, 0.3);
}
.wallet-slider {
    position: absolute;
    top: 2px;
    left: 2px;
    width: 30px;
    height: 26px;
    border-radius: 13px;
    background: rgba(255, 255, 255, 0.14);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.15);
    transition: transform 0.22s cubic-bezier(0.34, 1.4, 0.64, 1);
}
.wallet-capsule.is-star .wallet-slider { transform: translateX(30px); }
.wallet-opt {
    position: relative;
    width: 30px;
    height: 26px;
    padding: 0;
    border: none;
    background: transparent;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.2s;
}
.wallet-opt img, .wallet-opt .wallet-star { width: 18px; height: 18px; }
.wallet-star svg { width: 100% !important; height: 100% !important; }
.wallet-capsule:not(.is-star) .wallet-opt[data-currency="star"],
.wallet-capsule.is-star .wallet-opt[data-currency="ton"] { opacity: 0.45; }
.wallet-current {
    display: flex;
    align-items: center;
    padding: 0 2px;
    color: #fff;
    font: 700 16px Inter, sans-serif;
    font-variant-numeric: tabular-nums;
}
.wallet-current.swap .wallet-amount { animation: walletSwap 0.25s ease-out; }
@keyframes walletSwap {
    from { opacity: 0; transform: translateY(-5px); }
    to { opacity: 1; transform: none; }
}
.wallet-current.win .wallet-amount { animation: walletWin 0.8s ease-out; }
@keyframes walletWin { 0% { color: #51ff38; } 100% { color: #fff; } }
.wallet-add {
    width: 28px;
    height: 28px;
    padding: 0;
    border: none;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
}
/* empty balance: the amount is replaced by an accent "Пополнить" button */
.wallet-topup {
    display: none;
    height: 28px;
    padding: 0 12px;
    border: none;
    border-radius: 14px;
    background: linear-gradient(180deg, #4aa8ff 0%, #2a73e8 100%);
    box-shadow: 0 0 12px rgba(60, 145, 255, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.35);
    color: #fff;
    font: 700 13px Inter, sans-serif;
}
/* zero balance shows as 0 with the usual + (no separate Пополнить button) */

/* animated Telegram Stars emoji in the balance capsule */
.wallet-star { width: 22px; height: 22px; display: inline-block; }
.wallet-star svg { width: 100% !important; height: 100% !important; }

/* ================= lower half: glowing bet button, navy panel with a planet horizon, floating nav ================= */
:root { --nav-float: 76px; --nav-gap: 10px; }

.controls-area {
    background: #0a1322;
}
.bet-btn {
    /* same height as before (rocket stage must keep its size): 13px + 1px border */
    padding: 12px 13px;
    border-radius: 22px;
    border: 1px solid rgba(170, 215, 255, 0.55);
    background: linear-gradient(180deg, #5db8ff 0%, #2f88f2 55%, #1d62d6 100%);
    box-shadow: 0 0 24px rgba(56, 148, 255, 0.55), 0 6px 18px rgba(0, 40, 120, 0.45),
        inset 0 1px 0 rgba(255, 255, 255, 0.5), inset 0 -3px 8px rgba(0, 30, 90, 0.25);
    font-size: 1.05rem;
    font-weight: 800;
    letter-spacing: 1px;
    text-shadow: 0 1px 2px rgba(0, 30, 80, 0.4);
}

.live-bets-panel {
    position: relative;
    background: linear-gradient(180deg, #0a1322 0%, #060c18 60%, #03060d 100%);
    /* panel keeps its old outer size so the rocket stage doesn't shrink; room for the floating
       nav is made inside the scrolling list instead */
    padding-bottom: var(--nav-height);
}
.live-bets-panel .bets-list {
    padding-bottom: calc(var(--nav-float) + var(--nav-gap) - var(--nav-height) + 10px + var(--tg-safe-area-inset-bottom, env(safe-area-inset-bottom, 0px)));
}
.live-bets-panel > *:not(.bets-horizon) { position: relative; z-index: 1; }
.panel-header { color: #a9b8dc; font-weight: 700; font-size: 0.9rem; }
.empty-state { color: #9fb3e0; opacity: 1; font-weight: 600; font-size: 1rem; }
.empty-state ion-icon { color: #fff; font-size: 2.4rem !important; }

/* dark cratered moon with a glowing blue rim, peeking up behind the nav bar */
.bets-horizon {
    position: absolute;
    z-index: 0;
    left: -25%;
    width: 150%;
    height: 460px;
    bottom: calc(var(--nav-float) + var(--nav-gap) + var(--tg-safe-area-inset-bottom, env(safe-area-inset-bottom, 0px)) - 340px);
    border-radius: 50%;
    pointer-events: none;
    background:
        radial-gradient(ellipse 6% 2.2% at 38% 9%, rgba(0, 0, 0, 0.35), transparent 70%),
        radial-gradient(ellipse 4% 1.6% at 62% 7%, rgba(0, 0, 0, 0.3), transparent 70%),
        radial-gradient(ellipse 8% 2.6% at 52% 15%, rgba(0, 0, 0, 0.28), transparent 70%),
        radial-gradient(ellipse 3% 1.2% at 30% 16%, rgba(0, 0, 0, 0.3), transparent 70%),
        radial-gradient(ellipse 70% 30% at 50% 0%, #1d3557 0%, #0d1a2e 45%, #050a14 75%);
    box-shadow: 0 -6px 30px rgba(70, 160, 255, 0.75), 0 -24px 90px rgba(40, 120, 255, 0.45),
        inset 0 3px 6px rgba(150, 210, 255, 0.9), inset 0 14px 30px rgba(60, 150, 255, 0.35);
}

/* floating glass navigation */
.bottom-nav {
    left: 12px;
    right: 12px;
    bottom: calc(var(--nav-gap) + var(--tg-safe-area-inset-bottom, env(safe-area-inset-bottom, 0px)));
    width: auto;
    max-width: 456px;
    height: var(--nav-float);
    min-height: var(--nav-float);
    padding: 6px;
    border-radius: 28px;
    border: 1px solid rgba(130, 170, 255, 0.14);
    background: rgba(18, 26, 44, 0.72);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.06);
    justify-content: space-between;
}
.nav-item {
    width: 20%;
    height: 100%;
    border-radius: 22px;
    color: #e8eeff;
    gap: 5px;
}
.nav-item span { font-size: 0.8rem; font-weight: 600; margin-top: 0; }
.nav-item ion-icon { font-size: 1.6rem; margin-bottom: 0; }
.nav-svg { width: 26px; height: 26px; }
.nav-item.active {
    color: #fff;
    background: linear-gradient(180deg, #3d8dff 0%, #1f5fd0 100%);
    border: 1px solid rgba(160, 205, 255, 0.55);
    box-shadow: 0 0 20px rgba(60, 145, 255, 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.35);
}

/* auto cash-out block: title + switch; the multiplier picker slides open only when switched on */
.auto-cashout-row { flex-direction: column; align-items: stretch; gap: 0; }
.auto-cashout-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.auto-cashout-title { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.auto-cashout-title span { color: #fff; font: 700 15px Inter, sans-serif; }
.auto-cashout-title small { color: rgba(255, 255, 255, 0.45); font: 500 12px Inter, sans-serif; }
.auto-cashout-row .multiplier-control {
    max-height: 0;
    margin-top: 0;
    padding-top: 0;
    padding-bottom: 0;
    border-width: 0;
    opacity: 0;
    overflow: hidden;
    transition: max-height 0.25s ease, margin-top 0.25s ease, padding 0.25s ease, opacity 0.2s ease;
}
.auto-cashout-row.on .multiplier-control {
    max-height: 60px;
    margin-top: 12px;
    padding-top: 6px;
    padding-bottom: 6px;
    border-width: 1px;
    opacity: 1;
}

/* ---------- bets list cards (navy glass, round gradient avatars, clear amounts) ---------- */
.bets-list { padding: 4px 12px 0; }
.bet-row {
    padding: 12px 14px;
    margin-bottom: 10px;
    border-radius: 18px;
    background: linear-gradient(180deg, rgba(26, 34, 54, 0.82) 0%, rgba(17, 23, 38, 0.82) 100%);
    border: 1px solid rgba(140, 170, 255, 0.08);
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25), inset 0 1px 0 rgba(255, 255, 255, 0.04);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
}
.bet-row.my-bet {
    background: linear-gradient(180deg, rgba(30, 64, 120, 0.55) 0%, rgba(20, 40, 80, 0.55) 100%);
    border-color: rgba(80, 150, 255, 0.35);
}
.bet-row.win-row {
    background: linear-gradient(180deg, rgba(34, 90, 60, 0.5) 0%, rgba(20, 52, 38, 0.5) 100%);
    border-color: rgba(74, 222, 128, 0.3);
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25), 0 0 14px rgba(74, 222, 128, 0.12);
}
.bet-row.loss-row {
    background: linear-gradient(180deg, rgba(70, 28, 36, 0.45) 0%, rgba(40, 18, 24, 0.45) 100%);
    border-color: rgba(255, 90, 90, 0.22);
    opacity: 0.75;
}
.bet-card-left { gap: 14px; min-width: 0; }
.bet-avatar {
    width: 46px;
    height: 46px;
    border-radius: 50%;
    flex: 0 0 46px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
}
.bet-user-info { gap: 5px; min-width: 0; }
.bet-username {
    font-size: 1rem;
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.bet-details { gap: 6px; font-size: 0.95rem; }
.bet-amount-text { color: #8b97b0; font-weight: 600; }
.bet-multiplier { color: #38bdf8; font-weight: 700; }
.bet-card-right { gap: 8px; }
.bet-win-amount { font-size: 1.1rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.bet-icon-ton, .bet-icon-star { width: 20px; height: 20px; opacity: 1; }
.bet-details .bet-icon-ton, .bet-details .bet-icon-star { width: 18px; height: 18px; }
.panel-header .total-bets-value { font-size: 1.05rem; font-weight: 800; }

/* compact cards, sized like the mockup (~46px tall rows) */
.bets-list { padding: 2px 12px 0; }
.bet-row { padding: 7px 12px; margin-bottom: 6px; border-radius: 14px; }
.bet-card-left { gap: 11px; }
.bet-avatar { width: 34px; height: 34px; flex: 0 0 34px; }
.bet-user-info { gap: 2px; }
.bet-username { font-size: 0.9rem; line-height: 1.15; }
.bet-details { gap: 4px; font-size: 0.82rem; line-height: 1.15; }
.bet-card-right { gap: 6px; }
.bet-win-amount { font-size: 0.95rem; }
.bet-icon-ton, .bet-icon-star { width: 16px; height: 16px; }
.bet-details .bet-icon-ton, .bet-details .bet-icon-star { width: 14px; height: 14px; }
.panel-header .total-bets-value { font-size: 0.95rem; }

/* compact floating nav, sized like the mockup */
:root { --nav-float: 60px; }
.bottom-nav { padding: 4px; border-radius: 24px; }
.nav-item { border-radius: 19px; gap: 3px; }
.nav-item ion-icon { font-size: 1.35rem; }
.nav-svg { width: 22px; height: 22px; }
.nav-item span { font-size: 0.72rem; }

/* the top bar spans the full width over the tab headers: only the wallet takes taps,
   the rest lets them through (e.g. the back button on a case page) */
.top-bar { pointer-events: none; }
.top-bar .top-right-group, .top-bar .wallet-capsule { pointer-events: auto; }

/* stars first in the [stars | gram] toggle: the highlight sits on the left for stars, moves right for gram */
.wallet-capsule.is-star .wallet-slider { transform: none; }
.wallet-capsule:not(.is-star) .wallet-slider { transform: translateX(30px); }

/* opened outside Telegram: one screen that sends the player to the bot */
.only-tg { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; padding: 24px; background: radial-gradient(ellipse at 50% 20%, #10224a, #040814 70%); font-family: Inter, sans-serif; color: #fff; }
.only-tg-card { max-width: 340px; text-align: center; }
.only-tg-icon { font-size: 56px; margin-bottom: 10px; }
.only-tg h1 { margin: 0 0 8px; font: 800 22px/1.25 Inter, sans-serif; }
.only-tg p { margin: 0 0 20px; color: #a9b8dc; font: 500 15px/1.4 Inter, sans-serif; }
.only-tg-btn { display: inline-block; padding: 13px 26px; border-radius: 18px; background: linear-gradient(180deg, #4cc2ff, #1f8bf0); color: #fff; font: 700 16px Inter, sans-serif; text-decoration: none; box-shadow: 0 0 18px rgba(60, 170, 255, 0.5); }
.only-tg-btn[hidden] { display: none; }

/* wide window (Telegram Desktop / Web): the space around the game column is the same night sky,
   not flat black */
html, body {
    background:
        radial-gradient(ellipse 60% 50% at 50% 0%, rgba(40, 90, 200, 0.22), transparent 70%),
        radial-gradient(ellipse 70% 40% at 50% 100%, rgba(30, 70, 170, 0.18), transparent 70%),
        linear-gradient(180deg, #050a18 0%, #071026 50%, #040814 100%);
    background-attachment: fixed;
}

/* "бот" mark next to a bot's name in the bets list */
.bet-bot { display: inline-block; margin-left: 6px; padding: 1px 6px; border-radius: 7px; background: rgba(140, 160, 210, 0.18); color: #a9b8dc; font: 700 9.5px Inter, sans-serif; letter-spacing: 0.3px; vertical-align: 2px; text-transform: lowercase; }

/* crash scene off screen (other tab / app in background): stop its CSS animations too */
body.crash-paused .p-moon { animation-play-state: paused; }

/* bet sheet: quick amounts sit right under the amount; same sheet height as before */
.input-group + .quick-amounts { margin-top: -8px; }
.quick-amounts + .auto-cashout-row { margin-bottom: 20px; }
