/* HUD chrome (DESIGN §10): chunky cartoon-RTS panels — navy glass, thick gold bevels, cyan accents.
   Everything is sized in em off #hud's font-size, which hud.js scales with the window (--k), so the HUD keeps
   its proportions from 1080p to 4K. Only panels take pointer events; the map stays draggable everywhere else. */

#hud {
  --k: 1;
  --edge: 0.8em;
  --gold: #ffc53d;
  --gold-hi: #ffe7a0;
  --gold-lo: #b7801a;
  --cyan: #39e5ff;
  --ink: #0b1026;
  --text: #eef3ff;
  --muted: #9fb0d8;
  --panel-top: rgba(33, 49, 102, 0.93);
  --panel-bot: rgba(14, 22, 48, 0.9);
  font-size: calc(14px * var(--k));
  line-height: 1.25;
  color: var(--text);
  font-family: var(--font-body);
}

#hud * { box-sizing: border-box; }
#hud [hidden] { display: none !important; }
#hud button { font: inherit; color: inherit; }
#hud svg { display: block; overflow: visible; }
#hud code { font-family: ui-monospace, 'Cascadia Mono', Consolas, monospace; }

/* ---- panel frame -------------------------------------------------------------------------------------------- */

#hud .panel,
#hud .plate {
  pointer-events: auto;
  background:
    linear-gradient(180deg, var(--panel-top), var(--panel-bot)) padding-box,
    linear-gradient(180deg, var(--gold-hi) 0%, var(--gold) 34%, var(--gold-lo) 100%) border-box;
  border: 0.16em solid transparent;
  border-radius: 0.95em;
  box-shadow:
    0 0.26em 0 rgba(3, 6, 18, 0.6),
    0 0.7em 1.5em rgba(0, 0, 0, 0.36),
    inset 0 0.12em 0 rgba(255, 255, 255, 0.14),
    inset 0 0 0 0.08em rgba(57, 229, 255, 0.14),
    inset 0 -0.4em 0.9em rgba(0, 0, 0, 0.22);
}
#hud .panel { position: absolute; }
#hud .plate { position: relative; }

/* corner rivets */
#hud .panel::after,
#hud .plate::after {
  content: '';
  position: absolute;
  inset: 0.2em;
  pointer-events: none;
  --rv: radial-gradient(circle, #fff3c9 0 0.07em, #c99426 0.08em 0.14em, rgba(0, 0, 0, 0.35) 0.15em 0.17em, transparent 0.18em);
  background:
    var(--rv) left top / 0.4em 0.4em no-repeat,
    var(--rv) right top / 0.4em 0.4em no-repeat,
    var(--rv) left bottom / 0.4em 0.4em no-repeat,
    var(--rv) right bottom / 0.4em 0.4em no-repeat;
  opacity: 0.9;
}

#hud .panel-head {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.45em;
  min-height: 2.25em;
  padding: 0.3em 0.45em 0.3em 0.75em;
  border-bottom: 0.1em solid rgba(255, 197, 61, 0.32);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.07), rgba(255, 255, 255, 0) 90%);
  border-radius: 0.8em 0.8em 0 0;
}
#hud .ph-t {
  font: 400 1.05em/1 var(--font-title);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #fff;
  text-shadow: 0 0.09em 0 var(--ink);
}
#hud .ph-s { font: 700 0.62em/1 var(--font-body); letter-spacing: 0.24em; text-transform: uppercase; color: #8fdcff; margin-top: 0.15em; }
#hud .ph-sp { flex: 1; }
#hud .ph-icon svg { width: 1.35em; height: 1.35em; }

#hud .mini-btn {
  width: 1.75em;
  height: 1.75em;
  display: grid;
  place-items: center;
  padding: 0;
  border: 0.1em solid var(--ink);
  border-radius: 0.45em;
  background: linear-gradient(180deg, #2c3f86, #172354);
  box-shadow: inset 0 0.08em 0 rgba(255, 255, 255, 0.18), 0 0.12em 0 #060a1c;
  cursor: pointer;
}
#hud .mini-btn svg { width: 1.05em; height: 1.05em; }
#hud .mini-btn:hover { background: linear-gradient(180deg, #3b56b2, #203272); }
#hud .mini-btn:active { transform: translateY(0.08em); box-shadow: inset 0 0.08em 0 rgba(255, 255, 255, 0.18), 0 0.04em 0 #060a1c; }

#hud .muted { color: var(--muted); }
#hud .ico-br { display: inline-block; width: 0.95em; height: 0.95em; margin-right: 0.25em; vertical-align: -0.12em; opacity: 0.9; }
#hud .st.br { display: inline-flex; align-items: center; text-transform: none; letter-spacing: 0.02em; }

/* ---- top bar ------------------------------------------------------------------------------------------------ */

#hud .topbar {
  position: absolute;
  left: var(--edge);
  right: var(--edge);
  top: 0.55em;
  height: 3.4em;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  pointer-events: none;
  z-index: 3;
}
#hud .topbar .plate { height: 3.4em; display: flex; align-items: center; }
#hud .tb-left { padding: 0 0.95em 0 0.4em; gap: 0.55em; }
#hud .tb-right { padding: 0 0.4em 0 0.9em; gap: 0.7em; }
#hud .tb-midwrap {
  position: absolute;
  left: 50%;
  top: 0;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  pointer-events: none;
}
#hud .tb-mid { padding: 0 0.35em; gap: 0.2em; border-radius: 0.4em 0.4em 1.05em 1.05em; }

/* logo */
#hud .logo {
  display: flex;
  align-items: center;
  gap: 0.35em;
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
}
#hud .logo .emblem {
  width: 2.55em;
  height: 2.75em;
  filter: drop-shadow(0 0.14em 0 rgba(0, 0, 0, 0.45)) drop-shadow(0 0 0.5em rgba(57, 229, 255, 0.35));
  transition: transform 0.25s cubic-bezier(0.2, 1.8, 0.4, 1);
}
#hud .logo:hover .emblem { transform: rotate(-8deg) scale(1.08); }
#hud .logo-t { display: flex; flex-direction: column; align-items: flex-start; }
#hud .logo-svg { height: 2.05em; width: 14.6em; }
#hud .logo-sub {
  margin-top: 0.2em;
  padding-left: 0.15em;
  font: 700 0.5em/1 var(--font-body);
  letter-spacing: 0.34em;
  text-transform: uppercase;
  color: #8fb6ff;
  white-space: nowrap;
}
#hud .lt { font-family: var(--font-title); letter-spacing: 0.5px; }
#hud .lt-ext { fill: #03050f; stroke: #03050f; stroke-width: 10px; stroke-linejoin: round; }
#hud .lt-out { fill: none; stroke: #0b1026; stroke-width: 7.5px; stroke-linejoin: round; }
#hud .lt-fill { fill: url(#cnc-logo-gold); }
#hud .lt-fill .amp { fill: url(#cnc-logo-cyan); }
#hud .lt-shine { fill: none; stroke: rgba(120, 66, 0, 0.55); stroke-width: 0.8px; }
#hud .lt-shine .amp { stroke: rgba(0, 60, 110, 0.5); }
#hud .lt-clip { font-family: var(--font-title); letter-spacing: 0.5px; }
#hud .lt-glint { animation: hud-glint 7s ease-in-out 1.5s infinite; }
@keyframes hud-glint { 0%, 78% { transform: translateX(0); } 100% { transform: translateX(470px); } }
#hud.rm .lt-glint { animation: none; opacity: 0; }

