/* ============================================
   Math Blaster - Main Stylesheet
   ============================================ */

:root {
    --neon-blue: #00d4ff;
    --neon-pink: #ff006e;
    --neon-green: #00ff87;
    --neon-yellow: #ffbe0b;
    --neon-purple: #8338ec;
    --neon-orange: #fb5607;
    --bg-dark: #0a0a1a;
    --bg-medium: #12122a;
    --bg-light: #1a1a3e;
    --text-primary: #ffffff;
    --text-secondary: rgba(255, 255, 255, 0.7);
    --text-muted: rgba(255, 255, 255, 0.4);
    --border-subtle: rgba(255, 255, 255, 0.1);
    --border-light: rgba(255, 255, 255, 0.2);
    --space-xs: 4px;
    --space-sm: 8px;
    --space-md: 12px;
    --space-lg: 16px;
    --space-xl: 24px;
    --space-2xl: 32px;
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-full: 50%;
    --font-display: 'Orbitron', monospace;
    --font-body: 'Rajdhani', sans-serif;
    --transition-fast: 0.15s ease;
    --transition-normal: 0.3s ease;
    --transition-slow: 0.5s ease;
    --z-canvas: 1;
    --z-effects: 5;
    --z-hud: 10;
    --z-buttons: 15;
    --z-floating: 50;
    --z-popups: 60;
    --z-screens: 100;
    --z-ads: 200;
}

*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

html {
    -webkit-text-size-adjust: 100%;
    -ms-text-size-adjust: 100%;
}

body {
    font-family: var(--font-body);
    background: var(--bg-dark);
    color: var(--text-primary);
    overflow: hidden;
    height: 100vh;
    height: 100dvh;
    width: 100vw;
    position: relative;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    touch-action: manipulation;
}

.stars-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
    overflow: hidden;
}

.star {
    position: absolute;
    background: var(--text-primary);
    border-radius: var(--radius-full);
    animation: twinkle var(--duration, 3s) ease-in-out infinite;
}

@keyframes twinkle {
    0%, 100% { opacity: 0.2; }
    50% { opacity: 1; }
}

#gameContainer {
    position: relative;
    width: 100%;
    height: 100%;
    z-index: 1;
}

#gameCanvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: var(--z-canvas);
    display: block;
}

#hiddenInput {
    position: absolute;
    left: -9999px;
    top: -9999px;
    opacity: 0;
    width: 0;
    height: 0;
    border: none;
    outline: none;
}

/* ---------- Icon Sizes ---------- */
.btn-icon {
    width: 18px;
    height: 18px;
    display: block;
}

.btn-icon-inline {
    width: 16px;
    height: 16px;
    display: inline-block;
    vertical-align: middle;
    margin-right: 6px;
}

.title-icon {
    width: 28px;
    height: 28px;
    display: inline-block;
    vertical-align: middle;
    margin-right: 8px;
}

.setting-icon {
    width: 16px;
    height: 16px;
    display: inline-block;
    vertical-align: middle;
    margin-right: 6px;
    opacity: 0.7;
}

/* ---------- Scrollbar ---------- */
::-webkit-scrollbar {
    width: 4px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--neon-blue);
    border-radius: 2px;
}

* {
    scrollbar-width: thin;
    scrollbar-color: var(--neon-blue) transparent;
}

::selection {
    background: rgba(0, 212, 255, 0.3);
    color: var(--text-primary);
}

/* ============================================
   Loading Screen
   ============================================ */

.loading-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-dark);
    transition: opacity 0.6s ease, visibility 0.6s ease;
}

.loading-screen.loaded {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.loading-content {
    text-align: center;
    padding: var(--space-xl);
    max-width: 400px;
    width: 90%;
}

.loading-title {
    font-family: var(--font-display);
    font-size: clamp(32px, 8vw, 52px);
    font-weight: 900;
    background: linear-gradient(135deg, var(--neon-blue), var(--neon-pink), var(--neon-purple));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: var(--space-xs);
    animation: titleGlow 3s ease infinite;
}

@keyframes titleGlow {
    0%, 100% { filter: drop-shadow(0 0 10px rgba(0, 212, 255, 0.5)); }
    50% { filter: drop-shadow(0 0 25px rgba(255, 0, 110, 0.5)); }
}

.loading-subtitle {
    font-family: var(--font-display);
    font-size: clamp(10px, 3vw, 13px);
    color: var(--text-muted);
    letter-spacing: 4px;
    text-transform: uppercase;
    margin-bottom: var(--space-2xl);
}

.loading-bar-container {
    width: 100%;
    height: 4px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 2px;
    overflow: hidden;
    margin-bottom: var(--space-lg);
    position: relative;
}

.loading-bar {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--neon-blue), var(--neon-purple), var(--neon-pink));
    border-radius: 2px;
    transition: width 0.3s ease;
    position: relative;
}

.loading-bar::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 20px;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4));
    border-radius: 2px;
    animation: loadingShine 1.5s ease infinite;
}

@keyframes loadingShine {
    0%, 100% { opacity: 0; }
    50% { opacity: 1; }
}

.loading-status {
    font-family: var(--font-display);
    font-size: 11px;
    color: var(--text-muted);
    letter-spacing: 2px;
    text-transform: uppercase;
    margin-bottom: var(--space-xl);
}

.loading-tip {
    font-family: var(--font-body);
    font-size: 13px;
    color: rgba(255, 255, 255, 0.3);
    font-style: italic;
    line-height: 1.5;
    min-height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.3s ease;
}

.loading-spinner {
    width: 24px;
    height: 24px;
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-top-color: var(--neon-blue);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto var(--space-lg);
}

@keyframes spin {
    to { transform: rotate(360deg); }
}