/* Xing's game screen (2026-10-08): a full-window client, the galaxy map on a canvas with HTML panels over it.
   The look (2026-10-12, docs/xing/look.md): 星图 Xīngtú, the star chart. Panels are lacquer navy with a gold hairline at the
   edge and gold corner marks, as on a printed plate; buttons are flat with a hairline edge, gold on hover; Space Grotesk
   is the look's voice and Noto Sans the reading text. Until 2026-10-13 frames and buttons were pixel art from the atlas
   (the 90s pixel look, with css/modern.css beside it for the modern one); their 8- and 16-pixel edges stay as
   transparent borders, so every rule that counts on them holds. */
@font-face { font-family: "Space Grotesk"; src: url("../fonts/spacegrotesk/SpaceGrotesk-Regular.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Space Grotesk"; src: url("../fonts/spacegrotesk/SpaceGrotesk-Medium.woff2") format("woff2"); font-weight: 500; font-display: swap; }
@font-face { font-family: "Space Grotesk"; src: url("../fonts/spacegrotesk/SpaceGrotesk-Bold.woff2") format("woff2"); font-weight: 700; font-display: swap; }
@font-face { font-family: "Noto Sans"; src: url("../fonts/notosans/NotoSans-Regular.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Noto Sans"; src: url("../fonts/notosans/NotoSans-Italic.woff2") format("woff2"); font-weight: 400; font-style: italic; font-display: swap; }
@font-face { font-family: "Noto Sans"; src: url("../fonts/notosans/NotoSans-Bold.woff2") format("woff2"); font-weight: 700; font-display: swap; }
/* the symbols Space Grotesk and Noto Sans lack (◀ ▶ ✓ ↩) */
@font-face { font-family: "DejaVu Sans Mono"; src: url("../fonts/dejavusansmono/DejaVuSansMono.ttf") format("truetype"); font-display: swap; }

:root {
  --space: #070b18;      /* the night: ink blue, not black */
  --panel: #0c1221;      /* lacquer navy */
  --panel-2: #121a2c;
  --line: #45577c;       /* the edges of buttons, fields and boxes (#2c3a58 until 2026-10-13) */
  --rule: #28344f;       /* the lines between rows (#19223a until then) */
  --text: #ece7dc;       /* paper white */
  --text-dim: #9aa1b2;
  --amber: #ffc65a;
  --amber-2: #d9952a;
  --cyan: #5ad6e6;
  --violet: #c27ae8;
  --gold: #c9a45c;       /* the hairlines and corner marks */
  --gold-line: rgba(201, 164, 92, 0.65);   /* a panel's edge and the bars' lines (0.38 until 2026-10-13) */
  --cinnabar: #d9483b;   /* seals, war, danger */
  --jade: #5fc49a;       /* food and growth */
  --btn: #131b2e;
  --btn-hi: #1b2541;
  --field: #0a0f1c;      /* the inside of a field: a select, an input */
  /* the look's voice, then reading text; DejaVu Sans Mono has the symbols both lack */
  --font-head: "Space Grotesk", "Noto Sans", "DejaVu Sans Mono", "Noto Sans CJK SC", "PingFang SC", "Microsoft YaHei", sans-serif;
  --font-body: "Noto Sans", "DejaVu Sans Mono", "Noto Sans CJK SC", "PingFang SC", "Microsoft YaHei", sans-serif;
  --font-cjk: "Noto Sans CJK SC", "Noto Sans SC", "Source Han Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
  --body-size: 14px;
  --body-line: 1.45;
  --head-l: 22px;     /* the star's name */
  --head-m: 16px;     /* a body's name */
  --head-s: 15px;     /* buttons, the star type */
  --head-xs: 13px;    /* the special's badge */
  --panel-w: 352px;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--space); color: var(--text); font: var(--body-size)/var(--body-line) var(--font-body);
  font-synthesis: none; overscroll-behavior: none; -webkit-text-size-adjust: 100%; }
body { overflow: hidden; }
#game { position: fixed; inset: 0; display: grid; grid-template-rows: auto minmax(0, 1fr) auto; grid-template-columns: minmax(0, 1fr); }
table { font-variant-numeric: tabular-nums; }

/* ---- frames: the bars, and the panels with a gold hairline at the edge and gold corner marks */
.bar { border: 8px solid transparent; background: linear-gradient(180deg, #0e1527, #0a0f1d) border-box; }
.panel {
  position: absolute; border: 16px solid transparent; border-radius: 2px;
  background:
    linear-gradient(var(--gold), var(--gold)) left top / 14px 1px no-repeat border-box,
    linear-gradient(var(--gold), var(--gold)) left top / 1px 14px no-repeat border-box,
    linear-gradient(var(--gold), var(--gold)) right top / 14px 1px no-repeat border-box,
    linear-gradient(var(--gold), var(--gold)) right top / 1px 14px no-repeat border-box,
    linear-gradient(var(--gold), var(--gold)) left bottom / 14px 1px no-repeat border-box,
    linear-gradient(var(--gold), var(--gold)) left bottom / 1px 14px no-repeat border-box,
    linear-gradient(var(--gold), var(--gold)) right bottom / 14px 1px no-repeat border-box,
    linear-gradient(var(--gold), var(--gold)) right bottom / 1px 14px no-repeat border-box,
    linear-gradient(180deg, #0f1629, #0a0f1d) border-box;
  outline: 1px solid var(--gold-line); outline-offset: -1px; box-shadow: 0 14px 36px rgba(0, 0, 0, 0.5);
}

/* ---- buttons: 44 px targets for touch; flat, a hairline edge, gold on hover */
.btn { font: 500 var(--head-s)/1 var(--font-head); letter-spacing: 0.01em; color: var(--text); background: var(--btn); min-height: 44px;
  min-width: 44px; padding: 0 6px; cursor: pointer; touch-action: manipulation; user-select: none; -webkit-user-select: none;
  border: 8px solid transparent; border-radius: 2px; outline: 1px solid var(--line); outline-offset: -1px; }
.btn:hover:not(:disabled) { background: var(--btn-hi); outline-color: var(--gold); color: #fff; }
.btn:active:not(:disabled) { background: #0d1324; }
.btn:disabled { background: #0c111e; outline-color: #283350; color: #5a6379; cursor: default; }
/* looks disabled, but a click still says why (2026-10-12: the battle board's Retreat before its round) */
.btn[aria-disabled="true"] { background: #0c111e; outline-color: #283350; color: #5a6379; }
.btn:focus-visible { outline: 1px dashed var(--amber); outline-offset: 2px; }
.btn img { display: block; }
/* a link styled as a button (the Game menu's manual link): centred like a button, no underline */
a.btn { display: inline-flex; align-items: center; justify-content: center; text-align: center; text-decoration: none; }

select, input { font: var(--body-size) var(--font-body); color: var(--text); background: var(--field); border: 1px solid var(--line);
  border-radius: 2px; height: 34px; padding: 0 6px; }
select:focus, input:focus { outline: 1px solid var(--amber-2); }
input[type=number] { width: 7.5em; }

/* ---- top bar: the logo, the player's empire, the turn, the galaxy */
.topbar { position: relative; z-index: 5; display: flex; align-items: center; gap: 8px 20px; padding: 0 4px; min-height: 60px;
  background: linear-gradient(var(--gold-line), var(--gold-line)) left bottom / 100% 1px no-repeat border-box,
  linear-gradient(180deg, #0e1527, #0a0f1d) border-box; }
/* the 星 seal and XĪNG */
.brand { display: flex; align-items: center; gap: 10px; font: 500 20px/1 var(--font-head); color: var(--text); letter-spacing: 0.2em; }
.brand .seal { width: 34px; height: 34px; margin: 0; font-size: 23px; background: var(--cinnabar); color: #f6f1e6; vertical-align: middle; }
.empire-badge { display: flex; align-items: center; gap: 8px; min-width: 0; }
.empire-badge .swatch { width: 14px; height: 14px; flex: none; box-shadow: 0 0 0 2px var(--space), 0 0 0 3px var(--line); }
.empire-name { font: var(--head-m)/1.1 var(--font-head); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.empire-race { color: var(--text-dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
/* the turn number, a button that opens the turn's report again (2026-10-10) */
.turn-label { font: var(--head-m)/1 var(--font-head); color: var(--amber); white-space: nowrap; background: none; border: 0;
  padding: 6px 2px; cursor: pointer; }
.turn-label:hover { text-decoration: underline; }
.turn-label:focus-visible { outline: 1px dashed var(--amber); outline-offset: 2px; }
.turn-label.flash { animation: turn-flash 0.9s ease-in-out 1; }
@keyframes turn-flash { 0%, 33%, 66% { color: #fff; } 16%, 50%, 100% { color: var(--amber); } }
.galaxy-info { margin-left: auto; color: var(--text-dim); white-space: nowrap; }
/* the empire's totals (2026-10-09) */
.totals { display: flex; align-items: center; gap: 4px 14px; font: var(--head-m)/1 var(--font-head); white-space: nowrap;
  font-variant-numeric: tabular-nums; }
.total { display: inline-flex; align-items: center; gap: 4px; }
.total.short, .total .short { color: #ff7a7a; }
/* the research total opens the Research screen ("research" alone is the screen's own class) */
.total.to-research, .total.to-finance { cursor: pointer; }
.total.to-research:focus-visible, .total.to-finance:focus-visible { outline: 1px dashed var(--amber); outline-offset: 2px; }
.total.idle { color: var(--amber); }
.total .income { color: var(--text-dim); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
/* a seal (印章 yìnzhāng, 2026-10-12): a race's character on a square of its empire's colour (js/ui/describe.js seal()) */
.seal { display: inline-grid; place-items: center; width: 1.32em; height: 1.32em; margin-right: 0.12em; border-radius: 2px;
  background: var(--seal, var(--cinnabar)); color: var(--seal-ink, #f6f1e6); font: 700 0.9em/1 var(--font-cjk);
  vertical-align: -0.24em; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.16); }

/* ---- the map */
.map { position: relative; overflow: hidden; min-height: 0; }
/* drawn at the screen's own pixels: pixelated keeps it from being smoothed again when its size rounds to a whole pixel */
.map canvas.galaxy { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none;
  image-rendering: pixelated; cursor: grab; }
.map canvas.galaxy.dragging { cursor: grabbing; }
.map canvas.galaxy.over-star { cursor: pointer; }
.zoom-controls { position: absolute; left: 10px; bottom: 10px; display: flex; flex-direction: column; gap: 4px; }
.zoom-controls .btn { width: 44px; height: 44px; padding: 0; display: grid; place-items: center; }

/* ---- bottom bar (the game's screens; not built yet) */
.bottombar { display: flex; align-items: center; gap: 4px; padding: 0 2px; min-height: 60px;
  background: linear-gradient(var(--gold-line), var(--gold-line)) left top / 100% 1px no-repeat border-box,
  linear-gradient(180deg, #0c1323, #090e1b) border-box; }
.bottombar .btn { padding: 0 10px; flex: none; }
.bottombar .screens { flex: 1; min-width: 0; display: flex; gap: 4px; overflow-x: auto; }
.bottombar .turn { min-width: 96px; }
.bottombar .turn:not(:disabled) { color: var(--amber); }
/* Research while nothing is being researched (2026-10-09, Robin): amber text that glows, and the button's own edge in
   amber, breathing (it pulsed in steps in the pixel look). Steady for people who ask for less motion. */
.bottombar .btn.attention { color: var(--amber); outline: 1px solid var(--amber); outline-offset: -1px;
  animation: attention 1.6s ease-in-out infinite; }
@keyframes attention {
  0%, 100% { outline-color: rgba(255, 198, 90, 0.25); text-shadow: none; }
  50% { outline-color: rgba(255, 198, 90, 1); text-shadow: 0 0 6px rgba(255, 198, 90, 0.9); }
}
.bottombar .btn.attention:focus-visible { outline: 1px dashed var(--amber); outline-offset: 2px; animation: none; }
@media (prefers-reduced-motion: reduce) { .bottombar .btn.attention { animation: none; } }

/* ---- star panel */
.star-panel { top: 8px; right: 8px; bottom: 8px; width: var(--panel-w); max-width: calc(100% - 16px); display: flex; flex-direction: column; }
.star-panel[hidden] { display: none; }
.star-panel .close { position: absolute; top: 0; right: 0; width: 44px; height: 44px; padding: 0; display: grid; place-items: center; z-index: 1; }
.star-panel .scroll { flex: 1; min-height: 0; overflow-y: auto; padding: 0 4px 4px 0; overscroll-behavior: contain; }
.star-panel header { display: flex; align-items: center; gap: 10px; margin: 0 48px 8px 0; min-height: 44px; }
.star-panel header img { flex: none; }
.star-panel h2 { margin: 0; font: 700 var(--head-l)/1.1 var(--font-head); color: var(--amber); overflow-wrap: anywhere; }
.star-panel h2 .chars { font-weight: 400; }   /* a Chinese name's characters, in the system's Chinese font (2026-10-11) */
.star-panel .kind { font: var(--head-s)/1.2 var(--font-head); }
.star-panel .desc { margin: 0 0 10px; color: var(--text-dim); }
.star-panel canvas.orbits { display: block; width: 100%; height: 80px; margin: 0 0 6px;
  background: var(--space); border: 1px solid var(--rule); }
/* the Planets and Ships tabs (2026-10-10, Robin chose the mockups' layout C with B's orbit strip); the star's name,
   description and tabs stay put above the scrolling content */
.star-panel .star-top { flex: none; }
.star-tabs { display: flex; gap: 6px; margin: 0 0 8px; }
.star-tabs .btn { flex: 1 1 0; min-width: 0; padding: 0 4px; }
.star-tabs .btn[aria-selected="true"] { color: var(--amber); outline-color: var(--gold);
  background: linear-gradient(var(--amber), var(--amber)) left bottom / 100% 2px no-repeat border-box, var(--btn-hi); }
.star-tabs .badge { margin-left: 6px; padding: 0 4px; color: var(--space); background: var(--amber); white-space: nowrap; }
.star-tabs .badge.coming { background: var(--cyan); }   /* 2026-10-11: other empires' fleets seen heading here */
/* three tabs since 2026-10-11: Planets and Fleet as wide as their words, Ships (with its badge) the rest */
.star-tabs .btn.tab-planets, .star-tabs .btn.tab-fleet { flex: 0 0 auto; padding: 0 6px; }
.star-tabs .btn.tab-ships { flex: 1 1 auto; }
@media (max-height: 560px) {
  /* a short window, such as a phone held sideways: the whole panel scrolls, the star's name and tabs with it, and the
     X stays at the top (2026-10-10, review: at 667 x 375 the fixed top left the tab's content 4 pixels) */
  .star-panel { overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; scrollbar-color: #4f6789 #0e1424; }
  .star-panel .close { position: sticky; top: 0; flex: none; align-self: flex-end; margin-bottom: -44px; }
  .star-panel .scroll { flex: none; min-height: auto; overflow: visible; }
}
/* the orbit strip: a button over each body (placed when the strip is drawn) opens it below */
.orbit-pick { position: relative; }
.orbit-hit { position: absolute; top: 0; height: 80px; padding: 0; background: none; border: 0; cursor: pointer; touch-action: manipulation; }
.orbit-hit:focus-visible { outline: 1px dashed var(--amber); outline-offset: -3px; }
/* a short line for each body; the open one in full under its line */
.body-list { list-style: none; margin: 0; padding: 0; }
.body-list > li { border-top: 1px solid var(--rule); }
.body-list > li:first-child { border-top: 0; }
.body-row { width: 100%; display: grid; grid-template-columns: 26px 36px minmax(0, 1fr) auto; align-items: center; gap: 8px;
  padding: 4px 4px 4px 2px; font: inherit; color: var(--text); text-align: left; background: none; border: 0; cursor: pointer;
  touch-action: manipulation; }
.body-row:hover { background: var(--panel-2); }
.body-row:focus-visible { outline: 1px dashed var(--amber); outline-offset: -2px; }
.body-row[aria-expanded="true"] { background: var(--panel-2); box-shadow: inset 3px 0 0 var(--amber); }
.body-row .num { color: var(--text-dim); text-align: center; font-family: var(--font-head); }   /* Noto Sans's I has serifs */
.body-row .pic { width: 36px; height: 36px; display: grid; place-items: center; }
.body-row .pic img { max-width: 36px; max-height: 36px; }
.body-row .what { min-width: 0; font: var(--head-s)/1.2 var(--font-head); }
.body-row .sub { display: block; color: var(--text-dim); font: var(--body-size)/1.2 var(--font-body); }
.body-row .tag { text-align: right; white-space: nowrap; }
.body-row .tag .claim { display: block; color: var(--amber); }
.dim { color: var(--text-dim); }
.body-full { display: flex; gap: 10px; align-items: flex-start; padding: 4px 4px 10px 8px; background: var(--panel-2);
  box-shadow: inset 3px 0 0 var(--amber); }
.body-full .pic { width: 64px; height: 64px; display: grid; place-items: center; flex: none; }
.body-full .name { font: var(--head-m)/1.2 var(--font-head); color: var(--text); }
.body-full .facts { color: var(--text-dim); }
.body-full .facts.defences { color: var(--text); }   /* 2026-10-11, war piece 3 */
.planet-title .facts.conquered { color: var(--amber); }   /* 2026-10-11, war piece 5: a conquered colony */
.body-full .facts.defences.silenced { color: #ff9a8a; }
.body-full .special { display: inline-block; margin-top: 3px; padding: 1px 6px; color: var(--space); background: var(--cyan); font: var(--head-xs)/1.2 var(--font-head); }
.note { margin: 10px 0 0; padding: 6px 8px; background: var(--panel-2); border-left: 3px solid var(--violet); }
.note.unexplored { border-left-color: var(--line); color: var(--text-dim); }
.note.hint { border-left-color: var(--amber-2); color: var(--text-dim); }
.note.error { border-left-color: #ff5a5a; color: #ffb4b4; }
.note.ahead { border-left-color: #ff5a5a; }   /* 2026-10-11: an enemy war fleet where the fleet is going */
.fleet-line .out-of-contact { color: var(--amber); }   /* 2026-10-11: a fleet in flight that cannot change course */
.note.ahead p { margin: 0; }
.note.ahead p + p { margin-top: 4px; }
.body-full .colony { font-family: var(--font-head); }
.order { color: var(--amber); }

/* ---- ships in the panels (2026-10-08) */
.ships-here { margin: 0 0 10px; padding: 6px 8px; background: var(--panel-2); }
.ships-here h3 { margin: 0 0 4px; font: var(--head-m)/1.2 var(--font-head); color: var(--text); }
.ships-here .fleet-list + h3 { margin-top: 8px; }   /* "Other ships here" under the player's (2026-10-09) */
.fleet-list { list-style: none; margin: 0; padding: 0; }
.fleet-list li { display: flex; align-items: center; gap: 8px; padding: 3px 0; }
.fleet-list li + li { border-top: 1px solid var(--rule); }   /* 2026-10-13 */
/* a row that opens its fleet (2026-10-11): the Ships tab, and the fleet panel's other fleets here */
.fleet-list li.pick { cursor: pointer; touch-action: manipulation; }
.fleet-list li.pick:hover .ship-name { color: var(--amber); }
.ship-icon { flex: none; }
.ship-name { flex: 1; min-width: 0; }
.ship-status { display: block; color: var(--text-dim); }
.ship-status.waiting-long { color: var(--amber); }   /* waiting for orders three turns or more (2026-10-10) */
.fleet-line { margin: 6px 0 0; }
.ship-list { margin: 6px 0 0; padding-left: 18px; }
.settle { margin-top: 4px; }
/* what a colony or outpost ship can claim, in its fleet panel (2026-10-09) */
.claims { margin: 10px 0 0; }
.claim-list { list-style: none; margin: 0; padding: 0; }
.claim-list li { display: flex; gap: 8px; align-items: flex-start; padding: 6px 0; border-top: 1px solid var(--rule); }
.claim-list li:first-child { border-top: 0; }
.claim-pic { flex: none; width: 32px; height: auto; object-fit: contain; }
.claim-main { flex: 1; min-width: 0; }
.claim-main .name { font: var(--head-s)/1.2 var(--font-head); }
.claim-main .facts { color: var(--text-dim); }
.empty { margin: 4px 0; color: var(--text-dim); font-style: italic; }
.link { color: var(--amber); text-decoration: underline; cursor: pointer; touch-action: manipulation; }
.link:hover { color: #fff; }
.star-panel .scroll, .bottombar .screens { scrollbar-width: thin; scrollbar-color: #4f6789 #0e1424; }

/* ---- a colony's people in three rows, coloured by what they make (2026-10-09; the planet screen since the same day) */
.planet { --food: var(--jade); }
.planet p.facts { margin: 4px 0 0; color: var(--text-dim); }
.colony-pop { display: flex; align-items: center; gap: 6px; margin: 10px 0 0; font: var(--head-m)/1.2 var(--font-head); }
.job-row { margin-top: 10px; padding-top: 8px; border-top: 1px solid var(--rule); }
.job-head { display: flex; align-items: center; gap: 6px; }
.job-name { flex: 1; min-width: 0; font: var(--head-m)/1.2 var(--font-head); }
.job-out { display: inline-flex; align-items: center; gap: 4px; min-width: 4em; font: var(--head-m)/1 var(--font-head); }
.job-farmers .job-out { color: var(--food); }
.job-workers .job-out { color: var(--amber); }
.job-scientists .job-out { color: var(--cyan); }
.btn.job-btn { width: 40px; padding: 0; display: grid; place-items: center; }
.job-people { display: flex; flex-wrap: wrap; margin: 6px 0 2px; min-height: 28px; }
.job-people img { margin-right: -2px; }
.job-people .none { color: var(--text-dim); font-style: italic; align-self: center; }
.job-row .facts { color: var(--text-dim); }
/* favourites (2026-10-13, ui/favourite.js): the star that marks one by its name, the star in lists, Favourites only */
.title-row { display: flex; align-items: center; gap: 8px; }
.title-row h2 { min-width: 0; }
.fav-btn { flex: none; display: inline-grid; place-items: center; width: 28px; height: 28px; padding: 0; background: none;
  border: 1px solid transparent; border-radius: 2px; cursor: pointer; touch-action: manipulation; }
.fav-btn img { display: block; width: 20px; height: 20px; }
.fav-btn:hover { border-color: var(--gold); }
.fav-btn:focus-visible { outline: 1px dashed var(--amber); outline-offset: 1px; }
.title-row .fav-btn { width: 40px; height: 40px; }
.title-row .fav-btn img { width: 26px; height: 26px; }
.fav-mark { width: 14px; height: 14px; margin-right: 4px; vertical-align: -2px; }
.fav-filter { display: inline-flex; align-items: center; gap: 6px; min-height: 32px; padding: 0 10px; font: var(--head-s)/1.2 var(--font-head);
  color: var(--text-dim); background: var(--btn); border: 1px solid var(--line); border-radius: 2px; cursor: pointer; }
.fav-filter img { width: 16px; height: 16px; }
.fav-filter:hover:not(:disabled) { border-color: var(--gold); color: var(--text); }
.fav-filter[aria-pressed="true"] { color: var(--amber); border-color: var(--amber); background: var(--panel-2); }
.fav-filter:disabled { opacity: 0.55; cursor: default; }
.fav-filter:focus-visible { outline: 1px dashed var(--amber); outline-offset: 2px; }
/* names a player gives (2026-10-13, ui/names.js): the pencil beside a name, the field in its place, a named fleet's ships */
.rename-btn { flex: none; display: inline-grid; place-items: center; width: 36px; height: 36px; padding: 0; background: none;
  border: 1px solid transparent; border-radius: 2px; cursor: pointer; touch-action: manipulation; }
.rename-btn img { display: block; width: 20px; height: 20px; }
.rename-btn:hover { border-color: var(--gold); }
.rename-btn:focus-visible { outline: 1px dashed var(--amber); outline-offset: 1px; }
.title-row .rename-btn { margin-left: -4px; }
.name-edit { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.name-field { flex: 1 1 100%; min-width: 0; max-width: 20em; height: 36px; font: var(--head-m)/1.2 var(--font-head); }
.fleet-title { flex: 1; min-width: 0; }
.named-ships, .own-name { color: var(--text-dim); font-size: 13px; }   /* what a named fleet holds; a named colony's planet */
/* decorations (2026-10-13, ui/ranks.js): a ship's rank, one to three gold chevrons, by its name */
.rank-badge { width: 16px; height: 16px; margin-right: 4px; vertical-align: -3px; }
h3 .rank-badge, h4 .rank-badge { width: 18px; height: 18px; vertical-align: -3px; }
.facts.record { color: var(--text); }
/* New people (2026-10-13): what a colony's new people do, a button a choice showing its people, the chosen one in amber */
.new-people { margin-top: 10px; padding-top: 8px; border-top: 1px solid var(--rule); }
.np-head { display: flex; align-items: baseline; gap: 8px; }
.np-title { flex: 1; font: var(--head-m)/1.2 var(--font-head); }
.np-now { font: var(--head-s)/1.2 var(--font-head); color: var(--amber); }
.np-choices { display: flex; flex-wrap: wrap; gap: 4px; margin: 6px 0 2px; }
.np-choice { display: inline-flex; align-items: center; justify-content: center; min-width: 40px; min-height: 40px; padding: 0 6px;
  background: var(--btn); border: 1px solid var(--line); border-radius: 2px; cursor: pointer; touch-action: manipulation; }
.np-choice img { display: block; margin: 0 -1px; }
.np-choice:hover:not(:disabled) { background: var(--btn-hi); border-color: var(--gold); }
.gov-choice { min-width: 0; min-height: 32px; padding: 0 10px; font: var(--head-s)/1.2 var(--font-head); color: var(--text); }   /* the governor's choices (2026-10-15; the picture buttons set no text colour, so the labels took the button's dark default) */
.gov-choice.chosen { color: var(--amber); }
.np-choice.chosen { background: var(--panel-2); border-color: var(--amber); box-shadow: inset 0 0 0 1px var(--amber); }
.np-choice:disabled { opacity: 0.35; cursor: default; }
.np-choice:focus-visible { outline: 1px dashed var(--amber); outline-offset: 2px; }
.new-people .facts { color: var(--text-dim); }
/* the Colonies screen's: a list under a row's jobs, and New colonies above the table */
.np-pick { display: inline-flex; align-items: center; gap: 6px; color: var(--text-dim); font-size: 12px; white-space: nowrap; }
.np-pick select { height: 26px; padding: 0 4px; font-size: 13px; }
.colony-table .np-pick { display: flex; margin-top: 4px; }
.colonies-sum .np-colonies { margin-left: 6px; }
.note.food { border-left-color: var(--food); }
/* a guardian at the star (2026-10-10, docs/xing/combat.md): its picture beside what it is */
.note.guardian { display: flex; gap: 8px; align-items: flex-start; margin: 0 0 8px; border-left-color: #ff7a6a; }
.note.guardian img { flex: none; }
.note.guardian .name { font: var(--head-s)/1.2 var(--font-head); color: var(--text); }
.note.guardian p { margin: 2px 0 0; }
.planets-table td.guarded img { vertical-align: middle; margin-right: 4px; }
p.order { margin: 10px 0 0; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.body-full .room { color: var(--text); }
.body-full .room .hungry { color: var(--amber); }   /* its people would live on food shipped in (2026-10-09) */

/* ---- the build queue (2026-10-09; on the planet screen since the same day) */
.planet h3 { margin: 12px 0 4px; font: var(--head-m)/1.2 var(--font-head); color: var(--text); }
.queue { list-style: none; margin: 6px 0 0; padding: 0; }
.queue li { display: flex; align-items: flex-start; gap: 8px; padding: 6px 0; border-top: 1px solid var(--rule); }
.queue li:first-child { border-top: 0; }
.queue li.front { background: var(--panel-2); padding: 6px; }
.queue li.trade-row .item-name { color: var(--amber); }   /* trade goods, chosen, at the bottom of the queue (2026-10-09) */
.item-pic { flex: none; width: 28px; height: auto; margin-top: 2px; }
.item-main { flex: 1; min-width: 0; }
.item-name { font: var(--head-m)/1.2 var(--font-head); }
.item-buttons { display: flex; gap: 4px; flex: none; }
.planet .facts { color: var(--text-dim); }
.btn.small.icon { width: 36px; padding: 0; display: grid; place-items: center; }
.btn.small.buy { margin-top: 4px; color: var(--amber); display: inline-flex; align-items: center; gap: 4px; }
.btn.small.buy:disabled { color: #5a6379; }
.btn.small.buy:disabled img { opacity: 0.4; }
.progress { height: 8px; margin: 4px 0 2px; background: var(--space); border: 1px solid var(--line);
  background-image: linear-gradient(90deg, var(--amber-2) var(--done, 0%), transparent var(--done, 0%)); }

/* ---- the planet screen (2026-10-09): one of the player's colonies over the whole map, the planet turning at the top,
   then People, Building and Add side by side, each scrolling on its own; on narrower screens two columns, then one,
   and the whole screen scrolls. Since 2026-10-11 (Robin: "bump up the build list items to fill the space between the
   top buttons and the current list") one grid: the planet's header over People and Building, the buttons top right,
   and Add from under the buttons to the bottom */
.planet-overlay { padding: 8px; }
.planet { width: 100%; height: 100%; }   /* the whole window since 2026-10-11 (Robin: "We can just make the modal bigger or just full screen"); 1320 pixels at most before */
.overlay > .panel.planet { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1.3fr);
  grid-template-rows: auto auto minmax(0, 1fr); column-gap: 18px; }
.planet-head { grid-column: 1 / 3; grid-row: 1 / 3; display: flex; gap: 16px; align-items: center; padding: 0 0 8px;
  border-bottom: 1px solid var(--rule); }
.portrait-box { position: relative; flex: none; width: 200px; height: 200px; margin: -6px 0 -6px -6px; }
.portrait-box .portrait { display: block; width: 100%; height: 100%; opacity: 0; transition: opacity 0.4s ease-out; }
.portrait-box .portrait.ready { opacity: 1; }
/* what orbits the planet (2026-10-10: a shipyard), on a canvas over it */
.portrait-box .portrait-overlay { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; opacity: 0;
  transition: opacity 0.4s ease-out; }
.portrait-box .portrait-overlay.ready { opacity: 1; }
/* an asteroid belt's colony (2026-10-12): its picture in the portrait's place */
.portrait-box .portrait-belt { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }
.planet-title { flex: 1; min-width: 0; }
.planet-title h2 { margin: 0; overflow-wrap: anywhere; }
.planet-title .kind { font: var(--head-s)/1.2 var(--font-head); }
.planet-title .colony-pop { margin-top: 6px; font: inherit; align-items: flex-start; }
.planet-title .colony-pop b { font: var(--head-m)/1.2 var(--font-head); color: var(--text); font-weight: 400; }
.planet-makes { display: flex; flex-wrap: wrap; gap: 4px 16px; margin: 8px 0 0; font: var(--head-m)/1.2 var(--font-head); }
.planet-makes span { display: inline-flex; align-items: center; gap: 4px; }
.planet-nav { grid-column: 3; grid-row: 1; display: flex; gap: 6px; align-self: start; flex-wrap: wrap; justify-content: flex-end;
  padding-bottom: 8px; }
.planet-nav .btn.close { position: static; }
.planet-cols { grid-column: 1 / 3; grid-row: 3; min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 0 18px; margin-top: 8px; }
.planet-col { min-height: 0; overflow-y: auto; padding: 0 4px 8px 0; scrollbar-width: thin; scrollbar-color: #4f6789 #0e1424; }
.planet-col.add { grid-column: 3; grid-row: 2 / 4; }
/* another empire's colony (2026-10-14, Inside): nothing to add, so two columns: the buttons, the planet's header, then
   People and Building */
.overlay > .panel.planet.theirs { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.planet.theirs .planet-nav { grid-column: 1 / 3; grid-row: 1; }
.planet.theirs .planet-head { grid-column: 1 / 3; grid-row: 2; }
.planet.theirs .planet-cols { grid-column: 1 / 3; grid-row: 3; display: grid; }
.planet.theirs .agents { margin: 4px 0 0; color: var(--cyan); }
.col-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; position: sticky; top: 0; z-index: 1;
  background: var(--panel); padding: 2px 0 4px; }
.planet .col-head h3 { margin: 4px 0; color: var(--amber); }   /* .overlay h3, later in the file, would win otherwise */
.col-note { display: inline-flex; align-items: center; gap: 4px; color: var(--text-dim); }
.planet h4 { margin: 10px 0 6px; font: var(--head-s)/1.2 var(--font-head); color: var(--text-dim); }
/* Add (2026-10-09, Robin: "build options in a list, with a description panel below the list"; until then cards, their
   text cut after three lines): a row an item, its + adding it, and the picked row in full in a panel that stays at the
   bottom of the column; on a phone or in a short window it opens under the picked row (planetscreen.js puts it there,
   UNDER_ROW, the same query as below) */
.build-list { display: flex; flex-direction: column; gap: 2px; }
.build-row { display: flex; align-items: center; gap: 4px; }
.build-row + .build-row { border-top: 1px solid var(--rule); padding-top: 2px; }   /* 2026-10-13 */
.build-pick { flex: 1; min-width: 0; min-height: 36px; display: flex; align-items: center; gap: 8px; padding: 3px 6px; font: inherit;
  color: var(--text); text-align: left; background: none; border: 1px solid transparent; cursor: pointer; touch-action: manipulation; }
.build-pick:hover { border-color: var(--line); }
.build-pick:focus-visible { outline: 1px dashed var(--amber); outline-offset: 1px; }
.build-row.selected .build-pick { background: var(--panel-2); border-color: var(--amber-2); }
.build-pick .item-pic { margin-top: 0; }
.build-name { flex: 1; min-width: 0; font: var(--head-s)/1.2 var(--font-head); overflow-wrap: anywhere; }
.build-sub { flex: 0 1 auto; display: inline-flex; flex-wrap: wrap; justify-content: flex-end; align-items: center; gap: 4px;
  color: var(--amber); text-align: right; }
.build-row.locked .build-name, .build-row.locked .build-sub, .build-row.queued .build-sub { color: var(--text-dim); }
.build-row.locked .item-pic, .build-detail.locked .detail-pic { opacity: 0.6; }
/* bottom: the column's own bottom padding, so no strip of the list shows under the panel; max-height: a long
   description scrolls inside it rather than covering the rows */
.build-detail { position: sticky; bottom: -8px; z-index: 1; max-height: 40vh; overflow-y: auto; margin-top: 8px; padding: 8px 10px 10px;
  background: var(--panel-2); border: 1px solid var(--amber-2); box-shadow: 0 -8px 12px var(--panel); }
.detail-head { display: flex; align-items: center; gap: 10px; }
.detail-pic { flex: none; max-width: 64px; }
.build-detail p { margin: 6px 0 0; }
.build-detail .btn { margin-top: 8px; }
.built { list-style: none; margin: 4px 0 0; padding: 0; }
.built li { display: flex; gap: 8px; align-items: flex-start; padding: 4px 0; }
.built li + li { border-top: 1px solid var(--rule); }   /* 2026-10-13 */
.built li > span { display: flex; flex-direction: column; min-width: 0; }
@media (max-width: 1100px) {
  /* two columns (2026-10-11; before, Add went below People and Building, out of view): on the left the planet's
     header over People and Building, which scroll together; on the right the buttons, and Add under them */
  .overlay > .panel.planet { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .planet-head { grid-column: 1; }
  .portrait-box { width: 150px; height: 150px; margin: -4px 0 -4px -4px; }
  .planet-nav { grid-column: 2; }
  .planet-cols { grid-column: 1; display: block; overflow-y: auto; }
  .planet-cols .planet-col { overflow: visible; min-height: auto; }
  .planet-cols .col-head { position: static; }
  .planet-col.add { grid-column: 2; }
}
@media (max-width: 950px) {
  /* narrower still (2026-10-11): the whole screen scrolls, as on a phone: the buttons, the planet, People and Building
     side by side, then Add */
  .overlay > .panel.planet { display: flex; flex-direction: column; overflow-y: auto; }
  .planet-head { flex: none; }
  .planet-nav { order: -1; align-self: stretch; }
  .planet-cols { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); flex: none; overflow: visible; }
  .planet-col.add { flex: none; overflow: visible; min-height: auto; margin-top: 8px; }
  .col-head { position: static; }
  .build-detail { bottom: 0; }   /* the screen scrolls here, and it has no bottom padding */
}
@media (max-width: 700px) {
  /* one column */
  .planet-head { flex-wrap: wrap; gap: 8px; }
  .portrait-box { width: 120px; height: 120px; margin: -4px 0; }
  .planet-nav { justify-content: flex-start; }
  .planet-cols { grid-template-columns: minmax(0, 1fr); }
  /* the cost, or the tech a building needs, on a line under the name */
  .build-pick { display: grid; grid-template-columns: auto minmax(0, 1fr); column-gap: 8px; row-gap: 2px; }
  .build-pick .item-pic { grid-row: span 2; }
  .build-sub { justify-content: flex-start; text-align: left; }
}
@media (max-width: 700px), (max-height: 780px) {
  /* Add's panel under the picked row, scrolling with the list (2026-10-09, review: pinned in a short window, it left
     no room for the rows) */
  .build-detail { position: static; max-height: none; overflow: visible; margin: 2px 0 6px; box-shadow: none; }
}
@media (max-height: 560px) {
  /* a short window, such as a phone held sideways: the whole screen scrolls, the planet with it, as on a phone
     (2026-10-09; before, the planet's header left the columns no room) */
  .planet { overflow-y: auto; }
  .overlay > .panel.planet { grid-template-rows: auto auto auto; }
  .planet-col.add { grid-row: 3; }   /* beside People and Building: the screen scrolls, and Add at its full height would
                                        stretch the header's row */
  .planet-cols { flex: none; overflow: visible; }
  .planet-col { overflow: visible; min-height: auto; }
  .col-head { position: static; }
  .portrait-box { width: 120px; height: 120px; margin: -4px 0; }
}

/* ---- the Colonies screen (2026-10-09): every colony a row, a colony with nothing to build in amber; on a phone each
   row is a card of labelled figures */
.colonies { width: min(1480px, 100%); }   /* wider since 2026-10-11, for its minerals and jobs' - and + */   /* as tall as its rows, up to the screen (.overlay > .panel) */
.colonies .screen-head { margin-bottom: 0; }   /* its summary line sits close below */
.colonies-sum { margin: 4px 0 8px; color: var(--text-dim); display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; }
.colonies-sum .idle-note { color: var(--amber); }
.colonies-sum .link { font: inherit; background: none; border: 0; padding: 0; }
.sort-by { display: none; margin-left: auto; align-items: center; gap: 6px; }
.colony-table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.colony-table th { position: sticky; top: 0; z-index: 1; background: var(--panel); text-align: left; padding: 4px 8px 6px;
  border-bottom: 1px solid var(--line); white-space: nowrap; }
.colony-table th.num, .colony-table td.num { text-align: right; }
.colony-table .sort { font: var(--head-s)/1.2 var(--font-head); color: var(--text-dim); background: none; border: 0; padding: 4px 0;
  cursor: pointer; min-height: 32px; }
.colony-table .sort:hover, .colony-table th[aria-sort="ascending"] .sort, .colony-table th[aria-sort="descending"] .sort { color: var(--amber); }
.colony-table .sort:focus-visible { outline: 1px dashed var(--amber); outline-offset: 2px; }
.colony-table th:not(:has(.sort)) { font: var(--head-s)/1.2 var(--font-head); color: var(--text-dim); }
/* the line between rows drawn by the row (2026-10-13): the first cell is a flex box rather than a table cell, and drew its
   own a pixel lower than the rest */
.colony-table td { padding: 6px 8px; vertical-align: middle; }
.colony-table tbody tr { border-top: 1px solid var(--rule); }
.colony-row { cursor: pointer; }
.colony-row:hover td { background: var(--panel-2); }
.colony-row.is-idle td:first-child { box-shadow: inset 3px 0 0 var(--amber); }
.colony-table .sub { display: block; color: var(--text-dim); font-size: 12px; white-space: nowrap; }
.colony-table td.planet { display: flex; align-items: center; gap: 8px; min-width: 190px; }
.colony-table .pic { width: 32px; height: 32px; display: grid; place-items: center; flex: none; }
/* under 1480 pixels the table scrolled sideways (2026-10-15): tighter cells, and the small lines may wrap */
@media (max-width: 1480px) and (min-width: 761px) {
  .colony-table td { padding: 6px 5px; }
  .colony-table th { padding: 4px 5px 6px; }
  .colony-table .sub { white-space: normal; }
  .colony-table td.planet { min-width: 150px; }
}
.colony-table .who { min-width: 0; }
.colony-table .name { font: var(--head-m)/1.2 var(--font-head); color: var(--text); background: none; border: 0; padding: 0;
  text-decoration: none; cursor: pointer; }
.colony-table .name:hover { color: var(--amber); }
.colony-table .jobs { cursor: default; }
.colony-table .job { display: inline-flex; align-items: center; gap: 2px; margin-right: 8px; }
/* a job's - and + and Auto on the row (2026-10-11), small beside the figures */
.colony-table .job-set { display: inline-flex; align-items: center; white-space: nowrap; }
.colony-table .job .n { min-width: 2ch; text-align: center; }
.colony-table .job-btn { width: 22px; height: 22px; padding: 0; display: inline-grid; place-items: center; background: var(--panel-2);
  border: 1px solid var(--line); cursor: pointer; }
.colony-table .job-btn:hover:not(:disabled) { border-color: var(--amber); }
.colony-table .job-btn:disabled { opacity: .3; cursor: default; }
.colony-table .job-btn:focus-visible, .colony-table .job-auto:focus-visible { outline: 1px dashed var(--amber); outline-offset: 1px; }
.colony-table .job-auto { font: var(--head-s)/1.2 var(--font-head); color: var(--text-dim); background: none; border: 1px solid var(--line);
  padding: 2px 6px; cursor: pointer; }
.colony-table .job-auto:hover { color: var(--amber); border-color: var(--amber); }
.colony-table .jobs.changed .sub { color: var(--amber); white-space: normal; }
.colony-table .jobs .link { font: inherit; color: var(--amber); background: none; border: 0; padding: 0; text-decoration: underline; cursor: pointer; }
.colony-table .job.food { color: var(--jade); }
.colony-table .job.work { color: var(--amber); }
.colony-table .job.science { color: var(--cyan); }
.colony-table .short, .colony-table .short-cell .sub { color: #ff8a8a; }
.colony-table .building { min-width: 180px; }
.colony-table .building .sub { white-space: normal; }   /* it may wrap rather than push the table wider (2026-10-11) */
.colony-table .front { display: inline-flex; align-items: center; gap: 6px; }
.colony-table .front .item-pic { width: auto; margin: 0; }
.mini-progress { display: block; height: 4px; max-width: 160px; margin: 3px 0 1px; background: var(--space); border: 1px solid var(--line);
  background-image: linear-gradient(90deg, var(--amber-2) var(--done, 0%), transparent var(--done, 0%)); }
.colony-table .idle .idle-text { color: var(--amber); font: var(--head-s)/1.2 var(--font-head); }
@media (max-width: 760px) {
  .sort-by { display: inline-flex; }
  .colony-table thead { display: none; }
  .colony-table, .colony-table tbody { display: block; }
  .colony-table tr.colony-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px 12px; padding: 8px 6px;
    border-top: 1px solid var(--rule); }
  .colony-row:hover td { background: none; }
  .colony-row.is-idle { box-shadow: inset 3px 0 0 var(--amber); }
  .colony-row.is-idle td:first-child { box-shadow: none; }
  .colony-table td { display: block; border: 0; padding: 0; text-align: left !important; min-width: 0; }
  .colony-table td.planet, .colony-table td.building, .colony-table td.jobs { grid-column: 1 / -1; }
  .colony-table .job-btn { width: 30px; height: 30px; }   /* a finger's size */
  .np-pick select { height: 32px; }
  .colony-table .fav-btn { width: 36px; height: 36px; }   /* a finger's size */
  .colony-table td.planet { display: flex; }
  .colony-table td:not(.planet)::before { content: attr(data-label); display: block; color: var(--text-dim); font-size: 12px; }
  .colony-table .sub { white-space: normal; }
}

/* ---- the Planets screen (2026-10-10): every planet explored, its table styled as the Colonies screen's; the roomiest
   free world a waiting colony ship can reach marked in amber, worlds others hold dimmed; on a phone, cards */
.planets { width: min(1240px, 100%); }
.planets .screen-head { margin-bottom: 0; }
.planets-sum { margin: 4px 0 8px; color: var(--text-dim); }
.planets-sum .idle-note, .planets-table .on-way, .fleets-table .on-way { color: var(--amber); }
.planets-filters { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 16px; margin: 0 0 8px; color: var(--text-dim); }
.planets-filters .check, .planets-filters .pick { display: inline-flex; align-items: center; gap: 6px; min-height: 32px; cursor: pointer; }
.planets-filters input[type=checkbox] { width: 18px; height: 18px; margin: 0; accent-color: var(--amber); }
.planets-filters select { font: var(--body-size)/1.2 var(--font-body); color: var(--text); background: var(--field);
  border: 1px solid var(--line); padding: 2px 4px; }
.planets-filters .count { margin-left: auto; }
.planets-message { margin: 0 0 8px; }
.planet-row { cursor: pointer; }
.planet-row:hover td { background: var(--panel-2); }
.planet-row.is-taken td { color: var(--text-dim); }
.planet-row.is-best td:first-child { box-shadow: inset 3px 0 0 var(--amber); }
.planets-table .room { font: var(--head-m)/1 var(--font-head); color: var(--text); }
.planet-row.is-taken .room { color: var(--text-dim); }
.planets-table .sub.hungry { color: var(--amber); }
.planets-table .worth { display: inline-flex; align-items: center; gap: 3px; white-space: nowrap; }   /* At full (2026-10-10) */
.planets-table .acts { white-space: nowrap; text-align: right; }
.planets-table .acts .btn + .btn { margin-left: 4px; }
@media (max-width: 760px) {
  .planets-table tr.planet-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px 12px; padding: 8px 6px;
    border-top: 1px solid var(--rule); }
  .planet-row:hover td { background: none; }
  .planet-row.is-best { box-shadow: inset 3px 0 0 var(--amber); }
  .planet-row.is-best td:first-child { box-shadow: none; }
  .planets-table td.planet, .planets-table td.acts { grid-column: 1 / -1; }
  .planets-table td.acts { text-align: left; }
  .planets-table td.acts::before { content: none; }
  .planets-filters .count { margin-left: 0; }
}

/* ---- the Fleets screen (2026-10-10): every fleet, those waiting for orders first; a waiting colony or outpost ship has
   the amber stripe; its table, summary and phone cards are the Planets screen's */
.fleets { width: min(1000px, 100%); }
/* the battle screen (2026-10-10, docs/xing/combat.md): what came of it, the two sides, then the rounds */
.battle { width: min(760px, 100%); }
/* the end of a game (2026-10-11, war piece 5): game over or victory */
/* the Chronicle (2026-10-15), and the end screen's list */
.chronicle { width: min(760px, 100%); }
.chronicle .facts { margin: 4px 0 8px; color: var(--text-dim); }
.chronicle .scroll { max-height: 70vh; overflow-y: auto; padding-right: 4px; scrollbar-width: thin; }
.chron-list { list-style: none; margin: 0; padding: 0; }
.chron-list li { display: flex; gap: 10px; padding: 3px 0; border-top: 1px solid var(--rule); }
.chron-list li:first-child { border-top: 0; }
.chron-year { flex: none; min-width: 72px; color: var(--amber); font: var(--head-s)/1.4 var(--font-head); }
.chron-text { color: var(--text); }
.chron-list .link { font: inherit; background: none; border: 0; padding: 0; text-align: left; color: var(--text); text-decoration: none; cursor: pointer; }
.chron-list .link:hover { color: var(--amber); text-decoration: underline; }
.chron-list .chron-war .chron-text, .chron-list .chron-razed .chron-text, .chron-list .chron-gone .chron-text { color: #ff8a8a; }
.chron-list .chron-won .chron-text, .chron-list .chron-opening .chron-text { color: var(--amber); }
.end .chron-list { font-size: 14px; }
/* the Saved games screen (2026-10-15) */
.saves { width: min(760px, 100%); }
.saves .facts { margin: 4px 0 8px; color: var(--text-dim); }
.save-list { list-style: none; margin: 0; padding: 0; }
.save-slot { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; padding: 8px 6px; border-top: 1px solid var(--rule); }
.save-slot.current { box-shadow: inset 3px 0 0 var(--amber); }
.saves-message { margin: 0 0 8px; color: var(--amber); }   /* a refused write, a save that could not be opened (2026-10-15) */
.overlay.saves-overlay { z-index: 6; }   /* over the new game screen, so a slot can be continued from there (2026-10-15) */
.save-slot .slot-no { width: 20px; color: var(--text-dim); font: var(--head-s)/1.2 var(--font-head); }
.save-slot .name { flex: 1; min-width: 180px; font: var(--head-m)/1.2 var(--font-head); }
.save-slot.empty .name { color: var(--text-dim); }
.save-slot .rename { flex: 1; display: inline-flex; gap: 6px; align-items: center; }
.save-slot .rename input { flex: 1; min-width: 120px; }
.save-slot .acts { display: inline-flex; flex-wrap: wrap; gap: 6px; }
.save-slot .tag { color: var(--amber); font: var(--head-s)/1.2 var(--font-head); padding: 0 6px; }
.save-slot .facts { flex-basis: 100%; margin: 0 0 0 30px; font-size: 13px; }
.end { width: min(820px, 100%); }
.end p { margin: 8px 0 12px; }
/* the standings, honours and score (2026-10-15) */
.end .scroll { max-height: 72vh; overflow-y: auto; padding-right: 4px; scrollbar-width: thin; }
.end h3 { margin: 10px 0 4px; font: var(--head-m)/1.2 var(--font-head); color: var(--amber); }
.end table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; font-size: 14px; }
.end th, .end td { padding: 2px 6px; text-align: left; white-space: nowrap; }
.end th.num, .end td.num { text-align: right; }
/* on a phone the standings wrapped nowhere and scrolled sideways unseen (the evening review's D7): tighter, and wrapping */
@media (max-width: 760px) {
  .end table { font-size: 12px; }
  .end th, .end td { padding: 2px 3px; white-space: normal; }
}
.end th { color: var(--text-dim); font-weight: 500; border-bottom: 1px solid var(--rule); }
.end tr.you td { color: var(--amber); }
.end td .winner { margin-left: 4px; font-size: 11px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--amber); }
.end tr.gone td { color: var(--text-dim); }
.end .facts { margin: 6px 0 0; color: var(--text-dim); }
.end ul.honours { margin: 0; padding-left: 18px; color: var(--text-dim); }
.end ul.honours li { margin: 2px 0; }
.end-score { width: auto; min-width: 320px; }
.end-score tr.total td { border-top: 1px solid var(--rule); color: var(--text); font-weight: 600; }
.fleet-line.damaged { color: #ff9a8a; }
.battle .scroll { overflow-y: auto; min-height: 0; padding-right: 4px; scrollbar-width: thin; scrollbar-color: #4f6789 #0e1424; }
.battle .outcome { margin: 0 0 10px; color: var(--amber); }
.battle .sides { display: flex; flex-wrap: wrap; gap: 8px 24px; }
.battle .sides > div { flex: 1 1 240px; }
.battle h3 { margin: 0 0 4px; font: var(--head-s)/1.2 var(--font-head); }
.battle .units { list-style: none; margin: 0; padding: 0; }
.battle .units li { display: flex; justify-content: space-between; gap: 12px; padding: 2px 0; border-bottom: 1px solid var(--rule); }
.battle .units li.lost { color: var(--text-dim); text-decoration: line-through; }
.battle .rounds { margin: 10px 0 0; padding-left: 0; list-style: none; }
.battle .rounds > li { padding: 4px 0; border-bottom: 1px solid var(--rule); }
.battle summary { cursor: pointer; }
.battle .shots { margin: 4px 0 0 16px; padding: 0; list-style: none; color: var(--text-dim); }
.battle .shots li.hit { color: var(--text); }
.fleets .screen-head { margin-bottom: 0; }
.fleet-row { cursor: pointer; }
.fleet-row:hover td { background: var(--panel-2); }
.fleet-row.is-idle td:first-child { box-shadow: inset 3px 0 0 var(--amber); }
.fleets-table .acts { white-space: nowrap; text-align: right; }
.fleets-table .acts .btn + .btn { margin-left: 4px; }
@media (max-width: 760px) {
  .fleets-table tr.fleet-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px 12px; padding: 8px 6px;
    border-top: 1px solid var(--rule); }
  .fleet-row:hover td { background: none; }
  .fleet-row.is-idle { box-shadow: inset 3px 0 0 var(--amber); }
  .fleet-row.is-idle td:first-child { box-shadow: none; }
  .fleets-table td.planet, .fleets-table td.acts { grid-column: 1 / -1; }
  .fleets-table td.acts { text-align: left; }
  .fleets-table td.acts::before { content: none; }
}
/* the Fleets screen's tabs and its Classes tab (2026-10-11, option 1 of Robin's two, ui/classes.js): a line a class at
   the left, the selected class in a pane at the right; on a narrower screen the pane goes under the list */
.screen-tabs { display: flex; gap: 6px; margin: 6px 0 4px; }
.screen-tabs .btn { min-width: 140px; }
.screen-tabs .btn[aria-selected="true"] { color: var(--amber); outline-color: var(--gold);
  background: linear-gradient(var(--amber), var(--amber)) left bottom / 100% 2px no-repeat border-box, var(--btn-hi); }
.fleets.classes-tab { width: min(1240px, 100%); }
.classes-body { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr) minmax(340px, 500px); gap: 12px; }
.class-list { min-height: 0; overflow-y: auto; display: flex; flex-direction: column; gap: 4px; padding-right: 4px;
  scrollbar-width: thin; scrollbar-color: #4f6789 #0e1424; }
.class-line { display: grid; grid-template-columns: 44px minmax(0, 1fr) auto; align-items: center; gap: 4px 10px; width: 100%;
  text-align: left; font: inherit; color: var(--text); background: var(--panel-2); border: 1px solid var(--line); padding: 6px 8px;
  cursor: pointer; touch-action: manipulation; }
.class-line:hover { border-color: var(--amber-2); }
.class-line:focus-visible { outline: 1px dashed var(--amber); outline-offset: 1px; }
.class-line.selected { border-color: var(--amber); box-shadow: inset 3px 0 0 var(--amber); }
.class-line.locked { opacity: 0.55; }
.class-line img { justify-self: center; }
.class-line .name { display: block; font: var(--head-s)/1.2 var(--font-head); }
.class-line .sub { display: block; color: var(--text-dim); font-size: 13px; }
.class-line .cost { color: var(--amber); font-size: 13px; text-align: right; white-space: nowrap; }
.class-line .old, .class-pane .old { color: var(--amber); }
.class-pane { min-height: 0; overflow-y: auto; display: flex; flex-direction: column; gap: 7px; padding: 10px 12px; background: var(--panel-2);
  border: 2px solid var(--amber); scrollbar-width: thin; scrollbar-color: #4f6789 #0e1424; }
.class-pane header { display: flex; gap: 12px; align-items: center; }
.class-pane header img { flex: none; }
.fleets .class-pane h3 { margin: 0; font: var(--head-m)/1.2 var(--font-head); color: var(--amber); }   /* over .overlay h3 */
.class-pane h4 { margin: 4px 0 0; font: var(--head-s)/1.2 var(--font-head); color: var(--text); }
.class-pane p { margin: 0; }
.class-pane .dim { color: var(--text-dim); }
.class-pane dl { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 2px 10px; margin: 0; }
.class-pane dt { color: var(--text-dim); }
.class-pane dd { margin: 0; }
.class-pane .marks { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 3px; }
.class-pane .next .btn { margin-left: 4px; }
.class-pane .later { margin-top: auto; padding-top: 4px; }
.class-pane .later .btn { margin-right: 6px; }
@media (max-width: 900px) {
  .classes-body { display: flex; flex-direction: column; overflow-y: auto; }
  .class-list, .class-pane { flex: none; overflow: visible; min-height: auto; }
}

/* ---- the Races screen (2026-10-10, docs/xing/war.md): your empire, then each empire met, a card each with its race,
   personality, war or peace, strength, grievances and the war and peace buttons; the race's colour down its left
   edge (the new game screen's race card styles), a red border at war */
/* ---- the Finance screen (2026-10-11, docs/xing/finance-screen.md): the treasury and the turns ahead, then Income and Costs
   side by side (one under the other on a narrow screen), then what to do when the money runs out */
.finance { width: min(1000px, 100%); }
.finance .scroll { overflow-y: auto; min-height: 0; padding-right: 4px; scrollbar-width: thin; scrollbar-color: #4f6789 #0e1424; }
.finance-sum { margin: 4px 0 8px; }
.finance-sum b { font: var(--head-m)/1.2 var(--font-head); font-weight: 400; color: var(--text); }
.finance-cols { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 0 24px; margin-top: 8px; }
.finance .finance-col h3, .finance .finance-shortfall h3, .finance .finance-grants h3 { margin: 8px 0 4px; color: var(--amber); }   /* .overlay h3, later, would win otherwise */
.finance-table th { position: static; }
.finance ul.intel-how { margin: 4px 0 8px; padding-left: 20px; color: var(--text-dim); }   /* the intelligence list's how-it-works (2026-10-15) */
.finance ul.intel-how li { margin: 2px 0; }
.finance ul.intel-how b { font-weight: 600; color: var(--text); }
.finance-table td { padding: 3px 8px; }
.finance-table tr.group td { color: var(--text); }
/* each colony's share of the income (2026-10-13): a thin gold bar from the left, and its percent in dim text */
.finance-table .share { white-space: nowrap; width: 1%; }
.finance-table .share-bar { display: inline-block; height: 6px; border-radius: 0 3px 3px 0; background: var(--gold); vertical-align: middle; }
.finance-table .share-pct { margin-left: 6px; color: var(--text-dim); font-size: 0.86em; }
.finance-table tr.detail td:first-child { padding-left: 24px; }
.finance-table tr.detail td { color: var(--text-dim); border-top: 0; }
.finance-table tfoot td { border-top: 1px solid var(--line); color: var(--text); }
.finance-shortfall { margin-top: 12px; padding-top: 4px; border-top: 1px solid var(--rule); }
/* research grants (2026-10-11): a slider of the share of taxes to research */
.finance-grants { margin-top: 12px; padding-top: 4px; border-top: 1px solid var(--rule); }
.grants-row { display: flex; align-items: center; gap: 12px; max-width: 460px; }
.grants-row input[type="range"] { flex: 1; accent-color: var(--amber); min-height: 32px; }
.grants-value { min-width: 4.5ch; text-align: right; color: var(--amber); }
/* intelligence (2026-10-13, docs/xing/diplomacy.md): your agents' reach on each empire you have met, in a word, under the slider */
.intel-list { list-style: none; margin: 6px 0; padding: 0; display: grid; grid-template-columns: max-content max-content max-content 1fr; gap: 2px 14px;
  max-width: 460px; }
.intel-list li { display: contents; }
.intel-list .who { font: var(--head-s)/1.4 var(--font-head); }
.intel-list .reach { color: var(--text-dim); }
/* the forecast from Deep (2026-10-14): where the reach is heading, a line of its own under the row */
.intel-list .heading { grid-column: 1 / -1; margin: -2px 0 4px; color: var(--text-dim); }
/* the stance, Watch or Watch and steal (2026-10-14, docs/xing/diplomacy.md, step 4): the Finance list's rows and the Diplomacy screen */
.stances { display: inline-flex; gap: 4px; align-self: center; }
.stances .btn.small.stance { min-height: 28px; padding: 0 8px; white-space: nowrap; font-size: 13px; }
.stances .btn.small.stance[aria-pressed="true"] { color: var(--amber); border-color: var(--amber); background: var(--panel-2); }
.intel-theft { margin: 2px 0 0; color: var(--text-dim); }
.intel-theirs, .intel-list .heading.theirs { color: var(--amber); }   /* their agents stealing from you, from Deep (item 3) */
.intel-theirs { margin: 2px 0 0; }
.intel-stance { margin: 4px 0 0; }
.intel-target { margin: 4px 0 0; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; }   /* the tech to steal first (item 1) */
.intel-target select { max-width: 100%; }
@media (max-width: 760px) {
  /* four columns do not fit a phone: the stance buttons take a row of their own under the empire's line */
  .intel-list { grid-template-columns: max-content max-content 1fr; }
  .intel-list .stances { grid-column: 1 / -1; margin: 0 0 4px; }
}
.intel-level, .empire-card .intel { color: var(--text-dim); }
.intel-level.level-1, .intel-level.level-2, .intel-level.level-3, .intel-level.level-4 { color: var(--cyan); }
.empire-card .intel .label, .diplomacy .intel .label { color: var(--text-dim); }
.empire-card .intel.level-1, .empire-card .intel.level-2, .empire-card .intel.level-3, .empire-card .intel.level-4,
.diplomacy .intel.level-1, .diplomacy .intel.level-2, .diplomacy .intel.level-3, .diplomacy .intel.level-4 { color: var(--cyan); }
.diplomacy .intel { color: var(--text-dim); }
.empire-card .intel-research { color: var(--text-dim); }
.finance-choice { display: flex; gap: 8px; align-items: flex-start; padding: 6px 8px; margin: 4px 0; border: 1px solid transparent; cursor: pointer; }
.finance-choice.chosen { border-color: var(--amber-2); background: var(--panel-2); }
.finance-choice input { margin-top: 3px; accent-color: var(--amber); }
.finance-choice > span { display: flex; flex-direction: column; gap: 2px; }
.finance-choice b { font: var(--head-s)/1.2 var(--font-head); font-weight: 400; color: var(--text); }
@media (max-width: 700px) {
  .finance-cols { grid-template-columns: minmax(0, 1fr); }
}
.races { width: min(1000px, 100%); }
.races .screen-head { margin-bottom: 0; }
.races-sum { margin: 4px 0 8px; color: var(--text-dim); }
.races-level { margin: -4px 0 8px; color: var(--text-dim); }   /* the game's difficulty (2026-10-12) */
.races-message { margin: 0 0 8px; color: #ff8a8a; }
/* 天门 Tiānmén, everyone's progress, above the cards (2026-10-15) */
.gate-strip { margin: 0 0 10px; padding: 8px 10px; background: var(--panel-2); border: 1px solid var(--rule); }
.gate-strip.none { color: var(--text-dim); background: none; border: 0; padding: 0; margin: 0 0 8px; }
.gate-strip h3 { margin: 0 0 6px; font: var(--head-m)/1.2 var(--font-head); color: var(--amber); }
.gate-row { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; padding: 3px 0 3px 8px; border-left: 3px solid var(--race); }
.gate-row + .gate-row { margin-top: 4px; }
.gate-row .who { font: 500 var(--head-s)/1.2 var(--font-head); min-width: 150px; }
.gate-marks { display: inline-flex; gap: 3px; }
.gate-mark { font-size: 11px; line-height: 1.4; padding: 0 6px; border: 1px solid var(--line); border-radius: 2px; color: var(--text-dim); }
.gate-mark.lit { background: var(--amber); border-color: var(--amber); color: #1a1408; }
.gate-where { color: var(--text-dim); }
.gate-where .link { font: inherit; background: none; border: 0; padding: 0; color: var(--amber); text-decoration: underline; }   /* a planet's name as a link, not a button (Robin's screenshot) */
.gate-opening { color: var(--amber); }
.empire-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 8px; }
.empire-card { display: flex; flex-direction: column; gap: 4px; padding: 8px 10px; background: var(--panel-2);
  border: 1px solid var(--rule); box-shadow: inset 4px 0 0 var(--race); }
.empire-card.at-war { border-color: #8a3040; }
.empire-card p { margin: 0; }
.empire-card .personality .label, .diplomacy .personality .label { color: var(--race); }
.empire-card .relation.war, .diplomacy .relation.war { color: #ff8a8a; }
.empire-card .relation.gone { font: 600 var(--head-m)/1.3 var(--font-head); color: var(--text); margin-top: 4px; }   /* an empire out of the game (2026-10-15; Robin: "bigger and bolder") */
.empire-card .relation .offer, .diplomacy .relation .offer { color: var(--amber); }
.empire-card .strength, .empire-card .grievances, .empire-card .other-wars { color: var(--text-dim); }
/* how it feels about you (2026-10-13, docs/xing/diplomacy.md): the word in its colour, the reasons after it */
.empire-card .attitude, .diplomacy .attitude { color: var(--text-dim); }
.empire-card .attitude .label, .diplomacy .attitude .label { font: var(--head-s)/1.2 var(--font-head); }
.empire-card .attitude.hostile .label, .diplomacy .attitude.hostile .label { color: var(--cinnabar); }
.empire-card .attitude.wary .label, .diplomacy .attitude.wary .label { color: var(--amber); }
.empire-card .attitude.neutral .label, .diplomacy .attitude.neutral .label { color: var(--text); }
.empire-card .attitude.warm .label, .empire-card .attitude.friendly .label,
.diplomacy .attitude.warm .label, .diplomacy .attitude.friendly .label { color: var(--jade); }
.empire-card .relation-acts, .diplomacy .relation-acts { margin-top: 4px; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.empire-card .relation-acts .order, .diplomacy .relation-acts .order { color: var(--amber); }
/* tribute with a peace proposal (2026-10-12, docs/xing/deals.md; on the Diplomacy screen since 2026-10-14) */
.empire-card .tribute-label, .diplomacy .tribute-label { display: flex; align-items: center; gap: 6px; color: var(--text-dim); }
.empire-card .tribute, .diplomacy .tribute { width: 6em; }
.empire-card .gate { color: var(--text-dim); }   /* 天门 Tiānmén (2026-10-12) */
.empire-card .gate.opening { color: var(--amber); }
.settle .warn { margin-top: 4px; color: var(--amber); }   /* settling in a system another empire holds (2026-10-10) */
.fleet-list .at-war { color: #ff8a8a; }
.fleet-list .battle-note { color: var(--text-dim); }   /* what happens next with an enemy's fleet here (2026-10-11) */
/* a battle forecast (2026-10-11): green when every try is won, red when every one is lost */
.forecast ul { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 4px; }
.forecast .win, .facts.forecast.win { color: var(--jade); }
.forecast .loss, .facts.forecast.loss { color: #ff8a8a; }   /* another empire's ships, at war with the player's (2026-10-10) */
@media (max-width: 760px) {
  .empire-cards { grid-template-columns: 1fr; }
}

/* ---- the Diplomacy screen (2026-10-14, docs/xing/diplomacy.md, step 3): one empire, war and peace, and a deal of techs and
   money both ways; the empire's colour down its left edge, as on its card */
.diplomacy { width: min(880px, 100%); }
.diplomacy .screen-head { margin-bottom: 0; }
.diplo-head { display: flex; flex-direction: column; gap: 6px; margin: 6px 0 0; padding: 0 0 8px; border-bottom: 1px solid var(--rule); }
.diplo-lines { display: flex; flex-direction: column; gap: 4px; padding: 0 2px; }
/* the audience (2026-10-14): their home world turning at the left, washed into the empire's colour, the envoy before
   it, the name and the envoy's line, and the seal at the right */
.audience { position: relative; display: flex; align-items: flex-end; gap: 14px; min-height: 150px; padding: 10px 12px 10px 132px; overflow: hidden;
  border: 1px solid var(--rule);
  background: radial-gradient(ellipse 62% 120% at 10% 50%, color-mix(in srgb, var(--race) 36%, var(--panel)) 0%,
    color-mix(in srgb, var(--race) 14%, var(--panel)) 55%, var(--panel) 100%); }
.audience .world { position: absolute; left: -14px; top: 50%; width: 176px; height: 176px; transform: translateY(-50%); opacity: 0.88;
  -webkit-mask-image: radial-gradient(circle at 50% 50%, #000 50%, transparent 70%); mask-image: radial-gradient(circle at 50% 50%, #000 50%, transparent 70%); }
.audience .world canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
/* a world at a star the player has not explored (2026-10-14, Robin): blurred to a soft disc with a hint of its colour */
.audience .world.unknown { filter: blur(9px) saturate(0.45) brightness(0.85); opacity: 0.7; }
.audience .envoy { flex: none; width: 66px; height: 110px; filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.55)); }
.audience .envoy.none { width: 0; }
.audience .court { flex: 1; min-width: 0; align-self: center; }
.audience .envoy-line { margin: 6px 0 0; color: var(--text); font-style: italic; }
.audience .race-char.large { width: 76px; height: 76px; min-width: 76px; font-size: 50px; align-self: center;
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.14), 0 3px 12px rgba(0, 0, 0, 0.45); }
@media (max-width: 640px) {
  .audience { padding-left: 86px; min-height: 124px; gap: 10px; }
  .audience .world { left: -34px; width: 140px; height: 140px; }
  .audience .envoy { width: 48px; height: 80px; }
  .audience .race-char.large { width: 56px; height: 56px; min-width: 56px; font-size: 36px; }
}
.diplo-head p, .diplo-section p { margin: 0; }
.diplo-section { padding: 8px 0 6px; border-bottom: 1px solid var(--rule); }
.diplomacy .diplo-section h3 { margin: 0 0 6px; color: var(--amber); }
.diplo-section .facts { margin-bottom: 6px; }
.deal-cols { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 4px 18px; }
.deal-col h4 { margin: 4px 0; font: var(--head-s)/1.2 var(--font-head); color: var(--text); }
.deal-list { list-style: none; margin: 0; padding: 0; }
.deal-list li { display: flex; align-items: center; gap: 8px; padding: 2px 0; }
.deal-list label { flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px; cursor: pointer; }
.deal-list input[type="checkbox"] { accent-color: var(--amber); }
.deal-list .wanted { color: var(--jade); font-size: 0.86em; }
.deal-list .worth { color: var(--amber); white-space: nowrap; }
.deal-list li.kept { color: var(--text-dim); }
.deal-list li.kept label { cursor: default; }
.deal-list .kept-why { color: var(--text-dim); font-size: 0.86em; }
.deal-money { margin: 6px 0 8px; color: var(--text-dim); }
.deal-money input { width: 6em; }
.deal-balance { margin: 4px 0 8px; }
.deal-balance.ok { color: var(--jade); }
.deal-balance.short { color: var(--amber); }
.deal-balance.no { color: #ff8a8a; }
.deal-order { color: var(--amber); }
/* their proposal (2026-10-14, piece 3): a deal, a pact or a demand waiting for an answer this turn; and the demand row */
.proposal-box { margin: 8px 0 0; padding: 8px 10px; border: 1px solid var(--amber); background: var(--panel-2); }
.proposal-box p { margin: 0; }
.proposal-box .label { color: var(--amber); font: var(--head-s)/1.2 var(--font-head); }
.proposal-box .relation-acts { margin-top: 6px; }
.demand-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 4px 0; color: var(--text-dim); }
.demand-row select { max-width: 100%; min-height: 36px; }
.demand-row input { width: 6em; }
/* treaties (2026-10-14, piece 2): a row a pact, its name lit while it holds */
.pact-row { padding: 4px 0 6px; border-top: 1px solid var(--rule); }
.pact-row:first-of-type { border-top: 0; }
.pact-name { font: var(--head-s)/1.2 var(--font-head); color: var(--text); }
.pact-row.holds .pact-name, .pact-row .holds { color: var(--jade); }
.pact-row .facts { margin: 2px 0 2px; }
@media (max-width: 640px) {
  .deal-cols { grid-template-columns: minmax(0, 1fr); }
}

/* ---- overlays over the map: the new game screen and the turn report (2026-10-08) */
/* flex, not grid: a grid row grows to its content, so max-height: 100% would not hold the panel to the screen */
.overlay { position: absolute; inset: 0; z-index: 4; display: flex; align-items: center; justify-content: center; padding: 12px;
  background: rgba(4, 6, 14, 0.62); }
.overlay[hidden] { display: none; }
.overlay > .panel { position: relative; max-height: 100%; display: flex; flex-direction: column; }
.overlay .scroll { flex: 1 1 auto; overflow-y: auto; min-height: 0; padding-right: 4px; scrollbar-width: thin; scrollbar-color: #4f6789 #0e1424; }
.overlay h2 { margin: 0 0 8px; font: var(--head-l)/1.1 var(--font-head); color: var(--amber); }
.overlay h3 { margin: 4px 0 8px; font: var(--head-m)/1.2 var(--font-head); color: var(--text); }
/* a screen's heading with its X at the right (the Colonies screen's, 2026-10-09; every screen's since 2026-10-10) */
.screen-head { flex: none; display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.screen-head h2 { margin: 0; }
.screen-head .btn.close { position: static; flex: none; width: 44px; padding: 0; display: grid; place-items: center; }
.buttons { display: flex; justify-content: flex-end; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.btn.primary { min-width: 120px; }
.btn.primary:not(:disabled) { color: var(--amber); outline-color: var(--gold); }
.btn.small { min-height: 36px; min-width: 0; padding: 0 4px; font-size: var(--body-size); }

.newgame { width: min(1040px, 100%); }
.newgame-foot { flex: none; border-top: 1px solid var(--rule); margin-top: 8px; padding-top: 4px; }
.newgame-foot .form-row { margin-top: 4px; }
.newgame-foot .buttons { margin-top: 6px; }
.newgame-level { margin: 4px 0 0; color: var(--text-dim); }   /* the chosen difficulty's description (2026-10-12) */
.newgame-rivals:empty { display: none; }   /* the rivals note (2026-10-14): only when more are chosen than the size has room for */
/* the empire's colour (2026-10-13): a swatch a colour, the chosen one ringed in amber; the seal and name as they will look */
.newgame-colour { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; margin-top: 8px; color: var(--text-dim); }
.newgame-colour .swatches { display: flex; flex-wrap: wrap; gap: 4px; }
.swatch { width: 36px; height: 36px; padding: 4px; background: var(--swatch) content-box; border: 2px solid transparent; border-radius: 2px;
  outline: 1px solid var(--line); outline-offset: -1px; cursor: pointer; touch-action: manipulation; }
.swatch:hover { outline-color: var(--gold); }
.swatch.chosen { border-color: var(--amber); outline-color: var(--amber); }
.swatch:focus-visible { outline: 1px dashed var(--amber); outline-offset: 2px; }
.newgame-emblem { display: inline-flex; align-items: center; gap: 6px; font: var(--head-m)/1.2 var(--font-head); }
.newgame-colour-note { flex-basis: 100%; font-size: 13px; }
.newgame-colour-note:empty { display: none; }
/* phones (2026-10-12, with the difficulty): the name across, then galaxy and seed, rivals and difficulty side by side,
   so the race cards keep their room */
@media (max-width: 600px) {
  .newgame-foot .form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 12px; }
  .newgame-foot .form-row label:first-child { grid-column: 1 / -1; }
  .newgame-foot .form-row select, .newgame-foot .form-row input { width: 100%; min-width: 0; }
}
.race-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 8px; }
.race-card { display: flex; flex-direction: column; gap: 4px; text-align: left; font: inherit; color: var(--text); cursor: pointer;
  background: var(--panel-2); border: 2px solid var(--rule); padding: 8px 10px; touch-action: manipulation; }
.race-card:hover { border-color: var(--line); }
.race-card.chosen { border-color: var(--amber); background: #1a2338; box-shadow: inset 4px 0 0 var(--race); }
.race-card:focus-visible { outline: 1px dashed var(--amber); outline-offset: 2px; }
.race-head { display: flex; align-items: center; gap: 10px; }
/* the race's character as a big seal: its colour, the character in paper white or ink (--race-ink, core/seal.js) */
.race-char { display: grid; place-items: center; width: 52px; height: 52px; min-width: 52px; border-radius: 3px;
  font: 700 34px/1 var(--font-cjk); background: var(--race); color: var(--race-ink, #f6f1e6);
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.14); }
.race-name { display: block; font: var(--head-l)/1 var(--font-head); color: var(--race); }
.race-meaning { display: block; color: var(--text-dim); }
.race-desc { margin: 2px 0; }
.race-traits { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 4px; }
.race-traits li { padding: 0 6px; background: #22304a; color: var(--text); white-space: nowrap; }
.race-traits li.minus { background: #3a1e26; color: #ffb4b4; }
.race-home, .race-points { margin: 0; color: var(--text-dim); }
.form-row { display: flex; flex-wrap: wrap; gap: 10px 20px; margin-top: 12px; }
.form-row label { display: flex; flex-direction: column; gap: 4px; color: var(--text-dim); }
.form-row input[type=text] { width: 15em; max-width: 100%; }

/* the problem report (2026-10-09) */
.problem { width: min(560px, 100%); }
.problem textarea { width: 100%; font: var(--body-size)/var(--body-line) var(--font-body); color: var(--text); background: var(--space);
  border: 1px solid var(--line); padding: 6px; resize: vertical; }
.problem textarea:focus { outline: 1px solid var(--amber-2); }
.report-lines { list-style: none; margin: 0; padding: 0; }
.report-lines li { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 4px 10px; padding: 6px 0;
  border-top: 1px solid var(--rule); }
.report-lines li:first-child { border-top: 0; }
.report-lines li > span { flex: 1 1 170px; min-width: 0; }
.report-lines .line-actions { flex: none; display: flex; gap: 6px; margin-left: auto; }
/* a line's picture (2026-10-13): what it is about, in a column of its own */
.report-lines .line-icon { flex: none; width: 30px; display: grid; place-items: center; align-self: flex-start; margin-top: 2px; }
.report-lines .line-icon img { max-width: 30px; max-height: 26px; }
.report-lines .line-icon .seal { margin: 0; font-size: 17px; }
.report-lines .line-actions:empty { display: none; }
.report-lines li.seen > span { color: var(--text-dim); }   /* a line the player has followed (2026-10-10) */
.report-lines li.report-note > span { color: var(--amber); }   /* about the turn itself: a part that could not be shown (2026-10-13) */
/* the turn report (2026-10-10, Robin's second play test): a panel at the left of the map that stays while its lines are
   followed, never down over the zoom buttons (3 x 44 px and their gaps, 10 px from the bottom); 900 px wide or less, a
   sheet along the top */
.report-panel { top: 8px; left: 8px; width: var(--panel-w); max-width: calc(100% - 16px); max-height: calc(100% - 166px);
  display: flex; flex-direction: column; }
.report-panel[hidden] { display: none; }
.report-panel .close { position: absolute; top: 0; right: 0; width: 44px; height: 44px; padding: 0; display: grid; place-items: center;
  z-index: 1; }
.report-panel h2 { margin: 0 48px 4px 0; min-height: 44px; display: flex; align-items: center; font: 700 var(--head-l)/1.1 var(--font-head);
  color: var(--amber); }
.report-panel .scroll { flex: 1 1 auto; min-height: 0; overflow-y: auto; padding-right: 4px; overscroll-behavior: contain;
  scrollbar-width: thin; scrollbar-color: #4f6789 #0e1424; }
.report-panel .buttons { flex: none; margin-top: 8px; }
@media (max-width: 900px) {
  .report-panel { right: 8px; width: auto; max-height: 45%; }
}
@media (max-width: 900px) and (max-height: 560px) {   /* a phone on its side: the map is too short for 45 % to show a line */
  .report-panel { max-height: calc(100% - 16px); }
}

/* ---- the Research screen (2026-10-09): a row a field, a column a level. Since 2026-10-11 (option 1 of Robin's three)
   a line a tech, and the selected tech in full in a pane at the right; on a narrower screen the pane goes under them */
.research { width: min(1560px, 100%); }   /* wider since 2026-10-11, for four levels (tech tree v2) */
.research-now { margin: 6px 0 4px; }
.research-now .order { margin-top: 4px; }
.research-body { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr) minmax(300px, 380px); gap: 12px; margin-top: 6px; }
.research-techs { min-height: 0; overflow-y: auto; padding-right: 4px; scrollbar-width: thin; scrollbar-color: #4f6789 #0e1424; }
.research-heads, .research-grid { display: grid; grid-template-columns: 112px repeat(var(--levels, 3), minmax(0, 1fr)); gap: 0 6px; }
.research-heads { color: var(--text-dim); padding-bottom: 2px; }
.research-field { display: contents; }
.research-field > * { border-top: 1px solid var(--rule); padding: 4px 0; }
.field-name .name { font: var(--head-s)/1.2 var(--font-head); }
.field-name .field-icon { width: 20px; height: 20px; margin-right: 6px; vertical-align: -4px; }   /* 2026-10-13 */
.research-level { display: flex; flex-direction: column; gap: 2px; }
.research-level.now { background: var(--panel-2); padding: 4px; box-shadow: inset 0 0 0 1px var(--line); }   /* its line: 2026-10-13 */
.research-level.later { opacity: 0.55; }
.tline { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 0 6px; width: 100%; min-height: 26px; text-align: left;
  font: inherit; color: var(--text); background: var(--space); border: 1px solid #34425f; padding: 2px 6px; cursor: pointer;
  touch-action: manipulation; }
.tline:hover { border-color: var(--amber-2); }
.tline:focus-visible { outline: 1px dashed var(--amber); outline-offset: 1px; }
.tline.selected { border-color: var(--amber); box-shadow: inset 0 0 0 1px var(--amber); }
.tline.chosen { border-color: var(--amber-2); border-width: 2px; }
.tline.chosen .turns { color: var(--amber); }
.tline.skipped { border-style: dashed; border-color: #5a1f7a; }
.tline.known .tname { color: var(--jade); }
/* the name at its width (on two lines when longer than the line, 2026-10-11: four levels left "Advanced const..."), and the
   turns and gain beside it, or under it when there is no room */
.tname { flex: 0 1 auto; max-width: 100%; font: var(--head-s)/1.2 var(--font-head); }
.tmeta { flex: none; margin-left: auto; display: inline-flex; align-items: baseline; gap: 6px; white-space: nowrap; }
.tmeta .turns { color: var(--amber); }
.tline.skipped .tmeta .turns { color: var(--violet); }
.tmeta .gain { display: inline-flex; align-items: center; gap: 2px; color: var(--jade); }
.tmeta .gain img { width: 14px; height: 14px; }
.tech-pane { min-height: 0; overflow-y: auto; display: flex; flex-direction: column; gap: 6px; padding: 10px 12px; background: var(--panel-2);
  border: 2px solid var(--amber); scrollbar-width: thin; scrollbar-color: #4f6789 #0e1424; }
.tech-pane h3 { margin: 0; font: var(--head-m)/1.2 var(--font-head); color: var(--amber); }
.research .tech-pane h3 { color: var(--amber); }   /* .overlay h3, later in the file, would win otherwise */
.tech-pane p { margin: 0; }
.tech-pane .dim { color: var(--text-dim); }
.tech-pane .desc { font-style: italic; color: var(--text-dim); }
.tech-pane .for-you { color: var(--jade); }
.tech-pane .research-it, .tech-pane .order { align-self: flex-start; }
@media (max-width: 1100px) {
  .research-body { grid-template-columns: minmax(0, 1fr) minmax(250px, 300px); }
}
@media (max-width: 900px) {
  /* the pane under the techs, and the two scroll together; a tap on a tech brings the pane into view */
  .research-body { display: flex; flex-direction: column; overflow-y: auto; }
  .research-techs, .tech-pane { flex: none; overflow: visible; min-height: auto; }
}

.game-menu { left: 10px; bottom: 10px; z-index: 5; display: flex; flex-direction: column; gap: 6px; min-width: 200px; }
.game-menu[hidden] { display: none; }

/* ---- loading and errors */
.loading { position: fixed; inset: 0; display: grid; place-items: center; padding: 20px; text-align: center; background: var(--space);
  font: 18px/1.5 var(--font-head); color: var(--text-dim); z-index: 10; }
.loading[hidden] { display: none; }

/* ---- the top bar on narrower screens (2026-10-09): the galaxy's size and seed go first, then the race, and the
   empire's totals take a row of their own (they overlapped the empire's name from 701 to about 950 pixels) */
@media (max-width: 1100px) {
  .galaxy-info { display: none; }
}
@media (max-width: 900px) {
  .empire-race { display: none; }
  .topbar { flex-wrap: wrap; gap: 8px 12px; padding-bottom: 6px; }
  .totals { order: 9; flex-basis: 100%; justify-content: space-between; }
}

/* ---- narrow screens (a first pass; the phone layout comes later): the star panel becomes a sheet along the bottom,
   the zoom buttons move to the top, the bottom bar scrolls sideways */
@media (max-width: 700px) {
  .star-panel { left: 6px; right: 6px; top: auto; bottom: 6px; width: auto; max-height: 60%; }
  .zoom-controls { top: 10px; bottom: auto; }
  .bottombar .screens { scrollbar-width: none; scroll-snap-type: x mandatory; padding: 0 16px; scroll-padding: 0 16px; }
  .bottombar .btn { padding: 0 6px; }
  /* the row of screens on a phone (2026-10-13): a whole button first, just past a fade that shows more beyond it (the
     padding is the fade's width), and a fade at the other end too while more is there */
  .bottombar .screens .btn { scroll-snap-align: start; }
  .bottombar .screens.more-right { -webkit-mask-image: linear-gradient(90deg, #000 calc(100% - 16px), transparent);
    mask-image: linear-gradient(90deg, #000 calc(100% - 16px), transparent); }
  .bottombar .screens.more-left { -webkit-mask-image: linear-gradient(270deg, #000 calc(100% - 16px), transparent);
    mask-image: linear-gradient(270deg, #000 calc(100% - 16px), transparent); }
  .bottombar .screens.more-left.more-right {
    -webkit-mask-image: linear-gradient(90deg, transparent, #000 16px, #000 calc(100% - 16px), transparent);
    mask-image: linear-gradient(90deg, transparent, #000 16px, #000 calc(100% - 16px), transparent); }
  .race-cards { grid-template-columns: 1fr; }
  .research-grid { grid-template-columns: minmax(0, 1fr); }
  .research-level.now, .research-level { padding: 6px 0; }
  .research-heads { display: none; }   /* one column: each level says nothing of its own, its techs do (2026-10-11) */
}
@media (max-width: 520px) {
  .brand span:not(.seal) { display: none; }   /* XĪNG; the 星 seal stays */
  /* the totals on a phone (2026-10-13, the visual review: the money's change ran off the edge, "1236 +14"): closer, a
     little smaller, so the row fits from 360 pixels wide */
  .totals { gap: 4px 8px; font-size: 15px; }
  .total { gap: 3px; }
}
@media (max-width: 380px) {
  .totals { font-size: 14px; }
  .total img { width: 16px; height: 16px; }
}
@media (max-width: 340px) {
  .totals { font-size: 13px; gap: 4px 6px; }
}

/* ---- the ship designer (2026-10-11, docs/xing/designer.md): a hull, a name, the space, the parts by kind with - and +, and
   beside them what the ship would be; on a narrow screen one column */
.designer { width: min(1100px, 100%); }
.design-top { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 24px; margin: 4px 0 8px; }
.design-top .hulls { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.hull-pick.chosen { border-color: transparent; outline: 2px solid var(--amber); outline-offset: -2px; color: var(--amber); }
.design-name-row { display: flex; align-items: center; gap: 6px; }
/* its look (2026-10-13): each drawn with its weapons, the chosen one ringed in amber */
.design-top .looks { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.look-pick { display: inline-flex; flex-direction: column; align-items: center; gap: 2px; padding: 4px 6px 3px; font: inherit; font-size: 12px;
  color: var(--text-dim); background: var(--panel-2); border: 0; border-radius: 2px; outline: 1px solid var(--line); outline-offset: -1px;
  cursor: pointer; touch-action: manipulation; }
.look-pick:hover { outline-color: var(--gold); color: var(--text); }
.look-pick.chosen { outline: 2px solid var(--amber); outline-offset: -2px; color: var(--amber); }
.look-pick:focus-visible { outline: 1px dashed var(--amber); outline-offset: 2px; }
@media (max-width: 520px) {
  .look-pick canvas { width: 66px !important; height: 30px !important; }   /* the three on one row on a phone */
}
.design-name { font: inherit; color: var(--text); background: var(--field); border: 1px solid var(--line); padding: 4px 8px; min-width: 16em; }
.design-name:focus-visible { outline: 1px dashed var(--amber); outline-offset: 1px; }
.space-row { display: flex; align-items: center; gap: 10px; margin: 0 0 10px; }
.space-bar { flex: 1; max-width: 420px; height: 10px; border: 1px solid var(--line); background: var(--space);
  background-image: linear-gradient(90deg, var(--amber-2) var(--used, 0%), transparent var(--used, 0%)); }
.design-body { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(260px, 1fr); gap: 16px; align-items: start; }
.design-kind h4 { margin: 8px 0 4px; color: var(--amber); }
.design-parts { list-style: none; margin: 0; padding: 0; }
.design-parts li { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: center; gap: 4px 12px; padding: 4px 0;
  border-top: 1px solid var(--rule); }
.design-parts .part-main { display: flex; flex-direction: column; min-width: 0; }
.design-parts .name { font: var(--head-s)/1.2 var(--font-head); }
.design-parts .part-cost { color: var(--text-dim); white-space: nowrap; }
.design-parts .part-count { display: inline-flex; align-items: center; gap: 6px; }
.design-parts .part-count b { min-width: 2ch; text-align: center; color: var(--amber); }
.design-preview { display: flex; flex-direction: column; gap: 8px; padding: 10px 12px; background: var(--panel-2); border: 1px solid var(--line); }
.design-preview img { align-self: center; }
.design-preview canvas { align-self: center; max-width: 100%; }   /* drawn at high resolution (2026-10-11) */
.design-preview p { margin: 0; }
.design-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
@media (max-width: 760px) {
  .design-body { grid-template-columns: minmax(0, 1fr); }
  .design-name { min-width: 0; width: 100%; }
  /* a part on two lines: its name and numbers, then its space and cost beside - and + */
  .design-parts li { grid-template-columns: minmax(0, 1fr) auto; }
  .design-parts .part-main { grid-column: 1 / -1; }
}

/* ---- tactical battles (2026-10-11, docs/xing/tactical.md): the prompt; then the board beside its panel, the panel under
   the board on a narrow screen */
.tactical-ask { width: min(640px, 100%); }
.tactical-ask p { margin: 0 0 10px; }
.tactical-choices { display: flex; flex-wrap: wrap; gap: 8px; margin: 4px 0 12px; }
.tactical-ask .btn.link { padding: 0; border: 0; background: none; outline: 0; color: var(--amber); text-decoration: underline; }
.tactical-ask .btn.link:focus-visible { outline: 1px dashed var(--amber); outline-offset: 2px; }
.tactical-overlay { padding: 8px; }
.overlay > .panel.tactical { width: 100%; height: 100%; }
.tactical-body { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 12px; }
.tactical-wrap { min-width: 0; min-height: 0; display: flex; align-items: center; justify-content: center; overflow: hidden; }
/* the board's layers (2026-10-11, piece 7c): the sky, a colony's planet turning, the board with its ships on top */
.tactical-layers { position: relative; flex: none; }
.tactical-layers > canvas { position: absolute; inset: 0; display: block; }
.tactical-board { cursor: crosshair; touch-action: manipulation; }
.tactical-planet { position: absolute; pointer-events: none; }
.tactical-planet .portrait, .tactical-planet .portrait-overlay { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0;
  transition: opacity 0.4s ease-out; }
.tactical-planet .portrait.ready, .tactical-planet .portrait-overlay.ready { opacity: 1; }
.tactical-side { min-height: 0; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; scrollbar-width: thin; }
.tactical-side h3, .tactical-side h4 { margin: 0; font: var(--head-s)/1.2 var(--font-head); }
.tactical-side p { margin: 0; }
.tactical-round { color: var(--amber); }
.tactical-weapons { list-style: none; margin: 0; padding: 0; }
.tactical-weapons li { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 3px 0; border-bottom: 1px solid var(--rule); }
.tactical-weapons li > span { min-width: 0; }
.tactical-weapons .btn { flex: none; }
.tactical-weapons .btn.chosen { color: var(--amber); }
.tactical-next { color: var(--text-dim); }
.tactical-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.tactical-hover { padding: 6px 8px; border: 1px solid var(--line); background: var(--panel-2); }
.tactical-hover ul { margin: 4px 0 0; padding-left: 16px; }
.tactical-log { list-style: none; margin: 0; padding: 0; color: var(--text-dim); }
.tactical-log li { padding: 1px 0; }
.tactical-log li.round { color: var(--amber); margin-top: 4px; }
.tactical-log li.hit { color: var(--text); }
.tactical-log li.destroyed { color: #ff8a6a; }
@media (max-width: 760px) {
  .tactical-body { grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 1fr) auto; }
  .tactical-side { max-height: 42vh; }
}

/* another empire's fleet in a card on the map (2026-10-12, ui/fleetcard.js): over its icon, or pinned by a tap */
.fleet-card { position: absolute; z-index: 30; max-width: 260px; padding: 6px 10px; border: 1px solid var(--race, var(--line));
  background: var(--panel-2); color: var(--text); pointer-events: none; box-shadow: 0 2px 8px rgba(0, 0, 0, 0.6); }
.fleet-card.pinned { pointer-events: auto; padding-right: 40px; }
.fleet-card p { margin: 2px 0; }
.fleet-card .who { color: var(--race, var(--text)); font-family: var(--font-head); }
.fleet-card .relation { color: var(--text-dim); }
.fleet-card .relation.war { color: #ff8a6a; }
.fleet-card .btn.close { position: absolute; top: 4px; right: 4px; }
.fleet-card .out-of-contact { color: var(--amber); }   /* 2026-10-12: the player's own fleets, the fleet panel's lines */
.fleet-card .damaged { color: #ff9a8a; }
.fleet-card .buttons { margin-top: 6px; }
