/* FORGELINE — UI skin. Dark glass sci-fi: blurred panels, hairline accents,
   crisp system type, motion under 150ms. Owned by the hud module. */

:root {
  --bg:         #070a13;
  --hull-light: #8d99ae;
  --hull-mid:   #5c6678;
  --hull-dark:  #2f3542;
  --accent:     #e8a33d;
  --accent2:    #3d9de8;
  --accent3:    #66e0c2;
  --danger:     #e8503d;
  --good:       #7de87a;
  --text:       #dfe6f0;
  --dim:        #8792a6;
  --pirate:     #b03a2e;
  --station:    #3d7de8;
  /* guided-tutorial gold — must match GUIDE_GOLD in js/ui/editor.js so the
     pulsing palette button and the pulsing target cell read as one thing */
  --guide:      #ffc861;

  --glass:      linear-gradient(175deg, rgba(20,27,45,.80), rgba(8,11,20,.88));
  --glass-solid:linear-gradient(175deg, rgba(20,27,45,.94), rgba(8,11,20,.97));
  --edge:       rgba(141,153,174,.20);
  --edge-soft:  rgba(141,153,174,.10);
  --shadow:     0 10px 34px rgba(0,0,0,.50), inset 0 1px 0 rgba(255,255,255,.055);

  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  width: 100%; height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 13px;
  line-height: 1.35;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
  overscroll-behavior: none;
}

#game-canvas {
  position: fixed; inset: 0;
  width: 100%; height: 100%;
  display: block;
  cursor: crosshair;
  background: var(--bg);
}

#ui-root { position: fixed; inset: 0; pointer-events: none; z-index: 10; }

.hud { position: absolute; inset: 0; pointer-events: none; }
.hud .pe { pointer-events: auto; }

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: rgba(255,255,255,.03); border-radius: 4px; }
::-webkit-scrollbar-thumb { background: rgba(141,153,174,.24); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: rgba(141,153,174,.40); }

/* ------------------------------------------------------------ primitives -- */
.panel {
  background: var(--glass);
  -webkit-backdrop-filter: blur(13px) saturate(150%);
  backdrop-filter: blur(13px) saturate(150%);
  border: 1px solid var(--edge);
  border-radius: 9px;
  box-shadow: var(--shadow);
}

.lbl {
  font-size: 9px; letter-spacing: .14em; text-transform: uppercase;
  color: var(--dim); font-weight: 600; white-space: nowrap;
}

.num { font-family: var(--mono); font-variant-numeric: tabular-nums; }

