/**
 * CORE STYLES - Mind Craft
 */
@import url('https://fonts.googleapis.com/css2?family=Press+Start+2P&family=Space+Grotesk:wght@400;600;700&display=swap');

:root {
    --primary: #00ff88;
    --primary-dark: #00cc6a;
    --accent: #8338ec;
    --background: #0a0e27;
    --surface: #252b48;
    --text: #ffffff;
    --text-secondary: #b4b9d3;
    --gradient-primary: linear-gradient(135deg, #00ff88 0%, #8338ec 100%);
    --glass-bg: rgba(255, 255, 255, 0.05);
    --glass-border: rgba(255, 255, 255, 0.1);
}

* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

body {
    font-family: 'Space Grotesk', sans-serif;
    background: var(--background);
    color: var(--text);
    min-height: 100vh;
    overflow-x: hidden;
}

body::before {
    content: '';
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: radial-gradient(circle at 20% 30%, rgba(131, 56, 236, 0.15) 0%, transparent 50%),
                radial-gradient(circle at 80% 70%, rgba(0, 255, 136, 0.15) 0%, transparent 50%);
    pointer-events: none;
    z-index: -1;
}

.pixel-text { font-family: 'Press Start 2P', cursive; }
.hidden { display: none !important; }

.glass {
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
}

.btn {
    font-weight: 600;
    padding: 12px 24px;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s;
}
.btn-primary {
    background: var(--gradient-primary);
    color: #0a0e27;
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 10px 30px rgba(0, 255, 136, 0.3); }
.btn-ghost {
    background: transparent;
    border: 2px solid var(--primary);
    color: var(--primary);
}

/* Loading Screen */
#loading-screen {
    position: fixed;
    top: 0; left: 0;
    width: 100vw; height: 100vh;
    background: var(--background);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 10000;
}
.minecraft-logo {
    display: grid;
    grid-template-columns: repeat(2, 60px);
    gap: 10px;
    margin-bottom: 24px;
}
.minecraft-logo .block {
    width: 60px; height: 60px;
    background: var(--gradient-primary);
    border-radius: 8px;
    animation: block-float 2s ease-in-out infinite;
}
.minecraft-logo .block:nth-child(2) { animation-delay: 0.2s; }
.minecraft-logo .block:nth-child(3) { animation-delay: 0.4s; }
.minecraft-logo .block:nth-child(4) { animation-delay: 0.6s; }
@keyframes block-float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-15px); }
}
.loading-bar {
    width: 300px; height: 8px;
    background: rgba(255,255,255,0.2);
    border-radius: 4px;
    overflow: hidden;
    margin: 20px 0;
}
.loading-progress {
    height: 100%;
    width: 0%;
    background: var(--gradient-primary);
    transition: width 0.5s;
}
#loading-screen p { color: var(--text-secondary); margin-bottom: 16px; }

.skip-load-btn {
    margin-top: 20px;
    padding: 14px 28px;
    font-size: 1rem;
    font-weight: 600;
    background: var(--gradient-primary);
    color: #0a0e27;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    touch-action: manipulation;
    min-height: 48px;
    min-width: 120px;
}

/* Main Menu */
#main-menu {
    position: fixed;
    top: 0; left: 0;
    width: 100vw; height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 24px;
}
.title-glitch {
    font-family: 'Press Start 2P', cursive;
    font-size: clamp(1.5rem, 6vw, 2.5rem);
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    text-align: center;
    margin-bottom: 48px;
}
.menu-buttons {
    display: flex;
    flex-direction: column;
    gap: 12px;
    width: 100%;
    max-width: 400px;
}
.menu-btn {
    font-size: 1.1rem;
    padding: 18px 24px;
    min-height: 52px;
    background: var(--glass-bg);
    border: 2px solid var(--glass-border);
    border-radius: 12px;
    color: white;
    cursor: pointer;
    transition: all 0.3s;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}