#hud .demo-badge {
  padding: 0.38em 0.6em 0.32em;
  border: 0.12em solid var(--ink);
  border-radius: 0.45em;
  background: linear-gradient(180deg, #c3a0ff, #7a4dff);
  box-shadow: 0 0.16em 0 #2e1a70, inset 0 0.1em 0 rgba(255, 255, 255, 0.35);
  font: 400 0.92em/1 var(--font-title);
  letter-spacing: 0.08em;
  color: #fff;
  text-shadow: 0 0.08em 0 #2e1a70;
  transform: rotate(-4deg);
  cursor: pointer;
  white-space: nowrap;
}
#hud .demo-badge:hover { transform: rotate(-2deg) scale(1.05); }

/* resource counters */
#hud .res {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.32em;
  height: 2.6em;
  padding: 0 0.75em 0 0.3em;
  border-radius: 0.6em;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.32), rgba(0, 0, 0, 0.14));
  box-shadow: inset 0 0.1em 0.25em rgba(0, 0, 0, 0.5), inset 0 -0.06em 0 rgba(255, 255, 255, 0.08);
  cursor: default;
}
#hud .res .ri svg { width: 1.95em; height: 1.95em; filter: drop-shadow(0 0.1em 0 rgba(0, 0, 0, 0.35)); }
#hud .res .rv { display: flex; flex-direction: column; align-items: flex-start; }
#hud .rv-n {
  font: 400 1.42em/1 var(--font-title);
  letter-spacing: 0.02em;
  color: #fff;
  text-shadow: 0 0.08em 0 var(--ink), 0 0 0.6em rgba(57, 229, 255, 0.22);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  transform-origin: 30% 60%;
}
#hud .res small { margin-top: 0.2em; font: 700 0.54em/1 var(--font-body); letter-spacing: 0.2em; text-transform: uppercase; color: var(--muted); }
#hud .res[data-k='tokens'] .rv-n { color: #bff6ff; }
#hud .res[data-k='cost'] .rv-n { color: #ffe38a; }
#hud .res.bump .rv-n { animation: hud-bump 0.6s ease; }
@keyframes hud-bump {
  0% { transform: scale(1); }
  30% { transform: scale(1.22); color: #ffe38a; }
  100% { transform: scale(1); }
}

/* NEEDS YOU pill (hangs below the resource tray) */
#hud .needs-pill {
  pointer-events: auto;
  margin-top: 0.5em;
  display: flex;
  align-items: center;
  gap: 0.45em;
  max-width: 34em;
  padding: 0.3em 0.95em 0.3em 0.35em;
  border: 0.14em solid #3a2a00;
  border-radius: 2em;
  background: linear-gradient(180deg, #fff09a, #ffc21f);
  color: #2a1d00;
  font: 700 0.95em/1 var(--font-body);
  letter-spacing: 0.06em;
  box-shadow: 0 0.22em 0 #7a5300, 0 0 1.2em rgba(255, 210, 63, 0.65);
  cursor: pointer;
  animation: hud-pill 1.1s ease-in-out infinite;
}
#hud .needs-pill svg { width: 1.55em; height: 1.55em; flex: none; }
#hud .needs-pill .np-t { white-space: nowrap; }
#hud .needs-pill b {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font: 400 1.12em/1 var(--font-title);
  letter-spacing: 0.02em;
  color: #1d1400;
}
#hud .np-more { flex: none; padding: 0.18em 0.45em; border-radius: 1em; background: #2a1d00; color: #ffd23f; font-size: 0.8em; }
#hud .needs-pill:hover { filter: brightness(1.08); }
@keyframes hud-pill {
  0%, 100% { transform: translateY(0) scale(1); }
  50% { transform: translateY(0.12em) scale(1.045); box-shadow: 0 0.1em 0 #7a5300, 0 0 2em rgba(255, 210, 63, 0.95); }
}

/* clock, connection light, buttons */
#hud .clock { display: flex; align-items: baseline; gap: 0.18em; cursor: default; white-space: nowrap; }
#hud .clock b { font: 400 1.5em/1 var(--font-title); color: #fff; text-shadow: 0 0.08em 0 var(--ink); letter-spacing: 0.02em; }
#hud .clock small { font: 700 0.62em/1 var(--font-body); letter-spacing: 0.1em; color: var(--muted); }
#hud .conn {
  display: flex;
  align-items: center;
  gap: 0.42em;
  padding: 0.38em 0.6em;
  border-radius: 0.5em;
  background: rgba(0, 0, 0, 0.32);
  box-shadow: inset 0 0.08em 0.2em rgba(0, 0, 0, 0.45);
  font: 700 0.7em/1 var(--font-body);
  letter-spacing: 0.2em;
  color: #c9d6f5;
  white-space: nowrap;
  cursor: default;
}
#hud .conn i { width: 0.8em; height: 0.8em; border-radius: 50%; background: #8a94a6; box-shadow: 0 0 0 0.14em rgba(0, 0, 0, 0.4); }
#hud .conn.c-live { color: #aaffcf; }
#hud .conn.c-live i { background: #3ddc84; box-shadow: 0 0 0 0.14em rgba(0, 0, 0, 0.4), 0 0 0.7em #3ddc84; animation: hud-live 1.8s ease-in-out infinite; }
#hud .conn.c-stale { color: #8fa89a; }
#hud .conn.c-stale i { background: #4f7a62; animation: hud-blink 1.6s steps(2, jump-none) infinite; }
#hud .conn.c-demo { color: #e2d4ff; }
#hud .conn.c-demo i { background: #b58cff; box-shadow: 0 0 0 0.14em rgba(0, 0, 0, 0.4), 0 0 0.7em #b58cff; }
#hud .conn.c-reconnecting { color: #ffd98a; }
#hud .conn.c-reconnecting i { background: #ffb020; animation: hud-blink 0.8s steps(2, jump-none) infinite; }
#hud .conn.c-connecting i { background: #7fa0ff; animation: hud-blink 1.1s steps(2, jump-none) infinite; }
@keyframes hud-live { 50% { opacity: 0.45; } }
@keyframes hud-blink { 0% { opacity: 1; } 100% { opacity: 0.15; } }

