:root {
    --bg-void: #050814;
    --panel-bg: rgba(9, 20, 40, 0.88);
    --cyan: #5ce1e6;
    --cyan-glow: rgba(92, 225, 230, 0.35);
    --purple: #a855f7;
    --red: #f43f5e;
    --green: #34d399;
    --orange: #fb923c;
    --text-main: #e2e8f0;
    --text-dim: #94a3b8;
    --font-pixel: 'Press Start 2P', monospace;
    --font-mono: 'VT323', monospace;
}

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

body {
    background-color: var(--bg-void);
    color: var(--text-main);
    font-family: var(--font-mono);
    font-size: 20px;
    line-height: 1.5;
    overflow-x: hidden;
}

/* FONDO ESPACIAL Y CUADRÍCULA TÁCTICA */
.void-bg {
    position: fixed;
    inset: 0;
    z-index: -1;
    overflow: hidden;
    background: radial-gradient(circle at 50% 30%, #0b132b 0%, #050814 80%);
}

.tactical-grid {
    position: absolute;
    inset: -10%;
    background-image:
        linear-gradient(to right, rgba(56, 189, 248, 0.08) 1px, transparent 1px),
        linear-gradient(to bottom, rgba(56, 189, 248, 0.08) 1px, transparent 1px);
    background-size: 48px 48px;
    transform: rotate(-3deg);
}

.nebula-block {
    position: absolute;
    opacity: 0.25;
}

.nebula-purple {
    top: 8%;
    left: 2%;
    width: 340px;
    height: 460px;
    background: #3b0764;
}

.nebula-teal {
    top: 4%;
    left: 22%;
    width: 240px;
    height: 310px;
    background: #0f3d4c;
}

.nebula-indigo {
    bottom: 6%;
    left: 16%;
    width: 380px;
    height: 290px;
    background: #171547;
}

.pixel-star {
    position: absolute;
    background: #ffffff;
    animation: twinkle 3s infinite alternate;
}

@keyframes twinkle {
    from { opacity: 0.25; }
    to { opacity: 1; }
}

/* UTILIDADES DE COLOR */
.cyan { color: var(--cyan); }
.purple { color: var(--purple); }
.red { color: var(--red); }

/* PANEL HUD CON ESQUINAS TÁCTICAS */
.hud-panel {
    position: relative;
    background: var(--panel-bg);
    border: 1px solid rgba(92, 225, 230, 0.25);
    padding: 2rem;
    box-shadow: 0 0 30px rgba(0, 0, 0, 0.6);
}

.corner {
    position: absolute;
    width: 10px;
    height: 10px;
    border-color: var(--cyan);
    border-style: solid;
    pointer-events: none;
}

.corner.tl { top: -1px; left: -1px; border-width: 2px 0 0 2px; }
.corner.tr { top: -1px; right: -1px; border-width: 2px 2px 0 0; }
.corner.bl { bottom: -1px; left: -1px; border-width: 0 0 2px 2px; }
.corner.br { bottom: -1px; right: -1px; border-width: 0 2px 2px 0; }

/* TOPBAR */
.hud-topbar {
    position: sticky;
    top: 0;
    z-index: 40;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.9rem 2rem;
    background: rgba(5, 8, 20, 0.92);
    border-bottom: 1px solid rgba(92, 225, 230, 0.25);
    backdrop-filter: blur(6px);
}

.hud-brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-family: var(--font-pixel);
    font-size: 0.75rem;
    color: var(--cyan);
}

.feather-icon-sm { width: 26px; height: 26px; }
.feather-icon-lg { width: 72px; height: 72px; filter: drop-shadow(0 0 12px rgba(56, 189, 248, 0.5)); }

.hud-nav {
    display: flex;
    gap: 1.8rem;
}

.hud-nav a {
    color: var(--text-dim);
    text-decoration: none;
    font-family: var(--font-pixel);
    font-size: 0.65rem;
    transition: color 0.2s;
}

.hud-nav a:hover {
    color: var(--cyan);
}

