/* ==========================================================================
   PAC-MAN ARCADE - COMPACT FULL-FIT RETRO DESIGN SYSTEM
   ========================================================================== */

@font-face {
    font-family: 'PressStart2P';
    src: url('../font/PressStart2P.ttf') format('truetype');
    font-display: swap;
}

:root {
    --bg-dark: #04050a;
    --bg-surface: rgba(14, 20, 37, 0.85);
    --bg-surface-hover: rgba(22, 31, 56, 0.95);
    --border-color: rgba(56, 189, 248, 0.25);
    --border-glow: rgba(0, 240, 255, 0.4);
    
    --primary-yellow: #FFE600;
    --primary-yellow-glow: rgba(255, 230, 0, 0.4);
    --neon-blue: #00F0FF;
    --neon-blue-glow: rgba(0, 240, 255, 0.4);
    --neon-pink: #FF3366;
    
    --text-primary: #F8FAFC;
    --text-secondary: #94A3B8;
    
    --font-pixel: 'PressStart2P', monospace, sans-serif;
    --font-ui: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 14px;
    --radius-full: 9999px;
    
    --shadow-neon-yellow: 0 0 16px rgba(255, 230, 0, 0.4);
    --shadow-neon-blue: 0 0 20px rgba(0, 240, 255, 0.35);
}

/* Reset & Base */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    user-select: none;
    -webkit-user-select: none;
}

html, body {
    width: 100%;
    height: 100%;
    margin: 0;
    padding: 0;
    overflow: hidden !important;
    background-color: var(--bg-dark);
    color: var(--text-primary);
    font-family: var(--font-ui);
    display: flex;
    justify-content: center;
    align-items: center;
}

body {
    background-image: 
        radial-gradient(circle at 50% 10%, rgba(0, 240, 255, 0.1), transparent 50%),
        radial-gradient(circle at 80% 80%, rgba(255, 230, 0, 0.06), transparent 40%),
        linear-gradient(180deg, #04050a 0%, #090d1a 50%, #04050a 100%);
}

/* Fullscreen App Container */
.app-container {
    width: 100vw;
    height: 100vh;
    max-width: 100vw;
    max-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: center;
    padding: 6px 10px;
    box-sizing: border-box;
    overflow: hidden;
    position: relative;
    gap: 6px;
}

/* Compact HUD Header */
.game-header {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 4px 12px;
    background: var(--bg-surface);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    flex-shrink: 0;
    height: 36px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
    z-index: 10;
}

.brand-section {
    display: flex;
    align-items: center;
    gap: 8px;
}

.brand-logo-icon {
    width: 20px;
    height: 20px;
    background: var(--primary-yellow);
    border-radius: var(--radius-full);
    position: relative;
    box-shadow: var(--shadow-neon-yellow);
    animation: chomp 0.8s infinite alternate ease-in-out;
}

.brand-logo-icon::after {
    content: '';
    position: absolute;
    top: 4px;
    left: 9px;
    width: 3px;
    height: 3px;
    background: #000;
    border-radius: var(--radius-full);
}

@keyframes chomp {
    0% {
        clip-path: polygon(100% 74%, 50% 50%, 100% 26%, 100% 0%, 0% 0%, 0% 100%, 100% 100%);
    }
    100% {
        clip-path: polygon(100% 52%, 50% 50%, 100% 48%, 100% 0%, 0% 0%, 0% 100%, 100% 100%);
    }
}

.brand-title-group h1 {
    font-family: var(--font-pixel);
    font-size: 12px;
    color: var(--primary-yellow);
    text-shadow: 0 0 8px var(--primary-yellow-glow);
    letter-spacing: 0.5px;
    display: inline-block;
}

.brand-badge {
    display: inline-block;
    font-family: var(--font-pixel);
    font-size: 7.5px;
    color: var(--neon-blue);
    background: rgba(0, 240, 255, 0.12);
    border: 1px solid rgba(0, 240, 255, 0.3);
    padding: 1px 5px;
    border-radius: var(--radius-sm);
    margin-left: 6px;
}

@media (max-width: 600px) {
    .brand-badge {
        display: none;
    }
}

/* Header Action Toolbar */
.header-actions {
    display: flex;
    align-items: center;
    gap: 6px;
}

.action-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    font-family: var(--font-ui);
    font-size: 11px;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.2s ease;
}

.action-btn:hover {
    background: var(--bg-surface-hover);
    border-color: var(--neon-blue);
    box-shadow: 0 0 10px rgba(0, 240, 255, 0.3);
    transform: translateY(-1px);
}

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

.action-btn svg {
    width: 12px;
    height: 12px;
    fill: currentColor;
}

.action-btn.active {
    background: rgba(0, 240, 255, 0.2);
    border-color: var(--neon-blue);
    color: var(--neon-blue);
}

/* Arcade Cabinet & Canvas Screen */
.arcade-cabinet {
    flex: 1 1 0%;
    width: 100%;
    min-height: 0;
    height: calc(100vh - 54px);
    max-height: calc(100vh - 54px);
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    background: #000;
    border-radius: var(--radius-md);
    border: 1.5px solid rgba(0, 240, 255, 0.3);
    box-shadow: 
        0 0 20px rgba(0, 240, 255, 0.2),
        inset 0 0 20px rgba(0, 0, 0, 0.9);
    overflow: hidden;
}

/* CRT Screen Scanline Overlay */
.arcade-cabinet::before {
    content: " ";
    display: block;
    position: absolute;
    top: 0; left: 0; bottom: 0; right: 0;
    background: linear-gradient(rgba(18, 16, 16, 0) 50%, rgba(0, 0, 0, 0.2) 50%);
    background-size: 100% 3px;
    z-index: 2;
    pointer-events: none;
    opacity: 0.25;
}

.canvas-wrapper {
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    overflow: hidden;
}

canvas#canvas {
    display: block;
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    aspect-ratio: 960 / 640;
    object-fit: contain;
    background: #000;
}

/* Floating Virtual D-Pad (Touch / Mobile Overlay) */
.virtual-controls {
    display: none;
    position: absolute;
    bottom: 12px;
    right: 12px;
    z-index: 50;
    pointer-events: auto;
}

.dpad-container {
    position: relative;
    width: 120px;
    height: 120px;
    background: rgba(14, 20, 37, 0.85);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-full);
    backdrop-filter: blur(10px);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.6);
}

.dpad-btn {
    position: absolute;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: var(--primary-yellow);
    font-size: 13px;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    cursor: pointer;
    touch-action: manipulation;
    transition: all 0.1s ease;
}

.dpad-btn:active,
.dpad-btn.pressed {
    background: var(--primary-yellow);
    color: #000;
    box-shadow: 0 0 12px var(--primary-yellow-glow);
}

.dpad-up {
    top: 6px;
    left: 42px;
    width: 36px;
    height: 32px;
}

.dpad-down {
    bottom: 6px;
    left: 42px;
    width: 36px;
    height: 32px;
}

.dpad-left {
    top: 42px;
    left: 6px;
    width: 32px;
    height: 36px;
}

.dpad-right {
    top: 42px;
    right: 6px;
    width: 32px;
    height: 36px;
}

.dpad-center {
    top: 42px;
    left: 42px;
    width: 36px;
    height: 36px;
    background: rgba(0, 240, 255, 0.15);
    border: 1px solid rgba(0, 240, 255, 0.3);
    color: var(--neon-blue);
    font-family: var(--font-pixel);
    font-size: 8px;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
}