#hud .btns { display: flex; gap: 0.32em; }
#hud .btn {
  width: 2.35em;
  height: 2.35em;
  display: grid;
  place-items: center;
  padding: 0;
  border: 0.12em solid var(--ink);
  border-radius: 0.6em;
  background: linear-gradient(180deg, #2f438e, #172354);
  box-shadow: inset 0 0.1em 0 rgba(255, 255, 255, 0.2), 0 0.18em 0 #060a1c;
  cursor: pointer;
  transition: filter 0.15s;
}
#hud .btn svg { width: 1.45em; height: 1.45em; }
#hud .btn:hover { filter: brightness(1.25); }
#hud .btn:active { transform: translateY(0.1em); box-shadow: inset 0 0.1em 0 rgba(255, 255, 255, 0.2), 0 0.06em 0 #060a1c; }
#hud .btn.on { background: linear-gradient(180deg, #1cb2da, #0e5c84); }
#hud .btn.on.blocked { background: linear-gradient(180deg, #e0a52a, #8a5a06); }
#hud.drawer-open .btn[data-act='settings'] { background: linear-gradient(180deg, #ffe08a, #d99a1f); }

/* ---- minimap -------------------------------------------------------------------------------------------------- */

#hud .minimap { left: var(--edge); bottom: var(--edge); width: 18.5em; z-index: 2; }
#hud .mm-screen {
  position: relative;
  height: 14.5em;
  margin: 0.45em;
  border-radius: 0.6em;
  overflow: hidden;
  background: #0a2446;
  box-shadow: 0 0 0 0.12em rgba(0, 0, 0, 0.55), inset 0 0 1.5em rgba(0, 0, 0, 0.6);
}
#hud .mm-canvas { display: block; width: 100%; height: 100%; cursor: crosshair; touch-action: none; }
#hud .mm-sweep {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 160%;
  aspect-ratio: 1;
  translate: -50% -50%;
  pointer-events: none;
  border-radius: 50%;
  background: conic-gradient(from 0deg, rgba(57, 229, 255, 0) 0deg 290deg, rgba(57, 229, 255, 0.05) 330deg, rgba(57, 229, 255, 0.2) 359deg, rgba(57, 229, 255, 0) 360deg);
  mix-blend-mode: screen;
  animation: hud-sweep 5s linear infinite;
}
#hud .mm-glass {
  position: absolute;
  inset: 0;
  pointer-events: none;
  border-radius: inherit;
  background:
    radial-gradient(ellipse at 30% -10%, rgba(255, 255, 255, 0.14), transparent 55%),
    repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.03) 0 1px, transparent 1px 3px);
  box-shadow: inset 0 0 0 1px rgba(57, 229, 255, 0.3), inset 0 0 2em rgba(0, 20, 40, 0.5);
}
#hud .minimap.collapsed { width: auto; }
#hud .minimap.collapsed .mm-screen { display: none; }
#hud .minimap.collapsed .panel-head { border-bottom: 0; border-radius: 0.8em; }
@keyframes hud-sweep { to { transform: rotate(360deg); } }

/* ---- EVA log ---------------------------------------------------------------------------------------------------- */

#hud .eva {
  right: var(--edge);
  top: 4.75em;
  width: 24em;
  max-height: calc(100% - 4.75em - 17em);
  display: flex;
  flex-direction: column;
  z-index: 2;
  transition: opacity 0.2s;
}
#hud.drawer-open .eva { opacity: 0; pointer-events: none; }
#hud .eva.quiet:not(:hover) { opacity: 0.8; }
#hud .eva .rec { width: 0.62em; height: 0.62em; border-radius: 50%; background: #ff4d4d; box-shadow: 0 0 0.5em #ff4d4d, 0 0 0 0.12em rgba(0, 0, 0, 0.4); }
#hud .eva .rec.blip { animation: hud-rec 0.45s ease 4; }
@keyframes hud-rec { 50% { opacity: 0.2; } }
#hud .eva-list {
  list-style: none;
  margin: 0;
  padding: 0.4em 0.45em 0.5em;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: 0.3em;
}
#hud .eva.collapsed .eva-list,
#hud .eva.collapsed .eva-empty { display: none; }
#hud .eva.collapsed { width: auto; }
#hud .eva.collapsed .panel-head { border-bottom: 0; border-radius: 0.8em; }
#hud .eva-line {
  position: relative;
  display: grid;
  grid-template-columns: 1.95em minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.55em;
  padding: 0.4em 0.55em 0.4em 0.5em;
  border-radius: 0.55em;
  background: linear-gradient(90deg, color-mix(in srgb, var(--tone) 24%, rgba(0, 0, 0, 0.2)), rgba(255, 255, 255, 0.03) 75%);
  box-shadow: inset 0.24em 0 0 var(--tone), inset 0 0 0 0.07em rgba(255, 255, 255, 0.05);
  font-size: 0.93em;
  line-height: 1.28;
  cursor: pointer;
  transition: opacity 0.8s, filter 0.8s, transform 0.18s, background 0.2s;
}
#hud .eva-line:hover { transform: translateX(-0.25em); background: linear-gradient(90deg, color-mix(in srgb, var(--tone) 40%, rgba(0, 0, 0, 0.1)), rgba(255, 255, 255, 0.08) 80%); opacity: 1; filter: none; }
#hud .eva-line.picked { box-shadow: inset 0.24em 0 0 var(--tone), 0 0 0 0.12em var(--cyan); }
#hud .ev-ico svg { width: 1.95em; height: 1.95em; filter: drop-shadow(0 0.1em 0 rgba(0, 0, 0, 0.35)); }
#hud .ev-txt { overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; text-shadow: 0 0.06em 0 rgba(0, 0, 0, 0.5); }
#hud .ev-age { align-self: start; margin-top: 0.2em; font: 700 0.72em/1 var(--font-body); color: var(--muted); white-space: nowrap; }
#hud .eva-line.dim { opacity: 0.62; filter: saturate(0.7); }
#hud .eva-line.hist { opacity: 0.48; filter: saturate(0.5); }
#hud .eva-line.pinned { opacity: 1; filter: none; box-shadow: inset 0.24em 0 0 var(--tone), 0 0 0 0.09em color-mix(in srgb, var(--tone) 60%, transparent); }
#hud .eva-line.in { animation: hud-evain 0.55s cubic-bezier(0.2, 1.5, 0.4, 1) both; }
#hud .eva-line.out { opacity: 0; transform: translateX(1.2em); }
@keyframes hud-evain {
  0% { opacity: 0; transform: translateX(2em) scale(0.96); filter: brightness(2.2); }
  60% { filter: brightness(1.5); }
  100% { opacity: 1; transform: none; filter: none; }
}
#hud .eva-sep {
  display: flex;
  align-items: center;
  gap: 0.7em;
  margin: 0.15em 0.4em 0;
  font: 700 0.6em/1 var(--font-body);
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: #7383b3;
}
#hud .eva-sep::before, #hud .eva-sep::after { content: ''; flex: 1; height: 1px; background: rgba(143, 182, 255, 0.25); }
#hud .eva-sep.away { color: #9aa9d8; letter-spacing: 0.22em; }
#hud .eva-empty { padding: 0.7em 1em 0.9em; color: var(--muted); font-style: italic; font-size: 0.88em; }

