/* ==========================================================================
   BLOCK OUT 3D - Retro DOS / Arcade Styling & Theme Definitions
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Press+Start+2P&family=Share+Tech+Mono&family=VT323&display=swap');

:root {
    --bg-color: #000000;
    --hud-border: #0000aa;
    --hud-border-light: #4444ff;
    --hud-bg: #000022;
    --hud-text: #00ff33;
    --hud-label: #00ccff;
    --hud-accent: #ff8800;
    --hud-digit-bg: #000000;
    --crt-glow: rgba(0, 255, 51, 0.15);
}

/* THEME: Cyberpunk */
body.theme-cyberpunk {
    --hud-border: #7f00ff;
    --hud-border-light: #b366ff;
    --hud-bg: #1a0033;
    --hud-text: #00ffff;
    --hud-label: #ff007f;
    --hud-accent: #ff007f;
    --crt-glow: rgba(255, 0, 127, 0.15);
}

/* THEME: Amber */
body.theme-amber {
    --hud-border: #663300;
    --hud-border-light: #aa6600;
    --hud-bg: #221100;
    --hud-text: #ffaa00;
    --hud-label: #ffcc44;
    --hud-accent: #ffdd44;
    --crt-glow: rgba(255, 170, 0, 0.15);
}

/* THEME: Matrix */
body.theme-matrix {
    --hud-border: #003311;
    --hud-border-light: #008833;
    --hud-bg: #001a08;
    --hud-text: #00ff66;
    --hud-label: #33ff99;
    --hud-accent: #66ff99;
    --crt-glow: rgba(0, 255, 102, 0.15);
}

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

body {
    background-color: #000000;
    color: var(--hud-text);
    font-family: 'Share Tech Mono', 'VT323', monospace;
    overflow: hidden;
    width: 100vw;
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* CRT Screen Scanline Overlay */
.crt-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 9999;
    background: linear-gradient(rgba(18, 16, 16, 0) 50%, rgba(0, 0, 0, 0.25) 50%), linear-gradient(90deg, rgba(255, 0, 0, 0.03), rgba(0, 255, 0, 0.01), rgba(0, 0, 255, 0.03));
    background-size: 100% 3px, 6px 100%;
    opacity: 0.8;
}

.crt-overlay.disabled {
    display: none;
}

/* Screens Container (Full Screen / Full Canvas) */
#game-container {
    position: relative;
    width: 100vw;
    height: 100vh;
    max-width: 100vw;
    max-height: 100vh;
    background-color: #000000;
    display: flex;
    overflow: hidden;
}

/* Screen Base */
.screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: none;
    background: #000000;
    z-index: 10;
}

.screen.active {
    display: flex;
}

/* ==========================================================================
   1. SPLASH SCREEN
   ========================================================================== */
#screen-splash {
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    background: radial-gradient(circle at center, #000022 0%, #000000 85%);
    cursor: pointer;
}

.splash-title-wrap {
    margin-bottom: 25px;
    animation: floatTitle 3s ease-in-out infinite;
}

.splash-retro-title {
    font-family: 'Press Start 2P', monospace;
    font-size: 3.5rem;
    font-weight: 900;
    color: #1177ff;
    text-shadow: 4px 4px 0px #cc1100, 6px 6px 0px #880000, 0 0 20px rgba(0, 150, 255, 0.6);
    letter-spacing: 4px;
    line-height: 1.2;
}

.splash-sub {
    font-size: 1.1rem;
    color: #00ccff;
    margin-top: 8px;
    letter-spacing: 3px;
}

.splash-tribute {
    font-size: 0.95rem;
    color: #8888aa;
    margin-bottom: 40px;
}

.splash-prompt {
    font-family: 'Press Start 2P', monospace;
    font-size: 1rem;
    color: #00ff33;
    animation: blink 1s step-start infinite;
    padding: 12px 24px;
    border: 2px dashed #00cc33;
    background: rgba(0, 50, 20, 0.4);
}

/* ==========================================================================
   2. GAME INTRO SCREEN & 3. CREDITS SCREEN
   ========================================================================== */
