[hidden] { display: none !important; }
*, *::before, *::after { box-sizing: border-box; }

:root {
    --bg: #0b0f14;
    --panel: rgba(10, 16, 24, 0.86);
    --line: rgba(120, 200, 255, 0.28);
    --cyan: #3fd0ff;
    --amber: #ffb43f;
    --red: #ff4d5a;
    --green: #5be38a;
    --text: #e6f1fa;
}

html, body { margin: 0; height: 100%; overflow: hidden; background: var(--bg); color: var(--text); }
body { font-family: 'Rajdhani', 'Segoe UI', sans-serif; font-size: 17px; user-select: none; -webkit-user-select: none; touch-action: none; }
canvas#game { position: fixed; inset: 0; width: 100%; height: 100%; display: block; }
button { font: inherit; cursor: pointer; }
kbd { display: inline-block; min-width: 1.6em; padding: 0 5px; margin: 0 1px; border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 4px; background: rgba(255, 255, 255, 0.06); font-family: inherit; font-size: 0.9em; text-align: center; }

/* ---------- Screens ---------- */
.screen { position: fixed; inset: 0; z-index: 30; display: flex; align-items: center; justify-content: center; padding: 16px; overflow-y: auto; }
.screen.dim { background: rgba(0, 0, 0, 0.55); }
.card {
    width: min(520px, 100%); max-height: 100%; overflow-y: auto;
    background: var(--panel); border: 1px solid var(--line); border-radius: 14px;
    padding: 22px 24px; box-shadow: 0 0 40px rgba(63, 208, 255, 0.15), 0 20px 60px rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(6px);
}
.card.wide { width: min(860px, 100%); }
h1, h2, h3 { font-family: 'Orbitron', sans-serif; margin: 0; letter-spacing: 0.06em; }
h1 { font-size: clamp(2em, 7vw, 3.4em); line-height: 1.05; text-align: center; color: var(--cyan); text-shadow: 0 0 18px rgba(63, 208, 255, 0.6); }
h1 span { color: var(--amber); text-shadow: 0 0 18px rgba(255, 180, 63, 0.55); }
h2 { font-size: 1.6em; color: var(--cyan); margin-bottom: 10px; }
h3 { font-size: 1em; color: var(--amber); margin: 16px 0 8px; }
.tag { text-align: center; opacity: 0.85; margin: 10px 0 18px; }
.small { font-size: 0.85em; opacity: 0.75; }
.eyebrow { font-family: 'Orbitron', sans-serif; font-size: 0.75em; letter-spacing: 0.2em; color: var(--amber); margin-bottom: 4px; }
.menu { display: flex; flex-direction: column; gap: 10px; max-width: 320px; margin: 0 auto; }
.row { display: flex; flex-wrap: wrap; gap: 10px; justify-content: flex-end; margin-top: 18px; }
.btn {
    display: block; text-align: center; text-decoration: none; color: var(--text);
    padding: 11px 18px; border-radius: 8px; border: 1px solid var(--line);
    background: rgba(63, 208, 255, 0.08); font-family: 'Orbitron', sans-serif; font-size: 0.85em; letter-spacing: 0.08em;
    transition: background 0.15s, border-color 0.15s, transform 0.1s;
}
.btn:hover { background: rgba(63, 208, 255, 0.2); border-color: var(--cyan); }
.btn:active { transform: scale(0.98); }
.btn.primary { background: linear-gradient(180deg, #1aa6dc, #0b6f99); border-color: var(--cyan); }
.btn.primary:hover { background: linear-gradient(180deg, #2bbcf3, #1185b6); }
.btn.ghost { background: transparent; }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }
.radio-text { border-left: 3px solid var(--amber); padding: 6px 12px; background: rgba(255, 180, 63, 0.07); font-size: 1.05em; line-height: 1.4; }
.brief-facts { list-style: none; padding: 0; margin: 12px 0 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 8px; }
.brief-facts li { background: rgba(255, 255, 255, 0.04); border: 1px solid var(--line); border-radius: 8px; padding: 6px 10px; }
.brief-facts li b { display: block; font-family: 'Orbitron', sans-serif; font-size: 0.7em; letter-spacing: 0.12em; color: var(--cyan); }

/* Sector list */
.sector-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 10px; }
.sector {
    text-align: left; padding: 12px 14px; border-radius: 10px; border: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.03); color: var(--text);
}
.sector:hover:not(:disabled) { border-color: var(--cyan); background: rgba(63, 208, 255, 0.1); }
.sector .num { font-family: 'Orbitron', sans-serif; font-size: 0.7em; letter-spacing: 0.18em; color: var(--amber); }
.sector .name { font-family: 'Orbitron', sans-serif; font-size: 1.05em; margin: 2px 0; }
.sector .obj { font-size: 0.9em; opacity: 0.85; }
.sector .best { font-size: 0.85em; color: var(--green); margin-top: 4px; }
.sector:disabled { opacity: 0.35; cursor: not-allowed; }

/* Garage */
.credits { font-size: 1.1em; margin: 0; } .credits b { color: var(--amber); font-family: 'Orbitron', sans-serif; }
.loadout { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 8px; }
.gadget-card { text-align: left; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line); background: rgba(255, 255, 255, 0.03); color: var(--text); }
.gadget-card.on { border-color: var(--green); background: rgba(91, 227, 138, 0.1); }
.gadget-card .gname { font-family: 'Orbitron', sans-serif; font-size: 0.9em; }
.gadget-card .gdesc { font-size: 0.85em; opacity: 0.8; }
.gadget-card .gkey { float: right; color: var(--green); font-family: 'Orbitron', sans-serif; font-size: 0.8em; }
.upgrades { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 8px; }
.upgrade { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; background: rgba(255, 255, 255, 0.03); }
.upgrade .uinfo { flex: 1; min-width: 0; }
.upgrade .uname { font-family: 'Orbitron', sans-serif; font-size: 0.85em; }
.upgrade .udesc { font-size: 0.82em; opacity: 0.75; }
.upgrade .pips { display: flex; gap: 3px; margin-top: 4px; }
.upgrade .pips i { width: 14px; height: 5px; border-radius: 2px; background: rgba(255, 255, 255, 0.15); }
.upgrade .pips i.on { background: var(--cyan); box-shadow: 0 0 6px var(--cyan); }
.upgrade .btn { padding: 7px 10px; font-size: 0.72em; white-space: nowrap; }
.help-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 4px 18px; }
.help-grid p { margin: 0 0 6px; line-height: 1.45; }