/* highlighted values inside EVA lines */
#hud .e-name { color: var(--c, #fff); font-weight: 700; }
#hud .e-role { color: var(--c, #bff6ff); font-weight: 700; }
#hud .e-num { font: 400 1.08em/1 var(--font-title); letter-spacing: 0.02em; color: #fff; }
#hud .e-q { font-style: italic; color: #dde6ff; }
#hud .e-port { color: #7ff0d0; font-weight: 700; }
#hud .e-branch { color: #ffa6ee; font-weight: 700; }
#hud .e-hash { padding: 0 0.28em; border-radius: 0.25em; background: rgba(0, 0, 0, 0.35); color: #ffe38a; font-size: 0.86em; }
#hud .e-author { color: #ffd98a; font-weight: 700; }
#hud .e-isl { color: #ffe38a; font-weight: 700; }

/* ---- selection card ------------------------------------------------------------------------------------------------ */

#hud .card {
  left: 50%;
  bottom: var(--edge);
  width: min(52em, calc(100% - 2 * (18.5em + 2 * var(--edge))));
  max-height: min(46vh, 30em);
  display: flex;
  flex-direction: column;
  translate: -50% 0;
  z-index: 4;
}
#hud .card.in { animation: hud-cardin 0.38s cubic-bezier(0.2, 1.35, 0.4, 1) both; }
@keyframes hud-cardin { 0% { opacity: 0; transform: translateY(1.5em) scale(0.97); } 100% { opacity: 1; transform: none; } }
#hud .card-head {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.7em;
  padding: 0.5em 0.55em 0.5em 0.6em;
  border-bottom: 0.1em solid rgba(255, 197, 61, 0.32);
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0) 65%);
  border-radius: 0.8em 0.8em 0 0;
}
#hud .crest-wrap { flex: none; width: 3.2em; height: 2.6em; position: relative; }
#hud .crest-wrap > svg { position: absolute; left: 0; bottom: -0.2em; width: 3.2em; height: 3.52em; filter: drop-shadow(0 0.2em 0 rgba(0, 0, 0, 0.45)) drop-shadow(0 0 0.6em rgba(0, 0, 0, 0.35)); }
#hud .card .ttl { flex: 1; min-width: 0; }
#hud .card .nm {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font: 400 1.5em/1.08 var(--font-title);
  letter-spacing: 0.01em;
  color: #fff;
  text-shadow: 0 0.08em 0 var(--ink);
}
#hud .card .sub { margin-top: 0.18em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 0.82em; color: #b9c7ec; }
#hud .card .fac { color: var(--c); font-weight: 700; }
#hud .hchip { flex: none; display: flex; flex-direction: column; align-items: flex-end; gap: 0.3em; }
#hud .hchip .st { font-size: 0.86em; }
#hud .hchip .since { font-size: 0.72em; color: var(--muted); white-space: nowrap; }
#hud .card .x {
  flex: none;
  align-self: flex-start;
  width: 1.8em;
  height: 1.8em;
  display: grid;
  place-items: center;
  padding: 0;
  border: 0.1em solid var(--ink);
  border-radius: 0.5em;
  background: linear-gradient(180deg, #37488e, #1b2658);
  box-shadow: inset 0 0.08em 0 rgba(255, 255, 255, 0.18), 0 0.12em 0 #060a1c;
  cursor: pointer;
}
#hud .card .x svg { width: 1em; height: 1em; }
#hud .card .x:hover { background: linear-gradient(180deg, #d84a4a, #8e1f2c); }
#hud .ribbon {
  position: absolute;
  top: -0.85em;
  left: 4.4em;
  padding: 0.28em 0.6em 0.22em;
  border: 0.1em solid var(--ink);
  border-radius: 0.35em;
  background: linear-gradient(180deg, #ffe7a0, #ffc53d);
  color: #2a1d00;
  font: 400 0.72em/1 var(--font-title);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  box-shadow: 0 0.12em 0 #7a5300;
}
#hud .card-body {
  display: grid;
  grid-template-columns: minmax(0, 1.12fr) minmax(0, 1fr);
  gap: 0.6em 1.1em;
  padding: 0.6em 0.8em 0.75em;
  overflow: auto;
  min-height: 0;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 197, 61, 0.5) transparent;
}
#hud .card-body .col { min-width: 0; display: flex; flex-direction: column; gap: 0.55em; }
#hud .card-body .col.r { padding-left: 0.9em; border-left: 0.08em solid rgba(143, 182, 255, 0.16); }
#hud .card-body:has(> .col.r[hidden]) { grid-template-columns: 1fr; }
#hud .k-gone .card-body, #hud .k-unknown .card-body { grid-template-columns: 1fr; }
#hud .sec p { margin: 0; }
#hud .sec-h {
  display: flex;
  align-items: center;
  gap: 0.5em;
  margin-bottom: 0.35em;
  font: 700 0.64em/1 var(--font-body);
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: #8fdcff;
}
#hud .sec-h::after { content: ''; flex: 1; height: 1px; background: linear-gradient(90deg, rgba(143, 220, 255, 0.3), transparent); order: 1; }
#hud .sec-h em, #hud .sec-h .bricks { order: 2; }
#hud .sec-h em { font-style: normal; font-weight: 600; letter-spacing: 0.04em; text-transform: none; color: var(--muted); font-size: 1.15em; }
#hud .sec-h .st { order: 2; font-size: 1.05em; letter-spacing: 0.06em; }

#hud .doing {
  display: flex;
  align-items: center;
  gap: 0.55em;
  padding: 0.45em 0.65em;
  border-radius: 0.55em;
  background: rgba(0, 0, 0, 0.28);
  box-shadow: inset 0 0 0 0.08em rgba(255, 255, 255, 0.06);
  font-weight: 600;
}
#hud .doing span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#hud .doing small { color: var(--muted); font-weight: 700; font-size: 0.8em; }
#hud .doing.ds-needs_input { background: rgba(255, 210, 63, 0.17); box-shadow: inset 0 0 0 0.1em rgba(255, 210, 63, 0.65); color: #fff3c4; }
#hud .doing.ds-working { box-shadow: inset 0 0 0 0.08em rgba(47, 207, 120, 0.35); }
#hud .sdot { flex: none; width: 0.62em; height: 0.62em; border-radius: 50%; background: var(--c); box-shadow: 0 0 0.45em var(--c), 0 0 0 0.1em rgba(0, 0, 0, 0.4); }
#hud .doing.ds-working .sdot, #hud .doing.ds-needs_input .sdot { animation: hud-live 1.2s ease-in-out infinite; }

