:root {
    --bg-primary: #0f172a;
    --bg-secondary: #1e293b;
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    
    /* Dark Glass Default Theme */
    --accent: #38bdf8;
    --accent-glow: rgba(56, 189, 248, 0.5);
    --error: #ef4444;
    --error-glow: rgba(239, 68, 68, 0.5);
    --success: #10b981;
    --tile-bg: rgba(255, 255, 255, 0.1);
    --tile-hover: rgba(255, 255, 255, 0.2);
    --tile-revealed: rgba(0, 0, 0, 0.3);
    
    --font-ui: 'Inter', sans-serif;
    --font-mono: 'JetBrains Mono', monospace;
}

[data-theme="neon-cyber"] {
    --bg-primary: #2e1065; --bg-secondary: #4c1d95;
    --accent: #f472b6; --accent-glow: rgba(244, 114, 182, 0.5);
    --tile-bg: rgba(255, 255, 255, 0.15); --tile-hover: rgba(255, 255, 255, 0.3);
}
[data-theme="emerald-forest"] {
    --bg-primary: #022c22; --bg-secondary: #064e3b;
    --accent: #34d399; --accent-glow: rgba(52, 211, 153, 0.5);
    --tile-bg: rgba(255, 255, 255, 0.1); --tile-hover: rgba(255, 255, 255, 0.2);
}

* { margin: 0; padding: 0; box-sizing: border-box; }
body {
    background-color: var(--bg-primary);
    color: var(--text-primary);
    font-family: var(--font-ui);
    overflow: hidden;
    user-select: none;
    -webkit-user-select: none;
    transition: background-color 0.5s;
}

#game-container { position: relative; width: 100vw; height: 100vh; }
#particle-canvas { position: absolute; top: 0; left: 0; width: 100%; height: 100%; z-index: 1; pointer-events: none; }
#ui-layer { position: absolute; top: 0; left: 0; width: 100%; height: 100%; z-index: 10; pointer-events: none; }

.screen {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    opacity: 0; visibility: hidden; transition: 0.3s ease; pointer-events: auto;
    background: radial-gradient(circle at center, transparent 0%, var(--bg-primary) 100%);
}
.screen.active { opacity: 1; visibility: visible; }
#screen-game { background: transparent; padding-top: 2rem;}

/* Text */
.logo { font-size: 4rem; font-weight: 800; letter-spacing: -2px; margin-bottom: 0.5rem; }
.highlight { color: var(--accent); text-shadow: 0 0 15px var(--accent-glow); }
.subtitle { font-size: 1.2rem; color: var(--text-secondary); letter-spacing: 4px; margin-bottom: 3rem; text-align: center; }
h2 { font-size: 2.5rem; margin-bottom: 2rem; color: var(--text-primary); letter-spacing: 2px; }

