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

:root {
  color-scheme: dark;
  font-family: Manrope, "Segoe UI", sans-serif;
  background: #071414;
  color: #f0ead6;
  --ink: #f0ead6;
  --muted: #92aaa3;
  --line: rgba(171, 211, 195, .23);
  --glass: rgba(6, 20, 20, .72);
  --amber: #f2b85b;
  --cyan: #79e0d0;
  --danger: #ef745b;
}

* { box-sizing: border-box; }
html, body { width: 100%; height: 100%; overflow: hidden; }
body { margin: 0; background: #071414; }
button, a { font: inherit; }
button { color: inherit; }
#game { position: fixed; inset: 0; }
#game canvas { display: block; width: 100%; height: 100%; touch-action: none; }

.vignette {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(circle at 50% 48%, transparent 35%, rgba(2, 8, 8, .3) 72%, rgba(2, 6, 6, .86));
  z-index: 2;
}
.vignette::after {
  content: "";
  position: absolute;
  inset: 0;
  opacity: .08;
  background-image: repeating-linear-gradient(0deg, rgba(255,255,255,.22) 0 1px, transparent 1px 4px);
}

.panel {
  z-index: 5;
  border: 1px solid var(--line);
  background: linear-gradient(145deg, rgba(8, 27, 27, .82), rgba(5, 16, 17, .66));
  box-shadow: 0 18px 48px rgba(0,0,0,.22), inset 0 1px rgba(255,255,255,.04);
  backdrop-filter: blur(14px);
}
.brand {
  position: fixed;
  top: 24px;
  left: 28px;
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 13px 17px 12px 13px;
  clip-path: polygon(0 0, calc(100% - 16px) 0, 100% 16px, 100% 100%, 0 100%);
}
.brand-mark {
  display: grid;
  width: 37px;
  height: 37px;
  place-items: center;
  border: 1px solid rgba(242,184,91,.55);
  color: var(--amber);
  font-size: 21px;
  box-shadow: inset 0 0 14px rgba(242,184,91,.12);
}
.brand p, .brand h1 { margin: 0; }
.brand p, .eyebrow, .telemetry-head, .menu, .controls, .meter label {
  font-family: "Chakra Petch", ui-monospace, monospace;
  letter-spacing: .16em;
}
.brand p { color: var(--muted); font-size: 10px; }
.brand h1 { margin-top: 2px; font: 500 18px/1.1 "Chakra Petch", sans-serif; letter-spacing: .09em; }

.objective {
  position: fixed;
  left: 28px;
  bottom: 30px;
  width: min(390px, calc(100vw - 56px));
  padding: 17px 19px 15px;
}
.eyebrow { color: var(--amber); font-size: 11px; }
.objective-row { display: flex; justify-content: space-between; gap: 12px; align-items: baseline; margin-top: 7px; }
.objective-row strong { font: 500 19px "Chakra Petch", sans-serif; letter-spacing: .08em; }
.objective-row b { color: var(--cyan); font: 500 14px "Chakra Petch", sans-serif; }
.objective p { margin: 9px 0 0; color: var(--muted); font-size: 13px; }
.progress { height: 3px; margin-top: 10px; background: rgba(121,224,208,.12); }
.progress i { display: block; width: 0; height: 100%; background: var(--cyan); box-shadow: 0 0 12px var(--cyan); transition: width .35s ease; }
kbd { padding: 2px 5px; border: 1px solid rgba(240,234,214,.32); background: rgba(255,255,255,.05); font: 500 11px "Chakra Petch", monospace; }

.telemetry { position: fixed; top: 24px; right: 28px; width: 264px; padding: 15px; }
.telemetry-head { display: flex; justify-content: space-between; padding-bottom: 11px; border-bottom: 1px solid var(--line); color: var(--muted); font-size: 10px; }
.telemetry-head span:last-child { color: var(--amber); }
.meter { display: grid; grid-template-columns: 50px 1fr 30px; gap: 9px; align-items: center; margin-top: 12px; }
.meter label { color: var(--muted); font-size: 10px; }
.meter span { height: 4px; background: rgba(255,255,255,.08); }
.meter span i { display: block; height: 100%; width: 100%; background: var(--cyan); box-shadow: 0 0 9px rgba(121,224,208,.55); }
.meter b { text-align: right; font: 500 11px "Chakra Petch", sans-serif; }
.meter.scrap span i { width: 0; background: var(--amber); box-shadow: 0 0 9px rgba(242,184,91,.55); }
.radar { position: relative; height: 114px; margin-top: 13px; overflow: hidden; border: 1px solid var(--line); background: repeating-radial-gradient(circle, transparent 0 19px, rgba(121,224,208,.1) 20px 21px), linear-gradient(rgba(121,224,208,.04) 1px, transparent 1px), linear-gradient(90deg, rgba(121,224,208,.04) 1px, transparent 1px); background-size: auto, 20px 20px, 20px 20px; }
.radar::before, .radar::after { content:""; position:absolute; background:rgba(121,224,208,.13); }
.radar::before { width:1px; height:100%; left:50%; }
.radar::after { height:1px; width:100%; top:50%; }
.radar > i { position: absolute; left: 50%; top: 50%; width: 8px; height: 8px; margin: -4px; border: 2px solid #ddfff8; transform: rotate(45deg); z-index: 2; transition: left .12s linear, top .12s linear; }
.radar > span { position: absolute; width: 5px; height: 5px; border-radius: 50%; background: var(--amber); box-shadow: 0 0 7px var(--amber); }
.radar > span:nth-of-type(1) { left: 21%; top: 68%; }.radar > span:nth-of-type(2) { left: 43%; top: 19%; }.radar > span:nth-of-type(3) { left: 72%; top: 24%; }.radar > span:nth-of-type(4) { left: 82%; top: 63%; }.radar > span:nth-of-type(5) { left: 52%; top: 81%; }

.repair { position: fixed; left: 50%; bottom: 31px; display: flex; align-items: center; gap: 12px; width: 258px; padding: 12px 14px; opacity: 0; transform: translate(-50%, 12px); transition: .22s ease; pointer-events: none; }
.repair.visible { opacity: 1; transform: translate(-50%, 0); }
.repair .key { display: grid; width: 40px; height: 40px; place-items: center; border: 1px solid var(--amber); color: var(--amber); font: 600 17px "Chakra Petch", sans-serif; }
.repair strong, .repair small { display: block; }
.repair strong { font: 500 13px "Chakra Petch", sans-serif; letter-spacing: .08em; }
.repair small { margin-top: 2px; color: var(--muted); font-size: 11px; }
.repair > i { margin-left: auto; width: 32px; height: 32px; border-radius: 50%; background: conic-gradient(var(--amber) var(--repair, 0%), rgba(255,255,255,.08) 0); -webkit-mask: radial-gradient(transparent 48%, #000 50%); mask: radial-gradient(transparent 48%, #000 50%); }

.controls { position: fixed; right: 28px; bottom: 30px; display: flex; gap: 16px; padding: 11px 14px; color: var(--muted); font-size: 10px; }
.controls div { white-space: nowrap; }
.menu { position: fixed; z-index: 6; top: 119px; left: 29px; display: flex; gap: 16px; font-size: 10px; }
.menu a, .menu button { border: 0; padding: 0; color: var(--muted); background: none; text-decoration: none; cursor: pointer; letter-spacing: .12em; }
.menu a:hover, .menu button:hover { color: var(--ink); }

.toast { position: fixed; z-index: 8; left: 50%; top: 16%; padding: 9px 16px; color: #091412; background: var(--amber); font: 600 11px "Chakra Petch", sans-serif; letter-spacing: .12em; opacity: 0; transform: translate(-50%, -8px); transition: .25s ease; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

.briefing, .completion, .loading { position: fixed; inset: 0; z-index: 20; display: grid; place-items: center; }
.briefing { background: radial-gradient(circle at 50% 45%, rgba(19, 55, 51, .52), rgba(3, 11, 11, .92)); }
.briefing.hidden { opacity: 0; pointer-events: none; transition: opacity .6s ease; }
.briefing-card, .completion-card { width: min(620px, calc(100vw - 40px)); padding: clamp(28px, 6vw, 62px); }
.briefing-card h2, .completion-card h2 { margin: 18px 0 16px; font: 400 clamp(30px, 5vw, 55px)/1.04 "Chakra Petch", sans-serif; letter-spacing: -.025em; }
.briefing-card p, .completion-card p { max-width: 510px; color: #adc0ba; font-size: 15px; line-height: 1.7; }
.briefing-card button, .completion-card button { display: flex; width: 100%; margin-top: 29px; padding: 14px 18px; justify-content: space-between; align-items: center; border: 1px solid rgba(242,184,91,.5); background: rgba(242,184,91,.09); cursor: pointer; text-align: left; transition: .2s ease; }
.briefing-card button:hover, .completion-card button:hover { background: var(--amber); color: #0a1614; }
.briefing-card button span, .completion-card button { font: 600 13px "Chakra Petch", sans-serif; letter-spacing: .12em; }
.briefing-card button small { color: var(--muted); }
.briefing-card button:hover small { color: #24342f; }
.completion { opacity: 0; pointer-events: none; background: rgba(2, 10, 10, .74); transition: opacity .5s ease; }
.completion.visible { opacity: 1; pointer-events: auto; }
.completion-card { text-align: center; }
.completion-card p { margin-inline: auto; }
.completion-card button { justify-content: center; }

.loading { z-index: 30; gap: 13px; align-content: center; background: #061112; transition: opacity .5s ease; }
.loading.hidden { opacity: 0; pointer-events: none; }
.loading i { width: 42px; height: 42px; border: 1px solid rgba(121,224,208,.22); border-top-color: var(--cyan); border-radius: 50%; animation: spin 1s linear infinite; }
.loading p { margin: 0; color: var(--muted); font: 500 10px "Chakra Petch", sans-serif; letter-spacing: .2em; }
@keyframes spin { to { transform: rotate(360deg); } }

@media (max-width: 780px) {
  .brand { top: 14px; left: 14px; }
  .brand h1 { font-size: 14px; }
  .telemetry { top: 14px; right: 14px; width: 164px; }
  .radar { height: 70px; }
  .telemetry .meter { grid-template-columns: 44px 1fr 24px; }
  .menu { top: 102px; left: 16px; }
  .controls { display: none; }
  .objective { left: 14px; bottom: 14px; width: calc(100vw - 28px); }
  .repair { bottom: 139px; }
}

@media (max-width: 520px) {
  .brand { right: 14px; }
  .telemetry { top: 84px; width: 150px; }
  .telemetry-head span:first-child { display: none; }
  .telemetry-head { justify-content: flex-end; }
  .radar { display: none; }
  .menu { top: 90px; }
  .menu button:last-child { display: none; }
  .objective p { font-size: 12px; }
}