.modal-screen {
    flex-direction: column;
    padding: 24px 35px;
    background: #000018;
    overflow-y: auto;
}

.screen-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 2px solid var(--hud-border-light);
    padding-bottom: 12px;
    margin-bottom: 20px;
}

.screen-header h2 {
    font-family: 'Press Start 2P', monospace;
    font-size: 1.3rem;
    color: var(--hud-label);
}

.intro-content {
    display: grid;
    grid-template-columns: 1.2fr 1fr;
    gap: 25px;
    flex: 1;
}

.intro-text-box {
    background: rgba(0, 0, 40, 0.6);
    border: 2px solid var(--hud-border);
    padding: 18px;
    font-size: 0.95rem;
    line-height: 1.6;
    color: #ddddff;
    overflow-y: auto;
    max-height: 480px;
}

.intro-text-box h3 {
    color: var(--hud-accent);
    margin: 14px 0 6px 0;
    font-size: 1.05rem;
}
.intro-text-box h3:first-child {
    margin-top: 0;
}

.intro-text-box ul {
    margin-left: 20px;
    margin-bottom: 10px;
}

.intro-text-box kbd {
    background: #222255;
    color: #00ffff;
    border: 1px solid #4444aa;
    border-radius: 3px;
    padding: 2px 6px;
    font-family: 'Share Tech Mono', monospace;
    font-size: 0.9rem;
}

/* 3D Preview Box in Intro */
.preview-box {
    background: #000011;
    border: 2px solid var(--hud-border);
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 15px;
}

.preview-canvas-wrap {
    width: 260px;
    height: 220px;
    background: #000000;
    border: 1px solid #005522;
    margin-bottom: 15px;
}

.preview-controls-guide {
    width: 100%;
    text-align: center;
}

.preview-btn-group {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 8px;
}

.btn-mini {
    background: #001144;
    color: #00ffcc;
    border: 1px solid #0055aa;
    padding: 6px 10px;
    font-family: 'Share Tech Mono', monospace;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.15s;
}

.btn-mini:hover {
    background: #003388;
    color: #ffffff;
    box-shadow: 0 0 8px rgba(0, 200, 255, 0.5);
}

.screen-footer {
    margin-top: 20px;
    display: flex;
    justify-content: flex-end;
    gap: 15px;
}

/* ==========================================================================
   4. START GAME SCREEN
   ========================================================================== */
#screen-start {
    flex-direction: column;
    padding: 30px 45px;
    background: radial-gradient(circle at center, #000028 0%, #00000a 80%);
}

.start-header {
    text-align: center;
    margin-bottom: 25px;
}

.start-logo {
    font-family: 'Press Start 2P', monospace;
    font-size: 2.5rem;
    color: #0066ff;
    text-shadow: 3px 3px 0 #cc0000, 5px 5px 0 #880000;
    letter-spacing: 3px;
}

.start-grid {
    display: grid;
    grid-template-columns: 1.1fr 0.9fr;
    gap: 30px;
    flex: 1;
}

