:root {
  --navy: #0a1220;
  --navy-2: #0d1627;
  --navy-3: #101b2e;
  --ink: #d7eef8;
  --cyan: #49bbdf;
  --cyan-hot: #7af0ff;
  --cyan-deep: #1b9ede;
  --mag: #e840a0;
  --mag-hot: #ff5ad8;
  --rose: #f43f5e;
  --gold: #ea970c;
  --gold-hot: #ffc14a;
  --panel: rgba(10, 18, 34, 0.92);
  --line: rgba(73, 187, 223, 0.55);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body {
  width: 100%; height: 100%; overflow: hidden;
  background: #080e1a;
  color: var(--ink);
  font-family: "Exo 2", "Rajdhani", sans-serif;
  user-select: none;
}
#stage, #c {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  display: block;
}
#c { z-index: 0; }

#hud {
  position: absolute; inset: 0; z-index: 3;
  pointer-events: none;
}
#hud .abil { pointer-events: auto; }

/* ----- cockpit frame ----- */
#frame-l, #frame-r {
  position: absolute;
  top: 0; bottom: 0;
  width: 7.2%;
  background: linear-gradient(180deg, #0a1220 0%, #0c1526 50%, #080e1a 100%);
  z-index: 1;
}
#frame-l {
  left: 0;
  clip-path: polygon(0 0, 100% 0, 62% 42%, 100% 100%, 0 100%);
  box-shadow: inset -18px 0 28px rgba(0,0,0,0.45);
}
#frame-r {
  right: 0;
  clip-path: polygon(0 0, 100% 0, 100% 100%, 0 100%, 38% 42%);
  box-shadow: inset 18px 0 28px rgba(0,0,0,0.45);
}
#frame-b {
  position: absolute;
  left: 18%; right: 18%;
  bottom: 0; height: 15.6%;
  background: linear-gradient(180deg, rgba(8,14,26,0) 0%, #080e1a 28%, #0a1222 100%);
  clip-path: polygon(8% 0, 92% 0, 100% 100%, 0 100%);
  z-index: 1;
}

/* ----- title ----- */
#hud-tl {
  position: absolute;
  top: 3.1%;
  left: 3.4%;
  display: flex;
  align-items: center;
  gap: 0.7rem;
  z-index: 4;
}
#title-diamond {
  width: 34px; height: 34px;
  object-fit: contain;
  filter: drop-shadow(0 0 8px rgba(73, 187, 223, 0.7));
}
#title-word {
  font-family: "Orbitron", "Audiowide", sans-serif;
  font-weight: 800;
  letter-spacing: 0.16em;
  font-size: clamp(13px, 1.28vw, 20px);
  color: #e8f6ff;
  text-shadow: 0 0 10px rgba(73, 187, 223, 0.55);
}
#title-sub {
  margin-top: 3px;
  font-family: "Rajdhani", sans-serif;
  font-weight: 700;
  letter-spacing: 0.22em;
  font-size: clamp(9px, 0.78vw, 12px);
  color: #49bbdf;
}

