/**
 * Mico Roulette Pro - Styles v17
 * Moved from inline <style> for better maintainability
 */

:root {
    --font-display: 'Inter', 'Sarabun', sans-serif;
    --color-green: #10b981;
    --color-red: #ef4444;
    --color-black: #18181B;
}

html, body {
    touch-action: manipulation;
}

body {
    font-family: 'Sarabun', 'Inter', sans-serif;
    background: #FAFAFA;
    color: #18181B;
}

h1, h2, h3, .font-display {
    font-family: var(--font-display);
}

/* === Glass Panel (Header) === */
.glass-panel {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid #E4E4E7;
}

/* === Cards === */
.card {
    background: #fff;
    border: 1px solid #E4E4E7;
    border-radius: 16px;
}

/* === Scrollbar Hide === */
.scrollbar-hide::-webkit-scrollbar {
    display: none;
}
.scrollbar-hide {
    -ms-overflow-style: none;
    scrollbar-width: none;
}

/* === Animations === */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

/* === Premium Preloader Animations === */
@keyframes blob {
    0%, 100% { transform: translate(0, 0) scale(1); }
    25% { transform: translate(20px, -30px) scale(1.1); }
    50% { transform: translate(-20px, 20px) scale(0.95); }
    75% { transform: translate(15px, 15px) scale(1.05); }
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-8px); }
}

@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes slideUp {
    from { opacity: 0; transform: translateY(100%); }
    to { opacity: 1; transform: translateY(0); }
}

.animate-slideUp {
    animation: slideUp 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes fadeOut {
    from { opacity: 1; transform: translateY(0); }
    to { opacity: 0; transform: translateY(10px); }
}

.animate-fadeOut {
    animation: fadeOut 0.3s ease-out forwards;
}

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

@keyframes spin-slow {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.animate-blob {
    animation: blob 8s ease-in-out infinite;
}

.animate-float {
    animation: float 3s ease-in-out infinite;
}

.animate-fadeInUp {
    animation: fadeInUp 0.6s ease-out forwards;
}

.animation-delay-2000 {
    animation-delay: 2s;
}

.animation-delay-4000 {
    animation-delay: 4s;
}

.animation-delay-200 {
    animation-delay: 200ms;
}

.animation-delay-400 {
    animation-delay: 400ms;
}

.animation-delay-1000 {
    animation-delay: 1s;
}

/* === Preloader V2 Animations === */
@keyframes spin-reverse {
    from { transform: rotate(0deg); }
    to { transform: rotate(-360deg); }
}

@keyframes bounce-light {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-4px); }
}

@keyframes pulse-slow {
    0%, 100% { opacity: 0.4; transform: scale(1); }
    50% { opacity: 0.7; transform: scale(1.05); }
}

