/* =====================================================
   TANK BATTALION – ARCADE EDITION
   style.css
   ===================================================== */

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

:root {
    --bg:        #000000;
    --hud-bg:    #111111;
    --gold:      #ffd700;
    --green:     #00ff41;
    --red:       #ff2222;
    --cyan:      #00e5ff;
    --white:     #ffffff;
    --gray:      #666666;
    --panel-bg:  rgba(10, 10, 10, 0.92);
    --border:    rgba(255, 215, 0, 0.4);
}

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

html, body {
    width: 100%;
    height: 100%;
    background: var(--bg);
    font-family: 'Press Start 2P', monospace;
    color: var(--white);
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* ===================== ARCADE CABINET ===================== */
.cabinet-container {
    width: 100vw;
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    background: radial-gradient(circle at center, #1a1a1a 0%, #000000 100%);
    padding: 20px;
}

.cabinet {
    position: relative;
    background: #0d0d0d;
    padding: 40px;
    border-radius: 20px;
    border: 6px solid #1a1a1a;
    box-shadow: 
        0 60px 100px -20px rgba(0,0,0,0.8),
        0 0 40px rgba(0,0,0,0.5),
        inset 0 0 100px rgba(0,0,0,0.8);
}

/* Red side stripes */
.cabinet::before, .cabinet::after {
    content: '';
    position: absolute;
    top: 5%;
    bottom: 5%;
    width: 10px;
    background: linear-gradient(to bottom, transparent, var(--red), transparent);
    box-shadow: 0 0 15px var(--red);
}
.cabinet::before { left: 15px; }
.cabinet::after { right: 15px; }

.cabinet-bezel {
    position: relative;
    background: #000;
    padding: 5px;
    border-radius: 10px;
    box-shadow: inset 0 0 20px #000;
    overflow: hidden;
    width: 800px;
    height: 850px; /* HUD (50) + Canvas (800) */
    display: flex;
    flex-direction: column;
}

/* ===================== SCREEN SYSTEM ===================== */
.screen {
    display: none;
    width: 100%;
    height: 100%;
    justify-content: center;
    align-items: center;
    flex-direction: column;
    position: absolute;
    top: 0; left: 0;
    z-index: 10;
}

.screen.active {
    display: flex;
}

/* ===================== TITLE SCREEN ===================== */
#screen-title {
    background: radial-gradient(ellipse at center, #1a0a2e 0%, #000000 85%);
}

.title-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 30px;
    padding: 60px;
    border: 4px solid var(--gold);
    box-shadow: 
        0 0 60px rgba(255, 215, 0, 0.2), 
        inset 0 0 60px rgba(255, 215, 0, 0.05);
    max-width: 650px;
    width: 90%;
    background: rgba(0,0,0,0.4);
}

.title-logo {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
}

.title-tank-icon {
    font-size: 5rem;
    filter: drop-shadow(0 0 15px var(--green));
    animation: bounce 1.2s infinite ease-in-out;
}

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

.title-text {
    font-size: 3.5rem;
    line-height: 1.1;
    text-align: center;
    color: var(--gold);
    text-shadow: 0 0 20px rgba(255, 215, 0, 0.6), 4px 4px 0 #4a3600;
    letter-spacing: 4px;
}

.title-sub {
    font-size: 1rem;
    color: var(--cyan);
    letter-spacing: 8px;
    text-shadow: 0 0 10px var(--cyan);
}

.title-info {
    width: 100%;
    border-top: 2px solid var(--border);
    border-bottom: 2px solid var(--border);
    padding: 15px 0;
}

.score-row {
    display: flex;
    justify-content: space-between;
    font-size: 1.2rem;
    color: var(--gold);
}

.blink-text {
    font-size: 1.1rem;
    color: var(--white);
    animation: blink 0.9s step-end infinite;
    text-align: center;
    letter-spacing: 2px;
}

.blink-text.small {
    font-size: 0.8rem;
}

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

.controls-legend {
    display: flex;
    flex-direction: column;
    gap: 12px;
    width: 100%;
    padding: 0 15px;
}

.legend-row {
    display: flex;
    justify-content: space-between;
    font-size: 0.8rem;
    color: var(--gray);
}

.legend-keys {
    color: var(--cyan);
}

.title-credit {
    font-size: 0.6rem;
    color: #555;
    text-align: center;
}

/* ===================== GAME SCREEN ===================== */
#screen-game {
    flex-direction: column;
    background: #000;
    position: relative;
    z-index: 1;
}