/* ----- night/day phase banner ----- */
#phase-banner {
  position: absolute;
  top: 1.6%;
  left: 50%;
  transform: translateX(-50%);
  width: min(520px, 38vw);
  z-index: 4;
  border: 2px solid #e85a8c;
  background: linear-gradient(180deg, rgba(28, 6, 28, 0.92), rgba(12, 6, 22, 0.92));
  box-shadow: 0 0 18px rgba(232, 64, 160, 0.35), inset 0 0 18px rgba(232, 64, 160, 0.12);
  clip-path: polygon(14px 0, calc(100% - 14px) 0, 100% 50%, calc(100% - 14px) 100%, 14px 100%, 0 50%);
  padding: 0.28rem 1.4rem 0.34rem;
  text-align: center;
}
#phase-banner.day {
  border-color: #49bbdf;
  background: linear-gradient(180deg, rgba(8, 28, 48, 0.92), rgba(6, 14, 32, 0.92));
  box-shadow: 0 0 18px rgba(73, 187, 223, 0.35);
}
#phase-top {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
}
#phase-icon {
  color: var(--rose);
  font-size: 0.72rem;
  text-shadow: 0 0 8px #f43f5e;
}
#phase-banner.day #phase-icon { color: #ffc14a; text-shadow: 0 0 8px #ea970c; }
#phase-label {
  font-family: "Orbitron", sans-serif;
  font-weight: 800;
  letter-spacing: 0.18em;
  font-size: clamp(10px, 0.95vw, 14px);
  color: #ff5a78;
}
#phase-banner.day #phase-label { color: #7af0ff; }
#phase-time {
  font-family: "Share Tech Mono", "Orbitron", monospace;
  color: #7af0ff;
  letter-spacing: 0.08em;
  font-size: clamp(12px, 1.1vw, 16px);
}
#phase-rule {
  margin-top: 3px;
  font-family: "Rajdhani", sans-serif;
  font-weight: 700;
  letter-spacing: 0.08em;
  font-size: clamp(8px, 0.7vw, 11px);
  color: #c9a0b4;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ----- score ----- */
#hud-tr {
  position: absolute;
  top: 2.2%;
  right: 2.8%;
  display: flex;
  align-items: stretch;
  gap: 1.15rem;
  background: linear-gradient(180deg, rgba(12, 18, 38, 0.88), rgba(10, 14, 28, 0.72));
  border: 1px solid rgba(73, 187, 223, 0.28);
  padding: 0.38rem 1.1rem 0.42rem 1.15rem;
  z-index: 4;
}
#gold-stripe {
  position: absolute;
  right: -2px; top: -1px; bottom: -1px;
  width: 4px;
  background: linear-gradient(180deg, #ffc14a, #ea970c);
  box-shadow: 0 0 10px #ea970c;
}
.sc-lab {
  font-family: "Rajdhani", sans-serif;
  font-weight: 700;
  letter-spacing: 0.16em;
  font-size: clamp(8px, 0.68vw, 11px);
  color: #8aa4b8;
}
.sc-val {
  font-family: "Orbitron", "Share Tech Mono", sans-serif;
  font-weight: 800;
  font-size: clamp(16px, 1.55vw, 24px);
  letter-spacing: 0.04em;
  line-height: 1.1;
}
.sc-val.gold { color: #ffc14a; text-shadow: 0 0 12px rgba(234, 151, 12, 0.65); }
.sc-val.mag { color: #ff5ad8; text-shadow: 0 0 12px rgba(232, 64, 160, 0.65); }
.sc-val .max {
  font-size: 0.55em;
  letter-spacing: 0.12em;
  margin-left: 0.15em;
}

/* ----- target ----- */
#target-banner {
  position: absolute;
  left: 50%;
  top: 52.5%;
  transform: translateX(-50%);
  z-index: 4;
  min-width: min(420px, 34vw);
  text-align: center;
  padding: 0.32rem 1.3rem 0.38rem;
  background: linear-gradient(180deg, rgba(40, 6, 22, 0.92), rgba(14, 6, 18, 0.92));
  border: 2px solid #e85a8c;
  box-shadow: 0 0 16px rgba(232, 64, 160, 0.3);
}
#target-name {
  font-family: "Orbitron", sans-serif;
  font-weight: 800;
  letter-spacing: 0.12em;
  font-size: clamp(10px, 0.92vw, 14px);
  color: #ff6a88;
}
#target-sub {
  margin-top: 2px;
  font-family: "Rajdhani", sans-serif;
  font-weight: 700;
  letter-spacing: 0.1em;
  font-size: clamp(8px, 0.68vw, 11px);
  color: #c9a0b4;
}

