:root {
  color-scheme: dark;
  --steel: #283b49;
  --ice: #dae7f1;
  --dust: #9cacbb;
  --signal: #f9c68e;
  --deck: #111d29;
  --void: #09111b;
  font-family: system-ui, sans-serif;
  color: var(--ice);
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; overflow: hidden; background: var(--void); }
#world, #interface { position: fixed; inset: 0; width: 100%; height: 100%; }
#interface { pointer-events: none; }
h1, h2, p, dl, dd { margin: 0; }
small { font-size: .78em; color: var(--dust); }
strong, b, dd { font-variant-numeric: tabular-nums; }
kbd {
  display: inline-block;
  min-width: 1.45em;
  padding: .16em .4em;
  border: 1px solid #61707a;
  border-bottom-width: 2px;
  border-radius: 3px;
  background: #273542;
  color: var(--ice);
  font-family: inherit;
  line-height: 1;
  text-align: center;
  white-space: nowrap;
}

.hangar {
  height: 100%;
  display: grid;
  grid-template-rows: auto minmax(0,1fr) auto auto;
  padding: 0 clamp(14px, 5.5vw, 100px);
  background: radial-gradient(ellipse at 50% 41%, #293f50e8 0%, #111d29fd 59%, #09111b 100%);
  overflow: auto;
}

.hangar-head, .hangar-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: clamp(9px, 2.8vh, 28px) 0;
  color: var(--dust);
  border-bottom: 1px solid var(--steel);
}
.hangar-head strong { color: var(--ice); margin-left: .4rem; }
.hangar-head h1 {
  color: var(--ice);
  letter-spacing: -.045em;
  font-size: clamp(2rem, 7.5vw, 6.4rem);
  line-height: .86;
  font-weight: 900;
  font-stretch: condensed;
}
.hangar-head h1 span { color: var(--signal); margin-left: .08em; }