.kc {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 21px; height: 20px; padding: 0 6px; margin: 0 1px;
  font-family: var(--mono); font-size: 11px; font-weight: 700; line-height: 1;
  color: #eef3fb;
  background: linear-gradient(180deg, #313b52, #171d2b);
  border: 1px solid rgba(141,153,174,.34);
  border-bottom-color: rgba(0,0,0,.65);
  border-radius: 5px;
  box-shadow: 0 2px 0 rgba(0,0,0,.45), inset 0 1px 0 rgba(255,255,255,.10);
  vertical-align: middle;
  white-space: nowrap;
}
.kc.wide { min-width: 46px; }

.bar {
  position: relative; height: 6px; width: 92px;
  background: rgba(255,255,255,.07);
  border-radius: 3px; overflow: hidden;
  box-shadow: inset 0 0 0 1px rgba(0,0,0,.35);
}
.bar > i {
  display: block; height: 100%; width: 0;
  border-radius: 3px;
  background: var(--accent3);
  transition: width 120ms linear, background-color 150ms linear;
}
.bar.thin { height: 4px; }

.btn {
  font-family: var(--sans); font-size: 11px; font-weight: 700;
  letter-spacing: .06em; text-transform: uppercase;
  color: var(--text);
  background: linear-gradient(180deg, rgba(60,72,98,.55), rgba(24,31,48,.75));
  border: 1px solid rgba(141,153,174,.26);
  border-radius: 5px;
  padding: 5px 9px;
  cursor: pointer;
  transition: background-color 120ms, border-color 120ms, transform 90ms, color 120ms;
}
.btn:hover { border-color: rgba(141,153,174,.55); background: linear-gradient(180deg, rgba(78,93,124,.6), rgba(32,41,62,.8)); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .32; cursor: default; transform: none; }
.btn:disabled:hover { border-color: rgba(141,153,174,.26); }
.btn.acc { color: #1a1206; background: linear-gradient(180deg, #f0b558, #d08a26); border-color: #f3c37a; }
.btn.acc:hover { background: linear-gradient(180deg, #ffc76b, #e09a2e); }
.btn.dim { color: var(--dim); }
.btn.big { font-size: 13px; padding: 11px 22px; letter-spacing: .1em; }

/* --------------------------------------------------------------- top bar -- */
.topbar {
  position: absolute; top: 14px; left: 14px;
  display: flex; align-items: center; gap: 0;
  height: 46px; padding: 0 4px;
  border-radius: 10px;
  background: var(--glass);
  -webkit-backdrop-filter: blur(13px) saturate(150%);
  backdrop-filter: blur(13px) saturate(150%);
  border: 1px solid var(--edge);
  box-shadow: var(--shadow);
}
.tb-seg { position: relative; display: flex; align-items: center; gap: 8px; padding: 0 13px; height: 100%; }
.tb-seg + .tb-seg { border-left: 1px solid var(--edge-soft); }
.tb-credits { padding-right: 62px; }
.tb-col { display: flex; flex-direction: column; gap: 4px; }
.sub-num {
  font-family: var(--mono); font-size: 9.5px; font-weight: 700;
  letter-spacing: .04em; color: var(--dim); margin-left: 8px;
}
.sub-num.bad { color: var(--danger); }

.brand {
  font-size: 13px; font-weight: 800; letter-spacing: .26em;
  color: var(--text);
  padding: 0 4px;
  text-shadow: 0 0 14px rgba(232,163,61,.45);
}
.brand b { color: var(--accent); font-weight: 800; }

.cr-wrap { position: relative; display: flex; align-items: baseline; gap: 6px; }
.cr-mark { color: var(--accent); font-size: 13px; font-weight: 700; }
.cr-val {
  font-family: var(--mono); font-size: 19px; font-weight: 700; letter-spacing: .01em;
  color: var(--text); font-variant-numeric: tabular-nums;
  transition: color 150ms linear, text-shadow 150ms linear;
}
.cr-val.up { color: #ffd98a; text-shadow: 0 0 12px rgba(232,163,61,.7); }
.cr-delta {
  position: absolute; right: 10px; top: 17px;
  font-family: var(--mono); font-size: 12px; font-weight: 700;
  color: var(--good); white-space: nowrap;
  animation: floatUp 1100ms cubic-bezier(.2,.7,.3,1) forwards;
  pointer-events: none;
}
.cr-delta.neg { color: var(--danger); }
@keyframes floatUp {
  0%   { opacity: 0; transform: translateY(5px); }
  18%  { opacity: 1; transform: translateY(0); }
  100% { opacity: 0; transform: translateY(-11px); }
}

.zone-chip {
  display: flex; align-items: center; gap: 7px;
  padding: 5px 11px; border-radius: 6px;
  border: 1px solid currentColor;
  font-size: 10px; font-weight: 800; letter-spacing: .16em; text-transform: uppercase;
  transition: color 150ms, background-color 150ms;
}
.zone-chip .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; box-shadow: 0 0 8px currentColor; }
.zone-chip.z-core   { color: var(--accent3); background: rgba(102,224,194,.09); }
.zone-chip.z-fringe { color: var(--accent);  background: rgba(232,163,61,.10); }
.zone-chip.z-open   { color: var(--danger);  background: rgba(232,80,61,.11); }

.topbar.critical { border-color: rgba(232,80,61,.55); animation: critPulse 1.1s ease-in-out infinite; }
@keyframes critPulse {
  0%, 100% { box-shadow: var(--shadow), 0 0 0 rgba(232,80,61,0); }
  50%      { box-shadow: var(--shadow), 0 0 22px rgba(232,80,61,.35); }
}

/* ----------------------------------------------------------- cargo strip -- */
.cargo {
  position: absolute; top: 72px; left: 14px;
  display: flex; align-items: center; gap: 6px;
  padding: 7px 9px;
  background: var(--glass);
  -webkit-backdrop-filter: blur(13px) saturate(150%);
  backdrop-filter: blur(13px) saturate(150%);
  border: 1px solid var(--edge);
  border-radius: 9px;
  box-shadow: var(--shadow);
}
.cchip {
  display: flex; align-items: center; gap: 6px;
  padding: 4px 8px 4px 5px;
  border-radius: 6px;
  background: rgba(255,255,255,.035);
  border: 1px solid rgba(141,153,174,.13);
  transition: opacity 150ms, border-color 150ms, background-color 150ms;
}
.cchip.empty { opacity: .38; }
.cchip canvas { display: block; width: 16px; height: 16px; image-rendering: auto; }
.cchip .n {
  font-family: var(--mono); font-size: 13px; font-weight: 700;
  font-variant-numeric: tabular-nums; min-width: 16px; text-align: right;
}
.cchip.fa { animation: chipFlash 420ms ease-out; }
.cchip.fb { animation: chipFlash 420ms ease-out; }
@keyframes chipFlash {
  0%   { background: rgba(232,163,61,.45); border-color: rgba(232,163,61,.8); transform: scale(1.09); }
  100% { background: rgba(255,255,255,.035); border-color: rgba(141,153,174,.13); transform: scale(1); }
}
.cargo-cap { display: flex; flex-direction: column; gap: 4px; padding-left: 6px; margin-left: 2px; border-left: 1px solid var(--edge-soft); }
.cargo-cap .bar { width: 66px; }

/* --------------------------------------------------------------- minimap -- */
.mm {
  position: absolute; top: 14px; right: 14px;
  width: 198px; padding: 9px;
  background: var(--glass);
  -webkit-backdrop-filter: blur(13px) saturate(150%);
  backdrop-filter: blur(13px) saturate(150%);
  border: 1px solid var(--edge);
  border-radius: 10px;
  box-shadow: var(--shadow);
}
.mm-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.mm canvas { display: block; width: 180px; height: 180px; border-radius: 50%; }
.mm-foot {
  display: flex; justify-content: space-between; gap: 6px;
  margin-top: 7px; padding-top: 6px; border-top: 1px solid var(--edge-soft);
  font-family: var(--mono); font-size: 10px; color: var(--dim);
  font-variant-numeric: tabular-nums;
}
.mm-foot b { color: var(--danger); font-weight: 700; }

/* ---------------------------------------------------------------- toasts -- */
.toasts {
  position: absolute; top: 118px; left: 14px;
  display: flex; flex-direction: column; gap: 7px;
  width: 262px;
}
.toast {
  display: flex; gap: 9px; align-items: flex-start;
  padding: 8px 11px;
  background: var(--glass);
  -webkit-backdrop-filter: blur(11px) saturate(140%);
  backdrop-filter: blur(11px) saturate(140%);
  border: 1px solid var(--edge);
  border-left: 2px solid var(--hull-mid);
  border-radius: 7px;
  box-shadow: 0 8px 22px rgba(0,0,0,.45);
  animation: toastIn 150ms cubic-bezier(.2,.8,.3,1);
  transition: opacity 220ms ease, transform 220ms ease;
}
.toast.out { opacity: 0; transform: translateX(-14px); }
.toast .ti { flex: 1 1 auto; min-width: 0; }
.toast .tt { font-size: 11px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; }
.toast .tb { font-size: 12px; color: var(--text); opacity: .88; margin-top: 2px; word-wrap: break-word; }
.toast .tv { font-family: var(--mono); font-size: 13px; font-weight: 700; align-self: center; white-space: nowrap; }
.toast.t-good { border-left-color: var(--good); }
.toast.t-good .tt, .toast.t-good .tv { color: var(--good); }
.toast.t-bad  { border-left-color: var(--danger); }
.toast.t-bad .tt, .toast.t-bad .tv { color: var(--danger); }
.toast.t-info { border-left-color: var(--accent2); }
.toast.t-info .tt { color: var(--accent2); }
.toast.t-warn { border-left-color: var(--accent); }
.toast.t-warn .tt { color: var(--accent); }
.toast.t-step { border-left-color: var(--accent3); background: linear-gradient(175deg, rgba(24,44,44,.84), rgba(8,14,20,.9)); }
.toast.t-step .tt { color: var(--accent3); }
@keyframes toastIn {
  from { opacity: 0; transform: translateX(-16px) scale(.98); }
  to   { opacity: 1; transform: none; }
}

/* --------------------------------------------------------- bottom stack -- */
.bottom {
  position: absolute; left: 0; right: 0; bottom: 16px;
  display: flex; flex-direction: column; align-items: center; gap: 9px;
  pointer-events: none;
}

.hint {
  display: none; align-items: center; gap: 10px;
  max-width: min(640px, 86vw);
  padding: 9px 12px;
  background: var(--glass);
  -webkit-backdrop-filter: blur(13px) saturate(150%);
  backdrop-filter: blur(13px) saturate(150%);
  border: 1px solid rgba(102,224,194,.30);
  border-radius: 9px;
  box-shadow: 0 10px 30px rgba(0,0,0,.5), inset 0 1px 0 rgba(255,255,255,.05);
  animation: hintIn 150ms cubic-bezier(.2,.8,.3,1);
}
.hint.show { display: flex; }
.hint .pip { width: 7px; height: 7px; border-radius: 50%; background: var(--accent3); box-shadow: 0 0 10px var(--accent3); flex: none; animation: pipPulse 1.8s ease-in-out infinite; }
@keyframes pipPulse { 0%,100% { opacity: .45; } 50% { opacity: 1; } }
.hint .hbody { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.hint .txt { font-size: 13.5px; color: var(--text); letter-spacing: .01em; }
/* the "why" line: the reason a step is worth doing, never the instruction */
.hint .why { font-size: 11.5px; color: var(--dim); letter-spacing: .01em; line-height: 1.35; }
.hint .why:empty { display: none; }
.hint .skip {
  margin-left: 4px; padding-left: 10px; border-left: 1px solid var(--edge-soft);
  cursor: pointer; opacity: .8; transition: opacity 120ms;
  align-self: center; flex: none;
}
.hint .skip:hover { opacity: 1; }
/* a guided step is pointing at something on screen — match the target's gold */
.hint.guided { border-color: rgba(255,200,97,.42); box-shadow: 0 10px 30px rgba(0,0,0,.5), 0 0 22px rgba(232,163,61,.16), inset 0 1px 0 rgba(255,255,255,.05); }
.hint.guided .pip { background: var(--guide); box-shadow: 0 0 10px var(--guide); }
@keyframes hintIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.dockprompt {
  display: none; align-items: center; gap: 10px;
  padding: 8px 14px;
  border-radius: 9px;
  background: var(--glass);
  -webkit-backdrop-filter: blur(13px);
  backdrop-filter: blur(13px);
  border: 1px solid rgba(61,125,232,.42);
  box-shadow: 0 0 26px rgba(61,125,232,.20), var(--shadow);
  font-size: 12.5px;
}
.dockprompt.show { display: flex; }
.dockprompt .d { font-family: var(--mono); color: var(--dim); font-size: 11px; }
.dockprompt.ready { border-color: rgba(102,224,194,.6); box-shadow: 0 0 30px rgba(102,224,194,.28), var(--shadow); animation: dockPulse 1.2s ease-in-out infinite; }
@keyframes dockPulse { 0%,100% { border-color: rgba(102,224,194,.45); } 50% { border-color: rgba(102,224,194,.9); } }

.buildbadge {
  display: none; align-items: center; gap: 9px;
  padding: 5px 12px; border-radius: 7px;
  background: rgba(232,163,61,.13);
  border: 1px solid rgba(232,163,61,.4);
  color: var(--accent);
  font-size: 10px; font-weight: 800; letter-spacing: .18em; text-transform: uppercase;
}
.buildbadge.show { display: flex; }
.buildbadge .warn { color: var(--danger); letter-spacing: .04em; text-transform: none; font-weight: 600; font-size: 11px; }

/* --------------------------------------------------------- build palette -- */
.palette {
  display: none; flex-direction: column; gap: 8px;
  max-width: min(1180px, 96vw);
  padding: 10px 12px 9px;
  background: var(--glass-solid);
  -webkit-backdrop-filter: blur(15px) saturate(150%);
  backdrop-filter: blur(15px) saturate(150%);
  border: 1px solid var(--edge);
  border-radius: 11px;
  box-shadow: var(--shadow);
}
.palette.show { display: flex; }
.pal-rows { display: flex; align-items: stretch; gap: 10px; flex-wrap: wrap; justify-content: center; }
.pal-group { display: flex; flex-direction: column; gap: 5px; padding-right: 10px; border-right: 1px solid var(--edge-soft); }
.pal-group:last-child { border-right: none; padding-right: 0; }
.pal-glabel { font-size: 10px; letter-spacing: .16em; text-transform: uppercase; font-weight: 800; opacity: .85; padding-left: 2px; }
.pal-btns { display: flex; gap: 5px; }

.pbtn {
  position: relative;
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  width: 68px; padding: 6px 3px 5px;
  background: rgba(255,255,255,.035);
  border: 1px solid rgba(141,153,174,.16);
  border-radius: 7px;
  cursor: pointer;
  transition: background-color 120ms, border-color 120ms, transform 90ms, opacity 120ms;
}
.pbtn:hover { background: rgba(255,255,255,.085); border-color: rgba(141,153,174,.42); transform: translateY(-1px); }
.pbtn:active { transform: translateY(0); }
.pbtn canvas { display: block; width: 28px; height: 28px; }
.pbtn .nm { font-size: 10px; letter-spacing: 0; color: var(--dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; text-align: center; }
.pbtn .cost { display: flex; gap: 4px; align-items: center; font-family: var(--mono); font-size: 10.5px; font-weight: 700; color: var(--dim); }
.pbtn .cost i { width: 5px; height: 5px; border-radius: 1px; display: inline-block; margin-right: 2px; }
.pbtn .idx {
  position: absolute; top: 2px; left: 3px;
  font-family: var(--mono); font-size: 9.5px; font-weight: 700; color: var(--dim); opacity: .7;
}
.pbtn.sel {
  background: rgba(232,163,61,.16);
  border-color: var(--accent);
  box-shadow: 0 0 16px rgba(232,163,61,.3), inset 0 0 0 1px rgba(232,163,61,.25);
}
.pbtn.sel .nm { color: var(--accent); }
.pbtn.na { opacity: .34; }
.pbtn.na canvas { filter: grayscale(1) brightness(.8); }
.pbtn.na .cost { color: var(--danger); }

/* guided tutorial: THIS button, this one right here. Gold to match the target
   cell drawn on the ship, with a caret so the eye lands on it instantly. */
.pbtn.guide {
  border-color: var(--guide);
  background: rgba(255,200,97,.14);
  animation: palGuide 1.15s ease-in-out infinite;
  z-index: 1;
}
.pbtn.guide .nm { color: var(--guide); }
.pbtn.guide::after {
  content: ''; position: absolute; left: 50%; top: -11px;
  width: 0; height: 0; margin-left: -6px;
  border: 6px solid transparent; border-top-color: var(--guide);
  animation: palCaret 1.15s ease-in-out infinite;
}
@keyframes palGuide {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255,200,97,.42), 0 0 14px rgba(255,200,97,.22); }
  50%      { box-shadow: 0 0 0 7px rgba(255,200,97,0), 0 0 24px rgba(255,200,97,.5); }
}
@keyframes palCaret {
  0%, 100% { transform: translateY(0); opacity: .75; }
  50%      { transform: translateY(4px); opacity: 1; }
}

.pal-foot {
  display: flex; align-items: center; justify-content: center; gap: 14px;
  padding-top: 7px; border-top: 1px solid var(--edge-soft);
  font-size: 11px; color: var(--dim);
}
.pal-foot span { display: inline-flex; align-items: center; gap: 4px; }
.pal-foot .rotarrow { font-family: var(--mono); color: var(--accent); font-size: 14px; font-weight: 700; }

/* -------------------------------------------------------------- tooltip -- */
.tip {
  position: absolute; z-index: 40;
  display: none; width: 232px;
  padding: 10px 11px;
  background: var(--glass-solid);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  border: 1px solid var(--edge);
  border-radius: 8px;
  box-shadow: 0 14px 36px rgba(0,0,0,.6);
  pointer-events: none;
}
.tip.show { display: block; }
.tip h4 { font-size: 13px; font-weight: 700; margin-bottom: 2px; }
.tip .cat { font-size: 8.5px; letter-spacing: .16em; text-transform: uppercase; font-weight: 800; margin-bottom: 6px; }
.tip .desc { font-size: 11.5px; color: var(--dim); line-height: 1.45; margin-bottom: 8px; }
.tip .rows { display: flex; flex-direction: column; gap: 3px; }
.tip .r { display: flex; justify-content: space-between; gap: 10px; font-size: 11px; }
.tip .r span:first-child { color: var(--dim); }
.tip .r span:last-child { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.tip .costline {
  display: flex; align-items: center; gap: 9px; flex-wrap: wrap;
  margin-top: 8px; padding-top: 7px; border-top: 1px solid var(--edge-soft);
  font-family: var(--mono); font-size: 11.5px;
}
.tip .costline .ci { display: inline-flex; align-items: center; gap: 4px; }
.tip .costline .ci.no { color: var(--danger); }
.tip .costline .ci i { width: 7px; height: 7px; border-radius: 2px; display: inline-block; }
.tip .costline .free { color: var(--good); }

/* ---------------------------------------------------------------- market -- */
.market {
  position: absolute; top: 270px; right: 14px;
  display: none; flex-direction: column;
  width: 306px; max-height: calc(100vh - 310px);
  background: var(--glass-solid);
  -webkit-backdrop-filter: blur(15px) saturate(150%);
  backdrop-filter: blur(15px) saturate(150%);
  border: 1px solid var(--edge);
  border-radius: 10px;
  box-shadow: var(--shadow);
  overflow: hidden;
  animation: mkIn 150ms cubic-bezier(.2,.8,.3,1);
}
.market.show { display: flex; }
@keyframes mkIn { from { opacity: 0; transform: translateX(14px); } to { opacity: 1; transform: none; } }
.mk-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 12px;
  border-bottom: 1px solid var(--edge-soft);
  background: linear-gradient(180deg, rgba(61,125,232,.16), rgba(61,125,232,0));
}
.mk-head .t { font-size: 11px; font-weight: 800; letter-spacing: .16em; text-transform: uppercase; color: var(--station); }
.mk-body { overflow-y: auto; padding: 8px 10px 10px; }
.mk-sub {
  font-size: 8.5px; letter-spacing: .16em; text-transform: uppercase; font-weight: 800;
  color: var(--dim); margin: 8px 0 5px; padding-bottom: 4px;
  border-bottom: 1px solid var(--edge-soft);
}
.mk-sub:first-child { margin-top: 0; }
.mk-row {
  display: grid; grid-template-columns: 18px 1fr auto; align-items: center;
  gap: 8px; padding: 5px 2px;
  border-radius: 5px;
  transition: background-color 120ms;
}
.mk-row:hover { background: rgba(255,255,255,.04); }
.mk-row canvas { display: block; width: 16px; height: 16px; }
.mk-name { font-size: 12px; display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.mk-name .n { font-weight: 600; }
.mk-name .s { font-family: var(--mono); font-size: 10px; color: var(--dim); }
.mk-name .s b { color: var(--text); font-weight: 700; }
.mk-name .s .lo { color: var(--danger); }
.mk-btns { display: flex; gap: 3px; }
.mk-btns .btn { padding: 4px 6px; font-size: 10px; min-width: 30px; }
.mk-foot {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 8px 12px; border-top: 1px solid var(--edge-soft);
  font-size: 11px; color: var(--dim);
}
.mk-note { font-size: 10.5px; color: var(--accent3); padding: 2px 2px 6px; }

/* ---------------------------------------------------------------- corner -- */
.corner {
  position: absolute; right: 14px; bottom: 12px;
  display: flex; align-items: center; gap: 10px;
  font-family: var(--mono); font-size: 10px; color: var(--dim); opacity: .62;
}
.corner .fps.warn { color: var(--accent); }
.corner .fps.bad { color: var(--danger); }
.corner .muted { color: var(--danger); }
.helpchip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 8px 3px 5px;
  background: rgba(255,255,255,.04);
  border: 1px solid var(--edge-soft);
  border-radius: 7px;
  color: var(--dim); cursor: pointer;
  font-family: var(--mono); font-size: 10px;
  transition: opacity 120ms, border-color 120ms, color 120ms;
}
.helpchip .kc { min-width: 17px; height: 16px; font-size: 9.5px; padding: 0 4px; }
.helpchip .hcl { letter-spacing: .12em; text-transform: uppercase; }
.helpchip:hover { color: var(--text); border-color: var(--edge); }

/* --------------------------------------------------------- zone banner -- */
/* The title card lands wherever the ships happen to be, so it carries its own
   backdrop: without it the subtitle disappears into a hull. */
.zonebanner {
  position: absolute; left: 50%; top: 21%;
  transform: translate(-50%, 0);
  display: flex; flex-direction: column; align-items: center; gap: 5px;
  padding: 14px 46px 15px;
  border-radius: 14px;
  background: radial-gradient(ellipse at center, rgba(6,9,17,.82) 0%, rgba(6,9,17,.62) 55%, rgba(6,9,17,0) 100%);
  opacity: 0; pointer-events: none;
  transition: opacity 260ms ease;
}
.zonebanner.show { opacity: 1; animation: zbIn 420ms cubic-bezier(.2,.8,.3,1); }
.zonebanner .zt {
  font-size: 30px; font-weight: 200; letter-spacing: .42em; text-indent: .42em; text-transform: uppercase;
  text-shadow: 0 2px 18px rgba(0,0,0,.95), 0 0 34px rgba(0,0,0,.8);
}
.zonebanner .zs {
  font-size: 11px; letter-spacing: .22em; text-transform: uppercase; color: #c3ccdb;
  text-shadow: 0 1px 10px rgba(0,0,0,.98), 0 0 20px rgba(0,0,0,.9);
}
@keyframes zbIn { from { transform: translate(-50%, 10px); opacity: 0; } to { transform: translate(-50%, 0); opacity: 1; } }

/* --------------------------------------------------------------- overlay -- */
.overlay {
  position: absolute; inset: 0;
  display: none; align-items: center; justify-content: center;
  background: radial-gradient(ellipse at center, rgba(6,9,17,.72), rgba(3,5,10,.92));
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  z-index: 30;
  animation: fadeIn 150ms ease;
}
.overlay.show { display: flex; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.modal {
  position: relative;
  width: min(620px, 92vw); max-height: 90vh; overflow-y: auto;
  padding: 22px 26px 18px;
  background: var(--glass-solid);
  border: 1px solid var(--edge);
  border-radius: 12px;
  box-shadow: 0 30px 80px rgba(0,0,0,.7), inset 0 1px 0 rgba(255,255,255,.06);
  animation: modalIn 150ms cubic-bezier(.2,.8,.3,1);
}
@keyframes modalIn { from { opacity: 0; transform: translateY(10px) scale(.985); } to { opacity: 1; transform: none; } }
/* Corner brackets sit ON the panel edge. Offsetting them outward left the arc
   floating clear of the border and reading as a clipping artifact. */
.modal::before, .modal::after {
  content: ''; position: absolute; width: 22px; height: 22px; pointer-events: none;
}
.modal::before { top: 0; left: 0; border-top: 2px solid var(--accent); border-left: 2px solid var(--accent); border-top-left-radius: 12px; }
.modal::after { bottom: 0; right: 0; border-bottom: 2px solid var(--accent); border-right: 2px solid var(--accent); border-bottom-right-radius: 12px; }
.modal.bad::before, .modal.bad::after { border-color: var(--danger); }
.modal.win::before, .modal.win::after { border-color: var(--accent3); }

.modal h1 { font-size: 24px; font-weight: 300; letter-spacing: .2em; text-transform: uppercase; margin-bottom: 3px; }
.modal.bad h1 { color: var(--danger); }
.modal.win h1 { color: var(--accent3); }
.modal .sub { font-size: 12.5px; color: var(--dim); margin-bottom: 15px; line-height: 1.5; }

.stats-grid {
  display: grid; grid-template-columns: repeat(3, 1fr);
  gap: 1px; background: var(--edge-soft);
  border: 1px solid var(--edge-soft); border-radius: 8px; overflow: hidden;
  margin-bottom: 18px;
}
.sitem { background: rgba(255,255,255,.025); padding: 10px 11px; }
.sitem .k { font-size: 8.5px; letter-spacing: .14em; text-transform: uppercase; color: var(--dim); font-weight: 700; }
.sitem .v { font-family: var(--mono); font-size: 19px; font-weight: 700; margin-top: 2px; font-variant-numeric: tabular-nums; }

.modal-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.modal-actions .note { font-size: 11px; color: var(--dim); }

/* ------------------------------------------------------------------ help -- */
.help-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 20px; margin-bottom: 14px; }
.help-col h3 {
  font-size: 9px; letter-spacing: .18em; text-transform: uppercase; color: var(--accent);
  font-weight: 800; margin-bottom: 6px; padding-bottom: 4px; border-bottom: 1px solid var(--edge-soft);
}
.help-col .row { display: flex; align-items: center; gap: 8px; padding: 2px 0; font-size: 12px; }
.help-col .row .keys { flex: none; min-width: 86px; }
.help-col .row .d { color: var(--dim); }
.help-tips { font-size: 11.5px; color: var(--dim); line-height: 1.55; }
.help-tips li { margin-left: 16px; margin-bottom: 3px; }
.help-tips b { color: var(--text); font-weight: 600; }

@media (max-width: 900px) {
  .help-cols { grid-template-columns: 1fr; gap: 14px; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .market { top: auto; bottom: 16px; max-height: 46vh; }
  .toasts { width: 220px; }
}
/* narrow viewports: topbar wraps instead of clipping, minimap drops below it */
@media (max-width: 960px) {
  .topbar { flex-wrap: wrap; max-width: calc(100vw - 28px); height: auto; min-height: 46px; }
  .tb-seg { height: 46px; }
  .mm { top: 74px; }
}
@media (max-width: 760px) {
  .tb-seg { padding: 0 8px; gap: 6px; }
  .tb-credits { padding-right: 24px; }
}
@media (max-width: 700px) {
  .mm { top: 122px; width: 172px; }
  .mm-head { gap: 8px; }
  .mm-head .lbl { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
}
@media (max-height: 700px) {
  .market { top: 270px; max-height: calc(100vh - 292px); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
}

/* ------------------------------------------------- integrator: fault bar -- */
.errbar {
  position: absolute; left: 50%; bottom: 18px;
  transform: translate(-50%, 8px);
  max-width: min(560px, 88vw);
  padding: 9px 14px;
  font-family: var(--mono); font-size: 11.5px; letter-spacing: .02em;
  color: #ffd7d0;
  background: linear-gradient(175deg, rgba(58,18,14,.92), rgba(20,7,6,.95));
  border: 1px solid rgba(232,80,61,.55);
  border-radius: 7px;
  box-shadow: 0 10px 34px rgba(0,0,0,.55), 0 0 24px rgba(232,80,61,.18);
  opacity: 0; pointer-events: none;
  transition: opacity 140ms ease, transform 140ms ease;
  z-index: 60;
}
.errbar.show { opacity: 1; transform: translate(-50%, 0); }
