/* ==========================================================================
   RULETA XL+ - PREMIUM CARTOON CASINO STYLE SYSTEM (V2)
   ========================================================================== */

/* Design Tokens & Root Variables */
:root {
    --color-yellow: #FFE000;
    --color-dark: #111111;
    --color-dark-gray: #1E1E1E;
    --color-light-gray: #F5F5F7;
    --color-white: #FFFFFF;
    
    /* Neon Accent Colors for Tiers */
    --color-gold: #FFD700;    /* Tier 1 - Gran Premio Dorado */
    --color-blue: #00E5FF;    /* Tier 2 */
    --color-green: #39FF14;   /* Tier 3 */
    --color-orange: #FF6D00;  /* Tier 4 */
    --color-purple: #A100F6;  /* Tier 6 - Tiro Extra! */
    
    /* Cartoon styling tokens */
    --border-width: 4px;
    --border-color: #111111;
    --cartoon-border: var(--border-width) solid var(--border-color);
    --cartoon-shadow: 6px 6px 0px #111111;
    --cartoon-shadow-sm: 4px 4px 0px #111111;
    --cartoon-shadow-hover: 8px 8px 0px #111111;
    
    /* Fonts */
    --font-heading: 'Fredoka', sans-serif;
    --font-body: 'Outfit', sans-serif;
}

/* Reset & Base Styles */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    user-select: none;
    -webkit-user-select: none;
}

body {
    font-family: var(--font-body);
    background-color: #151515; /* Solid flat color for 0% rendering overhead */
    color: var(--color-white);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    overflow-x: hidden;
    padding: 20px;
}

/* Confetti Canvas overlay */
#confetti-canvas {
    display: none; /* Hidden by default to save composition layers during wheel spin */
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    pointer-events: none;
    z-index: 999;
}

/* Main Container */
.app-container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 30px;
    padding: 10px;
}

/* ==========================================================================
   HEADER STYLE (Yellow & Black Logo Brand Card)
   ========================================================================== */
.app-header {
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.logo-container {
    perspective: 800px;
}

.app-logo-image {
    max-width: 250px;
    height: auto;
    filter: drop-shadow(5px 5px 0px var(--color-dark));
    animation: logoBounce 3s ease-in-out infinite alternate;
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    cursor: pointer;
    will-change: transform;
    transform: translate3d(0, 0, 0);
    backface-visibility: hidden;
}

.app-logo-image:hover {
    transform: scale(1.06) rotate(-2deg) translate3d(0, 0, 0);
    filter: drop-shadow(7px 7px 0px var(--color-dark));
}

@keyframes logoBounce {
    0% { transform: translateY(0) translate3d(0, 0, 0); }
    100% { transform: translateY(-10px) translate3d(0, 0, 0); }
}

/* Pause logo animations during spin for absolute GPU dedication */
.app-container.spinning .app-logo-image {
    animation-play-state: paused !important;
}

.app-subtitle {
    font-family: var(--font-heading);
    color: #AAAAAA;
    font-size: 1.1rem;
    font-weight: 400;
    max-width: 600px;
}

/* ==========================================================================
   MAIN LAYOUT (Centered Overhaul)
   ========================================================================== */
.main-layout {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 35px;
    width: 100%;
}

.centered-layout {
    margin: 0 auto;
}

/* ==========================================================================
   WHEEL SECTION (Marquee & Outer lights)
   ========================================================================== */
.wheel-section {
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    width: 100%;
}

/* Outer Ring (Casino Marquee style - Enlarged to 680px in V2 to be absolute showstopper centerpiece) */
.marquee-outer {
    position: relative;
    width: 680px;
    height: 680px;
    background-color: var(--color-dark);
    border: 6px solid var(--color-dark);
    border-radius: 50%;
    box-shadow: 0px 0px 50px rgba(255, 224, 0, 0.32),
                var(--cartoon-shadow);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    transition: width 0.3s ease, height 0.3s ease;
    will-change: transform;
    transform: translate3d(0,0,0);
    backface-visibility: hidden;
}

@media (max-width: 768px) {
    .marquee-outer {
        width: 500px;
        height: 500px;
        padding: 20px;
    }
}

@media (max-width: 520px) {
    .marquee-outer {
        width: 340px;
        height: 340px;
        padding: 14px;
    }
}

/* LED Container and bulbs */
.led-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    border-radius: 50%;
}

.led-bulb {
    position: absolute;
    width: 12px;
    height: 12px;
    background-color: #555555;
    border-radius: 50%;
    transform: translate(-50%, -50%);
    box-shadow: inset 0px 1px 3px rgba(255,255,255,0.4);
    transition: background-color 0.15s ease, box-shadow 0.15s ease;
}

