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

:root {
  --bg: #0a0d14;
  --panel: #10141d;
  --panel2: #171c28;
  --line: #262e42;
  --line-hi: #34405e;
  --text: #d6dcea;
  --dim: #8791a6;
  --maroon: #a03040;
  --maroon-bright: #c84a5c;
  --good: #5fd08a;
  --warn: #e0b050;
  --cyan: #6fd7ff;
  --font: 'Bahnschrift', 'Avenir Next Condensed', 'Avenir Next', 'Segoe UI', system-ui, sans-serif;
  --side: 340px;
}

html, body { height: 100%; overflow: hidden; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  user-select: none;
}

#game { position: relative; width: 100vw; height: 100vh; }

#canvas {
  position: absolute; left: 0; top: 0;
  right: var(--side); bottom: 0;
  cursor: crosshair;
  display: block;
}

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

#hud-top {
  position: absolute; left: 14px; top: 12px;
  display: flex; flex-direction: column; gap: 7px;
  pointer-events: none;
}
.bar-wrap { display: flex; align-items: center; gap: 9px; }
.bar-wrap label {
  width: 52px; font-size: 10px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 2px; color: var(--dim);
}
.bar {
  width: 190px; height: 13px;
  border: 1px solid var(--line-hi);
  background: linear-gradient(180deg, #04060b, #0c1120);
  border-radius: 7px; overflow: hidden;
  box-shadow: inset 0 2px 5px rgba(0, 0, 0, 0.65);
}
.bar > div {
  height: 100%; width: 100%;
  border-radius: 6px;
  transition: width 0.15s linear;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.35);
}
#shield-bar {
  background: linear-gradient(180deg, #a5e6ff, #2e7fd0 55%, #1b5fa8);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.4), 0 0 10px rgba(111, 215, 255, 0.45);
}
#hull-bar {
  background: linear-gradient(180deg, #ef8090, #a83346 55%, #6e1a28);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.35), 0 0 10px rgba(200, 74, 92, 0.4);
}
.bar-wrap span {
  font-size: 11px; color: var(--dim); min-width: 66px;
  font-variant-numeric: tabular-nums; letter-spacing: 0.03em;
}

#zone-label { font-size: 13px; color: var(--dim); margin-top: 2px; letter-spacing: 0.04em; }
#zone-label b { color: var(--text); font-weight: 700; letter-spacing: 0.08em; }

/* damage and its fix share one line — the chips say what's broken, the button
   right beside them is how you fix it, so the HUD doesn't grow a row per state */
#damage-row { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; max-width: 600px; }
#debuffs { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 4px; pointer-events: auto; }
.debuff-chip {
  font-size: 11px; font-weight: 600; padding: 2px 9px; border-radius: 10px;
  background: linear-gradient(180deg, rgba(200, 74, 92, 0.35), rgba(120, 30, 44, 0.35));
  border: 1px solid var(--maroon);
  box-shadow: 0 0 8px rgba(200, 74, 92, 0.25), inset 0 1px 0 rgba(255, 255, 255, 0.08);
  color: #f5c2ca;
}
#patch-row { margin-top: 4px; pointer-events: auto; }
#patch-row button { font-size: 11px; }
#overhaul-btn { margin-left: 5px; }

/* ammo loadout: a setting, not a readout — collapsed to a one-line summary of
   what's actually loaded, and only unfolds into the full grid when clicked */
#ammo-row { margin-top: 6px; pointer-events: auto; display: flex; flex-direction: column; gap: 3px; }
#ammo-row.hidden { display: none; }
#ammo-detail { display: flex; flex-direction: column; gap: 3px; }
#ammo-detail.hidden { display: none; }
.ammo-chip.hidden { display: none; }
#ammo-toggle {
  align-self: flex-start;
  font-size: 10px; letter-spacing: 0.06em; padding: 3px 9px; border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(10, 14, 20, 0.55);
  color: var(--dim); cursor: pointer;
}
#ammo-toggle:hover { border-color: rgba(255, 255, 255, 0.3); color: var(--fg); }
#ammo-toggle b { font-weight: 700; }
.ammo-grp { display: flex; align-items: center; gap: 6px; }
.ammo-grp > label {
  font-size: 10px; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--dim); width: 62px; flex: none;
}
.ammo-grp > span { display: flex; gap: 3px; flex-wrap: wrap; }
.ammo-chip {
  font-size: 10px; padding: 2px 7px; border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.04);
  color: rgba(233, 238, 245, 0.62);
  cursor: pointer;
}
.ammo-chip:hover { border-color: var(--ac); color: var(--ac); }
.ammo-chip.on {
  border-color: var(--ac);
  color: #0b0e14;
  background: var(--ac);
  font-weight: 700;
  box-shadow: 0 0 10px color-mix(in srgb, var(--ac) 45%, transparent);
}
#patch-prog { display: inline-block; margin-left: 7px; font-size: 11px; color: var(--warn); }