/* ---- HUD ---- */
#hud {
    width: 100%;
    height: 50px;
    background: #050505;
    border-bottom: 2px solid #222;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    gap: 10px;
    flex-shrink: 0;
    box-shadow: 0 5px 15px rgba(0,0,0,0.5);
}

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

.hud-center {
    flex: 1;
}

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

.hud-value {
    font-size: 1rem;
    color: var(--white);
    white-space: nowrap;
    text-shadow: 0 0 8px rgba(255,255,255,0.3);
}

/* ---- Canvas Wrapper ---- */
#canvas-wrapper {
    position: relative;
    width: 800px;
    height: 800px;
    flex-shrink: 0;
    line-height: 0;
    overflow: hidden;
}

#gameCanvas {
    display: block;
    width: 800px;
    height: 800px;
    image-rendering: pixelated;
    image-rendering: crisp-edges;
}

/* ---- Pause Overlay ---- */
.canvas-overlay {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.75);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 20;
}

.canvas-overlay.hidden {
    display: none;
}

.overlay-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 25px;
    padding: 40px 60px;
    border: 3px solid var(--gold);
    background: #000;
    box-shadow: 0 0 50px rgba(255, 215, 0, 0.4);
}

.overlay-title {
    font-size: 2rem;
    color: var(--gold);
    text-shadow: 0 0 15px var(--gold);
}

/* ===================== RESULT SCREENS ===================== */
#screen-stage-clear,
#screen-gameover,
#screen-victory {
    background: radial-gradient(ellipse at center, #0d1b0d 0%, #000000 90%);
}

#screen-gameover {
    background: radial-gradient(ellipse at center, #1a0606 0%, #000000 90%);
}

#screen-victory {
    background: radial-gradient(ellipse at center, #1a150a 0%, #000000 90%);
}

.result-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 30px;
    padding: 60px 80px;
    border: 4px solid var(--border);
    box-shadow: 0 0 50px rgba(255, 215, 0, 0.15);
    max-width: 700px;
    width: 90%;
    background: rgba(0,0,0,0.5);
}

.result-title {
    font-size: 3rem;
    text-align: center;
    text-shadow: 0 0 20px currentColor;
}

.result-subtitle {
    font-size: 1rem;
    color: var(--gray);
    text-align: center;
}

.result-stage {
    font-size: 1.5rem;
    color: var(--cyan);
}

.result-stats {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 15px;
    border-top: 2px solid var(--border);
    border-bottom: 2px solid var(--border);
    padding: 20px 0;
}

.stat-line {
    display: flex;
    justify-content: space-between;
    font-size: 0.9rem;
    color: var(--white);
    gap: 30px;
}

/* Color helpers */
.green-text { color: var(--green); }
.red-text   { color: var(--red);   }
.gold-text  { color: var(--gold);  }

/* ===================== RESPONSIVE ===================== */
@media (max-width: 900px) {
    .cabinet { padding: 20px; }
    .cabinet-bezel {
        width: 100%;
        height: auto;
        aspect-ratio: 1 / 1.06;
    }
    #canvas-wrapper, #gameCanvas {
        width: 100%;
        height: auto;
        aspect-ratio: 1 / 1;
    }
    .title-text { font-size: 2rem; }
}

@media (max-height: 800px) {
    .cabinet { padding: 10px; }
    .title-box, .result-box { padding: 20px; gap: 15px; }
    .title-text { font-size: 1.5rem; }
    .result-title { font-size: 1.8rem; }
    .title-tank-icon { font-size: 3rem; }
}
