/* Quatra Command, interface styles.
   One stylesheet, no framework, no web fonts: the whole thing has to load off
   shared hosting and start fast. Colours are a cold hull palette with an amber
   warning channel, so damage reads instantly against all the cyan. */

:root {
  --void:      #04060c;
  --void-2:    #080d18;
  --panel:     rgba(9, 16, 28, 0.72);
  --panel-line:rgba(120, 196, 255, 0.22);
  --ink:       #dceaff;
  --ink-dim:   #7e93b4;
  --ink-faint: #4d5f7d;
  --cyan:      #57d4ff;
  --cyan-hot:  #a8ecff;
  --amber:     #ffb547;
  --red:       #ff5d5d;
  --green:     #5dffa8;
  --violet:    #b78cff;
  --hud-font:  ui-monospace, "SF Mono", "Cascadia Mono", Menlo, Consolas, monospace;
  --ui-font:   system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  overflow: hidden;
  background: var(--void);
  color: var(--ink);
  font-family: var(--ui-font);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

#app { position: fixed; inset: 0; }

#scene {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  cursor: crosshair;
}

.layer { position: absolute; inset: 0; }
.hidden { display: none !important; }

.noscript {
  position: fixed; inset: 0; display: grid; place-items: center;
  background: var(--void); color: var(--ink); font-size: 18px;
}

/* ============================ shared bits ============================ */

.panel {
  background: var(--panel);
  border: 1px solid var(--panel-line);
  border-radius: 10px;
  padding: 9px 12px;
  backdrop-filter: blur(7px);
  -webkit-backdrop-filter: blur(7px);
}

.label {
  font-family: var(--hud-font);
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-dim);
}

.sub {
  font-family: var(--hud-font);
  font-size: 10.5px;
  letter-spacing: 0.06em;
  color: var(--ink-faint);
  margin-top: 3px;
}