/* a quiet full-width footer control for a list, not an action button */
.list-toggle {
  display: block; width: 100%; margin-top: 8px;
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--line); box-shadow: none;
  color: var(--dim); font-size: 11px; font-weight: 600;
  letter-spacing: 0.08em; text-transform: uppercase;
}
.list-toggle:hover:not(:disabled) {
  color: var(--text); border-color: var(--line-hi);
  box-shadow: none; transform: none;
}
.list-toggle.hidden { display: none; }

/* ---------- tracked goal: what you are saving up for, and how far off ---------- */
#goal {
  border: 1px solid var(--line-hi);
  border-left: 3px solid var(--warn);
  border-radius: 8px;
  background: linear-gradient(180deg, rgba(224,176,80,0.09), rgba(10,13,20,0.5));
  padding: 8px 10px;
}
#goal.hidden { display: none; }
#goal.ready { border-left-color: var(--good); background: linear-gradient(180deg, rgba(95,208,138,0.13), rgba(10,13,20,0.5)); }
#goal .goal-head { display: flex; align-items: center; justify-content: space-between; }
#goal .goal-kicker {
  font-size: 9px; font-weight: 700; letter-spacing: 2px; text-transform: uppercase; color: var(--dim);
}
#goal.ready .goal-kicker { color: var(--good); }
#goal .goal-name { font-size: 12.5px; font-weight: 700; color: var(--text); margin: 1px 0 6px; }
#goal-clear {
  background: none; border: none; box-shadow: none; padding: 0 2px;
  color: var(--dim); font-size: 15px; line-height: 1; cursor: pointer;
}
#goal-clear:hover:not(:disabled) { color: var(--maroon-bright); transform: none; box-shadow: none; }
#goal .g-ore { display: flex; align-items: center; gap: 6px; margin: 3px 0; font-size: 11px; }
#goal .g-ore .g-label { width: 62px; color: var(--dim); flex: none; }
#goal .g-ore .g-track {
  /* block, not inline: these are spans, and an inline box ignores width and
     height entirely — the fill rendered at 0x0 and simply wasn't there */
  display: block; flex: 1; height: 7px; border-radius: 4px; overflow: hidden;
  background: rgba(0,0,0,0.45); border: 1px solid var(--line);
}
#goal .g-ore .g-fill {
  display: block; height: 100%; border-radius: 3px;
  transition: width 0.2s linear;
  box-shadow: 0 0 6px currentColor;
}
#goal .g-ore .g-num { font-variant-numeric: tabular-nums; color: var(--text); min-width: 54px; text-align: right; }
#goal .g-ore.done .g-num { color: var(--good); }
#goal-buy {
  display: block; width: 100%; margin-top: 8px;
  font-size: 11px; font-weight: 700; letter-spacing: 0.06em;
}
#goal-buy.hidden { display: none; }
#goal.ready #goal-buy:not(:disabled) {
  background: linear-gradient(180deg, #4bbd7c, #2c8354);
  border-color: #6fd8a0; border-top-color: #8ce8b8;
  color: #04120a;
}

/* The pin that puts a row in the tracker. Selectors are qualified because the
   list livery rules (#upgrade-list button:not(:disabled), .rep-row button) are
   more specific than a bare class and would otherwise paint these as maroon
   action buttons. */
#upgrade-list .pin:not(:disabled), .rep-row .pin:not(:disabled), .pin {
  background: none; background-image: none; border: none; box-shadow: none;
  color: #4a5570; font-size: 13px; line-height: 1;
  padding: 0 4px; margin: 0; cursor: pointer;
  text-shadow: none;
}
#upgrade-list .pin:hover:not(:disabled), .rep-row .pin:hover:not(:disabled), .pin:hover:not(:disabled) {
  color: var(--warn); transform: none; box-shadow: none; border-color: transparent;
}
#upgrade-list .pin.on, .rep-row .pin.on, .pin.on {
  color: var(--warn); text-shadow: 0 0 8px rgba(224,176,80,0.6);
}