.hangar-body {
  display: grid;
  grid-template-columns: minmax(145px, 1fr) minmax(0, 2.45fr) minmax(145px, 1fr);
  gap: clamp(10px, 3vw, 48px);
  align-items: center;
  min-height: 0;
}
.hangar-body h2 { font-size: clamp(1rem, 2.1vw, 1.9rem); line-height: 1; letter-spacing: -.04em; margin-bottom: .6rem; }
.hangar-body p { color: var(--dust); font-size: clamp(.76rem, 1.25vw, 1rem); line-height: 1.45; }
.ship-data { border-left: 3px solid var(--ship); padding-left: 13px; }
.ship-data small { display: block; margin-bottom: .55rem; }
.ship-data h2 { color: var(--ship); }
.launch-pad {
  position: relative;
  height: 100%;
  min-height: 0;
  display: grid;
  place-items: center;
  isolation: isolate;
  background:
    radial-gradient(ellipse, transparent 43%, #111c28 44%, transparent 45%),
    repeating-linear-gradient(90deg, transparent 0 41px, #9aacc312 42px 43px),
    repeating-linear-gradient(0deg, transparent 0 41px, #9aacc312 42px 43px);
}
.launch-pad::after {
  content: '';
  position: absolute;
  inset: 12% 8%;
  border-inline: 2px dashed #acbbcb44;
  z-index: -1;
}
.launch-pad img {
  width: 83%;
  height: 85%;
  object-fit: contain;
  min-height: 0;
  filter: drop-shadow(0 19px 13px #0009);
}
.ship-list {
  min-width: 0;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 6px;
}
.ship-slot {
  display: grid;
  place-items: center;
  padding: min(1.4vh, 10px) 2px;
  background: #0f1b27;
  border-top: 2px solid var(--steel);
  font-size: clamp(.58rem, 1.4vw, .88rem);
  color: var(--dust);
}
.ship-slot img { display: block; width: 75%; height: clamp(27px, 9vh, 94px); object-fit: contain; margin-bottom: 3px; }
.ship-slot.selected { color: var(--ice); background: #2d3e4c; border-top-color: var(--ship); box-shadow: inset 0 -2px var(--ship); }
.hangar-foot { border: 0; font-size: clamp(.69rem, 1.6vw, .94rem); }
.hangar-foot strong { color: var(--signal); }

.flight-ui, .scrim { position: absolute; inset: 0; }
.flight-head, .flight-base { position: absolute; left: 14px; right: 14px; }
.flight-head { top: 12px; display: flex; align-items: start; justify-content: space-between; gap: 10px; }
.objective, .flight-score, .altimeter, .console, .tip, .boss-meter {
  background: #0a1521e8;
  border: 1px solid #55697c;
  box-shadow: 0 3px 8px #0005;
}
.objective, .flight-score { display: grid; padding: 7px 10px; gap: 2px; }
.objective { grid-template-columns: minmax(0, 1fr) auto; min-width: 225px; }
.objective strong { grid-column: 1 / -1; grid-row: 2; font-size: .93rem; }
.objective .sector { color: var(--signal); font-size: .76rem; }
.objective small { padding-left: .9em; white-space: nowrap; }
.heading { display: inline-block; transform: rotate(var(--heading)); font-style: normal; color: var(--signal); }
.flight-score { text-align: right; flex-shrink: 0; }
.flight-score strong { font-size: 1.2rem; line-height: 1; }
.altimeter { position: absolute; top: 37%; right: 14px; width: 76px; padding: 7px; text-align: center; }
.altimeter strong { display: block; font-size: 1.22rem; }
.altimeter sub { vertical-align: baseline; font-size: .6rem; }
.altimeter.danger { border-color: #ff8b7c; background: #41272af2; }
.alt-track {
  position: relative;
  height: min(15vh, 120px);
  margin: 9px auto;
  width: 15px;
  border: 1px solid #546473;
  background: repeating-linear-gradient(to top, #283d52 0 1px, #101e2c 1px 12px);
}
.alt-track i, .alt-track b { position: absolute; bottom: var(--z); transform: translateY(50%); }
.alt-track i { height: 5px; width: 100%; left: 0; background: #a8e4f2; }
.alt-track b { height: 2px; width: 23px; left: -5px; background: #ff9b81; }
.boss-meter { position: absolute; top: 94px; left: 50%; transform: translateX(-50%); width: min(48%, 360px); padding: 5px 9px; }
.flight-base { bottom: 12px; }
.tip {
  width: fit-content;
  margin: 0 auto 6px;
  border-color: #d2a377;
  padding: 4px 10px;
  color: var(--signal);
  font-size: .82rem;
  text-align: center;
}
.console {
  display: grid;
  grid-template-columns: minmax(180px, 1.15fr) minmax(155px, 1fr) minmax(210px, 1.3fr) minmax(95px, .52fr);
  gap: 6px;
  padding: 6px;
  font-size: .78rem;
  width: min(100%, 1100px);
  margin: auto;
  background: #0a1521;
}
.hull-panel, .shield-panel, .laser-panel, .reactor, .utility {
  padding: 7px 9px;
  background: #142332;
  border: 1px solid #425363;
}
.hull-panel {
  padding: 7px 10px 5px;
  background: #252022;
  border-color: #927061;
  border-left: 4px solid #f4ba9a;
}
.hull-panel .gauge div { font-size: clamp(.91rem, 1.55vw, 1.19rem); font-weight: 850; }
.hull-panel .gauge i { height: 9px; background: #51313a; }
.hull-panel small {
  display: block;
  min-height: 1.1rem;
  margin-top: 3px;
  color: #e9b8a2;
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.hull-panel.critical { background: #381d25; border-color: #ff8b76; }
.hull-panel.struck { background: #5e2a2b; border-color: #ff9c82; }
.vitals { display: grid; gap: 4px; }
.shield-panel, .laser-panel { padding: 4px 7px; }
.shield-panel.struck { background: #254c5b; border-color: #a8e4f2; }
.laser-panel.starved { border-color: #b99b68; background: #332b27; }
.reactor { display: grid; align-content: center; gap: 4px; }
.aim-cue {
  position: absolute;
  width: max-content;
  right: -1px;
  top: calc(100% + 5px);
  padding: 6px 9px;
  border: 1px solid #a48056;
  background: #201d22;
  color: #ffcc98;
}
.aim-cue strong { font-size: .76rem; }
.aim-cue small { color: inherit; }
.aim-cue.aligned { color: #aaf2dd; border-color: #679e92; background: #132b2c; }
.gauge div, .reactor-title, .reactor-values { display: flex; justify-content: space-between; align-items: center; gap: 3px; }
.gauge div { color: var(--ink); }
.gauge i { display: block; background: #253444; height: 5px; margin-top: 4px; }
.gauge em { display: block; width: var(--fill); height: 100%; background: var(--ink); }
.reactor-title span, .reactor-values { color: var(--dust); }
.power-cells { display: grid; grid-template-columns: repeat(10, 1fr); gap: 3px; margin: 3px 0; }
.power-cells b { height: 5px; background: #a8e4f2; }
.power-cells .laser { background: #f5d38e; }
.utility { display: grid; align-content: center; gap: 4px; }
.utility > div { display: flex; align-items: center; gap: 4px; }
.utility b { margin-left: auto; white-space: nowrap; }

.scrim {
  display: grid;
  place-items: center;
  padding: 12px;
  background: #07111dcc;
}
.sheet {
  width: min(100%, 505px);
  max-height: 100%;
  overflow: auto;
  background: #132333;
  box-shadow: 0 14px 80px #000b;
  padding: clamp(14px, 4vh, 37px);
  border: 1px solid #607489;
  border-top: 4px solid var(--signal);
}
.sheet h2 { font-size: clamp(1.85rem, 5vw, 2.8rem); letter-spacing: -.055em; line-height: .99; margin-bottom: 15px; }
.sheet p { color: var(--dust); margin-bottom: 17px; }
.sheet small { display: block; margin-bottom: 7px; color: var(--signal); }
.controls, .results { display: grid; grid-template-columns: max-content 1fr; gap: 5px 16px; align-items: center; font-size: .91rem; }
.controls dt { text-align: right; }
.results { grid-template-columns: 1fr max-content; }
.results dd { color: var(--signal); }
.sheet footer {
  padding-top: 12px;
  margin-top: 15px;
  border-top: 1px solid #495c6d;
  line-height: 1.7;
  font-size: .85rem;
}

@media (max-width: 720px) {
  .hangar-body { grid-template-columns: 1.2fr 1fr; grid-template-rows: minmax(0,1fr) auto; padding-bottom: 10px; }
  .launch-pad { grid-column: 1 / -1; grid-row: 1; }
  .flight-head, .flight-base { left: 5px; right: 5px; }
  .altimeter { right: 5px; width: 54px; font-size: .78rem; }
  .console { grid-template-columns: 1fr 1fr; font-size: .68rem; gap: 4px; padding: 4px; }
  .hull-panel { padding: 6px; }
  .utility { align-content: center; }
  .reactor { padding: 4px 6px; }
  .reactor-title { flex-wrap: wrap; }
  .reactor-title strong { order: -1; width: 100%; }
  .objective { min-width: 0; }
}

.retry-options { display: grid; grid-template-columns: repeat(2, 1fr); gap: 5px; margin-bottom: 10px; }
.retry-options span { display: block; padding: 4px 7px; border: 1px solid #45596b; color: var(--dust); }
.retry-options .chosen { border-color: var(--signal); color: var(--signal); background: #332c29; }
.sheet .credit {
  border-top: 1px solid #495c6d;
  padding-top: 10px;
  color: var(--signal);
  font-size: .82rem;
}