#hud .cbar { position: relative; height: 0.95em; border-radius: 0.5em; background: rgba(255, 255, 255, 0.1); box-shadow: inset 0 0.08em 0.22em rgba(0, 0, 0, 0.55); overflow: hidden; }
#hud .cbar i {
  position: absolute;
  inset: 0 auto 0 0;
  width: var(--p);
  border-radius: inherit;
  background: linear-gradient(180deg, color-mix(in srgb, var(--cc) 55%, white), var(--cc) 55%, color-mix(in srgb, var(--cc) 75%, black));
  box-shadow: 0 0 0.8em var(--cc);
  transition: width 0.6s ease;
}
#hud .cbar em { position: absolute; left: 80%; top: 0; bottom: 0; width: 0.12em; background: rgba(255, 255, 255, 0.45); }
#hud .cbar.hot i { animation: hud-hot 0.9s ease-in-out infinite; }
@keyframes hud-hot { 50% { filter: brightness(1.45); } }
#hud .cnum { display: flex; align-items: baseline; gap: 0.6em; margin-top: 0.32em; font-size: 0.9em; color: #c9d6f5; }
#hud .cnum b { font: 400 1.3em/1 var(--font-title); color: #fff; letter-spacing: 0.02em; }
#hud .cnum .pct { margin-left: auto; font: 400 1.35em/1 var(--font-title); color: var(--cc); text-shadow: 0 0.07em 0 var(--ink); }
#hud .bricks { display: flex; align-items: center; gap: 0.16em; }
#hud .bricks i { width: 0.95em; height: 0.58em; border-radius: 0.14em; background: linear-gradient(180deg, #d6fcff, #39e5ff); box-shadow: 0 0 0.4em rgba(57, 229, 255, 0.7), inset 0 -0.12em 0 rgba(0, 0, 0, 0.25); }
#hud .bricks b { font: 400 1.3em/1 var(--font-title); color: #bff6ff; letter-spacing: 0.02em; }

#hud .stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0.3em; }
#hud .stats.c3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
#hud .stats.one { grid-template-columns: repeat(2, minmax(0, 1fr)); }
#hud .stat.w2 { grid-column: span 2; }
#hud .stat {
  min-width: 0;
  padding: 0.3em 0.45em 0.34em;
  border-radius: 0.45em;
  background: rgba(255, 255, 255, 0.05);
  box-shadow: inset 0 0 0 0.07em rgba(255, 255, 255, 0.06);
  cursor: default;
}
#hud .stat small { display: block; margin-bottom: 0.22em; font: 700 0.58em/1 var(--font-body); letter-spacing: 0.15em; text-transform: uppercase; color: #8ea3d6; }
#hud .stat b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 700; font-size: 0.9em; color: #fff; }
#hud .stat b small { display: inline; font-size: 0.8em; letter-spacing: 0; color: var(--muted); }
#hud .stat.hot { background: rgba(255, 90, 77, 0.14); box-shadow: inset 0 0 0 0.08em rgba(255, 90, 77, 0.5); }
#hud .stat.hot b { color: #ff9a7a; }
#hud .chip-s.hot { background: rgba(255, 90, 77, 0.14); box-shadow: inset 0 0 0 0.08em rgba(255, 90, 77, 0.55); color: #ffd6c9; }
#hud .wt { display: flex; flex-direction: column; align-items: flex-start; gap: 0.18em; max-width: 100%; }
#hud .wt-st { padding-left: 0.7em; font-size: 0.74em; font-weight: 700; color: var(--muted); cursor: default; }
#hud .wt-st.hot { color: #ff9a7a; }
#hud .prs li { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 0.1em 0.5em; align-items: baseline; padding: 0.28em 0.5em;
  border-radius: 0.45em; background: rgba(255, 255, 255, 0.045); font-size: 0.88em; }
#hud .prs b { font: 400 1.1em/1 var(--font-title); color: #e86bff; }
#hud .prs small { color: var(--muted); font-weight: 700; font-size: 0.8em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#hud .prs code { grid-column: 1 / -1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 0.78em; color: #cfe0ff; user-select: all; cursor: text; }

#hud .mods { display: flex; flex-wrap: wrap; gap: 0.3em; }
#hud .mod {
  padding: 0.34em 0.55em 0.3em;
  border-radius: 0.4em;
  background: rgba(255, 197, 61, 0.1);
  box-shadow: inset 0 0 0 0.1em rgba(255, 197, 61, 0.35);
  color: #ffe38a;
  font: 700 0.72em/1 var(--font-body);
  letter-spacing: 0.04em;
  cursor: default;
}
#hud .mod b { margin-left: 0.15em; font: 400 1.1em/1 var(--font-title); color: #fff; }
#hud .mod.live { background: rgba(57, 229, 255, 0.2); color: #c8f8ff; box-shadow: inset 0 0 0 0.1em rgba(57, 229, 255, 0.75), 0 0 0.7em rgba(57, 229, 255, 0.45); }
#hud .mods .muted { font-size: 0.8em; font-style: italic; }

#hud .prompt {
  position: relative;
  margin: 0;
  padding: 0.5em 0.7em 0.5em 1.7em;
  border-radius: 0.55em;
  background: rgba(0, 0, 0, 0.24);
  font-size: 0.88em;
  font-style: italic;
  line-height: 1.38;
  color: #e0e8ff;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
#hud .prompt::before { content: '“'; position: absolute; left: 0.28em; top: 0.05em; font: 400 2.3em/1 var(--font-title); color: var(--gold); opacity: 0.85; }

#hud .brief { padding: 0.45em 0.7em 0.55em; border-radius: 0.55em; background: linear-gradient(180deg, rgba(255, 197, 61, 0.14), rgba(255, 197, 61, 0.05)); box-shadow: inset 0 0 0 0.08em rgba(255, 197, 61, 0.3); }
#hud .brief small { display: block; font: 700 0.6em/1 var(--font-body); letter-spacing: 0.22em; text-transform: uppercase; color: #ffd98a; }
#hud .brief p { margin: 0.25em 0 0; font: 400 1.12em/1.2 var(--font-title); letter-spacing: 0.01em; color: #fff; }