/* ============================== buttons ============================== */

button {
  background: linear-gradient(180deg, #2b3450, #1c2336);
  color: #dde4f2;
  border: 1px solid #3b4a6b;
  border-top-color: #4d5f88;
  border-radius: 6px;
  padding: 5px 11px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.03em;
  cursor: pointer;
  font-family: inherit;
  transition: transform 0.1s ease, box-shadow 0.12s ease, border-color 0.12s ease, filter 0.1s ease;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.07);
}
button:hover:not(:disabled) {
  border-color: var(--maroon-bright);
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.4), 0 0 10px rgba(200, 74, 92, 0.28), inset 0 1px 0 rgba(255, 255, 255, 0.1);
  transform: translateY(-1px);
}
button:active:not(:disabled) { transform: translateY(0); filter: brightness(0.9); }
button:disabled { opacity: 0.35; cursor: default; box-shadow: none; }

/* action buttons carry the ship's livery */
#upgrade-list button:not(:disabled),
.rep-row button:not(:disabled),
#nav-list button:not(:disabled),
#patch-btn:not(:disabled),
#overhaul-btn:not(:disabled) {
  background: linear-gradient(180deg, #b04255, #7c2334);
  border-color: #d0596e;
  border-top-color: #e2798c;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
}
#upgrade-list button:not(:disabled):hover,
.rep-row button:not(:disabled):hover,
#nav-list button:not(:disabled):hover,
#patch-btn:not(:disabled):hover,
#overhaul-btn:not(:disabled):hover {
  box-shadow: 0 3px 12px rgba(0, 0, 0, 0.45), 0 0 14px rgba(200, 74, 92, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.14);
}
button.danger {
  background: linear-gradient(180deg, #c33e52, #8c1f30) !important;
  border-color: var(--maroon-bright) !important;
  color: #fff;
  opacity: 1 !important;
}

/* ============================== sidebar ============================== */

#sidebar {
  position: absolute; right: 0; top: 0; bottom: 0;
  width: var(--side);
  background: linear-gradient(180deg, #131824, #0c0f16 40%);
  border-left: 1px solid var(--line-hi);
  overflow-y: auto; padding: 14px 12px;
  display: flex; flex-direction: column; gap: 13px;
}
#sidebar::-webkit-scrollbar { width: 8px; }
#sidebar::-webkit-scrollbar-track { background: transparent; }
#sidebar::-webkit-scrollbar-thumb { background: #2a3348; border-radius: 4px; }
#sidebar::-webkit-scrollbar-thumb:hover { background: var(--maroon); }

#sidebar h1 {
  font-size: 19px; letter-spacing: 6px; font-weight: 800;
  text-align: center;
  background: linear-gradient(180deg, #ff93a4, #c84a5c 55%, #8c2f3c);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 0 14px rgba(200, 74, 92, 0.35));
}
#sidebar h1 small {
  display: block; font-size: 9px; letter-spacing: 3px; font-weight: 600;
  text-transform: uppercase;
  background: none; -webkit-background-clip: initial; background-clip: initial;
  color: var(--dim); margin-top: 3px; filter: none;
}

#sidebar section {
  background: linear-gradient(180deg, #1b2132, #141926 70%);
  border: 1px solid var(--line);
  border-top-color: var(--line-hi);
  border-radius: 10px;
  padding: 11px;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.04);
}
#sidebar h2 {
  font-size: 11px; text-transform: uppercase; letter-spacing: 2.5px; font-weight: 700;
  color: #98a3ba;
  margin-bottom: 9px; padding-bottom: 6px;
  border-bottom: 1px solid rgba(200, 74, 92, 0.28);
}
#sidebar h2 span { float: right; color: var(--warn); letter-spacing: 1px; }

