:root {
  color-scheme: dark;
  --ink: #eaf3ff;
  --muted: #899bb8;
  --navy: #061224;
  --panel: rgba(8, 24, 47, 0.86);
  --line: rgba(143, 187, 255, 0.2);
  --cyan: #64e7ff;
  --blue: #4b89ff;
  --violet: #a071ff;
  --pink: #ff6295;
  --lime: #b9ff72;
  --font-display: "Space Grotesk", system-ui, sans-serif;
  --font-mono: "DM Mono", ui-monospace, monospace;
}

* { box-sizing: border-box; }

html { min-width: 320px; background: #030914; }

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
  color: var(--ink);
  background:
    radial-gradient(circle at 12% 2%, rgba(63, 81, 187, 0.3), transparent 31rem),
    radial-gradient(circle at 86% 18%, rgba(119, 54, 177, 0.2), transparent 32rem),
    #030914;
  font-family: var(--font-display);
}

button { font: inherit; }

button:focus-visible, a:focus-visible { outline: 2px solid var(--cyan); outline-offset: 3px; }

.app-shell { width: min(1480px, calc(100% - 48px)); margin: 0 auto; padding: 27px 0 40px; }

.topbar { display: flex; align-items: center; justify-content: space-between; margin: 0 2px 24px; }