@media (max-width: 520px) {
    .led-bulb {
        width: 9px;
        height: 9px;
    }
}

/* LED Blinking animations */
.led-bulb.lit-a {
    background-color: var(--color-yellow);
    box-shadow: 0px 0px 12px var(--color-yellow), inset 0px 1px 3px rgba(255,255,255,1);
    animation: blinkGlowA 0.8s infinite alternate;
}

.led-bulb.lit-b {
    background-color: #FFAA00;
    box-shadow: 0px 0px 12px #FFAA00, inset 0px 1px 3px rgba(255,255,255,1);
    animation: blinkGlowB 0.8s infinite alternate;
}

@keyframes blinkGlowA {
    0% {
        opacity: 0.45;
        box-shadow: 0px 0px 4px rgba(255, 224, 0, 0.3), inset 0px 1px 2px rgba(255,255,255,0.4);
    }
    100% {
        opacity: 1;
        box-shadow: 0px 0px 14px var(--color-yellow), inset 0px 1px 3px rgba(255,255,255,1);
    }
}

@keyframes blinkGlowB {
    0% {
        opacity: 1;
        box-shadow: 0px 0px 14px #FFAA00, inset 0px 1px 3px rgba(255,255,255,1);
    }
    100% {
        opacity: 0.45;
        box-shadow: 0px 0px 4px rgba(255, 170, 0, 0.3), inset 0px 1px 2px rgba(255,255,255,0.4);
    }
}

/* Lightweight Static LEDs during spin to completely free up CPU/GPU cycles for the wheel */
.app-container.spinning .led-bulb {
    animation: none !important;
    box-shadow: none !important;
}
.app-container.spinning .led-bulb.lit-a {
    background-color: var(--color-yellow) !important;
}
.app-container.spinning .led-bulb.lit-b {
    background-color: #FFAA00 !important;
}

/* Disable heavy box-shadow blurs on the outer marquee circle during spinning to completely free up GPU fill-rate */
.app-container.spinning .marquee-outer {
    box-shadow: var(--cartoon-shadow) !important;
}

/* Wheel Wrapper and Pointer alignment */
.wheel-wrapper {
    position: relative;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background-color: #222222;
    border: var(--cartoon-border);
    overflow: visible;
}

/* Pointer at the top */
.pointer-hand {
    position: absolute;
    top: -24px;
    left: 50%;
    transform: translateX(-50%) translate3d(0,0,0);
    z-index: 10;
    filter: drop-shadow(3px 3px 0px rgba(0,0,0,0.5));
    transform-origin: 50% 10px;
    will-change: transform;
    backface-visibility: hidden;
}

/* Wiggling class triggered in JS during spin */
.pointer-hand.wiggle {
    animation: pointerWiggle 0.12s infinite alternate ease-in-out;
}

@keyframes pointerWiggle {
    0% {
        transform: translateX(-50%) rotate(-10deg) translate3d(0,0,0);
    }
    100% {
        transform: translateX(-50%) rotate(10deg) translate3d(0,0,0);
    }
}

/* Wheel SVG Graphics */
.wheel-graphic {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    overflow: hidden;
    transform: rotate(0deg) translate3d(0,0,0);
    will-change: transform;
    backface-visibility: hidden;
}

/* Wheel Center Pin Face (Smiling face cap) */
.wheel-center-pin {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 70px;
    height: 70px;
    background-color: var(--color-dark);
    border: var(--cartoon-border);
    border-radius: 50%;
    box-shadow: 0px 4px 10px rgba(0,0,0,0.3);
    z-index: 5;
    display: flex;
    align-items: center;
    justify-content: center;
}

@media (max-width: 520px) {
    .wheel-center-pin {
        width: 50px;
        height: 50px;
    }
}