#hud .list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.22em; }
#hud .row {
  width: 100%;
  display: grid;
  grid-template-columns: 0.8em minmax(0, auto) minmax(0, 1fr) auto;
  grid-template-rows: auto auto;
  column-gap: 0.45em;
  row-gap: 0.12em;
  align-items: center;
  padding: 0.3em 0.5em;
  border: 0;
  border-radius: 0.45em;
  background: rgba(255, 255, 255, 0.045);
  text-align: left;
  cursor: pointer;
}
#hud .row:hover { background: rgba(57, 229, 255, 0.14); box-shadow: inset 0 0 0 0.08em rgba(57, 229, 255, 0.5); }
#hud .row .sdot { grid-row: 1 / span 2; }
#hud .rn { font-weight: 700; color: var(--c, #fff); white-space: nowrap; font-size: 0.92em; }
#hud .rd { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 0.86em; color: #dfe7ff; }
#hud .rt { grid-column: 4; grid-row: 1; font-size: 0.72em; color: var(--muted); font-weight: 700; }
#hud .rw { grid-column: 2 / span 3; grid-row: 2; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 0.74em; color: var(--muted); }
#hud .bases .rn { grid-column: 2 / span 3; overflow: hidden; text-overflow: ellipsis; }
#hud li.fin .row { opacity: 0.55; }
#hud li.appr .row { margin-left: 0.8em; width: calc(100% - 0.8em); }
#hud .more { font-size: 0.8em; padding-left: 0.5em; }

#hud .procs li {
  display: grid;
  grid-template-columns: auto minmax(2em, 1fr) auto;
  gap: 0.12em 0.5em;
  align-items: center;
  padding: 0.28em 0.5em;
  border-radius: 0.45em;
  background: rgba(255, 255, 255, 0.045);
  font-size: 0.88em;
  cursor: default;
}
#hud .procs small { color: var(--muted); font-weight: 700; font-size: 0.8em; white-space: nowrap; }
#hud .procs code { grid-column: 1 / -1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 0.78em; color: var(--muted); }
#hud .meter { height: 0.45em; border-radius: 0.3em; background: rgba(255, 255, 255, 0.1); overflow: hidden; }
#hud .meter i { display: block; height: 100%; width: var(--p); background: linear-gradient(90deg, #39e5ff, #ffc53d); border-radius: inherit; }

#hud .chips { display: flex; flex-wrap: wrap; gap: 0.3em; }
#hud .lnk, #hud .chip-s {
  display: inline-flex;
  align-items: center;
  gap: 0.35em;
  max-width: 100%;
  padding: 0.3em 0.55em;
  border: 0;
  border-radius: 0.45em;
  background: rgba(57, 229, 255, 0.1);
  box-shadow: inset 0 0 0 0.08em rgba(57, 229, 255, 0.35);
  color: #d4f7ff;
  font-size: 0.84em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
#hud .chip-s { background: rgba(255, 255, 255, 0.06); box-shadow: inset 0 0 0 0.08em rgba(255, 255, 255, 0.12); color: #dfe7ff; }
#hud .lnk { cursor: pointer; }
#hud .lnk:hover { background: rgba(57, 229, 255, 0.24); box-shadow: inset 0 0 0 0.1em rgba(57, 229, 255, 0.8); color: #fff; }
#hud .lnk b { color: #7ff0d0; }
#hud .where { display: flex; align-items: center; gap: 0.5em; min-width: 0; }
#hud .where code { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 0.74em; color: var(--muted); }
#hud .meta { display: flex; flex-wrap: wrap; gap: 0.3em 0.9em; margin-top: 0.35em; font-size: 0.74em; color: var(--muted); }
#hud .meta span + span::before { content: '·'; margin-right: 0.9em; color: rgba(159, 176, 216, 0.5); }
#hud .kv small { display: block; margin-bottom: 0.2em; font: 700 0.58em/1 var(--font-body); letter-spacing: 0.18em; text-transform: uppercase; color: #8ea3d6; }
#hud code.block {
  display: block;
  padding: 0.35em 0.5em;
  border-radius: 0.4em;
  background: rgba(0, 0, 0, 0.32);
  color: #cfe0ff;
  font-size: 0.78em;
  line-height: 1.35;
  word-break: break-all;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
#hud .addrs { margin-top: 0.35em; font-size: 0.74em; }
/* port card: ADRIFT (nobody is tending the server) */
#hud .sec[data-k="adrift"] .sec-h { color: #ffb35a; }
#hud .sec[data-k="adrift"] .sec-h::after { background: linear-gradient(90deg, rgba(255, 159, 58, 0.45), transparent); }
#hud .adrift-why { font-size: 0.9em; line-height: 1.35; color: #ffe0bd; }
#hud .adrift-why b { color: #fff; }
#hud .adrift-why .lnk { font-size: 0.95em; vertical-align: 0.05em; }
#hud .adrift-why + .meta { margin-top: 0.25em; }
#hud .copyline { display: flex; align-items: stretch; gap: 0.4em; }
#hud .copyline code.cmdline { flex: 1; min-width: 0; -webkit-line-clamp: 1; font-size: 0.82em; color: #ffe38a; user-select: all; cursor: text; }
#hud .copy {
  flex: none;
  padding: 0.3em 0.7em;
  border: 0;
  border-radius: 0.45em;
  background: rgba(255, 159, 58, 0.16);
  box-shadow: inset 0 0 0 0.08em rgba(255, 159, 58, 0.55);
  color: #ffd9a8;
  font-size: 0.8em;
  font-weight: 700;
  cursor: pointer;
}
#hud .copy:hover { background: rgba(255, 159, 58, 0.3); color: #fff; }
#hud .copy.ok { background: rgba(61, 220, 132, 0.2); box-shadow: inset 0 0 0 0.08em rgba(61, 220, 132, 0.7); color: #9dffc6; }
#hud .act { position: relative; height: 1em; border-radius: 0.5em; background: rgba(255, 255, 255, 0.1); box-shadow: inset 0 0.08em 0.22em rgba(0, 0, 0, 0.55); overflow: hidden; }
#hud .act i {
  position: absolute;
  inset: 0 auto 0 0;
  width: max(var(--p), 0.4em);
  border-radius: inherit;
  background: repeating-linear-gradient(-45deg, #39e5ff 0 0.45em, #1ea9cf 0.45em 0.9em);
  background-size: 1.27em 1.27em;
  box-shadow: 0 0 0.8em rgba(57, 229, 255, 0.6);
  animation: hud-stripes 1s linear infinite;
  transition: width 0.6s ease;
}
@keyframes hud-stripes { to { background-position: 1.27em 0; } }
#hud .blurb { font-style: italic; color: #cdd9f7; font-size: 0.9em; }
#hud .onmap { margin: 0 0 0.4em; font-size: 0.9em; color: #dfe7ff; }
#hud .onmap::before { content: '\25B8\00a0'; color: var(--gold); }
#hud .card-body.more { -webkit-mask-image: linear-gradient(180deg, #000 calc(100% - 2.2em), rgba(0, 0, 0, 0.25)); mask-image: linear-gradient(180deg, #000 calc(100% - 2.2em), rgba(0, 0, 0, 0.25)); }