/* ---------- HUD ---------- */
#hud { position: fixed; inset: 0; z-index: 10; pointer-events: none; }
.hud-top { display: flex; align-items: flex-start; gap: 12px; padding: 10px 12px; }
.hud-block { min-width: 110px; text-shadow: 0 0 6px #000; }
.hud-block.right { margin-left: auto; text-align: right; display: flex; gap: 6px; justify-content: flex-end; pointer-events: auto; }
.label { font-family: 'Orbitron', sans-serif; font-size: 0.62em; letter-spacing: 0.2em; color: var(--cyan); }
.value { font-family: 'Orbitron', sans-serif; font-size: 1.5em; font-weight: 800; }
.mult { font-family: 'Orbitron', sans-serif; color: var(--amber); font-size: 0.9em; min-height: 1.2em; }
.hud-objective { flex: 1; max-width: 460px; margin: 0 auto; text-align: center; }
.objective { font-family: 'Orbitron', sans-serif; font-size: 0.8em; letter-spacing: 0.08em; background: rgba(0, 0, 0, 0.55); border: 1px solid var(--line); border-radius: 8px; padding: 5px 10px; }
.progress { height: 6px; margin-top: 5px; border-radius: 3px; background: rgba(255, 255, 255, 0.15); overflow: hidden; }
.progress div { height: 100%; width: 0; background: linear-gradient(90deg, var(--cyan), var(--green)); }
.icon-button { width: 38px; height: 38px; border-radius: 8px; border: 1px solid var(--line); background: rgba(0, 0, 0, 0.55); color: var(--text); }
.radio {
    position: absolute; top: 74px; left: 50%; transform: translateX(-50%); max-width: min(560px, 92vw);
    background: rgba(0, 0, 0, 0.72); border: 1px solid var(--amber); border-radius: 8px; padding: 6px 12px;
    font-size: 1em; animation: radioIn 0.25s ease-out;
}
.radio b { color: var(--amber); font-family: 'Orbitron', sans-serif; font-size: 0.75em; letter-spacing: 0.12em; margin-right: 6px; }
@keyframes radioIn { from { opacity: 0; transform: translate(-50%, -6px); } }
.center-msg { position: absolute; top: 38%; left: 50%; transform: translate(-50%, -50%); font-family: 'Orbitron', sans-serif; font-size: clamp(1.4em, 5vw, 2.6em); font-weight: 800; color: var(--amber); text-shadow: 0 0 16px rgba(255, 180, 63, 0.7), 0 2px 4px #000; text-align: center; white-space: nowrap; }
.hud-bottom { position: absolute; left: 0; right: 0; bottom: 0; display: flex; align-items: flex-end; gap: 10px; padding: 10px 12px; flex-wrap: wrap; }
.bars { display: flex; flex-direction: column; gap: 4px; min-width: 190px; }
.bar { display: flex; align-items: center; gap: 6px; font-family: 'Orbitron', sans-serif; font-size: 0.58em; letter-spacing: 0.15em; text-shadow: 0 0 4px #000; }
.bar span { width: 64px; }
.bar div { flex: 1; height: 9px; border-radius: 5px; background: rgba(0, 0, 0, 0.6); border: 1px solid rgba(255, 255, 255, 0.15); overflow: hidden; min-width: 110px; }
.bar i { display: block; height: 100%; width: 100%; transition: width 0.1s; }
.bar.armor i { background: linear-gradient(90deg, #ff5a5a, #ffb43f, #5be38a); background-size: 300% 100%; }
.bar.energy i { background: var(--cyan); }
.bar.heat i { background: linear-gradient(90deg, #ffd23f, #ff4d5a); }
.bar.heat.over i { animation: blink 0.3s infinite; }
@keyframes blink { 50% { opacity: 0.3; } }
.slots { display: flex; gap: 6px; margin-left: auto; }
.slot { position: relative; width: 66px; height: 56px; border-radius: 9px; border: 1px solid var(--line); background: rgba(0, 0, 0, 0.6); overflow: hidden; text-align: center; padding-top: 4px; }
.slot b { position: absolute; top: 2px; left: 5px; font-family: 'Orbitron', sans-serif; font-size: 0.62em; color: var(--cyan); }
.slot .name { display: block; margin-top: 12px; font-family: 'Orbitron', sans-serif; font-size: 0.6em; letter-spacing: 0.08em; }
.slot .sub { display: block; font-size: 0.85em; color: var(--amber); }
.slot .cd { position: absolute; left: 0; bottom: 0; width: 100%; height: 0; background: rgba(255, 255, 255, 0.12); }
.slot.ready { border-color: var(--green); box-shadow: 0 0 8px rgba(91, 227, 138, 0.4); }
.slot.empty .sub { color: var(--red); }
.slot.van { margin-left: 0; }
.slot.press { animation: slotPress 0.35s; }
.slot.denied { animation: slotDenied 0.4s; }
@keyframes slotPress { 0% { background: rgba(91,227,138,0.6); transform: scale(1.08); } 100% { background: rgba(0,0,0,0.6); transform: none; } }
@keyframes slotDenied { 0%, 50% { background: rgba(255,77,90,0.6); } 25%, 75% { transform: translateX(-3px); } 100% { background: rgba(0,0,0,0.6); transform: none; } }
.slot.active { border-color: var(--amber); box-shadow: 0 0 10px var(--amber); }
.slot.pulse.ready { border-color: #7fe9ff; box-shadow: 0 0 10px rgba(127, 233, 255, 0.55); }
.slot.pulse.active { border-color: #7fe9ff; box-shadow: 0 0 16px #7fe9ff; }

/* ---------- Touch ---------- */
#touch { position: fixed; inset: 0; z-index: 12; pointer-events: none; }
#stick-zone { position: absolute; left: 0; bottom: 0; width: 50%; height: 62%; pointer-events: auto; }
#stick-base { position: absolute; width: 120px; height: 120px; border-radius: 50%; border: 2px solid rgba(255, 255, 255, 0.25); background: rgba(0, 0, 0, 0.25); left: 30px; bottom: 120px; }
#stick-knob { position: absolute; width: 54px; height: 54px; border-radius: 50%; left: 33px; top: 33px; background: rgba(63, 208, 255, 0.55); border: 2px solid var(--cyan); }
.touch-buttons { position: absolute; right: 10px; bottom: 120px; display: grid; grid-template-columns: repeat(2, 74px); gap: 8px; pointer-events: auto; }
#touch-gadgets { display: contents; }
.tbtn { height: 62px; border-radius: 14px; border: 2px solid var(--line); background: rgba(0, 0, 0, 0.45); color: var(--text); font-family: 'Orbitron', sans-serif; font-size: 0.7em; letter-spacing: 0.05em; touch-action: none; }
.tbtn.fire { border-color: var(--red); background: rgba(255, 77, 90, 0.25); grid-column: span 2; height: 74px; }
.tbtn.boost { border-color: var(--cyan); }
.tbtn.van { border-color: var(--amber); }
.tbtn.down { background: rgba(255, 255, 255, 0.25); }
@media (pointer: coarse) {
    .hud-bottom .slots, .hud-bottom .slot.van { display: none; }
    /* phones: bars in one compact row under the top bar, radio below them */
    .hud-top { padding: 8px 8px 0; gap: 8px; }
    .hud-block { min-width: 64px; }
    .value { font-size: 1.15em; }
    .objective { font-size: 0.66em; padding: 4px 6px; }
    .hud-bottom { bottom: auto; top: 58px; padding: 4px 8px; }
    .bars { flex-direction: row; gap: 8px; width: 100%; min-width: 0; }
    .bar { flex: 1; flex-direction: column; align-items: stretch; gap: 2px; font-size: 0.5em; }
    .bar span { width: auto; }
    .bar div { flex: none; min-width: 0; height: 7px; }
    .radio { top: 96px; font-size: 0.85em; padding: 5px 9px; }
    .center-msg { font-size: 1.3em; white-space: normal; width: 90vw; }
}
#hud .value, #hud .label, #hud .mult { text-shadow: 0 1px 3px rgba(0, 0, 0, 0.85); }
.lives { font-size: 1.35em; letter-spacing: 0.15em; color: #ff4d5a; text-shadow: 0 0 6px rgba(255, 60, 70, 0.7), 0 0 2px #000; line-height: 1; min-height: 1em; }
.lives.low { animation: livesPulse 0.8s ease-in-out infinite; }
@keyframes livesPulse { 50% { opacity: 0.45; } }

/* How to Play: tabs */
.help-tabs { display: flex; gap: 6px; flex-wrap: wrap; margin: 4px 0 14px; }
.help-tabs button { flex: 1; min-width: 120px; padding: 8px 10px; border-radius: 8px; border: 1px solid var(--line); background: rgba(255, 255, 255, 0.04); color: var(--text); font-family: 'Orbitron', sans-serif; font-size: 0.72em; letter-spacing: 0.08em; }
.help-tabs button:hover { border-color: var(--cyan); }
.help-tabs button.on { background: rgba(63, 208, 255, 0.16); border-color: var(--cyan); color: #fff; box-shadow: 0 0 12px rgba(63, 208, 255, 0.3); }
.help-pane { display: none; min-height: 330px; animation: paneIn 0.2s ease-out; }
.help-pane.on { display: block; }
@keyframes paneIn { from { opacity: 0; transform: translateY(4px); } }
.keys { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(330px, 1fr)); gap: 6px 18px; }
.keys li { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 6px 10px; border-radius: 8px; background: rgba(255, 255, 255, 0.035); }
.keys li > span:first-child { font-weight: 700; } .keys small { color: #8fa6b8; font-weight: 500; }
.keys li > span:last-child { color: #9fb4c4; white-space: nowrap; }
.tip { margin: 12px 0 0; line-height: 1.45; color: #c7d6e2; } .tip.small { font-size: 0.9em; color: #92a7b8; }
.weapons-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 10px; }
.wcard { position: relative; padding: 10px 12px 10px 56px; border: 1px solid var(--line); border-radius: 10px; background: linear-gradient(135deg, rgba(63, 208, 255, 0.07), rgba(255, 255, 255, 0.02)); min-height: 66px; }
.wcard i, .van-tip i, .tips-grid i { font-style: normal; }
.wcard i { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); font-size: 1.8em; filter: drop-shadow(0 0 6px rgba(63, 208, 255, 0.4)); }
.wcard b { display: block; font-family: 'Orbitron', sans-serif; font-size: 0.78em; letter-spacing: 0.06em; color: var(--amber); margin-bottom: 2px; }
.wcard p { margin: 0; line-height: 1.35; font-size: 0.95em; }
.van-tip { display: flex; gap: 12px; align-items: center; margin-top: 12px; padding: 10px 14px; border-radius: 10px; border: 1px solid rgba(255, 180, 63, 0.45); background: rgba(255, 180, 63, 0.08); }
.van-tip i { font-size: 2em; } .van-tip p { margin: 0; line-height: 1.4; } .van-tip b { color: var(--amber); }
.timeline { list-style: none; margin: 0; padding: 0 0 0 14px; position: relative; }
.timeline::before { content: ''; position: absolute; left: 62px; top: 8px; bottom: 8px; width: 2px; background: linear-gradient(var(--cyan), var(--amber), #e9f3fb); opacity: 0.6; }
.timeline li { display: grid; grid-template-columns: 52px 140px 1fr; align-items: baseline; gap: 6px 22px; padding: 5px 0; position: relative; }
.timeline li::before { content: ''; position: absolute; left: 44px; top: 11px; width: 10px; height: 10px; border-radius: 50%; background: var(--panel); border: 2px solid var(--cyan); box-shadow: 0 0 8px rgba(63, 208, 255, 0.6); }
.timeline time { font-family: 'Orbitron', sans-serif; font-size: 0.75em; color: var(--cyan); }
.timeline li > b { font-family: 'Orbitron', sans-serif; font-size: 0.8em; letter-spacing: 0.05em; color: var(--amber); }
.timeline span { color: #c7d6e2; line-height: 1.35; } .timeline span b { color: #fff; }
.tips-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 10px; }
.tips-grid > div { padding: 10px 12px; border-radius: 10px; background: rgba(255, 255, 255, 0.035); border: 1px solid rgba(120, 200, 255, 0.14); }
.tips-grid i { font-size: 1.25em; margin-right: 6px; color: var(--red); } .tips-grid i.red { text-shadow: 0 0 8px var(--red); }
.tips-grid b { font-family: 'Orbitron', sans-serif; font-size: 0.78em; letter-spacing: 0.06em; color: var(--amber); }
.tips-grid p { margin: 4px 0 0; line-height: 1.35; font-size: 0.95em; }
@media (max-width: 600px) {
    .keys { grid-template-columns: 1fr; }
    .timeline::before { left: 50px; }
    .timeline li { grid-template-columns: 40px 1fr; } .timeline li::before { left: 32px; }
    .timeline span { grid-column: 2; }
    .help-tabs button { min-width: 0; font-size: 0.62em; padding: 8px 4px; }
}
.heart { color: var(--red); text-shadow: 0 0 6px rgba(255, 60, 70, 0.7); }
.slot.flare.ready { border-color: #ffb43f; box-shadow: 0 0 10px rgba(255, 180, 63, 0.5); }
.slot.bomb.ready { border-color: #ff6a3a; box-shadow: 0 0 10px rgba(255, 106, 58, 0.5); }
.boss-bar { position: absolute; top: 64px; left: 50%; transform: translateX(-50%); width: min(560px, 80vw); text-align: center; pointer-events: none; }
.boss-bar span { display: block; font-family: 'Orbitron', sans-serif; font-weight: 800; font-size: 0.8em; letter-spacing: 0.25em; color: #ff5a5a; text-shadow: 0 0 10px rgba(255, 60, 60, 0.8), 0 1px 2px #000; margin-bottom: 4px; }
.boss-bar div { height: 12px; border-radius: 6px; background: rgba(0, 0, 0, 0.65); border: 1px solid rgba(255, 80, 80, 0.7); overflow: hidden; box-shadow: 0 0 14px rgba(255, 50, 50, 0.4); }
.boss-bar i { display: block; height: 100%; width: 100%; background: linear-gradient(90deg, #8a0f12, #ff3b3b, #ffb43f); transition: width 0.15s; }

/* Saved games */
.saves-current { display: flex; flex-direction: column; gap: 2px; padding: 10px 14px; border-radius: 10px; border: 1px solid var(--cyan); background: rgba(63, 208, 255, 0.08); margin: 6px 0 10px; }
.saves-current b { font-family: 'Orbitron', sans-serif; font-size: 0.8em; letter-spacing: 0.06em; color: var(--cyan); }
.saves-current span { color: #c7d6e2; }
.row.left { justify-content: flex-start; flex-wrap: wrap; }
.saves-msg { min-height: 1.2em; margin: 6px 0; color: var(--green); }
.save-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; max-height: 46vh; overflow-y: auto; }
.save-list li { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line); background: rgba(255, 255, 255, 0.035); }
.save-list li.empty { color: #92a7b8; justify-content: center; }
.save-list .sinfo { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.save-list .sinfo b { font-family: 'Orbitron', sans-serif; font-size: 0.85em; color: var(--amber); }
.save-list .sinfo span { color: #c7d6e2; font-size: 0.95em; }
.save-list .sinfo small { color: #8fa6b8; }
.save-list .sbtns { display: flex; gap: 6px; flex-wrap: wrap; }
.save-list .sbtns .btn { padding: 6px 12px; font-size: 0.85em; }
.gadget-card.later { border-color: rgba(255, 180, 63, 0.45); background: rgba(255, 180, 63, 0.06); }
.gadget-card.later .gkey { color: var(--amber); }
.pause-note { margin: 10px 0 0; min-height: 1.2em; color: var(--green); text-align: center; }
.btn.continue { border-color: var(--green); background: rgba(91, 227, 138, 0.14); }
.row.spread { justify-content: space-between; flex-wrap: wrap; }
.btn.danger { color: #ff9a9a; border-color: rgba(255, 90, 90, 0.5); }
.btn.danger:hover { background: rgba(255, 77, 90, 0.15); border-color: var(--red); }
