:root {
    /* Цветовая палитра: неоновый фиолетовый и космос */
    --bg-main: #0a0a0f;
    --bg-card: rgba(255, 255, 255, 0.05);
    --border-color: rgba(255, 255, 255, 0.1);

    --primary: #9d4edd;
    --primary-light: #c77dff;
    --secondary: #00b4d8;
    --accent: #ff9e00;

    --text-main: #ffffff;
    --text-muted: #adb5bd;

    --font-heading: 'Outfit', sans-serif;
    --font-body: 'Inter', sans-serif;

    /* Тени и свечения */
    --glow-primary: 0 0 15px rgba(157, 78, 221, 0.6);
    --glow-secondary: 0 0 20px rgba(0, 180, 216, 0.5);

    /* Анимации */
    --transition-fast: 0.2s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background-color: var(--bg-main);
    color: var(--text-main);
    font-family: var(--font-body);
    overflow-x: hidden;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

/* Фоновые градиенты */
.bg-glow,
.bg-glow-2 {
    position: fixed;
    width: 300px;
    height: 300px;
    border-radius: 50%;
    filter: blur(100px);
    z-index: -1;
    opacity: 0.5;
    animation: float 10s infinite alternate ease-in-out;
}

.bg-glow {
    background: var(--primary);
    top: -50px;
    left: -50px;
}

.bg-glow-2 {
    background: var(--secondary);
    bottom: -50px;
    right: -50px;
    animation-delay: -5s;
}

@keyframes float {
    0% {
        transform: translateY(0) scale(1);
    }

    100% {
        transform: translateY(50px) scale(1.1);
    }
}

/* Эффект матового стекла */
.blur-effect {
    background: var(--bg-card);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--border-color);
}

/* Каркас интерфейса */
.app-container {
    max-width: 600px;
    margin: 0 auto;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    padding-bottom: 80px;
    /* Для нижнего меню */
}

/* Шапка (Header) */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    border-radius: 0 0 20px 20px;
    position: sticky;
    top: 0;
    z-index: 10;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    display: flex;
    justify-content: center;
    align-items: center;
    font-weight: bold;
    font-size: 1.2rem;
    box-shadow: var(--glow-primary);
}

.user-details {
    display: flex;
    flex-direction: column;
}

.username {
    font-family: var(--font-heading);
    font-weight: 600;
    font-size: 1rem;
}

.vip-badge {
    font-size: 0.7rem;
    color: var(--text-main);
    background: var(--accent);
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: bold;
    text-transform: uppercase;
    width: fit-content;
}

.balance-pill {
    background: rgba(0, 0, 0, 0.4);
    padding: 8px 15px;
    border-radius: 20px;
    border: 1px solid var(--border-color);
    cursor: pointer;
    transition: var(--transition-fast);
}

.balance-pill:active {
    transform: scale(0.95);
}

.balance-item {
    display: flex;
    align-items: center;
    gap: 5px;
    font-family: var(--font-heading);
    font-weight: 800;
    font-size: 1.1rem;
}

/* Динамический эффект при наведении / клике */
.dynamic-hover {
    transition: var(--transition-fast);
    cursor: pointer;
}

.dynamic-hover:active {
    transform: translateY(2px) scale(0.98);
    border-color: var(--primary-light);
    box-shadow: 0 0 10px rgba(199, 125, 255, 0.2);
}

/* Вкладки (Tabs) */
.tab-content {
    display: none;
    animation: fadeIn 0.3s ease-in-out;
}