.start-options-card {
    background: rgba(0, 0, 35, 0.7);
    border: 2px solid var(--hud-border);
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.option-row {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.option-label {
    font-size: 0.95rem;
    color: var(--hud-label);
    text-transform: uppercase;
}

.mode-select-btns {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.btn-mode {
    background: #000033;
    color: #aaaaff;
    border: 2px solid var(--hud-border);
    padding: 10px 8px;
    font-family: 'Share Tech Mono', monospace;
    font-size: 0.9rem;
    cursor: pointer;
    text-align: center;
    transition: all 0.2s;
}

.btn-mode.active, .btn-mode:hover {
    background: #002277;
    color: #ffffff;
    border-color: #00aaff;
    box-shadow: 0 0 10px rgba(0, 150, 255, 0.5);
}

.level-picker-wrap {
    display: flex;
    align-items: center;
    gap: 12px;
}

.level-slider {
    flex: 1;
    accent-color: var(--hud-accent);
}

.level-badge {
    font-family: 'Press Start 2P', monospace;
    font-size: 1.2rem;
    color: var(--hud-accent);
    background: #000000;
    padding: 4px 12px;
    border: 1px solid var(--hud-accent);
}

/* Start Music Placeholder Box */
.music-placeholder-card {
    background: rgba(0, 20, 40, 0.7);
    border: 2px dashed #0088aa;
    padding: 18px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.music-title-wrap {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #00ffff;
    font-size: 1rem;
    font-weight: bold;
}

.music-status-text {
    font-size: 0.85rem;
    color: #88ffbb;
}

.music-btn-row {
    display: flex;
    gap: 10px;
    align-items: center;
}

.music-info-note {
    font-size: 0.8rem;
    color: #88aacc;
    line-height: 1.4;
}

/* ==========================================================================
   BUTTONS
   ========================================================================== */
.btn-primary {
    background: #008800;
    color: #ffffff;
    border: 2px solid #00ff33;
    padding: 12px 28px;
    font-family: 'Press Start 2P', monospace;
    font-size: 1rem;
    cursor: pointer;
    box-shadow: 0 0 15px rgba(0, 255, 50, 0.4);
    transition: all 0.2s;
    text-transform: uppercase;
}

.btn-primary:hover {
    background: #00bb00;
    box-shadow: 0 0 25px rgba(0, 255, 50, 0.8);
    transform: scale(1.02);
}

.btn-secondary {
    background: #001144;
    color: #88ccff;
    border: 2px solid #0055bb;
    padding: 10px 20px;
    font-family: 'Press Start 2P', monospace;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-secondary:hover {
    background: #002277;
    color: #ffffff;
    border-color: #0088ff;
    box-shadow: 0 0 12px rgba(0, 120, 255, 0.5);
}

/* ==========================================================================
   5. IN-GAME HUD (Exact match to screenshot)
   ========================================================================== */
#screen-game {
    display: none;
    width: 100%;
    height: 100%;
    background: #000000;
}

#screen-game.active {
    display: grid;
    grid-template-columns: 85px minmax(0, 1fr) 230px;
    height: 100%;
    width: 100%;
    overflow: hidden;
    box-sizing: border-box;
}

/* LEFT COLUMN: Level & Pit Depth Gauge */
.hud-left {
    display: flex;
    flex-direction: column;
    align-items: center;
    background: #000000;
    padding: 12px 6px;
    border-right: 2px solid #0000aa;
    gap: 14px;
    width: 85px;
    min-width: 85px;
    max-width: 85px;
    height: 100%;
    box-sizing: border-box;
    z-index: 10;
}

.hud-level-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
}

.hud-level-label {
    font-family: 'Share Tech Mono', monospace;
    font-size: 0.85rem;
    color: #0088ff;
    font-weight: bold;
    letter-spacing: 1px;
    margin-bottom: 2px;
}

.hud-level-num-box {
    width: 60px;
    height: 48px;
    background: #000000;
    border: 2px solid #0000aa;
    display: flex;
    justify-content: center;
    align-items: center;
}

.hud-level-num {
    font-family: 'Share Tech Mono', 'VT323', monospace;
    font-size: 2.2rem;
    font-weight: bold;
    color: #ff9900;
    line-height: 1;
}

/* Vertical Pit Depth Gauge */
.hud-depth-gauge-wrap {
    flex: 1;
    width: 32px;
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 10px;
}

.hud-depth-gauge {
    width: 100%;
    height: 100%;
    border: 2px solid #00cc00;
    background: #000000;
    display: flex;
    flex-direction: column-reverse; /* Bottom layer is index 0 */
    padding: 2px;
    gap: 2px;
}

.gauge-segment {
    width: 100%;
    flex: 1;
    background: #000000;
    transition: background 0.15s;
    border-radius: 1px;
}

.gauge-segment.filled {
    background: #0055ff;
}

.gauge-segment.filled.full {
    background: #00ff33;
    box-shadow: 0 0 6px #00ff33;
}

/* CENTER: 3D Viewport */
.hud-center {
    position: relative;
    background: #000000;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    width: 100%;
    height: 100%;
    min-width: 0;
    min-height: 0;
}

#three-viewport {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    min-width: 0;
    min-height: 0;
    overflow: hidden;
}

#three-viewport canvas {
    display: block;
    width: 100% !important;
    height: 100% !important;
}

