/* =========================================================
   NeuroPlay Arcade - Shared Global Styles

   Purpose:
   - Defines global design system (colors, spacing, shadows)
   - Provides base resets and typography
   - Includes reusable UI components (buttons, panels, navbar)
   - Handles global layout elements and responsive behavior

   Scope:
   - Used across all pages and games
   ========================================================= */

/* =========================
   RESET & BASE NORMALIZATION
   ========================= */

/* Ensure consistent box model and remove default spacing */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

/* =========================
   DESIGN TOKENS (CSS VARIABLES)
   ========================= */

/* Centralized theme variables for colors, spacing, shadows, etc.
   Makes it easy to maintain consistent design across the app */
:root {
    /* Background layers */
    --bg-1: #07111f;
    --bg-2: #0d1830;
    --bg-3: #121f3d;

    /* Surface layers (cards, panels, overlays) */
    --surface-1: rgba(255,255,255,0.06);
    --surface-2: rgba(255,255,255,0.08);
    --surface-3: rgba(255,255,255,0.12);

    /* Text hierarchy */
    --text-1: #f4f7ff;   /* Primary text */
    --text-2: #c7d1f4;   /* Secondary text */
    --text-3: #8d9ccf;   /* Muted text */

    /* Brand colors */
    --primary: #6ea8fe;
    --secondary: #a78bfa;
    --accent: #22d3ee;

    /* Shadows for depth hierarchy */
    --shadow-sm: 0 10px 24px rgba(0,0,0,0.18);
    --shadow-md: 0 16px 36px rgba(0,0,0,0.26);
    --shadow-lg: 0 28px 64px rgba(0,0,0,0.34);

    /* Border styles */
    --border-soft: 1px solid rgba(255,255,255,0.1);
    --border-strong: 1px solid rgba(255,255,255,0.18);

    /* Border radius scale */
    --radius-sm: 12px;
    --radius-md: 18px;
    --radius-lg: 24px;
    --radius-xl: 32px;

    /* Max container width */
    --container: 1280px;
}

/* Smooth scrolling for anchor navigation */
html {
    scroll-behavior: smooth;
}

/* =========================
   GLOBAL BODY STYLING
   ========================= */

/* Main application background + typography setup */
body {
    min-height: 100vh;
    font-family: Inter, "Segoe UI", Roboto, Arial, sans-serif;
    color: var(--text-1);

    /* Layered gradient background for depth and glow effect */
    background:
        radial-gradient(circle at top left, rgba(110,168,254,0.18), transparent 26%),
        radial-gradient(circle at right top, rgba(167,139,250,0.16), transparent 24%),
        radial-gradient(circle at center bottom, rgba(34,211,238,0.12), transparent 28%),
        linear-gradient(145deg, var(--bg-1), var(--bg-2), var(--bg-3));

    background-attachment: fixed;
    overflow-x: hidden;

    /* Fade-in effect when page is ready */
    opacity: 0;
    transition: opacity 0.45s ease;
}

/* Activated when JS signals page load completion */
body.page-ready {
    opacity: 1;
}

/* Remove default link styling */
a {
    color: inherit;
    text-decoration: none;
}

/* Ensure consistent font inheritance for form elements */
button,
input,
select {
    font: inherit;
}

/* =========================
   BACKGROUND GLOW EFFECT
   ========================= */

/* Decorative glowing background layer */
.background-glow {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: -1;
}

/* Glow blobs (blurred gradient circles) */
.background-glow::before,
.background-glow::after {
    content: "";
    position: absolute;
    border-radius: 50%;
    filter: blur(90px);
    opacity: 0.35;
}

/* Left/top glow */
.background-glow::before {
    width: 320px;
    height: 320px;
    top: 40px;
    left: -80px;
    background: rgba(110,168,254,0.22);
}

/* Right/bottom glow */
.background-glow::after {
    width: 420px;
    height: 420px;
    right: -120px;
    bottom: -60px;
    background: rgba(167,139,250,0.18);
}

/* =========================
   NAVBAR
   ========================= */

/* Sticky navigation bar with blur/glass effect */
.navbar {
    position: sticky;
    top: 0;
    z-index: 1000;
    background: rgba(9, 17, 35, 0.78);
    backdrop-filter: blur(14px);
    border-bottom: var(--border-soft);
}

/* Inner container to center content and control width */
.navbar-inner {
    width: min(var(--container), calc(100% - 2rem));
    margin: 0 auto;
    min-height: 82px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

/* Brand container (logo + text) */
.brand {
    display: flex;
    align-items: center;
    gap: 0.9rem;
    flex-shrink: 0;
}

/* Logo badge styling */
.brand-logo {
    width: 50px;
    height: 50px;
    border-radius: 16px;
    display: grid;
    place-items: center;
    font-size: 1.35rem;
    font-weight: 900;
    color: white;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    box-shadow: 0 12px 24px rgba(110,168,254,0.22);
}

/* Brand text container */
.brand-text {
    display: flex;
    flex-direction: column;
}

/* Main brand name */
.brand-title {
    font-size: 1.12rem;
    font-weight: 900;
    line-height: 1;
}

/* Subtitle/tagline */
.brand-subtitle {
    font-size: 0.82rem;
    color: var(--text-3);
    margin-top: 0.18rem;
}

/* Navigation links container */
.nav-links {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    flex-wrap: wrap;
    justify-content: flex-end;
}

/* Shared button/link base styles */
.nav-links a,
.music-btn,
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 46px;
    padding: 0.85rem 1.05rem;
    border-radius: 999px;
    font-weight: 700;
    transition: 0.2s ease;
}