.menu-btn:hover {
    border-color: var(--primary);
    transform: translateX(8px);
    box-shadow: -8px 0 20px rgba(0, 255, 136, 0.3);
}
.stat-display {
    display: flex;
    gap: 32px;
    margin-top: 48px;
}
.stat-item { text-align: center; }
.stat-label { display: block; font-size: 0.75rem; color: var(--text-secondary); margin-bottom: 4px; }
.stat-value { font-family: 'Press Start 2P', cursive; font-size: 1.25rem; color: var(--primary); }

/* Settings Modal */
.settings-modal {
    position: fixed;
    top: 0; left: 0;
    width: 100vw; height: 100vh;
    background: rgba(0,0,0,0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}
.settings-content {
    max-width: 500px;
    width: 90%;
    padding: 32px;
    border-radius: 20px;
    border: 2px solid var(--primary);
}
.settings-content h2 { margin-bottom: 24px; }
.setting-item { margin-bottom: 20px; }
.setting-item label { display: block; margin-bottom: 8px; }
.setting-actions { margin-top: 24px; display: flex; gap: 12px; }
.toggle-btn { padding: 8px 16px; border-radius: 8px; cursor: pointer; }

.progress-bar-container {
    width: 100%;
    height: 12px;
    background: rgba(255,255,255,0.2);
    border-radius: 6px;
    overflow: hidden;
}
.progress-bar {
    height: 100%;
    background: var(--gradient-primary);
    border-radius: 6px;
    transition: width 0.5s;
}

/* Quest UI */
.quest-card {
    background: white;
    border-radius: 12px;
    padding: 24px;
    margin: 16px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.quest-description {
    font-size: 16px;
    line-height: 1.6;
    margin: 16px 0;
}

.quest-hint {
    background: #fff3cd;
    border-left: 4px solid #ffc107;
    padding: 12px;
    margin: 16px 0;
    border-radius: 4px;
}

.quest-rewards {
    display: flex;
    gap: 16px;
    margin: 16px 0;
}

.quest-tools {
    display: flex;
    gap: 8px;
    margin: 16px 0;
    flex-wrap: wrap;
}

.tool-btn {
    background: #f0f0f0;
    border: 1px solid #ddd;
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
}

.tool-btn:hover {
    background: #e0e0e0;
}

.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-content {
    background: white;
    padding: 24px;
    border-radius: 12px;
    max-width: 600px;
    max-height: 80vh;
    overflow-y: auto;
    position: relative;
}

.modal-close {
    position: absolute;
    top: 12px;
    right: 12px;
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
}

.player-info {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 20px;
    border-radius: 12px;
    margin: 16px;
}

.xp-bar {
    background: rgba(255,255,255,0.3);
    height: 8px;
    border-radius: 4px;
    margin: 12px 0;
}

.xp-fill {
    background: white;
    height: 100%;
    transition: width 0.3s ease;
}

.stats {
    display: flex;
    gap: 16px;
    margin-top: 12px;
}

.levelup-modal h2 {
    color: #ffc107;
    font-size: 36px;
    text-align: center;
}

/* ===== HUB WORLD - Cookie Clicker / Roblox style ===== */
#game-container {
    position: fixed;
    top: 0; left: 0;
    width: 100vw; height: 100vh;
    display: flex;
    flex-direction: column;
    padding: 16px;
    overflow-y: auto;
}

.hub-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 8px;
}

.hub-back-btn {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    color: white;
    width: 40px;
    height: 40px;
    border-radius: 10px;
    cursor: pointer;
    font-size: 1.2rem;
    transition: all 0.2s;
}
.hub-back-btn:hover { border-color: var(--primary); }

.hub-stats {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    font-weight: 700;
}

.hub-stat {
    background: var(--glass-bg);
    padding: 8px 14px;
    border-radius: 12px;
    border: 1px solid var(--glass-border);
    font-size: 0.95rem;
}

.hub-stat span { color: var(--primary); }

.hub-passive {
    color: var(--primary);
    font-size: 0.9rem;
    font-weight: 600;
}