/* Center HUD Overlays */
.hud-alert-banner {
    position: absolute;
    top: 20px;
    background: rgba(0, 0, 0, 0.85);
    border: 2px solid #ffd700;
    color: #ffd700;
    padding: 10px 24px;
    font-family: 'Press Start 2P', monospace;
    font-size: 0.9rem;
    box-shadow: 0 0 20px rgba(255, 215, 0, 0.6);
    pointer-events: none;
    opacity: 0;
    transform: translateY(-20px);
    transition: all 0.3s;
    z-index: 50;
}

.hud-alert-banner.active {
    opacity: 1;
    transform: translateY(0);
}

.hud-alert-banner.level-up {
    border-color: #00ff66;
    color: #00ff66;
    box-shadow: 0 0 25px rgba(0, 255, 100, 0.8);
}

/* Controls reminder overlay in game */
.hud-controls-helper {
    position: absolute;
    bottom: 10px;
    background: rgba(0, 0, 20, 0.8);
    border: 1px solid #0044aa;
    padding: 6px 14px;
    font-size: 0.78rem;
    color: #88ccff;
    display: flex;
    gap: 15px;
    pointer-events: none;
    z-index: 20;
}

/* RIGHT COLUMN: Authentic Retro Block Out HUD */
.hud-right {
    display: flex;
    flex-direction: column;
    background: #000000;
    border-left: 2px solid #0000aa;
    padding: 12px 14px;
    gap: 12px;
    width: 230px;
    min-width: 230px;
    max-width: 230px;
    height: 100%;
    box-sizing: border-box;
    overflow-y: auto;
    overflow-x: hidden;
    z-index: 10;
}

/* BLOCK OUT 3D Logo */
.hud-logo-box {
    text-align: center;
    margin-bottom: 2px;
}

.hud-logo-text {
    font-family: 'Press Start 2P', monospace;
    font-size: 1.35rem;
    font-weight: 900;
    color: #0055ff;
    text-shadow: 3px 3px 0 #dd1100, 4px 4px 0 #990000;
    letter-spacing: 2px;
    line-height: 1.15;
}

/* Stat Card */
.hud-stat-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
}

.hud-stat-label {
    font-family: 'Share Tech Mono', monospace;
    font-size: 0.85rem;
    color: #0088ff;
    letter-spacing: 1.5px;
    margin-bottom: 4px;
    text-transform: uppercase;
}

.hud-stat-val-box {
    width: 100%;
    height: 38px;
    background: #000000;
    border: 2px solid #0000aa;
    display: flex;
    justify-content: flex-end;
    align-items: center;
    padding: 0 10px;
}

.hud-stat-val {
    font-family: 'Share Tech Mono', 'VT323', monospace;
    font-size: 1.9rem;
    color: #00cc33;
    font-weight: bold;
    letter-spacing: 2px;
}

.hud-stat-val.pit-val {
    justify-content: center;
    color: #ff9900;
    font-size: 1.35rem;
}

.hud-stat-val.blockset-val {
    justify-content: center;
    color: #ff9900;
    font-size: 1.25rem;
}

/* HUD Top Button Bar */
.hud-top-actions {
    display: flex;
    justify-content: space-between;
    margin-bottom: 4px;
}

.btn-icon {
    background: #000033;
    color: #00aaff;
    border: 1px solid #0000aa;
    padding: 4px 8px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.15s;
}

.btn-icon:hover {
    background: #002277;
    color: #ffffff;
}

/* ==========================================================================
   6. SETTINGS MODAL
   ========================================================================== */
#modal-settings {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    z-index: 100;
    display: none;
    justify-content: center;
    align-items: center;
}

#modal-settings.active {
    display: flex;
}