.tab-content.active-tab {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Основной контент */
.main-content {
    padding: 20px;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* Баннер Краша */
.hero-banner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 25px 20px;
    border-radius: 24px;
    background: linear-gradient(135deg, rgba(157, 78, 221, 0.2), rgba(0, 180, 216, 0.1));
    overflow: hidden;
    position: relative;
    border: 1px solid var(--primary);
}

.hero-content {
    z-index: 2;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.glow-text {
    font-family: var(--font-heading);
    font-size: 2rem;
    font-weight: 800;
    text-shadow: var(--glow-primary);
    margin-bottom: 5px;
}

.hero-content p {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 15px;
}

.btn-primary {
    background: linear-gradient(90deg, var(--primary), var(--secondary));
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 12px;
    font-family: var(--font-heading);
    font-weight: 600;
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.glow-btn {
    box-shadow: var(--glow-primary);
}

/* Блик на кнопке */
.btn-flare {
    position: absolute;
    top: 0;
    left: -100%;
    width: 50%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4), transparent);
    transform: skewX(-20deg);
    animation: flare 3s infinite;
}

@keyframes flare {
    0% {
        left: -100%;
    }

    50% {
        left: -100%;
    }

    100% {
        left: 200%;
    }
}

.hero-art {
    font-size: 5rem;
    position: absolute;
    right: 10px;
    opacity: 0.8;
    filter: drop-shadow(0 0 20px rgba(255, 255, 255, 0.3));
    animation: float2 4s infinite alternate ease-in-out;
}

@keyframes float2 {
    0% {
        transform: translateY(0);
    }

    100% {
        transform: translateY(-15px);
    }
}

@keyframes shake {

    10%,
    90% {
        transform: translate3d(-1px, 0, 0);
    }

    20%,
    80% {
        transform: translate3d(2px, 0, 0);
    }

    30%,
    50%,
    70% {
        transform: translate3d(-4px, 0, 0);
    }

    40%,
    60% {
        transform: translate3d(4px, 0, 0);
    }
}

.pulse-anim {
    animation: pulse-glow 1s infinite alternate;
}

@keyframes pulse-glow {
    from {
        transform: translate(-50%, -50%) scale(1);
        text-shadow: 0 0 20px var(--primary);
    }

    to {
        transform: translate(-50%, -50%) scale(1.1);
        text-shadow: 0 0 40px var(--primary);
    }
}

/* Категории */
.categories {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    padding-bottom: 5px;
    scrollbar-width: none;
}

.categories::-webkit-scrollbar {
    display: none;
}

.cat-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    color: var(--text-main);
    font-family: var(--font-body);
    border-radius: 20px;
    padding: 8px 15px;
    white-space: nowrap;
    transition: var(--transition-fast);
}

.cat-btn.active {
    background: var(--primary);
    border-color: var(--primary-light);
    box-shadow: var(--glow-primary);
}

/* Сетка карточек игр */
.games-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
}

.game-card {
    padding: 20px 15px;
    border-radius: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 10px;
    background: rgba(255, 255, 255, 0.03);
}

.game-icon {
    font-size: 3.5rem;
    filter: drop-shadow(0 0 10px rgba(255, 255, 255, 0.2));
    transition: 0.3s;
}

.game-card:hover .game-icon {
    transform: scale(1.1) rotate(5deg);
}

.game-info h3 {
    font-family: var(--font-heading);
    font-size: 1.2rem;
}

.game-info p {
    color: var(--text-muted);
    font-size: 0.8rem;
}

/* Нижняя панель навигации */
.bottom-nav {
    position: fixed;
    bottom: 15px;
    left: 50%;
    transform: translateX(-50%);
    width: calc(100% - 30px);
    max-width: 570px;
    display: flex;
    justify-content: space-around;
    padding: 12px;
    border-radius: 24px;
    z-index: 10;
}

.nav-item {
    background: transparent;
    border: none;
    color: var(--text-muted);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    font-size: 0.75rem;
    transition: var(--transition-fast);
}

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

.nav-item.active .icon {
    transform: translateY(-2px);
    text-shadow: var(--glow-primary);
}

.nav-item .icon {
    font-size: 1.4rem;
    transition: var(--transition-fast);
}

/* Модалка игры */
.game-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 100;
    display: flex;
    flex-direction: column;
    background: var(--bg-main);
    transform: translateY(100%);
    transition: transform 0.4s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.game-modal:not(.hidden) {
    transform: translateY(0);
}

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

.game-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
    background: rgba(0, 0, 0, 0.5);
}

