/* =============================================
   INFINITY WARP — RETRO PIXEL / VHS + POWERUPS
   ============================================= */

@import url('https://fonts.googleapis.com/css2?family=VT323&display=swap');

:root {
    --black: #000000;
    --white: #ffffff;
    --gray-dark: #111111;
    --gray-mid: #444444;
    --thruster-blue: #00f2ff;
}

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

html, body { width: 100%; height: 100%; overflow: hidden; }

.game-body {
    background: var(--black);
    color: var(--white);
    font-family: 'VT323', monospace;
    image-rendering: pixelated;
    image-rendering: crisp-edges;
}

/* =============================================
   CRT / VHS OVERLAY
   ============================================= */
.crt-overlay {
    position: fixed;
    inset: 0;
    z-index: 999;
    pointer-events: none;
}

.crt-lines {
    position: absolute;
    inset: 0;
    background: repeating-linear-gradient(
        0deg,
        rgba(0,0,0,0.03),
        rgba(0,0,0,0.03) 1px,
        transparent 1px,
        transparent 4px
    );
}

.crt-flicker {
    position: absolute;
    inset: 0;
    background: rgba(255,255,255,0.015);
    animation: flicker 0.15s infinite;
}

@keyframes flicker {
    0%   { opacity: 0.9; }
    50%  { opacity: 1.0; }
    100% { opacity: 0.93; }
}

.vhs-grain {
    position: absolute;
    inset: 0;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.08'/%3E%3C/svg%3E");
    opacity: 0.12;
    animation: grain 0.3s steps(2) infinite;
}

@keyframes grain {
    0%   { transform: translate(0, 0); }
    33%  { transform: translate(-2px, 1px); }
    66%  { transform: translate(1px, -2px); }
    100% { transform: translate(0, 0); }
}

.vignette {
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse at center, transparent 50%, rgba(0,0,0,0.85) 100%);
}

/* =============================================
   FULLSCREEN LAYERS
   ============================================= */
.fullscreen-overlay {
    position: fixed;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.fullscreen-overlay.hidden { display: none; }
.fullscreen-overlay.active { display: flex; }

.starfield-canvas {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
}

/* =============================================
   MENU / START SCREEN
   ============================================= */
#start-screen {
    background: var(--black);
    justify-content: space-between;
    padding: 0;
}

.retro-nav {
    width: 100%;
    padding: 16px 40px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 3px solid var(--white);
    z-index: 10;
}

.back-link {
    color: var(--white);
    text-decoration: none;
    font-size: 1.6rem;
    letter-spacing: 2px;
    transition: all 0.15s;
}

.back-link:hover { background: var(--white); color: var(--black); }

.retro-badge {
    font-size: 1.2rem;
    letter-spacing: 3px;
    opacity: 0.5;
}

.menu-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 22px;
    z-index: 10;
    filter: url(#fisheye-filter);
}

.title-block { text-align: center; line-height: 1; }

.title-sub {
    font-size: 1.3rem;
    letter-spacing: 6px;
    opacity: 0.7;
    margin-bottom: 8px;
}

.game-big-title {
    font-size: clamp(4rem, 12vw, 9rem);
    font-weight: 400;
    line-height: 0.9;
    text-shadow: 4px 4px 0 var(--gray-mid), 0 0 30px rgba(255,255,255,0.15);
    letter-spacing: 8px;
}

.title-warp {
    display: inline-block;
    border: 4px solid var(--white);
    padding: 0 20px;
    letter-spacing: 20px;
    margin-top: 10px;
    animation: titlePulse 2s infinite;
}

@keyframes titlePulse {
    0%, 100% { text-shadow: 0 0 10px var(--white), 0 0 30px rgba(255,255,255,0.3); }
    50%       { text-shadow: 0 0 4px var(--white); }
}

.menu-instructions {
    text-align: left;
    border: 2px solid var(--white);
    padding: 14px 30px;
    font-size: 1.4rem;
    line-height: 1.9;
    letter-spacing: 1px;
    opacity: 0.85;
}

/* Powerup legend on menu */
.menu-powerup-legend {
    display: flex;
    gap: 16px;
    font-size: 1.4rem;
}

.pu-badge {
    border: 2px solid var(--white);
    padding: 4px 14px;
    letter-spacing: 2px;
}

.pu-speed  { animation: puSpeedAnim 1.5s linear infinite; }
.pu-shoot  { animation: puShootAnim 2s ease-in-out infinite; }
.pu-life   { animation: puLifeAnim 1.2s ease-in-out infinite; }