/* ---- empty world ----------------------------------------------------------------------------------------------------- */

#hud .empty-card {
  left: 50%;
  top: 15%;
  translate: -50% 0;
  width: min(31em, calc(100% - 2em));
  padding: 1.1em 1.5em 1.35em;
  text-align: center;
  z-index: 3;
  animation: hud-cardin 0.5s cubic-bezier(0.2, 1.3, 0.4, 1) both;
}
#hud .empty-card .ec-art { display: flex; justify-content: center; margin-top: -2.7em; }
#hud .empty-card .ec-art svg { width: 4.2em; height: 4.62em; filter: drop-shadow(0 0.25em 0 rgba(0, 0, 0, 0.45)); animation: cnc-bob 3s ease-in-out infinite; }
#hud .empty-card h3 { margin: 0.35em 0 0.3em; font: 400 1.65em/1.1 var(--font-title); color: #fff; text-shadow: 0 0.08em 0 var(--ink); }
#hud .empty-card p { margin: 0 0 1em; color: #c9d6f5; }

#hud .pill-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4em;
  padding: 0.45em 0.95em 0.42em;
  border: 0.12em solid var(--ink);
  border-radius: 2em;
  background: linear-gradient(180deg, #37488e, #1b2658);
  box-shadow: inset 0 0.1em 0 rgba(255, 255, 255, 0.2), 0 0.16em 0 #060a1c;
  color: #fff;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
}
#hud .pill-btn.gold { background: linear-gradient(180deg, #ffe7a0, #ffc53d 55%, #e0a21f); color: #2a1d00; box-shadow: inset 0 0.1em 0 rgba(255, 255, 255, 0.5), 0 0.18em 0 #7a5300; font: 400 1.05em/1 var(--font-title); letter-spacing: 0.03em; }
#hud .pill-btn:hover { filter: brightness(1.1); }
#hud .pill-btn:active { transform: translateY(0.1em); }

/* ---- settings drawer + field manual --------------------------------------------------------------------------------------- */

#hud .drawer {
  right: var(--edge);
  top: 4.75em;
  bottom: var(--edge);
  width: 28em;
  display: flex;
  flex-direction: column;
  z-index: 6;
}
#hud .drawer.in { animation: hud-drawer 0.32s cubic-bezier(0.2, 1.2, 0.4, 1) both; }
@keyframes hud-drawer { 0% { opacity: 0; transform: translateX(2em); } 100% { opacity: 1; transform: none; } }
#hud .drawer .panel-head { padding-left: 0.45em; }
#hud .tabs { display: flex; gap: 0.3em; }
#hud .tab {
  display: flex;
  align-items: center;
  gap: 0.4em;
  padding: 0.32em 0.7em 0.3em 0.45em;
  border: 0.1em solid transparent;
  border-radius: 0.5em;
  background: transparent;
  font: 400 1em/1 var(--font-title);
  letter-spacing: 0.05em;
  color: #9fb0d8;
  cursor: pointer;
}
#hud .tab svg { width: 1.3em; height: 1.3em; }
#hud .tab.on { background: linear-gradient(180deg, #2f438e, #172354); border-color: var(--ink); color: #fff; box-shadow: inset 0 0.08em 0 rgba(255, 255, 255, 0.18), 0 0.12em 0 #060a1c; }
#hud .tab:not(.on):hover { color: #fff; }
#hud .drawer-scroll { flex: 1; min-height: 0; overflow: auto; padding: 0.3em 0.9em 1em; scrollbar-width: thin; scrollbar-color: rgba(255, 197, 61, 0.5) transparent; }
#hud .set-row { display: flex; align-items: center; justify-content: space-between; gap: 0.9em; padding: 0.7em 0.1em; border-bottom: 1px solid rgba(255, 255, 255, 0.07); }
#hud .set-l { min-width: 0; }
#hud .set-l b { display: block; font-weight: 700; color: #fff; }
#hud .set-l small { display: block; margin-top: 0.18em; font-size: 0.78em; line-height: 1.3; color: var(--muted); }
#hud .set-r { display: flex; align-items: center; gap: 0.5em; }
#hud .seg { flex: none; display: flex; gap: 0.15em; padding: 0.15em; border-radius: 0.6em; background: rgba(0, 0, 0, 0.38); box-shadow: inset 0 0.08em 0.2em rgba(0, 0, 0, 0.55); }
#hud .seg button { padding: 0.36em 0.7em 0.32em; border: 0; border-radius: 0.45em; background: transparent; font-weight: 700; font-size: 0.84em; color: #b9c7ec; cursor: pointer; }
#hud .seg button:hover { color: #fff; }
#hud .seg button.on { background: linear-gradient(180deg, #ffe7a0, #ffc53d); color: #2a1d00; box-shadow: 0 0.1em 0 #8a5a00; }
#hud .tog {
  position: relative;
  flex: none;
  width: 2.8em;
  height: 1.55em;
  padding: 0;
  border: 0;
  border-radius: 1em;
  background: rgba(0, 0, 0, 0.45);
  box-shadow: inset 0 0.08em 0.22em rgba(0, 0, 0, 0.65), inset 0 0 0 0.08em rgba(255, 255, 255, 0.12);
  cursor: pointer;
  transition: background 0.2s;
}
#hud .tog i { position: absolute; left: 0.18em; top: 0.18em; width: 1.19em; height: 1.19em; border-radius: 50%; background: #9fb0d8; box-shadow: 0 0.1em 0 rgba(0, 0, 0, 0.45); transition: transform 0.2s cubic-bezier(0.2, 1.6, 0.4, 1), background 0.2s; }
#hud .tog.on { background: linear-gradient(180deg, #25c3ea, #0e6d96); }
#hud .tog.on i { transform: translateX(1.25em); background: #fff; }
#hud .set-r .pill-btn { padding: 0.35em 0.8em 0.32em; font-size: 0.85em; }
#hud .set-foot { margin-top: 1em; font-size: 0.78em; line-height: 1.4; color: #c9d6f5; }