.xp-bar-hub {
    height: 8px;
    background: rgba(255,255,255,0.15);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 24px;
}

.xp-fill-hub {
    height: 100%;
    background: var(--gradient-primary);
    border-radius: 4px;
    transition: width 0.5s ease;
    width: 0%;
}

.hub-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 32px;
}

.learn-btn {
    touch-action: manipulation;
    animation: learnPulse 2s ease-in-out infinite;
    width: 200px;
    height: 200px;
    border-radius: 50%;
    background: linear-gradient(135deg, rgba(0,255,136,0.3) 0%, rgba(131,56,236,0.3) 100%);
    border: 4px solid var(--primary);
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    transition: all 0.15s ease;
    box-shadow: 0 0 40px rgba(0,255,136,0.3);
}

.learn-btn:hover { transform: scale(1.05); box-shadow: 0 0 60px rgba(0,255,136,0.5); animation: none; }
.learn-btn:active { transform: scale(0.95); box-shadow: 0 0 80px rgba(0,255,136,0.8); }

@keyframes learnPulse {
    0%, 100% { box-shadow: 0 0 40px rgba(0,255,136,0.3); }
    50% { box-shadow: 0 0 60px rgba(0,255,136,0.6); }
}

.learn-icon { font-size: 64px; margin-bottom: 8px; }
.learn-label { font-weight: 800; font-size: 1rem; text-transform: uppercase; letter-spacing: 1px; }
.learn-sub { font-size: 0.75rem; opacity: 0.8; margin-top: 4px; }

.hub-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    justify-content: center;
}

.hub-action-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 20px 28px;
    min-height: 72px;
    touch-action: manipulation;
    background: var(--glass-bg);
    border: 2px solid var(--glass-border);
    border-radius: 16px;
    color: white;
    cursor: pointer;
    transition: all 0.3s;
    font-weight: 600;
}

.hub-action-btn:hover {
    border-color: var(--primary);
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(0,255,136,0.2);
}

.hub-action-icon { font-size: 32px; }

/* Quest overlay */
#quest-container {
    position: fixed;
    top: 0; left: 0;
    width: 100vw; height: 100vh;
    z-index: 9998;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    overflow-y: auto;
}

#quest-container.hidden { display: none !important; }

/* Upgrades Panel */
.panel-overlay {
    position: fixed;
    top: 0; left: 0;
    width: 100vw; height: 100vh;
    background: rgba(0,0,0,0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    padding: 20px;
}

.panel-content {
    max-width: 500px;
    width: 100%;
    max-height: 85vh;
    overflow-y: auto;
    padding: 24px;
    border-radius: 20px;
}

.panel-content h2 { margin-bottom: 8px; }
.panel-desc { color: var(--text-secondary); font-size: 0.9rem; margin-bottom: 20px; }

.buildings-list { display: flex; flex-direction: column; gap: 10px; margin-bottom: 16px; }
.upgrades-list { display: flex; flex-direction: column; gap: 12px; margin-bottom: 20px; }

.building-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 16px;
    background: rgba(255,255,255,0.05);
    border: 2px solid var(--glass-border);
    border-radius: 12px;
    flex-wrap: wrap;
}
.building-card.affordable { border-color: var(--primary); background: rgba(0,255,136,0.08); }
.building-info { display: flex; align-items: center; gap: 12px; }
.building-icon { font-size: 28px; }
.building-stats { display: block; font-size: 0.8rem; color: var(--text-secondary); margin-top: 2px; }
.building-actions { display: flex; align-items: center; gap: 12px; }
.building-cost { font-weight: 700; color: var(--primary); font-size: 0.9rem; }

.upgrade-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 16px;
    background: rgba(255,255,255,0.05);
    border: 2px solid var(--glass-border);
    border-radius: 12px;
    flex-wrap: wrap;
}

.upgrade-card.affordable { border-color: var(--primary); background: rgba(0,255,136,0.05); }
.upgrade-card.owned { opacity: 0.7; border-color: var(--primary); }