.btn-back {
    background: transparent;
    border: none;
    color: var(--text-main);
    font-family: var(--font-heading);
    font-size: 1rem;
    cursor: pointer;
}

.game-modal-header h2 {
    font-family: var(--font-heading);
    font-size: 1.3rem;
}

.dummy {
    width: 50px;
}

/* Для центровки */

.game-modal-body {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

/* Элементы внутри игры */
.placeholder-box {
    text-align: center;
    padding: 30px;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px dashed var(--border-color);
    width: 100%;
}

.placeholder-box h1 {
    font-size: 4rem;
    margin-bottom: 20px;
    animation: bounce 2s infinite;
}

@keyframes bounce {

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

    50% {
        transform: translateY(-10px);
    }
}

.bet-input {
    width: 100%;
    padding: 15px;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    background: rgba(0, 0, 0, 0.5);
    color: var(--text-main);
    font-family: var(--font-heading);
    font-size: 1.2rem;
    text-align: center;
    margin: 20px 0;
    outline: none;
    transition: border-color 0.3s;
}

.bet-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 10px rgba(157, 78, 221, 0.3);
}

/* Адаптивность для десктопов (хотя это TG WebApp) */
@media (min-width: 600px) {
    .app-container {
        border: 1px solid var(--border-color);
        border-radius: 20px;
        margin-top: 20px;
        margin-bottom: 20px;
        min-height: calc(100vh - 40px);
    }

    .bottom-nav {
        bottom: 35px;
    }

    .game-modal {
        max-width: 600px;
        margin: 0 auto;
        border-radius: 20px;
        top: 20px;
        left: 50%;
        transform: translateX(-50%) translateY(120%);
        height: calc(100vh - 40px);
    }

    .game-modal:not(.hidden) {
        transform: translateX(-50%) translateY(0);
    }
}

/* --- SLOT MACHINE STYLES --- */
.slots-machine-container {
    width: 100%;
    margin-top: 10px;
}

.slots-machine {
    display: flex;
    justify-content: center;
    gap: 10px;
    background: #111;
    padding: 15px;
    border-radius: 20px;
    border: 3px solid var(--primary);
    box-shadow: 0 0 30px rgba(157, 78, 221, 0.4);
    margin-bottom: 20px;
}

.reel {
    width: 80px;
    height: 100px;
    background: #000;
    border-radius: 10px;
    overflow: hidden;
    position: relative;
    box-shadow: inset 0 0 25px rgba(0, 0, 0, 0.9), 0 0 10px var(--border-color);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.reel-strip {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
}

.reel-symbol {
    height: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3.2rem;
    min-width: 100%;
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.2);
}

.reel-strip.rolling {
    transition: transform 3s cubic-bezier(0.1, 0.6, 0.2, 1);
}

.reel-strip.blur {
    filter: blur(2px);
}

.win-reel {
    animation: winPulse 0.5s infinite alternate;
    box-shadow: 0 0 20px var(--accent);
}

@keyframes winPulse {
    from {
        transform: scale(1);
    }

    to {
        transform: scale(1.1);
    }
}