.btn-hud-sm {
    background: rgba(92, 225, 230, 0.12);
    border: 1px solid var(--cyan);
    color: var(--cyan);
    font-family: var(--font-pixel);
    font-size: 0.65rem;
    padding: 0.55rem 0.9rem;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-hud-sm:hover {
    background: var(--cyan);
    color: var(--bg-void);
}

/* CONTENEDOR Y HERO */
.container {
    max-width: 1120px;
    margin: 0 auto;
    padding: 2rem 1.5rem 5rem;
}

.hero-section {
    text-align: center;
    padding: 3.5rem 0 4rem;
}

.feather-emblem {
    margin-bottom: 1.2rem;
    animation: float 3.5s ease-in-out infinite;
}

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

.main-title {
    font-family: var(--font-pixel);
    font-size: clamp(2rem, 5vw, 3.6rem);
    color: var(--cyan);
    text-shadow: 0 0 22px var(--cyan-glow);
    letter-spacing: 4px;
    margin-bottom: 0.75rem;
}

.subtitle {
    font-family: var(--font-pixel);
    font-size: 0.9rem;
    color: #a5b4fc;
    letter-spacing: 3px;
    margin-bottom: 1.5rem;
}

.hero-desc {
    max-width: 680px;
    margin: 0 auto 2.5rem;
    font-size: 1.35rem;
    color: var(--text-dim);
}

/* BOTONES ESTILO MENÚ DEL JUEGO */
.menu-stack {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    margin-bottom: 3rem;
}

.menu-btn {
    position: relative;
    display: inline-block;
    width: 100%;
    max-width: 420px;
    padding: 1rem 1.5rem;
    background: rgba(11, 24, 48, 0.9);
    border: 1px solid rgba(92, 225, 230, 0.35);
    color: var(--text-main);
    font-family: var(--font-pixel);
    font-size: 0.78rem;
    text-decoration: none;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
}

.menu-btn:hover,
.menu-btn.primary {
    border-color: var(--cyan);
    background: rgba(20, 48, 84, 0.95);
    color: var(--cyan);
    box-shadow: 0 0 18px rgba(92, 225, 230, 0.22);
}

/* LEYENDA DE CONTROLES Y ARCHIVE RECORD */
.telemetry-strip {
    border-top: 1px solid rgba(92, 225, 230, 0.18);
    padding-top: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
    font-family: var(--font-pixel);
    font-size: 0.65rem;
}

.controls-legend {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 1.5rem;
    color: var(--text-dim);
}

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

.archive-record {
    color: #c084fc;
    letter-spacing: 1px;
}

/* SECCIONES */
.section-block {
    margin-top: 4.5rem;
}

.section-header {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.section-header h2 {
    font-family: var(--font-pixel);
    font-size: 1rem;
    color: var(--cyan);
}

/* TABS DEL SIMULADOR */
.tab-bar {
    display: flex;
    gap: 0.5rem;
}

.tab-btn {
    background: rgba(9, 20, 40, 0.8);
    border: 1px solid rgba(92, 225, 230, 0.3);
    color: var(--text-dim);
    font-family: var(--font-pixel);
    font-size: 0.62rem;
    padding: 0.6rem 0.9rem;
    cursor: pointer;
}

.tab-btn.active,
.tab-btn:hover {
    border-color: var(--cyan);
    color: var(--cyan);
    background: rgba(92, 225, 230, 0.12);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* ESCENARIO SIMULADO */
.sim-hud-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
    flex-wrap: wrap;
    font-family: var(--font-pixel);
    font-size: 0.62rem;
    margin-bottom: 1.5rem;
}

.hud-mini-box {
    border: 1px solid rgba(92, 225, 230, 0.4);
    padding: 0.75rem;
    min-width: 240px;
    background: rgba(5, 8, 20, 0.7);
}

.hud-mini-box.danger {
    border-color: rgba(244, 63, 94, 0.6);
}

.hud-mini-box.right {
    text-align: right;
    min-width: 190px;
}

.bar-row {
    margin-top: 0.5rem;
}

.bar-track {
    width: 100%;
    height: 8px;
    background: #0f172a;
    border: 1px solid #334155;
    margin-top: 4px;
}

.bar-fill {
    height: 100%;
}

.bar-fill.cyan { background: var(--cyan); }
.bar-fill.green { background: var(--green); }
.bar-fill.purple { background: var(--purple); }
.bar-fill.red { background: var(--red); }

.boss-bar {
    flex: 1;
    min-width: 220px;
    text-align: center;
}

.sim-stage {
    position: relative;
    height: 240px;
    border: 1px dashed rgba(92, 225, 230, 0.25);
    background: rgba(3, 6, 16, 0.65);
    overflow: hidden;
}

.player-ship {
    position: absolute;
    top: 45%;
    left: 52%;
    color: var(--cyan);
    font-size: 1.6rem;
    padding: 4px 8px;
    border: 2px solid var(--cyan);
    box-shadow: 0 0 12px var(--cyan-glow);
}

.enemy-triangle {
    position: absolute;
    font-size: 1.3rem;
}

.enemy-triangle.orange { color: var(--orange); }
.enemy-triangle.red { color: var(--red); }

.planet-pixel {
    position: absolute;
    right: 10%;
    bottom: 14%;
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: repeating-linear-gradient(
        to bottom,
        #1e3a5f 0px,
        #1e3a5f 6px,
        #0f172a 6px,
        #0f172a 10px
    );
}

.boss-core {
    position: absolute;
    top: 22%;
    left: 46%;
    font-size: 3rem;
    color: var(--red);
    border: 2px solid var(--red);
    padding: 0.3rem 0.9rem;
}

.bullet-grid {
    position: absolute;
    inset: 0;
    display: flex;
    justify-content: space-around;
    align-items: center;
    color: var(--red);
    font-size: 0.9rem;
}

.sim-footer {
    margin-top: 1.2rem;
    text-align: center;
    font-family: var(--font-pixel);
    font-size: 0.62rem;
}

.augment-bar {
    max-width: 420px;
    margin: 0 auto;
}

/* PANEL DE OPCIONES */
.options-panel {
    max-width: 580px;
    margin: 0 auto;
    text-align: center;
}

.options-panel h3 {
    font-family: var(--font-pixel);
    color: var(--cyan);
    font-size: 1.2rem;
}

.opt-sub {
    color: var(--text-dim);
    margin-bottom: 1.5rem;
}

.opt-row {
    display: flex;
    justify-content: space-between;
    padding: 0.9rem 1.2rem;
    margin-bottom: 0.75rem;
    border: 1px solid rgba(92, 225, 230, 0.25);
    background: rgba(5, 8, 20, 0.6);
    font-family: var(--font-pixel);
    font-size: 0.68rem;
    cursor: pointer;
    transition: border-color 0.2s;
}

.opt-row:hover {
    border-color: var(--cyan);
}

.opt-hint {
    margin-top: 1rem;
    font-size: 1rem;
    color: var(--text-dim);
}

/* TARJETAS DE ARSENAL */
.cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
}

.feature-card h3 {
    font-family: var(--font-pixel);
    font-size: 0.85rem;
    margin: 0.75rem 0;
    color: #fff;
}

.card-tag {
    font-family: var(--font-pixel);
    font-size: 0.62rem;
}

/* DESCARGA Y CRÉDITOS */
.download-box {
    text-align: center;
}

.download-box h2 {
    font-family: var(--font-pixel);
    color: var(--cyan);
    font-size: 1.2rem;
    margin-bottom: 0.75rem;
}

.download-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 1rem;
    margin: 2rem 0;
}