/* Buttons */
.btn {
    background: rgba(255,255,255,0.05); border: 1px solid rgba(255,255,255,0.1);
    color: var(--text-primary); padding: 1rem 2rem; font-size: 1.1rem; font-weight: 600;
    border-radius: 8px; cursor: pointer; transition: all 0.2s;
    display: flex; align-items: center; justify-content: center; gap: 0.5rem;
    min-width: 250px; backdrop-filter: blur(10px);
}
.btn:hover { background: rgba(255,255,255,0.1); transform: translateY(-2px); }
.btn.primary { background: var(--accent); color: #fff; border: none; box-shadow: 0 4px 20px var(--accent-glow); }
.btn.primary:hover { filter: brightness(1.2); }
.menu-buttons { display: flex; flex-direction: column; gap: 1rem; }
.menu-buttons.horizontal { flex-direction: row; }

/* Grid Cards */
.modes-grid, .theme-grid, .stats-grid { display: grid; gap: 1.5rem; margin-bottom: 2rem; }
.modes-grid { grid-template-columns: repeat(3, 1fr); }
.mode-card, .theme-card {
    background: rgba(255,255,255,0.03); border: 1px solid rgba(255,255,255,0.1);
    padding: 2rem; border-radius: 12px; cursor: pointer; text-align: center; transition: all 0.2s;
}
.mode-card:hover, .theme-card:hover, .theme-card.active {
    border-color: var(--accent); background: rgba(255,255,255,0.08); box-shadow: 0 0 20px var(--accent-glow); transform: scale(1.05);
}
.mode-card .material-icons { font-size: 3rem; color: var(--accent); margin-bottom: 1rem; }
.mode-card h3 { font-size: 1.2rem; margin-bottom: 0.5rem; }
.mode-card p { color: var(--text-secondary); font-size: 0.9rem; }

/* Themes */
.theme-grid { grid-template-columns: repeat(3, 1fr); }
.theme-preview { width: 100%; height: 80px; border-radius: 8px; border: 2px solid transparent; margin-bottom: 1rem; }

/* Stats */
.stats-card { background: rgba(255,255,255,0.03); border: 1px solid rgba(255,255,255,0.1); border-radius: 12px; padding: 2rem; width: 90%; max-width: 600px; margin-bottom: 2rem; }
.rank-display { display: flex; align-items: center; gap: 1rem; margin-bottom: 1.5rem; }
.rank-icon { font-size: 4rem; color: var(--accent); text-shadow: 0 0 15px var(--accent-glow); }
.xp-bar-container { width: 100%; height: 12px; background: rgba(255,255,255,0.1); border-radius: 6px; overflow: hidden; margin-bottom: 0.5rem; }
.xp-bar { height: 100%; background: var(--accent); width: 0%; transition: width 0.5s ease-out; box-shadow: 0 0 10px var(--accent-glow); }
.xp-text { text-align: right; color: var(--text-secondary); font-size: 0.9rem; margin-bottom: 2rem; }
.stats-grid { grid-template-columns: 1fr 1fr; }
.stat-box { background: rgba(0,0,0,0.2); padding: 1.5rem; border-radius: 8px; text-align: center; }
.stat-box h4 { color: var(--text-secondary); font-size: 0.9rem; margin-bottom: 0.5rem; }
.stat-box p { font-size: 2rem; font-weight: 700; font-family: var(--font-mono); }

/* Game HUD */
.hud { display: flex; justify-content: center; gap: 2rem; align-items: center; margin-bottom: 1rem; background: rgba(0,0,0,0.3); padding: 1rem 2rem; border-radius: 12px; border: 1px solid rgba(255,255,255,0.1); backdrop-filter: blur(10px); }
.hud-item { font-family: var(--font-mono); font-size: 1.5rem; font-weight: 700; display: flex; align-items: center; gap: 0.5rem; min-width: 100px; justify-content: center; }
.text-red { color: var(--error) !important; }
.text-green { color: var(--success) !important; }
.btn-icon { background: none; border: none; color: var(--text-primary); cursor: pointer; display: flex; padding: 0.5rem; border-radius: 50%; transition: 0.2s; }
.btn-icon:hover { background: rgba(255,255,255,0.1); transform: rotate(180deg); color: var(--accent); }
.btn-icon .material-icons { font-size: 2rem; }

/* Board */
.board-wrapper {
    flex: 1; width: 100%; max-height: calc(100vh - 250px);
    display: flex; justify-content: center; align-items: center;
    overflow: auto; padding: 1rem;
    scrollbar-width: thin; scrollbar-color: var(--accent) transparent;
}
.board {
    display: grid; gap: 2px; padding: 4px; background: rgba(255,255,255,0.05);
    border-radius: 8px; border: 1px solid rgba(255,255,255,0.1);
    box-shadow: 0 10px 30px rgba(0,0,0,0.5); margin: auto;
}
.tile {
    width: 32px; height: 32px; background: var(--tile-bg); border-radius: 4px;
    display: flex; justify-content: center; align-items: center;
    font-family: var(--font-mono); font-weight: 700; font-size: 1.2rem;
    cursor: pointer; transition: background 0.1s, transform 0.1s;
    user-select: none; box-shadow: inset 0 2px 5px rgba(255,255,255,0.1);
}
.tile:hover { background: var(--tile-hover); }
.tile:active { transform: scale(0.9); }
.tile.revealed {
    background: var(--tile-revealed); cursor: default; box-shadow: inset 0 2px 10px rgba(0,0,0,0.5);
    border: 1px solid rgba(255,255,255,0.05);
}
.tile.mine { background: var(--error) !important; animation: pop 0.3s ease-out; }
.tile.flag { color: var(--error); animation: pop 0.2s; }

@keyframes pop { 0% { transform: scale(0.5); opacity: 0; } 100% { transform: scale(1); opacity: 1; } }

/* Numbers */
.n-1 { color: #3b82f6; text-shadow: 0 0 5px rgba(59,130,246,0.5); }
.n-2 { color: #10b981; text-shadow: 0 0 5px rgba(16,185,129,0.5); }
.n-3 { color: #ef4444; text-shadow: 0 0 5px rgba(239,68,68,0.5); }
.n-4 { color: #8b5cf6; text-shadow: 0 0 5px rgba(139,92,246,0.5); }
.n-5 { color: #f59e0b; text-shadow: 0 0 5px rgba(245,158,11,0.5); }
.n-6 { color: #06b6d4; text-shadow: 0 0 5px rgba(6,182,212,0.5); }
.n-7 { color: #14b8a6; text-shadow: 0 0 5px rgba(20,184,166,0.5); }
.n-8 { color: #d946ef; text-shadow: 0 0 5px rgba(217,70,239,0.5); }

.controls-hint { color: var(--text-secondary); font-size: 0.9rem; margin-top: 1rem; }

/* Result */
.result-stats { display: flex; flex-wrap: wrap; justify-content: center; gap: 1.5rem; margin-bottom: 3rem; }
.result-box { background: rgba(255,255,255,0.05); padding: 1.5rem 2rem; border-radius: 12px; text-align: center; min-width: 150px; border: 1px solid rgba(255,255,255,0.1); }
.result-box.main-box { border-color: var(--accent); box-shadow: 0 0 20px rgba(0,0,0,0.5), inset 0 0 20px var(--accent-glow); }
.result-box.main-box .result-value { font-size: 4rem; text-shadow: 0 0 20px var(--accent-glow); }
.result-label { font-size: 0.9rem; color: var(--text-secondary); margin-bottom: 0.5rem; font-weight: 600; }
.result-value { font-size: 2.5rem; font-weight: 700; font-family: var(--font-mono); }
.mt-2 { margin-top: 1rem; }

@media (max-width: 768px) {
    .modes-grid, .theme-grid { grid-template-columns: 1fr; }
    .logo { font-size: 3rem; }
    .tile { width: 24px; height: 24px; font-size: 1rem; }
    .controls-hint { display: none; }
}