/* ---------- compact cargo strip ---------- */
#cargo-bar {
  display: grid; grid-template-columns: 1fr 1fr; gap: 3px 12px;
  background: linear-gradient(180deg, #1b2132, #141926);
  border: 1px solid var(--line); border-top-color: var(--line-hi);
  border-radius: 10px; padding: 8px 11px; font-size: 12px;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.04);
}
.cargo-legend {
  grid-column: 1 / -1; font-size: 9px; text-transform: uppercase;
  letter-spacing: 2px; font-weight: 700; color: #98a3ba;
  padding-bottom: 4px; margin-bottom: 2px;
  border-bottom: 1px solid rgba(200, 74, 92, 0.22);
}
.cargo-item { display: flex; align-items: center; gap: 5px; padding: 1px 0; }
.cargo-item .c-ore { margin-left: auto; font-variant-numeric: tabular-nums; font-weight: 600; }
.cargo-item .c-sep { color: #4a5468; }
.cargo-item .c-ing { color: var(--warn); font-variant-numeric: tabular-nums; font-weight: 700; }
.ore-dot {
  display: inline-block; width: 9px; height: 9px; border-radius: 50%;
  box-shadow: 0 0 5px currentColor, inset 0 -1px 1px rgba(0, 0, 0, 0.4);
}

/* ---------- tabs ---------- */
#tabs { display: flex; gap: 5px; }
#tabs button {
  flex: 1; position: relative; padding: 8px 2px;
  font-size: 11px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase;
  background: transparent; border: 1px solid transparent; border-radius: 7px;
  color: #77829a; box-shadow: none;
}
#tabs button:hover:not(.active) { color: #b9c2d4; border-color: var(--line); transform: none; box-shadow: none; }
#tabs button.active {
  background: linear-gradient(180deg, #242e48, #1a2133);
  color: #fff;
  border-color: var(--line-hi);
  border-top-color: #4d5f88;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08), 0 0 10px rgba(200, 74, 92, 0.18);
}
#tabs button.active::after {
  content: ''; position: absolute; left: 20%; right: 20%; bottom: -1px; height: 2px;
  background: linear-gradient(90deg, transparent, var(--maroon-bright), transparent);
}
#tabs .dot {
  position: absolute; top: 4px; right: 6px; width: 6px; height: 6px;
  border-radius: 50%; background: var(--warn);
  box-shadow: 0 0 6px var(--warn);
  display: none;
  animation: dotPulse 1.4s ease-in-out infinite;
}
@keyframes dotPulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(0.7); opacity: 0.6; }
}

/* ---------- refinery ---------- */
#refine-buttons { display: flex; flex-direction: column; gap: 4px; margin-bottom: 8px; }
.refine-row { display: flex; align-items: center; gap: 4px; padding: 1px 0; border-radius: 5px; }
.refine-row:hover { background: rgba(255, 255, 255, 0.025); }
.refine-row .refine-label { flex: 1; font-size: 12px; letter-spacing: 0.02em; }
.refine-row button { padding: 3px 8px; font-size: 11px; }

.queue-item { margin: 5px 0; font-size: 12px; letter-spacing: 0.02em; }
.queue-item .prog {
  height: 6px; background: rgba(0, 0, 0, 0.5);
  border-radius: 3px; overflow: hidden; margin-top: 3px;
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.6);
}
.queue-item .prog > div {
  height: 100%;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.3), rgba(255, 255, 255, 0) 55%),
    repeating-linear-gradient(45deg, #e0b050 0 7px, #b8892f 7px 14px);
  background-size: auto, 19.8px 100%;
  animation: stripes 0.9s linear infinite;
  border-radius: 3px;
  box-shadow: 0 0 6px rgba(224, 176, 80, 0.4);
}
@keyframes stripes { to { background-position: 0 0, 19.8px 0; } }
.queue-item.waiting { opacity: 0.5; display: flex; align-items: center; }
.queue-item.waiting:hover { opacity: 0.85; }
.queue-item .next-tag { color: var(--warn); font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 1.5px; margin-right: 5px; }
.queue-item .q-btns { margin-left: auto; display: flex; gap: 4px; }
.queue-item .q-btns button {
  font-size: 11px; line-height: 1;
  padding: 2px 7px; min-width: 0;
  opacity: 0.75;
}
.queue-item .q-btns button:hover { opacity: 1; }