@keyframes shimmer {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

.animate-spin-slow {
    animation: spin-slow 8s linear infinite;
}

.animate-spin-reverse {
    animation: spin-reverse 6s linear infinite;
}

.animate-bounce-light {
    animation: bounce-light 2s ease-in-out infinite;
}

.animate-pulse-slow {
    animation: pulse-slow 4s ease-in-out infinite;
}

.animate-shimmer {
    animation: shimmer 2s infinite;
}

@keyframes pointer-bounce {
    0% { transform: rotate(0deg); }
    10% { transform: rotate(-8deg); }
    20% { transform: rotate(8deg); }
    30% { transform: rotate(-6deg); }
    40% { transform: rotate(6deg); }
    50% { transform: rotate(-4deg); }
    60% { transform: rotate(4deg); }
    70% { transform: rotate(-2deg); }
    80% { transform: rotate(2deg); }
    90% { transform: rotate(-1deg); }
    100% { transform: rotate(0deg); }
}

@keyframes pointer-glow {
    0%, 100% { filter: drop-shadow(0 0 8px rgba(139, 92, 246, 0.6)); }
    50% { filter: drop-shadow(0 0 20px rgba(139, 92, 246, 1)); }
}

.pointer-marker {
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.pointer-marker.spinning {
    animation: pointer-bounce 0.8s ease-out, pointer-glow 1.5s ease-in-out infinite;
}

@keyframes pulse-glow {
    0%, 100% { box-shadow: 0 0 0 0 rgba(139, 92, 246, 0.4); }
    50% { box-shadow: 0 0 0 8px rgba(139, 92, 246, 0); }
}

@keyframes spin-wheel {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.animate-fadeIn {
    animation: fadeIn 0.3s ease forwards;
}

/* === Wheel Stage === */
.wheel-stage {
    background: linear-gradient(145deg, #f1f5f9 0%, #fff 100%);
    box-shadow: 8px 8px 20px rgba(0, 0, 0, 0.06), -8px -8px 20px #fff;
}

/* === Status Pills === */
.status-online {
    background: #D1FAE5;
    color: #065F46;
}

.status-offline {
    background: #FEE2E2;
    color: #991B1B;
}

.status-spinning {
    background: #FEF3C7;
    color: #92400E;
}

/* === History Container === */
.history-container {
    padding-top: 60px;
    margin-top: -30px;
    position: relative;
    overflow: visible;
}

.history-scroll {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    overflow-y: visible;
    padding: 12px 8px 8px 8px;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
}

/* === History Pills === */
.history-pill {
    min-width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 700;
    flex-shrink: 0;
    position: relative;
    transition: transform 0.15s, box-shadow 0.15s;
    cursor: pointer;
}

.history-pill:hover {
    transform: scale(1.2);
    z-index: 10;
}

.history-pill.latest {
    min-width: 52px;
    height: 52px;
    font-size: 18px;
    animation: pulse-glow 2s infinite;
}

.history-pill.red {
    background: linear-gradient(135deg, #EF4444, #DC2626);
    color: white;
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
}

.history-pill.black {
    background: linear-gradient(135deg, #3F3F46, #18181B);
    color: white;
    box-shadow: 0 4px 12px rgba(24, 24, 27, 0.3);
}

.history-pill.green {
    background: linear-gradient(135deg, #10B981, #059669);
    color: white;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

/* === History Tooltip === */
/* Smaller Tooltip (Requested Fix) */
.history-pill .tooltip {
    position: absolute;
    bottom: calc(100% + 8px); /* Closer */
    left: 50%;
    transform: translateX(-50%);
    padding: 3px 6px;       /* Smaller padding */
    background: #18181B;
    color: white;
    font-size: 9px;         /* Smaller font */
    font-weight: 600;
    border-radius: 4px;     /* Smaller radius */
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.15s, transform 0.15s;
    z-index: 9999;
    white-space: nowrap;
    box-shadow: 0 2px 6px rgba(0,0,0,0.2);
}

.history-pill .tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 3px solid transparent; /* Smaller arrow */
    border-top-color: #18181B;
}

.history-pill:hover .tooltip {
    opacity: 1;
    transform: translateX(-50%) translateY(-2px);
}

/* === Bet Cards === */
.bet-card {
    background: linear-gradient(145deg, #f8fafc, #f1f5f9);
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    padding: 12px 8px;
    text-align: center;
    transition: all 0.2s;
    position: relative;
    height: 84px; /* Fixed height for consistency (with/without pill) */
    display: flex;
    flex-direction: column;
    align-items: center;
}

.bet-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}

.bet-card.active {
    /* Deprecated for AI - reserved for user clicks if needed */
    border-color: #10B981;
}

/* AI Recommendation Highlight (Strong Purple) - ลงได้ */
.bet-card.highlight {
    border-color: #8B5CF6;
    background: linear-gradient(145deg, #EDE9FE, #DDD6FE);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(139, 92, 246, 0.3);
    animation: highlight-pulse 2s ease-in-out infinite;
}

@keyframes highlight-pulse {
    0%, 100% { box-shadow: 0 4px 12px rgba(139, 92, 246, 0.3); }
    50% { box-shadow: 0 4px 20px rgba(139, 92, 246, 0.5); }
}

/* AI Watch/Observing (Amber Glow) - จับตา */
.bet-card.watch {
    border-color: #F59E0B;
    background: linear-gradient(145deg, #FFFBEB, #FEF3C7);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(245, 158, 11, 0.25);
    animation: watch-glow 2.5s ease-in-out infinite;
}

@keyframes watch-glow {
    0%, 100% { 
        box-shadow: 0 2px 8px rgba(245, 158, 11, 0.25);
        border-color: #F59E0B;
    }
    50% { 
        box-shadow: 0 4px 16px rgba(245, 158, 11, 0.45);
        border-color: #D97706;
    }
}

.bet-card .count {
    position: absolute;
    top: 4px;
    right: 6px;
    font-size: 9px;
    color: #94a3b8;
    font-weight: 600;
}

.bet-card .main-num {
    font-size: 20px;
    font-weight: 900;
    color: #18181B;
    line-height: 1;
}

.bet-card .payout {
    font-size: 10px;
    color: #64748b;
    font-weight: 600;
}

.bet-card .prob {
    font-size: 10px;
    color: #8B5CF6;
    font-weight: 700;
    margin-top: 2px;
}

/* === Live Bet Pill (Violet Theme - v29.28) === */
.live-bet-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 2px;
    background: linear-gradient(135deg, #A78BFA, #8B5CF6);
    color: white;
    font-size: 11px;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 10px;
    box-shadow: 0 2px 6px rgba(139, 92, 246, 0.35);
    white-space: nowrap;
    animation: live-bet-pop 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    margin-top: 4px;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    transform-origin: center bottom;
}

@keyframes live-bet-pop {
    0% { transform: translateX(-50%) scale(0.5); opacity: 0; }
    100% { transform: translateX(-50%) scale(1); opacity: 1; }
}

@keyframes live-bet-update {
    0% { transform: translateX(-50%) scale(1); }
    50% { transform: translateX(-50%) scale(1.12); } /* Gentle pulse */
    100% { transform: translateX(-50%) scale(1); }
}

/* Win Flash (Green - AI Pick + Win) */
.flash-win {
    animation: flash-green 2s ease-out;
    border-color: #10B981 !important;
    box-shadow: 0 0 25px rgba(16, 185, 129, 0.5);
}

/* Lose Flash (Red - AI Pick + Lose) */
.flash-lose {
    animation: flash-red 2s ease-out;
    border-color: #EF4444 !important;
    box-shadow: 0 0 25px rgba(239, 68, 68, 0.5);
}

/* Neutral Flash (Purple - No AI Pick + Win) */
.flash-neutral {
    animation: flash-purple 2s ease-out;
    border-color: #8B5CF6 !important;
    box-shadow: 0 0 25px rgba(139, 92, 246, 0.5);
}

@keyframes flash-green {
    0% { background-color: white; transform: scale(1); }
    10% { background-color: #d1fae5; transform: scale(1.04); }
    25% { background-color: #6ee7b7; }
    50% { background-color: #a7f3d0; transform: scale(1.02); }
    100% { background-color: white; transform: scale(1); }
}

@keyframes flash-red {
    0% { background-color: white; transform: scale(1); }
    10% { background-color: #fee2e2; transform: scale(1.03); }
    25% { background-color: #fca5a5; }
    50% { background-color: #fecaca; transform: scale(1.01); }
    100% { background-color: white; transform: scale(1); }
}

@keyframes flash-purple {
    0% { background-color: white; transform: scale(1); }
    10% { background-color: #ede9fe; transform: scale(1.03); }
    25% { background-color: #c4b5fd; }
    50% { background-color: #ddd6fe; transform: scale(1.01); }
    100% { background-color: white; transform: scale(1); }
}

/* === Buttons === */
.btn {
    padding: 10px 16px;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 600;
    transition: all 0.15s;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

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

.btn-primary {
    background: #18181B;
    color: white;
}

.btn-primary:hover {
    background: #3F3F46;
}

.btn-secondary {
    background: #E4E4E7;
    color: #3F3F46;
}

.btn-success {
    background: #10B981;
    color: white;
}

.btn-warning {
    background: #F59E0B;
    color: white;
}

.btn-danger {
    background: #EF4444;
    color: white;
}

/* === Roulette Wheel (Enhanced) === */
.wheel-container {
    position: relative;
    width: 220px;
    height: 220px;
}

#roulette-mount {
    background: radial-gradient(circle at 30% 30%, #f8fafc, #e2e8f0);
    border-radius: 50%;
    box-shadow: 
        0 0 0 6px #fff,
        0 0 0 10px linear-gradient(135deg, #8B5CF6, #6366F1),
        0 10px 40px rgba(0,0,0,0.15),
        inset 0 -5px 20px rgba(0,0,0,0.05);
    overflow: hidden;
}

#roulette-mount canvas {
    border-radius: 50%;
}

.wheel-outer {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    background: conic-gradient(
        from 0deg,
        #059669 0deg 9.73deg,
        #DC2626 9.73deg 19.46deg,
        #18181B 19.46deg 29.19deg,
        #DC2626 29.19deg 38.92deg,
        #18181B 38.92deg 48.65deg,
        #DC2626 48.65deg 58.38deg,
        #18181B 58.38deg 68.11deg,
        #DC2626 68.11deg 77.84deg,
        #18181B 77.84deg 87.57deg,
        #DC2626 87.57deg 97.3deg,
        #18181B 97.3deg 107.03deg,
        #DC2626 107.03deg 116.76deg,
        #18181B 116.76deg 126.49deg,
        #DC2626 126.49deg 136.22deg,
        #18181B 136.22deg 145.95deg,
        #DC2626 145.95deg 155.68deg,
        #18181B 155.68deg 165.41deg,
        #DC2626 165.41deg 175.14deg,
        #18181B 175.14deg 184.87deg,
        #DC2626 184.87deg 194.6deg,
        #18181B 194.6deg 204.33deg,
        #DC2626 204.33deg 214.06deg,
        #18181B 214.06deg 223.79deg,
        #DC2626 223.79deg 233.52deg,
        #18181B 233.52deg 243.25deg,
        #DC2626 243.25deg 252.98deg,
        #18181B 252.98deg 262.71deg,
        #DC2626 262.71deg 272.44deg,
        #18181B 272.44deg 282.17deg,
        #DC2626 282.17deg 291.9deg,
        #18181B 291.9deg 301.63deg,
        #DC2626 301.63deg 311.36deg,
        #18181B 311.36deg 321.09deg,
        #DC2626 321.09deg 330.82deg,
        #18181B 330.82deg 340.55deg,
        #DC2626 340.55deg 350.28deg,
        #18181B 350.28deg 360deg
    );
    box-shadow: 
        0 0 0 4px #fff,
        0 0 0 8px #E4E4E7,
        0 8px 30px rgba(0,0,0,0.15);
}

.wheel-inner {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 60%;
    height: 60%;
    border-radius: 50%;
    background: linear-gradient(145deg, #fff, #f1f5f9);
    box-shadow: 
        inset 0 2px 10px rgba(0,0,0,0.1),
        0 4px 15px rgba(0,0,0,0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
}

.wheel-pointer {
    position: absolute;
    top: -12px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 12px solid transparent;
    border-right: 12px solid transparent;
    border-top: 20px solid #8B5CF6;
    filter: drop-shadow(0 2px 4px rgba(139, 92, 246, 0.4));
    z-index: 10;
}

.wheel-spinning .wheel-outer {
    animation: spin-wheel 3s cubic-bezier(0.17, 0.67, 0.12, 0.99) forwards;
}

/* === Bet Card Animations (Smoother) === */
@keyframes pulse-win {
    0% { 
        box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.8);
        transform: scale(1);
    }
    25% { 
        box-shadow: 0 0 20px 8px rgba(16, 185, 129, 0.4);
        transform: scale(1.03);
    }
    50% { 
        box-shadow: 0 0 30px 12px rgba(16, 185, 129, 0.2);
        transform: scale(1.05);
    }
    75% {
        box-shadow: 0 0 20px 8px rgba(16, 185, 129, 0.1);
        transform: scale(1.03);
    }
    100% { 
        box-shadow: 0 0 0 0 rgba(16, 185, 129, 0);
        transform: scale(1);
    }
}

@keyframes pulse-lose {
    0% { 
        box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.8);
        transform: scale(1);
    }
    25% { 
        box-shadow: 0 0 20px 8px rgba(239, 68, 68, 0.4);
        transform: scale(1.03);
    }
    50% { 
        box-shadow: 0 0 30px 12px rgba(239, 68, 68, 0.2);
        transform: scale(1.05);
    }
    75% {
        box-shadow: 0 0 20px 8px rgba(239, 68, 68, 0.1);
        transform: scale(1.03);
    }
    100% { 
        box-shadow: 0 0 0 0 rgba(239, 68, 68, 0);
        transform: scale(1);
    }
}

@keyframes pulse-neutral {
    0% { 
        box-shadow: 0 0 0 0 rgba(251, 191, 36, 0.8);
        transform: scale(1);
    }
    25% { 
        box-shadow: 0 0 15px 6px rgba(251, 191, 36, 0.3);
        transform: scale(1.02);
    }
    50% { 
        box-shadow: 0 0 20px 8px rgba(251, 191, 36, 0.15);
        transform: scale(1.03);
    }
    75% {
        box-shadow: 0 0 15px 6px rgba(251, 191, 36, 0.08);
        transform: scale(1.02);
    }
    100% { 
        box-shadow: 0 0 0 0 rgba(251, 191, 36, 0);
        transform: scale(1);
    }
}

/* === New Prominent Flash Animations === */

/* Win Flash: Bright Emerald Burst */
@keyframes super-flash-win {
    0% { background-color: #ffffff; transform: scale(1); box-shadow: 0 0 0 rgba(16, 185, 129, 0); }
    10% { background-color: #6ee7b7; transform: scale(1.1); box-shadow: 0 0 30px rgba(16, 185, 129, 0.8); border-color: #059669; }
    30% { background-color: #34d399; transform: scale(1.05); }
    50% { background-color: #a7f3d0; transform: scale(1.02); box-shadow: 0 0 15px rgba(16, 185, 129, 0.4); }
    100% { background-color: #ffffff; transform: scale(1); }
}

/* Lose Flash: Red Shake & Glow */
@keyframes super-flash-lose {
    0% { background-color: #ffffff; transform: translateX(0); }
    10% { background-color: #fca5a5; transform: translateX(-4px); border-color: #dc2626; box-shadow: 0 0 20px rgba(220, 38, 38, 0.6); }
    30% { background-color: #fecaca; transform: translateX(4px); }
    50% { background-color: #fee2e2; transform: translateX(0); }
    100% { background-color: #ffffff; }
}

/* Neutral Flash: Soft Yellow Fade (Standard) */
@keyframes pulse-neutral {
    0% { background-color: #fffbeb; transform: scale(1); }
    50% { background-color: #fce7f3; transform: scale(1.02); }
    100% { background-color: #fffbeb; transform: scale(1); }
}

.bet-card.flash-win {
    animation: super-flash-win 1.5s cubic-bezier(0.25, 1, 0.5, 1) forwards !important;
    z-index: 10;
}

.bet-card.flash-lose {
    animation: super-flash-lose 1.0s ease-out forwards !important;
    z-index: 10;
}

.bet-card.flash-neutral {
    animation: pulse-neutral 0.8s ease-out !important;
    border-color: #fbbf24 !important;
    background-color: #fffbeb !important;
}

/* === History Scroll Arrows === */
.history-wrapper {
    position: relative;
    overflow: visible;
    padding: 0 28px;
}

.history-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(255,255,255,0.95);
    border: 1px solid #E4E4E7;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 20;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    transition: all 0.2s;
    color: #71717A;
}

.history-arrow:hover {
    background: #18181B;
    color: white;
    transform: translateY(-50%) scale(1.1);
}

.history-arrow.left {
    left: -8px;
}

.history-arrow.right {
    right: -8px;
}

/* === Responsive === */
@media (max-width: 400px) {
    .history-pill {
        min-width: 36px;
        height: 36px;
        font-size: 12px;
    }
    .history-pill.latest {
        min-width: 44px;
        height: 44px;
        font-size: 15px;
    }
}
