/* Retro Bomberman Design System */
:root {
    --bg-dark: #08090c;
    --bg-card: rgba(18, 20, 28, 0.95);
    --border-color: rgba(255, 255, 255, 0.12);
    --neon-blue: #00d2ff;
    --neon-purple: #9d4edd;
    --neon-red: #ff3366;
    --font-mono: 'Share Tech Mono', 'Courier New', monospace;
    --font-arcade: 'VT323', monospace;
}

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

body {
    background-color: var(--bg-dark);
    color: #f1f3f9;
    font-family: var(--font-mono);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    position: relative;
}

/* Background grid animation */
body::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: 
        linear-gradient(to right, rgba(255,255,255,0.02) 1px, transparent 1px),
        linear-gradient(to bottom, rgba(255,255,255,0.02) 1px, transparent 1px);
    background-size: 40px 40px;
    z-index: 0;
}

/* Retro Scanlines and CRT curvature filter wrapper */
#retro-container {
    width: 100%;
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    z-index: 1;
}

.retro-scanlines::after {
    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.25) 50%), linear-gradient(90deg, rgba(255, 0, 0, 0.06), rgba(0, 255, 0, 0.02), rgba(0, 0, 255, 0.06));
    z-index: 999;
    background-size: 100% 4px, 6px 100%;
    pointer-events: none;
}

/* Modals overlays & lobby screen */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(4, 5, 8, 0.95);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 100;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    visibility: visible;
}

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

/* Lobby Card design */
.lobby-card {
    background: var(--bg-card);
    border: 4px solid var(--neon-purple);
    border-radius: 8px;
    padding: 3rem;
    width: 90%;
    max-width: 680px;
    box-shadow: 0 0 30px rgba(157, 78, 221, 0.4);
    text-align: center;
}

.retro-title {
    font-family: var(--font-arcade);
    font-size: 6rem;
    line-height: 0.9;
    color: #ffcc00;
    text-shadow: 0 0 15px rgba(255, 204, 0, 0.7);
    margin-bottom: 0.5rem;
    letter-spacing: 4px;
}

.retro-subtitle {
    font-family: var(--font-mono);
    font-size: 1.25rem;
    color: var(--neon-blue);
    letter-spacing: 6px;
    margin-bottom: 2rem;
    text-transform: uppercase;
}

/* Settings Form elements */
.settings-form {
    background: rgba(0, 0, 0, 0.4);
    border: 2px solid var(--border-color);
    border-radius: 4px;
    padding: 1.5rem;
    margin-bottom: 2rem;
    text-align: left;
}

.setting-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.25rem;
}

.setting-row:last-child {
    margin-bottom: 0;
}

.setting-row label {
    font-size: 1.1rem;
    color: #a0aec0;
}

.setting-row select, .setting-row input[type="range"] {
    background: #1a1e2e;
    color: #fff;
    border: 2px solid var(--border-color);
    padding: 0.5rem 1rem;
    font-family: var(--font-mono);
    font-size: 1rem;
    border-radius: 4px;
    outline: none;
    cursor: pointer;
    min-width: 240px;
}

.setting-row select:focus {
    border-color: var(--neon-blue);
}

/* Keyboard legends inside lobby */
.keyboard-legend {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    margin-bottom: 2.5rem;
    text-align: left;
}

.player-legend {
    background: rgba(255, 255, 255, 0.02);
    border: 1px dashed var(--border-color);
    padding: 1rem;
    border-radius: 4px;
}

.player-legend h3 {
    font-size: 1rem;
    margin-bottom: 0.5rem;
    color: var(--neon-blue);
}

.player-legend p {
    font-size: 0.9rem;
    color: #cbd5e0;
    margin-bottom: 0.25rem;
}

.key {
    background: #2d3748;
    border: 1px solid #718096;
    border-bottom: 3px solid #1a202c;
    border-radius: 3px;
    padding: 1px 6px;
    font-size: 0.8rem;
    display: inline-block;
    margin: 0 2px;
}

