:root {
  color-scheme: dark;
  --cyan: #5ee0ff;
  --gold: #ffc14a;
  --orange: #ff761c;
  --violet: #b07aff;
  --red: #ff2743;
  --ink: #05070c;
  --glass: rgba(6, 8, 14, .78);
  --line: rgba(255, 255, 255, .14);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html, body { width: 100%; height: 100%; margin: 0; overflow: hidden; background: #03050a; }
body { color: #fff; user-select: none; }
button, select { font: inherit; }
button, a, select { -webkit-tap-highlight-color: transparent; }

#atlas-canvas {
  position: fixed;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  cursor: crosshair;
  outline: none;
}

#game-ui { position: fixed; inset: 0; pointer-events: none; }

.topbar {
  position: absolute;
  z-index: 20;
  top: 0; left: 0; right: 0;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  min-height: 64px;
  padding: 13px clamp(16px, 2vw, 34px);
  background: linear-gradient(to bottom, rgba(3, 3, 4, .73), transparent);
  pointer-events: none;
}
.topbar a, .topbar button { pointer-events: auto; }
.back-link {
  justify-self: start;
  color: rgba(255, 255, 255, .72);
  text-decoration: none;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .15em;
}
.mission-mark { text-align: center; letter-spacing: .16em; }
.mission-mark strong, .mission-mark small { display: block; }
.mission-mark strong { font-size: 12px; }
.mission-mark small { margin-top: 4px; color: rgba(255, 255, 255, .43); font-size: 8px; }
.top-actions { justify-self: end; display: flex; gap: 7px; }
.top-actions button {
  border: 1px solid rgba(255, 255, 255, .13);
  border-radius: 10px;
  padding: 9px 11px;
  color: rgba(255, 255, 255, .74);
  background: rgba(4, 4, 5, .46);
  font-size: 8px;
  font-weight: 750;
  letter-spacing: .12em;
  cursor: pointer;
}

.hud {
  position: absolute;
  z-index: 10;
  top: 70px;
  left: clamp(16px, 2vw, 34px);
  right: clamp(16px, 2vw, 34px);
  display: none;
  grid-template-columns: 1fr minmax(260px, 460px) 1fr;
  align-items: start;
  gap: 16px;
  opacity: 0;
  transition: opacity .3s ease;
}
.hud.visible { display: grid; opacity: 1; }
.hud-cluster { display: flex; flex-wrap: wrap; gap: 8px; }
.hud-cluster.right { justify-content: flex-end; }
.hud-stat {
  min-width: 78px;
  padding: 9px 11px;
  border: 1px solid rgba(255, 255, 255, .1);
  border-radius: 10px;
  background: rgba(5, 5, 7, .5);
}
.hud-stat span {
  display: block;
  font-size: 8px;
  letter-spacing: .14em;
  color: rgba(255, 255, 255, .45);
  font-weight: 700;
}
.hud-stat b { display: block; margin-top: 4px; font-size: 15px; font-variant-numeric: tabular-nums; }
.hud-center { text-align: center; }
.hud-center span {
  display: block;
  font-size: 10px;
  letter-spacing: .18em;
  color: var(--cyan);
  font-weight: 800;
}
.hud-center strong {
  display: block;
  margin-top: 6px;
  font-size: 28px;
  font-variant-numeric: tabular-nums;
  letter-spacing: .04em;
}
.hud-center em {
  display: block;
  margin-top: 6px;
  font-style: normal;
  font-size: 10px;
  color: rgba(255, 255, 255, .5);
  letter-spacing: .08em;
}

.combat-status {
  position: absolute;
  z-index: 10;
  left: 50%;
  bottom: 92px;
  transform: translateX(-50%);
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
  max-width: min(920px, 94vw);
  opacity: 0;
  pointer-events: none;
}
body.playing .combat-status { opacity: 1; }

.combat-status output {
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, .12);
  background: rgba(5, 6, 10, .55);
  font-size: 9px;
  font-weight: 750;
  letter-spacing: .12em;
  color: rgba(255, 255, 255, .72);
}

.boost-meter {
  position: absolute;
  z-index: 10;
  left: clamp(16px, 2vw, 34px);
  bottom: 28px;
  width: min(220px, 40vw);
  display: none;
  gap: 6px;
  align-items: center;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, .1);
  background: rgba(5, 6, 10, .55);
  font-size: 9px;
  letter-spacing: .14em;
  font-weight: 750;
}
body.playing .boost-meter { display: flex; }
.boost-meter div {
  flex: 1;
  height: 7px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .08);
  overflow: hidden;
}
.boost-meter i {
  display: block;
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, #3a9fff, #7ad0ff);
  border-radius: inherit;
}
.boost-meter b { font-size: 11px; font-variant-numeric: tabular-nums; min-width: 36px; text-align: right; }