/* ---------- upgrades + repairs ---------- */
.up-row, .rep-row {
  border-top: 1px solid var(--line);
  padding: 8px 4px;
  margin: 0 -4px;
  display: flex; flex-direction: column; gap: 3px;
  border-radius: 6px;
}
.up-row:hover, .rep-row:hover { background: rgba(255, 255, 255, 0.025); }
.up-row:first-child, .rep-row:first-child { border-top: none; }
.up-head { display: flex; justify-content: space-between; align-items: center; gap: 6px; }
.up-head b { font-size: 13px; font-weight: 700; letter-spacing: 0.03em; }
.up-head .lvl { color: var(--dim); font-size: 11px; font-variant-numeric: tabular-nums; }
#upgrade-list .up-head { display: grid; grid-template-columns: 1fr 52px 56px; }
#upgrade-list .up-head .lvl { text-align: right; }
#upgrade-list .up-head button { justify-self: end; }
.up-desc { font-size: 11px; color: var(--dim); letter-spacing: 0.02em; }
.up-cost { font-size: 11px; color: var(--warn); font-weight: 600; letter-spacing: 0.02em; }
.rep-row .prog {
  height: 7px; background: rgba(0, 0, 0, 0.5);
  border-radius: 4px; overflow: hidden;
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.6);
}
.rep-row .prog > div {
  height: 100%;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.3), rgba(255, 255, 255, 0) 55%),
    repeating-linear-gradient(45deg, #c84a5c 0 7px, #93293b 7px 14px);
  background-size: auto, 19.8px 100%;
  animation: stripes 0.9s linear infinite;
  border-radius: 4px;
  box-shadow: 0 0 8px rgba(200, 74, 92, 0.45);
}
.rep-done {
  color: var(--good); font-size: 11px; font-weight: 700;
  letter-spacing: 1.5px; text-transform: uppercase;
  text-shadow: 0 0 8px rgba(95, 208, 138, 0.5);
}
.rep-locked { color: var(--dim); font-size: 11px; font-style: italic; }

/* ---------- nav ---------- */
.nav-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 6px 4px; margin: 0 -4px; border-radius: 6px;
  letter-spacing: 0.03em;
}
.nav-row:hover { background: rgba(255, 255, 255, 0.025); }
.nav-row .here {
  color: var(--good); font-size: 11px; font-weight: 700;
  letter-spacing: 1.5px; text-transform: uppercase;
  text-shadow: 0 0 8px rgba(95, 208, 138, 0.5);
}

#sidebar footer { margin-top: auto; text-align: center; display: flex; gap: 6px; justify-content: center; }
#sidebar footer button { font-size: 10px; opacity: 0.55; letter-spacing: 0.05em; }
#sidebar footer button:hover { opacity: 1; }

/* ---------- guided first-upgrade callout ---------- */
#guide-note {
  position: absolute; right: 352px; top: 118px; z-index: 9;
  background: linear-gradient(180deg, #1e2436, #161b28);
  border: 1px solid var(--warn);
  border-radius: 8px; padding: 10px 12px;
  font-size: 12px; line-height: 1.45; max-width: 230px; color: var(--text);
  padding-right: 20px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.45), 0 0 12px rgba(224, 176, 80, 0.18);
}
#guide-note.hidden { display: none; }
#guide-close {
  position: absolute; top: 2px; right: 4px;
  background: none; border: none; box-shadow: none; padding: 0 3px;
  color: #6b7690; font-size: 14px; line-height: 1; cursor: pointer;
}
#guide-close:hover:not(:disabled) {
  color: var(--warn); transform: none; box-shadow: none; border-color: transparent;
}
#guide-note::after {
  content: ''; position: absolute; right: -6px; top: 16px;
  width: 10px; height: 10px; background: #1c2233;
  border-top: 1px solid var(--warn); border-right: 1px solid var(--warn);
  transform: rotate(45deg);
}
.guide-glow {
  border-color: var(--warn) !important;
  animation: guidePulse 1.2s ease-in-out infinite;
}
@keyframes guidePulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(224, 176, 80, 0.6); }
  50% { box-shadow: 0 0 10px 4px rgba(224, 176, 80, 0.25); }
}

/* ---------- title / landing screen ---------- */
#title {
  position: absolute; inset: 0; z-index: 11;
  display: flex; align-items: center; justify-content: center;
  background: radial-gradient(ellipse at 50% 42%, rgba(5, 7, 11, 0.3), rgba(5, 7, 11, 0.85) 80%);
}
#title.hidden { display: none; }
#title .t-box { text-align: center; }
#title #t-logo { width: 620px; max-width: 82vw; display: block; margin: 0 auto; }
#title .t-tag {
  margin: 12px 0 40px;
  font-size: 12px; letter-spacing: 7px; padding-left: 7px;
  color: var(--dim);
}
#title .t-btns { display: flex; flex-direction: column; gap: 11px; align-items: center; }
/* .hidden has no global rule in this file — without this, the gated title
   buttons (Continue before a save exists, Exit Game outside the Steam shell,
   the demo wishlist CTA) all render regardless of the class */