.settings-card {
    width: 580px;
    max-height: 90%;
    background: #00001a;
    border: 3px solid var(--hud-border-light);
    box-shadow: 0 0 30px rgba(0, 100, 255, 0.5);
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    overflow-y: auto;
}

.settings-title {
    font-family: 'Press Start 2P', monospace;
    font-size: 1.1rem;
    color: var(--hud-label);
    border-bottom: 2px solid var(--hud-border);
    padding-bottom: 10px;
}

.settings-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.settings-group-label {
    font-size: 0.9rem;
    color: var(--hud-accent);
    text-transform: uppercase;
    font-weight: bold;
}

.settings-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.9rem;
    color: #ccccee;
}

.slider-ctrl {
    accent-color: var(--hud-accent);
    width: 140px;
}

.select-ctrl {
    background: #000033;
    color: #00ffff;
    border: 1px solid var(--hud-border-light);
    padding: 6px 10px;
    font-family: 'Share Tech Mono', monospace;
    font-size: 0.9rem;
}

.audio-guide-box {
    background: rgba(0, 20, 50, 0.6);
    border: 1px dashed #0088cc;
    padding: 10px 14px;
    font-size: 0.82rem;
    color: #88bbdd;
    line-height: 1.4;
}

/* ==========================================================================
   7. GAME OVER & HIGH SCORES SCREEN
   ========================================================================== */
#screen-gameover {
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background: rgba(0, 0, 15, 0.95);
    padding: 30px;
    gap: 20px;
}

.gameover-title {
    font-family: 'Press Start 2P', monospace;
    font-size: 2.2rem;
    color: #ff2222;
    text-shadow: 3px 3px 0 #660000, 0 0 15px rgba(255, 0, 0, 0.7);
    animation: blink 1.2s step-start infinite;
}

.gameover-stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px 30px;
    background: #000028;
    border: 2px solid var(--hud-border);
    padding: 18px 30px;
    font-size: 1.1rem;
    color: #00ffff;
}

.high-score-entry-card {
    background: rgba(0, 40, 20, 0.8);
    border: 2px solid #00ff33;
    padding: 15px 25px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.name-input {
    background: #000000;
    color: #00ff33;
    border: 2px solid #00ff33;
    font-family: 'Press Start 2P', monospace;
    font-size: 1.2rem;
    padding: 6px 12px;
    text-align: center;
    letter-spacing: 4px;
    width: 160px;
    text-transform: uppercase;
}

.leaderboard-table {
    width: 480px;
    border-collapse: collapse;
    font-size: 0.9rem;
    color: #00ff33;
    margin-top: 6px;
}

.leaderboard-table th {
    color: #00aaff;
    border-bottom: 1px solid #0000aa;
    padding: 4px 8px;
    text-align: left;
}

.leaderboard-table td {
    padding: 4px 8px;
    border-bottom: 1px solid #000033;
}

/* Animations */
@keyframes blink {
    50% { opacity: 0; }
}

@keyframes floatTitle {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-6px); }
}

/* ==========================================================================
   PAUSE / ABANDON GAME MODAL
   ========================================================================== */
#modal-pause {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 10, 0.85);
    z-index: 100;
    display: none;
    justify-content: center;
    align-items: center;
}

#modal-pause.active {
    display: flex;
}

.pause-card {
    width: 440px;
    background: #00001a;
    border: 3px solid var(--hud-border-light);
    box-shadow: 0 0 35px rgba(0, 100, 255, 0.6);
    padding: 28px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 18px;
    text-align: center;
}

.pause-title {
    font-family: 'Press Start 2P', monospace;
    font-size: 1.4rem;
    color: #ffaa00;
    text-shadow: 2px 2px 0 #663300;
}

.pause-btn-group {
    display: flex;
    flex-direction: column;
    width: 100%;
    gap: 12px;
}

.btn-danger {
    background: #880000;
    color: #ffffff;
    border: 2px solid #ff3333;
    padding: 12px 20px;
    font-family: 'Press Start 2P', monospace;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-danger:hover {
    background: #cc0000;
    box-shadow: 0 0 15px rgba(255, 50, 50, 0.6);
}

