@import url('https://fonts.googleapis.com/css2?family=Chakra+Petch:wght@400;600;700&display=swap');

:root { color-scheme: dark; font-family: 'Chakra Petch', system-ui, sans-serif; }
* { box-sizing: border-box; }
body { margin: 0; overflow: hidden; background: #02040b; color: #eafcff; }
#game, canvas { position: fixed; inset: 0; width: 100%; height: 100%; }
#game canvas { touch-action: none; }
.scanlines { position: fixed; inset: 0; pointer-events: none; opacity: .13; background: repeating-linear-gradient(0deg, transparent 0 3px, #00121c 4px); }
.hud { position: fixed; inset: 0 0 auto; display: grid; grid-template-columns: 1fr auto 1fr; align-items: start; gap: 36px; padding: 22px 30px; pointer-events: none; background: linear-gradient(#020711c9, transparent); }
.brand { font-weight: 700; letter-spacing: .18em; font-size: 19px; }
.brand span, h1 span { color: #45e5ff; }
.stats { display: flex; gap: 42px; text-align: center; }
.stats div { min-width: 76px; }
small, label { display: block; color: #7592a1; font-size: 10px; letter-spacing: .16em; }
strong { font-size: 18px; letter-spacing: .08em; }
.systems { justify-self: end; width: 220px; }
.systems label { display: flex; justify-content: space-between; margin-bottom: 4px; }
.systems label span { color: #ffbd5a; font-size: 15px; font-weight: 700; letter-spacing: .08em; text-shadow: 0 0 10px #ff8a3d; }
.powerup-status { position: fixed; top: 92px; right: 30px; color: #d8faff; font-size: 11px; letter-spacing: .1em; text-align: right; text-shadow: 0 0 10px #29dfff; }
.bar { height: 7px; border: 1px solid #355465; background: #07121d; margin-bottom: 10px; transform: skewX(-12deg); }
.bar i { display: block; height: 100%; width: 100%; background: linear-gradient(90deg, #16afc9, #6effef); box-shadow: 0 0 12px #38e4ff; transition: width .2s; }
.overlay { position: fixed; inset: 0; z-index: 5; display: grid; place-items: center; background: radial-gradient(circle at 50% 40%, #092439b8, #01030aeF 68%); }
.panel { width: min(610px, calc(100vw - 40px)); padding: 46px; border: 1px solid #2b6679; background: linear-gradient(135deg, #071522ed, #02060ded); box-shadow: 0 0 60px #0099cc2e, inset 0 0 40px #00789a14; clip-path: polygon(24px 0, 100% 0, 100% calc(100% - 24px), calc(100% - 24px) 100%, 0 100%, 0 24px); }
.panel.compact { text-align: center; max-width: 480px; }
.eyebrow { color: #53dff5 !important; letter-spacing: .22em; font-size: 11px; }
h1 { margin: 10px 0 16px; font-size: clamp(54px, 10vw, 96px); line-height: .73; letter-spacing: -.04em; }
h2 { font-size: 40px; margin: 12px 0; }
.panel > p { color: #99afba; line-height: 1.6; }
.controls { display: grid; gap: 8px; margin: 28px 0; color: #8197a2; font-size: 13px; }
.controls b { display: inline-block; color: white; min-width: 150px; letter-spacing: .08em; }
.difficulty-choice { display: flex; justify-content: center; align-items: center; margin: 0 0 20px; color: #7592a1; }
.difficulty-buttons { display: flex; gap: 6px; }
.difficulty-button { padding: 8px 10px; border-color: #377489; background: #061722; color: #9bbbc4; font-size: 10px; box-shadow: none; }
.difficulty-button.selected { border-color: #53e5ff; background: #0a7894; color: white; box-shadow: 0 0 12px #18cbea55; }
button { border: 1px solid #53e5ff; background: #0aa5c7; color: white; padding: 14px 24px; font: 700 13px inherit; letter-spacing: .14em; cursor: pointer; box-shadow: 0 0 22px #18cbea55; }
button:hover { background: #21c5e8; }
.menu-actions { display: flex; flex-wrap: nowrap; justify-content: center; gap: 9px; }
.menu-actions button { padding: 10px 14px; font-size: 11px; }
.button-secondary { background: #092230; border-color: #377489; color: #bcecf5; }
.button-secondary:hover { background: #12394b; }
.hangar-panel { width: min(1180px, calc(100vw - 28px)); max-height: calc(100vh - 28px); overflow: auto; padding: 26px; border: 1px solid #2b6679; background: linear-gradient(135deg, #071522f5, #02060df5); box-shadow: 0 0 60px #0099cc2e, inset 0 0 40px #00789a14; clip-path: polygon(24px 0, 100% 0, 100% calc(100% - 24px), calc(100% - 24px) 100%, 0 100%, 0 24px); }
.hangar-heading { display: flex; align-items: start; justify-content: space-between; gap: 20px; }
.hangar-heading h2 { margin: 6px 0 0; }
.hangar-intro { margin: 4px 0 14px; color: #99afba; }
.hangar-stage { height: min(43vh, 390px); min-height: 240px; border: 1px solid #214b5c; background: radial-gradient(circle at 50% 48%, #0b3044, #020811 72%); overflow: hidden; }
.hangar-stage canvas { position: static; display: block; width: 100%; height: 100%; }
.hangar-navigation { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-top: 12px; }
.hangar-navigation strong { color: #bcecf5; font-size: 13px; letter-spacing: .1em; text-align: center; }
.ship-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-top: 14px; }
.ship-card { padding: 12px; border: 1px solid #214b5c; background: #06121caa; }
.ship-card strong { display: block; color: #eafcff; font-size: 14px; }
.ship-card small { margin-top: 5px; color: #52d9ef; }
.ship-card p { margin: 7px 0 0; color: #829aa6; font-size: 12px; line-height: 1.35; }
.sector-panel { width: min(720px, calc(100vw - 28px)); max-height: calc(100vh - 28px); overflow: auto; padding: 28px; text-align: center; border: 1px solid #2b6679; background: linear-gradient(135deg, #071522f5, #02060df5); box-shadow: 0 0 60px #0099cc2e, inset 0 0 40px #00789a14; clip-path: polygon(24px 0, 100% 0, 100% calc(100% - 24px), calc(100% - 24px) 100%, 0 100%, 0 24px); }
.sector-panel h2 { margin: 5px 0 0; color: #eafcff; }
.sector-preview { height: min(35vh, 280px); min-height: 180px; margin: 10px 0; border: 1px solid #214b5c; background: radial-gradient(circle, #0b3044, #020811 72%); overflow: hidden; }
.sector-preview canvas { position: static; display: block; width: 100%; height: 100%; }
.sector-stats { display: flex; justify-content: center; gap: 34px; margin: 10px 0 18px; color: #7592a1; font-size: 11px; letter-spacing: .14em; }
.sector-stats strong { display: block; color: #eafcff; margin-top: 4px; }
.sector-shop { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; margin-bottom: 18px; }
.sector-shop button { padding: 12px 10px; font-size: 11px; }
.sector-shop small { display: block; margin-top: 4px; color: #ffcf70; font-size: 10px; }
.sector-message { min-height: 16px; margin: 0 0 12px; color: #ffcf70; font-size: 11px; letter-spacing: .1em; }
.credits-panel { width: 100vw; height: 100vh; padding: 24px; border: 0; background: transparent; box-shadow: none; clip-path: none; display: flex; flex-direction: column; }
.credits-heading { display: flex; align-items: start; justify-content: space-between; gap: 20px; }
.credits-heading h2 { margin: 6px 0 0; }
.credits-stage { flex: 1; min-height: 0; margin-top: 12px; border: 0; background: radial-gradient(circle at 50% 55%, #0b3044, #020811 72%); overflow: hidden; }
.credits-stage canvas { position: static; display: block; width: 100%; height: 100%; }
.message { position: fixed; top: 23%; left: 50%; transform: translate(-50%, -50%); color: white; font-size: clamp(24px, 4vw, 42px); font-weight: 700; letter-spacing: .18em; text-align: center; opacity: 0; text-shadow: 0 0 22px #4be7ff; transition: opacity .3s; pointer-events: none; }
.message.show { opacity: 1; }
.hidden { display: none !important; }
@media (max-width: 700px) { .hud { grid-template-columns: 1fr 1fr; padding: 14px; }.brand { display:none }.stats { gap: 12px; justify-content: start }.systems { width: 150px }.powerup-status { top: 82px; right: 14px; max-width: 55vw; font-size: 9px; }.stats div:nth-child(2) { display:none }.panel { padding: 30px }.controls b { min-width: 120px } }
@media (max-width: 700px) { .hangar-panel { padding: 16px; }.hangar-stage { height: 310px; }.ship-grid { grid-template-columns: repeat(2, 1fr); }.menu-actions { flex-wrap: wrap; }.menu-actions button { flex: 0 1 auto; } }
@media (max-width: 700px) { .hangar-navigation button { padding: 11px 12px; font-size: 10px; }.hangar-navigation strong { font-size: 10px; } }
@media (max-width: 700px) { .sector-panel { padding: 18px; }.sector-shop { grid-template-columns: 1fr; }.sector-stats { gap: 18px; } }
@media (max-width: 700px) { .difficulty-choice { display: block; }.difficulty-buttons { margin-top: 8px; }.difficulty-button { flex: 1; } }
@media (max-width: 700px) { .credits-panel { padding: 16px; }.credits-stage { min-height: 0; } }
@media (orientation: landscape) {
  .hud { display: block; padding: 16px 24px; }
  .brand { position: fixed; top: 16px; left: 24px; display: block; }
  .systems { position: fixed; top: 16px; right: 24px; width: 220px; }
  .stats { position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%); gap: 38px; padding: 8px 22px; background: #020711b8; border: 1px solid #294b5a; }
  .stats div:nth-child(2) { display: block; }
  .powerup-status { top: 88px; right: 24px; }
}
@media (max-width: 700px) {
  .hud { display: block; padding: 12px 14px; }
  .brand { position: fixed; top: 12px; left: 14px; display: block; font-size: 14px; }
  .systems { position: fixed; top: 12px; right: 14px; width: 150px; }
  .stats { position: fixed; bottom: 12px; left: 50%; transform: translateX(-50%); display: flex; gap: 12px; padding: 6px 10px; background: #020711c7; border: 1px solid #294b5a; }
  .stats div:nth-child(2) { display: block; }
  .stats div { min-width: 62px; }
  .stats strong { font-size: 14px; }
  .powerup-status { top: 72px; right: 14px; max-width: 58vw; }
}