#title .t-btns .hidden { display: none; }
#title .t-btns button {
  width: 256px; padding: 12px 0;
  font-size: 14px; letter-spacing: 3px;
}
#title #t-continue {
  border-color: var(--maroon-bright);
  color: #ffdfe4;
  box-shadow: 0 0 18px rgba(200, 74, 92, 0.35), inset 0 0 0 1px rgba(200, 74, 92, 0.3);
}
#title #t-quit { color: var(--dim); }

/* demo: the title screen's wishlist CTA — same slot metrics as the buttons,
   but in the store-crimson livery so it reads as THE call to action */
#title #t-wishlist {
  display: block; width: 256px; padding: 12px 0; text-align: center;
  font: inherit; font-size: 13px; font-weight: 700; letter-spacing: 2px;
  white-space: nowrap;
  text-decoration: none; cursor: pointer; border-radius: 7px;
  background: linear-gradient(180deg, #c33e52, #8c1f30);
  border: 1px solid var(--maroon-bright);
  color: #fff;
  box-shadow: 0 0 16px rgba(200, 74, 92, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.18);
}
#title #t-wishlist:hover { filter: brightness(1.15); }
/* must out-rank the double-id display:block above — the generic
   .t-btns .hidden rule loses that specificity fight */
#title #t-wishlist.hidden { display: none; }

/* ---------- tutorial popup (pauses the game) ---------- */
#tut {
  position: absolute; inset: 0; z-index: 11;
  background: rgba(4, 6, 11, 0.72);
  backdrop-filter: blur(2px);
  display: flex; align-items: center; justify-content: center;
}
#tut.hidden { display: none; }
#tut .card {
  background: linear-gradient(180deg, #1d2334, #151a26);
  border: 1px solid var(--line-hi);
  border-left: 3px solid var(--maroon-bright);
  border-radius: 10px; padding: 24px 30px; max-width: 440px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.05);
}
#tut h3 {
  color: var(--maroon-bright);
  letter-spacing: 3px; text-transform: uppercase;
  font-size: 14px; font-weight: 800; margin-bottom: 9px;
  text-shadow: 0 0 12px rgba(200, 74, 92, 0.4);
}
#tut p { color: var(--text); line-height: 1.55; font-size: 13px; margin-bottom: 15px; }
#tut p b { color: var(--warn); }

/* ---------- riveted plates: the wordmark's fastener motif on UI panels ----------
   Each corner gets a stud: light catch-point, dark head, faint rim. Layered
   over each panel's existing gradient (first layers render on top). */
#tut .card, #menu .card, #demo-end .card, #overlay .card {
  background-image:
    radial-gradient(circle at 11px 11px, rgba(230,235,255,0.18) 0 1px, rgba(6,4,8,0.6) 1.2px 2.6px, rgba(255,255,255,0.05) 2.9px 3.2px, transparent 3.6px),
    radial-gradient(circle at calc(100% - 11px) 11px, rgba(230,235,255,0.18) 0 1px, rgba(6,4,8,0.6) 1.2px 2.6px, rgba(255,255,255,0.05) 2.9px 3.2px, transparent 3.6px),
    radial-gradient(circle at 11px calc(100% - 11px), rgba(230,235,255,0.18) 0 1px, rgba(6,4,8,0.6) 1.2px 2.6px, rgba(255,255,255,0.05) 2.9px 3.2px, transparent 3.6px),
    radial-gradient(circle at calc(100% - 11px) calc(100% - 11px), rgba(230,235,255,0.18) 0 1px, rgba(6,4,8,0.6) 1.2px 2.6px, rgba(255,255,255,0.05) 2.9px 3.2px, transparent 3.6px),
    linear-gradient(180deg, #1d2334, #151a26);
}
#sidebar section, #cargo-bar {
  background-image:
    radial-gradient(circle at 9px 9px, rgba(230,235,255,0.15) 0 0.8px, rgba(6,4,8,0.55) 1px 2.2px, rgba(255,255,255,0.04) 2.4px 2.7px, transparent 3px),
    radial-gradient(circle at calc(100% - 9px) 9px, rgba(230,235,255,0.15) 0 0.8px, rgba(6,4,8,0.55) 1px 2.2px, rgba(255,255,255,0.04) 2.4px 2.7px, transparent 3px),
    radial-gradient(circle at 9px calc(100% - 9px), rgba(230,235,255,0.15) 0 0.8px, rgba(6,4,8,0.55) 1px 2.2px, rgba(255,255,255,0.04) 2.4px 2.7px, transparent 3px),
    radial-gradient(circle at calc(100% - 9px) calc(100% - 9px), rgba(230,235,255,0.15) 0 0.8px, rgba(6,4,8,0.55) 1px 2.2px, rgba(255,255,255,0.04) 2.4px 2.7px, transparent 3px),
    linear-gradient(180deg, #1b2132, #141926);
}
#guide-note {
  background-image:
    radial-gradient(circle at 8px 8px, rgba(230,235,255,0.16) 0 0.8px, rgba(6,4,8,0.55) 1px 2.1px, transparent 2.6px),
    radial-gradient(circle at 8px calc(100% - 8px), rgba(230,235,255,0.16) 0 0.8px, rgba(6,4,8,0.55) 1px 2.1px, transparent 2.6px),
    linear-gradient(180deg, #1e2436, #161b28);
}