.bar {
  position: relative;
  height: 7px;
  border-radius: 4px;
  background: rgba(120, 170, 230, 0.14);
  overflow: hidden;
}
.bar > i {
  position: absolute;
  inset: 0 auto 0 0;
  width: 0%;
  border-radius: 4px;
  background: var(--cyan);
  transition: width 0.12s linear, background-color 0.3s ease;
}
.bar.hull > i   { background: linear-gradient(90deg, #2fa8d8, #7ee6ff); }
.bar.hull.warn > i { background: linear-gradient(90deg, #d88f2f, var(--amber)); }
.bar.hull.crit > i { background: linear-gradient(90deg, #d83a3a, #ff8080); }
.bar.signal > i { background: linear-gradient(90deg, #8a6bd8, var(--violet)); }
.bar.signal.full > i { background: linear-gradient(90deg, #2fd88f, var(--green)); }
.bar.boost > i  { background: linear-gradient(90deg, #d8a52f, #ffe28a); }
.bar.thr > i    { background: linear-gradient(90deg, #2f7ed8, #8ac6ff); }

/* ============================== HUD ============================== */

#hud { pointer-events: none; user-select: none; }

.hud-top {
  position: absolute;
  top: max(14px, env(safe-area-inset-top));
  left: 14px;
  right: 14px;
  display: flex;
  gap: 12px;
  align-items: flex-start;
  justify-content: space-between;
}

.hull-panel { min-width: 210px; }
.hull-row { display: flex; align-items: center; gap: 10px; margin-top: 6px; }
.hull-row .bar { flex: 1; }
.hull-num {
  font-family: var(--hud-font);
  font-size: 21px;
  line-height: 1;
  font-weight: 600;
  color: var(--cyan-hot);
  min-width: 62px;
  text-align: right;
}
.hull-num span { font-size: 12px; color: var(--ink-dim); margin-left: 1px; }
.hull-panel.warn .hull-num { color: var(--amber); }
.hull-panel.crit .hull-num { color: var(--red); }

.obj-panel { flex: 0 1 420px; text-align: center; }
.obj {
  font-family: var(--hud-font);
  font-size: 12.5px;
  letter-spacing: 0.04em;
  color: var(--ink);
  margin: 5px 0 7px;
}
.signal-row {
  display: flex; align-items: center; gap: 8px;
}
.signal-label {
  font-family: var(--hud-font); font-size: 9.5px; letter-spacing: 0.14em;
  text-transform: uppercase; color: var(--ink-dim);
}
.signal-row .bar { flex: 1; }
.signal-num {
  font-family: var(--hud-font); font-size: 11px; color: var(--violet);
  min-width: 34px; text-align: right;
}
.signal-num.full { color: var(--green); }

.score-panel { min-width: 150px; text-align: right; }
.score {
  font-family: var(--hud-font);
  font-size: 26px;
  line-height: 1.05;
  font-weight: 600;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

.hud-left {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.chip {
  background: var(--panel);
  border: 1px solid var(--panel-line);
  border-radius: 8px;
  padding: 7px 10px;
  min-width: 104px;
  backdrop-filter: blur(7px);
  -webkit-backdrop-filter: blur(7px);
  transition: border-color 0.3s ease, transform 0.2s ease;
}
.chip.bump { transform: scale(1.08); border-color: var(--green); }
.chip-name {
  font-family: var(--hud-font); font-size: 9.5px; letter-spacing: 0.15em;
  text-transform: uppercase; color: var(--ink-dim); margin-bottom: 5px;
}
.pips { display: flex; gap: 3px; }
.pips i {
  width: 13px; height: 5px; border-radius: 2px;
  background: rgba(120, 170, 230, 0.18);
}
.pips i.on { background: var(--cyan); box-shadow: 0 0 6px rgba(87, 212, 255, 0.6); }
#chip-cannon .pips i.on { background: var(--amber); box-shadow: 0 0 6px rgba(255, 181, 71, 0.55); }
#chip-shield .pips i.on { background: var(--violet); box-shadow: 0 0 6px rgba(183, 140, 255, 0.55); }

.hud-bottom {
  position: absolute;
  left: 50%;
  bottom: max(16px, env(safe-area-inset-bottom));
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--panel);
  border: 1px solid var(--panel-line);
  border-radius: 11px;
  padding: 9px 15px;
  backdrop-filter: blur(7px);
  -webkit-backdrop-filter: blur(7px);
}
.gauge { width: 116px; }
.gauge-label {
  font-family: var(--hud-font); font-size: 9px; letter-spacing: 0.15em;
  text-transform: uppercase; color: var(--ink-dim); margin-bottom: 5px;
}
.speed-readout { text-align: center; min-width: 76px; }
.speed {
  font-family: var(--hud-font); font-size: 23px; line-height: 1; font-weight: 600;
  color: var(--cyan-hot); font-variant-numeric: tabular-nums;
}
.speed-unit {
  font-family: var(--hud-font); font-size: 9px; letter-spacing: 0.15em;
  text-transform: uppercase; color: var(--ink-faint); margin-top: 3px;
}

/* reticle ---------------------------------------------------------- */
.reticle {
  position: absolute; left: 50%; top: 50%;
  width: 78px; height: 78px;
  margin: -39px 0 0 -39px;
  opacity: 0.85;
}
.reticle svg { width: 100%; height: 100%; overflow: visible; }
.r-ring { fill: none; stroke: rgba(87, 212, 255, 0.42); stroke-width: 1.6; }
.r-tick { stroke: rgba(87, 212, 255, 0.7); stroke-width: 2.4; stroke-linecap: round; }
.r-dot  { fill: var(--cyan-hot); }
.reticle.hot .r-ring { stroke: rgba(255, 181, 71, 0.75); }
.reticle.hot .r-tick { stroke: var(--amber); }
.lock-label {
  position: absolute; left: 50%; top: 100%;
  transform: translateX(-50%);
  margin-top: 5px;
  font-family: var(--hud-font); font-size: 9.5px; letter-spacing: 0.16em;
  text-transform: uppercase; color: var(--amber); white-space: nowrap;
}

/* off-screen object markers ---------------------------------------- */
.tracker { position: absolute; inset: 0; }
.mark {
  position: absolute;
  transform: translate(-50%, -50%);
  font-family: var(--hud-font);
  font-size: 9.5px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  white-space: nowrap;
  color: var(--ink);
  will-change: transform, left, top;
}
.mark .box {
  width: 22px; height: 22px; margin: 0 auto 3px;
  border: 1.4px solid currentColor;
  border-radius: 3px;
  position: relative;
}
.mark .box::before, .mark .box::after {
  content: ""; position: absolute; background: currentColor;
}
.mark.base   { color: var(--red); }
.mark.pickup { color: var(--green); }
.mark.edge .box { border-radius: 50%; }
.mark .dist { display: block; text-align: center; opacity: 0.75; margin-top: 2px; }

/* popups ----------------------------------------------------------- */
.popups {
  position: absolute; left: 50%; top: 62%;
  transform: translateX(-50%);
  display: flex; flex-direction: column; align-items: center; gap: 5px;
}
.pop {
  font-family: var(--hud-font);
  font-size: 13px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--cyan-hot);
  text-shadow: 0 0 14px rgba(87, 212, 255, 0.55);
  animation: popRise 1.5s ease-out forwards;
}
.pop.good { color: var(--green); text-shadow: 0 0 14px rgba(93, 255, 168, 0.5); }
.pop.warn { color: var(--amber); text-shadow: 0 0 14px rgba(255, 181, 71, 0.5); }
.pop.bad  { color: var(--red);   text-shadow: 0 0 14px rgba(255, 93, 93, 0.5); }
.pop.big  { font-size: 19px; }
@keyframes popRise {
  0%   { opacity: 0; transform: translateY(10px) scale(0.94); }
  14%  { opacity: 1; transform: translateY(0) scale(1); }
  75%  { opacity: 1; }
  100% { opacity: 0; transform: translateY(-22px); }
}

/* warnings --------------------------------------------------------- */
.warn, .alarm {
  position: absolute; left: 50%; transform: translateX(-50%);
  font-family: var(--hud-font); font-size: 13px; letter-spacing: 0.2em;
  text-transform: uppercase; padding: 7px 16px; border-radius: 7px;
}
.warn {
  top: 24%;
  color: var(--amber);
  border: 1px solid rgba(255, 181, 71, 0.5);
  background: rgba(40, 26, 6, 0.6);
  animation: pulse 1.1s ease-in-out infinite;
}
.alarm {
  top: 31%;
  color: var(--red);
  border: 1px solid rgba(255, 93, 93, 0.5);
  background: rgba(42, 8, 8, 0.6);
  animation: pulse 0.7s ease-in-out infinite;
}
@keyframes pulse { 0%, 100% { opacity: 0.45; } 50% { opacity: 1; } }

.vignette {
  position: absolute; inset: 0;
  opacity: 0;
  background: radial-gradient(ellipse at center, transparent 42%, rgba(120, 8, 8, 0.85) 100%);
  transition: opacity 0.5s ease;
}
.hitflash {
  position: absolute; inset: 0;
  opacity: 0;
  background: rgba(255, 90, 90, 0.3);
  transition: opacity 0.18s ease-out;
}

/* ============================ screens ============================ */

.screen {
  display: grid;
  place-items: center;
  padding: 22px;
  overflow-y: auto;
  background:
    radial-gradient(1100px 700px at 50% -12%, rgba(40, 96, 168, 0.28), transparent 70%),
    radial-gradient(700px 500px at 88% 110%, rgba(140, 70, 200, 0.2), transparent 70%),
    rgba(3, 5, 10, 0.9);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
}

.screen-inner {
  width: min(980px, 100%);
  text-align: center;
  animation: fadeUp 0.45s ease-out both;
}
.screen-inner.narrow { width: min(560px, 100%); }
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: none; }
}

.wordmark {
  font-family: var(--hud-font);
  font-size: clamp(34px, 8.2vw, 76px);
  line-height: 0.98;
  letter-spacing: 0.02em;
  font-weight: 600;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0 0.34em;
}
.wm-q { color: var(--ink); }
.wm-c {
  color: var(--cyan);
  text-shadow: 0 0 34px rgba(87, 212, 255, 0.4);
}

.tagline {
  font-family: var(--hud-font);
  font-size: clamp(11px, 2.1vw, 14px);
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--ink-dim);
  margin: 14px 0 30px;
}

.kicker {
  font-family: var(--hud-font); font-size: 10.5px; letter-spacing: 0.26em;
  text-transform: uppercase; color: var(--cyan); margin-bottom: 9px;
}
.kicker.good { color: var(--green); }
.kicker.bad  { color: var(--red); }

.screen h1 {
  font-size: clamp(24px, 5vw, 40px);
  margin: 0 0 14px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.brief-line {
  color: var(--ink-dim);
  font-size: 14.5px;
  line-height: 1.65;
  max-width: 46ch;
  margin: 0 auto 22px;
}

.brief-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(232px, 1fr));
  gap: 12px;
  text-align: left;
  margin-bottom: 26px;
}
.brief-card {
  background: rgba(10, 18, 32, 0.6);
  border: 1px solid var(--panel-line);
  border-radius: 12px;
  padding: 15px 16px;
}
.brief-card h3 {
  font-family: var(--hud-font);
  font-size: 10.5px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--cyan);
  margin: 0 0 8px;
}
.brief-card p {
  margin: 0;
  font-size: 13px;
  line-height: 1.62;
  color: var(--ink-dim);
}

.brief-stats {
  list-style: none;
  margin: 0 0 24px;
  padding: 0;
  display: grid;
  gap: 1px;
  background: var(--panel-line);
  border: 1px solid var(--panel-line);
  border-radius: 10px;
  overflow: hidden;
  text-align: left;
}
.brief-stats li {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  padding: 10px 14px;
  background: rgba(8, 14, 26, 0.85);
  font-family: var(--hud-font);
  font-size: 12px;
}
.brief-stats li span:first-child {
  color: var(--ink-dim); letter-spacing: 0.1em; text-transform: uppercase; font-size: 10px;
  align-self: center;
}
.brief-stats li span:last-child { color: var(--ink); }
.brief-stats li.hi span:last-child { color: var(--green); }
.brief-stats li.lo span:last-child { color: var(--amber); }

/* --------------------------- cover art --------------------------- */
/* The artwork is the interface. It is letterboxed rather than cropped or
   stretched: the hotspots are positioned as percentages of the image, so any
   fit other than "contain" would slide the art out from under them. */

.cover-screen {
  padding: 0;
  background: #000;
}
.cover-frame {
  position: relative;
  display: block;
  line-height: 0;
}
.cover-frame img {
  display: block;
  max-width: 100vw;
  max-height: 100vh;
  width: auto;
  height: auto;
}

.hotspot {
  position: absolute;
  margin: 0;
  padding: 0;
  border: 1.5px solid transparent;
  border-radius: 4px;
  background: transparent;
  cursor: pointer;
  transition: border-color 0.15s ease, background-color 0.15s ease, box-shadow 0.15s ease;
}
/* Invisible until pointed at, so the artwork is not buried under chrome, but
   never invisible to keyboard focus. */
.hotspot:hover,
.hotspot:focus-visible {
  border-color: var(--cyan);
  background: rgba(87, 212, 255, 0.16);
  box-shadow: 0 0 18px rgba(87, 212, 255, 0.45), inset 0 0 12px rgba(87, 212, 255, 0.25);
  outline: none;
}
.hot-label {
  position: absolute;
  left: 50%;
  bottom: calc(100% + 7px);
  transform: translateX(-50%);
  font-family: var(--hud-font);
  font-size: 10px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--cyan);
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s ease;
}
.hotspot:hover .hot-label,
.hotspot:focus-visible .hot-label { opacity: 1; }

.cover-foot {
  position: absolute;
  left: 0;
  right: 0;
  bottom: max(10px, env(safe-area-inset-bottom));
  text-align: center;
  font-family: var(--hud-font);
  font-size: 10px;
  letter-spacing: 0.14em;
  color: var(--ink-faint);
  pointer-events: none;
}

/* No hover on a touch screen, so the targets must be visible from the off. */
@media (hover: none) {
  .hotspot { border-color: rgba(87, 212, 255, 0.55); background: rgba(87, 212, 255, 0.1); }
  .hot-label { opacity: 1; }
}

.controls-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(196px, 1fr));
  gap: 7px 18px;
  margin-bottom: 28px;
  text-align: left;
}
.controls-grid > div {
  display: flex; align-items: center; gap: 6px;
  font-size: 12.5px; color: var(--ink-dim);
}
.controls-grid span { margin-left: 3px; }
kbd {
  font-family: var(--hud-font);
  font-size: 10.5px;
  min-width: 21px;
  text-align: center;
  padding: 3px 6px;
  border-radius: 5px;
  border: 1px solid var(--panel-line);
  border-bottom-width: 2px;
  background: rgba(14, 24, 42, 0.9);
  color: var(--ink);
}

.btn-row { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.btn {
  font-family: var(--hud-font);
  font-size: 12px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink);
  background: rgba(16, 28, 48, 0.9);
  border: 1px solid var(--panel-line);
  border-radius: 9px;
  padding: 13px 26px;
  cursor: pointer;
  transition: transform 0.14s ease, border-color 0.2s ease, background-color 0.2s ease;
}
.btn:hover { border-color: var(--cyan); transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn.primary {
  background: linear-gradient(180deg, rgba(64, 178, 232, 0.95), rgba(28, 118, 172, 0.95));
  border-color: rgba(168, 236, 255, 0.65);
  color: #03121c;
  font-weight: 600;
}
.btn.primary:hover { filter: brightness(1.09); }

.record {
  font-family: var(--hud-font); font-size: 11px; letter-spacing: 0.12em;
  color: var(--ink-dim); margin-top: 18px; min-height: 15px;
}

/* ---------------------------- sponsor ---------------------------- */
/* The wordmark is white lettering on transparency, drawn for dark
   backgrounds, so it needs no plate behind it. It sits below the record line
   with real space around it rather than being crammed into the footer. */

.sponsor {
  margin: 26px auto 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 9px;
}
.sponsor-label {
  font-family: var(--hud-font);
  font-size: 9.5px;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--ink-faint);
}
.sponsor-logo {
  display: block;
  line-height: 0;
  opacity: 0.9;
  transition: opacity 0.2s ease, transform 0.2s ease;
}
.sponsor-logo:hover { opacity: 1; transform: translateY(-1px); }
.sponsor-logo:focus-visible {
  outline: 1px solid var(--cyan);
  outline-offset: 6px;
  border-radius: 4px;
}
.sponsor-logo img {
  display: block;
  width: 200px;
  height: auto;
  max-width: 62vw;
}
.sponsor.small { margin-top: 22px; }
.sponsor.small .sponsor-logo img { width: 140px; }
.foot {
  font-family: var(--hud-font); font-size: 10px; letter-spacing: 0.12em;
  color: var(--ink-faint); margin-top: 16px;
}

/* ============================= touch ============================= */

#touch { pointer-events: none; }
.stick {
  position: absolute;
  left: 22px; bottom: 26px;
  width: 128px; height: 128px;
  border-radius: 50%;
  border: 1px solid var(--panel-line);
  background: rgba(9, 16, 28, 0.5);
  pointer-events: auto;
  touch-action: none;
}
.stick > i {
  position: absolute; left: 50%; top: 50%;
  width: 48px; height: 48px; margin: -24px 0 0 -24px;
  border-radius: 50%;
  background: rgba(87, 212, 255, 0.35);
  border: 1px solid var(--cyan);
}
.touch-buttons {
  position: absolute; right: 20px; bottom: 24px;
  display: grid; grid-template-columns: repeat(2, auto); gap: 9px;
  pointer-events: auto;
}
.tbtn {
  font-family: var(--hud-font); font-size: 11px; letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink);
  background: rgba(16, 28, 48, 0.82);
  border: 1px solid var(--panel-line);
  border-radius: 12px;
  padding: 18px 20px;
  touch-action: none;
  cursor: pointer;
}
.tbtn.small { padding: 12px 16px; font-size: 10px; }
.tbtn:active { border-color: var(--cyan); background: rgba(30, 60, 96, 0.9); }

/* ============================ responsive ============================ */

@media (max-width: 860px) {
  .hud-top { flex-wrap: wrap; gap: 8px; }
  .obj-panel { order: 3; flex: 1 1 100%; }
  .hud-left { display: none; }
  .hull-panel { min-width: 0; flex: 1 1 auto; }
  .score-panel { min-width: 0; }
  .score { font-size: 20px; }
  .hull-num { font-size: 17px; min-width: 52px; }
  .gauge { width: 80px; }
  .hud-bottom { gap: 9px; padding: 7px 11px; }
  .speed { font-size: 18px; }
}

@media (max-width: 560px) {
  .brief-grid { grid-template-columns: 1fr; }
  .controls-grid { display: none; }
  .hud-bottom { bottom: auto; top: max(96px, env(safe-area-inset-top)); }
}

@media (prefers-reduced-motion: reduce) {
  .warn, .alarm { animation: none; opacity: 1; }
  .screen-inner { animation: none; }
}
