/* === Root Variables === */
:root {
    --bg-primary: #E8F4FF;
    --bg-secondary: #D0E8FF;
    --bg-tertiary: #B8DCFF;
    --accent-gold: #0099FF;
    --accent-amber: #0077CC;
    --accent-red: #dc143c;
    --accent-green: #00cc44;
    --text-primary: #0A1929;
    --text-secondary: #1A4366;
    --text-gold: #0099FF;
    --reel-bg: #1A5B99;
    --reel-border: #0099FF;
    --btn-gradient: linear-gradient(135deg, #0099FF, #0077CC);
    --btn-gradient-hover: linear-gradient(135deg, #00B3FF, #0088DD);
    --btn-gradient-disabled: linear-gradient(180deg, #666, #444);
    --shadow-gold: 0 0 20px rgba(0, 153, 255, 0.3);
    --shadow-gold-strong: 0 0 40px rgba(0, 153, 255, 0.5);
    --accent-warm: #FF9F1C;
    --win-glow: rgba(0, 212, 255, 0.8);
    --jackpot-color: #FF9F1C;
    --free-spins-color: #00D4FF;
    --border-radius: 8px;
}

/* === Reset & Base === */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    touch-action: manipulation;         /* Fix: iOS double-tap zoom prevention */
}

body {
    font-family: 'Segoe UI', 'Helvetica Neue', Arial, sans-serif;
    background: var(--bg-primary);
    background-image:
        radial-gradient(ellipse at 50% 0%, rgba(0, 100, 200, 0.2) 0%, transparent 60%),
        radial-gradient(ellipse at 50% 100%, rgba(0, 70, 150, 0.15) 0%, transparent 60%);
    color: var(--text-primary);
    display: flex;
    justify-content: center;
    align-items: flex-start;
    user-select: none;
    -webkit-user-select: none;
    touch-action: manipulation;
    -ms-touch-action: manipulation;
    overflow-y: auto;
}

/* === Splash Screen === */
#splash-screen {
    position: fixed;
    inset: 0;
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    background: radial-gradient(ellipse at 50% 40%, #B8DCFF, #E8F4FF 70%);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    transition: opacity 0.5s ease;
}

#splash-screen.hidden {
    opacity: 0;
    pointer-events: none;
}

#splash-content {
    text-align: center;
}

#splash-title {
    font-size: clamp(1.8rem, 6vw, 2.5rem);
    color: var(--accent-gold);
    text-shadow: 0 0 30px rgba(0, 153, 255, 0.5), 0 2px 4px rgba(0,0,0,0.5);
    margin: 0 0 8px 0;
    letter-spacing: 3px;
}

#splash-subtitle {
    font-size: 1.1rem;
    color: var(--text-secondary);
    margin: 0 0 40px 0;
    letter-spacing: 2px;
}

#splash-btn {
    background: var(--btn-gradient);
    color: #ffffff;
    border: none;
    padding: 14px 40px;
    font-size: clamp(1rem, 3.5vw, 1.3rem);
    font-weight: bold;
    border-radius: 50px;
    cursor: pointer;
    letter-spacing: 2px;
    box-shadow: 0 0 30px rgba(0, 153, 255, 0.4), 0 4px 15px rgba(0,0,0,0.3);
    animation: splashPulse 2s ease-in-out infinite;
}

#splash-btn:hover {
    background: var(--btn-gradient-hover);
    box-shadow: 0 0 40px rgba(0, 153, 255, 0.6);
}

@keyframes splashPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

/* === Game Views Wrapper (dynamically-loaded game views are injected here) === */
#game-views {
    width: 100%;
    display: flex;
    flex-direction: column;
}

/* Hide #game-views when empty so it doesn't consume flex space alongside #lobby-container */
#game-views:empty {
    display: none;
}

/* === Game Container === */
#game-container {
    width: 100%;
    max-width: 900px;
    height: 100vh;
    display: flex;
    flex-direction: column;
    background: var(--bg-secondary);
    border-radius: 12px;
    box-shadow: var(--shadow-gold);
    overflow: hidden;
    position: relative;
}

/* === Jackpot Banner === */
#jackpot-banner {
    background: linear-gradient(90deg, #E8F4FF, #B8DCFF, #E8F4FF);
    padding: 8px 0;
    text-align: center;
    border-bottom: 2px solid var(--accent-gold);
    flex-shrink: 0;
}

#jackpot-display {
    font-size: 1.4rem;
    font-weight: bold;
    color: #FF9F1C;
    text-shadow: 0 0 10px rgba(255, 159, 28, 0.6);
    letter-spacing: 2px;
}

/* === Info Bar === */
#info-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 20px;
    background: var(--bg-tertiary);
    flex-shrink: 0;
}

#info-bar > div {
    font-size: 0.95rem;
    font-weight: 600;
}

#balance-display { color: var(--text-primary); }
#win-display { color: var(--accent-gold); }

#balance, #win-amount {
    font-variant-numeric: tabular-nums;
}

/* === Overlays (shared) === */
.overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 100;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    overflow-y: auto;
    padding: 10px 0;
    box-sizing: border-box;
    touch-action: manipulation;         /* Fix: iOS double-tap zoom prevention */
}

.overlay.active {
    opacity: 1;
    pointer-events: all;
}

.overlay h2 {
    font-size: 1.8rem;
    color: #FF9F1C;
    text-shadow: 0 0 20px rgba(255, 159, 28, 0.6);
    margin-bottom: 8px;
}

.overlay p {
    font-size: 1rem;
    color: #ffffff;
    margin-bottom: 8px;
}

.overlay .btn-overlay {
    margin-top: 10px;
    padding: 10px 36px;
    font-size: 1.1rem;
    font-weight: bold;
    color: #ffffff;
    background: var(--btn-gradient);
    border: none;
    border-radius: 25px;
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.overlay .btn-overlay:hover {
    background: var(--btn-gradient-hover);
}

/* === Hidden utility === */
.hidden {
    display: none !important;
}

/* === Message display === */
#message-display {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 1.8rem;
    font-weight: bold;
    color: #FF9F1C;
    text-shadow: 0 0 20px rgba(255, 159, 28, 0.8), 0 2px 4px rgba(0,0,0,0.5);
    z-index: 50;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s ease;
    white-space: nowrap;
}

#message-display.show {
    opacity: 1;
}