.brand { display: inline-flex; align-items: center; gap: 12px; color: var(--ink); text-decoration: none; font-size: 16px; font-weight: 700; letter-spacing: 0.15em; }
.brand b { color: var(--cyan); font-weight: 500; }
.brand-mark { position: relative; display: block; width: 25px; height: 25px; transform: rotate(45deg); }
.brand-mark i { position: absolute; display: block; border: 1px solid var(--cyan); }
.brand-mark i:nth-child(1) { inset: 1px; box-shadow: 0 0 13px rgba(100, 231, 255, 0.65); }
.brand-mark i:nth-child(2) { inset: 6px; border-color: #a071ff; }
.brand-mark i:nth-child(3) { inset: 10px; background: var(--cyan); border: 0; }

.topbar-actions { display: flex; align-items: center; gap: 12px; }
.credit-chip { display: flex; align-items: baseline; gap: 7px; min-height: 39px; padding: 0 13px; border: 1px solid var(--line); border-radius: 4px; background: rgba(9, 24, 48, 0.65); font-family: var(--font-mono); }
.credit-chip .credit-icon { color: var(--lime); text-shadow: 0 0 10px rgba(185, 255, 114, 0.8); font-size: 16px; }
.credit-chip > span:nth-child(2) { color: #f4ffe9; font-size: 14px; }
.credit-chip small { color: var(--muted); font-size: 8px; letter-spacing: 0.1em; }

.outline-button, .text-button, .close-button, .pause-button { cursor: pointer; }
.outline-button { min-height: 39px; padding: 0 14px; border: 1px solid rgba(100, 231, 255, 0.48); border-radius: 4px; color: var(--cyan); background: rgba(10, 37, 65, 0.54); font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.08em; transition: 160ms ease; }
.outline-button:hover { border-color: var(--cyan); background: rgba(35, 90, 130, 0.48); box-shadow: 0 0 20px rgba(79, 202, 255, 0.15); }
.button-icon { font-size: 16px; vertical-align: -1px; }

.game-frame { position: relative; overflow: hidden; width: 100%; aspect-ratio: 16 / 8.55; min-height: 440px; border: 1px solid rgba(125, 180, 255, 0.31); border-radius: 8px; background: #030918; box-shadow: 0 28px 80px rgba(0, 0, 0, 0.38), inset 0 0 90px rgba(24, 55, 110, 0.18); isolation: isolate; }
.game-frame::before, .game-frame::after { position: absolute; z-index: 5; width: 38px; height: 38px; pointer-events: none; content: ""; }
.game-frame::before { top: -1px; left: -1px; border-top: 2px solid var(--cyan); border-left: 2px solid var(--cyan); border-radius: 8px 0 0; }
.game-frame::after { right: -1px; bottom: -1px; border-right: 2px solid #9b75ff; border-bottom: 2px solid #9b75ff; border-radius: 0 0 8px 0; }
#gameCanvas { display: block; width: 100%; height: 100%; cursor: crosshair; }
.scanlines { position: absolute; z-index: 2; inset: 0; pointer-events: none; opacity: 0.26; background: repeating-linear-gradient(to bottom, rgba(160, 207, 255, 0.035) 0, rgba(160, 207, 255, 0.035) 1px, transparent 1px, transparent 4px); mix-blend-mode: screen; }

.game-hud { position: absolute; z-index: 3; top: 0; left: 0; display: grid; grid-template-columns: 1fr 1fr 1fr; width: 100%; padding: 25px 28px; pointer-events: none; }
.hud-column { font-family: var(--font-mono); }
.hud-label, .threat-label, .integrity-header, .shield-line { color: #93a8c9; font-size: 9px; letter-spacing: 0.12em; }
.sector-value { margin-top: 6px; font-size: 13px; letter-spacing: 0.05em; }
.sector-value span { color: var(--cyan); font-size: 20px; font-weight: 500; }
.sector-value em { color: #eaf3ff; font-style: normal; }
.enemy-readout { display: flex; align-items: center; gap: 6px; margin-top: 10px; color: #8fa2bd; font-size: 8px; letter-spacing: 0.06em; }
.readout-dot { width: 5px; height: 5px; background: var(--lime); border-radius: 50%; box-shadow: 0 0 8px var(--lime); }
.hud-center { justify-self: center; width: min(235px, 28vw); padding-top: 4px; text-align: center; }
.threat-label { color: #d1c6ff; }
.threat-track, .health-track, .shield-track { position: relative; overflow: hidden; height: 5px; margin-top: 8px; border: 1px solid rgba(130, 170, 255, 0.24); background: rgba(1, 6, 18, 0.68); }
.threat-fill, .health-fill, .shield-fill { width: 0%; height: 100%; transition: width 180ms linear; }
.threat-fill { background: linear-gradient(90deg, var(--violet), var(--pink)); box-shadow: 0 0 12px var(--pink); }
.hud-right { justify-self: end; width: min(220px, 26vw); }
.integrity-header { display: flex; justify-content: space-between; }
.integrity-header b { color: var(--cyan); font-weight: 400; }
.health-fill { background: linear-gradient(90deg, #47c3ff, #8dffcb); box-shadow: 0 0 10px #63f8cb; }
.shield-line { display: flex; align-items: center; gap: 8px; margin-top: 9px; font-size: 8px; }
.shield-track { flex: 1; height: 3px; margin: 0; }
.shield-fill { background: #a071ff; box-shadow: 0 0 8px #a071ff; }

.intro-panel, .pause-panel, .gameover-panel { position: absolute; z-index: 4; top: 50%; left: 50%; width: min(495px, calc(100% - 44px)); transform: translate(-50%, -47%); text-align: center; }
.intro-panel { padding: 48px 50px 42px; border: 1px solid rgba(146, 189, 255, 0.23); background: linear-gradient(135deg, rgba(5, 15, 34, 0.73), rgba(10, 18, 54, 0.5)); box-shadow: 0 0 70px rgba(61, 77, 207, 0.18); backdrop-filter: blur(5px); clip-path: polygon(0 19px, 19px 0, calc(100% - 19px) 0, 100% 19px, 100% calc(100% - 19px), calc(100% - 19px) 100%, 19px 100%, 0 calc(100% - 19px)); }
.eyebrow { color: var(--cyan); font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.14em; }
.eyebrow.danger { color: var(--pink); }
.intro-panel h1, .pause-panel h2, .gameover-panel h2, .modal-header h2 { margin: 14px 0; font-weight: 700; line-height: 0.89; letter-spacing: -0.055em; }
.intro-panel h1 { font-size: clamp(43px, 5vw, 66px); }
.intro-panel h1 span { color: var(--cyan); text-shadow: 0 0 28px rgba(100, 231, 255, 0.42); }
.intro-panel p, .pause-panel p, .gameover-panel p { max-width: 350px; margin: 19px auto 26px; color: #afc0d8; font-size: 14px; line-height: 1.55; }
.launch-button { min-height: 48px; padding: 0 19px; border: 1px solid #98f2ff; border-radius: 3px; color: #031020; background: linear-gradient(100deg, #a9f6ff, #66d8ff); box-shadow: 0 0 22px rgba(100, 231, 255, 0.22); cursor: pointer; font-family: var(--font-mono); font-size: 12px; font-weight: 500; letter-spacing: 0.1em; transition: 180ms ease; }
.launch-button:hover { transform: translateY(-2px); box-shadow: 0 0 34px rgba(100, 231, 255, 0.45); }
.launch-button span { margin-left: 15px; font-size: 17px; }
.launch-button.compact { min-height: 42px; }
.intro-tip { display: flex; align-items: center; justify-content: center; gap: 6px; margin-top: 25px; color: #8497b6; font-family: var(--font-mono); font-size: 8px; letter-spacing: 0.06em; }
kbd { display: inline-flex; align-items: center; justify-content: center; min-width: 18px; min-height: 18px; padding: 2px 5px; border: 1px solid rgba(157, 194, 255, 0.42); border-radius: 3px; color: #dde9ff; background: rgba(43, 68, 113, 0.44); box-shadow: inset 0 -2px 0 rgba(0, 0, 0, 0.25); font-family: var(--font-mono); font-size: 8px; }
.intro-tip i { display: block; width: 1px; height: 14px; margin: 0 5px; background: rgba(148, 181, 237, 0.42); }

.pause-panel, .gameover-panel { padding: 34px; border: 1px solid rgba(146, 189, 255, 0.28); background: rgba(5, 13, 32, 0.88); box-shadow: 0 0 50px rgba(0, 0, 0, 0.4); }
.pause-panel h2, .gameover-panel h2 { font-size: 38px; }
.gameover-panel h2 { color: #ff759e; text-shadow: 0 0 24px rgba(255, 98, 149, 0.35); }
.gameover-panel strong { color: var(--cyan); font-weight: 500; }
.hidden { display: none !important; }
.pause-button { position: absolute; z-index: 4; right: 26px; bottom: 24px; width: 33px; height: 33px; border: 1px solid rgba(171, 200, 255, 0.4); border-radius: 50%; color: var(--ink); background: rgba(5, 17, 39, 0.62); font-size: 13px; transition: 160ms ease; }
.pause-button:hover { border-color: var(--cyan); color: var(--cyan); }
.status-toast { position: absolute; z-index: 4; bottom: 27px; left: 50%; min-width: 230px; padding: 9px 14px; transform: translate(-50%, 18px); border: 1px solid rgba(121, 229, 255, 0.35); color: #dcfaff; opacity: 0; background: rgba(7, 29, 54, 0.86); box-shadow: 0 0 22px rgba(100, 231, 255, 0.12); font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.06em; text-align: center; transition: 220ms ease; pointer-events: none; }
.status-toast.visible { opacity: 1; transform: translate(-50%, 0); }

.mission-deck { display: grid; grid-template-columns: 1.08fr 1.18fr 0.9fr; gap: 14px; margin-top: 15px; }
.mission-deck article { position: relative; min-height: 150px; padding: 22px 24px; overflow: hidden; border: 1px solid var(--line); border-radius: 5px; background: linear-gradient(135deg, rgba(10, 26, 51, 0.78), rgba(7, 16, 37, 0.75)); }
.card-kicker { color: #8498bb; font-family: var(--font-mono); font-size: 9px; letter-spacing: 0.13em; }
.ship-card { border-left-color: rgba(100, 231, 255, 0.57) !important; }
.card-corner { position: absolute; top: 0; right: 0; width: 38px; height: 38px; border-top: 1px solid rgba(100, 231, 255, 0.48); border-right: 1px solid rgba(100, 231, 255, 0.48); }
.ship-card-line { display: flex; align-items: center; gap: 15px; margin-top: 10px; }
.mini-ship { position: relative; display: inline-block; width: 36px; height: 44px; transform: rotate(180deg); background: linear-gradient(90deg, transparent 42%, #71e7ff 42% 58%, transparent 58%); clip-path: polygon(50% 0, 100% 90%, 70% 77%, 50% 100%, 30% 77%, 0 90%); filter: drop-shadow(0 0 7px rgba(100, 231, 255, 0.75)); }
.ship-card h2, .mission-card h2 { margin: 0; font-size: 19px; letter-spacing: -0.02em; }
.ship-card p, .mission-card p { margin: 2px 0 0; color: #8fa3c0; font-size: 11px; }
.text-button { margin-top: 14px; padding: 0; border: 0; color: var(--cyan); background: transparent; font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.08em; }
.text-button:hover { color: #d8fbff; }
.text-button span { padding-left: 5px; font-size: 14px; }
.mission-card { display: flex; align-items: center; justify-content: space-between; gap: 14px; background: linear-gradient(118deg, rgba(28, 29, 76, 0.76), rgba(16, 29, 68, 0.82)) !important; }
.mission-card h2 { margin-top: 8px; font-size: 22px; }
.mission-card h2 span { color: #a889ff; }
.mission-card p { max-width: 295px; margin-top: 8px; line-height: 1.45; }
.protocol-mark { position: relative; flex: 0 0 63px; width: 63px; height: 63px; border: 1px solid rgba(164, 137, 255, 0.55); border-radius: 50%; transform: rotate(45deg); }
.protocol-mark::after { position: absolute; inset: 17px; border: 1px solid #b492ff; content: ""; }
.protocol-mark i { position: absolute; width: 7px; height: 7px; background: #b492ff; box-shadow: 0 0 9px #a071ff; }
.protocol-mark i:nth-child(1) { top: -4px; left: -4px; }.protocol-mark i:nth-child(2) { top: -4px; right: -4px; }.protocol-mark i:nth-child(3) { bottom: -4px; left: -4px; }.protocol-mark i:nth-child(4) { right: -4px; bottom: -4px; }
.controls-grid { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 15px; margin-top: 16px; }
.controls-grid span { display: flex; align-items: center; gap: 3px; }
.controls-grid small { display: block; margin-left: 4px; color: #8094b4; font-family: var(--font-mono); font-size: 8px; letter-spacing: 0.08em; }

.modal-backdrop { position: fixed; z-index: 20; inset: 0; display: grid; place-items: center; padding: 24px; background: rgba(1, 6, 17, 0.76); backdrop-filter: blur(8px); }
.hangar-modal { width: min(1080px, 100%); max-height: min(790px, calc(100vh - 48px)); overflow: hidden; border: 1px solid rgba(120, 199, 255, 0.42); border-radius: 8px; background: linear-gradient(140deg, #091a35 0%, #071126 100%); box-shadow: 0 25px 100px rgba(0, 0, 0, 0.66), 0 0 52px rgba(69, 130, 255, 0.12); }
.modal-header { display: flex; align-items: center; justify-content: space-between; padding: 27px 32px 20px; border-bottom: 1px solid var(--line); background: radial-gradient(circle at 85% 0%, rgba(92, 75, 196, 0.24), transparent 35%); }
.modal-header h2 { margin: 7px 0 0; font-size: 32px; }
.close-button { width: 34px; height: 34px; border: 1px solid rgba(174, 203, 255, 0.35); border-radius: 50%; color: #c9d8ed; background: rgba(11, 29, 54, 0.74); font-size: 23px; line-height: 1; }
.close-button:hover { border-color: var(--pink); color: var(--pink); }
.hangar-balance { display: flex; align-items: center; justify-content: space-between; padding: 13px 32px; border-bottom: 1px solid rgba(137, 178, 238, 0.13); color: #90a4c4; font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.1em; }
.hangar-balance b { color: #f4ffe9; font-size: 14px; font-weight: 400; }.hangar-balance i { color: var(--lime); font-size: 17px; font-style: normal; text-shadow: 0 0 10px rgba(185, 255, 114, 0.75); }
.hangar-scroll { max-height: calc(min(790px, 100vh - 48px) - 167px); padding: 23px 32px 32px; overflow: auto; }
.section-heading { display: flex; align-items: baseline; gap: 10px; margin-bottom: 14px; }.section-heading > span { color: var(--cyan); font-family: var(--font-mono); font-size: 11px; }.section-heading h3 { margin: 0; font-size: 15px; letter-spacing: 0.04em; }.section-heading p { margin: 0; color: #8196b6; font-size: 11px; }
.ship-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 11px; }
.ship-option { position: relative; min-height: 240px; padding: 16px; overflow: hidden; border: 1px solid rgba(137, 178, 238, 0.2); border-radius: 4px; background: linear-gradient(145deg, rgba(19, 42, 79, 0.74), rgba(8, 21, 42, 0.9)); }.ship-option.selected { border-color: var(--ship-color, var(--cyan)); box-shadow: inset 0 0 32px color-mix(in srgb, var(--ship-color, var(--cyan)) 12%, transparent); }.ship-option.locked { opacity: 0.76; }
.option-strip { position: absolute; top: 0; left: 0; width: 100%; height: 3px; background: var(--ship-color, var(--cyan)); box-shadow: 0 0 14px var(--ship-color, var(--cyan)); }.option-tier { color: var(--ship-color, var(--cyan)); font-family: var(--font-mono); font-size: 8px; letter-spacing: 0.12em; }.ship-option h4 { margin: 7px 0 3px; font-size: 19px; }.ship-option p { min-height: 30px; margin: 0; color: #90a5c5; font-size: 10px; line-height: 1.4; }
.ship-glyph { position: relative; width: 66px; height: 59px; margin: 13px auto 8px; background: var(--ship-color, var(--cyan)); clip-path: polygon(50% 0, 70% 23%, 100% 87%, 64% 72%, 50% 100%, 36% 72%, 0 87%, 30% 23%); filter: drop-shadow(0 0 10px var(--ship-color, var(--cyan))); opacity: 0.8; }.ship-glyph::after { position: absolute; top: 26%; left: 41%; width: 18%; height: 26%; border-radius: 50% 50% 35% 35%; background: #e8ffff; box-shadow: 0 0 12px white; content: ""; }
.ship-stats { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 3px; margin: 4px 0 12px; }.ship-stats span { color: #8195b6; font-family: var(--font-mono); font-size: 7px; text-align: center; }.ship-stats b { display: block; margin-top: 3px; color: #e9f3ff; font-size: 10px; font-weight: 400; }.ship-action, .upgrade-action { width: 100%; min-height: 30px; border: 1px solid var(--ship-color, rgba(120, 199, 255, 0.6)); border-radius: 2px; color: var(--ship-color, var(--cyan)); background: rgba(32, 76, 108, 0.26); cursor: pointer; font-family: var(--font-mono); font-size: 9px; letter-spacing: 0.07em; }.ship-action:hover, .upgrade-action:hover { color: #031020; background: var(--ship-color, var(--cyan)); }.ship-option.selected .ship-action { color: #d7f7ff; border-color: rgba(229, 248, 255, 0.36); background: rgba(143, 202, 255, 0.14); cursor: default; }
.upgrade-section { margin-top: 29px; }.upgrade-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 11px; }.upgrade-card { padding: 15px; border: 1px solid rgba(137, 178, 238, 0.2); border-radius: 4px; background: rgba(11, 28, 54, 0.68); }.upgrade-top { display: flex; align-items: center; gap: 10px; }.upgrade-icon { display: grid; place-items: center; width: 29px; height: 29px; border: 1px solid rgba(100, 231, 255, 0.52); color: var(--cyan); background: rgba(40, 140, 182, 0.15); font-size: 15px; }.upgrade-card h4 { margin: 0; font-size: 13px; }.upgrade-card p { min-height: 30px; margin: 7px 0; color: #8b9fbd; font-size: 10px; line-height: 1.45; }.upgrade-level { color: #ccf9ff; font-family: var(--font-mono); font-size: 9px; letter-spacing: 0.05em; }.upgrade-action { margin-top: 10px; border-color: rgba(100, 231, 255, 0.55); color: var(--cyan); }.upgrade-action:disabled, .ship-action:disabled { opacity: 0.45; cursor: not-allowed; }.upgrade-action:disabled:hover, .ship-action:disabled:hover { color: var(--cyan); background: rgba(32, 76, 108, 0.26); }

@media (max-width: 900px) { .mission-deck { grid-template-columns: 1fr 1fr; }.control-card { grid-column: span 2; }.ship-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }.ship-option { min-height: 220px; } }
@media (max-width: 640px) { .app-shell { width: min(100% - 22px, 1480px); padding-top: 14px; }.topbar { margin-bottom: 13px; }.brand { font-size: 12px; gap: 8px; }.brand-mark { transform: scale(0.8) rotate(45deg); }.credit-chip { min-height: 33px; padding: 0 7px; gap: 4px; }.credit-chip small { display: none; }.outline-button { min-height: 33px; padding: 0 8px; font-size: 9px; }.game-frame { min-height: 370px; aspect-ratio: 1 / 1.2; }.game-hud { grid-template-columns: 1fr 1fr; padding: 17px 16px; }.hud-center { position: absolute; top: 75px; left: 50%; width: 45%; transform: translateX(-50%); }.hud-right { width: 36vw; }.hud-label, .threat-label, .integrity-header { font-size: 7px; }.sector-value { font-size: 9px; }.sector-value span { font-size: 14px; }.enemy-readout { font-size: 6px; }.intro-panel { padding: 33px 22px 29px; }.intro-panel h1 { font-size: 40px; }.intro-panel p { font-size: 12px; }.intro-tip { gap: 3px; font-size: 6px; }.intro-tip kbd { min-width: 14px; min-height: 15px; font-size: 6px; }.mission-deck { grid-template-columns: 1fr; gap: 9px; margin-top: 10px; }.mission-deck article { min-height: auto; padding: 17px; }.control-card { grid-column: auto; }.mission-card { min-height: 126px !important; }.protocol-mark { flex-basis: 48px; width: 48px; height: 48px; }.protocol-mark::after { inset: 12px; }.hangar-modal { max-height: calc(100vh - 20px); }.modal-backdrop { padding: 10px; }.modal-header, .hangar-balance { padding-right: 17px; padding-left: 17px; }.modal-header h2 { font-size: 25px; }.hangar-scroll { max-height: calc(100vh - 152px); padding: 18px 17px 24px; }.section-heading { flex-wrap: wrap; gap: 6px; }.section-heading p { width: 100%; margin-left: 26px; }.ship-grid, .upgrade-grid { grid-template-columns: 1fr; }.ship-option { display: grid; grid-template-columns: 70px 1fr; column-gap: 12px; min-height: 150px; }.ship-glyph { grid-row: span 3; align-self: center; }.ship-stats { grid-column: span 2; }.ship-action { grid-column: span 2; }.ship-option p { min-height: auto; }.pause-button { right: 15px; bottom: 15px; }.status-toast { bottom: 16px; font-size: 8px; }.gameover-panel, .pause-panel { padding: 27px 20px; }.gameover-panel h2, .pause-panel h2 { font-size: 31px; } }
