/* ============================================================
   STAR VANGUARD — Shared stylesheet
   ============================================================ */

* { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: radial-gradient(circle at 50% 20%, #0a1020, #02040a);
    color: #d8e5f5;
    min-height: 100vh;
    line-height: 1.6;
    overflow-x: hidden;
}

/* ---------- SITE HEADER ---------- */
.site-header {
    background: linear-gradient(180deg, #0b1220, #060a12);
    border-bottom: 1px solid #1e3040;
    box-shadow: 0 4px 20px #00000066;
    position: sticky; top: 0; z-index: 100;
    backdrop-filter: blur(10px);
}
.header-inner {
    max-width: 1200px; margin: 0 auto;
    padding: 0.9rem 1.5rem;
    display: flex; justify-content: space-between; align-items: center;
    flex-wrap: wrap; gap: 1rem;
}
.logo {
    font-size: 1.35rem; font-weight: 900;
    color: #7ae0ff; text-decoration: none;
    letter-spacing: 2px;
    text-shadow: 0 0 20px #4ac7ff88, 0 0 8px #4ac7ff66;
}
.logo:hover { color: #a8e8ff; }
.nav { display: flex; gap: 0.3rem; flex-wrap: wrap; }
.nav a {
    color: #9bb8dd; text-decoration: none;
    font-size: 0.9rem; font-weight: 600;
    letter-spacing: 1px; text-transform: uppercase;
    padding: 0.5rem 1rem;
    border-radius: 2rem;
    transition: all 0.2s;
}
.nav a:hover { color: #7ae0ff; background: #1e2b3e66; }
.nav a.active {
    color: #7ae0ff;
    background: #1e2b3e;
    box-shadow: 0 0 20px #4ac7ff33, inset 0 1px 0 #ffffff11;
}

/* ---------- AD CONTAINERS ---------- */
.ad-container {
    max-width: 1200px;
    margin: 1.5rem auto;
    padding: 0 1.5rem;
    min-height: 90px;
    display: flex; justify-content: center; align-items: center;
    background: #060a1299;
    border-radius: 1rem;
    overflow: hidden;
}
.ad-container ins { width: 100%; }

/* ---------- MAIN LAYOUT ---------- */
.main-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1.5rem 2rem;
}

/* ---------- HERO ---------- */
.hero {
    text-align: center;
    padding: 1.5rem 0 1rem;
}
.hero h1 {
    font-size: 3rem;
    font-weight: 900;
    letter-spacing: 4px;
    background: linear-gradient(180deg, #ffd966, #ff8800);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-shadow: 0 0 60px #ff880055;
    margin-bottom: 0.4rem;
}
.tagline {
    font-size: 1rem; color: #7a9bc4;
    letter-spacing: 2px; text-transform: uppercase;
}

/* ---------- GAME SECTION ---------- */
.game-section {
    display: flex;
    justify-content: center;
    padding: 1rem 0;
}
.game-wrapper {
    display: flex; flex-direction: column; align-items: center;
    background: linear-gradient(145deg, #0d111c, #07090f);
    padding: 1.3rem;
    border-radius: 2rem;
    box-shadow: 0 30px 70px -15px #000000ee, inset 0 0 0 2px #2e3b4e, 0 0 100px #1e90ff22;
    max-width: 100%;
}
.wrapper-relative { position: relative; width: 100%; }
canvas {
    display: block;
    width: 100%;
    max-width: 1000px;
    height: auto;
    aspect-ratio: 2 / 1;
    border-radius: 1.5rem;
    box-shadow: inset 0 0 60px #000000, 0 15px 35px #000000cc, 0 0 0 2px #3a4a60, 0 0 60px #1e90ff44;
    background: #0b0f18;
    cursor: crosshair;
    touch-action: none;
}

/* ---------- HUD ---------- */
.hud {
    display: flex; justify-content: space-between; align-items: center;
    width: 100%;
    margin-top: 0.9rem;
    padding: 0 0.5rem;
    gap: 0.7rem; flex-wrap: wrap;
    color: #eef4ff; font-weight: 600;
}
.hud-left { display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap; }
.hud-item {
    display: flex; align-items: center; gap: 0.5rem;
    background: linear-gradient(145deg, #101624, #0a0e18);
    padding: 0.4rem 0.9rem;
    border-radius: 3rem; border: 1px solid #4b6588;
    box-shadow: 0 5px 0 #030509, 0 0 15px #1e90ff33, inset 0 1px 0 #ffffff22;
}
.hud-icon { font-size: 1.1rem; }
.hud-value {
    font-size: 1.15rem; min-width: 1.8rem; text-align: center;
    color: #ffd966; font-family: monospace; letter-spacing: 1px;
    text-shadow: 0 0 12px #ffb347;
}
.hud-value.small { font-size: 1rem; color: #8fd9ff; text-shadow: 0 0 12px #4ac7ff; }
.hud-value.coin { color: #ffcc44; text-shadow: 0 0 12px #ffaa00; }

.power-badge {
    display: flex; align-items: center; gap: 0.4rem;
    background: linear-gradient(145deg, #1e1338, #120a22);
    padding: 0.3rem 0.9rem;
    border-radius: 3rem; border: 2px solid #b48aff;
    box-shadow: 0 0 20px #b48affaa, 0 4px 0 #0d061b;
    font-size: 0.7rem; text-transform: uppercase; letter-spacing: 2px;
    color: #d9c6ff; transition: all 0.2s;
}
.power-badge.inactive {
    opacity: 0.55; filter: grayscale(0.6);
    border-color: #4a4a6a; box-shadow: 0 4px 0 #0d061b;
}
.power-badge.rapid { border-color: #ffaa33; box-shadow: 0 0 25px #ffaa33aa, 0 4px 0 #0d061b; color: #ffe0a3; }
.power-badge.shield { border-color: #4ac7ff; box-shadow: 0 0 25px #4ac7ffaa, 0 4px 0 #0d061b; color: #b8ecff; }
.power-badge.triple { border-color: #ff88ff; box-shadow: 0 0 25px #ff88ffaa, 0 4px 0 #0d061b; color: #ffd0ff; }

/* ---------- BUTTONS ---------- */
.btn {
    background: linear-gradient(145deg, #2a3d56, #1a2638);
    border: none; color: white;
    font-weight: bold; font-size: 0.9rem; padding: 0.55rem 1.2rem;
    border-radius: 3rem; cursor: pointer;
    box-shadow: 0 6px 0 #0c111a, 0 0 18px #3a6ea5aa, inset 0 1px 0 #ffffff33;
    transition: all 0.06s linear; border: 1px solid #5f8ec9;
    letter-spacing: 0.6px; text-transform: uppercase;
    font-family: inherit;
}
.btn:active { transform: translateY(4px); box-shadow: 0 2px 0 #0c111a, inset 0 1px 0 #ffffff33; }
.btn:hover { background: linear-gradient(145deg, #3a5070, #253248); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; box-shadow: 0 6px 0 #0c111a; }
.btn:disabled:active { transform: none; }

/* ---------- OVERLAYS ---------- */
.overlay {
    position: absolute; left: 0; top: 0;
    width: 100%; height: 100%;
    display: flex; flex-direction: column;
    justify-content: center; align-items: center;
    background: radial-gradient(circle at 50% 40%, #0a1220f2, #02040af8);
    backdrop-filter: blur(14px);
    border-radius: 1.5rem;
    opacity: 0; pointer-events: none;
    transition: opacity 0.3s; z-index: 20;
    padding: 1rem;
    overflow-y: auto;
}
.overlay.show { opacity: 1; pointer-events: all; }
.overlay-title {
    font-size: 2.6rem; margin: 0 0 0.2rem;
    color: #ffd966; font-weight: 900; letter-spacing: 5px;
    text-shadow: 0 0 50px #ffb347, 0 0 20px #ff8800, 0 4px 0 #4a2800;
    text-align: center;
}
.overlay-sub {
    font-size: 0.9rem; color: #9bb8dd; letter-spacing: 4px;
    margin: 0 0 0.9rem; text-transform: uppercase; font-weight: 500;
}

/* Stats grid */
.stats-grid { display: flex; gap: 0.7rem; margin-bottom: 0.8rem; flex-wrap: wrap; justify-content: center; }
.stat-box {
    background: linear-gradient(145deg, #0f1624, #070b14);
    border: 2px solid #3a5a7a;
    border-radius: 1.1rem; padding: 0.45rem 1.2rem; text-align: center;
    min-width: 100px;
    box-shadow: 0 0 30px #1e90ff44, inset 0 1px 0 #ffffff11;
}
.stat-box .label {
    font-size: 0.65rem; color: #7a9bc4;
    text-transform: uppercase; letter-spacing: 3px; margin-bottom: 0.1rem;
}
.stat-box .value {
    font-size: 1.55rem; font-family: monospace; font-weight: 900;
    color: #ffd966; text-shadow: 0 0 20px #ffb347;
}
.stat-box.high .value { color: #7ae0ff; text-shadow: 0 0 20px #4ac7ff; }
.stat-box.coin .value { color: #ffcc44; text-shadow: 0 0 20px #ffaa00; }

/* Coin display */
.coin-display-big {
    display: flex; align-items: center; gap: 0.6rem;
    background: linear-gradient(145deg, #2a1e0a, #1a1206);
    border: 2px solid #ffcc44;
    padding: 0.45rem 1.4rem; border-radius: 2rem;
    box-shadow: 0 0 35px #ffaa0055, inset 0 1px 0 #ffffff22;
    margin-bottom: 0.8rem;
}
.coin-display-big .coin-icon { font-size: 1.4rem; }
.coin-display-big .coin-value {
    font-size: 1.5rem; font-family: monospace; font-weight: 900;
    color: #ffcc44; text-shadow: 0 0 15px #ffaa00;
    letter-spacing: 1.5px;
}

/* Menu tabs */
.menu-tabs {
    display: flex; gap: 0.4rem; margin-bottom: 0.8rem;
    background: #0a0f18aa;
    padding: 0.3rem;
    border-radius: 3rem;
    border: 1px solid #3a5a7a;
}
.tab-btn {
    background: transparent; border: none; color: #7a9bc4;
    font-weight: bold; font-size: 0.8rem; padding: 0.45rem 1.4rem;
    border-radius: 2rem; cursor: pointer;
    letter-spacing: 1.5px; text-transform: uppercase;
    font-family: inherit; transition: all 0.2s;
}
.tab-btn.active {
    background: linear-gradient(145deg, #2a3d56, #1a2638);
    color: #7ae0ff;
    box-shadow: 0 0 20px #4ac7ff66, inset 0 1px 0 #ffffff22;
}
.tab-btn:hover:not(.active) { color: #9bb8dd; }

.tab-content { display: none; flex-direction: column; align-items: center; width: 100%; }
.tab-content.active { display: flex; }

/* Controls hint */
.controls-hint {
    color: #7a9bc4; font-size: 0.78rem;
    letter-spacing: 0.5px; margin-top: 0.8rem; text-align: center;
    line-height: 1.7;
}
.controls-hint kbd, .page-content kbd {
    background: #1e2b3e; padding: 0.1rem 0.5rem;
    border-radius: 0.35rem; border: 1px solid #4b6588;
    font-family: monospace; color: #8fd9ff;
    font-size: 0.85em;
}

/* Upgrade shop */
.upgrade-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.6rem;
    width: 100%; max-width: 860px;
}
.upgrade-card {
    background: linear-gradient(155deg, #121a2b, #0a0f18);
    border: 2px solid #3a5a7a;
    border-radius: 1rem;
    padding: 0.65rem 0.6rem 0.55rem;
    display: flex; flex-direction: column; align-items: center;
    position: relative; transition: all 0.2s;
    box-shadow: 0 0 20px #1e90ff22, inset 0 1px 0 #ffffff0a;
    min-height: 165px;
}
.upgrade-card.maxed { border-color: #ffcc44; box-shadow: 0 0 30px #ffaa0044; }
.upgrade-card:hover:not(.maxed) {
    border-color: #5f8ec9; transform: translateY(-2px);
    box-shadow: 0 0 30px #4ac7ff33;
}
.upgrade-card .uc-icon {
    font-size: 1.7rem; filter: drop-shadow(0 0 10px #4ac7ff);
    margin-bottom: 0.2rem;
}
.upgrade-card.maxed .uc-icon { filter: drop-shadow(0 0 10px #ffcc44); }
.upgrade-card .uc-name {
    font-size: 0.78rem; color: #eef4ff; font-weight: bold;
    letter-spacing: 0.5px; text-align: center; margin-bottom: 0.1rem;
}
.upgrade-card .uc-desc {
    font-size: 0.6rem; color: #7a9bc4;
    text-align: center; margin-bottom: 0.35rem; line-height: 1.3;
    min-height: 22px;
}
.uc-pips { display: flex; gap: 3px; margin-bottom: 0.4rem; flex-wrap: wrap; justify-content: center; }
.uc-pip {
    width: 11px; height: 6px; border-radius: 2px;
    background: #1e2b3e; border: 1px solid #3a5a7a;
}
.uc-pip.filled {
    background: linear-gradient(90deg, #4ac780, #7ae0ff);
    box-shadow: 0 0 6px #4ac7ff; border-color: #4ac7ff;
}
.upgrade-card.maxed .uc-pip.filled {
    background: linear-gradient(90deg, #ffaa00, #ffcc44);
    box-shadow: 0 0 6px #ffcc44; border-color: #ffcc44;
}
.uc-buy {
    width: 100%;
    background: linear-gradient(145deg, #2a5a3a, #1a3a25);
    border: 2px solid #4ac780; color: #c8ffdd;
    font-weight: bold; font-size: 0.72rem; padding: 0.35rem 0.3rem;
    border-radius: 1.6rem; cursor: pointer;
    letter-spacing: 0.3px; font-family: inherit;
    box-shadow: 0 4px 0 #0a1a10; transition: all 0.1s;
    display: flex; align-items: center; justify-content: center; gap: 0.25rem;
}
.uc-buy:active:not(:disabled) { transform: translateY(3px); box-shadow: 0 1px 0 #0a1a10; }
.uc-buy:disabled {
    opacity: 0.45; cursor: not-allowed;
    background: linear-gradient(145deg, #2a2a3a, #1a1a25);
    border-color: #555; color: #888;
}
.uc-buy.maxed {
    background: linear-gradient(145deg, #5a4a1a, #3a3010);
    border-color: #ffcc44; color: #ffe9a8;
}
.uc-lvl-badge {
    position: absolute; top: 6px; right: 6px;
    background: #0a0f18cc;
    border: 1px solid #4ac7ff; color: #7ae0ff;
    font-size: 0.55rem; font-family: monospace; font-weight: bold;
    padding: 0.1rem 0.35rem; border-radius: 0.7rem;
}
.upgrade-card.maxed .uc-lvl-badge { border-color: #ffcc44; color: #ffcc44; }
.shop-footer { display: flex; justify-content: center; gap: 0.6rem; margin-top: 0.8rem; }

/* ---------- BANNERS ---------- */
.wave-banner {
    position: absolute; top: 30%; left: 50%;
    transform: translate(-50%, -50%);
    font-size: 2.6rem; font-weight: 900;
    color: #ffd966;
    text-shadow: 0 0 40px #ffb347, 0 0 15px #ff8800, 0 4px 0 #4a2800;
    letter-spacing: 8px; z-index: 6;
    pointer-events: none; opacity: 0;
    transition: opacity 0.4s; white-space: nowrap;
}
.wave-banner.show { opacity: 1; }
.wave-clear-banner {
    position: absolute; top: 40%; left: 50%;
    transform: translate(-50%, -50%);
    font-size: 1.8rem; font-weight: 900;
    color: #4ac7ff;
    text-shadow: 0 0 30px #4ac7ff, 0 0 15px #1e90ff, 0 3px 0 #003366;
    letter-spacing: 5px; z-index: 6;
    pointer-events: none; opacity: 0;
    transition: opacity 0.4s; white-space: nowrap;
}
.wave-clear-banner.show { opacity: 1; }
.powerup-toast {
    position: absolute; top: 16%; left: 50%;
    transform: translate(-50%, -50%);
    font-size: 1.2rem; font-weight: 900;
    z-index: 7; pointer-events: none; opacity: 0;
    transition: opacity 0.35s, transform 0.35s;
    white-space: nowrap; letter-spacing: 3px;
    text-transform: uppercase;
}
.powerup-toast.show { opacity: 1; transform: translate(-50%, -70%); }

.pause-icon {
    position: absolute; top: 14px; right: 18px;
    font-size: 1.6rem; color: #ffd966;
    text-shadow: 0 0 20px #ffb347;
    z-index: 5; cursor: pointer;
    opacity: 0; pointer-events: none; transition: opacity 0.3s;
}
.pause-icon.show { opacity: 1; pointer-events: all; }

.hp-bar {
    position: absolute; top: 12px; left: 50%;
    transform: translateX(-50%);
    width: 300px; height: 18px;
    background: #0a0f18;
    border: 2px solid #4b6588;
    border-radius: 12px; overflow: hidden;
    box-shadow: 0 0 20px #1e90ff55, inset 0 2px 5px #000;
    z-index: 5; opacity: 0; transition: opacity 0.3s;
}
.hp-bar.show { opacity: 1; }
.hp-fill {
    height: 100%; width: 100%;
    background: linear-gradient(90deg, #4ac780, #7ae0ff, #4ac780);
    transition: width 0.2s; box-shadow: 0 0 15px #4ac7ff;
}
.hp-fill.low { background: linear-gradient(90deg, #ff5e5e, #ffaa33, #ff5e5e); }
.hp-text {
    position: absolute; top: 0; left: 0;
    width: 100%; height: 100%;
    display: flex; justify-content: center; align-items: center;
    font-size: 0.72rem; font-weight: bold; color: white;
    text-shadow: 0 1px 3px black; letter-spacing: 1.5px;
    font-family: monospace;
}

.game-over-msg {
    font-size: 2.4rem; font-weight: 900; color: #ff5e5e;
    text-shadow: 0 0 30px #ff0000, 0 4px 0 #4a0000;
    letter-spacing: 6px; margin-bottom: 0.8rem; text-align: center;
}
.btn-row { display: flex; gap: 0.6rem; flex-wrap: wrap; justify-content: center; }

/* ---------- INFO / PAGE CONTENT ---------- */
.info-content, .page-content {
    max-width: 800px;
    margin: 2rem auto;
    padding: 2rem;
    background: linear-gradient(145deg, #0d1421, #080c14);
    border: 1px solid #1e3040;
    border-radius: 1.5rem;
    box-shadow: 0 20px 40px #00000066;
}
.page-content h1 {
    font-size: 2.2rem; color: #ffd966;
    letter-spacing: 3px; margin-bottom: 1rem;
    text-shadow: 0 0 30px #ffb34766;
}
.page-content h2 {
    font-size: 1.3rem; color: #7ae0ff;
    margin-top: 1.8rem; margin-bottom: 0.6rem;
    letter-spacing: 1.5px;
    text-shadow: 0 0 15px #4ac7ff55;
}
.page-content h3 {
    font-size: 1.05rem; color: #a8e8ff;
    margin-top: 1.2rem; margin-bottom: 0.4rem;
}
.info-content h2 {
    font-size: 1.4rem; color: #7ae0ff;
    letter-spacing: 2px; margin-bottom: 0.8rem;
    text-shadow: 0 0 15px #4ac7ff55;
}
.info-content h3 {
    font-size: 1.05rem; color: #a8e8ff;
    margin: 1.2rem 0 0.5rem;
}
.page-content p, .info-content p {
    color: #b0c4dd; margin-bottom: 0.9rem;
}
.page-content ul, .info-content ul {
    margin: 0.7rem 0 1rem 1.5rem;
    color: #b0c4dd;
}
.page-content li, .info-content li {
    margin-bottom: 0.35rem;
}
.page-content a, .info-content a {
    color: #7ae0ff; text-decoration: none;
    border-bottom: 1px dashed #7ae0ff88;
    transition: all 0.2s;
}
.page-content a:hover, .info-content a:hover {
    color: #a8e8ff; border-bottom-color: #a8e8ff;
}
.page-content code {
    background: #0a0f18; padding: 0.1rem 0.4rem;
    border-radius: 0.3rem; font-family: monospace;
    color: #ffcc66; font-size: 0.9em;
}
.muted { color: #6a7f9a !important; font-size: 0.85rem; font-style: italic; }

/* ---------- FOOTER ---------- */
.site-footer {
    background: linear-gradient(180deg, #060a12, #0b1220);
    border-top: 1px solid #1e3040;
    margin-top: 3rem;
    padding: 2rem 1.5rem 1rem;
}
.footer-inner {
    max-width: 1200px; margin: 0 auto;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid #1e3040;
}
.footer-col h4 {
    color: #7ae0ff; font-size: 0.95rem;
    letter-spacing: 2px; margin-bottom: 0.7rem;
    text-shadow: 0 0 10px #4ac7ff55;
}
.footer-col p, .footer-col a {
    color: #7a9bc4; font-size: 0.85rem;
    text-decoration: none; display: block;
    margin-bottom: 0.35rem;
    transition: color 0.2s;
}
.footer-col a:hover { color: #7ae0ff; }
.footer-bottom {
    max-width: 1200px; margin: 1rem auto 0;
    text-align: center;
    color: #4a5f78; font-size: 0.8rem;
}

/* ---------- RESPONSIVE ---------- */
@media (max-width: 900px) {
    .upgrade-grid { grid-template-columns: repeat(2, 1fr); }
    .hero h1 { font-size: 2.2rem; }
    .overlay-title { font-size: 2rem; }
}
@media (max-width: 640px) {
    .header-inner { padding: 0.7rem 1rem; }
    .logo { font-size: 1.1rem; }
    .nav a { font-size: 0.75rem; padding: 0.4rem 0.7rem; }
    .hero h1 { font-size: 1.7rem; letter-spacing: 2px; }
    .tagline { font-size: 0.8rem; }
    .upgrade-grid { grid-template-columns: 1fr 1fr; gap: 0.5rem; }
    .upgrade-card { min-height: 150px; padding: 0.5rem; }
    .overlay-title { font-size: 1.6rem; }
    .hp-bar { width: 200px; }
    .page-content, .info-content { padding: 1.3rem; margin: 1rem auto; }
    .page-content h1 { font-size: 1.6rem; }
    .page-content h2 { font-size: 1.1rem; }
    .footer-inner { grid-template-columns: 1fr; gap: 1.2rem; }
}