/* --- Reset and Core Styling --- */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

:root {
    --bg-dark: #090a10;
    --bg-gradient: radial-gradient(circle at 50% 50%, #171b30 0%, #090a10 100%);
    --panel-glass: rgba(22, 25, 41, 0.7);
    --border-glass: rgba(255, 255, 255, 0.08);
    --border-glass-glow: rgba(58, 134, 200, 0.35);
    
    --squirtle-blue: #70e0ec;
    --squirtle-blue-dark: #1282a2;
    --water-cyan: #00f5ff;
    --water-blue: #0077b6;
    
    --grass-green: #38b000;
    --accent-gold: #ffb703;
    
    --text-primary: #f8f9fa;
    --text-secondary: #9ea4c0;
    --text-dim: #676e8a;
    
    --card-shadow: 0 24px 48px rgba(0, 0, 0, 0.5), inset 0 1px 1px rgba(255, 255, 255, 0.1);
    --inner-glow: 0 0 20px rgba(0, 245, 255, 0.15);
}

body {
    font-family: 'Outfit', sans-serif;
    background: var(--bg-gradient);
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: center;
    overflow-x: hidden;
    padding: 40px 20px;
}

/* --- Layout Container --- */
.dashboard-container {
    width: 100%;
    max-width: 1100px;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

/* --- Header Section --- */
.game-header {
    text-align: center;
}

.logo-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 16px;
    margin-bottom: 6px;
}

.logo-wrapper h1 {
    font-size: 2.2rem;
    font-weight: 800;
    letter-spacing: 4px;
    background: linear-gradient(135deg, var(--text-primary) 30%, var(--squirtle-blue) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    text-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}

.logo-icon {
    font-size: 1.8rem;
    filter: drop-shadow(0 0 8px rgba(112, 224, 236, 0.5));
    animation: float 3s ease-in-out infinite alternate;
}

.logo-icon:last-child {
    animation-delay: 1.5s;
}

.subtitle {
    font-size: 1rem;
    color: var(--text-secondary);
    font-weight: 300;
    letter-spacing: 1px;
}

/* --- Glassmorphic Game Arena --- */
.game-arena {
    width: 100%;
}

.glass-dashboard {
    background: var(--panel-glass);
    border: 1px solid var(--border-glass);
    border-radius: 28px;
    padding: 28px;
    box-shadow: var(--card-shadow);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* --- HUD Top Bar --- */
.hud-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
}

.hud-group {
    display: flex;
    gap: 16px;
}

.hud-item {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 16px;
    padding: 12px 24px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-width: 150px;
    transition: all 0.3s ease;
}

.hud-item:hover {
    background: rgba(255, 255, 255, 0.04);
    border-color: rgba(255, 255, 255, 0.1);
}

.hud-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--text-secondary);
    margin-bottom: 4px;
    font-weight: 500;
}

.hud-value {
    font-size: 1.8rem;
    font-weight: 800;
    color: var(--text-primary);
}

.card-score .hud-value {
    color: var(--accent-gold);
    text-shadow: 0 0 10px rgba(255, 183, 3, 0.3);
}

.card-level .hud-value {
    color: var(--squirtle-blue);
    text-shadow: 0 0 10px rgba(112, 224, 236, 0.3);
}

/* Water Tank HUD Section */
.water-hud {
    flex-grow: 1;
    max-width: 450px;
}

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

.water-pct {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--water-cyan);
}

.water-progress-track {
    width: 100%;
    height: 12px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 6px;
    overflow: hidden;
    position: relative;
}

.water-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--water-blue) 0%, var(--water-cyan) 100%);
    box-shadow: 0 0 12px rgba(0, 245, 255, 0.5);
    border-radius: 6px;
    transition: width 0.1s ease-out;
    position: relative;
}

/* --- Viewport and Canvas --- */
.viewport-wrapper {
    position: relative;
    width: 100%;
    border-radius: 20px;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.06);
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
    aspect-ratio: 1024 / 640;
}

#gameCanvas {
    display: block;
    width: 100%;
    height: 100%;
    background-color: #264e22; /* Fallback */
}

/* --- Modern Glass Overlays --- */
.game-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(9, 10, 16, 0.85);
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    z-index: 10;
}

