/* Stellar Conflicts UI theme: pixel HUD on dark space.
   Markup comes from src/views/ui; the design reference is the "UI kit" board
   on the design canvas. Plain CSS, no build step: public/ is embedded. */

/* ---------- Tokens ---------- */

:root {
  color-scheme: dark;

  --void: #0F1218;
  --panel: #141922;
  --panel-2: #11151D;
  --well: #0A0C11;
  --raised: #232A36;
  --raised-hover: #2A3240;
  --ink: #06080C;
  --edge: #2E3646;
  --edge-2: #3A4354;
  --edge-soft: #1A202B;

  --text: #E9E4D6;
  --text-2: #B9BFCB;
  --muted: #8C93A3;
  --faint: #5E6878;

  --hull: #E9DFC4;
  --hull-shade: #B3A98E;
  --teal: #3EC1C9;
  --teal-dark: #1F7F8A;
  --teal-deep: #134E55;
  --teal-light: #9BE7EC;
  --amber: #E8B04A;
  --amber-dark: #9A6E1E;
  --amber-deep: #4A3810;
  --green: #7BC67E;
  --green-dark: #4E8A52;
  --red: #E2574C;
  --red-light: #F08A80;
  --red-dark: #8C2F2A;
  --red-deep: #2A1416;
  --purple: #B48CF0;
  --purple-dark: #8A63C8;

  --font-ui: "Share Tech Mono", ui-monospace, monospace;
  --font-display: "Doto", "Share Tech Mono", ui-monospace, monospace;
  --font-prose: "Atkinson Hyperlegible", system-ui, sans-serif;

  /* 2px pixel border with notched corners, no border-radius anywhere. */
  --px-edge: 0 -2px 0 0 var(--edge), 0 2px 0 0 var(--edge), -2px 0 0 0 var(--edge), 2px 0 0 0 var(--edge);
  --rivet: linear-gradient(var(--faint), var(--faint));
}

/* ---------- Base ---------- */

*, *::before, *::after { box-sizing: border-box; }

body.sc {
  margin: 0;
  min-height: 100vh;
  background: var(--void);
  color: var(--text);
  font-family: var(--font-ui);
  font-size: 16px;
  line-height: 1.4;
  font-synthesis: none;
  -webkit-font-smoothing: antialiased;
}

.sc a { color: var(--teal); }
.sc a:hover { color: var(--teal-light); }

.sc :focus-visible { outline: 2px dashed var(--amber); outline-offset: 3px; }

.sc h1, .sc h2, .sc h3 { margin: 0; font-weight: 400; }

/* `hidden` wins over a component's own display. */
[hidden] { display: none !important; }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ---------- Layout helpers ---------- */

.stack { display: flex; flex-direction: column; gap: 16px; }
.row { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.spread { justify-content: space-between; }
.grow { flex: 1 1 0; min-width: 0; }
.container { max-width: 1360px; margin: 0 auto; padding: 40px 32px 64px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 40px 32px; }
.span-2 { grid-column: span 2; }
.span-3 { grid-column: 1 / -1; }
@media (max-width: 1100px) { .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 720px) {
  .grid-3 { grid-template-columns: minmax(0, 1fr); }
  .span-2, .span-3 { grid-column: auto; }
  .container { padding: 24px 16px 48px; }
}

/* ---------- Type ---------- */

.display { font-family: var(--font-display); font-weight: 700; letter-spacing: .08em; line-height: 1.05; }
.display.xl { font-size: 64px; }
.display.lg { font-size: 44px; }
.display.md { font-size: 32px; }

/* Floating heading: Doto, outlined, sits straight on the starfield. */
.kicker {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 18px;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--amber);
}

.title { font-size: 24px; letter-spacing: .02em; }
.label { font-size: 12px; letter-spacing: .16em; text-transform: uppercase; color: var(--muted); margin: 0; }
.muted { color: var(--muted); }
.small { font-size: 13px; }

/* Outline for text drawn over the scene. */
.ol { text-shadow: 2px 0 0 var(--ink), -2px 0 0 var(--ink), 0 2px 0 var(--ink), 0 -2px 0 var(--ink); }

.nameplate { font-size: 15px; letter-spacing: .04em; white-space: nowrap; }

