:root {
    --primary: #38bdf8;
    --secondary: #a78bfa;
    --dark: #2d3436;
    --light: #f9f9f9;
    --overlay: rgba(0, 0, 0, 0.8);
    --card-bg: rgba(255, 255, 255, 0.70);
    --shadow: 0 18px 55px rgba(15, 23, 42, 0.16);
    --glass-border: rgba(15, 23, 42, 0.12);
    --glass-blur: 16px;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html, body {
    width: 100%;
    height: 100%;
    font-family: 'Nunito', sans-serif;
    background:
        radial-gradient(1200px 800px at 18% 0%, rgba(56, 189, 248, 0.18), transparent 60%),
        radial-gradient(900px 600px at 92% 12%, rgba(167, 139, 250, 0.12), transparent 55%),
        radial-gradient(1000px 700px at 50% 110%, rgba(56, 189, 248, 0.10), transparent 55%),
        #eaf6ff;
    overflow: hidden;
}

#game-wrapper {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

#dashboard {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    background:
        radial-gradient(1200px 800px at 18% 0%, rgba(56, 189, 248, 0.18), transparent 60%),
        radial-gradient(900px 600px at 92% 12%, rgba(167, 139, 250, 0.12), transparent 55%),
        radial-gradient(1000px 700px at 50% 110%, rgba(56, 189, 248, 0.10), transparent 55%),
        #eaf6ff;
}

#dashboard.hidden {
    display: none !important;
}

.dashboard-content {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.76), rgba(255, 255, 255, 0.60));
    border-radius: 20px;
    padding: 40px;
    box-shadow: var(--shadow);
    border: 1px solid var(--glass-border);
    backdrop-filter: blur(var(--glass-blur)) saturate(160%);
    -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(160%);
    text-align: center;
    max-width: 420px;
    width: 90%;
}

.game-title {
    font-family: 'Fredoka One', cursive;
    font-size: 2.2rem;
    color: var(--primary);
    margin-bottom: 25px;
}

.stats-box {
    display: flex;
    gap: 20px;
    margin-bottom: 30px;
}

.stat-item {
    flex: 1;
    background: rgba(255, 255, 255, 0.62);
    border-radius: 12px;
    padding: 15px;
    border: 1px solid rgba(15, 23, 42, 0.10);
    backdrop-filter: blur(var(--glass-blur)) saturate(160%);
    -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(160%);
}

.stat-label {
    display: block;
    font-size: 0.8rem;
    color: #666;
    margin-bottom: 5px;
    font-weight: 700;
    text-transform: uppercase;
}

.stat-value {
    display: block;
    font-size: 1.6rem;
    font-weight: 900;
    color: var(--dark);
}

.coin-value::before {
    content: '🪙 ';
}

.play-btn {
    background: linear-gradient(135deg, rgba(56, 189, 248, 0.95) 0%, rgba(167, 139, 250, 0.55) 100%);
    border: none;
    color: white;
    font-family: 'Fredoka One', cursive;
    font-size: 1.4rem;
    padding: 15px 50px;
    border-radius: 50px;
    cursor: pointer;
    width: 100%;
    margin-bottom: 20px;
}

.play-btn:hover {
    transform: scale(1.02);
}

.controls-info {
    font-size: 0.85rem;
    color: #666;
}

kbd {
    background: #eee;
    padding: 2px 6px;
    border-radius: 4px;
    font-family: monospace;
    font-weight: bold;
}

.desktop-controls { display: block; }
.mobile-controls { display: none; }

#game-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: none;
    background: #000;
}

#game-container.active {
    display: block;
}

#game-container canvas {
    width: 100%;
    height: 100%;
    display: block;
    touch-action: none;
}

#hud {
    position: absolute;
    top: 15px;
    left: 15px;
    right: 15px;
    display: flex;
    justify-content: space-between;
    z-index: 10;
    pointer-events: none;
}

.hud-left, .hud-right {
    background: rgba(255, 255, 255, 0.72);
    padding: 8px 16px;
    border-radius: 20px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.2);
    border: 1px solid rgba(15, 23, 42, 0.10);
    backdrop-filter: blur(var(--glass-blur)) saturate(160%);
    -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(160%);
}

.coin-display {
    display: flex;
    align-items: center;
    gap: 5px;
    font-weight: 900;
    font-size: 1.2rem;
    color: var(--primary);
}

#score-display {
    font-weight: 900;
    font-size: 1.2rem;
    color: var(--dark);
}

#pause-menu, #game-over-menu {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--overlay);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 50;
}

#pause-menu.hidden, #game-over-menu.hidden {
    display: none !important;
}

.pause-content, .gameover-content {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.76), rgba(255, 255, 255, 0.60));
    border-radius: 20px;
    padding: 35px;
    text-align: center;
    max-width: 350px;
    width: 85%;
    border: 1px solid var(--glass-border);
    backdrop-filter: blur(var(--glass-blur)) saturate(160%);
    -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(160%);
}

.pause-content h2, .gameover-content h2 {
    font-family: 'Fredoka One', cursive;
    font-size: 2rem;
    color: var(--primary);
    margin-bottom: 20px;
}

.gameover-content h2 { color: #e74c3c; }

.pause-stats, .gameover-stats {
    margin-bottom: 25px;
    font-size: 1.1rem;
}

.pause-stats p, .gameover-stats p {
    margin: 10px 0;
    color: var(--dark);
    font-weight: 700;
}

.pause-stats span, .gameover-stats span {
    color: var(--primary);
    font-size: 1.3rem;
}

.pause-buttons {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.pause-btn {
    border: none;
    font-family: 'Nunito', sans-serif;
    font-weight: 900;
    font-size: 1rem;
    padding: 14px 25px;
    border-radius: 50px;
    cursor: pointer;
    width: 100%;
    text-transform: uppercase;
}

.resume-btn {
    background: linear-gradient(135deg, #2ecc71 0%, #27ae60 100%);
    color: white;
}

.quit-btn, .play-again-btn {
    background: linear-gradient(135deg, #95a5a6 0%, #7f8c8d 100%);
    color: white;
}

@media (max-width: 600px) {
    .stats-box { flex-direction: column; gap: 10px; }
    .game-title { font-size: 1.6rem; }
    .desktop-controls { display: none; }
    .mobile-controls { display: block; }
    .hud-left, .hud-right { padding: 6px 12px; }
    .coin-display, #score-display { font-size: 1rem; }
}


/* Mobile Touch Controls */
.mobile-controls {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10000;
    display: none;
}

.mobile-btn {
    background: linear-gradient(135deg, #60a5fa, #a78bfa);
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    width: 120px;
    height: 120px;
    color: #fff;
    font-weight: 900;
    font-size: 14px;
    cursor: pointer;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

.mobile-btn:active {
    transform: scale(0.95);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

/* Show mobile controls on touch devices */
@media (hover: none) and (pointer: coarse) {
    .mobile-controls {
        display: block !important;
    }
}