.center-pin-inner {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background-color: var(--color-yellow);
    border: 3px solid var(--color-white);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

/* Bouncy smiley face details in center pin */
/* Bouncy smiley face details in center pin */
.smiley-face {
    width: 28px;
    height: 28px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@media (max-width: 520px) {
    .smiley-face {
        width: 20px;
        height: 20px;
        gap: 2px;
    }
}

.smiley-face .eyes {
    display: flex;
    gap: 6px;
    align-items: center;
}

/* Idle / Blinking Eyes */
.smiley-face .eye {
    width: 6px;
    height: 8px;
    background-color: var(--color-dark);
    border-radius: 50%;
    transform-origin: center;
    transition: all 0.2s ease;
}

.smiley-face.idle .eye {
    animation: eyeBlink 4s infinite;
}

@keyframes eyeBlink {
    0%, 90%, 100% { transform: scaleY(1); }
    95% { transform: scaleY(0.1); }
}

/* Static Smile Arc */
.smiley-face .smile {
    width: 14px;
    height: 7px;
    border-bottom: 3px solid var(--color-dark);
    border-radius: 0 0 10px 10px;
    transition: all 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

/* Dizzy State (@_@ or x_x while spinning) */
.smiley-face.dizzy {
    animation: faceShake 0.15s infinite alternate ease-in-out;
}

.smiley-face.dizzy .eye {
    background-color: transparent !important;
    border-radius: 0 !important;
    width: 10px;
    height: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.smiley-face.dizzy .eye::before {
    content: '×';
    font-family: var(--font-heading);
    font-size: 16px;
    font-weight: 700;
    color: var(--color-dark);
    line-height: 1;
    display: inline-block;
    animation: eyeSpin 0.4s linear infinite;
}

.smiley-face.dizzy .smile {
    width: 8px;
    height: 8px;
    border: 3px solid var(--color-dark);
    border-radius: 50%;
}

@keyframes eyeSpin {
    100% { transform: rotate(360deg); }
}

@keyframes faceShake {
    0% { transform: translate(-1px, 1px) rotate(-2deg); }
    100% { transform: translate(1px, -1px) rotate(2deg); }
}

/* Celebrating State (^o^ Win Celebration!) */
.smiley-face.celebrating {
    animation: faceBounce 0.4s ease infinite alternate;
}

.smiley-face.celebrating .eye {
    width: 8px;
    height: 6px;
    background-color: transparent !important;
    border-top: 3px solid var(--color-dark);
    border-radius: 50% 50% 0 0 !important;
    transform: translateY(1px);
}

.smiley-face.celebrating .smile {
    width: 15px;
    height: 9px;
    background-color: var(--color-dark);
    border-radius: 0 0 15px 15px;
    border: none !important;
    transform: translateY(-1px);
}

@keyframes faceBounce {
    0% { transform: scale(1) translateY(0); }
    100% { transform: scale(1.25) translateY(-2px); }
}

/* Cara triste — Seguí Participando */
.smiley-face.sad {
    animation: faceSad 0.6s ease infinite alternate;
}

.smiley-face.sad .eye {
    width: 6px;
    height: 8px;
    background-color: var(--color-dark);
    border-radius: 50%;
    transform: translateY(2px);
}

.smiley-face.sad .smile {
    width: 14px;
    height: 7px;
    background-color: transparent;
    border-radius: 0 0 0 0;
    border-top: 3px solid var(--color-dark);
    border-radius: 50% 50% 0 0;
    border: none;
    border-top: 3px solid var(--color-dark);
    transform: translateY(4px);
}

@keyframes faceSad {
    0% { transform: scale(0.95) translateY(0); }
    100% { transform: scale(1.0) translateY(2px); }
}

/* SVG Slice styling */
.wheel-slice-path {
    stroke: var(--color-dark);
    stroke-width: 5px;
    stroke-linejoin: round;
}

.wheel-slice-text {
    font-family: var(--font-heading);
    font-weight: 800; /* Extra bold for heavy cartoon styling */
    font-size: 9.5px; /* Optimizado para 20 sectores delgados */
    letter-spacing: 0.2px;
    fill: var(--color-dark);
}

.wheel-slice-text-light {
    fill: var(--color-white);
    stroke: var(--color-dark);
    stroke-width: 3.5px; /* Clean, bold black stroke around white text */
    paint-order: stroke fill; /* Renders stroke behind text fill to prevent text narrowing */
}

/* ==========================================================================
   CARDS & CONTROL LAYOUT
   ========================================================================== */
.controls-section {
    display: flex;
    flex-direction: column;
    gap: 24px;
    max-width: 650px;
    width: 100%;
    margin: 0 auto;
}

.card {
    background-color: var(--color-dark-gray);
    border: var(--cartoon-border);
    border-radius: 20px;
    box-shadow: var(--cartoon-shadow);
    overflow: hidden;
}

/* Integrated Gaming Console Row below Wheel */
.console-card {
    width: 100%;
}

.console-body {
    padding: 20px 24px !important;
}

.console-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    align-items: flex-end;
}

.console-input-group {
    margin-bottom: 0 !important;
}

.console-btn-group {
    width: 100%;
}

.console-btn {
    width: 100%;
    margin-bottom: 0;
}

.console-utilities {
    display: flex;
    justify-content: center;
    padding-top: 14px;
    border-top: 2px dashed rgba(255,255,255,0.06);
    margin-top: 16px;
}

@media (max-width: 600px) {
    .console-row {
        grid-template-columns: 1fr;
        gap: 15px;
    }
}

.card-header {
    background-color: var(--color-dark);
    padding: 16px 24px;
    border-bottom: var(--cartoon-border);
    display: flex;
    align-items: center;
    gap: 12px;
}

.card-header h2 {
    font-family: var(--font-heading);
    font-weight: 600;
    font-size: 1.3rem;
    color: var(--color-white);
}

.card-icon {
    font-size: 1.4rem;
}

.card-body {
    padding: 24px;
}

.card-footer {
    background-color: rgba(0,0,0,0.15);
    padding: 12px 24px;
    border-top: 2px dashed rgba(255,255,255,0.1);
    display: flex;
    justify-content: flex-end;
}

/* Typography elements in cards */
.instruction-text {
    color: #BBBBBB;
    font-size: 0.95rem;
    line-height: 1.5;
    margin-bottom: 20px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 24px;
}

.form-group label {
    font-family: var(--font-heading);
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--color-yellow);
}

.input-wrapper {
    position: relative;
    width: 100%;
}

.input-wrapper input {
    width: 100%;
    background-color: var(--color-dark);
    border: 3px solid #333333;
    padding: 14px 14px 14px 44px;
    border-radius: 12px;
    color: var(--color-white);
    font-family: var(--font-body);
    font-size: 1rem;
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.input-wrapper input:focus {
    border-color: var(--color-yellow);
    box-shadow: 0px 0px 10px rgba(255, 224, 0, 0.2);
}

.input-icon {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: #666666;
    font-size: 1rem;
}

/* Spin Controls and Giant Button */
.spin-controls {
    display: flex;
    justify-content: center;
    width: 100%;
}

/* Interactive 3D Cartoon Button (Trivia Crack Style!) */
.btn {
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 1.15rem;
    color: var(--color-dark) !important;
    background-color: var(--color-yellow);
    border: var(--cartoon-border);
    border-radius: 40px; /* Bubbly Trivia Crack fully rounded corners */
    padding: 14px 32px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    text-transform: uppercase;
    position: relative;
    outline: none;
    
    /* 3D push-down physical effect: bottom shadow */
    box-shadow: 0px 6px 0px var(--color-dark);
    transform: translateY(-2px);
    transition: transform 0.08s ease, box-shadow 0.08s ease;
}

.btn-large {
    width: 100%;
    padding: 18px 30px;
    font-size: 1.35rem;
    letter-spacing: 1px;
}

.btn-spin {
    background-color: var(--color-yellow);
    color: var(--color-dark) !important;
    text-shadow: 1px 1px 0px rgba(255,255,255,0.4);
}

.btn-primary {
    background-color: var(--color-gold) !important;
    color: var(--color-dark) !important;
    text-shadow: 1px 1px 0px rgba(255,255,255,0.4);
}

.btn-secondary {
    background-color: var(--color-blue) !important;
    color: var(--color-dark) !important;
}

.btn:hover {
    transform: translateY(-4px);
    box-shadow: 0px 8px 0px var(--color-dark);
}

.btn:active {
    transform: translateY(4px);
    box-shadow: 0px 0px 0px var(--color-dark);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
    box-shadow: 0px 4px 0px var(--color-dark) !important;
}

.btn-outline {
    background-color: transparent;
    color: #AAAAAA !important;
    border: 3px solid #444444;
    border-radius: 40px;
    padding: 12px 24px;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-outline:hover {
    color: var(--color-white) !important;
    border-color: var(--color-white);
}

.btn-full {
    width: 100%;
}

/* Audio Toggle Button */
.btn-audio {
    background-color: transparent;
    border: none;
    color: #888888;
    font-family: var(--font-heading);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    border-radius: 6px;
    transition: color 0.2s ease, background-color 0.2s ease;
}

.btn-audio:hover {
    color: var(--color-yellow);
    background-color: rgba(255, 224, 0, 0.05);
}

.btn-audio i {
    font-size: 1.1rem;
    width: 16px;
}

/* ==========================================================================
   PRIZE HISTORY - HORIZONTAL TICKER BAR
   ========================================================================== */
.ticker-card {
    background-color: transparent !important;
    border: none !important;
    box-shadow: none !important;
    max-width: 650px;
    width: 100%;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
    align-items: center;
    padding: 0;
    overflow: visible;
}

.ticker-header {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #888888;
    font-family: var(--font-heading);
    font-size: 0.95rem;
}

.ticker-header h3 {
    font-size: 0.95rem;
    font-weight: 600;
}

.ticker-body {
    width: 100%;
    display: flex;
    justify-content: center;
}

.ticker-list-wrapper {
    width: 100%;
    max-height: none !important;
    overflow: visible !important;
}

.ticker-list {
    display: flex;
    flex-direction: row !important;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
    list-style: none;
}

.ticker-list .history-item {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 14px;
    border-radius: 20px;
    border: var(--cartoon-border);
    font-size: 0.85rem;
    box-shadow: var(--cartoon-shadow-sm);
    background-color: var(--color-dark-gray);
    border-left: 5px solid #555555;
    margin: 2px;
    animation: historyEnter 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes historyEnter {
    0% {
        opacity: 0;
        transform: translateY(10px) scale(0.95);
    }
    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.ticker-list .history-empty {
    color: #666666;
    font-style: italic;
    font-size: 0.85rem;
    padding: 10px 0;
}

/* History Tier Border Styles */
.history-tier-1 { border-left-color: var(--color-gold) !important; }
.history-tier-2 { border-left-color: var(--color-blue) !important; }
.history-tier-3 { border-left-color: var(--color-green) !important; }
.history-tier-4 { border-left-color: var(--color-orange) !important; }
.history-tier-5 { border-left-color: var(--color-yellow) !important; }
.history-tier-6 { border-left-color: var(--color-purple) !important; }

.hist-name {
    font-weight: 600;
}

.hist-time {
    color: #666666;
    font-size: 0.8rem;
}

.hist-badge {
    font-family: var(--font-heading);
    font-weight: 600;
    font-size: 0.75rem;
    padding: 2px 8px;
    border-radius: 4px;
    background-color: var(--color-dark);
}

.badge-t1 { color: var(--color-gold); }
.badge-t2 { color: var(--color-blue); }
.badge-t3 { color: var(--color-green); }
.badge-t4 { color: var(--color-orange); }
.badge-t5 { color: var(--color-yellow); }
.badge-t6 { color: var(--color-purple); }

/* ==========================================================================
   WINNER CELEBRATION MODAL
   ========================================================================== */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.93);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    padding: 20px;
}

.modal-overlay.open {
    opacity: 1;
    pointer-events: auto;
}

.cartoon-popup {
    background-color: var(--color-dark-gray);
    border: var(--cartoon-border);
    border-radius: 28px;
    box-shadow: 10px 10px 0px #111111;
    max-width: 500px;
    width: 100%;
    padding: 40px 30px;
    text-align: center;
    position: relative;
    transform: scale(0.85) rotate(-1deg);
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.25);
    overflow: hidden; /* Prevent sunburst rays from overflowing! */
}

/* Layer popup contents above sunburst */
.cartoon-popup > *:not(.sunburst-bg) {
    position: relative;
    z-index: 2;
}

.sunburst-bg {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 650px;
    height: 650px;
    background: repeating-conic-gradient(
        from 0deg,
        rgba(255, 224, 0, 0.08) 0deg 15deg,
        transparent 15deg 30deg
    );
    border-radius: 50%;
    pointer-events: none;
    z-index: 1;
    animation: sunburstRotate 25s linear infinite;
    opacity: 0;
    transition: opacity 0.5s ease;
}

.modal-overlay.open .sunburst-bg {
    opacity: 1;
}

@keyframes sunburstRotate {
    100% {
        transform: translate(-50%, -50%) rotate(360deg);
    }
}

.modal-overlay.open .cartoon-popup {
    transform: scale(1) rotate(0deg);
}

/* Floating Crown Icon on top of Modal */
.modal-crown {
    position: absolute;
    top: -35px;
    left: 50%;
    transform: translateX(-50%);
    background-color: var(--color-dark);
    border: var(--cartoon-border);
    width: 70px;
    height: 70px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 4px 4px 0px rgba(0,0,0,0.3);
}

.modal-crown i {
    font-size: 2rem;
}

.modal-greeting {
    display: block;
    font-family: var(--font-heading);
    color: #AAAAAA;
    font-size: 1.1rem;
    margin-top: 10px;
    margin-bottom: 5px;
}

.modal-title {
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 2.5rem;
    color: var(--color-white);
    letter-spacing: 2px;
    margin-bottom: 24px;
    text-shadow: 2px 2px 0px var(--color-dark);
}

/* Spotlight for the won Prize */
.prize-spotlight {
    border: var(--cartoon-border);
    border-radius: 16px;
    padding: 24px;
    background-color: var(--color-dark);
    box-shadow: inset 0px 0px 20px rgba(0,0,0,0.6);
    margin-bottom: 24px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    position: relative;
    overflow: hidden;
}

/* Spotlight backlights */
.prize-spotlight::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255,255,255,0.08) 0%, transparent 60%);
    pointer-events: none;
}