.upgrade-info { flex: 1; min-width: 140px; }
.upgrade-info strong { display: block; margin-bottom: 4px; }
.upgrade-desc { font-size: 0.8rem; color: var(--text-secondary); }
.upgrade-cost { font-weight: 700; color: var(--primary); }
.owned-badge { color: var(--primary); font-size: 1.2rem; }
.btn-sm { padding: 8px 16px; font-size: 0.85rem; }

/* Idle toasts & tap pop */
.idle-toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: var(--gradient-primary);
    color: #0a0e27;
    padding: 12px 24px;
    border-radius: 12px;
    font-weight: 600;
    z-index: 10001;
    opacity: 0;
    transition: all 0.3s ease;
    max-width: 90vw;
}

.idle-toast.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

.tap-pop {
    position: fixed;
    font-weight: 800;
    font-size: 1.2rem;
    color: var(--primary);
    z-index: 10000;
    animation: tapFloat 0.8s ease-out forwards;
    pointer-events: none;
}

@keyframes tapFloat {
    0% { opacity: 1; transform: translateY(0) scale(1); }
    100% { opacity: 0; transform: translateY(-60px) scale(1.2); }
}

.coin-particle {
    position: fixed;
    font-size: 20px;
    pointer-events: none;
    z-index: 9999;
    animation: coinBurst 1.2s ease-out forwards;
}

@keyframes coinBurst {
    0% { opacity: 1; transform: translate(0, 0) scale(1); }
    100% { opacity: 0; transform: translate(30px, -80px) scale(0.5); }
}
.coin-particle:nth-child(2) { animation-name: coinBurst2; }
.coin-particle:nth-child(3) { animation-name: coinBurst3; }
@keyframes coinBurst2 {
    0% { opacity: 1; transform: translate(0, 0) scale(1); }
    100% { opacity: 0; transform: translate(-40px, -70px) scale(0.5); }
}
@keyframes coinBurst3 {
    0% { opacity: 1; transform: translate(0, 0) scale(1); }
    100% { opacity: 0; transform: translate(50px, -90px) scale(0.5); }
}