#hud .manual { font-size: 0.95em; }
#hud .manual h4 { margin: 1.1em 0 0.45em; font: 400 1.15em/1 var(--font-title); letter-spacing: 0.03em; color: var(--gold); text-shadow: 0 0.07em 0 var(--ink); }
#hud .fm-lead { margin: 0.7em 0 0.2em; color: #e6edff; line-height: 1.4; }
#hud .fm-row, #hud .fm-fac { display: grid; grid-template-columns: 2.5em minmax(0, 1fr); gap: 0.65em; align-items: start; margin: 0.55em 0; }
#hud .fm-i svg, #hud .fm-crest svg { width: 2.4em; height: 2.4em; filter: drop-shadow(0 0.12em 0 rgba(0, 0, 0, 0.4)); }
#hud .fm-crest svg, #hud .fm-i svg.crest { height: 2.64em; }
#hud .fm-row b, #hud .fm-fac b { color: #fff; }
#hud .fm-fac small { display: block; font-size: 0.78em; color: var(--muted); margin-top: 0.1em; }
#hud .fm-row p, #hud .fm-fac p { margin: 0.2em 0 0; font-size: 0.86em; line-height: 1.38; color: #c9d6f5; }
#hud .fm-row .st { font-size: 0.72em; vertical-align: 0.1em; }
#hud .fm-foot { margin: 1.2em 0 0.2em; font-style: italic; color: var(--muted); }

#hud kbd {
  display: inline-block;
  min-width: 1.9em;
  padding: 0.34em 0.5em 0.3em;
  border-radius: 0.38em;
  background: linear-gradient(180deg, #f6f8ff, #c9d3ee);
  box-shadow: 0 0.16em 0 #6d7aa6, inset 0 -0.06em 0 rgba(0, 0, 0, 0.15);
  color: #141a38;
  font: 700 0.8em/1 var(--font-body);
  text-align: center;
  white-space: nowrap;
}

/* ---- help overlay ----------------------------------------------------------------------------------------------------- */

#hud .help-wrap { position: absolute; inset: 0; z-index: 8; display: grid; place-items: center; background: rgba(4, 7, 20, 0.5); pointer-events: auto; }
#hud .help-wrap.in .help { animation: hud-cardin 0.35s cubic-bezier(0.2, 1.3, 0.4, 1) both; }
#hud .help { position: relative; width: min(48em, calc(100% - 2em)); }
#hud .help-body { display: grid; grid-template-columns: 1fr 1fr; gap: 0.3em 2em; padding: 0.9em 1.3em 1.1em; }
#hud .k-col h5 { margin: 0.2em 0 0.55em; font: 400 1.2em/1 var(--font-title); letter-spacing: 0.04em; color: var(--gold); text-shadow: 0 0.07em 0 var(--ink); }
#hud .k-row { display: flex; align-items: center; gap: 0.8em; margin: 0.5em 0; font-size: 0.93em; }
#hud .k-row .keys { flex: none; display: flex; flex-wrap: wrap; gap: 0.25em; width: 8.2em; }
#hud .help-foot { grid-column: 1 / -1; margin: 0.6em 0 0; font-style: italic; color: var(--muted); text-align: center; }

/* ---- tooltip, toast, hint, attention -------------------------------------------------------------------------------------- */

#hud .hud-tip {
  position: fixed;
  left: 0;
  top: 0;
  z-index: 20;
  max-width: 34em;
  padding: 0.4em 0.7em 0.44em;
  border-radius: 0.5em;
  background: rgba(8, 12, 30, 0.95);
  box-shadow: 0 0 0 0.1em rgba(57, 229, 255, 0.6), 0 0.3em 0.9em rgba(0, 0, 0, 0.5);
  color: #fff;
  font: 600 0.86em/1.3 var(--font-body);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  pointer-events: none;
}
#hud .hud-toast {
  position: absolute;
  left: 50%;
  top: 7.4em;
  z-index: 9;
  translate: -50% 0;
  padding: 0.55em 1.1em 0.5em;
  border-radius: 2em;
  background: rgba(8, 12, 30, 0.93);
  box-shadow: 0 0 0 0.12em rgba(255, 197, 61, 0.85), 0 0.3em 1em rgba(0, 0, 0, 0.45);
  font-weight: 700;
  letter-spacing: 0.04em;
  pointer-events: none;
  white-space: nowrap;
}
#hud .hud-toast b { font: 400 1.1em/1 var(--font-title); letter-spacing: 0.04em; color: var(--gold); text-transform: uppercase; }
#hud .hud-toast.in { animation: hud-toast 1.8s ease both; }
@keyframes hud-toast {
  0% { opacity: 0; transform: translateY(-0.6em) scale(0.9); }
  12% { opacity: 1; transform: none; }
  80% { opacity: 1; }
  100% { opacity: 0; }
}
#hud .hud-hint {
  position: absolute;
  left: 50%;
  bottom: 1em;
  translate: -50% 0;
  padding: 0.45em 0.9em;
  border-radius: 2em;
  background: rgba(8, 12, 30, 0.8);
  color: #c9d6f5;
  font-weight: 700;
  font-size: 0.85em;
  pointer-events: none;
  opacity: 0;
}
#hud .hud-hint.in { animation: hud-hint 3.2s ease both; }
@keyframes hud-hint { 0%, 70% { opacity: 1; } 100% { opacity: 0; } }

#hud .hud-attn {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  box-shadow: inset 0 0 4.5em 1em rgba(255, 196, 30, 0.42), inset 0 0 0 0.28em rgba(255, 210, 63, 0.6);
  animation: hud-attn 1.7s ease-in-out infinite;
  will-change: opacity;
}
@keyframes hud-attn { 0%, 100% { opacity: 0.35; } 50% { opacity: 1; } }

/* ---- hide HUD (H) + reduce motion --------------------------------------------------------------------------------------------- */

#hud > * { transition: opacity 0.25s ease; }
#hud.hud-off > :not(.hud-hint):not(.hud-toast):not(.hud-attn) { opacity: 0 !important; pointer-events: none !important; }
#hud.hud-instant > * { transition: none !important; }
#hud.hud-off .panel, #hud.hud-off .plate, #hud.hud-off .needs-pill { pointer-events: none !important; }

#hud.rm .mm-sweep { display: none; }
#hud.rm .needs-pill, #hud.rm .hud-attn, #hud.rm .act i, #hud.rm .cbar.hot i, #hud.rm .sdot, #hud.rm .conn i { animation: none !important; }
#hud.rm .hud-attn { opacity: 0.8; }
#hud.rm .eva-line.in, #hud.rm .card.in, #hud.rm .drawer.in, #hud.rm .empty-card, #hud.rm .empty-card svg { animation: none !important; }

@media (prefers-reduced-motion: reduce) {
  #hud .mm-sweep { animation-duration: 12s; }
}

/* very small windows: keep the emblem, drop the wordmark so the resource tray never collides with it */
@media (max-width: 960px) {
  #hud .logo-t { display: none; }
}
#hud.tb-tight .logo-t { display: none; }   /* same, for big HUD sizes (hud.js applyScale) */

/* narrow windows: stack the card and keep the top bar in one row */
@media (max-aspect-ratio: 4/3) {
  #hud .logo-sub, #hud .res small { display: none; }
  #hud .card-body { grid-template-columns: 1fr; }
  #hud .card-body .col.r { padding-left: 0; border-left: 0; }
}