/* ---------- demo end card ---------- */
#demo-end {
  position: absolute; inset: 0; z-index: 13;
  background: rgba(4, 6, 11, 0.85);
  backdrop-filter: blur(3px);
  display: flex; align-items: center; justify-content: center;
}
#demo-end.hidden { display: none; }
#demo-end .de-list {
  list-style: none; margin: 12px auto 4px; max-width: 430px;
  text-align: left; font-size: 13px; color: var(--dim);
}
#demo-end .de-list li { margin: 5px 0; padding-left: 18px; position: relative; }
#demo-end .de-list li::before {
  content: '▸'; position: absolute; left: 2px; color: var(--maroon-bright);
}
#demo-end .card {
  background: linear-gradient(180deg, #1d2334, #151a26);
  border: 1px solid var(--line-hi);
  border-left: 3px solid var(--maroon-bright);
  border-radius: 10px; padding: 28px 34px; max-width: 460px; text-align: center;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.05);
}
#demo-end .de-kicker {
  font-size: 11px; font-weight: 700; letter-spacing: 3px; text-transform: uppercase;
  color: var(--dim); margin-bottom: 8px;
}
#demo-end h2 {
  color: var(--maroon-bright);
  font-size: 34px; font-weight: 900; letter-spacing: 8px;
  text-shadow: 0 0 18px rgba(200, 74, 92, 0.5);
}
#demo-end .de-tag {
  font-size: 10.5px; letter-spacing: 3px; color: var(--dim); margin: 4px 0 14px;
}
#demo-end p { color: var(--text); font-size: 13px; line-height: 1.6; }
#demo-end p b { color: var(--warn); }
#demo-end .btns { display: flex; gap: 10px; justify-content: center; margin: 18px 0 10px; }
#demo-end a, #wishlist-btn {
  display: inline-block; text-decoration: none; cursor: pointer;
  font: inherit; font-weight: 700;
}
#demo-end #de-wishlist {
  background: linear-gradient(180deg, #c33e52, #8c1f30);
  border: 1px solid var(--maroon-bright);
  color: #fff; border-radius: 6px; padding: 9px 16px; font-size: 13px;
  box-shadow: 0 0 14px rgba(200, 74, 92, 0.35);
}
#demo-end #de-wishlist:hover { filter: brightness(1.15); }
#demo-end .de-note { font-size: 11px; color: var(--dim); }
#wishlist-btn {
  font-size: 10px; letter-spacing: 0.05em; opacity: 0.75;
  color: var(--maroon-bright); align-self: center; padding: 4px 8px;
}
#wishlist-btn:hover { opacity: 1; }
#wishlist-btn.hidden { display: none; }

/* ---------- pause menu ---------- */
#menu {
  position: absolute; inset: 0; z-index: 12;
  background: rgba(4, 6, 11, 0.72);
  backdrop-filter: blur(2px);
  display: flex; align-items: center; justify-content: center;
}
#menu.hidden { display: none; }
#menu .card {
  background: linear-gradient(180deg, #1d2334, #151a26);
  border: 1px solid var(--line-hi);
  border-left: 3px solid var(--maroon-bright);
  border-radius: 10px; padding: 22px 28px; width: 340px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.05);
}
#menu h3 {
  color: var(--maroon-bright);
  letter-spacing: 3px; text-transform: uppercase;
  font-size: 14px; font-weight: 800; margin-bottom: 4px;
  text-shadow: 0 0 12px rgba(200, 74, 92, 0.4);
}
#menu .m-sec {
  font-size: 10px; font-weight: 700; letter-spacing: 2px; text-transform: uppercase;
  color: var(--dim); margin: 14px 0 6px;
  border-bottom: 1px solid var(--line-hi); padding-bottom: 4px;
}
#menu .m-row {
  display: flex; align-items: center; justify-content: space-between;
  font-size: 12.5px; color: var(--text); margin: 6px 0;
}
#menu .m-row button { min-width: 96px; font-size: 11px; }
#menu .bind.listening {
  border-color: var(--warn); color: var(--warn);
  box-shadow: 0 0 12px rgba(224, 176, 80, 0.35);
}
#menu .bind.fixed { opacity: 0.5; }
#menu .m-hint { font-size: 10.5px; color: var(--dim); margin: 2px 0 8px; }
#menu .m-controls { font-size: 12px; color: var(--text); }
#menu .m-controls div { display: flex; justify-content: space-between; margin: 5px 0; }
#menu .m-controls b { color: var(--warn); font-weight: 700; }
#menu .m-controls span { color: var(--dim); }
#m-resume { display: block; width: 100%; margin-top: 16px; font-weight: 700; }