/* Default nav link */
.nav-links a {
    color: var(--text-2);
}

/* Hover state */
.nav-links a:hover {
    background: rgba(255,255,255,0.06);
    color: white;
}

/* Active page link */
.nav-links a.active {
    color: white;
    background: linear-gradient(135deg, rgba(110,168,254,0.18), rgba(167,139,250,0.18));
    border: var(--border-soft);
}

/* =========================
   BUTTON SYSTEM
   ========================= */

/* Music toggle button */
.music-btn {
    border: var(--border-soft);
    background: rgba(255,255,255,0.05);
    color: var(--text-1);
    cursor: pointer;
}

/* Hover effect */
.music-btn:hover {
    background: rgba(255,255,255,0.1);
}

/* Disabled/off state */
.music-btn.music-off {
    opacity: 0.72;
}

/* Base button */
.btn {
    border: none;
    cursor: pointer;
}

/* Primary button (main CTA) */
.btn.primary {
    background: linear-gradient(135deg, #4d8dff, #6f6cff);
    color: white;
    box-shadow: 0 12px 24px rgba(77,141,255,0.22);
}

/* Secondary button */
.btn.secondary {
    background: linear-gradient(135deg, #8b5cf6, #6d4cff);
    color: white;
    box-shadow: 0 12px 24px rgba(139,92,246,0.22);
}

/* Outline/ghost button */
.btn.outline {
    background: rgba(255,255,255,0.05);
    color: white;
    border: var(--border-soft);
}

/* Universal hover interaction for buttons */
.btn:hover,
button:hover {
    transform: translateY(-2px);
}

/* Pressed state animation */
.pressing {
    transform: scale(0.97) !important;
}

/* =========================
   PANELS & CONTROLS
   ========================= */

/* Reusable card/panel container */
.panel-box {
    background: linear-gradient(180deg, rgba(255,255,255,0.08), rgba(255,255,255,0.045));
    border: var(--border-soft);
    box-shadow: var(--shadow-sm);
    border-radius: 18px;
    padding: 1rem;
}

/* Panel title */
.panel-box h2 {
    font-size: 1.08rem;
    margin-bottom: 0.9rem;
}

/* Form control group */
.control-group {
    margin-bottom: 1rem;
}

/* Label styling */
.control-group label {
    display: block;
    margin-bottom: 0.4rem;
    color: var(--text-2);
    font-size: 0.88rem;
    font-weight: 600;
}

/* Select input styling */
.control-group select {
    width: 100%;
    padding: 0.82rem 0.9rem;
    border-radius: 12px;
    border: var(--border-soft);
    background: rgba(9,18,36,0.92);
    color: white;
    outline: none;
}

/* Vertical stack of control buttons */
.control-buttons {
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
}

/* Individual control button */
.control-btn {
    min-height: 48px;
    border-radius: 12px;
    border: none;
    font-weight: 800;
    cursor: pointer;
    transition: 0.18s ease;
}

/* Button variants */
.primary-btn { background: linear-gradient(135deg, #4d8dff, #6f6cff); color: white; }
.secondary-btn { background: linear-gradient(135deg, #8b5cf6, #6d4cff); color: white; }
.ghost-btn { background: rgba(255,255,255,0.05); color: white; border: var(--border-soft); }

/* =========================
   COMMON UI ELEMENTS
   ========================= */

/* Board/game message display */
.board-message {
    margin-top: 1rem;
    padding: 0.95rem 1rem;
    border-radius: 14px;
    background: rgba(255,255,255,0.05);
    border: var(--border-soft);
    color: var(--text-2);
    text-align: center;
}

/* Footer styling */
.footer {
    margin-top: 3rem;
    padding: 1.5rem 1rem 2rem;
    text-align: center;
    color: var(--text-3);
    border-top: var(--border-soft);
}

/* Informational list (used in side panels/help sections) */
.info-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
}

/* List item with custom bullet */
.info-list li {
    color: var(--text-2);
    line-height: 1.65;
    padding-left: 1rem;
    position: relative;
}

/* Custom accent dot bullet */
.info-list li::before {
    content: "";
    position: absolute;
    left: 0;
    top: 0.7rem;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--accent);
}

/* =========================
   RESPONSIVE DESIGN
   ========================= */

/* Tablet layout adjustments */
@media (max-width: 900px) {
    .navbar-inner {
        flex-direction: column;
        align-items: stretch;
        justify-content: center;
        padding: 0.9rem 0;
    }

    .brand {
        justify-content: center;
    }

    .nav-links {
        justify-content: center;
    }
}

/* Mobile layout adjustments */
@media (max-width: 560px) {
    .nav-links {
        display: grid;
        grid-template-columns: 1fr 1fr;
        width: 100%;
    }

    .nav-links a,
    .music-btn {
        width: 100%;
    }
}