.credits-divider {
    height: 1px;
    background: rgba(92, 225, 230, 0.25);
    margin: 2rem auto 1.5rem;
    max-width: 520px;
}

.credits-line {
    font-family: var(--font-pixel);
    font-size: 0.7rem;
    color: var(--text-dim);
}

/* MODAL DE DEMO CANVAS */
.modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 100;
    background: rgba(2, 4, 12, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.modal-backdrop.hidden {
    display: none;
}

.modal-window {
    width: 100%;
    max-width: 960px;
    padding: 1.2rem;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    margin-bottom: 0.8rem;
    font-family: var(--font-pixel);
    font-size: 0.6rem;
    color: var(--cyan);
}

.btn-close {
    background: transparent;
    border: 1px solid var(--red);
    color: var(--red);
    font-family: var(--font-pixel);
    font-size: 0.6rem;
    padding: 0.4rem 0.7rem;
    cursor: pointer;
}

.canvas-wrapper {
    position: relative;
}

#gameCanvas {
    width: 100%;
    height: auto;
    display: block;
    background: #050814;
    border: 1px solid rgba(92, 225, 230, 0.4);
    cursor: crosshair;
}

.canvas-hud {
    position: absolute;
    top: 10px;
    left: 12px;
    right: 12px;
    display: flex;
    justify-content: space-between;
    font-family: var(--font-pixel);
    font-size: 0.65rem;
    pointer-events: none;
}

@media (max-width: 720px) {
    .hud-nav { display: none; }
}