/* Arcade Buttons */
.retro-btn {
    background: linear-gradient(180deg, #ff3366, #b80045);
    border: none;
    border-radius: 6px;
    color: #fff;
    font-family: var(--font-mono);
    font-size: 1.5rem;
    font-weight: bold;
    padding: 1rem 2.5rem;
    cursor: pointer;
    box-shadow: 0 6px 0 #900030, 0 12px 20px rgba(255, 51, 102, 0.4);
    text-transform: uppercase;
    transition: transform 0.1s, box-shadow 0.1s;
    outline: none;
}

.retro-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 0 #900030, 0 15px 25px rgba(255, 51, 102, 0.5);
}

.retro-btn:active {
    transform: translateY(6px);
    box-shadow: 0 0px 0 #900030, 0 4px 10px rgba(255, 51, 102, 0.3);
}

/* Main Game Layout */
#game-layout {
    display: flex;
    justify-content: center;
    align-items: stretch;
    gap: 2rem;
    width: 95%;
    max-width: 1400px;
    height: 90vh;
}

#game-layout.hidden {
    display: none;
}

/* Side Panels & HUD elements */
.side-panel {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    width: 250px;
}

.player-hud-card {
    background: var(--bg-card);
    border: 3px solid var(--p-color);
    border-radius: 6px;
    padding: 1.25rem;
    box-shadow: 0 0 15px rgba(255, 255, 255, 0.05);
    transition: opacity 0.3s ease;
}

.player-hud-card.hidden {
    display: none;
}

.player-hud-card.dead {
    opacity: 0.4;
    border-color: #4a5568 !important;
}

.hud-header {
    font-family: var(--font-arcade);
    font-size: 1.75rem;
    color: var(--p-color);
    border-bottom: 2px dashed rgba(255, 255, 255, 0.1);
    padding-bottom: 0.5rem;
    margin-bottom: 0.75rem;
    text-shadow: 0 0 5px var(--p-color);
}

.hud-stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
}

.stat-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.1rem;
}

.stat-row .icon {
    font-size: 1.2rem;
}

.stat-row .val {
    font-weight: bold;
}

/* Center Viewport Layout */
#center-viewport {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 1rem;
}

#game-header {
    width: 100%;
    display: flex;
    justify-content: center;
}

/* Timer Display block */
#timer-box {
    background: #0d0f17;
    border: 3px solid #cbd5e0;
    border-radius: 4px;
    padding: 0.5rem 3rem;
    box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.8);
}

#timer-display {
    font-family: var(--font-arcade);
    font-size: 3rem;
    color: #e2e8f0;
    text-shadow: 0 0 5px rgba(255,255,255,0.2);
}

#timer-display.critical {
    color: var(--neon-red);
    text-shadow: 0 0 8px rgba(255, 51, 102, 0.6);
}

/* Game Canvas Wrapper with CRT Scanline overlays */
#canvas-wrapper {
    position: relative;
    background: #000;
    border: 6px solid #4a5568;
    border-radius: 4px;
    box-shadow: 0 0 25px rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
}

#game-canvas {
    display: block;
    image-rendering: pixelated;
    image-rendering: crisp-edges;
}

#crt-overlay {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    box-shadow: inset 0 0 80px rgba(0,0,0,0.8);
    pointer-events: none;
    z-index: 5;
}

/* Round over overlay */
.round-card {
    background: rgba(18, 20, 28, 0.98);
    border: 4px solid var(--neon-blue);
    border-radius: 8px;
    padding: 2.5rem 4rem;
    text-align: center;
    box-shadow: 0 0 40px rgba(0, 210, 255, 0.5);
}

.round-card h2 {
    font-family: var(--font-arcade);
    font-size: 4.5rem;
    color: #fff;
    margin-bottom: 0.5rem;
}

/* Utilities */
.blink {
    animation: blinker 1s linear infinite;
}

@keyframes blinker {
    50% { opacity: 0; }
}

.animate-pulse {
    animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; filter: brightness(1); }
    50% { opacity: .85; filter: brightness(1.2); }
}

.mt-4 { margin-top: 1rem; }
.mt-8 { margin-top: 2rem; }
.text-center { text-align: center; }
.text-sm { font-size: 0.875rem; }