.prose { font-family: var(--font-prose); font-size: 19px; line-height: 1.65; color: #D3D8E0; max-width: 72ch; }
.prose p { margin: 0 0 22px; }
.prose h2 { font-family: var(--font-ui); font-size: 30px; line-height: 1.2; margin: 52px 0 16px; color: var(--text); }
.prose h2::before { content: ""; display: inline-block; width: 12px; height: 12px; background: var(--teal); margin-right: 14px; vertical-align: 5px; }

/* Accent colour utilities, used by icons and text. */
.c-teal { color: var(--teal); }
.c-amber { color: var(--amber); }
.c-green { color: var(--green); }
.c-red { color: var(--red-light); }
.c-cream { color: var(--hull); }
.c-purple { color: var(--purple); }
.c-muted { color: var(--muted); }

.icon { display: inline-block; flex: none; vertical-align: -2px; }

/* ---------- Frames ---------- */

/* Riveted panel: dark fill, double inset border, a rivet in each corner. */
.frame {
  position: relative;
  background:
    var(--rivet) 6px 6px / 2px 2px no-repeat,
    var(--rivet) calc(100% - 6px) 6px / 2px 2px no-repeat,
    var(--rivet) 6px calc(100% - 6px) / 2px 2px no-repeat,
    var(--rivet) calc(100% - 6px) calc(100% - 6px) / 2px 2px no-repeat,
    var(--panel-2);
  box-shadow: 0 0 0 2px var(--ink), inset 0 0 0 2px var(--edge), inset 0 0 0 4px var(--panel);
}
.frame.glass { background-color: rgba(14, 17, 24, .95); }

.panel { padding: 30px 22px 22px; display: flex; flex-direction: column; gap: 18px; min-width: 0; }

.well { background: var(--well); box-shadow: inset 0 0 0 2px var(--edge-soft); }

/* Tab label sitting on a frame's top edge. */
.tab {
  position: absolute; top: -12px; left: 14px;
  margin: 0; padding: 1px 8px 2px;
  font-family: var(--font-ui); font-size: 12px; font-weight: 400;
  letter-spacing: .14em; text-transform: uppercase;
  background: var(--teal); color: #08161A;
  box-shadow: 0 0 0 2px var(--ink);
}
.tab.amber { background: var(--amber); color: #1A1206; }
.tab.red { background: var(--red); color: #1A0806; }
.tab.cream { background: var(--hull); color: #08161A; }
.tab.green { background: var(--green); color: #0D1A0E; }
.tab.purple { background: var(--purple); color: #160D24; }

/* ---------- Buttons ---------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 0 18px 2px;
  border: 0; border-radius: 0;
  background: var(--raised); color: var(--text);
  font: inherit; font-size: 17px; text-decoration: none; cursor: pointer;
  box-shadow: 0 0 0 2px var(--ink), inset 0 -4px 0 #171C25, inset 0 2px 0 var(--edge-2);
}
.sc .btn:hover { background: var(--raised-hover); color: var(--text); }
.btn:active, .btn.pressed {
  transform: translateY(2px);
  box-shadow: 0 0 0 2px var(--ink), inset 0 -1px 0 #171C25, inset 0 2px 0 #171C25;
}
.btn.primary { background: var(--teal); color: #08161A; box-shadow: 0 0 0 2px var(--ink), inset 0 -4px 0 var(--teal-dark), inset 0 2px 0 var(--teal-light); }
.sc .btn.primary:hover { background: #5ACFD6; color: #08161A; }
.btn.danger { background: var(--red); color: #1A0806; box-shadow: 0 0 0 2px var(--ink), inset 0 -4px 0 var(--red-dark), inset 0 2px 0 #F59A90; }
.sc .btn.danger:hover { background: #EA6D63; color: #1A0806; }
.btn.gold { background: var(--amber); color: #1A1206; box-shadow: 0 0 0 2px var(--ink), inset 0 -4px 0 var(--amber-dark), inset 0 2px 0 #F6D58E; }
.sc .btn.gold:hover { background: #EDBE65; color: #1A1206; }
.btn.ghost { background: transparent; color: var(--text-2); box-shadow: inset 0 0 0 2px var(--edge-2); }
.sc .btn.ghost:hover { background: var(--panel); }
.btn.sm { min-height: 34px; padding: 0 12px 2px; font-size: 14px; }
.btn.block { width: 100%; }
.btn .cost { font-size: 13px; opacity: .8; }
.btn:disabled, .btn[aria-disabled="true"] {
  background: #1A1F28; color: var(--faint); cursor: not-allowed; transform: none;
  box-shadow: 0 0 0 2px var(--ink), inset 0 0 0 2px var(--raised);
}

.icon-btn {
  position: relative; display: inline-flex; align-items: center; justify-content: center;
  width: 44px; height: 44px; padding: 0; border: 0; border-radius: 0;
  background: #161B25; color: var(--text); cursor: pointer;
  box-shadow: 0 0 0 2px var(--ink), inset 0 0 0 2px var(--edge), inset 0 -6px 0 0 #0D1016;
}
.icon-btn:hover { box-shadow: 0 0 0 2px var(--ink), inset 0 0 0 2px var(--teal), inset 0 -6px 0 0 #0D1016; }

.badge {
  position: absolute; top: -6px; right: -6px;
  min-width: 18px; height: 18px; padding: 0 3px;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; background: var(--red); color: #1A0806;
  box-shadow: 0 0 0 2px var(--ink);
}
.badge.inline { position: static; display: inline-flex; margin-left: 6px; vertical-align: 1px; }
.badge.amber { background: var(--amber); color: #1A1206; }

.keycap {
  display: inline-flex; align-items: center; justify-content: center; font-family: inherit;
  min-width: 26px; height: 26px; padding: 0 6px 2px;
  font-size: 13px; color: var(--text); background: var(--raised);
  box-shadow: 0 0 0 2px var(--ink), inset 0 -3px 0 #171C25;
}
.keycap.sm { min-width: 18px; height: 18px; padding: 0 4px 1px; font-size: 12px; color: var(--text-2); background: var(--well); box-shadow: inset 0 0 0 1px var(--edge-2); }

.tag { display: inline-block; padding: 1px 8px 2px; font-size: 12px; letter-spacing: .12em; text-transform: uppercase; background: var(--teal); color: #08161A; }
.tag.amber { background: var(--amber); color: #1A1206; }
.tag.green { background: var(--green); color: #0D1A0E; }
.tag.red { background: var(--red); color: #1A0806; }
.tag.purple { background: var(--purple); color: #160D24; }
.tag.cream { background: var(--hull); color: #08161A; }
.tag.outline { background: transparent; color: var(--text-2); box-shadow: inset 0 0 0 2px var(--edge-2); }
/* Tags that link to their list (categories and post tags). */
.sc a.tag, .sc a.tag:hover { color: #08161A; text-decoration: none; }
.sc a.tag:not(.outline):hover { filter: brightness(1.15); }
.sc a.tag.outline { color: var(--text-2); }
.sc a.tag.outline:hover { color: var(--text); box-shadow: inset 0 0 0 2px var(--teal); }

/* ---------- Meters ---------- */

.meter-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; font-size: 14px; margin-bottom: 6px; }
.seg {
  position: relative; display: flex; height: 12px; padding: 2px;
  background: var(--well); box-shadow: inset 0 0 0 1px var(--edge);
}
.seg > i { display: block; height: 100%; }
.seg .mark { position: absolute; top: -4px; width: 2px; height: 20px; background: var(--red); }
.f-teal { background: repeating-linear-gradient(90deg, var(--teal) 0 5px, transparent 5px 7px); }
.f-amber { background: repeating-linear-gradient(90deg, var(--amber) 0 5px, transparent 5px 7px); }
.f-green { background: repeating-linear-gradient(90deg, var(--green) 0 5px, transparent 5px 7px); }
.f-red { background: repeating-linear-gradient(90deg, var(--red) 0 5px, transparent 5px 7px); }
.f-cream { background: repeating-linear-gradient(90deg, var(--hull) 0 5px, transparent 5px 7px); }
.f-purple { background: repeating-linear-gradient(90deg, var(--purple) 0 5px, transparent 5px 7px); }
.f-muted { background: repeating-linear-gradient(90deg, var(--muted) 0 5px, transparent 5px 7px); }
.f-ghost { background: repeating-linear-gradient(90deg, #F59A90 0 5px, transparent 5px 7px); opacity: .55; }

.pips { display: inline-flex; gap: 6px; }
.pip { width: 12px; height: 12px; background: var(--well); box-shadow: inset 0 0 0 2px var(--edge-2); }
.pip.on { background: var(--amber); box-shadow: inset 0 0 0 2px var(--amber-dark); }

/* Hotbar slot with an optional cooldown shade rising from the bottom. */
.slot {
  position: relative; display: flex; align-items: center; justify-content: center;
  width: 52px; height: 52px; padding: 0; border: 0;
  background: #161B25; color: var(--text); font: inherit; cursor: pointer;
  box-shadow: 0 0 0 2px var(--ink), inset 0 0 0 2px var(--edge), inset 0 -6px 0 0 #0D1016;
}
.slot:hover { box-shadow: 0 0 0 2px var(--ink), inset 0 0 0 2px var(--teal), inset 0 -6px 0 0 #0D1016; }
.slot .key { position: absolute; top: 2px; left: 5px; font-size: 11px; color: var(--muted); }
.slot .cd { position: absolute; left: 2px; right: 2px; bottom: 2px; height: var(--cd, 0%); background: rgba(6, 8, 12, .78); }
.slot .cd-text { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 14px; color: var(--amber); }

.hotbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 12px 14px; }
.hotbar .sep { width: 2px; height: 40px; background: var(--edge); margin: 0 4px; }

/* ---------- Forms ---------- */

.field { display: flex; flex-direction: column; gap: 6px; }
.field-label { display: flex; justify-content: space-between; gap: 12px; font-size: 14px; color: var(--text-2); }
.field-hint { font-size: 13px; color: var(--muted); }
.field-error { font-size: 13px; color: var(--red-light); }

.input {
  display: block; width: 100%; height: 44px; padding: 0 12px;
  border: 0; border-radius: 0; background: var(--well); color: var(--text);
  font: inherit; font-size: 16px;
  box-shadow: inset 0 0 0 2px var(--edge-2);
}
textarea.input { height: auto; min-height: 96px; padding: 12px; line-height: 1.5; resize: vertical; }
.input:focus { outline: none; box-shadow: inset 0 0 0 2px var(--teal); }
.input[aria-invalid="true"] { box-shadow: inset 0 0 0 2px var(--red); }
.input::placeholder { color: var(--faint); }

.select { position: relative; }
.select select { appearance: none; -webkit-appearance: none; padding-right: 36px; cursor: pointer; }
.select .caret { position: absolute; right: 12px; top: 14px; pointer-events: none; color: var(--hull); }

/* Pixel switch built on a real checkbox. */
.switch { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 36px; cursor: pointer; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch .track { position: relative; flex: none; width: 56px; height: 28px; background: var(--well); box-shadow: inset 0 0 0 2px var(--edge-2); }
.switch .track::after { content: ""; position: absolute; top: 5px; left: 5px; width: 18px; height: 18px; background: var(--faint); }
.switch .state::after { content: "OFF"; font-size: 13px; color: var(--muted); }
.switch input:checked ~ .track { background: var(--teal-deep); box-shadow: inset 0 0 0 2px var(--teal); }
.switch input:checked ~ .track::after { left: 33px; background: var(--hull); }
.switch input:checked ~ .state::after { content: "ON"; }
.switch input:focus-visible ~ .track { outline: 2px dashed var(--amber); outline-offset: 3px; }
.switch .end { display: flex; align-items: center; gap: 10px; }

.check { display: flex; align-items: center; gap: 12px; min-height: 32px; cursor: pointer; }
.check input {
  appearance: none; -webkit-appearance: none; position: relative; flex: none;
  width: 22px; height: 22px; margin: 0; cursor: pointer;
  background: var(--well); box-shadow: inset 0 0 0 2px var(--edge-2);
}
.check input[type="checkbox"]:checked { background: var(--teal); box-shadow: inset 0 0 0 2px var(--teal-dark); }
.check input[type="checkbox"]:checked::after {
  content: ""; position: absolute; left: 4px; top: 10px; width: 2px; height: 2px; background: #08161A;
  box-shadow: 2px 2px #08161A, 4px 4px #08161A, 6px 2px #08161A, 8px 0 #08161A, 10px -2px #08161A, 12px -4px #08161A;
}
.check input[type="radio"] { clip-path: polygon(4px 0, calc(100% - 4px) 0, 100% 4px, 100% calc(100% - 4px), calc(100% - 4px) 100%, 4px 100%, 0 calc(100% - 4px), 0 4px); }
.check input[type="radio"]:checked::after { content: ""; position: absolute; left: 7px; top: 7px; width: 8px; height: 8px; background: var(--teal); }

fieldset.group { border: 0; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
fieldset.group legend { padding: 0; margin-bottom: 8px; }

/* Range slider; --v is the filled percentage, kept in sync by an inline handler. */
.range {
  -webkit-appearance: none; appearance: none; display: block; width: 100%; height: 14px; margin: 6px 0; cursor: pointer;
  background: repeating-linear-gradient(90deg, var(--teal) 0 5px, transparent 5px 7px) 2px 2px / calc(var(--v, 50%) - 4px) 10px no-repeat, var(--well);
  box-shadow: inset 0 0 0 2px var(--edge);
}
.range::-webkit-slider-thumb { -webkit-appearance: none; width: 14px; height: 26px; background: var(--hull); box-shadow: inset -3px -3px 0 var(--hull-shade), 0 0 0 2px var(--ink); }
.range::-moz-range-thumb { width: 14px; height: 26px; border: 0; border-radius: 0; background: var(--hull); box-shadow: inset -3px -3px 0 var(--hull-shade), 0 0 0 2px var(--ink); }

.stepper { display: flex; align-items: center; gap: 10px; }
.stepper input {
  width: 80px; height: 44px; border: 0; text-align: center; font: inherit; font-size: 20px;
  background: var(--well); color: var(--text); box-shadow: inset 0 0 0 2px var(--edge-soft);
  appearance: textfield; -moz-appearance: textfield;
}
.stepper input::-webkit-inner-spin-button, .stepper input::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }

/* Tabs: links or buttons, htmx-friendly. */
.tabs { display: flex; flex-wrap: wrap; gap: 4px; box-shadow: inset 0 -2px 0 var(--edge); }
.tabs a, .tabs button {
  position: relative; display: inline-flex; align-items: center; min-height: 40px; padding: 0 14px 2px;
  border: 0; background: var(--panel); color: var(--muted); font: inherit; font-size: 15px; text-decoration: none; cursor: pointer;
  box-shadow: inset 0 0 0 2px var(--raised);
}
.sc .tabs a:hover, .tabs button:hover { color: var(--text); }
.sc .tabs [aria-current="true"] { background: #1F2633; color: var(--text); box-shadow: inset 0 0 0 2px var(--edge), inset 0 3px 0 var(--teal); }

/* Segmented control built on radios: no JS needed. */
.segmented { display: inline-flex; gap: 4px; padding: 4px; margin: 0; border: 0; background: var(--well); box-shadow: inset 0 0 0 2px var(--edge); }
.segmented label { position: relative; cursor: pointer; }
.segmented input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.segmented span { display: inline-flex; align-items: center; min-height: 34px; padding: 0 14px 2px; font-size: 14px; color: var(--muted); }
.segmented label:hover span { color: var(--text); }
.segmented input:checked + span { background: var(--hull); color: #08161A; }
.segmented input:focus-visible + span { outline: 2px dashed var(--amber); outline-offset: 2px; }

/* ---------- Breadcrumbs (src/views/ui/crumbs.rs) ---------- */

/* Every crumb is 40px tall; its right edge is a stepped arrow 16px deep, and
   the next crumb's left notch is the same staircase, so with a 12px overlap a
   4px dark gap traces the steps between them. */
.trail { max-width: 100%; }
.crumbs { display: inline-flex; align-items: stretch; max-width: 100%; margin: 0; padding: 2px; list-style: none; background: var(--ink); }
.crumbs li { position: relative; display: flex; min-width: 0; }
.crumbs li + li { margin-left: -12px; }
.cr {
  display: inline-flex; align-items: center; gap: 8px; height: 40px; min-width: 0; padding: 0 26px 0 30px;
  background: #1B2230; color: var(--text-2); font-size: 15px; text-decoration: none; white-space: nowrap;
  clip-path: polygon(0 0, calc(100% - 16px) 0, calc(100% - 16px) 4px, calc(100% - 12px) 4px, calc(100% - 12px) 8px, calc(100% - 8px) 8px, calc(100% - 8px) 12px, calc(100% - 4px) 12px, calc(100% - 4px) 16px, 100% 16px, 100% 24px, calc(100% - 4px) 24px, calc(100% - 4px) 28px, calc(100% - 8px) 28px, calc(100% - 8px) 32px, calc(100% - 12px) 32px, calc(100% - 12px) 36px, calc(100% - 16px) 36px, calc(100% - 16px) 100%, 0 100%, 0 36px, 4px 36px, 4px 32px, 8px 32px, 8px 28px, 12px 28px, 12px 24px, 16px 24px, 16px 16px, 12px 16px, 12px 12px, 8px 12px, 8px 8px, 4px 8px, 4px 4px, 0 4px);
}
/* First crumb: square left edge. */
.crumbs li:first-child .cr {
  padding-left: 14px;
  clip-path: polygon(0 0, calc(100% - 16px) 0, calc(100% - 16px) 4px, calc(100% - 12px) 4px, calc(100% - 12px) 8px, calc(100% - 8px) 8px, calc(100% - 8px) 12px, calc(100% - 4px) 12px, calc(100% - 4px) 16px, 100% 16px, 100% 24px, calc(100% - 4px) 24px, calc(100% - 4px) 28px, calc(100% - 8px) 28px, calc(100% - 8px) 32px, calc(100% - 12px) 32px, calc(100% - 12px) 36px, calc(100% - 16px) 36px, calc(100% - 16px) 100%, 0 100%);
}
/* Current page: square right edge, lit, not a link. */
.cr.here {
  padding-right: 16px; background: var(--teal); color: #08161A;
  clip-path: polygon(0 0, 100% 0, 100% 100%, 0 100%, 0 36px, 4px 36px, 4px 32px, 8px 32px, 8px 28px, 12px 28px, 12px 24px, 16px 24px, 16px 16px, 12px 16px, 12px 12px, 8px 12px, 8px 8px, 4px 8px, 4px 4px, 0 4px);
}
.crumbs li:first-child .cr.here { clip-path: none; }
.sc a.cr { color: var(--text-2); }
.sc a.cr:hover { background: var(--raised); color: var(--text); box-shadow: inset 0 3px 0 var(--teal); }
.sc a.cr:focus-visible { outline: none; background: var(--raised); color: var(--text); box-shadow: inset 0 0 0 2px var(--amber); }
.crumb-icon { flex: none; color: var(--teal); }
.cr.here .crumb-icon { color: #08161A; }
.crumb-text { overflow: hidden; text-overflow: ellipsis; max-width: 260px; }

/* Folded middle levels: a "···" crumb opening a menu. */
.crumb-more { position: relative; display: flex; }
.cr.more { padding: 0 24px 0 28px; cursor: pointer; list-style: none; }
.cr.more::-webkit-details-marker { display: none; }
.cr.more:hover, .crumb-more[open] .cr.more { background: var(--raised); color: var(--text); box-shadow: inset 0 3px 0 var(--teal); }
.crumb-menu { position: absolute; top: calc(100% + 10px); left: 8px; z-index: 5; min-width: 220px; padding: 8px 6px; display: flex; flex-direction: column; }
.sc .crumb-menu a { display: flex; align-items: center; min-height: 40px; padding: 0 10px 0 24px; color: var(--text); text-decoration: none; font-size: 15px; }
.sc .crumb-menu a:hover { background: #1B2230; }

/* Phones: just the parent, as a back arrow. */
@media (max-width: 600px) {
  .crumbs li { display: none; }
  .crumbs li.crumb-parent { display: flex; margin-left: 0; }
  .crumbs li.crumb-parent .cr {
    padding: 0 16px 0 26px; background: #1B2230; color: var(--text);
    clip-path: polygon(16px 0, 100% 0, 100% 100%, 16px 100%, 16px 36px, 12px 36px, 12px 32px, 8px 32px, 8px 28px, 4px 28px, 4px 24px, 0 24px, 0 16px, 4px 16px, 4px 12px, 8px 12px, 8px 8px, 12px 8px, 12px 4px, 16px 4px);
  }
}

/* ---------- Feedback ---------- */

.toast {
  display: flex; align-items: center; gap: 12px; padding: 10px 14px;
  background: var(--panel-2);
  box-shadow: 0 0 0 2px var(--ink), inset 0 0 0 2px var(--edge), inset 4px 0 0 0 var(--accent, var(--teal));
}
.toast.amber { --accent: var(--amber); }
.toast.green { --accent: var(--green); }
.toast.purple { --accent: var(--purple); }
.toast.red { --accent: var(--red); background: var(--red-deep); box-shadow: 0 0 0 2px var(--ink), inset 0 0 0 2px #7A2C26, inset 4px 0 0 0 var(--red); }
.toast-body { flex: 1; min-width: 0; }
.toast-detail { font-size: 13px; color: var(--muted); }

.banner {
  padding: 18px 12px 16px; text-align: center; background: #1A1608;
  box-shadow: 0 0 0 2px var(--ink), inset 0 0 0 2px var(--amber), inset 0 0 0 4px var(--amber-deep);
}
.banner .display { font-size: 34px; color: var(--amber); }

/* ---------- Command menu (FF-style) ---------- */

.commands { display: flex; flex-direction: column; margin: 0 -6px; }
.cmd {
  position: relative; display: flex; align-items: center; gap: 10px; width: 100%;
  min-height: 42px; padding: 0 10px 0 24px; border: 0; background: none;
  color: var(--text); font: inherit; font-size: 17px; text-align: left; text-decoration: none; cursor: pointer;
}
.cmd::before {
  content: ""; display: none; position: absolute; left: 8px; top: 50%; margin-top: -5px; width: 2px; height: 2px;
  background: var(--hull);
  box-shadow: 0 2px var(--hull), 0 4px var(--hull), 0 6px var(--hull), 0 8px var(--hull), 2px 2px var(--hull), 2px 4px var(--hull), 2px 6px var(--hull), 4px 4px var(--hull);
}
.cmd:hover, .cmd:focus-visible, .cmd.hot { background: #1B2230; outline: none; }
.cmd:hover::before, .cmd:focus-visible::before, .cmd.hot::before { display: block; }
.sc .cmd:hover { color: var(--text); }
.cmd.danger, .sc .cmd.danger:hover { color: var(--red-light); }
.cmd:disabled, .cmd[aria-disabled="true"] { color: var(--faint); cursor: not-allowed; }
.cmd .cost { margin-left: auto; display: inline-flex; align-items: center; gap: 4px; font-size: 14px; color: var(--amber); }

/* ---------- Inventory ---------- */

.inventory { display: grid; grid-template-columns: repeat(8, 56px); gap: 12px; }
@media (max-width: 720px) { .inventory { grid-template-columns: repeat(5, 56px); } }
.item {
  position: relative; display: flex; align-items: center; justify-content: center;
  width: 56px; height: 56px; padding: 0; border: 0; background: #161B25; color: var(--rc); cursor: pointer;
  box-shadow: 0 0 0 2px var(--ink), inset 0 0 0 2px var(--rb, var(--edge-2));
}
.item.common { --rc: #A9B3C4; --rb: var(--edge-2); }
.item.uncommon { --rc: var(--green); --rb: var(--green-dark); }
.item.rare { --rc: var(--teal); --rb: #2FA3AB; }
.item.epic { --rc: var(--purple); --rb: var(--purple-dark); }
.item.legendary { --rc: var(--amber); --rb: var(--amber); box-shadow: 0 0 0 2px var(--ink), inset 0 0 0 2px var(--amber), inset 0 0 0 4px var(--amber-deep); }
.item.empty { background: var(--void); cursor: default; --rb: #1E2430; }
.item.locked { background: repeating-linear-gradient(45deg, var(--panel-2) 0 4px, #161B25 4px 8px); cursor: not-allowed; --rb: #1E2430; }
.item[aria-selected="true"] { outline: 2px solid var(--hull); outline-offset: 2px; }
.item .qty { position: absolute; right: 4px; bottom: 1px; font-size: 13px; color: var(--text); }

.r-common { color: #A9B3C4; }
.r-uncommon { color: var(--green); }
.r-rare { color: var(--teal); }
.r-epic { color: var(--purple); }
.r-legendary { color: var(--amber); }

.tooltip { padding: 14px 16px; display: flex; flex-direction: column; gap: 10px; }
.stat { display: flex; justify-content: space-between; gap: 12px; font-size: 14px; }
.stat .up { color: var(--green); }
.stat .down { color: var(--red-light); }

/* ---------- Tips (src/views/ui/tip.rs, public/js/tip.js) ---------- */

.tip-trigger { cursor: help; text-decoration: underline dotted; text-underline-offset: 3px; }

/* Placed by tip.js (left/top, data-side). Resets the browser's popover box. */
.sc .tip {
  position: fixed; inset: auto; margin: 0; border: 0; padding: 0; z-index: 1000;
  display: none; overflow: visible; color: var(--text);
  width: max-content; max-width: min(340px, calc(100vw - 16px));
  font-size: 14px; line-height: 1.45; text-align: left; pointer-events: auto;
}
.sc .tip.is-open { display: block; }
.tip-body { display: flex; flex-direction: column; gap: 6px; padding: 12px 14px; overflow-y: auto; }
.tip-body .stat { font-size: 13px; }
.tip-title { color: var(--teal); }

/* Stepped pixel caret pointing at the trigger, just outside the frame's ink edge. */
.tip::after {
  content: ""; position: absolute; width: 2px; height: 2px;
  left: calc(var(--tip-caret-x, 50%) - 1px); background: var(--edge-2);
}
.tip[data-side="top"]::after {
  top: calc(100% + 2px);
  box-shadow: -2px 0 var(--edge-2), 2px 0 var(--edge-2), -4px 0 var(--edge-2), 4px 0 var(--edge-2), 0 2px var(--edge-2), -2px 2px var(--edge-2), 2px 2px var(--edge-2), 0 4px var(--edge-2);
}
.tip[data-side="bottom"]::after {
  bottom: calc(100% + 2px);
  box-shadow: -2px 0 var(--edge-2), 2px 0 var(--edge-2), -4px 0 var(--edge-2), 4px 0 var(--edge-2), 0 -2px var(--edge-2), -2px -2px var(--edge-2), 2px -2px var(--edge-2), 0 -4px var(--edge-2);
}

/* ---------- Dialog ---------- */

.dialog { display: flex; flex-direction: column; gap: 14px; padding: 18px; background: var(--well); box-shadow: inset 0 0 0 2px #7A2C26; }
.dialog-title { font-size: 22px; }

/* ---------- Tables ---------- */

.table { width: 100%; border-collapse: collapse; font-size: 15px; }
.table th, .table td { padding: 8px 10px; text-align: left; font-weight: 400; }
.table thead th { font-size: 12px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); box-shadow: inset 0 -2px 0 var(--edge); }
.table tbody tr:nth-child(odd) { background: var(--panel); }
.table tbody tr:hover { background: #1B2230; }
.table .num { text-align: right; }

/* ---------- Starfield ---------- */

.space { position: relative; overflow: hidden; background: var(--void); }
.space::before, .space::after { content: ""; position: absolute; left: 0; top: 0; background: transparent; pointer-events: none; }
.space::before {
  width: 2px; height: 2px;
  box-shadow: 84px 62px #D8DEE8, 312px 140px #D8DEE8, 530px 48px #AEB6C4, 760px 210px #D8DEE8, 1010px 90px #AEB6C4, 1290px 160px #D8DEE8, 1390px 420px #AEB6C4, 1180px 610px #D8DEE8, 940px 760px #AEB6C4, 620px 840px #D8DEE8, 300px 700px #AEB6C4, 60px 520px #D8DEE8, 220px 380px #AEB6C4, 470px 300px #D8DEE8, 860px 470px #AEB6C4, 1100px 330px #D8DEE8, 1340px 780px #AEB6C4, 700px 590px #D8DEE8, 150px 860px #AEB6C4, 1230px 40px #D8DEE8;
}
.space::after {
  width: 1px; height: 1px;
  box-shadow: 40px 30px #5A6272, 190px 110px #5A6272, 260px 230px #747C8C, 380px 60px #5A6272, 450px 410px #747C8C, 590px 260px #5A6272, 650px 120px #747C8C, 720px 360px #5A6272, 820px 80px #747C8C, 890px 280px #5A6272, 960px 180px #747C8C, 1060px 230px #5A6272, 1150px 120px #747C8C, 1260px 300px #5A6272, 1380px 220px #747C8C, 1310px 520px #5A6272, 1210px 450px #747C8C, 1050px 500px #5A6272, 900px 640px #747C8C, 780px 700px #5A6272;
}
.space > * { position: relative; }

/* ---------- Motion ---------- */

/* Stepped blink for things that need attention: unread DMs, ready items. */
@keyframes sc-blink { 50% { opacity: 0; } }
.blink { animation: sc-blink 1s steps(2) infinite; }
@media (prefers-reduced-motion: reduce) { .blink { animation: none; } }

/* htmx: dim a region while its request is in flight. */
.htmx-request.dim-while-loading, .htmx-request .dim-while-loading { opacity: .6; transition: opacity .1s steps(2); }

/* ---------- Error page ---------- */

/* In the page container like everything else, so it lines up with the header. */
.container.error { padding-top: 120px; display: flex; flex-direction: column; gap: 14px; }
.error > * { max-width: 640px; }
.error h1 { font-family: var(--font-display); font-weight: 700; font-size: 44px; letter-spacing: .06em; }
.error-code { margin: 0; font-family: var(--font-display); font-weight: 700; font-size: 18px; letter-spacing: .16em; text-transform: uppercase; color: var(--amber); }
.error p { margin: 0; color: var(--text-2); }
.error-note { padding: 10px 14px; background: var(--panel-2); box-shadow: inset 4px 0 0 var(--amber); }
.error-reference { font-size: 13px; }

/* ---------- Page kinds (src/views/layout.rs) ---------- */

.skip-link { position: absolute; left: 16px; top: -60px; z-index: 100; padding: 8px 12px; background: var(--hull); color: #08161A; }
.sc .skip-link:focus { top: 12px; color: #08161A; }

.sc .logo { display: inline-flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; }
.logo-mark { flex: none; image-rendering: pixelated; }
.sc .logo:hover { color: var(--text); }
.logo-text { font-family: var(--font-display); font-weight: 700; font-size: 20px; letter-spacing: .08em; }

/* Site: header, page, footer; the footer sticks to the bottom on short pages. */
body.site { display: flex; flex-direction: column; }
.site-main { flex: 1 0 auto; }

.site-bar { max-width: 1360px; margin: 0 auto; padding: 0 32px; display: flex; flex-wrap: wrap; align-items: center; gap: 10px 28px; }
.site-header { background: var(--panel-2); box-shadow: 0 2px 0 var(--edge); }
.site-header .site-bar { min-height: 68px; }
.site-nav { display: flex; flex-wrap: wrap; gap: 4px 22px; }
.site-nav a { padding: 10px 2px; color: var(--text-2); text-decoration: none; font-size: 17px; }
.sc .site-nav a:hover { color: var(--text); }
.site-nav a[aria-current="page"] { color: var(--text); box-shadow: inset 0 -4px 0 var(--teal); }
.site-user { margin-left: auto; display: flex; align-items: center; gap: 16px; }
.sc .site-pilot { display: flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; }
.sc .site-pilot:hover { color: var(--teal-light); }
.avatar { width: 38px; height: 38px; display: flex; align-items: center; justify-content: center; background: var(--well); box-shadow: inset 0 0 0 2px var(--edge); color: var(--teal); }

/* No margin: each page's content box already ends in its own padding. */
.site-footer { background: #0B0E13; box-shadow: inset 0 2px 0 var(--edge); }
.site-footer .site-bar { padding-top: 24px; padding-bottom: 24px; }
.site-footer a { color: var(--muted); }
.site-footer-build { margin-left: auto; }

/* Landing: full-bleed starfield, status line pinned to the bottom. */
body.landing { display: flex; flex-direction: column; }
.landing-main { flex: 1 0 auto; min-height: 100vh; padding-bottom: 72px; }
.landing-footer {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
  display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 8px 22px;
  padding: 14px 24px 18px; pointer-events: none;
}
.landing-footer a, .landing-footer span { pointer-events: auto; }

/* Game: the HUD owns the viewport. */
body.game { height: 100vh; overflow: hidden; }

@media (max-width: 720px) {
  .site-bar { padding: 0 16px; }
  .site-user { margin-left: 0; }
  .landing-footer { position: static; }
  .landing-main { padding-bottom: 0; }
}

/* Lost-link alert (public/js/link.js). Hidden while the link is fine; only
   shown when the page has actually lost the server. */
.link-alert {
  position: fixed; top: 16px; left: 50%; transform: translateX(-50%); z-index: 100;
  max-width: calc(100% - 32px); padding: 10px 16px; font-size: 15px;
  background: var(--panel-2); color: var(--amber);
  box-shadow: 0 0 0 2px var(--ink), inset 0 0 0 2px var(--edge), inset 4px 0 0 0 var(--amber);
}
.link-alert[data-link="connecting"], .link-alert[data-link="connected"] { display: none; }
.link-alert[data-link="offline"] {
  color: var(--red-light); background: var(--red-deep);
  box-shadow: 0 0 0 2px var(--ink), inset 0 0 0 2px #7A2C26, inset 4px 0 0 0 var(--red);
}
.link-alert[data-link="update"] {
  display: flex; align-items: center; gap: 12px; color: var(--text);
  box-shadow: 0 0 0 2px var(--ink), inset 0 0 0 2px var(--edge), inset 4px 0 0 0 var(--teal);
}

/* ---------- Front page, sign-in, news (src/features/{home,news,auth}) ---------- */

/* Hero: the pitch from the design's sign-in board, on the starfield. */
.hero { padding: 24px 0 8px; box-shadow: inset 0 -2px 0 var(--edge-soft); }
.hero-pitch { gap: 20px; max-width: 640px; }
/* Front page: this game's pitch, and the way to Reforged beside it. */
.hero-split { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 460px); gap: 40px 48px; align-items: center; }
.reforged-card { display: flex; flex-direction: column; padding: 4px; }
.reforged-shot img { display: block; width: 100%; height: auto; }
.reforged-body { display: flex; flex-direction: column; gap: 14px; padding: 16px 16px 14px; }
.reforged-body h2 { margin: 0; }
@media (max-width: 900px) { .hero-split { grid-template-columns: minmax(0, 1fr); } }
/* As wide as CONFLICTS, lines centered: the monospaced STELLAR sits one
   character in on each side, and CONFLICTS keeps the hero's left edge. */
.hero-title { align-self: flex-start; width: fit-content; text-align: center; }
.hero-features { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 14px; }
.hero-features li { display: flex; align-items: flex-start; gap: 14px; }
.hero-icon { flex: none; display: grid; place-items: center; width: 36px; height: 36px; background: var(--panel-2); box-shadow: inset 0 0 0 2px var(--edge); }
.hero-line { margin: 0; font-size: 18px; line-height: 1.5; color: var(--text-2); }

/* News cards in a grid. */
.news-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 24px; }
.news-card { display: flex; flex-direction: column; gap: 10px; padding: 22px; }
.news-card p { margin: 0; flex: 1; }
.news-card-title { margin: 0; font-size: 20px; line-height: 1.3; font-weight: 400; color: var(--text); }
.news-card-title a { color: var(--text); text-decoration: none; }
.news-card-title a:hover { color: var(--teal-light); }

/* Sign-in: pitch on the left, panel on the right. */
.sign-in { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 48px; align-items: start; padding-top: 72px; }
.sign-in-panel { position: sticky; top: 32px; }
.sign-in-panel h2 { font-size: 22px; }
.latest-post { display: flex; flex-direction: column; gap: 8px; max-width: 520px; padding: 18px 20px; text-decoration: none; color: var(--text); }
.latest-post:hover .news-card-title { color: var(--teal-light); }
.latest-label { color: var(--amber); letter-spacing: .12em; text-transform: uppercase; }

/* A post (src/features/news/public.rs), laid out like the design's devlog,
   in the header bar's box so its edges line up with the logo and account. */
.post-page { max-width: 1360px; margin: 0 auto; padding: 40px 32px 64px; display: flex; flex-direction: column; gap: 36px; }
.post-head { display: flex; flex-direction: column; gap: 16px; }
.sc .post-title, .post-lede { max-width: 900px; }
/* No sidebar: the body takes the sidebar's room too, full width. */
.post-page.single .post-cols { grid-template-columns: minmax(0, 1fr); }
.post-page.single .post-body, .post-page.single .post-pager { max-width: none; }
.post-tags { gap: 10px; }
.sc .post-title { font-family: var(--font-display); font-size: 56px; font-weight: 700; line-height: 1.05; letter-spacing: .01em; overflow-wrap: anywhere; }
.post-lede { margin: 0; font-family: var(--font-prose); font-size: 22px; line-height: 1.5; color: var(--text-2); }
.post-byline { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 20px; }
.post-byline .btn { margin-left: auto; }
.post-author { display: flex; align-items: center; gap: 12px; }
.post-author .tag { font-size: 11px; padding: 0 6px 1px; vertical-align: 1px; }
.post-when { font-size: 14px; }
.post-cover { margin: 0; }
.post-cover img {
  display: block; width: 100%; height: 380px; object-fit: cover; image-rendering: pixelated;
  background: var(--well); box-shadow: 0 0 0 2px var(--ink), inset 0 0 0 2px var(--edge);
}
.post-cols { display: grid; grid-template-columns: minmax(0, 760px) minmax(0, 1fr); gap: 48px 64px; align-items: start; }
.post-body { max-width: 760px; min-width: 0; }
.post-body h2 { scroll-margin-top: 24px; }
.post-body > :first-child { margin-top: 0; }
.post-actions { display: flex; flex-wrap: wrap; gap: 12px; margin: 36px 0 0; padding-top: 24px; box-shadow: inset 0 2px 0 var(--edge); font-family: var(--font-ui); }
.post-actions .copy-link { margin-left: auto; }
.post-side { position: sticky; top: 24px; display: flex; flex-direction: column; gap: 36px; min-width: 0; }
.toc { display: flex; flex-direction: column; padding: 28px 18px 14px; }
.sc .toc a { display: flex; gap: 10px; align-items: center; min-height: 36px; color: var(--text-2); text-decoration: none; font-size: 16px; }
.sc .toc a:hover { color: var(--text); }
.toc a::before { content: ""; flex: none; width: 6px; height: 6px; background: var(--edge-2); }
.sc .toc a.on { color: var(--teal); }
.toc a.on::before { background: var(--teal); }
.more-news { display: flex; flex-direction: column; padding: 28px 18px 14px; }
.sc .more-post { display: flex; flex-direction: column; gap: 4px; padding: 10px 0; color: var(--text); text-decoration: none; box-shadow: inset 0 -2px 0 var(--edge-soft); }
.sc .more-post:last-child { box-shadow: none; }
.sc .more-post:hover .more-post-title { color: var(--teal-light); }
.more-post .tag { align-self: flex-start; font-size: 11px; }
.more-post-title { font-size: 17px; }
.post-pager { display: flex; flex-wrap: wrap; gap: 20px; max-width: 760px; }
.sc .pager-link { flex: 1 1 300px; display: flex; flex-direction: column; gap: 4px; padding: 18px; color: var(--text); text-decoration: none; font-size: 18px; }
.sc .pager-link:hover { color: var(--teal-light); }
.pager-link.next { text-align: right; }
@media (max-width: 1100px) {
  .post-cols { grid-template-columns: minmax(0, 1fr); }
  .post-side { position: static; }
  /* Stacked under the post, the contents would only point back up. */
  .toc { display: none; }
}

/* Stat tables: boxed and striped. */
.prose table {
  width: 100%; border-collapse: collapse; margin: 0 0 22px; font-family: var(--font-ui); font-size: 17px;
  background: var(--panel-2); box-shadow: 0 0 0 2px var(--ink), inset 0 0 0 2px var(--edge);
}
.prose th, .prose td { padding: 10px 14px; text-align: left; font-weight: 400; }
.prose thead th { font-size: 13px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); box-shadow: inset 0 -2px 0 var(--edge); }
.prose tbody tr:nth-child(odd) { background: #141922; }
.prose code { font-family: var(--font-ui); font-size: .9em; background: var(--well); padding: 1px 5px; }
.prose blockquote {
  margin: 32px 0; padding: 4px 0 4px 24px; box-shadow: inset 6px 0 0 var(--amber);
  font-family: var(--font-ui); font-size: 30px; line-height: 1.3; color: var(--text);
}
.prose blockquote p { margin: 0; }

/* ```patch and ```callout blocks. */
.patch-notes { list-style: none; margin: 0 0 24px; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.patch-notes li {
  display: grid; grid-template-columns: 96px minmax(0, 1fr); gap: 14px; align-items: baseline;
  padding: 10px 12px; background: var(--panel-2); font-size: 17px; line-height: 1.5;
}
.patch-notes .tag { text-align: center; }
.tag.t-new { background: var(--green); color: #0D1A0E; }
.tag.t-chg { background: var(--amber); color: #1A1206; }
.tag.t-fix { background: var(--teal); color: #08161A; }
.prose .callout {
  margin: 30px 0 26px; padding: 26px 20px 18px; font-size: 17px;
  box-shadow: 0 0 0 2px var(--ink), inset 0 0 0 2px var(--amber-dark), inset 0 0 0 4px #1A1608;
}
.prose .callout > :last-child { margin-bottom: 0; }

/* Newsroom (staff). */
.staff-post { padding: 14px 18px; }

/* The post editor (src/features/news/editor.rs), laid out like the design. */
.newsroom { max-width: 1360px; margin: 0 auto; padding: 32px 32px 56px; display: flex; flex-direction: column; gap: 28px; }
.editor-head { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 18px; font-size: 15px; }
.editor-cols { display: flex; flex-wrap: wrap; gap: 40px; align-items: flex-start; }
.editor-main { flex: 999 1 640px; min-width: 0; display: flex; flex-direction: column; gap: 22px; }
.editor-side { flex: 1 1 320px; min-width: 0; display: flex; flex-direction: column; gap: 34px; }
.editor-side .panel { gap: 14px; padding: 28px 18px 18px; }
.editor-title { height: 64px; padding: 0 16px; font-size: 32px; }
.editor-row { display: flex; flex-wrap: wrap; gap: 16px; }
.editor-url { flex: 2 1 340px; min-width: 0; }
.editor-category { flex: 1 1 200px; }
.input-prefixed { display: flex; align-items: stretch; }
.input-prefix {
  display: flex; align-items: center; padding: 0 10px; font-size: 14px; color: var(--muted); white-space: nowrap;
  background: var(--panel); box-shadow: inset 0 0 0 2px var(--edge-2);
}
.input-prefixed .input { margin-left: -2px; min-width: 0; }
textarea.editor-excerpt { min-height: 0; font-family: var(--font-prose); font-size: 17px; }
.cover-panel { flex-direction: row; flex-wrap: wrap; align-items: center; gap: 18px; padding: 28px 18px 18px; }
.cover-thumb { width: 300px; max-width: 100%; height: 92px; flex: none; overflow: hidden; background: var(--well); box-shadow: inset 0 0 0 2px var(--edge); }
.cover-thumb img { display: block; width: 100%; height: 100%; object-fit: cover; image-rendering: pixelated; }
.cover-info { flex: 1 1 220px; min-width: 0; display: flex; flex-direction: column; gap: 8px; overflow-wrap: anywhere; }
.editor-body { display: flex; flex-direction: column; gap: 12px; }
.editor-body .tabs { box-shadow: none; }
.sc .tabs [aria-selected="true"] { background: #1F2633; color: var(--text); box-shadow: inset 0 0 0 2px var(--edge), inset 0 3px 0 var(--teal); }
.editor-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.editor-toolbar .icon-btn { width: 38px; height: 38px; font-size: 15px; }
.editor-toolbar-rule { width: 2px; height: 30px; background: var(--edge); }
textarea.editor-text { min-height: 440px; padding: 14px; font-family: var(--font-ui); font-size: 15px; line-height: 1.65; }
.editor-preview { max-width: none; min-height: 440px; padding: 24px 28px; background: #0B0E13; box-shadow: inset 0 0 0 2px var(--edge); }
.publish-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 4px; }
.publish-actions > * { flex: 1 1 100px; }
.publish-actions .publish-go { flex-basis: 100%; }
.publish:has(input[name="schedule"]:not(:checked)) .schedule-fields { display: none; }
.schedule-fields { display: flex; flex-direction: column; gap: 8px; }
.schedule-time { flex-wrap: nowrap; gap: 10px; align-items: flex-start; }
.editor-side .switch .state { display: none; }

/* Bylines: avatar on the left, name and tag on the right (posts, editor). */
.byline-avatar {
  flex: none; display: flex; align-items: center; justify-content: center; overflow: hidden;
  width: 44px; height: 44px; background: var(--well); box-shadow: inset 0 0 0 2px var(--edge);
  color: var(--teal); font-size: 20px;
}
.byline-avatar img { width: 100%; height: 100%; object-fit: cover; image-rendering: pixelated; }
.byline-name .tag { font-size: 11px; padding: 0 6px 1px; vertical-align: 1px; }
.sc a.byline-link { color: var(--text); text-decoration: none; }
.sc a.byline-link:hover { color: var(--teal-light); text-decoration: underline; }
.byline-current { display: flex; align-items: center; gap: 12px; min-width: 0; }
.byline-card, .byline-option {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; width: 100%;
  padding: 8px 12px 8px 8px; border: 0; background: var(--well); color: var(--text); font: inherit; font-size: 15px;
  text-align: left; cursor: pointer; box-shadow: inset 0 0 0 2px var(--edge-2);
}
.byline-card:hover, .byline-option:hover, .byline-option[aria-selected="true"] { box-shadow: inset 0 0 0 2px var(--teal); }
.byline-option { justify-content: flex-start; }
.byline-dialog { width: min(440px, calc(100vw - 32px)); padding: 12px 0 0; border: 0; background: transparent; color: var(--text); overflow: visible; }
.byline-dialog::backdrop { background: rgba(6, 8, 12, .8); }
.byline-dialog .panel { gap: 16px; }
.byline-dialog:has(input[name="byline"][value="account"]:not(:checked)) [data-pane-for="account"],
.byline-dialog:has(input[name="byline"][value="custom"]:not(:checked)) [data-pane-for="custom"] { display: none; }
.byline-pane { display: flex; flex-direction: column; gap: 12px; }
.byline-results { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; max-height: 320px; overflow-y: auto; }
.byline-results:empty { display: none; }
.byline-icon-row { gap: 10px; }
.byline-dialog [data-byline-done] { align-self: flex-end; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chips:empty { display: none; }
.chip { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 4px 0 10px; font-size: 14px; background: #1F2633; box-shadow: inset 0 0 0 2px var(--edge); }
.chip button { display: flex; align-items: center; justify-content: center; width: 22px; height: 22px; padding: 0; border: 0; background: transparent; color: var(--muted); cursor: pointer; }
.chip button:hover { color: var(--text); background: var(--edge); }
.checklist-item { display: flex; align-items: center; gap: 12px; font-size: 15px; }
.checklist-item .pip { flex: none; }
.checklist-item[data-ok="true"] .pip { background: var(--green); box-shadow: inset 0 0 0 2px var(--green-dark); }
.checklist-item[data-ok="false"] { color: var(--amber); }
.checklist-item[data-ok="false"] .pip { background: var(--amber); box-shadow: inset 0 0 0 2px var(--amber-dark); }
.editor-side .recent { gap: 0; }
.sc .recent-post { display: flex; justify-content: space-between; gap: 12px; padding: 10px 0; color: var(--text); text-decoration: none; box-shadow: inset 0 -2px 0 #1A202B; }
.sc .recent-post:last-child { box-shadow: none; }
.sc .recent-post:hover { color: var(--teal-light); }
.recent-post .tag { align-self: flex-start; flex: none; font-size: 11px; }

@media (max-width: 1100px) { .news-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 720px) {
  .news-grid, .sign-in { grid-template-columns: minmax(0, 1fr); }
  .sign-in { padding-top: 32px; gap: 28px; }
  .sign-in-panel { position: static; }
  .display.xl { font-size: 44px; }
  .post-page { padding: 24px 16px 48px; gap: 28px; }
  .sc .post-title { font-size: 34px; }
  .post-lede { font-size: 19px; }
  .newsroom { padding: 24px 16px 40px; }
  .editor-title { height: 52px; font-size: 22px; }
  .post-cover img { height: 220px; }
  .prose blockquote { font-size: 22px; }
  .patch-notes li { grid-template-columns: minmax(0, 1fr); gap: 6px; }
  .patch-notes .tag { justify-self: start; }
}

/* Gallery lightbox (public/js/gallery.js). */
.lightbox { padding: 0; border: 0; background: transparent; color: var(--text); max-width: 96vw; max-height: 96vh; overflow: visible; }
.lightbox::backdrop { background: rgba(6, 8, 12, .88); }
/* Dialogs take focus when they open; the ring belongs on their controls. */
.lightbox:focus, .byline-dialog:focus { outline: none; }
.lightbox-frame { display: flex; flex-direction: column; gap: 12px; padding: 16px; }
.lightbox-image { display: block; margin: 0 auto; max-width: min(1400px, 90vw); max-height: 76vh; width: auto; height: auto; box-shadow: 0 0 0 2px var(--ink); }
.lightbox-caption { margin: 0; max-width: 72ch; font-family: var(--font-prose); font-size: 16px; line-height: 1.5; color: var(--text-2); }
.lightbox-bar { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 10px; }
.lightbox-bar .row { gap: 10px; }

/* Post editor: media the body uses (public/js/editor.js). */
.post-media { display: flex; flex-direction: column; gap: 10px; }
.post-media .label { margin: 0; }
.post-media-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.post-media-item { display: grid; grid-template-columns: 64px minmax(0, 1fr) auto; gap: 14px; align-items: center; padding: 10px 12px; }
.post-media-thumb { width: 64px; height: 64px; display: grid; place-items: center; overflow: hidden; background: var(--well); box-shadow: inset 0 0 0 2px var(--edge-soft); color: var(--muted); font-size: 12px; text-decoration: none; }
.post-media-thumb img { width: 100%; height: 100%; object-fit: cover; }
.post-media-name { display: flex; flex-direction: column; gap: 2px; min-width: 0; overflow-wrap: anywhere; }
.post-media-actions { gap: 8px; flex-wrap: nowrap; }
@media (max-width: 720px) {
  .post-media-item { grid-template-columns: 48px minmax(0, 1fr); }
  .post-media-thumb { width: 48px; height: 48px; }
  .post-media-actions { grid-column: 1 / -1; }
}

/* Media library (staff) and media in posts. */
.media-item { display: grid; grid-template-columns: 96px minmax(0, 1fr); gap: 16px; padding: 14px; align-items: start; }
.media-item:target { box-shadow: 0 0 0 2px var(--ink), inset 0 0 0 2px var(--teal), inset 0 0 0 4px var(--panel); }
.media-preview { width: 96px; height: 96px; display: grid; place-items: center; overflow: hidden; background: var(--well); box-shadow: inset 0 0 0 2px var(--edge-soft); }
.media-preview img { max-width: 100%; max-height: 100%; image-rendering: pixelated; }
.media-snippet { font-size: 13px; }
/* Images in posts: screenshots scale smoothly; pixel art opts in with the
   image title, ![alt](url "pixel"), and scales up to the column with hard
   edges (uploaded at 1x). */
.prose img, .prose video { display: block; max-width: 100%; height: auto; margin: 0 0 22px; }
.prose img[title~="pixel"] { width: 100%; image-rendering: pixelated; }

/* Post blocks (src/features/news/markdown.rs). */
.gallery { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; margin: 0 0 22px; }
.gallery figure { margin: 0; display: flex; flex-direction: column; gap: 8px; }
.gallery a { display: block; box-shadow: 0 0 0 2px var(--ink), 0 0 0 4px var(--edge); }
.gallery a:hover { box-shadow: 0 0 0 2px var(--ink), 0 0 0 4px var(--teal); }
.prose .gallery img { width: 100%; aspect-ratio: 1; object-fit: cover; margin: 0; }
.gallery figcaption { font-family: var(--font-ui); font-size: 13px; line-height: 1.4; color: var(--muted); }

/* Our own videos on their own line (src/features/news/markdown.rs). */
.post-video { margin: 0 0 22px; display: flex; flex-direction: column; gap: 8px; }
.prose .post-video video {
  width: 100%; max-height: 72vh; margin: 0; background: var(--well);
  box-shadow: 0 0 0 2px var(--ink), 0 0 0 4px var(--edge);
}
.post-video figcaption { font-family: var(--font-ui); font-size: 13px; line-height: 1.4; color: var(--muted); }
/* ```img blocks: a captioned image, floated so text wraps around it. */
.post-figure { margin: 0 0 22px; display: flex; flex-direction: column; gap: 8px; }
.post-figure.float-right { float: right; width: min(42%, 420px); margin: 4px 0 18px 28px; }
.post-figure.float-left { float: left; width: min(42%, 420px); margin: 4px 28px 18px 0; }
.prose .post-figure img { width: 100%; margin: 0; box-shadow: 0 0 0 2px var(--ink), 0 0 0 4px var(--edge); }
.post-figure figcaption { font-family: var(--font-ui); font-size: 13px; line-height: 1.4; color: var(--muted); }
.post-figure figcaption > :last-child { margin-bottom: 0; }
/* ```clear: what follows starts below any floated image. */
.prose .clear { clear: both; }
/* Floats stay inside the post. */
.post-body { display: flow-root; }
@media (max-width: 600px) {
  .post-figure.float-right, .post-figure.float-left { float: none; width: auto; margin: 0 0 22px; }
}
.post-video-title { font-family: var(--font-ui); font-size: 18px; color: var(--text); }
.prose .post-video-text { font-family: var(--font-prose); font-size: 17px; line-height: 1.55; color: var(--text-2); }
.post-video-text > :last-child { margin-bottom: 0; }

.profile { display: grid; grid-template-columns: 112px minmax(0, 1fr); gap: 24px; align-items: start; margin: 0 0 28px; }
.prose .profile-avatar { width: 112px; height: 112px; object-fit: cover; margin: 0; box-shadow: 0 0 0 2px var(--ink), 0 0 0 4px var(--edge); }
.profile-initial { display: grid; place-items: center; font-family: var(--font-display); font-size: 48px; color: var(--teal); background: var(--panel-2); }
.prose .profile-name { margin: 0 0 8px; font-family: var(--font-ui); font-size: 24px; color: var(--text); }
.profile p:last-child { margin-bottom: 0; }

.discord-card { max-width: 560px; margin: 0 0 22px; padding: 4px; font-family: var(--font-ui); font-size: 15px; line-height: 1.4; }
.discord-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 14px 18px; background: #5865F2; color: #fff; letter-spacing: .04em; }
.discord-online { font-size: 14px; }
.discord-body { padding: 14px 18px 6px; }
.discord-server { margin: 0 0 10px; color: var(--text); }
.discord-members { list-style: none; margin: 0 0 10px; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 16px; }
.discord-members li { display: flex; align-items: center; gap: 10px; min-width: 0; color: var(--text-2); }
.discord-members li span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.discord-members .avatar { flex: none; width: 24px; height: 24px; font-size: 12px; }
.discord-foot { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 10px; padding: 12px 18px; box-shadow: inset 0 2px 0 var(--edge-soft); }
.discord-join { padding: 6px 14px; background: var(--raised); color: var(--text); text-decoration: none; box-shadow: inset 0 0 0 2px var(--edge-2); }
.discord-join:hover { background: var(--raised-hover); color: var(--text); }

/* Code: numbers in their own column (never touching the code, never copied),
   the code scrolling sideways on its own. */
.code-block { display: flex; margin: 0 0 22px; background: #1B1E26; box-shadow: 0 0 0 2px var(--ink), inset 0 0 0 2px var(--edge); font-family: var(--font-ui); font-size: 15px; line-height: 1.6; }
.code-block pre { margin: 0; padding: 16px 0; font: inherit; }
.code-block .code-lines { flex: none; padding: 16px 14px 16px 18px; text-align: right; color: var(--faint); user-select: none; box-shadow: inset -2px 0 0 var(--edge-soft); }
.code-block .code-body { flex: 1; min-width: 0; padding: 16px 18px; overflow-x: auto; color: #E6E1D3; }
.code-body code { background: none; padding: 0; font: inherit; }
/* Syntax colours (syntect scope classes, hl- prefixed). */
.hl-comment { color: var(--faint); font-style: italic; }
.hl-keyword, .hl-storage.hl-modifier { color: #F0607A; }
.hl-storage, .hl-support.hl-type { color: #5FD3E6; font-style: italic; }
.hl-entity.hl-name.hl-function, .hl-support.hl-function, .hl-entity.hl-name.hl-type, .hl-entity.hl-name.hl-class { color: #A6E22E; }
.hl-string { color: var(--amber); }
.hl-constant, .hl-constant.hl-numeric { color: var(--purple); }
.hl-variable.hl-parameter, .hl-punctuation.hl-definition.hl-variable { color: #F0607A; }
.hl-keyword.hl-operator, .hl-punctuation.hl-separator { color: #F0607A; }
.hl-entity.hl-name.hl-tag { color: #F0607A; }
.hl-entity.hl-other.hl-attribute-name { color: #A6E22E; }

@media (max-width: 720px) {
  .gallery { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .profile { grid-template-columns: 72px minmax(0, 1fr); gap: 16px; }
  .prose .profile-avatar { width: 72px; height: 72px; }
  .discord-members { grid-template-columns: minmax(0, 1fr); }
}