.slots-controls {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.btn-slot-spin {
    width: 100%;
    padding: 20px;
    font-size: 1.5rem;
    font-weight: 800;
    border-radius: 15px;
    background: linear-gradient(180deg, #ffbd00, #ff9e00);
    color: #000;
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 0 #b36f00, 0 8px 20px rgba(255, 158, 0, 0.4);
}

.btn-slot-spin:active {
    transform: translateY(2px);
    box-shadow: 0 2px 0 #b36f00;
}

.btn-slot-spin:disabled {
    opacity: 0.5;
    filter: grayscale(1);
}

/* --- SLOTS WIN ANIMATION --- */
.slots-machine-container {
    position: relative;
}

.win-overlay-container {
    position: absolute;
    top: 30%;
    left: 50%;
    transform: translate(-50%, -50%);
    pointer-events: none;
    z-index: 100;
    text-align: center;
    width: 150%;
}

.big-win-text {
    font-size: 3rem;
    font-weight: 900;
    font-family: var(--font-heading);
    color: #ffb703;
    text-shadow: 0 0 15px #ff8c00, 0 0 30px #ff0000, 0 4px 5px rgba(0, 0, 0, 0.8);
    animation: bigWinPop 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
    transform: scale(0);
    line-height: 1;
    margin-bottom: 5px;
}

.win-amount-text {
    font-size: 2rem;
    font-weight: 800;
    color: #06d6a0;
    text-shadow: 0 0 15px rgba(6, 214, 160, 0.8), 0 4px 5px rgba(0, 0, 0, 0.8);
    animation: bigWinPop 0.8s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
    transform: scale(0);
}

@keyframes bigWinPop {
    0% {
        transform: scale(0);
        opacity: 0;
    }

    100% {
        transform: scale(1) rotate(-5deg);
        opacity: 1;
    }
}

.coin-particle {
    position: absolute;
    width: 30px;
    height: 30px;
    background: radial-gradient(circle, #ffca3a 0%, #ff9e00 100%);
    border-radius: 50%;
    box-shadow: inset 0 0 8px rgba(255, 255, 255, 0.8), 0 5px 10px rgba(0, 0, 0, 0.5);
    animation: coinFall linear forwards;
    pointer-events: none;
    z-index: 150;
}

.coin-particle::after {
    content: '$';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #8c5a00;
    font-weight: 900;
    font-size: 16px;
}

@keyframes coinFall {
    0% {
        transform: translateY(-50px) rotate(0deg) scale(0.5);
        opacity: 0;
    }

    10% {
        opacity: 1;
        transform: translateY(0px) rotate(90deg) scale(1.2);
    }

    100% {
        transform: translateY(120vh) rotate(1080deg) scale(1);
        opacity: 0;
    }
}

/* --- CRASH GAME STYLES --- */
.crash-container {
    width: 100%;
    padding: 5px;
}

.crash-graph {
    background: radial-gradient(circle at center, #1a1a1a 0%, #000 100%);
    border: 2px solid var(--primary);
    box-shadow: inset 0 0 50px rgba(157, 78, 221, 0.2);
    position: relative;
    margin-bottom: 25px !important;
    overflow: hidden;
}

#crash-rocket {
    z-index: 2;
    filter: drop-shadow(0 0 10px var(--primary));
    transform-origin: center;
}

.rocket-fly {
    animation: rocketShake 0.4s infinite alternate;
}

@keyframes rocketShake {
    0% {
        transform: translateY(0) rotate(0deg);
    }

    100% {
        transform: translateY(-3px) rotate(2deg);
    }
}

.rocket-explode {
    animation: explodePop 0.5s ease-out forwards;
}

@keyframes explodePop {
    0% {
        transform: scale(1);
        opacity: 1;
        filter: hue-rotate(0deg) brightness(1);
    }

    50% {
        transform: scale(2.5);
        opacity: 0.8;
        filter: hue-rotate(90deg) brightness(2) drop-shadow(0 0 30px #ff0000);
    }

    100% {
        transform: scale(0);
        opacity: 0;
    }
}

#crash-mult {
    transition: transform 0.1s ease-out;
}

.crash-controls {
    background: rgba(255, 255, 255, 0.03);
    padding: 15px;
    border-radius: 20px;
    border: 1px solid var(--border-color);
}

/* --- MISSIONS & WALLET STYLES --- */
.quest-card {
    transition: all 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.quest-card:active {
    transform: scale(0.96);
}

#missions-list .quest-card {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(10px);
}

#deposit-section,
#withdraw-section {
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(0, 0, 0, 0.2);
}

.bet-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 15px rgba(157, 78, 221, 0.4);
    outline: none;
}

input::-webkit-outer-spin-button,
input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

@keyframes pulse-glow {
    0% {
        transform: scale(1);
        opacity: 0.8;
        text-shadow: 0 0 10px var(--primary);
    }

    50% {
        transform: scale(1.05);
        opacity: 1;
        text-shadow: 0 0 25px var(--primary);
    }

    100% {
        transform: scale(1);
        opacity: 0.8;
        text-shadow: 0 0 10px var(--primary);
    }
}

.glow-text {
    animation: pulse-glow 3s infinite ease-in-out;
}

/* --- MINES STYLES --- */
.mine-cell {
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    position: relative;
    overflow: hidden;
}

.mine-cell:hover {
    background: rgba(255, 255, 255, 0.15) !important;
    transform: scale(1.05);
    border-color: var(--primary) !important;
}

.mine-cell:active {
    transform: scale(0.95);
}

.mine-cell.revealed {
    background: rgba(255, 255, 255, 0.08) !important;
    border-color: rgba(255, 255, 255, 0.2) !important;
    animation: popReveal 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.mine-cell.exploded {
    background: rgba(239, 35, 60, 0.2) !important;
    border-color: #ef233c !important;
    box-shadow: 0 0 15px rgba(239, 35, 60, 0.5) inset;
    animation: shakeErr 0.4s;
}

@keyframes popReveal {
    0% {
        transform: scale(0.2) rotate(-10deg);
        opacity: 0;
    }

    80% {
        transform: scale(1.1) rotate(5deg);
        opacity: 1;
    }

    100% {
        transform: scale(1);
    }
}

@keyframes shakeErr {

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

    20%,
    60% {
        transform: translateX(-5px);
    }

    40%,
    80% {
        transform: translateX(5px);
    }
}

/* --- DICE STYLES --- */
.dice-fast-roll {
    animation: blurText 0.1s infinite alternate;
}

@keyframes blurText {
    0% {
        filter: blur(0px);
        transform: translateX(-50%) translateY(0);
    }

    100% {
        filter: blur(2px);
        transform: translateX(-50%) translateY(-2px);
    }
}

#dice-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 28px;
    height: 28px;
    background: #ffffff;
    cursor: pointer;
    border-radius: 50%;
    box-shadow: 0 0 15px rgba(255, 255, 255, 0.5);
}

.dice-slider-container {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.05);
}