/* ----- speed ----- */
#lane-chevrons {
  position: absolute;
  left: 50%;
  bottom: 27.5%;
  transform: translateX(-50%);
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  opacity: 0.85;
}
.chev {
  width: 28px; height: 10px;
  border-left: 3px solid #7af0ff;
  border-top: 3px solid #7af0ff;
  transform: rotate(45deg);
  filter: drop-shadow(0 0 6px #49bbdf);
}
#speed-badge {
  position: absolute;
  left: 50%;
  bottom: 19.6%;
  transform: translateX(-50%);
  z-index: 4;
  min-width: 92px;
  padding: 0.22rem 0.85rem 0.28rem;
  background: rgba(6, 16, 32, 0.88);
  border: 2px solid #2a6a88;
  border-radius: 10px;
  text-align: center;
  box-shadow: 0 0 12px rgba(73, 187, 223, 0.25);
}
#speed-num {
  font-family: "Orbitron", sans-serif;
  font-weight: 800;
  font-size: clamp(18px, 1.7vw, 26px);
  color: #7af0ff;
  letter-spacing: 0.06em;
  line-height: 1;
}
#speed-unit {
  font-family: "Rajdhani", sans-serif;
  font-weight: 700;
  letter-spacing: 0.28em;
  font-size: 9px;
  color: #3aa0c4;
  margin-top: 2px;
}

/* dash ticks */
#dash-l, #dash-r {
  position: absolute;
  bottom: 14.4%;
  width: 18px; height: 42px;
  border-radius: 9px;
  background: rgba(8, 16, 28, 0.9);
  border: 2px solid #2a88aa;
  z-index: 4;
}
#dash-l { left: 38.5%; }
#dash-r { right: 38.5%; border-color: #c050a0; }
#dash-l .tick, #dash-r .tick {
  display: block;
  width: 10px; height: 10px;
  margin: 14px auto 0;
  border-radius: 2px;
  background: #49bbdf;
  box-shadow: 0 0 8px #49bbdf;
}
#dash-r .tick { background: #e840a0; box-shadow: 0 0 8px #e840a0; }