.prize-tier-badge {
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 0.9rem;
    padding: 6px 16px;
    border-radius: 20px;
    background-color: #333;
    color: var(--color-white);
    display: inline-block;
    border: 2px solid var(--color-white);
}

.prize-name {
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 2.2rem;
    line-height: 1.2;
}

.modal-description {
    color: #999999;
    font-size: 0.95rem;
    line-height: 1.5;
    margin-bottom: 30px;
}

.modal-actions {
    display: flex;
    justify-content: center;
    width: 100%;
    margin-top: 10px;
}

/* Colored Spotlight States */
.spotlight-t1 { 
    box-shadow: 0px 0px 30px rgba(255, 215, 0, 0.6), inset 0px 0px 25px rgba(0,0,0,0.8); 
    border-color: #D4AF37 !important; /* Classic Metallic Gold */
    background: linear-gradient(135deg, rgba(20,20,20,0.98) 0%, rgba(35,30,10,0.98) 100%) !important;
}
.spotlight-t1 .prize-tier-badge { 
    background: linear-gradient(135deg, #FFE000 0%, #FFF8B3 30%, #D4AF37 60%, #AA771C 100%) !important;
    border-color: #8C6B1B !important; 
    color: #111111 !important; 
    font-weight: 800;
    box-shadow: 0 2px 5px rgba(0,0,0,0.4);
}
.spotlight-t1 .prize-name { 
    background: linear-gradient(to right, #FFE000 0%, #FFF9C4 35%, #D4AF37 60%, #FFF9C4 85%, #8C6B1B 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    filter: drop-shadow(2px 2px 0px #111111) drop-shadow(0px 0px 8px rgba(255, 215, 0, 0.6));
}

.spotlight-t2 { box-shadow: 0px 0px 20px rgba(0, 229, 255, 0.4), inset 0px 0px 20px rgba(0,0,0,0.6); }
.spotlight-t2 .prize-tier-badge { background-color: var(--color-blue); border-color: var(--color-dark); color: var(--color-dark); }
.spotlight-t2 .prize-name { color: var(--color-blue); text-shadow: 2px 2px 0px var(--color-dark); }

.spotlight-t3 { box-shadow: 0px 0px 20px rgba(57, 255, 20, 0.4), inset 0px 0px 20px rgba(0,0,0,0.6); }
.spotlight-t3 .prize-tier-badge { background-color: var(--color-green); border-color: var(--color-dark); color: var(--color-dark); }
.spotlight-t3 .prize-name { color: var(--color-green); text-shadow: 2px 2px 0px var(--color-dark); }

.spotlight-t4 { box-shadow: 0px 0px 20px rgba(255, 109, 0, 0.4), inset 0px 0px 20px rgba(0,0,0,0.6); }
.spotlight-t4 .prize-tier-badge { background-color: var(--color-orange); border-color: var(--color-white); }
.spotlight-t4 .prize-name { color: var(--color-orange); text-shadow: 2px 2px 0px var(--color-dark); }

.spotlight-t5 { box-shadow: 0px 0px 20px rgba(255, 224, 0, 0.4), inset 0px 0px 20px rgba(0,0,0,0.6); }
.spotlight-t5 .prize-tier-badge { background-color: var(--color-yellow); border-color: var(--color-dark); color: var(--color-dark); }
.spotlight-t5 .prize-name { color: var(--color-yellow); text-shadow: 2px 2px 0px var(--color-dark); }

.spotlight-t6 { box-shadow: 0px 0px 20px rgba(161, 0, 246, 0.4), inset 0px 0px 20px rgba(0,0,0,0.6); }
.spotlight-t6 .prize-tier-badge { background-color: var(--color-purple); border-color: var(--color-white); color: var(--color-white); }
.spotlight-t6 .prize-name { color: var(--color-purple); text-shadow: 2px 2px 0px var(--color-dark); }

/* ==========================================================================
   FLOATING SETTINGS BUTTON & CONFIG DRAWER
   ========================================================================== */
.btn-settings-trigger {
    position: fixed;
    bottom: 24px;
    right: 24px;
    background-color: var(--color-dark);
    color: var(--color-yellow);
    border: var(--cartoon-border);
    width: 56px;
    height: 56px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.4rem;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 4px 4px 0px rgba(0,0,0,0.3);
    z-index: 100;
    transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275), color 0.2s ease;
}

.btn-settings-trigger:hover {
    transform: scale(1.1) rotate(45deg);
    color: var(--color-white);
}

/* Admin Sidebar Drawer */
/* ─── Admin Auth Modal ─────────────────────────────────────────── */
.admin-auth-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.9);
    z-index: 9999;
    align-items: center;
    justify-content: center;
}
.admin-auth-overlay.open {
    display: flex;
}
.admin-auth-box {
    background: linear-gradient(145deg, #1a1a2e, #16213e);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 20px;
    padding: 40px 36px;
    width: 320px;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0,0,0,0.5);
    position: relative;
    animation: authBoxIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes authBoxIn {
    from { transform: scale(0.8); opacity: 0; }
    to   { transform: scale(1);   opacity: 1; }
}
.admin-auth-close {
    position: absolute;
    top: 12px; right: 16px;
    background: none;
    border: none;
    color: rgba(255,255,255,0.4);
    font-size: 1.4rem;
    cursor: pointer;
    line-height: 1;
    transition: color 0.2s;
}
.admin-auth-close:hover { color: #fff; }
.admin-auth-icon { font-size: 2.5rem; margin-bottom: 12px; }
.admin-auth-title {
    color: #fff;
    font-family: 'Fredoka', sans-serif;
    font-size: 1.4rem;
    margin: 0 0 6px;
}
.admin-auth-desc {
    color: rgba(255,255,255,0.5);
    font-size: 0.85rem;
    margin: 0 0 20px;
}
.admin-auth-input {
    width: 100%;
    background: rgba(255,255,255,0.07);
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: 10px;
    color: #fff;
    font-size: 1rem;
    padding: 12px 16px;
    outline: none;
    box-sizing: border-box;
    transition: border-color 0.2s;
    text-align: center;
    letter-spacing: 3px;
}
.admin-auth-input:focus { border-color: rgba(255,255,255,0.4); }
.admin-auth-error {
    color: #ff6b6b;
    font-size: 0.8rem;
    min-height: 20px;
    margin: 8px 0 12px;
}
.admin-auth-box .btn-primary {
    width: 100%;
    margin-top: 4px;
}

/* ─────────────────────────────────────────────────────────────── */
.admin-drawer {

    position: fixed;
    top: 0;
    right: -420px; /* Hidden by default */
    width: 400px;
    height: 100%;
    background-color: var(--color-dark);
    border-left: var(--cartoon-border);
    box-shadow: -10px 0px 30px rgba(0,0,0,0.5);
    z-index: 900;
    display: flex;
    flex-direction: column;
    transition: right 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    overflow-y: auto;
}

@media (max-width: 450px) {
    .admin-drawer {
        width: 100%;
        right: -100%;
    }
}

.admin-drawer.open {
    right: 0;
}

.drawer-header {
    background-color: var(--color-dark-gray);
    padding: 24px;
    border-bottom: var(--cartoon-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.drawer-header h3 {
    font-family: var(--font-heading);
    font-weight: 600;
    font-size: 1.2rem;
    color: var(--color-white);
    display: flex;
    align-items: center;
    gap: 10px;
}

.drawer-header h3 i {
    color: var(--color-yellow);
}

.btn-close-drawer {
    background: transparent;
    border: none;
    color: #666666;
    font-size: 1.4rem;
    cursor: pointer;
    padding: 4px;
    transition: color 0.2s ease;
}

.btn-close-drawer:hover {
    color: var(--color-white);
}

.drawer-body {
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.drawer-intro {
    color: #888888;
    font-size: 0.85rem;
    line-height: 1.4;
}

.drawer-divider {
    border: none;
    border-top: 2px dashed #222222;
    margin: 10px 0;
}

/* Custom Config Special Cards (e.g. Tier 1 Toggle) */
.config-card {
    background-color: var(--color-dark-gray);
    border: 3px solid #333333;
    border-radius: 12px;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.config-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.config-card-header strong {
    font-family: var(--font-heading);
    font-size: 0.95rem;
    color: var(--color-white);
}

.special-card-desc {
    color: #777777;
    font-size: 0.8rem;
    line-height: 1.3;
}

.special-card {
    border-color: #333;
    transition: border-color 0.3s ease;
}

.special-card.active {
    border-color: var(--color-gold);
    box-shadow: 0 0 10px rgba(255, 215, 0, 0.2);
}

.percentage-display {
    align-self: flex-start;
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 1rem;
    padding: 4px 12px;
    border-radius: 6px;
    background-color: var(--color-dark);
}

.active-t1-badge {
    color: #777777;
    border: 1.5px solid #333;
}

.special-card.active .active-t1-badge {
    color: var(--color-gold);
    border-color: var(--color-gold);
}

/* Toggle Switch styles */
.switch-toggle {
    position: relative;
    display: inline-block;
    width: 48px;
    height: 26px;
}

.switch-toggle input {
    opacity: 0;
    width: 0;
    height: 0;
}

.switch-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #333333;
    border-radius: 34px;
    transition: .3s cubic-bezier(0.175, 0.885, 0.32, 1.2);
}

.switch-slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 4px;
    bottom: 4px;
    background-color: var(--color-white);
    border-radius: 50%;
    transition: .3s cubic-bezier(0.175, 0.885, 0.32, 1.2);
}

.switch-toggle input:checked + .switch-slider {
    background-color: var(--color-gold);
}

.switch-toggle input:checked + .switch-slider:before {
    transform: translateX(22px);
}

/* Sliders listing */
.sliders-list {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.slider-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.slider-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.9rem;
    font-family: var(--font-heading);
}

.tier-label {
    font-weight: 600;
}

.t2-label { color: var(--color-blue); }
.t3-label { color: var(--color-green); }
.t4-label { color: var(--color-orange); }
.t5-label { color: var(--color-yellow); }
.t6-label { color: var(--color-purple); }

.slider-val {
    font-weight: 700;
    color: var(--color-white);
    background-color: var(--color-dark-gray);
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.8rem;
    border: 1px dashed #333;
}

/* range slider styling */
.range-slider {
    -webkit-appearance: none;
    width: 100%;
    height: 8px;
    border-radius: 5px;
    background: #252525;
    outline: none;
}

.range-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--color-white);
    border: 3px solid var(--color-dark);
    cursor: pointer;
    box-shadow: 0px 2px 5px rgba(0,0,0,0.3);
    transition: transform 0.1s ease;
}

.range-slider::-webkit-slider-thumb:hover {
    transform: scale(1.15);
}

.range-slider::-moz-range-thumb {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--color-white);
    border: 3px solid var(--color-dark);
    cursor: pointer;
    box-shadow: 0px 2px 5px rgba(0,0,0,0.3);
    transition: transform 0.1s ease;
}

.range-slider::-moz-range-thumb:hover {
    transform: scale(1.15);
}

/* Total sum display */
.sum-validator-box {
    background-color: rgba(255,255,255,0.03);
    border: 1px dashed #333333;
    padding: 12px;
    border-radius: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.9rem;
}

.sum-validator-box.error {
    border-color: red;
    background-color: rgba(255,0,0,0.05);
}

.sum-validator-box.error strong {
    color: red;
}

.sum-validator-box strong {
    font-family: var(--font-heading);
    font-weight: 700;
    color: var(--color-green);
    font-size: 1rem;
}

/* ==========================================================================
   SIMULATOR CHART STYLES
   ========================================================================== */
.simulator-section {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.simulator-section h4 {
    font-family: var(--font-heading);
    font-weight: 600;
    font-size: 1.05rem;
    color: var(--color-white);
    display: flex;
    align-items: center;
    gap: 8px;
}

.simulator-section h4 i {
    color: var(--color-blue);
}

.simulator-desc {
    color: #666666;
    font-size: 0.78rem;
    line-height: 1.4;
}

.simulation-results {
    background-color: var(--color-dark-gray);
    border: 2px solid #222222;
    border-radius: 10px;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    animation: historyEnter 0.3s ease;
}

.simulation-results h5 {
    font-family: var(--font-heading);
    font-size: 0.85rem;
    color: #888888;
}

.bar-chart-container {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.bar-chart-row {
    display: grid;
    grid-template-columns: 75px 1fr 90px;
    align-items: center;
    gap: 8px;
    font-size: 0.78rem;
}

.bar-label {
    font-family: var(--font-heading);
    font-weight: 600;
    color: #999;
}

.bar-track {
    background-color: rgba(0,0,0,0.3);
    height: 12px;
    border-radius: 6px;
    overflow: hidden;
    position: relative;
    border: 1px solid #222;
}

.bar-fill {
    height: 100%;
    border-radius: 6px;
    width: 0%;
    transition: width 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

.bar-pct {
    text-align: right;
    font-weight: 600;
    font-family: var(--font-heading);
    color: var(--color-white);
}

/* Backgrounds for fills */
.bg-gold { background-color: var(--color-gold); }
.bg-blue { background-color: var(--color-blue); }
.bg-green { background-color: var(--color-green); }
.bg-orange { background-color: var(--color-orange); }
.bg-yellow-chart { background-color: var(--color-yellow); }
.bg-purple { background-color: var(--color-purple); }

/* Color helpers */
.text-yellow { color: var(--color-yellow); }
.text-gold { color: var(--color-gold); }
.text-blue { color: var(--color-blue); }
.text-green { color: var(--color-green); }
