/* Galactic Desk: "starship console" theme.
   An original sci-fi look (chamfered panels, colour-blocked controls, condensed type, starfield).
   It deliberately copies no franchise artwork, logos, or the LCARS layout.

   Theme colours (user-adjustable in Settings > Appearance):
     --c1  primary   : navigation, frame bars, primary buttons
     --c2  secondary : headings, links, labels
     --c3  highlight : selection, focus, live indicators
   Status colours (--green / --yellow / --red / --done) are fixed so their meaning never changes. */
:root {
  --c1: #f2a541; --c2: #8fb8ff; --c3: #c58cf2;
  --c1-ink: #120b02;                       /* text drawn on top of --c1 (set by JS for contrast) */
  --bg: #05070d; --panel: rgba(16, 21, 34, .86); --panel2: rgba(28, 35, 54, .9); --line: rgba(120, 140, 180, .18);
  --text: #e9edf6; --muted: #8e99b2;
  --accent: var(--c1); --accent2: var(--c2);
  --font: "Bahnschrift", "Segoe UI Variable Display", "Segoe UI", system-ui, sans-serif;
  --cut: 14px;                              /* chamfer size */
}

html, body {
  font-family: var(--font);
  background: var(--bg);
}
body {
  min-height: 100vh;
  background:
    radial-gradient(1px 1px at 12% 18%, #fff8 50%, transparent 51%),
    radial-gradient(1px 1px at 72% 11%, #fff6 50%, transparent 51%),
    radial-gradient(1.5px 1.5px at 33% 64%, #fff7 50%, transparent 51%),
    radial-gradient(1px 1px at 88% 47%, #fff5 50%, transparent 51%),
    radial-gradient(1px 1px at 55% 83%, #fff6 50%, transparent 51%),
    radial-gradient(1.5px 1.5px at 6% 77%, #fff5 50%, transparent 51%),
    radial-gradient(1px 1px at 46% 35%, #fff4 50%, transparent 51%),
    radial-gradient(1200px 700px at 85% -10%, color-mix(in srgb, var(--c2) 14%, transparent), transparent 60%),
    radial-gradient(900px 600px at -10% 110%, color-mix(in srgb, var(--c3) 12%, transparent), transparent 60%),
    var(--bg);
  background-attachment: fixed;
  background-size: 400px 400px, 520px 520px, 610px 610px, 470px 470px, 380px 380px, 700px 700px, 330px 330px, auto, auto, auto;
}

/* ---------- header / navigation ---------- */
.top {
  background: linear-gradient(180deg, rgba(5,7,13,.96), rgba(5,7,13,.86));
  border-bottom: none;
  padding: 12px 20px 14px;
  gap: 18px;
}
.top::after {                                    /* frame bar under the header: colour-blocked segments */
  content: ""; position: absolute; left: 20px; right: 20px; bottom: 0; height: 4px; border-radius: 4px;
  background: linear-gradient(90deg, var(--c1) 0 34%, transparent 34% 35%, var(--c2) 35% 62%, transparent 62% 63%,
    var(--c3) 63% 78%, transparent 78% 79%, color-mix(in srgb, var(--c1) 55%, transparent) 79% 100%);
  opacity: .9;
}
.brand { text-transform: uppercase; letter-spacing: .14em; font-weight: 700; font-size: 15px; }
.brand .dot {
  width: 30px; height: 30px; border-radius: 50%; background: none; box-shadow: none;
  border: 3px solid var(--c1); position: relative;
}
.brand .dot::after {
  content: ""; position: absolute; inset: 6px; border-radius: 50%;
  background: var(--c3); box-shadow: 0 0 12px var(--c3);
}
.brand small { display: block; font-size: 9.5px; letter-spacing: .22em; color: var(--muted); font-weight: 500; }
nav { gap: 6px; }
nav button {
  text-transform: uppercase; letter-spacing: .1em; font-size: 12.5px; font-weight: 600;
  border-radius: 999px; padding: 7px 16px;
  background: color-mix(in srgb, var(--c1) 12%, transparent); color: var(--text);
  border: 1px solid color-mix(in srgb, var(--c1) 35%, transparent);
}
nav button:hover { background: color-mix(in srgb, var(--c1) 25%, transparent); }
nav button.on { background: var(--c1); color: var(--c1-ink); border-color: var(--c1); box-shadow: 0 0 16px color-mix(in srgb, var(--c1) 45%, transparent); }
.sync { text-transform: uppercase; letter-spacing: .08em; font-size: 11px; }
.sync::before { content: "● "; color: var(--c3); }
.gear { border-radius: 50%; border-color: color-mix(in srgb, var(--c2) 40%, transparent); color: var(--c2); }

/* ---------- panels: chamfered corners + coloured header strip ---------- */
.card, .list, .detail, .orow, .hero > div, .mbox {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 0;
  clip-path: polygon(var(--cut) 0, 100% 0, 100% calc(100% - var(--cut)), calc(100% - var(--cut)) 100%, 0 100%, 0 var(--cut));
  backdrop-filter: blur(3px);
}
.card { position: relative; padding-top: 20px; }
.card::before, .detail::before {
  content: ""; position: absolute; top: 0; left: var(--cut); right: 30%; height: 3px;
  background: linear-gradient(90deg, var(--c1), color-mix(in srgb, var(--c1) 0%, transparent));
}
.card h2, .detail .hd h2, .nsec h3, .mhd h2 {
  text-transform: uppercase; letter-spacing: .1em; font-weight: 700; color: var(--c1);
}
.card h3, .detail .sec h3, .lbl { color: var(--c2); letter-spacing: .14em; }
.hero > div { min-width: 150px; }
.hero .ops { border-color: color-mix(in srgb, var(--c1) 60%, transparent); }
.big { color: var(--c1); text-shadow: 0 0 18px color-mix(in srgb, var(--c1) 40%, transparent); font-weight: 700; }
.val { font-weight: 600; }
a { color: var(--c2); }
.detail { position: sticky; }
.detail .hd { background: linear-gradient(90deg, color-mix(in srgb, var(--c1) 10%, transparent), transparent 70%); }

/* ---------- controls ---------- */
.legend button, .filters input[type=search], .filters select, .band input, .path-hd select, .btn, .more button {
  border-radius: 999px; background: var(--panel2); border-color: color-mix(in srgb, var(--c2) 25%, transparent);
}
.filters select, .filters input[type=search] { padding-left: 14px; }
.legend button.on { outline: none; background: var(--c1); color: var(--c1-ink); border-color: var(--c1); }
.legend button.on .sw { box-shadow: 0 0 0 2px var(--c1-ink); }
.btn:hover, .more button:hover { border-color: var(--c1); }
.btn.primary { background: var(--c1); color: var(--c1-ink); border-color: var(--c1); font-weight: 700; }
input:focus-visible, select:focus-visible, button:focus-visible { outline: 2px solid var(--c3); outline-offset: 2px; }

/* ---------- rows ---------- */
.mrow.sel, .brow.sel { outline: 1px solid var(--c3); box-shadow: inset 3px 0 0 var(--c3); }
.tag { border-radius: 999px; text-transform: uppercase; letter-spacing: .06em; font-size: 10px; padding: 2px 9px; }
.nextup { border-color: var(--c3); border-radius: 0;
  clip-path: polygon(10px 0, 100% 0, 100% calc(100% - 10px), calc(100% - 10px) 100%, 0 100%, 0 10px); }
.nextup a, ol.chain a { color: var(--c2); }
.nsec h3 { color: var(--c1); }

/* ---------- footer ---------- */
footer { text-transform: uppercase; letter-spacing: .12em; font-size: 10.5px; }

/* ---------- appearance settings ---------- */
.swatches { display: flex; gap: 8px; flex-wrap: wrap; margin: 8px 0 4px; }
.swatch { display: flex; align-items: center; gap: 8px; border: 1px solid var(--line); background: var(--panel2); color: var(--text);
  border-radius: 999px; padding: 5px 12px 5px 6px; cursor: pointer; font: inherit; font-size: 12px; text-transform: uppercase; letter-spacing: .06em; }
.swatch.on { border-color: var(--c3); box-shadow: 0 0 0 1px var(--c3); }
.swatch i { display: inline-flex; width: 42px; height: 16px; border-radius: 999px; overflow: hidden; }
.swatch i b { flex: 1; }
.pickers { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 10px; }
.pickers label { display: flex; flex-direction: column; gap: 4px; font-size: 11px; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); }
.pickers input[type=color] { width: 100%; height: 38px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel2); padding: 3px; cursor: pointer; }
.contrast-warn { color: var(--yellow); font-size: 12px; margin-top: 6px; min-height: 1em; }
.disclaimer { font-size: 11.5px; color: var(--muted); border-top: 1px solid var(--line); padding-top: 10px; margin-top: 10px; }

@media (max-width: 900px) {
  .split { grid-template-columns: 1fr; }
  .detail { position: static; max-height: none; }
}

footer .copy { color: var(--c1); font-weight: 600; margin-bottom: 4px; }
footer .legal { text-transform: none; letter-spacing: .02em; font-size: 10.5px; max-width: 900px; margin: 0 auto; line-height: 1.5; }


/* ---------- banner: "bridge command" look. Fixed colours: it looks the same whatever theme the player picks.
   Original design (angled plate, light strips, bar graphs, waveform); copies no franchise screen layout. ---------- */
.banner, .navbar { --c1: #ff3b3b; --c2: #ffb04a; --c3: #ff6a4a; --c1-ink: #fff; --text: #f4f4f6; }
.banner {
  position: relative; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 24px;
  padding: 22px 26px; min-height: 150px; overflow: hidden;
  background: radial-gradient(700px 160px at 50% 125%, #ff2b2b2e, transparent 70%), linear-gradient(#0d0d10, #050505);
}
.bn-line { position: absolute; left: 0; right: 0; height: 2px; pointer-events: none;
  background: linear-gradient(90deg, transparent, #ff3b3b 15%, #ff6a4a 50%, #ff3b3b 85%, transparent);
  box-shadow: 0 0 14px #ff3b3b, 0 0 30px #ff3b3b88; }
.bn-line.t { top: 0; } .bn-line.b { bottom: 0; }
.bn-left { justify-self: start; }
.bn-bars { display: flex; gap: 4px; align-items: flex-end; height: 64px; }
.bn-bars span { width: 9px; height: 100%; border-radius: 1px; background: linear-gradient(#ff6a4a, #a01818); transform-origin: bottom; animation: bn-bars 1.8s ease-in-out infinite; }
.bn-bars span:nth-child(2n) { animation-delay: -.5s; background: linear-gradient(#ffb04a, #a05a18); }
.bn-bars span:nth-child(3n) { animation-delay: -1.1s; } .bn-bars span:nth-child(5n) { animation-duration: 2.6s; }
.bn-lab { margin-top: 8px; font-size: 10.5px; letter-spacing: .2em; color: #8a8a96; font-stretch: condensed; }
.bn-plate { position: relative; display: flex; align-items: center; gap: 16px; padding: 18px 64px;
  background: linear-gradient(#1a1a20, #0c0c0f);
  clip-path: polygon(40px 0, calc(100% - 40px) 0, 100% 50%, calc(100% - 40px) 100%, 40px 100%, 0 50%); }
.bn-plate::before { content: ""; position: absolute; inset: 1px; z-index: -1; }
.bn-plate::after { content: ""; position: absolute; left: 48px; right: 48px; bottom: 6px; height: 2px; background: #ff3b3b; box-shadow: 0 0 10px #ff3b3b; opacity: .8; }
.brand-text { position: relative; min-width: 0; text-align: left; }
.app-name { margin: 0; font-size: 30px; line-height: 1.05; font-weight: 600; letter-spacing: .18em; text-transform: uppercase;
  color: #f4f4f6; text-shadow: 0 0 18px #ff3b3b66; font-stretch: condensed; white-space: nowrap; }
.tagline { margin-top: 6px; font-size: 11px; letter-spacing: .38em; text-transform: uppercase; color: #ff6a4a; }
.bn-right { justify-self: end; display: flex; flex-direction: column; align-items: flex-end; gap: 8px; }
.bn-wave { width: 220px; height: 60px; }
.bn-trace { stroke-dasharray: 460; animation: bn-trace 3s linear infinite; }
.banner-right { display: flex; align-items: center; gap: 12px; }
.bn-dots { display: flex; gap: 5px; }
.bn-dots span { width: 22px; height: 7px; border-radius: 2px; background: #3a1414; }
.bn-dots .on { background: #ff3b3b; box-shadow: 0 0 8px #ff3b3b; } .bn-dots .am { background: #ffb04a; animation: bn-blink 1.4s infinite; }
.banner .sync { color: #ff8a6a; margin: 0; white-space: nowrap; }
.banner .gear { color: #ffb04a; border-color: #5a2a1a; background: #120808; }
.banner .gear:hover { border-color: #ff3b3b; color: #fff; }
@keyframes bn-bars { 0%, 100% { transform: scaleY(.35); } 50% { transform: scaleY(1); } }
@keyframes bn-trace { from { stroke-dashoffset: 460; } to { stroke-dashoffset: 0; } }
@keyframes bn-blink { 50% { opacity: .25; } }

.navbar {
  position: sticky; top: 0; z-index: 5; display: flex; gap: 8px; flex-wrap: wrap; justify-content: center;
  padding: 12px 22px 13px; background: rgba(8, 8, 10, .96); backdrop-filter: blur(6px); border-bottom: 1px solid #1d1d22;
}
.navbar button { position: relative; background: linear-gradient(#1c1c22, #111115); border: 1px solid #2c2c34; border-radius: 0;
  color: #b8b8c4; font-weight: 600; letter-spacing: .16em; text-transform: uppercase; padding: 10px 24px 9px;
  clip-path: polygon(10px 0, 100% 0, calc(100% - 10px) 100%, 0 100%); box-shadow: none; }
.navbar button::after { content: ""; position: absolute; left: 14px; right: 14px; bottom: 3px; height: 2px; background: #3a1a1a; }
.navbar button:hover { color: #fff; background: linear-gradient(#26262e, #16161b); }
.navbar button.on { color: #fff; background: linear-gradient(#3a1010, #1a0808); border-color: #ff3b3b; box-shadow: none; }
.navbar button.on::after { background: #ff3b3b; box-shadow: 0 0 10px #ff3b3b; }

@media (max-width: 1320px) {
  .banner { grid-template-columns: auto 1fr; }
  .bn-left { display: none; }
  .bn-plate { justify-self: start; }
}
@media (max-width: 760px) {
  .banner { display: flex; flex-direction: column; align-items: stretch; gap: 10px; padding: 16px 12px 14px; min-height: 0; }
  .bn-plate { padding: 12px 34px; gap: 10px; clip-path: polygon(22px 0, calc(100% - 22px) 0, 100% 50%, calc(100% - 22px) 100%, 22px 100%, 0 50%); }
  .bn-plate::after { left: 28px; right: 28px; }
  .app-name { font-size: 17px; letter-spacing: .08em; white-space: normal; }
  .tagline { font-size: 9px; letter-spacing: .2em; }
  .bn-wave, .bn-dots { display: none; }
  .banner .sync { white-space: normal; font-size: 10px; min-width: 0; }
  .bn-right { align-items: stretch; }
  .banner-right { justify-content: space-between; }
  .navbar { padding: 8px 10px 10px; gap: 6px; }
  .navbar button { padding: 8px 14px 7px; letter-spacing: .08em; font-size: 12px; }
}
@media (prefers-reduced-motion: reduce) {
  .bn-bars span, .bn-trace, .bn-dots .am { animation: none; }
}

/* emblem (original SVG logos, coloured by the theme) */
.brand-logo { width: 58px; height: 58px; flex: none; position: relative; filter: drop-shadow(0 0 10px color-mix(in srgb, var(--c1) 40%, transparent)); }
.brand-logo svg, .logoopt svg { width: 100%; height: 100%; display: block; overflow: visible; }
.lf1 { fill: var(--c1); } .lf2 { fill: var(--c2); } .lf3 { fill: var(--c3); } .lft { fill: var(--text); opacity: .8; }
.ls1, .ls2, .ls3 { fill: none; } .ls1 { stroke: var(--c1); } .ls2 { stroke: var(--c2); } .ls3 { stroke: var(--c3); }
.lbg { fill: color-mix(in srgb, var(--c1) 10%, transparent); } .lbg2 { fill: color-mix(in srgb, var(--c2) 18%, transparent); }
.glow { filter: drop-shadow(0 0 4px var(--c3)); }
.logopick { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 10px; }
.logoopt { display: flex; flex-direction: column; align-items: center; gap: 6px; width: 104px; padding: 12px 8px 8px; cursor: pointer;
  background: var(--panel2); border: 1px solid var(--line); border-radius: 10px; color: var(--muted); font: inherit; font-size: 11px; }
.logoopt svg { width: 56px; height: 56px; }
.logoopt.on { border-color: var(--c3); color: var(--text); box-shadow: 0 0 0 1px var(--c3); }
@media (max-width: 760px) { .brand-logo { width: 38px; height: 38px; } }

/* ======================================================================================================
   RED ALERT FRAME: the content area matches the bridge banner whatever colours the player picks.
   Frames (panel metal, red top edges, heading underlines, active buttons) are fixed; the player's theme
   colours only the data: big numbers, progress, links, selection and tags.
   ====================================================================================================== */
:root { --fr: #ff3b3b; --fr-hi: #ff8a6a; --fr-dim: #3a1a1a; --edge: #26262e;
  --metal: linear-gradient(rgba(20, 20, 24, .95), rgba(11, 11, 14, .95)); }

/* panels */
.card, .detail, .list, .orow, .mbox { background: var(--metal); border: 1px solid var(--edge); clip-path: none; border-radius: 0; }
.card, .detail { border-top: 2px solid var(--fr); box-shadow: 0 -6px 18px -10px var(--fr); }
.card::before, .detail::before { display: none; }
.orow { border-top: 1px solid var(--fr-dim); }
.mbox { box-shadow: 0 0 0 1px #000, 0 -6px 22px -8px var(--fr), 0 20px 60px #000c; }
.detail .hd { background: linear-gradient(90deg, color-mix(in srgb, var(--fr) 12%, transparent), transparent 70%); }

/* headings: white with a short glowing red underline; sub-headings in the banner's warm red */
.card h2, .detail .hd h2, .mhd h2 { color: #fff; padding-bottom: 8px;
  background: linear-gradient(var(--fr), var(--fr)) left bottom / 60px 2px no-repeat;
  text-shadow: 0 0 14px color-mix(in srgb, var(--fr) 35%, transparent); }
.card h3, .detail .sec h3, .nsec h3, .goal h3 { color: var(--fr-hi); }

/* stat tiles: angled corners, dark metal, numbers in the player's colour */
.hero > div { position: relative; background: var(--metal); border: 1px solid var(--edge); border-bottom: 2px solid var(--fr-dim);
  clip-path: polygon(12px 0, 100% 0, 100% calc(100% - 12px), calc(100% - 12px) 100%, 0 100%, 0 12px); }
.hero .lbl { color: #9a9aa6; }
.hero .val { color: var(--c1); }
/* the highlighted tile (Operations): red-lit plate with a glowing strip on top */
.hero .ops { border: 1px solid var(--fr); background: linear-gradient(color-mix(in srgb, var(--fr) 18%, #18181d), #0d0d10); }
.hero .ops::before { content: ""; position: absolute; left: 12px; right: 12px; top: 0; height: 2px;
  background: var(--fr); box-shadow: 0 0 10px var(--fr), 0 0 22px var(--fr); }
.hero .ops .lbl { color: var(--fr-hi); }
.stat.link:hover, .ops.link:hover { outline: none; border-color: var(--fr); }

/* highlighted call-outs use the same red-lit plate */
.nextup, .goal { border: 1px solid var(--fr); background: linear-gradient(color-mix(in srgb, var(--fr) 14%, #141418), rgba(13, 13, 16, .9)); }
details.goal > summary::before { color: var(--fr); }

/* buttons and filters: dark metal, red when on (like the menu) */
.legend button, .btn, .more button { background: linear-gradient(#1c1c22, #111115); border: 1px solid #2c2c34; color: #d0d0da; }
.legend button:hover, .btn:hover, .more button:hover { border-color: var(--fr); color: #fff; }
.legend button.on, .btn.primary { background: linear-gradient(#3a1010, #1a0808); border-color: var(--fr); color: #fff;
  box-shadow: 0 0 10px -2px var(--fr); }
.legend button.on .sw { box-shadow: 0 0 0 2px #1a0808; }
.filters input[type=search], .filters select, .band input, .path-hd select { background: #0e0e12; border-color: #2c2c34; }

footer .copy { color: var(--fr-hi); }

/* Overview: the Ops goal on the left; glance, resources, factions and timers stacked on the right, each card only as
   tall as its content */
.ov-cols { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.ov-side { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.ov-side .card p.small { margin: 8px 0 0; }
@media (max-width: 760px) { .ov-cols { grid-template-columns: 1fr; } }

/* ---------- line charts (single series, hover readout) ---------- */
.lchart { position: relative; height: auto; margin: 6px 0 4px; }
.lchart svg { width: 100%; height: 56px; display: block; overflow: visible; }
.lchart .ll { fill: none; stroke: var(--c1); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.lchart .la { fill: color-mix(in srgb, var(--c1) 14%, transparent); stroke: none; }
.lchart .lx { position: absolute; top: 0; bottom: 0; width: 1px; background: #ffffff55; pointer-events: none; }
.lchart .ltip { position: absolute; bottom: calc(100% + 4px); transform: translateX(-50%); white-space: nowrap; pointer-events: none;
  background: #111115; border: 1px solid #2c2c34; padding: 3px 8px; font-size: 11px; color: var(--muted); z-index: 3; }
.lchart .ltip b { color: var(--text); }
.lchart.empty { padding: 10px 0; }
.up { color: var(--green); } .down { color: var(--red); }

/* ---------- Factions tab ---------- */
.fgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 16px; align-items: start; margin-bottom: 12px; }
.fhd { display: flex; align-items: center; gap: 14px; }
.femb { width: 56px; height: 56px; flex: none; filter: drop-shadow(0 0 8px color-mix(in srgb, var(--fc) 45%, transparent)); }
.fnm { flex: 1; min-width: 0; } .fnm h2 { margin: 0 0 4px; } .fnm .sub { font-size: 12px; color: var(--muted); }
.frep { text-align: right; } .frep b { display: block; font-size: 24px; color: var(--c1); } .frep span { font-size: 10.5px; letter-spacing: .14em; text-transform: uppercase; color: #9a9aa6; }
.fchg { margin-top: 12px; font-size: 13px; }
.fmeta { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 12.5px; color: var(--muted); margin: 8px 0 2px; } .fmeta b { color: var(--text); }
.fwarn { margin: 8px 0; padding: 8px 10px; font-size: 12.5px; border-left: 3px solid var(--yellow); background: color-mix(in srgb, var(--yellow) 10%, transparent); }
.fwarn.serious { border-left-color: var(--red); background: color-mix(in srgb, var(--red) 12%, transparent); }
.fcard.hostile { border-top-color: var(--red); }
.fmis { margin: 4px 0 0; padding-left: 18px; } .fmis li { margin: 3px 0; } .fmis a { cursor: pointer; }

/* ---------- progress history (Overview) ---------- */
.card.hist { margin-top: 16px; }
.hhd { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.hhd .legend { margin: 0; }
.hgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px 20px; margin-top: 6px; }
.hlab { font-size: 10.5px; letter-spacing: .16em; text-transform: uppercase; color: #9a9aa6; }
.hval { font-size: 13px; margin-top: 2px; } .hval b { font-size: 18px; color: var(--c1); margin-right: 4px; }

/* ---------- alerts: banner under the menu, pop-ups bottom right ---------- */
.alertbar { position: sticky; top: 58px; z-index: 4; padding: 0 22px; }
.abar { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin: 8px 0 0; padding: 9px 12px;
  font-size: 13px; background: linear-gradient(color-mix(in srgb, var(--yellow) 16%, #141418), #101014); border: 1px solid color-mix(in srgb, var(--yellow) 60%, transparent); }
.abar.serious { background: linear-gradient(color-mix(in srgb, var(--fr) 22%, #141418), #101014); border-color: var(--fr); box-shadow: 0 0 14px -4px var(--fr); }
.abar .abtn { display: flex; gap: 8px; } .abar .btn { padding: 4px 12px; font-size: 12px; }
.toasts { position: fixed; right: 16px; bottom: 16px; z-index: 30; display: flex; flex-direction: column; gap: 8px; max-width: min(360px, calc(100vw - 32px)); }
.toast { position: relative; padding: 10px 34px 10px 12px; background: linear-gradient(#1c1c22, #111115); border: 1px solid #2c2c34; border-left: 3px solid var(--c1);
  font-size: 13px; box-shadow: 0 10px 30px #000a; animation: toast-in .25s ease-out; }
.toast b { display: block; margin-bottom: 2px; } .toast.serious { border-left-color: var(--red); } .toast.warning { border-left-color: var(--yellow); }
.toast button { position: absolute; right: 6px; top: 6px; background: none; border: 0; color: var(--muted); cursor: pointer; }
@keyframes toast-in { from { transform: translateY(10px); opacity: 0; } }
@media (max-width: 760px) { .alertbar { padding: 0 10px; top: 92px; } .fgrid { grid-template-columns: 1fr; } }
.rname { display: inline-flex; align-items: center; gap: 8px; }
.ricon { width: 22px; height: 22px; object-fit: contain; flex: none; }

/* ---- Artifacts tab */
.good { color: var(--green); } .bad { color: var(--red); }
.stat .val.good { color: var(--green); }
.agal-row { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 14px; margin-bottom: 14px; }
.agal { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-bottom: 10px; }
.abuff .nm { font-weight: 600; font-size: 13px; }
.abuff b { font-size: 20px; color: var(--c2); }
.atags { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0; }
.acurs { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 6px 14px; }
.acur { display: flex; align-items: center; gap: 8px; min-width: 0; }
.acur .nm { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.agrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 12px; }
.acard { cursor: pointer; margin: 0; }
.acard:hover, .acard:focus-visible { border-color: var(--c1); outline: none; }
.acard[aria-expanded="true"] { grid-column: 1 / -1; }
.ahd { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; }
.ahd > .tag { margin-left: auto; align-self: flex-start; }
.apic { width: 56px; height: 56px; object-fit: contain; flex: none; border-radius: 8px; background: #0005; }
.anm { min-width: 0; } .anm .nm { font-weight: 600; }
.adesc { color: var(--muted); margin-bottom: 6px; }
.avals { display: flex; gap: 14px; flex-wrap: wrap; margin-bottom: 4px; }
.avals b { color: var(--c2); }
.tag.r-unc { color: #5fd38d; border-color: #5fd38d80; } .tag.r-rare { color: #5aa9ff; border-color: #5aa9ff80; } .tag.r-epic { color: #c08bff; border-color: #c08bff80; }
.adetail { margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line); cursor: default; }
.tablewrap { overflow-x: auto; }
.atable { width: 100%; border-collapse: collapse; font-size: 13px; }
.atable th, .atable td { text-align: left; padding: 5px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
.atable th { color: var(--muted); font-weight: 600; text-transform: uppercase; font-size: 11px; letter-spacing: .06em; }
.atable tr.done td { color: var(--muted); }
.atable tr.nextlv td { background: color-mix(in srgb, var(--c1) 14%, transparent); }
@media (max-width: 1000px) { .agal-row { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 760px) { .agal { grid-template-columns: minmax(0, 1fr); } .agrid { grid-template-columns: minmax(0, 1fr); } }

/* ---------------------------------------------------------------- galaxy map */
.map-wrap { display: grid; grid-template-columns: 250px minmax(0, 1fr); gap: 12px; align-items: start; }
.map-filters { max-height: calc(100vh - 230px); min-height: 380px; overflow: auto; padding: 12px 14px; }
.map-filters h4 { margin: 12px 0 6px; font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.map-filters h4:first-child { margin-top: 0; }
.map-filters label { display: flex; gap: 6px; align-items: center; font-size: 13px; padding: 2px 0; cursor: pointer; }
.map-filters .row { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.map-filters input[type=number] { width: 64px; }
.map-filters select { width: 100%; }
.map-filters details { border-top: 1px solid var(--line); padding: 4px 0; }
.map-filters details > summary { cursor: pointer; font-size: 13px; padding: 4px 0; }
.map-filters .cnt { margin-left: auto; color: var(--muted); font-size: 11px; }
.map-filters .quick { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 6px; }
.map-filters .quick .btn, .map-bar .btn { padding: 3px 9px; font-size: 12px; }
.map-main { min-width: 0; }
.map-bar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 8px; }
.map-bar input[type=search] { flex: 1 1 220px; min-width: 160px; font-size: 14px; padding: 6px 10px; }
.map-canvas-wrap { position: relative; height: calc(100vh - 230px); min-height: 380px; border: 1px solid var(--line);
  border-radius: 12px; overflow: hidden; background: radial-gradient(ellipse at center, #0f1422 0%, #06080d 75%); }
#map-canvas { width: 100%; height: 100%; display: block; touch-action: none; cursor: grab; outline: none; }
#map-canvas:active { cursor: grabbing; }
#map-canvas:focus-visible { box-shadow: inset 0 0 0 2px var(--yellow); }
.map-tip { position: absolute; pointer-events: none; background: rgba(10,12,18,.95); border: 1px solid var(--line);
  border-radius: 8px; padding: 6px 9px; font-size: 12px; white-space: nowrap; z-index: 2; }
.map-legend { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 6px; color: var(--muted); }
.map-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 5px; vertical-align: -1px; }
.map-pop h2 { margin: 0 0 4px; }
.map-pop h3 { margin: 14px 0 6px; font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.map-pop table { width: 100%; border-collapse: collapse; font-size: 12px; }
.map-pop td { padding: 3px 4px; border-bottom: 1px solid var(--line); vertical-align: top; }
.map-pop td.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.map-chips { display: flex; gap: 4px; flex-wrap: wrap; margin: 6px 0; }
.map-chip { font-size: 11px; padding: 2px 7px; border-radius: 10px; border: 1px solid var(--line); color: var(--muted); }
.map-chip.good { color: var(--green); border-color: var(--green); } .map-chip.bad { color: var(--red); border-color: var(--red); }
.map-mis { display: flex; gap: 8px; align-items: baseline; padding: 4px 0; border-bottom: 1px solid var(--line); font-size: 12px; cursor: pointer; }
.map-mis:hover .nm { text-decoration: underline; }
.map-mis .lv { min-width: 22px; color: var(--muted); font-variant-numeric: tabular-nums; }
.map-mis .st { margin-left: auto; white-space: nowrap; font-size: 11px; }
.map-mis.now .st { color: var(--green); } .map-mis.done { opacity: .55; } .map-mis.alt { opacity: .45; }
.maplink { cursor: pointer; color: var(--yellow); font-size: 12px; white-space: nowrap; }
.map-pop { position: absolute; z-index: 3; width: 330px; max-width: calc(100% - 20px); overflow: auto; padding: 12px 14px;
  margin: 0; box-shadow: 0 10px 30px rgba(0,0,0,.6); background: var(--panel); }
.map-pop .x { position: absolute; top: 6px; right: 8px; background: none; border: 0; color: var(--muted); font-size: 18px; cursor: pointer; }
.map-pop .x:hover { color: var(--text); }
.map-pop h2 { padding-right: 24px; }
@media (max-width: 800px) { .map-wrap { grid-template-columns: 1fr; } .map-filters { max-height: 40vh; min-height: 0; }
  .map-pop { left: 10px !important; right: 10px; top: auto !important; bottom: 10px; width: auto; max-height: 55% !important; }
  .map-canvas-wrap { height: 62vh; } }

/* story choices that close off other missions */
.choicemark { font-size: 10px; letter-spacing: .04em; color: var(--yellow); border: 1px solid var(--yellow); border-radius: 8px; padding: 0 5px; white-space: nowrap; vertical-align: 1px; }
.choicewarn { border-left: 3px solid var(--yellow); padding-left: 10px; background: rgba(242, 193, 78, .07); }
.choicelist { margin: 8px 0 0; padding-left: 18px; } .choicelist li { margin: 6px 0; } .choicelist a { cursor: pointer; }

/* ship upgrade guide */
.guidebtn { margin-top: 6px; }
.shipguide { width: min(720px, calc(100vw - 32px)); max-height: calc(100vh - 60px); overflow: auto; padding: 18px 20px;
  color: var(--text); background: var(--panel); border: 1px solid var(--line); border-radius: 14px; }
.shipguide::backdrop { background: rgba(0, 0, 0, .65); }
.shipguide .x { position: sticky; float: right; top: 0; background: none; border: 0; color: var(--muted); font-size: 20px; cursor: pointer; }
.shipguide .x:hover { color: var(--text); }
.shipguide h2 { margin: 0 0 2px; }
.shipguide h3 { margin: 18px 0 8px; font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.shipguide h4 { margin: 12px 0 4px; font-size: 12px; color: var(--muted); }
.sg-bars { display: flex; gap: 22px; margin: 10px 0; font-size: 18px; }
.sg-note { padding: 8px 12px; border-left: 3px solid var(--yellow); background: rgba(242, 193, 78, .07); font-size: 13px; }
.sg-note.ok { border-color: var(--green); background: rgba(60, 207, 145, .07); }
.sg-note.done { border-color: var(--muted); background: rgba(255, 255, 255, .04); }
.sg-parts { list-style: none; padding: 0; margin: 0; } .sg-parts li { padding: 5px 0; border-bottom: 1px solid var(--line); font-size: 13px; }
.sg-parts li.done { opacity: .55; }
.sg-t { width: 100%; border-collapse: collapse; font-size: 12px; margin: 4px 0; }
.sg-t td { padding: 3px 4px; border-bottom: 1px solid var(--line); vertical-align: top; }
.sg-t td.num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.sg-t tr.how td { color: var(--muted); border-bottom: 1px solid var(--line); padding-left: 14px; }
.shipguide .ok { color: var(--green); } .shipguide .short { color: var(--red); }
.sg-res { padding: 8px 0; border-bottom: 1px solid var(--line); } .sg-res.done { opacity: .55; }

/* PVE / PVP builds */
.bd-wrap { display: grid; grid-template-columns: 230px minmax(0, 1fr); gap: 14px; align-items: start; }
.bd-nav { padding: 10px; position: sticky; top: 8px; }
.bd-nav h4 { margin: 10px 4px 4px; font-size: 11px; letter-spacing: .1em; color: var(--muted); }
.bd-nav h4:first-child { margin-top: 0; }
.bd-nav button { display: flex; width: 100%; text-align: left; background: none; border: 0; color: var(--text); padding: 7px 8px; border-radius: 8px; cursor: pointer; font: inherit; font-size: 13px; }
.bd-nav button:hover { background: var(--panel2); } .bd-nav button.on { background: var(--panel2); box-shadow: inset 3px 0 0 var(--yellow); }
.bd-nav .cnt { margin-left: auto; color: var(--muted); font-size: 11px; }
.bd-main h2 { margin: 0 0 6px; }
.bd-sec { margin: 16px 0 8px; font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.bd-card { padding: 12px 14px; margin-bottom: 10px; }
.bd-card h3 { margin: 0; font-size: 15px; }
.bd-hd { display: flex; gap: 10px; align-items: center; justify-content: space-between; flex-wrap: wrap; margin-bottom: 4px; }
.bd-crew { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 6px; margin: 8px 0; }
.bd-off { border: 1px solid var(--line); border-radius: 8px; padding: 6px 8px; display: flex; flex-direction: column; gap: 2px; font-size: 13px; }
.bd-off .slot { font-size: 10px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.bd-off.own { border-color: var(--green); } .bd-off.miss { border-color: var(--red); border-style: dashed; } .bd-off.unk { opacity: .6; }
.bd-card .ok { color: var(--green); } .bd-card .short { color: var(--red); }
@media (max-width: 800px) { .bd-wrap { grid-template-columns: 1fr; } .bd-nav { position: static; } }

.choicebrief { margin-top: 4px; font-size: 12px; padding: 5px 8px; border-left: 3px solid var(--yellow); background: rgba(255, 196, 0, .08); border-radius: 4px; }

/* Settings */
.banner .gear.setbtn { width: auto; height: 30px; border-radius: 16px; padding: 0 12px; font-size: 13px; letter-spacing: .03em; white-space: nowrap; }
.set-sec { margin: 18px 0 4px; font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: var(--c2); }
.set-intro { margin: 0 0 6px; }
#set-profile:empty { display: none; }
.set-prof { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.setrow select { max-width: 190px; }
.setrow input[type=checkbox] { width: 18px; height: 18px; flex: none; }
.setrow .btn { white-space: nowrap; }
/* mid-width windows: the brand plate takes most of the banner, so the right side drops the decoration and wraps
   instead of running off the edge (it used to hide the Settings button) */
.bn-right { min-width: 0; }
.banner-right .setbtn { flex: none; }
@media (max-width: 1320px) and (min-width: 761px) {
  .bn-dots { display: none; }
  .banner-right { flex-wrap: wrap; justify-content: flex-end; }
  .banner .sync { white-space: normal; text-align: right; min-width: 0; }
}
@media (max-width: 1100px) and (min-width: 761px) { .bn-wave { display: none; } }
/* refits */
.sg-res.rf.done { opacity: 1; } .sg-res.rf .tag { margin-left: 4px; }
.tag.rf-use { background: transparent; border: 1px solid var(--line); color: var(--muted); }
.rf-tags { margin: 4px 0 8px; flex-wrap: wrap; }
.card.rf-ship { padding: 10px 12px; margin-bottom: 10px; }
.card.rf-ship .shiphd { display: flex; align-items: center; gap: 10px; } .card.rf-ship .shiphd .guidebtn { margin-left: auto; }
/* refit rarity: picture beside each refit, edge and label in the game's rarity colours */
.sg-res.rf { display: flex; gap: 10px; align-items: flex-start; border-left: 3px solid var(--line); padding-left: 8px; }
.sg-res.rf .rf-body { flex: 1; min-width: 0; }
.rf-pic { width: 56px; height: 56px; object-fit: contain; flex: none; border-radius: 6px; }
.rar-common { --rar: #b8bcc4; } .rar-uncommon { --rar: #4fbf5a; } .rar-rare { --rar: #3d8ef0; } .rar-epic { --rar: #a65ef2; }
.sg-res.rf[class*="rar-"] { border-left-color: var(--rar); }
.tag.rf-rar { background: transparent; color: var(--rar); border: 1px solid var(--rar); }
/* Station: Holodeck and Alliance Starbase cards */
.grid.specials { margin: 0 0 16px; align-items: start; }
.sp-holo h3, .sp-star h3 { margin: 12px 0 4px; }
.sp-mod summary { cursor: pointer; } .sp-mod .tag { margin-left: 6px; }
/* building bonuses on the Station list; battle log card */
.bbuffs { margin-top: 3px; } .bbuffs b { color: var(--text); }
.card.battles { margin-bottom: 16px; } .bt-hero { margin: 8px 0; } .bt-grid { gap: 12px; }
.bt-grid h3 { margin: 6px 0 4px; }
/* Forbidden & Chaos Tech */
.card.ft-card { margin-top: 16px; }
.ft-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 10px; margin-top: 8px; }
.ft { border: 1px solid var(--line); border-left: 3px solid var(--rar, var(--line)); border-radius: 6px; padding: 8px 10px; }
.ft-hd { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.ft-hd + .muted { margin: 1px 0 3px; }
.ft.unowned { opacity: .6; } .ft ul { margin: 4px 0 0; padding-left: 18px; }
/* officer traits, Syndicate */
.traits { margin-top: 4px; } .trait[title] { cursor: help; }
.card.synd { margin-bottom: 16px; } .synd-grid { gap: 12px; } .synd-grid h3 { margin: 6px 0 4px; }
/* Alliance tab */
.al-grid { margin: 16px 0; align-items: start; }
.al-wide > .card { grid-column: 1 / -1; }
.al-split { display: grid; grid-template-columns: 1fr 1fr; gap: 0 24px; align-items: start; }
@media (max-width: 760px) { .al-split { grid-template-columns: 1fr; } }
.al-rep .bar { margin-top: 6px; }
.al-add { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; } .al-add input[name=name] { flex: 1 1 160px; }

/* refit suggestions (Overview) */
.rf-tips li { gap: 8px; } .rf-tip { display: flex; gap: 8px; align-items: center; } .rf-pic.sm { width: 32px; height: 32px; }
#rf-focus { margin: 4px 0 8px; }

/* Independent Archives (Station) */
.arch-q { width: 100%; margin: 6px 0; } .arch-t input[type=number] { width: 64px; }

/* game overlay settings */
.ov-btns { margin-top: 8px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.ov-link { margin: 6px 0; overflow-wrap: anywhere; } .ov-link code { font-size: 12px; user-select: all; }

/* Every other text, number and date field, drop-down and text box (Settings, Syndicate level, promo codes, alliance
   schedule, archive levels…): the same dark console field as the filters. :where() keeps it below any specific rule. */
:where(input:not([type]), input[type=text], input[type=number], input[type=date], input[type=time], input[type=search],
  input[type=url], input[type=email], select, textarea) {
  background: #0e0e12; color: var(--text); border: 1px solid #2c2c34; border-radius: 8px; padding: 6px 10px;
  font: inherit; font-size: 14px; color-scheme: dark; }
:where(input, select, textarea):hover { border-color: #3c3c46; }
:where(input, select, textarea):focus { border-color: var(--fr); outline: none; box-shadow: 0 0 0 2px color-mix(in srgb, var(--fr) 30%, transparent); }
:where(input[type=checkbox], input[type=radio]) { accent-color: var(--fr); }
:where(input[type=number]) { width: 6em; }

/* summary tiles across the tabs: same height, shown while a tab loads */
.hero > .stat { display: flex; flex-direction: column; justify-content: center; }
.hero .stat.link { cursor: pointer; }
.hero .stat.link:focus-visible { outline: 2px solid var(--c3); outline-offset: 2px; }
.hero .stat.loading .val { animation: heroPulse 1.2s ease-in-out infinite; }
@keyframes heroPulse { 50% { opacity: .35; } }
@media (prefers-reduced-motion: reduce) { .hero .stat.loading .val { animation: none; } }
@media (max-width: 760px) { .hero > div { min-width: calc(50% - 6px); flex: 1 1 calc(50% - 6px); } }

/* ---------- status colours: one meaning, one colour, on every tab (fixed: they don't follow the theme) ----------
   in progress (violet) · ready / can do now (green) · waiting on something (yellow) · blocked (red)
   · done / maxed / owned (cyan) · not started / locked / not owned (slate) · event (amber) · other storyline (dashed) */
:root { --st-progress: #c58cf2; --st-ready: var(--green); --st-wait: var(--yellow); --st-blocked: var(--red);
  --st-done: #4cc9f0; --st-none: #9aa3b5; --st-event: #f2a541; --st-other: #7a8296; }
.tag { --st: var(--muted); }
/* .tag.tag outranks the older per-status colour rules in style.css (.tag.st-done etc.), so --st alone decides */
.tag.tag { color: var(--st); border: 1px solid color-mix(in srgb, var(--st) 70%, transparent);
  background: color-mix(in srgb, var(--st) 10%, transparent); }
.tag.active, .tag.st-accent, .tag.st-progress { --st: var(--st-progress); }
.tag.available, .tag.st-green { --st: var(--st-ready); }
.tag.st-yellow { --st: var(--st-wait); }
.tag.st-red { --st: var(--st-blocked); }
.tag.completed, .tag.st-done { --st: var(--st-done); }
.tag.completed::before { content: "✓ "; }
.tag.locked, .tag.st-none { --st: var(--st-none); }
.tag.special { --st: var(--st-event); }
.tag.alt_path { --st: var(--st-other); border-style: dashed; background: transparent; }
/* rarity and use tags keep their own colours */
.tag.r-unc { --st: #5fd38d; } .tag.r-rare { --st: #5aa9ff; } .tag.r-epic { --st: #c08bff; }

/* legend swatches and row edges use the same colours */
.sw.accent { background: var(--st-progress); } .sw.done { background: var(--st-done); }
.brow.accent { border-left-color: var(--st-progress);
  background-image: linear-gradient(90deg, color-mix(in srgb, var(--st-progress) 10%, transparent), transparent 40%); }
.brow.done { border-left-color: var(--st-done); }
.mrow.st-active { box-shadow: inset -3px 0 0 var(--st-progress); }
.mrow.done { border-left-color: color-mix(in srgb, var(--st-done) 60%, transparent); }
.tag.rf-rar { --st: var(--rar); background: transparent; } .tag.rf-use { --st: var(--muted); background: transparent; border-color: var(--line); }
.sw.none { background: var(--st-none); } .brow.none { border-left-color: var(--st-none); }
.linklist .done, .sg-parts li.done { color: color-mix(in srgb, var(--st-done) 75%, var(--muted)); }
.jobs .tag { flex: none; align-self: center; }
