/* ========================================================
   ИЗОЛЯЦИЯ И СБРОС ВНЕШНИХ ОГРАНИЧЕНИЙ
   ======================================================== */
body:has(#view-roulette.active) .top-header {
    display: none !important;
}

body:has(#view-roulette.active) {
    overflow-x: hidden !important;
}

body:has(#view-roulette.active) #main-content {
    max-width: 100vw !important;
    width: 100vw !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
    margin: 0 !important;
    box-sizing: border-box !important;
}

#view-roulette.hidden {
    display: none !important;
}

#view-roulette.active {
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    width: 100vw !important;
    max-width: 100vw !important;
    padding: 6px 8px 85px 8px !important;
    box-sizing: border-box !important;
    margin: 0 auto !important;
}

/* ========================================================
   ЗАГОЛОВОК SCROLL & SPIN
   ======================================================== */
.roulette-header-area {
    text-align: center;
    margin-bottom: 8px;
    width: 100%;
}

.roulette-brand-title {
    font-size: 30px;
    font-weight: 900;
    margin: 0;
    color: #ffffff;
    text-transform: uppercase;
    letter-spacing: 2px;
    text-shadow: 0 4px 20px rgba(239, 68, 68, 0.65);
    font-family: system-ui, -apple-system, sans-serif;
}

.roulette-sub-account {
    color: #a1a1aa;
    font-size: 11px;
    font-weight: 600;
    margin: 2px 0 0 0;
}

/* ========================================================
   ШИРОКАЯ МОНОЛИТНАЯ КАРТОЧКА
   ======================================================== */
.roulette-main-card {
    width: calc(100vw - 16px) !important;
    max-width: 480px !important;
    height: 535px;
    max-height: 70vh;
    background: radial-gradient(circle at 50% 50%, #1a1a24 0%, #0d0d12 100%);
    border-radius: 28px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    box-shadow: 0 16px 45px rgba(0, 0, 0, 0.9), inset 0 0 35px rgba(255, 255, 255, 0.02);
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
}

/* Эффект комиксных лучей */
.roulette-main-card::before {
    content: '';
    position: absolute;
    inset: -25%;
    background: repeating-conic-gradient(
        from 0deg at 50% 50%,
        rgba(255, 255, 255, 0.045) 0deg 8deg,
        transparent 8deg 25deg,
        rgba(239, 68, 68, 0.065) 25deg 33deg,
        transparent 33deg 50deg
    );
    pointer-events: none;
    z-index: 1;
}

/* Радиальный свет в центре карточки */
.roulette-main-card::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 320px;
    height: 320px;
    transform: translate(-50%, -50%);
    background: radial-gradient(circle, rgba(239, 68, 68, 0.15) 0%, rgba(245, 158, 11, 0.08) 50%, transparent 75%);
    pointer-events: none;
    z-index: 2;
}

/* Боковые маркеры фиксации приза */
.roulette-focus-indicator {
    position: absolute;
    top: 50%;
    left: 8px;
    right: 8px;
    height: 195px;
    transform: translateY(-50%);
    pointer-events: none;
    z-index: 10;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.roulette-focus-indicator::before,
.roulette-focus-indicator::after {
    content: '';
    width: 6px;
    height: 48px;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.25);
    box-shadow: 0 0 12px rgba(255, 255, 255, 0.4);
    opacity: 0.6;
}

/* ========================================================
   ВЕРХНЯЯ ПАНЕЛЬ
   ======================================================== */
.roulette-top-bar {
    position: absolute;
    top: 14px;
    left: 16px;
    right: 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    z-index: 30;
    pointer-events: auto;
}

.roulette-left-actions {
    display: flex;
    align-items: center;
    gap: 6px;
}

.roulette-icon-btn {
    width: 32px;
    height: 32px;
    border-radius: 9px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.14);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 14px;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.roulette-icon-btn:active {
    transform: scale(0.9);
}