@keyframes puSpeedAnim {
    0%, 100% { border-color: #fff; }
    50%       { border-color: rgba(255,255,255,0.3); box-shadow: 0 0 12px #fff; }
}
@keyframes puShootAnim {
    0%, 100% { transform: scale(1); }
    50%       { transform: scale(1.05); box-shadow: 0 0 10px #fff; }
}
@keyframes puLifeAnim {
    0%, 100% { transform: scale(1); color: #fff; }
    50%       { transform: scale(1.1); color: rgba(255,255,255,0.6); }
}

.hi-score-display {
    font-size: 2rem;
    letter-spacing: 6px;
    opacity: 0.7;
}

/* =============================================
   PIXEL BUTTONS
   ============================================= */
.pixel-btn {
    background: var(--white);
    color: var(--black);
    border: 4px solid var(--white);
    padding: 10px 32px;
    font-size: 2rem;
    font-family: 'VT323', monospace;
    letter-spacing: 4px;
    cursor: pointer;
    text-decoration: none;
    display: inline-block;
    transition: all 0.1s;
    text-align: center;
}

.pixel-btn:hover {
    background: var(--black);
    color: var(--white);
    box-shadow: 0 0 20px rgba(255,255,255,0.4);
}

.pixel-btn-outline {
    background: var(--black);
    color: var(--white);
}

.pixel-btn-outline:hover { background: var(--white); color: var(--black); }

.blink-btn { animation: btnBlink 1.2s step-start infinite; }

@keyframes btnBlink {
    0%, 49% { opacity: 1; }
    50%, 100% { opacity: 0.4; }
}

.flicker-text { animation: flicker 0.4s infinite; }

/* =============================================
   MENU FOOTER
   ============================================= */
.retro-footer {
    width: 100%;
    border-top: 3px solid var(--white);
    text-align: center;
    padding: 14px;
    font-size: 1rem;
    letter-spacing: 2px;
    opacity: 0.55;
    z-index: 10;
}

.footer-tape {
    display: block;
    font-size: 0.75rem;
    opacity: 0.3;
    margin-bottom: 4px;
}

/* =============================================
   GAME SCREEN HUD
   ============================================= */
#game-screen {
    background: var(--black);
    justify-content: flex-start;
}

.hud {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: stretch;
    padding: 8px 20px;
    border-bottom: 3px solid var(--white);
    background: var(--black);
    z-index: 10;
    flex-shrink: 0;
    gap: 10px;
}

.hud-block {
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.hud-center-block {
    align-items: center;
    flex: 1;
    gap: 4px;
}

.hud-right-block {
    align-items: flex-end;
    gap: 4px;
}

.hud-sub-row {
    display: flex;
    align-items: center;
    gap: 12px;
}

.hud-spacer { margin-left: 16px; }

.hud-label {
    font-size: 0.9rem;
    letter-spacing: 3px;
    opacity: 0.55;
}

.hud-value {
    font-size: 2rem;
    letter-spacing: 3px;
}

.hud-lives-val {
    font-size: 1.8rem;
    letter-spacing: 2px;
    transition: color 0.2s;
}

.hud-title {
    font-size: 1.5rem;
    letter-spacing: 8px;
    opacity: 0.45;
}

/* Powerup status bar in HUD */
.powerup-status-hud {
    font-size: 1.3rem;
    letter-spacing: 3px;
    min-height: 1.4rem;
    animation: puHudPulse 0.8s ease-in-out infinite;
    white-space: nowrap;
}

@keyframes puHudPulse {
    0%, 100% { opacity: 1; }
    50%       { opacity: 0.55; }
}

#gameCanvas {
    flex: 1;
    width: 100%;
    background: var(--black);
    image-rendering: pixelated;
    display: block;
}

.game-footer-hud {
    width: 100%;
    display: flex;
    justify-content: space-between;
    padding: 10px 20px;
    border-top: 3px solid var(--white);
    font-size: 1.2rem;
    letter-spacing: 3px;
    background: var(--black);
    flex-shrink: 0;
}

.shooter-hint-hidden { opacity: 0; }
.shooter-hint-active {
    opacity: 1;
    animation: shooterHintBlink 0.5s step-start infinite;
}

@keyframes shooterHintBlink {
    0%, 49% { opacity: 1; }
    50%, 100% { opacity: 0.3; }
}

/* =============================================
   GAME OVER SCREEN
   ============================================= */
#gameover-screen { background: var(--black); }

.gameover-content {
    z-index: 10;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 24px;
    border: 4px solid var(--white);
    padding: 40px 60px;
    filter: url(#fisheye-filter);
}

.go-pre {
    font-size: 1.4rem;
    letter-spacing: 6px;
    opacity: 0.6;
}

.go-title {
    font-size: clamp(3.5rem, 10vw, 7rem);
    font-weight: 400;
    text-align: center;
    line-height: 0.9;
    text-shadow: 4px 4px 0 var(--gray-mid), 0 0 30px rgba(255,255,255,0.12);
    letter-spacing: 10px;
}

.go-scores { width: 100%; display: flex; flex-direction: column; gap: 10px; }

.go-score-row {
    display: flex;
    justify-content: space-between;
    font-size: 1.8rem;
    border-bottom: 1px solid rgba(255,255,255,0.3);
    padding-bottom: 6px;
    letter-spacing: 4px;
}

.go-buttons { display: flex; gap: 16px; }
