/* ==========================================================================
   🐱 Super Cat Mario Adventure - Modern Arcade Design System
   ========================================================================== */

:root {
    --bg-dark: #0f141c;
    --card-bg: rgba(26, 32, 44, 0.85);
    --gold: #f8b800;
    --gold-glow: rgba(248, 184, 0, 0.4);
    --primary: #3b82f6;
    --primary-hover: #2563eb;
    --accent-red: #ef4444;
    --accent-green: #22c55e;
    --text-light: #f8fafc;
    --text-muted: #94a3b8;
    --border-glass: rgba(255, 255, 255, 0.12);
    --shadow-deep: 0 20px 40px -15px rgba(0, 0, 0, 0.7), 0 0 50px rgba(59, 130, 246, 0.15);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    user-select: none;
    -webkit-user-select: none;
}

body {
    background-color: var(--bg-dark);
    color: var(--text-light);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    overflow-x: hidden;
    padding: 12px;
}

/* Background Animated Gradient Mesh */
.bg-glow {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(circle at 50% 20%, rgba(59, 130, 246, 0.15) 0%, transparent 60%),
                radial-gradient(circle at 80% 80%, rgba(248, 184, 0, 0.08) 0%, transparent 50%);
    pointer-events: none;
    z-index: 0;
}

/* Arcade Cabinet Container */
.arcade-wrapper {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    max-width: 1040px;
}

/* Top Floating Bar / Title */
.header-bar {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    padding: 8px 16px;
    background: var(--card-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--border-glass);
    border-radius: 14px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.game-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.15rem;
    font-weight: 800;
    letter-spacing: 0.5px;
    color: #ffffff;
}

.game-title .cat-icon {
    font-size: 1.4rem;
    animation: gentle-bounce 2s infinite ease-in-out;
}

.quick-actions {
    display: flex;
    gap: 8px;
}

.icon-btn {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid var(--border-glass);
    color: var(--text-light);
    padding: 6px 14px;
    border-radius: 10px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s ease;
}

.icon-btn:hover {
    background: rgba(255, 255, 255, 0.18);
    transform: translateY(-1px);
}

.icon-btn:active {
    transform: translateY(1px);
}

/* Main Game Canvas Container */
.game-frame {
    position: relative;
    width: 100%;
    background: #000;
    border-radius: 18px;
    overflow: hidden;
    box-shadow: var(--shadow-deep);
    border: 2px solid rgba(255, 255, 255, 0.1);
    display: flex;
    justify-content: center;
    align-items: center;
    aspect-ratio: 16 / 9;
}

#gameContainer {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
}

#gameCanvas {
    display: block;
    image-rendering: -webkit-optimize-contrast;
    image-rendering: crisp-edges;
    image-rendering: pixelated;
    background: #5c94fc;
}

/* In-Game Retro HUD Overlay */
.game-hud {
    position: absolute;
    top: 14px;
    left: 20px;
    right: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    pointer-events: none;
    z-index: 10;
    font-family: "Courier New", Courier, monospace, sans-serif;
    font-weight: 900;
    font-size: 1.15rem;
    text-shadow: 2px 2px 0px #000, -1px -1px 0px #000, 1px -1px 0px #000, -1px 1px 0px #000, 0px 2px 4px rgba(0,0,0,0.8);
    color: #ffffff;
}

.hud-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
}

.hud-label {
    font-size: 0.75rem;
    color: var(--gold);
    letter-spacing: 1px;
}

.hud-val {
    letter-spacing: 1px;
}

/* Modals & Overlays */
.overlay-screen {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 20, 28, 0.88);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 20;
    padding: 24px;
    text-align: center;
    transition: opacity 0.3s ease;
}

.overlay-screen.hidden {
    opacity: 0;
    pointer-events: none;
    visibility: hidden;
}

.modal-card {
    background: rgba(30, 41, 59, 0.95);
    border: 1px solid var(--border-glass);
    border-radius: 20px;
    padding: 32px 40px;
    max-width: 460px;
    width: 90%;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.8);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    animation: pop-in 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.hero-avatar-preview {
    width: 90px;
    height: 120px;
    object-fit: contain;
    filter: drop-shadow(0 8px 16px rgba(0, 0, 0, 0.4));
    animation: float-avatar 2.5s infinite ease-in-out;
}

.modal-title {
    font-size: 1.7rem;
    font-weight: 800;
    color: #ffffff;
    margin-top: -4px;
}

.modal-desc {
    font-size: 0.95rem;
    color: var(--text-muted);
    line-height: 1.5;
}

.controls-hint {
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    padding: 12px 18px;
    width: 100%;
    font-size: 0.85rem;
    color: #cbd5e1;
    display: flex;
    flex-direction: column;
    gap: 6px;
    text-align: left;
}

.controls-hint strong {
    color: var(--gold);
}

.key-tag {
    display: inline-block;
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 6px;
    padding: 2px 6px;
    font-family: monospace;
    font-size: 0.8rem;
    color: #ffffff;
}

.cta-btn {
    background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
    color: #ffffff;
    border: none;
    padding: 12px 32px;
    font-size: 1.1rem;
    font-weight: 700;
    border-radius: 12px;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(59, 130, 246, 0.4);
    transition: all 0.2s ease;
    width: 100%;
}

.cta-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(59, 130, 246, 0.6);
}

.cta-btn:active {
    transform: translateY(1px);
}

/* Touch Controls Bar (Mobile / Tablet) */
.touch-controls {
    display: flex;
    justify-content: space-between;
    width: 100%;
    margin-top: 14px;
    padding: 0 8px;
}

.dpad-group, .action-group {
    display: flex;
    gap: 12px;
}

.touch-btn {
    background: rgba(30, 41, 59, 0.8);
    border: 2px solid var(--border-glass);
    color: #ffffff;
    font-size: 1.25rem;
    font-weight: bold;
    width: 60px;
    height: 60px;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    touch-action: manipulation;
    box-shadow: 0 6px 15px rgba(0, 0, 0, 0.4);
    transition: transform 0.1s, background 0.1s;
}

.touch-btn.active, .touch-btn:active {
    background: rgba(59, 130, 246, 0.8);
    transform: scale(0.92);
}

.action-btn-a {
    background: rgba(34, 197, 94, 0.4);
    border-color: rgba(34, 197, 94, 0.6);
}
.action-btn-a.active, .action-btn-a:active {
    background: rgba(34, 197, 94, 0.9);
}

.action-btn-b {
    background: rgba(239, 68, 68, 0.4);
    border-color: rgba(239, 68, 68, 0.6);
}
.action-btn-b.active, .action-btn-b:active {
    background: rgba(239, 68, 68, 0.9);
}

/* Victory / Game Over stats */
.stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    width: 100%;
}

.stat-box {
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 10px;
    padding: 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.stat-title {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.stat-value {
    font-size: 1.3rem;
    font-weight: 800;
    color: var(--gold);
}

/* Animations */
@keyframes gentle-bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-4px); }
}

@keyframes float-avatar {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-8px); }
}

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

/* Responsive adjustments */
@media (max-width: 768px) {
    .game-hud {
        font-size: 0.9rem;
    }
    .hud-label {
        font-size: 0.65rem;
    }
    .touch-btn {
        width: 52px;
        height: 52px;
        font-size: 1.1rem;
    }
}