#minimap-wrap {
  position: absolute;
  z-index: 12;
  right: clamp(16px, 2vw, 34px);
  bottom: 28px;
  display: none;
  flex-direction: column;
  gap: 6px;
  padding: 8px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, .12);
  background: rgba(4, 6, 12, .72);
}
body.playing #minimap-wrap { display: flex; }
#minimap-wrap span {
  font-size: 8px;
  letter-spacing: .16em;
  font-weight: 800;
  color: rgba(255, 255, 255, .55);
  text-align: center;
}
#minimap { width: 148px; height: 148px; border-radius: 10px; display: block; }

.target-reticle {
  position: absolute;
  left: 50%; top: 50%;
  width: 42px; height: 42px;
  margin: -21px 0 0 -21px;
  pointer-events: none;
  opacity: .55;
}
.target-reticle i {
  position: absolute;
  width: 10px; height: 10px;
  border: 2px solid rgba(255, 255, 255, .55);
}
.target-reticle i:nth-child(1) { top: 0; left: 0; border-right: 0; border-bottom: 0; }
.target-reticle i:nth-child(2) { top: 0; right: 0; border-left: 0; border-bottom: 0; }
.target-reticle i:nth-child(3) { bottom: 0; left: 0; border-right: 0; border-top: 0; }
.target-reticle i:nth-child(4) { bottom: 0; right: 0; border-left: 0; border-top: 0; }

.game-toast {
  position: absolute;
  z-index: 30;
  left: 50%;
  top: 22%;
  transform: translateX(-50%) translateY(-8px);
  padding: 10px 16px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, .14);
  background: rgba(6, 8, 14, .82);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .06em;
  opacity: 0;
  transition: opacity .25s ease, transform .25s ease;
  pointer-events: none;
  max-width: min(520px, 90vw);
  text-align: center;
}
.game-toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

.damage-flash {
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at center, transparent 40%, rgba(255, 40, 60, .35));
  opacity: 0;
  pointer-events: none;
  transition: opacity .12s ease;
  z-index: 25;
}
.damage-flash.show { opacity: 1; }

.banner {
  position: absolute;
  z-index: 28;
  left: 50%;
  top: 16%;
  transform: translateX(-50%);
  text-align: center;
  padding: 14px 22px;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, .14);
  background: linear-gradient(180deg, rgba(12, 14, 22, .88), rgba(6, 8, 14, .82));
  opacity: 0;
  pointer-events: none;
  transition: opacity .3s ease;
  min-width: min(360px, 88vw);
}
.banner.show { opacity: 1; }
.banner strong {
  display: block;
  font-size: 18px;
  letter-spacing: .18em;
}
.banner span {
  display: block;
  margin-top: 8px;
  font-size: 11px;
  color: rgba(255, 255, 255, .62);
  letter-spacing: .06em;
  line-height: 1.45;
}