.game-overlay.show {
    opacity: 1;
    pointer-events: auto;
}

.overlay-card {
    max-width: 580px;
    text-align: center;
    padding: 40px;
    background: rgba(22, 25, 41, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 24px;
    box-shadow: 0 30px 60px rgba(0, 0, 0, 0.6), inset 0 1px 1px rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    transform: translateY(20px);
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.game-overlay.show .overlay-card {
    transform: translateY(0);
}

.squirtle-graphic-glow {
    font-size: 3rem;
    margin-bottom: 16px;
    animation: pulseGlow 2s infinite alternate;
    display: inline-block;
}

.overlay-card h2 {
    font-size: 1.8rem;
    font-weight: 800;
    letter-spacing: 2px;
    color: var(--text-primary);
    margin-bottom: 16px;
}

.overlay-card p {
    font-size: 0.95rem;
    line-height: 1.6;
    color: var(--text-secondary);
    margin-bottom: 30px;
}

.overlay-card strong {
    color: var(--squirtle-blue);
}

/* Play/Start Button */
.play-btn {
    font-family: inherit;
    font-size: 1.05rem;
    font-weight: 600;
    color: #000;
    background: linear-gradient(135deg, var(--water-cyan) 0%, #00b4d8 100%);
    border: none;
    padding: 14px 32px;
    border-radius: 14px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    box-shadow: 0 8px 20px rgba(0, 245, 255, 0.25);
    transition: all 0.2s ease;
}

.play-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 28px rgba(0, 245, 255, 0.4);
    background: linear-gradient(135deg, #e0ffff 0%, var(--water-cyan) 100%);
}

.play-btn:active {
    transform: translateY(1px);
    box-shadow: 0 4px 10px rgba(0, 245, 255, 0.25);
}

/* --- Dashboard Footer Control Bar --- */
.dashboard-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    padding-top: 20px;
}

.instructions-inline {
    font-size: 0.9rem;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 12px;
}

.key-badge {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-primary);
}

.space-badge {
    padding-left: 20px;
    padding-right: 20px;
}

.divider {
    width: 1px;
    height: 16px;
    background-color: rgba(255, 255, 255, 0.1);
}

/* Control Buttons */
.control-actions {
    display: flex;
    gap: 12px;
}

.action-btn-modern {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 500;
    padding: 10px 20px;
    border-radius: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s ease;
}

.action-btn-modern:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.15);
    color: var(--squirtle-blue);
}

.sound-btn:hover {
    border-color: rgba(0, 245, 255, 0.3);
}

.restart-btn:hover {
    border-color: rgba(255, 183, 3, 0.3);
}

.btn-icon {
    font-size: 1rem;
}

/* --- App Footer --- */
.app-footer {
    text-align: center;
    font-size: 0.85rem;
    color: var(--text-dim);
}

/* --- Animations --- */
@keyframes float {
    from { transform: translateY(0); }
    to { transform: translateY(-6px); }
}

@keyframes pulseGlow {
    from {
        transform: scale(1);
        filter: drop-shadow(0 0 10px rgba(0, 245, 255, 0.4));
    }
    to {
        transform: scale(1.1);
        filter: drop-shadow(0 0 20px rgba(0, 245, 255, 0.8));
    }
}

.animate-fade-in {
    animation: fadeIn 1s ease-out forwards;
}

.animate-scale-up {
    animation: scaleUp 0.8s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes scaleUp {
    from { opacity: 0; transform: scale(0.96) translateY(10px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}

/* Responsive adjustments */
@media (max-width: 900px) {
    .hud-bar {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
    }
    .water-hud {
        max-width: none;
    }
    .dashboard-footer {
        flex-direction: column;
        gap: 16px;
        align-items: center;
    }
    .instructions-inline {
        flex-direction: column;
        gap: 6px;
        text-align: center;
    }
    .divider {
        display: none;
    }
}

#radarCanvas {
    position: absolute;
    bottom: 20px;
    left: 20px;
    z-index: 5;
    pointer-events: none;
    border-radius: 50%;
    border: 3px solid rgba(0, 245, 255, 0.4);
    background: rgba(12, 15, 28, 0.75);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}
