/* ============================================
   FOREST MAGIC — Core Design System
   ============================================ */

/* ----- CSS Custom Properties ----- */
:root {
    /* Primary palette */
    --color-bg-deep: #0d0517;
    --color-bg-primary: #1a0a2e;
    --color-bg-secondary: #2a1045;
    --color-bg-tertiary: #3d1a60;

    /* Accent colors */
    --color-gold: #ffd700;
    --color-gold-light: #ffe44d;
    --color-gold-dark: #b8960f;
    --color-cyan: #00f0ff;
    --color-cyan-light: #66f7ff;
    --color-cyan-dark: #00b8c4;
    --color-magenta: #ff006e;
    --color-magenta-light: #ff4d94;
    --color-green: #00ff88;
    --color-green-dark: #00cc6a;
    --color-red: #ff3333;
    --color-orange: #ff8c00;

    /* Text colors */
    --color-text-primary: #ffffff;
    --color-text-secondary: rgba(255, 255, 255, 0.7);
    --color-text-tertiary: rgba(255, 255, 255, 0.45);
    --color-text-gold: var(--color-gold);

    /* Glass */
    --glass-bg: rgba(26, 10, 46, 0.65);
    --glass-bg-strong: rgba(26, 10, 46, 0.85);
    --glass-border: rgba(255, 255, 255, 0.08);
    --glass-border-light: rgba(255, 255, 255, 0.15);
    --glass-blur: 16px;

    /* Shadows */
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.5);
    --shadow-glow-gold: 0 0 20px rgba(255, 215, 0, 0.3);
    --shadow-glow-cyan: 0 0 20px rgba(0, 240, 255, 0.3);
    --shadow-glow-magenta: 0 0 20px rgba(255, 0, 110, 0.3);

    /* Typography */
    --font-display: 'Orbitron', sans-serif;
    --font-body: 'Inter', sans-serif;
    --font-size-xs: 0.625rem;
    --font-size-sm: 0.75rem;
    --font-size-base: 0.875rem;
    --font-size-md: 1rem;
    --font-size-lg: 1.25rem;
    --font-size-xl: 1.5rem;
    --font-size-2xl: 2rem;
    --font-size-3xl: 2.5rem;
    --font-size-4xl: 3.5rem;

    /* Spacing */
    --space-1: 4px;
    --space-2: 8px;
    --space-3: 12px;
    --space-4: 16px;
    --space-5: 20px;
    --space-6: 24px;
    --space-8: 32px;
    --space-10: 40px;
    --space-12: 48px;

    /* Border Radius */
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    --radius-full: 9999px;

    /* Transitions */
    --transition-fast: 150ms ease;
    --transition-base: 250ms ease;
    --transition-slow: 400ms ease;

    /* Z-Index scale */
    --z-canvas: 1;
    --z-ui: 10;
    --z-overlay: 50;
    --z-modal: 100;
    --z-popup: 200;
    --z-toast: 300;
    --z-loading: 1000;
}

/* ----- Reset & Base ----- */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font-body);
    background: var(--color-bg-deep);
    color: var(--color-text-primary);
    overflow: hidden;
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    position: relative;
    user-select: none;
    -webkit-user-select: none;
    -webkit-tap-highlight-color: transparent;
}

a { color: var(--color-cyan); text-decoration: none; }
img { max-width: 100%; display: block; }
button { cursor: pointer; border: none; background: none; font-family: inherit; color: inherit; }
input, select { font-family: inherit; }

/* ----- Scrollbar ----- */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: rgba(255, 255, 255, 0.03); }
::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.15); border-radius: var(--radius-full); }
::-webkit-scrollbar-thumb:hover { background: rgba(255, 255, 255, 0.25); }

/* ----- Selection ----- */
::selection { background: var(--color-magenta); color: white; }

/* ----- Typography System ----- */
.font-display { font-family: var(--font-display); }
.font-body { font-family: var(--font-body); }

.text-xs { font-size: var(--font-size-xs); }
.text-sm { font-size: var(--font-size-sm); }
.text-base { font-size: var(--font-size-base); }
.text-md { font-size: var(--font-size-md); }
.text-lg { font-size: var(--font-size-lg); }
.text-xl { font-size: var(--font-size-xl); }
.text-2xl { font-size: var(--font-size-2xl); }
.text-3xl { font-size: var(--font-size-3xl); }

/* ----- Glassmorphism ----- */
.glass-panel {
    background: var(--glass-bg);
    backdrop-filter: blur(var(--glass-blur));
    -webkit-backdrop-filter: blur(var(--glass-blur));
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
}

.glass-panel-strong {
    background: var(--glass-bg-strong);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid var(--glass-border-light);
    border-radius: var(--radius-lg);
}

/* ----- Button Styles ----- */
.btn-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    padding: var(--space-3) var(--space-6);
    font-family: var(--font-display);
    font-size: var(--font-size-base);
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--color-bg-deep);
    background: linear-gradient(135deg, var(--color-gold), var(--color-gold-light));
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-glow-gold);
    transition: all var(--transition-base);
    position: relative;
    overflow: hidden;
}

.btn-primary::before {
    content: '';
    position: absolute;
    top: 0; left: -100%; right: 0; bottom: 0;
    width: 200%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
    animation: shimmer 3s infinite;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 0 30px rgba(255, 215, 0, 0.5);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-secondary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    padding: var(--space-3) var(--space-6);
    font-family: var(--font-display);
    font-size: var(--font-size-sm);
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--color-text-primary);
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid var(--glass-border-light);
    border-radius: var(--radius-md);
    transition: all var(--transition-base);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: var(--color-cyan);
    box-shadow: var(--shadow-glow-cyan);
}

.btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: var(--radius-full);
    color: var(--color-text-secondary);
    transition: all var(--transition-fast);
}

.btn-icon:hover {
    color: var(--color-text-primary);
    background: rgba(255, 255, 255, 0.1);
}

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

/* ----- Glow Effects ----- */
.glow-text {
    text-shadow: 0 0 8px rgba(255, 215, 0, 0.6),
                 0 0 16px rgba(255, 215, 0, 0.3);
    color: var(--color-gold);
}

.glow-cyan {
    text-shadow: 0 0 8px rgba(0, 240, 255, 0.6),
                 0 0 16px rgba(0, 240, 255, 0.3);
    color: var(--color-cyan);
}

.glow-magenta {
    text-shadow: 0 0 8px rgba(255, 0, 110, 0.6),
                 0 0 16px rgba(255, 0, 110, 0.3);
    color: var(--color-magenta);
}

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

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

.toggle-slider {
    position: absolute;
    cursor: pointer;
    inset: 0;
    background: rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-full);
    transition: var(--transition-base);
}

.toggle-slider::before {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    left: 3px;
    bottom: 3px;
    background: white;
    border-radius: 50%;
    transition: var(--transition-base);
}

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

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

/* ----- Utility ----- */
.sr-only {
    position: absolute;
    width: 1px; height: 1px;
    padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0,0,0,0);
    border: 0;
}

.text-gold { color: var(--color-gold); }
.text-cyan { color: var(--color-cyan); }
.text-green { color: var(--color-green); }
.text-magenta { color: var(--color-magenta); }