.overlay {
  position: absolute;
  inset: 0;
  z-index: 40;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: radial-gradient(circle at 50% 30%, rgba(30, 40, 70, .35), rgba(3, 5, 10, .88));
  pointer-events: auto;
}
.overlay.active { display: flex; }
.panel {
  width: min(560px, 100%);
  padding: 28px 26px;
  border-radius: 20px;
  border: 1px solid rgba(255, 255, 255, .12);
  background: rgba(8, 10, 16, .92);
  box-shadow: 0 30px 80px rgba(0, 0, 0, .55);
}
.panel h1 {
  margin: 0 0 8px;
  font-size: clamp(22px, 4vw, 32px);
  letter-spacing: .08em;
}
.panel .eyebrow {
  margin: 0 0 12px;
  font-size: 10px;
  letter-spacing: .2em;
  font-weight: 800;
  color: var(--cyan);
}
.panel p {
  margin: 0 0 16px;
  color: rgba(255, 255, 255, .68);
  line-height: 1.55;
  font-size: 14px;
}
.panel .meta {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin: 0 0 18px;
}
.panel .meta div {
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, .1);
  background: rgba(255, 255, 255, .03);
}
.panel .meta span {
  display: block;
  font-size: 9px;
  letter-spacing: .14em;
  color: rgba(255, 255, 255, .45);
  font-weight: 700;
}
.panel .meta b { display: block; margin-top: 4px; font-size: 16px; }
.field { margin: 0 0 16px; }
.field label {
  display: block;
  margin-bottom: 8px;
  font-size: 10px;
  letter-spacing: .16em;
  font-weight: 750;
  color: rgba(255, 255, 255, .55);
}
.field select {
  width: 100%;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, .14);
  background: rgba(0, 0, 0, .35);
  color: #fff;
}
.actions { display: flex; flex-wrap: wrap; gap: 10px; }
.actions button, .actions a {
  pointer-events: auto;
  border: 0;
  border-radius: 12px;
  padding: 12px 16px;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .1em;
  cursor: pointer;
  text-decoration: none;
  color: #041018;
  background: linear-gradient(135deg, #7ad0ff, #5ee0a8);
}
.actions button.secondary, .actions a.secondary {
  color: rgba(255, 255, 255, .8);
  background: rgba(255, 255, 255, .08);
  border: 1px solid rgba(255, 255, 255, .14);
}

.zone-list {
  display: grid;
  gap: 8px;
  margin: 0 0 18px;
}
.zone-list article {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 10px;
  align-items: start;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, .08);
  background: rgba(255, 255, 255, .03);
}
.zone-list i {
  width: 10px;
  height: 10px;
  margin-top: 4px;
  border-radius: 50%;
  display: block;
}
.zone-list strong {
  display: block;
  font-size: 11px;
  letter-spacing: .12em;
}
.zone-list span {
  display: block;
  margin-top: 3px;
  font-size: 11px;
  color: rgba(255, 255, 255, .55);
  line-height: 1.4;
}

dialog#controls-dialog {
  border: 1px solid rgba(255, 255, 255, .14);
  border-radius: 18px;
  padding: 0;
  background: rgba(8, 10, 16, .96);
  color: #fff;
  max-width: min(480px, 94vw);
}
dialog#controls-dialog::backdrop { background: rgba(0, 0, 0, .65); }
dialog#controls-dialog .panel { box-shadow: none; border: 0; }
.control-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin: 0 0 16px;
  font-size: 12px;
}
.control-grid b {
  display: inline-block;
  min-width: 52px;
  padding: 3px 8px;
  margin-right: 6px;
  border-radius: 6px;
  background: rgba(255, 255, 255, .08);
  font-size: 10px;
  letter-spacing: .08em;
}

@media (max-width: 720px) {
  .hud { grid-template-columns: 1fr; top: 60px; }
  .hud-cluster.right { justify-content: flex-start; }
  .panel .meta { grid-template-columns: 1fr; }
  .control-grid { grid-template-columns: 1fr; }
  #minimap { width: 120px; height: 120px; }
}