.golden-bonus {
    position: fixed;
    padding: 16px 24px;
    background: linear-gradient(135deg, #ffd700, #ffaa00);
    color: #1a1a1a;
    font-weight: 800;
    border-radius: 16px;
    cursor: pointer;
    z-index: 10002;
    box-shadow: 0 0 40px rgba(255,215,0,0.6);
    animation: goldenPulse 1s ease-in-out infinite;
}

.golden-bonus:hover { transform: scale(1.05); }

/* Activity modals - Quiz, Word, Math */
.activity-modal {
    position: fixed;
    top: 0; left: 0;
    width: 100vw; height: 100vh;
    background: rgba(0,0,0,0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10001;
    padding: 20px;
}
.activity-content {
    max-width: 420px;
    width: 100%;
    padding: 24px;
    border-radius: 20px;
}
.activity-question {
    font-size: 1.2rem;
    margin: 20px 0;
    line-height: 1.5;
    font-family: 'Space Grotesk', -apple-system, sans-serif;
}
.activity-question.math-expr { font-size: 1.5rem; font-weight: 700; text-align: center; }
.activity-options {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 16px;
}
.activity-opt-btn {
    padding: 16px 20px;
    font-size: 1rem;
    font-weight: 600;
    background: rgba(255,255,255,0.08);
    border: 2px solid var(--glass-border);
    border-radius: 12px;
    color: white;
    cursor: pointer;
    transition: all 0.2s;
}
.activity-opt-btn:hover { border-color: var(--primary); background: rgba(0,255,136,0.1); }
.activity-opt-btn.correct { border-color: #00ff88; background: rgba(0,255,136,0.2); }
.activity-opt-btn.wrong { border-color: #ef4444; background: rgba(239,68,68,0.2); }
.hub-action-btn.primary-action { border-color: var(--primary); background: rgba(0,255,136,0.1); }
.hub-action-btn.secondary-action { opacity: 0.85; }

.hub-arcade { margin-top: 24px; padding-top: 20px; border-top: 1px solid var(--glass-border); width: 100%; max-width: 400px; }
.arcade-title { font-size: 0.9rem; color: var(--text-secondary); margin-bottom: 12px; text-align: center; }

/* Arcade hub buttons - each game gets its own color */
.arcade-buttons { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }
.arcade-slot-btn { border-color: #f59e0b !important; color: #fbbf24 !important; background: rgba(245,158,11,0.15) !important; }
.arcade-slot-btn:hover { border-color: #fbbf24 !important; background: rgba(245,158,11,0.35) !important; box-shadow: 0 0 24px rgba(245,158,11,0.5); transform: translateY(-3px); }
.arcade-memory-btn { border-color: #06b6d4 !important; color: #22d3ee !important; background: rgba(6,182,212,0.15) !important; }
.arcade-memory-btn:hover { border-color: #22d3ee !important; background: rgba(6,182,212,0.35) !important; box-shadow: 0 0 24px rgba(6,182,212,0.5); transform: translateY(-3px); }
.arcade-mixmatch-btn { border-color: #ec4899 !important; color: #f472b6 !important; background: rgba(236,72,153,0.15) !important; }
.arcade-mixmatch-btn:hover { border-color: #f472b6 !important; background: rgba(236,72,153,0.35) !important; box-shadow: 0 0 24px rgba(236,72,153,0.5); transform: translateY(-3px); }

/* ===== THEME: SLOT - Vegas Gold / Amber ===== */
.theme-slot { --game-bg: linear-gradient(145deg, #1a1510 0%, #2d2418 50%, #1a1510 100%); --game-border: #f59e0b; --game-glow: rgba(245,158,11,0.5); --game-win: #fbbf24; }
.theme-slot.glass { background: linear-gradient(145deg, rgba(26,21,16,0.95) 0%, rgba(45,36,24,0.9) 100%) !important; border: 2px solid rgba(245,158,11,0.4) !important; box-shadow: 0 0 40px rgba(245,158,11,0.15); }
.theme-slot h2 { color: #fbbf24; text-shadow: 0 0 20px rgba(251,191,36,0.5); }
.theme-slot .panel-desc { color: #d4a574; }
.arcade-slot.slot-pro { max-width: 340px; position: relative; }
.slot-machine { position: relative; margin: 20px 0; padding: 12px; background: linear-gradient(180deg, rgba(0,0,0,0.6) 0%, rgba(45,36,24,0.8) 50%, rgba(0,0,0,0.6) 100%); border-radius: 16px; border: 2px solid rgba(245,158,11,0.5); box-shadow: inset 0 0 30px rgba(245,158,11,0.08); }
.slot-reels-container { display: flex; gap: 6px; justify-content: center; }
.slot-reel-window { width: 72px; height: 72px; overflow: hidden; border-radius: 12px; background: linear-gradient(180deg, #0f0d0a 0%, #1a1510 100%); border: 2px solid rgba(251,191,36,0.3); position: relative; }
.slot-reel-window.reel-stopped { border-color: #f59e0b; box-shadow: inset 0 0 25px rgba(245,158,11,0.2), 0 0 15px rgba(245,158,11,0.3); }
.slot-reel-strip { display: flex; flex-direction: column; transition: none; will-change: transform; }
.slot-symbol { width: 72px; height: 72px; min-height: 72px; display: flex; align-items: center; justify-content: center; font-size: 36px; flex-shrink: 0; filter: drop-shadow(0 0 4px rgba(251,191,36,0.3)); }
.slot-payline { position: absolute; left: 12px; right: 12px; top: 50%; height: 3px; background: linear-gradient(90deg, transparent, #fbbf24, #f59e0b, #fbbf24, transparent); transform: translateY(-50%); pointer-events: none; box-shadow: 0 0 10px #fbbf24; }
.theme-slot .slot-spin-btn { margin: 16px 0; min-height: 48px; font-weight: 700; letter-spacing: 0.05em; background: linear-gradient(135deg, #f59e0b, #d97706) !important; color: #0a0e27 !important; border: none; box-shadow: 0 4px 20px rgba(245,158,11,0.4); }
.theme-slot .slot-spin-btn:hover { box-shadow: 0 6px 30px rgba(245,158,11,0.6); }
.slot-result { font-weight: 700; margin-top: 16px; min-height: 32px; text-align: center; font-size: 1.1rem; transition: transform 0.2s; color: #94a3b8; }
.slot-result.slot-win .slot-win-amount { display: inline-block; animation: slotWinPop 0.4s ease-out; }
.theme-slot .slot-result { color: #d4a574; }
.theme-slot .slot-result.slot-win { color: #fbbf24; }
.theme-slot .slot-result.slot-lose { color: #a78a5a; }
.theme-slot .btn-ghost { border-color: #f59e0b; color: #fbbf24; }
.slot-confetti { position: absolute; inset: 0; pointer-events: none; overflow: visible; z-index: 10; }
.confetti-piece { position: absolute; width: 8px; height: 8px; top: 20%; border-radius: 2px; animation: confettiFall 2s ease-out forwards; }
@keyframes slotWinPop { 0% { transform: scale(0.5); opacity: 0; } 70% { transform: scale(1.15); } 100% { transform: scale(1); opacity: 1; } }
@keyframes slotShake { 0%,100% { transform: translateX(0); } 20% { transform: translateX(-4px); } 40% { transform: translateX(4px); } 60% { transform: translateX(-2px); } 80% { transform: translateX(2px); } }
@keyframes confettiFall { 0% { transform: translateY(0) rotate(0deg); opacity: 1; } 100% { transform: translateY(200px) rotate(720deg); opacity: 0; } }

/* ===== THEME: MEMORY - Ocean Teal / Cyan ===== */
.theme-memory { --game-bg: linear-gradient(145deg, #0c1929 0%, #0e3d4a 50%, #0c1929 100%); --game-border: #06b6d4; --game-glow: rgba(6,182,212,0.5); }
.theme-memory.glass { background: linear-gradient(145deg, rgba(12,25,41,0.95) 0%, rgba(14,61,74,0.9) 100%) !important; border: 2px solid rgba(6,182,212,0.4) !important; box-shadow: 0 0 40px rgba(6,182,212,0.15); }
.theme-memory h2 { color: #22d3ee; text-shadow: 0 0 20px rgba(34,211,238,0.5); }
.theme-memory .panel-desc { color: #67e8f9; }
.memory-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin: 20px 0; perspective: 800px; }
.memory-card { aspect-ratio: 1; border-radius: 14px; cursor: pointer; font-weight: 700; font-size: 0.85rem; position: relative; transform-style: preserve-3d; transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1); }
.memory-card:hover:not(.flipped):not(.matched) { transform: scale(1.02); }
.memory-card .memory-back, .memory-card .memory-front { position: absolute; inset: 0; backface-visibility: hidden; display: flex; align-items: center; justify-content: center; border-radius: 14px; }
.theme-memory .memory-card .memory-back { background: linear-gradient(135deg, #0891b2, #06b6d4); color: white; font-size: 1.4rem; box-shadow: inset 0 0 20px rgba(6,182,212,0.3); }
.theme-memory .memory-card .memory-front { background: linear-gradient(135deg, #22d3ee, #67e8f9); color: #0c1929; transform: rotateY(180deg); }
.memory-card.flipped { transform: rotateY(180deg); }
.memory-card.matched { transform: rotateY(180deg) scale(0.92); opacity: 0.7; cursor: default; pointer-events: none; animation: memoryMatchPop 0.4s ease-out; }
.theme-memory .memory-card.matched .memory-front { box-shadow: 0 0 25px rgba(34,211,238,0.6); }
.theme-memory .btn-ghost { border-color: #06b6d4; color: #22d3ee; }
@keyframes memoryMatchPop { 0% { transform: rotateY(180deg) scale(1.1); } 100% { transform: rotateY(180deg) scale(0.92); } }

/* ===== THEME: MIX & MATCH - Coral / Pink ===== */
.theme-mixmatch { --game-bg: linear-gradient(145deg, #1f0a14 0%, #2d1520 50%, #1f0a14 100%); --game-border: #ec4899; --game-glow: rgba(236,72,153,0.5); }
.theme-mixmatch.glass { background: linear-gradient(145deg, rgba(31,10,20,0.95) 0%, rgba(45,21,32,0.9) 100%) !important; border: 2px solid rgba(236,72,153,0.4) !important; box-shadow: 0 0 40px rgba(236,72,153,0.15); }
.theme-mixmatch h2 { color: #f472b6; text-shadow: 0 0 20px rgba(244,114,182,0.5); }
.theme-mixmatch .panel-desc { color: #f9a8d4; }
.mixmatch-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin: 20px 0; }
.mixmatch-col { display: flex; flex-direction: column; gap: 10px; }
.theme-mixmatch .mixmatch-item { padding: 16px; background: rgba(236,72,153,0.08); border: 2px solid rgba(244,114,182,0.3); border-radius: 14px; cursor: pointer; text-align: center; font-weight: 600; transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1); }
.theme-mixmatch .mixmatch-item:hover:not(.matched) { border-color: #ec4899; background: rgba(236,72,153,0.2); transform: translateY(-2px); box-shadow: 0 4px 20px rgba(236,72,153,0.2); }
.theme-mixmatch .mixmatch-item.selected { border-color: #f472b6; background: rgba(236,72,153,0.25); box-shadow: 0 0 24px rgba(236,72,153,0.4); transform: scale(1.04); }
.theme-mixmatch .mixmatch-item.matched { opacity: 0.6; cursor: default; transform: scale(0.96); animation: mixmatchMatch 0.4s ease-out; border-color: rgba(244,114,182,0.5); }
.theme-mixmatch .btn-ghost { border-color: #ec4899; color: #f472b6; }
@keyframes mixmatchMatch { 0% { transform: scale(1.05); } 100% { transform: scale(0.96); } }

@keyframes goldenPulse {
    0%, 100% { box-shadow: 0 0 40px rgba(255,215,0,0.6); }
    50% { box-shadow: 0 0 60px rgba(255,215,0,0.9); }
}

/* ===== MOBILE & TABLET RESPONSIVE ===== */
@media (max-width: 768px) {
    #main-menu { padding: 16px; }
    #game-container { padding: 16px; }
    .menu-btn {
        min-height: 48px;
        padding: 14px 20px;
        font-size: 1rem;
        -webkit-tap-highlight-color: transparent;
    }
    .stat-display { gap: 20px; margin-top: 32px; }
    .stat-value { font-size: 1rem; }
    .title-glitch { font-size: clamp(1.2rem, 5vw, 1.8rem); margin-bottom: 32px; }
    .settings-content { padding: 24px; width: 95%; }
}

@media (max-width: 480px) {
    #main-menu { padding: 12px; }
    .menu-buttons { max-width: 100%; }
    .menu-btn { font-size: 0.95rem; }
    .stat-display { flex-wrap: wrap; justify-content: center; gap: 16px; }
}

/* Touch-friendly targets */
@media (pointer: coarse) {
    .menu-btn, .btn, .btn-primary, .tool-btn {
        min-height: 44px;
        min-width: 44px;
        -webkit-tap-highlight-color: transparent;
    }
}

/* Safe area for notched phones */
@supports (padding: env(safe-area-inset-top)) {
    #main-menu, #loading-screen {
        padding-top: max(24px, env(safe-area-inset-top));
        padding-bottom: max(24px, env(safe-area-inset-bottom));
        padding-left: max(24px, env(safe-area-inset-left));
        padding-right: max(24px, env(safe-area-inset-right));
    }
}