.roulette-stars-pill {
    display: flex;
    align-items: center;
    gap: 5px;
    background: rgba(245, 158, 11, 0.18);
    border: 1px solid rgba(245, 158, 11, 0.4);
    padding: 3px 6px 3px 9px;
    border-radius: 10px;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.roulette-stars-val {
    color: #fbbf24;
    font-size: 12px;
    font-weight: 800;
}

.roulette-stars-plus {
    width: 20px;
    height: 20px;
    border-radius: 6px;
    background: #f59e0b;
    color: #000;
    font-weight: 900;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    line-height: 1;
}

/* ========================================================
   ОПТИМИЗИРОВАННЫЙ БАРАБАН
   ======================================================== */
.roulette-drum-viewport {
    width: 100%;
    height: 100%;
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.roulette-reel {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    position: absolute;
    top: 0;
    left: 0;
    z-index: 5;
    will-change: transform;
}

/* Плавный бесшовный холостой ход без рывков */
.roulette-reel.idle-loop {
    animation: roulette-infinite-idle 28s linear infinite !important;
}

@keyframes roulette-infinite-idle {
    0% { transform: translateY(0); }
    100% { transform: translateY(-2520px); }
}

/* ========================================================
   КАРТОЧКА ПРИЗА (ПЛАШКА СТРОГО ПОД КАРТИНКОЙ БЕЗ НАЛОЖЕНИЙ)
   ======================================================== */
.roulette-prize-card {
    height: 210px;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    position: relative;
    flex-shrink: 0;
    transition: transform 0.45s cubic-bezier(0.18, 0.89, 0.32, 1.28);
}

/* Анимация зума при победе */
.roulette-prize-card.winner-zoomed,
.roulette-prize-card.winner-focus {
    transform: scale(1.18) !important;
    z-index: 50 !important;
}

.roulette-prize-card.winner-zoomed .roulette-item-circle,
.roulette-prize-card.winner-focus .roulette-item-circle {
    box-shadow: 0 0 35px rgba(245, 158, 11, 0.95), 0 0 15px rgba(255, 255, 255, 0.8) !important;
    border: 2px solid #fbbf24 !important;
}

/* Круг подложки */
.roulette-item-circle {
    width: 130px;
    height: 130px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.65);
    flex-shrink: 0;
    transition: box-shadow 0.35s ease, border-color 0.35s ease;
}

/* Картинка приза */
.roulette-item-img {
    width: 155px !important;
    height: 155px !important;
    max-width: none !important;
    max-height: none !important;
    object-fit: contain;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    pointer-events: none;
    z-index: 2;
}

/* Плашка с названием аккуратно ПОД кругом (никогда не перекрывается) */
.roulette-item-pill {
    margin-top: 6px;
    background: #000000;
    color: #ffffff;
    font-size: 13px;
    font-weight: 900;
    padding: 5px 16px;
    border-radius: 16px;
    z-index: 5;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.85);
    letter-spacing: 0.3px;
    white-space: nowrap;
    border: 1px solid rgba(255, 255, 255, 0.18);
    pointer-events: none;
    position: relative;
}

/* ========================================================
   ЕДИНЫЙ СТИЛЬ СТЕКЛЯННЫХ КНОПОК ДЕЙСТВИЯ (DEEP MATTE GLASS)
   ======================================================== */
.roulette-action-btn-container {
    width: calc(100vw - 16px) !important;
    max-width: 480px !important;
    margin-top: 12px;
}

.roulette-btn-need-more,
.roulette-btn-spin-ready {
    width: 100%;
    background: linear-gradient(180deg, rgba(35, 35, 42, 0.75) 0%, rgba(18, 18, 22, 0.95) 100%);
    color: #f1f5f9;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 20px;
    padding: 16px;
    font-size: 15px;
    font-weight: 800;
    cursor: pointer;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.65), inset 0 1px 0 rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    letter-spacing: 0.6px;
    text-transform: uppercase;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    transition: transform 0.15s ease, background 0.2s ease, border-color 0.2s ease;
    box-sizing: border-box;
}

.roulette-btn-need-more:active,
.roulette-btn-spin-ready:active {
    transform: scale(0.98);
}

.roulette-btn-spin-ready.is-spinning {
    opacity: 0.75;
    cursor: default;
    color: #94a3b8;
}

.roulette-spin-cost-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    color: #fbbf24;
    font-size: 15px;
    font-weight: 900;
}

/* ========================================================
   МОДАЛЬНЫЕ ОКНА И АНИМАЦИИ ВЫИГРЫША
   ======================================================== */
.roulette-modal-overlay {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.92);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    box-sizing: border-box;
}

.roulette-modal-card {
    width: 100%;
    max-width: 360px;
    background: #18181b;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 22px;
    padding: 24px 20px;
    box-sizing: border-box;
    text-align: center;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.9);
}

@keyframes winModalPop {
    0% {
        opacity: 0;
        transform: scale(0.65) translateY(20px);
    }
    60% {
        opacity: 1;
        transform: scale(1.04) translateY(-3px);
    }
    100% {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.win-modal-animate {
    animation: winModalPop 0.42s cubic-bezier(0.16, 1, 0.3, 1) forwards !important;
}

@keyframes prizeIconGlow {
    0%, 100% { transform: scale(1); filter: drop-shadow(0 0 10px rgba(245, 158, 11, 0.5)); }
    50% { transform: scale(1.08); filter: drop-shadow(0 0 22px rgba(245, 158, 11, 0.9)); }
}

.win-icon-pulse {
    animation: prizeIconGlow 2s infinite ease-in-out;
}