/* === Pragmatic Play Cards === */
.pp-card {
    border-radius: 16px;
    overflow: hidden;
    cursor: pointer;
    border: 1px solid rgba(255, 255, 255, 0.08);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.pp-card:active {
    transform: scale(0.96);
}

.pp-img {
    height: 110px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3.5rem;
}

.pp-name {
    padding: 8px 10px 2px;
    font-weight: 600;
    font-size: 0.8rem;
    line-height: 1.2;
}

.pp-rtp {
    padding: 2px 10px 10px;
    font-size: 0.65rem;
    color: var(--text-muted);
}

/* === Provider Filter Tabs === */
.prov-tab {
    flex-shrink: 0;
    padding: 6px 12px;
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: rgba(255, 255, 255, 0.04);
    color: var(--text-muted);
    font-size: 0.75rem;
    font-family: var(--font-body);
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 4px;
}

.prov-tab:active {
    transform: scale(0.95);
}

.prov-tab.active {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
    font-weight: 600;
}

#provider-tabs::-webkit-scrollbar {
    display: none;
}

/* --- PREMIUM ANIMATIONS --- */
.pulse-glow {
    animation: pulseGlow 1.5s infinite alternate ease-in-out;
}

@keyframes pulseGlow {
    from {
        transform: scale(0.95);
        filter: drop-shadow(0 0 5px currentColor);
    }

    to {
        transform: scale(1.05);
        filter: drop-shadow(0 0 25px currentColor);
    }
}

.floating-fast {
    animation: floatFast 3s infinite alternate ease-in-out;
}

@keyframes floatFast {
    from {
        transform: translateY(0);
    }

    to {
        transform: translateY(-10px);
    }
}

.wheel-shimmer {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0) 0%, rgba(255, 255, 255, 0.1) 50%, rgba(255, 255, 255, 0) 100%);
    background-size: 200% 200%;
    animation: shimmer 2s infinite linear;
}

@keyframes shimmer {
    0% {
        background-position: -100% -100%;
    }

    100% {
        background-position: 100% 100%;
    }
}

.glass-panel {
    background: rgba(255, 255, 255, 0.03);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.3);
}