/* recovered Lodestar log skin — amber data slate instead of maroon tutorial */
#tut .card.log { border-left-color: var(--warn); }
#tut .card.log h3 {
  color: var(--warn);
  text-shadow: 0 0 12px rgba(224, 176, 80, 0.4);
}
#tut .card.log p { font-style: italic; }
#tut .card.log .stamp {
  display: block; font-style: normal;
  font-size: 10px; font-weight: 700; letter-spacing: 2px;
  color: var(--dim); text-transform: uppercase; margin-bottom: 7px;
}

/* the sealed order is not salvage — it reads red, not amber, so the player
   registers it as a different kind of document than a recovered slate */
#tut .card.log.sealed { border-left-color: var(--maroon); }
#tut .card.log.sealed h3 {
  color: #f5a0ac;
  text-shadow: 0 0 12px rgba(200, 74, 92, 0.45);
}
#tut .card.log .seal-note {
  display: block; font-style: normal; font-size: 12px; line-height: 1.5;
  color: #f5c2ca; border-left: 2px solid var(--maroon);
  padding: 5px 0 5px 10px; margin: 0 0 11px;
  background: linear-gradient(90deg, rgba(200, 74, 92, 0.12), transparent);
}

/* ---------- victory overlay ---------- */
#overlay {
  position: absolute; inset: 0; z-index: 10;
  background: rgba(4, 6, 11, 0.88);
  backdrop-filter: blur(3px);
  display: flex; align-items: center; justify-content: center;
}
#overlay.hidden { display: none; }
#overlay .card {
  background: linear-gradient(180deg, #1d2334, #141926);
  border: 1px solid var(--maroon);
  border-top: 1px solid var(--maroon-bright);
  border-radius: 12px; padding: 34px 46px; text-align: center; max-width: 460px;
  box-shadow: 0 16px 50px rgba(0, 0, 0, 0.65), 0 0 40px rgba(200, 74, 92, 0.18);
}
#overlay h2 {
  font-size: 24px; letter-spacing: 6px; font-weight: 800;
  background: linear-gradient(180deg, #ff93a4, #c84a5c 60%, #8c2f3c);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 0 16px rgba(200, 74, 92, 0.4));
  margin-bottom: 12px;
}
#overlay p { color: var(--dim); margin-bottom: 15px; line-height: 1.55; }
#overlay .stats { font-size: 13px; margin-bottom: 19px; line-height: 1.9; letter-spacing: 0.03em; }
#overlay .stats b { color: var(--warn); font-variant-numeric: tabular-nums; }
#overlay .btns { display: flex; gap: 10px; justify-content: center; }

/* ============================== narrow viewports ==============================
   The itch.io embed has to stay near 960px wide — itch stretches the whole page
   column to whatever the embed asks for, and a 1500px column makes the page
   description unreadable. At that width a fixed 340px rail would take a third
   of the frame, so narrow viewports get a tighter one and the belt keeps room.
   (Last in the file: these override the base rules at equal specificity.) */
@media (max-width: 1180px) {
  :root { --side: 274px; }
  #sidebar { padding: 12px 10px; gap: 11px; }
  /* four tabs will not fit on one row in a narrow rail — they overflow rather
     than shrink, because flex items floor at min-content. Wrap to 2x2. */
  #tabs { flex-wrap: wrap; gap: 4px; }
  #tabs button { flex: 0 0 calc(50% - 2px); font-size: 10px; padding: 7px 2px; }
}
@media (max-width: 900px) { :root { --side: 246px; } }