/* ----- telemetry ----- */
#telemetry {
  position: absolute;
  left: 2.2%;
  bottom: 3.4%;
  width: min(360px, 26vw);
  z-index: 5;
  padding: 0.85rem 1.05rem 0.75rem;
  background: linear-gradient(180deg, rgba(10, 18, 36, 0.94), rgba(8, 14, 28, 0.94));
  border: 2px solid rgba(73, 187, 223, 0.55);
  box-shadow: 0 0 18px rgba(73, 187, 223, 0.18);
  clip-path: polygon(0 12px, 12px 0, 100% 0, 100% calc(100% - 12px), calc(100% - 12px) 100%, 0 100%);
}
.tel-head {
  display: flex;
  justify-content: space-between;
  margin-bottom: 0.55rem;
}
.tel-title, .tel-sys {
  font-family: "Orbitron", sans-serif;
  font-weight: 800;
  letter-spacing: 0.16em;
  font-size: clamp(10px, 0.95vw, 14px);
  color: #7af0ff;
  line-height: 1.15;
}
.tel-sys { text-align: right; }
.bar-row { margin-bottom: 0.38rem; }
.bar-meta {
  display: flex;
  justify-content: space-between;
  font-family: "Rajdhani", sans-serif;
  font-weight: 700;
  letter-spacing: 0.12em;
  font-size: clamp(8px, 0.72vw, 11px);
  color: #9eb4c8;
  margin-bottom: 3px;
}
.bar-meta .mag { color: #ff5ad8; }
.bar-meta .gold { color: #ffc14a; }
.track {
  height: 7px;
  background: rgba(255,255,255,0.08);
  border-radius: 2px;
  overflow: hidden;
}
.track > i {
  display: block;
  height: 100%;
  width: 88%;
  border-radius: 2px;
}
.track.cyan > i { background: linear-gradient(90deg, #1b9ede, #7af0ff); box-shadow: 0 0 8px #49bbdf; }
.track.mag > i { background: linear-gradient(90deg, #a02080, #ff5ad8); box-shadow: 0 0 8px #e840a0; }
.track.gold > i { background: linear-gradient(90deg, #c07008, #ffc14a); box-shadow: 0 0 8px #ea970c; }

.abil-row {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 0.4rem;
  margin-top: 0.55rem;
}
.abil {
  font-family: "Rajdhani", sans-serif;
  font-weight: 700;
  letter-spacing: 0.06em;
  font-size: clamp(8px, 0.7vw, 11px);
  line-height: 1.15;
  color: #c8e6f4;
  background: rgba(12, 28, 48, 0.85);
  border: 1.5px solid rgba(73, 187, 223, 0.55);
  border-radius: 6px;
  padding: 0.38rem 0.2rem;
  cursor: pointer;
  pointer-events: auto;
}
.abil b { color: #7af0ff; }
.abil:hover, .abil.hot {
  border-color: #7af0ff;
  box-shadow: 0 0 10px rgba(73, 187, 223, 0.45);
  color: #fff;
}
.abil.cd { opacity: 0.45; }

/* ----- frequency ----- */
#freq-bar {
  position: absolute;
  left: 50%;
  bottom: 3.2%;
  transform: translateX(-50%);
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 0.28rem 1.4rem;
  min-width: min(460px, 36vw);
  background: rgba(8, 14, 26, 0.92);
  border: 1.5px solid rgba(73, 187, 223, 0.45);
  border-radius: 20px;
}
.freq-lab {
  font-family: "Orbitron", sans-serif;
  font-weight: 700;
  letter-spacing: 0.14em;
  font-size: clamp(8px, 0.72vw, 11px);
  color: #5aa8c8;
  white-space: nowrap;
}
#wave { display: block; }
.freq-hz {
  font-family: "Share Tech Mono", "Orbitron", monospace;
  color: #ff5ad8;
  letter-spacing: 0.06em;
  font-size: clamp(12px, 1.05vw, 16px);
  white-space: nowrap;
}

/* ----- radar ----- */
#radar-panel {
  position: absolute;
  right: 2.2%;
  bottom: 3.4%;
  width: min(360px, 26vw);
  z-index: 5;
  padding: 0.75rem 0.95rem 0.7rem;
  background: linear-gradient(180deg, rgba(10, 18, 36, 0.94), rgba(8, 14, 28, 0.94));
  border: 2px solid rgba(200, 80, 160, 0.45);
  box-shadow: 0 0 18px rgba(232, 64, 160, 0.16);
  clip-path: polygon(12px 0, 100% 0, 100% calc(100% - 12px), calc(100% - 12px) 100%, 0 100%, 0 12px);
}
.rad-head {
  display: flex;
  justify-content: space-between;
  margin-bottom: 0.45rem;
}
.rad-title {
  font-family: "Orbitron", sans-serif;
  font-weight: 800;
  letter-spacing: 0.12em;
  font-size: clamp(10px, 0.92vw, 13px);
  color: #7af0ff;
  line-height: 1.15;
}
.rad-stage {
  text-align: right;
  font-family: "Orbitron", sans-serif;
  font-weight: 800;
  letter-spacing: 0.14em;
  font-size: clamp(10px, 0.88vw, 13px);
  color: #ff5ad8;
  line-height: 1.15;
}
.rad-body {
  display: flex;
  gap: 0.7rem;
  align-items: center;
}
#radar {
  width: 92px; height: 92px;
  flex: 0 0 92px;
}
.rad-list {
  list-style: none;
  font-family: "Rajdhani", sans-serif;
  font-weight: 700;
  font-size: clamp(10px, 0.85vw, 13px);
  color: #9eb4c8;
  line-height: 1.45;
}
.rad-list .obj {
  color: #ff8ab8;
  margin-bottom: 0.15rem;
}
.rad-list .obj::before {
  content: "▶ ";
  color: #49bbdf;
  font-size: 0.75em;
}

/* ----- overlays ----- */
#menu, #results {
  position: absolute; inset: 0; z-index: 8;
  display: flex; align-items: center; justify-content: center;
  background: radial-gradient(ellipse at 50% 40%, rgba(40, 8, 36, 0.55), rgba(4, 8, 18, 0.82));
}
.menu-card {
  width: min(640px, 86vw);
  padding: 1.8rem 2rem 1.6rem;
  background: linear-gradient(180deg, rgba(10, 18, 36, 0.94), rgba(8, 12, 24, 0.96));
  border: 2px solid rgba(73, 187, 223, 0.5);
  box-shadow: 0 0 40px rgba(73, 187, 223, 0.18);
  clip-path: polygon(18px 0, 100% 0, 100% calc(100% - 18px), calc(100% - 18px) 100%, 0 100%, 0 18px);
  text-align: center;
}
.menu-lockup {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.8rem;
  margin-bottom: 1rem;
}
.menu-lockup img { width: 42px; height: 42px; object-fit: contain; }
.menu-title {
  font-family: "Orbitron", sans-serif;
  font-weight: 800;
  letter-spacing: 0.16em;
  font-size: clamp(16px, 2vw, 26px);
  color: #e8f6ff;
  text-shadow: 0 0 12px rgba(73, 187, 223, 0.5);
}
.menu-title.sm { font-size: clamp(16px, 1.6vw, 22px); }
.menu-sub {
  font-family: "Rajdhani", sans-serif;
  font-weight: 700;
  letter-spacing: 0.2em;
  font-size: 12px;
  color: #49bbdf;
  margin-top: 4px;
}
.menu-blurb {
  font-family: "Exo 2", sans-serif;
  font-size: 14px;
  line-height: 1.55;
  color: #b8cce0;
  margin: 0.6rem 0 1.2rem;
}
#btn-play, #btn-again {
  pointer-events: auto;
  cursor: pointer;
  font-family: "Orbitron", sans-serif;
  font-weight: 800;
  letter-spacing: 0.16em;
  font-size: 13px;
  color: #071018;
  background: linear-gradient(90deg, #49bbdf, #7af0ff);
  border: none;
  padding: 0.75rem 1.4rem;
  box-shadow: 0 0 18px rgba(73, 187, 223, 0.45);
}
#btn-play:hover, #btn-again:hover { filter: brightness(1.08); }
.menu-controls {
  margin-top: 1rem;
  font-family: "Rajdhani", sans-serif;
  font-weight: 700;
  font-size: 13px;
  color: #8aa4b8;
  line-height: 1.55;
}
kbd {
  display: inline-block;
  padding: 0 0.28em;
  border: 1px solid rgba(73, 187, 223, 0.4);
  border-radius: 3px;
  color: #7af0ff;
  font-family: inherit;
}
.res-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.55rem 1.2rem;
  margin: 1rem 0 1.3rem;
  font-family: "Rajdhani", sans-serif;
  font-weight: 700;
  color: #8aa4b8;
  letter-spacing: 0.1em;
}
.res-grid b {
  display: block;
  font-family: "Orbitron", sans-serif;
  color: #7af0ff;
  font-size: 1.15em;
  margin-top: 2px;
}

#banner {
  position: absolute;
  top: 18%;
  left: 50%;
  transform: translateX(-50%);
  z-index: 7;
  font-family: "Orbitron", sans-serif;
  font-weight: 800;
  letter-spacing: 0.18em;
  font-size: clamp(14px, 1.6vw, 22px);
  color: #7af0ff;
  text-shadow: 0 0 16px rgba(73, 187, 223, 0.8);
  pointer-events: none;
}
#pause {
  position: absolute; inset: 0; z-index: 9;
  display: flex; align-items: center; justify-content: center;
  background: rgba(4, 8, 16, 0.55);
  font-family: "Orbitron", sans-serif;
  letter-spacing: 0.28em;
  font-size: 28px;
  color: #7af0ff;
}
#hitflash {
  position: absolute; inset: 0; z-index: 6;
  pointer-events: none;
  background: radial-gradient(ellipse at center, transparent 40%, rgba(244, 63, 94, 0.35));
  opacity: 0;
}
.hidden { display: none !important; }

@media (max-width: 1100px) {
  #frame-l, #frame-r { width: 4%; }
  #telemetry, #radar-panel { width: min(300px, 32vw); }
}
