:root {
  --space: #0a0b1a; --surface: #1a1c33; --card: #292d47; --raised: #383d5c;
  --line: rgba(255, 255, 255, 0.14);
  --text: #f5f7ff; --dim: #c2c9de;
  --amber: #ffb840; --teal: #40d9c7; --coral: #ff8f85;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--space); color: var(--text);
  font: 14px/1.35 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; overflow: hidden; }
button, input, select { font: inherit; color: inherit; }
h1, h2, h3, p { margin: 0; }
[hidden] { display: none !important; }
.loading { position: fixed; inset: 0; display: grid; place-items: center; color: var(--dim); font-size: 18px; background: linear-gradient(rgba(0, 0, 0, 0.45), rgba(0, 0, 0, 0.45)), url(../art/bg_title.jpg?v=c1ffb2b-20261130161614) center / cover no-repeat, var(--space, #0a0b1a); }
.loading-card { text-align: center; min-width: 260px; max-width: 80vw; text-shadow: 0 1px 6px rgba(0, 0, 0, 0.8); }
.progress { height: 6px; margin: 14px auto 8px; width: 240px; border-radius: 3px; background: rgba(255, 255, 255, 0.16); overflow: hidden; }
.progress i { display: block; height: 100%; width: 0; background: var(--amber, #ffb840); transition: width 0.15s linear; }
.progress.unknown i { width: 35% !important; animation: slide 1.4s ease-in-out infinite alternate; }
@keyframes slide { from { margin-left: 0; } to { margin-left: 65%; } }
.reduce-motion .progress.unknown i { animation: none; }
@media (prefers-reduced-motion: reduce) { .progress.unknown i { animation: none; } }
#root { position: fixed; inset: 0; }
.screen { position: absolute; inset: 0; }

/* colours */
.dim { color: var(--dim); } .amber { color: var(--amber); } .teal { color: var(--teal); } .coral { color: var(--coral); } .text { color: var(--text); }
.small { font-size: 12px; } .strong { font-weight: 600; } .mono { font-variant-numeric: tabular-nums; }
.grow { flex: 1 1 auto; min-width: 0; }
.row { display: flex; align-items: center; gap: 8px; } .row.end { justify-content: flex-end; }

/* buttons */
.pill { border: 1px solid currentColor; background: transparent; border-radius: 999px; padding: 5px 13px; font-weight: 600; cursor: pointer; white-space: nowrap; }
.pill.amber { color: var(--amber); background: rgba(255, 184, 64, 0.16); border-color: rgba(255, 184, 64, 0.6); }
.pill.teal { color: var(--teal); background: rgba(64, 217, 199, 0.16); border-color: rgba(64, 217, 199, 0.6); }
.pill.dim { color: var(--dim); background: rgba(194, 201, 222, 0.14); border-color: rgba(194, 201, 222, 0.5); }
.pill.coral { color: var(--coral); background: rgba(255, 143, 133, 0.16); border-color: rgba(255, 143, 133, 0.6); }
.pill.prominent { color: rgba(0, 0, 0, 0.85); border-color: transparent; }
.pill.prominent.amber { background: var(--amber); } .pill.prominent.teal { background: var(--teal); }
.pill.large { padding: 8px 20px; font-size: 15px; min-width: 130px; }
.pill.mini { padding: 2px 9px; font-size: 12px; }
.pill:hover:not(:disabled) { filter: brightness(1.15); }
.pill:disabled { opacity: 0.38; cursor: default; }
:focus-visible { outline: 2px solid var(--teal); outline-offset: 2px; }

/* title screen */
#title { background: var(--space); overflow: hidden; }
.title-bg { position: absolute; inset: 0; background: url(../art/bg_title.jpg?v=c1ffb2b-20261130161614) center / cover no-repeat; }
.title-bg::after { content: ""; position: absolute; inset: 0; background: rgba(0, 0, 0, 0.35); }
.title-sky { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.title-body { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; padding: 40px 40px 12vh; }
.title-body h1 { font-size: 60px; font-weight: 800; color: var(--amber); text-shadow: 0 0 18px rgba(255, 184, 64, 0.35); font-family: ui-rounded, "Segoe UI", system-ui, sans-serif; text-align: center; }
.tagline { color: var(--dim); font-size: 20px; text-align: center; }
.title-buttons { display: flex; gap: 12px; margin-top: 18px; }
.title-buttons .pill { padding: 9px 22px; font-size: 16px; }

/* game layout */
#game { display: grid; grid-template-rows: 54px auto 1fr auto; background: var(--space); }
/* Each part names its row: the strips row disappears when it is empty (`.strips:empty`), and without this the map would slide into the
   content-sized row and the budget strip into the stretching one, leaving a dark band under it. */
#topbar { grid-row: 1; } #strips { grid-row: 2; } #main { grid-row: 3; } #budget { grid-row: 4; }
#topbar { display: flex; align-items: center; gap: 16px; padding: 0 16px; background: var(--surface); border-bottom: 1px solid var(--line); min-width: 0; }
#topbar > * { flex: 0 0 auto; } #topbar .grow { flex: 1 1 8px; }
.galaxy-name { font-weight: 600; font-size: 16px; white-space: nowrap; }
.divider { width: 1px; height: 30px; background: var(--line); }
.stats { display: flex; gap: 18px; }
.stat { display: flex; align-items: center; gap: 7px; }
.stat-icon { width: 24px; height: 24px; object-fit: contain; }
.stat-line { display: flex; align-items: baseline; gap: 5px; }
.stat-val { font-weight: 600; font-size: 15px; font-variant-numeric: tabular-nums; }
.seat-badge { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border: 1px solid; border-radius: 999px; background: var(--card); font-weight: 600; white-space: nowrap; }
.seat-badge i { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
#main { display: grid; grid-template-columns: 1fr 330px; min-height: 0; }
#mapwrap { position: relative; min-width: 0; min-height: 0; overflow: hidden; }
#map { position: absolute; inset: 0; width: 100%; height: 100%; display: block; cursor: grab; touch-action: none; outline-offset: -2px; }
#inspector { overflow-y: auto; padding: 12px; background: var(--surface); border-left: 1px solid var(--line); display: flex; flex-direction: column; gap: 12px; }

/* cards */
.card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; display: flex; flex-direction: column; gap: 8px; }
.section-head { color: var(--amber); font-size: 12px; font-weight: 700; letter-spacing: 1px; text-transform: uppercase; }
.section-top { display: flex; align-items: center; justify-content: space-between; min-height: 30px; }
.kv { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.kv .k { color: var(--dim); } .kv .v { text-align: right; font-variant-numeric: tabular-nums; }
.star-head { display: flex; justify-content: space-between; gap: 8px; }
.star-name { font-size: 20px; font-weight: 600; }
.alert { border-width: 1px; } .alert.coral { background: rgba(255, 143, 133, 0.16); border-color: rgba(255, 143, 133, 0.7); } .alert.amber { background: rgba(255, 184, 64, 0.16); border-color: rgba(255, 184, 64, 0.7); }
.alert-title { font-size: 16px; font-weight: 700; } .alert.coral .alert-title { color: var(--coral); } .alert.amber .alert-title { color: var(--amber); }
.verdict { padding: 8px; border-radius: 8px; font-weight: 600; }
.verdict.teal { background: rgba(64, 217, 199, 0.14); color: var(--teal); } .verdict.amber { background: rgba(255, 184, 64, 0.14); color: var(--amber); } .verdict.coral { background: rgba(255, 143, 133, 0.14); color: var(--coral); }
.forecast-body { display: flex; flex-direction: column; gap: 6px; }
.slider-row { display: flex; align-items: center; gap: 8px; }
.slider { flex: 1; accent-color: var(--amber); min-width: 0; }
.slider:disabled { opacity: 0.5; }
.switch-row { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.switch-row input { accent-color: var(--teal); width: 16px; height: 16px; }
.ship-icon { flex: none; }
.leader { display: inline-flex; align-items: center; justify-content: center; border-radius: 50%; border-style: solid; background: rgba(194, 201, 222, 0.2); overflow: hidden; font-weight: 700; flex: none; }
.leader img { width: 100%; height: 100%; object-fit: cover; display: block; }
/* The busts fill their square, so a round frame cut the heads at the corners: draw them a little smaller and lower (same figures as the Mac's LeaderBadge). */
.leader img { transform: translateY(5%) scale(0.86); }

/* map overlays */
.messages { position: absolute; top: 12px; left: 0; right: 0; display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; padding: 0 16px; }
.banner { pointer-events: auto; display: flex; align-items: center; gap: 12px; padding: 12px; width: min(620px, 100%); background: rgba(56, 61, 92, 0.96); border: 1px solid rgba(255, 184, 64, 0.6); border-radius: 12px; box-shadow: 0 6px 20px rgba(0, 0, 0, 0.5); }
.banner-text { flex: 1; min-width: 0; }
.envelope { color: var(--amber); font-size: 26px; width: 44px; text-align: center; }
.notice { pointer-events: auto; display: flex; align-items: center; gap: 8px; padding: 6px 12px; background: rgba(56, 61, 92, 0.96); border: 1px solid rgba(255, 143, 133, 0.6); border-radius: 999px; color: var(--coral); }
.x { background: none; border: 0; color: var(--dim); cursor: pointer; }
.players-card { position: absolute; left: 12px; bottom: 12px; width: 214px; padding: 10px; background: rgba(26, 28, 51, 0.94); border: 1px solid var(--line); border-radius: 12px; max-height: 60%; overflow-y: auto; }
.player-row { display: flex; align-items: center; gap: 6px; padding: 3px 6px; border-radius: 6px; border: 1px solid transparent; }
.player-row.me { background: var(--card); border-color: rgba(255, 184, 64, 0.5); }
.player-row .name { font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.player-row .grow { min-width: 0; } .player-row .sub { overflow: hidden; text-overflow: ellipsis; font-size: 11px; color: var(--dim); white-space: nowrap; font-variant-numeric: tabular-nums; }
.player-row.out .name { text-decoration: line-through; color: var(--dim); }
.zoom-buttons { position: absolute; right: 12px; bottom: 12px; display: flex; flex-direction: column; gap: 4px; }
.zoom-buttons button { width: 32px; height: 32px; border-radius: 8px; border: 1px solid var(--line); background: rgba(26, 28, 51, 0.9); cursor: pointer; font-size: 16px; }
.zoom-buttons button:hover { background: var(--raised); }
.overlay-center { position: absolute; inset: 0; display: grid; place-items: center; background: rgba(10, 11, 26, 0.55); }
.gameover { width: min(460px, 90%); gap: 12px; padding: 22px; text-align: center; } .gameover h2 { font-size: 22px; color: var(--amber); }
.resolving { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; background: rgba(10, 11, 26, 0.35); }
.resolving > div:last-child { padding: 10px 18px; background: var(--raised); border-radius: 12px; }
.spinner { width: 28px; height: 28px; border: 3px solid var(--raised); border-top-color: var(--amber); border-radius: 50%; animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation: none; } }

/* budget strip */
#budget { background: var(--surface); border-top: 1px solid var(--line); height: 158px; overflow: hidden; }
#budget.collapsed { height: 34px; }
.full { display: flex; height: 100%; position: relative; }
.left { width: 150px; padding: 8px 14px; display: flex; flex-direction: column; gap: 6px; align-items: flex-start; border-right: 1px solid var(--line); flex: none; }
.budget-title { font-size: 12px; font-weight: 600; letter-spacing: 0.8px; color: var(--dim); }
.segmented { display: flex; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; }
.segmented button { background: transparent; border: 0; padding: 2px 10px; cursor: pointer; font-size: 12px; }
.segmented button.on { background: var(--raised); font-weight: 600; }
.cols { display: flex; gap: 10px; padding: 6px 12px; overflow-x: auto; flex: 1; align-items: flex-start; }
.col { width: 66px; flex: none; display: flex; flex-direction: column; align-items: center; gap: 3px; }
.pct { font-size: 12px; font-weight: 600; font-variant-numeric: tabular-nums; height: 16px; } .pct.research { color: var(--teal); font-size: 14px; font-weight: 700; }
.bar { position: relative; width: 34px; height: 66px; border-radius: 5px; background: rgba(0, 0, 0, 0.35); cursor: ns-resize; touch-action: none; overflow: hidden; }
.bar.locked { cursor: not-allowed; }
.bar .fill { position: absolute; left: 0; right: 0; bottom: 0; border-radius: 5px; }
.bar .tick { position: absolute; left: 0; width: 30%; height: 1px; background: rgba(255, 255, 255, 0.25); } .bar .tick.mid { width: 50%; }
.lock { background: none; border: 0; cursor: pointer; font-size: 12px; line-height: 1; padding: 0; opacity: 0.7; } .lock.on { opacity: 1; }
.col-title { font-size: 12px; max-width: 62px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-align: center; }
.col-money { font-size: 11px; color: var(--dim); font-variant-numeric: tabular-nums; }
.low-note-slot { position: absolute; top: 6px; right: 40px; }
.low-note { display: flex; align-items: center; gap: 8px; padding: 4px 10px; border-radius: 999px; background: rgba(255, 184, 64, 0.14); border: 1px solid rgba(255, 184, 64, 0.6); color: var(--amber); font-weight: 600; }
.chev-slot { position: absolute; top: 6px; right: 8px; }
.chevron { background: none; border: 0; color: var(--dim); cursor: pointer; width: 26px; height: 22px; font-size: 11px; }
.slim { display: flex; align-items: center; gap: 12px; height: 34px; padding: 0 14px; cursor: pointer; }
.slim-bar { display: flex; gap: 1px; width: clamp(120px, 24vw, 340px); height: 14px; border-radius: 4px; overflow: hidden; background: rgba(0, 0, 0, 0.3); flex: none; }
.slim-figs { display: flex; gap: 14px; } .fig { display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; } .fig i { width: 8px; height: 8px; border-radius: 50%; display: inline-block; } .fig b { font-variant-numeric: tabular-nums; }
.low-chip { padding: 2px 8px; border-radius: 999px; background: rgba(255, 184, 64, 0.14); border: 1px solid rgba(255, 184, 64, 0.6); color: var(--amber); font-size: 12px; font-weight: 600; white-space: nowrap; }
.slim .chevron { margin-left: auto; }

/* new game */
.modal-back { position: fixed; inset: 0; background: rgba(5, 6, 15, 0.7); display: grid; place-items: center; z-index: 20; }
.newgame { width: min(640px, 96vw); max-height: 96vh; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; display: flex; flex-direction: column; box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6); }
.newgame header { padding: 22px 28px 12px; } .newgame h2 { font-size: 24px; font-weight: 600; }
.newgame .scroll { overflow-y: auto; padding: 0 28px 8px; display: flex; flex-direction: column; gap: 14px; min-height: 0; }
.newgame footer { padding: 10px 28px 18px; border-top: 1px solid var(--line); margin-top: 8px; display: flex; flex-direction: column; gap: 8px; }
.newgame .card { padding: 16px 18px; gap: 12px; }
.who { display: flex; gap: 20px; align-items: center; }
.portrait-btn { background: none; border: 0; padding: 0; cursor: pointer; border-radius: 50%; display: inline-flex; } .portrait-btn.chosen { filter: drop-shadow(0 0 4px var(--amber)); }
.portrait-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 10px; padding: 12px; background: var(--surface); border-radius: 10px; justify-items: center; }
input.text, select { background: var(--raised); border: 1px solid var(--line); border-radius: 8px; padding: 8px 12px; min-width: 0; }
input.text { flex: 1; } input.seed { width: 130px; flex: none; }
select { cursor: pointer; }
.dice { width: 36px; height: 36px; border-radius: 50%; border: 1px solid var(--line); background: var(--raised); cursor: pointer; font-size: 20px; flex: none; }
.stepper { display: flex; align-items: center; gap: 6px; } .step-val { min-width: 40px; text-align: center; font-size: 20px; font-weight: 600; }
.step { width: 34px; height: 34px; border-radius: 50%; border: 1px solid var(--line); background: var(--raised); cursor: pointer; font-size: 18px; font-weight: 700; } .step:disabled { opacity: 0.35; cursor: default; }
.tiles { display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; }
.tile { background: var(--raised); border: 1px solid var(--line); border-radius: 10px; padding: 12px 4px; cursor: pointer; display: flex; flex-direction: column; gap: 4px; align-items: center; }
.tile.chosen { border: 2px solid var(--amber); padding: 11px 3px; } .tile-name { font-size: 16px; font-weight: 600; } .tile.chosen .tile-name { color: var(--amber); }
.advanced { padding: 0 !important; gap: 0 !important; }
.adv-head { display: flex; gap: 10px; align-items: baseline; width: 100%; padding: 18px; background: none; border: 0; cursor: pointer; text-align: left; font-size: 16px; }
.adv-head .dim { font-size: 14px; }
.adv-body { padding: 0 18px 18px; display: flex; flex-direction: column; gap: 14px; }
.opt-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; } .opt-row .row { flex: none; }
.rating { font-size: 18px; font-weight: 700; }

/* menu */
.menu { position: fixed; z-index: 30; min-width: 200px; background: var(--raised); border: 1px solid var(--line); border-radius: 10px; padding: 4px; box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5); }
.menu button { display: block; width: 100%; text-align: left; background: none; border: 0; padding: 8px 12px; border-radius: 6px; cursor: pointer; }
.menu button:hover { background: var(--card); }
.toast { position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%); padding: 8px 16px; background: var(--raised); border: 1px solid var(--line); border-radius: 999px; z-index: 40; }

/* dialogs (confirmations) */
.dialog { width: min(460px, 94vw); background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 22px 24px; display: flex; flex-direction: column; gap: 14px; box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6); }
.dialog h2 { font-size: 18px; font-weight: 600; }
hr { border: 0; border-top: 1px solid var(--line); margin: 4px 0; width: 100%; }
.col-gap { display: flex; flex-direction: column; gap: 6px; }
.violet { color: rgb(219, 128, 255); }
.right { text-align: right; } .ellip { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pad { padding: 10px 16px; }
.dice.small { width: 30px; height: 30px; font-size: 16px; }
.pencil { background: rgba(56, 61, 92, 0.7); border: 0; border-radius: 50%; width: 24px; height: 24px; color: var(--dim); cursor: pointer; font-size: 12px; flex: none; }
.pencil:hover { color: var(--text); background: var(--raised); }
.rename { display: flex; flex-direction: column; gap: 6px; padding-top: 6px; }

/* inspector ships */
.fleet-block { display: flex; flex-direction: column; gap: 2px; }
.fleet-line { display: flex; align-items: center; gap: 4px; }
.fleet-row { display: flex; align-items: center; gap: 8px; flex: 1; min-width: 0; text-align: left; background: none; border: 1.5px solid transparent; border-radius: 8px; padding: 6px; cursor: pointer; }
.fleet-row:hover { background: rgba(56, 61, 92, 0.5); }
.fleet-row.selected { background: var(--raised); border-color: var(--amber); }
.fleet-row.ordered { opacity: 0.82; }
.settle-toggle { padding: 0 6px 4px; display: flex; flex-direction: column; gap: 2px; }
.hint.coral-box { padding: 8px; border-radius: 8px; background: rgba(255, 143, 133, 0.14); display: flex; flex-direction: column; gap: 4px; }
.row.stepper .step { width: 28px; height: 28px; font-size: 16px; }
.link-row { background: none; border: 0; text-align: left; cursor: pointer; padding: 2px 0; width: 100%; }
.link-row:hover { background: rgba(56, 61, 92, 0.5); border-radius: 6px; }
.count-val { min-width: 84px; text-align: center; }

/* build sheet */
.buildsheet { width: min(1040px, 97vw); max-height: 97vh; overflow-y: auto; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 20px 24px; display: flex; flex-direction: column; gap: 14px; box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6); }
.build-cols { display: grid; grid-template-columns: minmax(0, 1fr) 330px; gap: 16px; align-items: start; }
.build-main, .side { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.build-title h2 { font-size: 20px; font-weight: 600; }
.type-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(76px, 1fr)); gap: 8px; }
.type-btn { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 8px 2px; background: rgba(26, 28, 51, 0.6); border: 1px solid var(--line); border-radius: 10px; cursor: pointer; color: var(--dim); font-size: 12px; font-weight: 600; }
.type-btn.on { background: var(--raised); border: 2px solid var(--amber); color: var(--text); padding: 7px 1px; }
.design-summary { display: flex; gap: 16px; align-items: center; padding: 4px 0; }
.design-summary .ship-icon { padding: 6px; background: rgba(26, 28, 51, 0.6); border-radius: 10px; box-sizing: content-box; }
.design-type { font-size: 16px; font-weight: 600; } .design-code { font-size: 16px; font-weight: 500; }
.warn { padding: 8px; background: rgba(255, 143, 133, 0.14); color: var(--coral); border-radius: 8px; font-weight: 600; }
.sliders { display: flex; flex-direction: column; gap: 4px; }
.area-line { display: flex; align-items: center; gap: 12px; min-height: 28px; }
.area-name { width: 96px; flex: none; }
.area-val { width: 72px; text-align: right; flex: none; font-variant-numeric: tabular-nums; } .design-val { font-size: 16px; }
.marginal { padding-left: 108px; } .reach-help { padding-left: 108px; }
.design-slider { accent-color: var(--teal); height: 22px; }
.name-row { align-items: center; } .name-label { width: 96px; flex: none; }
.total { display: flex; flex-direction: column; gap: 2px; font-variant-numeric: tabular-nums; } .total .big { font-size: 18px; }
.small-note { display: flex; flex-direction: column; gap: 2px; }
.saved-list { display: flex; flex-direction: column; gap: 6px; max-height: 250px; overflow-y: auto; }
.saved-row { padding: 8px; border: 1px solid var(--line); border-radius: 10px; background: rgba(26, 28, 51, 0.5); cursor: pointer; }
.saved-row:hover { background: rgba(56, 61, 92, 0.6); } .saved-row.on { background: var(--raised); border: 2px solid var(--amber); padding: 7px; }
.saved-row .right { white-space: pre-line; }
.build-foot { padding-top: 4px; }

/* panels (Fleets, Star List) */
.panels { position: absolute; inset: 0; pointer-events: none; z-index: 6; }
.panel { pointer-events: auto; position: absolute; top: 84px; left: 50%; transform: translateX(-50%); width: min(1060px, calc(100% - 24px)); max-height: calc(100% - 96px);
  display: flex; flex-direction: column; background: rgba(26, 28, 51, 0.97); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 10px 40px rgba(0, 0, 0, 0.6); overflow: hidden; }
.panel + .panel { top: 108px; }
.panel-head { display: flex; align-items: center; gap: 12px; padding: 12px 16px 8px; } .panel-head h2 { font-size: 18px; font-weight: 600; }
.panel-head input.text { width: 200px; flex: none; padding: 5px 10px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 16px 8px; align-items: center; }
.chips.compact { padding: 0 0 4px; gap: 4px; }
.chip { font-size: 12px; font-weight: 600; padding: 3px 10px; border-radius: 999px; cursor: pointer; color: rgb(219, 128, 255); background: rgba(219, 128, 255, 0.14); border: 1px solid rgba(219, 128, 255, 0.6); }
.chip.on { background: rgb(219, 128, 255); color: rgba(0, 0, 0, 0.85); }
.frow, .srow { display: flex; align-items: center; gap: 8px; padding: 5px 16px; font-size: 13px; }
.frow:not(.fhead), .srow:not(.shead) { cursor: pointer; border-left: 3px solid transparent; } .frow:not(.fhead):hover, .srow:not(.shead):hover { background: rgba(56, 61, 92, 0.5); }
.frow.on, .srow.on { background: var(--raised); border-left-color: var(--amber); }
.fhead, .shead { border-bottom: 1px solid var(--line); padding-top: 4px; padding-bottom: 4px; }
.fhead .fc, .shead .sc { background: none; border: 0; padding: 0; text-align: left; cursor: pointer; font-size: 11px; font-weight: 700; letter-spacing: 0.6px; text-transform: uppercase; color: var(--dim); }
.fc.on, .sc.on { color: var(--amber) !important; }
.fc, .sc { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; flex: none; }
.fc-icon { width: 34px; flex: none; display: inline-flex; justify-content: center; }
.fc-design { width: 160px; display: flex; align-items: center; gap: 4px; } .fc-type { width: 78px; } .fc-values { width: 74px; } .fc-count { width: 46px; }
.fc-where { width: 230px; } .fc-fuel { width: 190px; } .fc-status { width: 170px; }
.fbody, .sbody { overflow-y: auto; min-height: 60px; flex: 1 1 auto; }
.fgroup { padding: 5px 16px; font-weight: 600; color: var(--amber); background: rgba(56, 61, 92, 0.5); }
.ffoot { padding: 8px 16px; border-top: 1px solid var(--line); }
.frename { padding: 0 16px 8px 58px; max-width: 460px; }
.sc-name { width: 110px; } .sc-status { width: 150px; } .sc-temp { width: 50px; } .sc-gravity { width: 150px; } .sc-climate { width: 140px; }
.sc-metal { width: 62px; } .sc-people { width: 62px; } .sc-max { width: 62px; } .sc-income { width: 66px; } .sc-verdict { width: 150px; flex: 1 1 auto; } .sc-fleets { width: 44px; } .sc-seen { width: 44px; }
.segmented button.on { background: var(--raised); }
select:focus-visible, input:focus-visible { outline-offset: 0; }
#map:focus-visible { outline: 2px solid rgba(64, 217, 199, 0.28); outline-offset: -2px; }
.buildsheet { padding: 16px 22px 0; gap: 10px; }
.build-foot { position: sticky; bottom: 0; background: var(--surface); padding: 10px 0 14px; border-top: 1px solid var(--line); z-index: 2; }
.area-row { min-height: 0; } .marginal, .reach-help { line-height: 1.2; }
.sc { flex: 0 1 auto; } .srow { gap: 6px; }
.sc-name { width: 104px; } .sc-status { width: 128px; } .sc-temp { width: 44px; } .sc-gravity { width: 132px; } .sc-climate { width: 126px; }
.sc-metal { width: 54px; } .sc-people { width: 66px; } .sc-max { width: 66px; } .sc-income { width: 64px; } .sc-verdict { width: 120px; } .sc-fleets { width: 50px; } .sc-seen { width: 44px; }
#topbar { gap: 10px; } .stats { gap: 14px; }
.galaxy-name { max-width: 190px; overflow: hidden; text-overflow: ellipsis; }
.seat-badge { max-width: 190px; overflow: hidden; text-overflow: ellipsis; }
#topbar .pill:not(.large) { padding-left: 11px; padding-right: 11px; }
.srow { font-size: 12.5px; gap: 5px; padding-left: 12px; padding-right: 12px; }
.sc-name { width: 92px; } .sc-status { width: 112px; } .sc-temp { width: 40px; } .sc-gravity { width: 120px; } .sc-climate { width: 118px; }
.sc-metal { width: 52px; } .sc-people { width: 62px; } .sc-max { width: 66px; } .sc-income { width: 72px; } .sc-verdict { width: 120px; flex: 1 1 120px; } .sc-fleets { width: 44px; } .sc-seen { width: 38px; }
.sc-fleets { width: 56px; }

/* ---- stage 2b: windows ---- */
.panel-body { overflow-y: auto; padding: 4px 16px 16px; display: flex; flex-direction: column; gap: 12px; min-height: 0; flex: 1 1 auto; }
.panel { z-index: 10; }
.wrap { flex-wrap: wrap; }
.center { justify-content: center; }
.pane-title { font-size: 17px; font-weight: 600; }
.linkish { background: none; border: 0; color: var(--teal); cursor: pointer; text-align: left; padding: 2px 0; font-size: 12px; }
.tag { font-size: 10px; font-weight: 700; color: var(--dim); padding: 1px 6px; border: 1px solid var(--line); border-radius: 999px; }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; flex: none; }
.iconbtn { background: none; border: 0; cursor: pointer; font-size: 14px; padding: 2px 4px; border-radius: 6px; } .iconbtn:hover { background: var(--raised); }
.player-row.clickable { cursor: pointer; } .player-row.clickable:hover { background: rgba(56, 61, 92, 0.6); }
.hbar { position: relative; height: 22px; border-radius: 5px; background: rgba(0, 0, 0, 0.35); cursor: ew-resize; touch-action: none; overflow: hidden; }
.hbar.locked { cursor: not-allowed; }
.hfill { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 5px; }
.htick { position: absolute; top: 0; width: 1px; height: 35%; background: rgba(255, 255, 255, 0.25); }
.tech-grid { display: grid; grid-template-columns: 230px minmax(0, 1fr) 72px; gap: 14px; align-items: center; }
.tech-who { display: flex; gap: 10px; align-items: center; } .tech-icon { width: 48px; height: 48px; object-fit: contain; flex: none; }
.tech-names { min-width: 0; }
.tech-mid { display: flex; flex-direction: column; gap: 6px; } .tech-mid progress { width: 100%; height: 8px; accent-color: var(--amber); }
.tech-end { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; }
.boost { background: var(--amber); color: rgba(0, 0, 0, 0.85); font-weight: 700; font-size: 11px; padding: 0 6px; border-radius: 999px; }
.dialog.eureka { width: min(740px, 96vw); }
.eureka-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.eureka-card { text-align: left; padding: 14px; min-height: 120px; background: var(--card); border: 1px solid var(--line); border-radius: 12px; cursor: pointer; display: flex; flex-direction: column; gap: 8px; position: relative; }
.eureka-card:hover { filter: brightness(1.1); } .eureka-name { font-size: 17px; }
.eureka-card.struck { background: var(--surface); border: 2px solid var(--coral); color: var(--dim); }
.eureka-card.struck .eureka-name, .eureka-card.struck .eureka-blurb { text-decoration: line-through; text-decoration-color: var(--coral); }
.eureka-card.struck::after { content: ""; position: absolute; left: 10px; right: 10px; top: 50%; border-top: 3px solid rgba(255, 143, 133, 0.75); transform: rotate(-12deg); }
.dip-line { display: flex; gap: 10px; align-items: flex-start; } .dip-k { width: 96px; flex: none; } .dip-turn { width: 56px; flex: none; }
.dip-name { font-size: 17px; }
.stance-seg { width: 270px; } .stance-seg button { flex: 1; padding: 5px 8px; font-weight: 600; }
.stance-seg button.on { background: var(--amber); color: rgba(0, 0, 0, 0.88); }
.pbars { display: flex; flex-direction: column; gap: 3px; width: 150px; flex: none; }
.pbar { width: 150px; height: 5px; border-radius: 3px; background: var(--line); } .pbar i { display: block; height: 5px; border-radius: 3px; }
.dialog.msg, .dialog.give { width: min(440px, 94vw); }
.cmp-row { display: grid; grid-template-columns: minmax(130px, 1fr) 72px 72px 72px 140px; gap: 10px; align-items: center; padding: 2px 0; }
.cmp-name { display: flex; align-items: center; gap: 6px; min-width: 0; }
.cmp-head { border-bottom: 1px solid var(--line); padding-bottom: 4px; letter-spacing: 0.6px; }
.reports-body { flex-direction: row; gap: 16px; overflow: hidden; }
.log-col { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 8px; min-height: 0; }
.bat-col { flex: 0 0 300px; display: flex; flex-direction: column; gap: 8px; min-height: 0; }
.log-scroll { overflow-y: auto; background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 12px; display: flex; flex-direction: column; gap: 12px; min-height: 120px; max-height: calc(100vh - 260px); }
.log-entry { display: flex; gap: 8px; padding: 1px 0; } .log-entry.clickable { cursor: pointer; } .log-entry.clickable:hover { background: rgba(56, 61, 92, 0.5); }
.bat-row { display: flex; align-items: center; gap: 10px; padding: 10px; background: var(--raised); border-radius: 10px; }
.ellip-wrap { min-width: 0; }
.battle-body { overflow-y: auto; }
.battle-wrap { display: flex; flex-direction: column; gap: 8px; }
.battle-canvas { width: 100%; height: clamp(300px, calc(100vh - 340px), 560px); border-radius: 10px; background: #070816; display: block; }
.bctl { padding: 2px 0; }
.battle-log { background: var(--card); border-radius: 10px; padding: 8px 12px; min-height: 40px; }
.bhead { padding-top: 6px; }
.lost-note { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 40px 20px; text-align: center; }
.text-report { display: flex; flex-direction: column; gap: 12px; }
.bside { width: 150px; flex: none; }
.rtable { display: grid; grid-template-columns: 170px 54px 54px minmax(180px, 1.3fr) minmax(120px, 1fr); gap: 12px; padding: 2px 0; align-items: start; }
.eco-body { gap: 10px; }
.eco-title { font-size: 20px; font-weight: 700; }
.etiles { display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; }
.etile { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 8px 14px; min-width: 0; }
.etile-t { letter-spacing: 0.8px; text-transform: uppercase; font-size: 11px; } .etile-v { font-size: 18px; font-weight: 600; white-space: nowrap; }
.chip.amber-chip { color: var(--amber); background: rgba(255, 184, 64, 0.14); border-color: rgba(255, 184, 64, 0.6); }
.chip.amber-chip.on { background: var(--amber); color: rgba(0, 0, 0, 0.85); }
.eco-scroll { overflow: auto; background: var(--card); border: 1px solid var(--line); border-radius: 12px; max-height: 330px; min-height: 120px; }
.eco-table { width: max-content; min-width: 100%; }
.erow { display: flex; gap: 6px; align-items: center; padding: 0 16px 0 0; }
.ehead, .egroup { position: sticky; top: 0; z-index: 3; background: var(--card); }
.egroup { padding-top: 8px; } .ehead { top: 26px; border-bottom: 1px solid var(--line); padding-bottom: 4px; }
.egroup .eg { border-bottom: 1px solid var(--line); letter-spacing: 0.8px; font-size: 10px; padding-bottom: 2px; }
.ec { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-height: 1px; }
.ehead .ec { background: none; border: 0; padding: 0; cursor: pointer; font-size: 11px; font-weight: 700; color: var(--dim); letter-spacing: 0.4px; } .ehead .ec.on { color: var(--amber); }
.ebody { height: 40px; cursor: pointer; font-size: 12.5px; } .ebody:hover { background: rgba(56, 61, 92, 0.4); } .ebody.on { background: var(--raised); }
.erow .ec:nth-child(1), .erow .ec:nth-child(2) { position: sticky; background: inherit; z-index: 2; }
.erow .ec:nth-child(1) { left: 0; padding-left: 16px; box-sizing: content-box; } .erow .ec:nth-child(2) { left: 38px; }
.ebody .ec:nth-child(1), .ebody .ec:nth-child(2), .efoot .ec:nth-child(1), .efoot .ec:nth-child(2) { background: var(--card); } .ebody.on .ec:nth-child(1), .ebody.on .ec:nth-child(2) { background: var(--raised); }
.ehead .ec:nth-child(1), .ehead .ec:nth-child(2) { background: var(--card); }
.efoot { height: 36px; background: var(--raised); position: sticky; bottom: 0; z-index: 3; font-weight: 600; font-size: 12.5px; } .efoot .ec:nth-child(1), .efoot .ec:nth-child(2) { background: var(--raised); }
.eco-planet { width: 26px; height: 26px; object-fit: contain; flex: none; }
.eco-slider { width: 62px !important; flex: none; } .eco-pct { width: 40px; text-align: right; }
.eco-slider.disabled, input[type=range]:disabled { opacity: 0.45; }
.books { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; align-items: start; }
.account { max-height: 270px; overflow-y: auto; gap: 4px; }
.rbar { flex: 1; height: 12px; border-radius: 4px; background: rgba(0, 0, 0, 0.35); overflow: hidden; } .rbar i { display: block; height: 12px; background: rgba(64, 217, 199, 0.85); border-radius: 4px; }
.hist-body { min-height: 0; }
.hist-chart { position: relative; height: min(360px, calc(100vh - 380px)); min-height: 200px; background: var(--card); border: 1px solid var(--line); border-radius: 12px; }
.hist-canvas { width: 100%; height: 100%; display: block; }
.hist-readout { position: absolute; top: 8px; left: 70px; width: 270px; padding: 10px; background: var(--raised); border: 1px solid var(--line); border-radius: 10px; pointer-events: none; display: flex; flex-direction: column; gap: 3px; }
.legend { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; background: var(--card); border: 1px solid var(--line); cursor: pointer; font-weight: 600; color: var(--dim); }
.legend.on { color: var(--text); } .legend i { width: 12px; height: 12px; border-radius: 50%; border: 2px solid; display: inline-block; }
.ts-grid { display: grid; grid-template-columns: minmax(110px, 210px) repeat(5, minmax(48px, 90px)); gap: 6px 12px; align-items: center; }
.settings-body .set-row { display: flex; align-items: flex-start; gap: 12px; cursor: pointer; padding: 2px 0; }
.settings-body .set-row input { width: 18px; height: 18px; accent-color: var(--teal); flex: none; }
.gameover.card { width: min(560px, 94%); padding: 28px; overflow: hidden; background-size: cover; background-position: center; border-color: var(--line); }
.go-inner { padding: 26px 28px; display: flex; flex-direction: column; gap: 10px; align-items: center; background: rgba(6, 7, 20, 0.74); border-radius: 22px; }
.go-title { font-size: 34px; font-weight: 800; } .gameover h2 { font-size: 20px; color: var(--text); font-weight: 500; }
.notice.revealed { color: var(--text); border-color: rgba(64, 217, 199, 0.6); } .notice.pending-note { color: var(--text); border-color: rgba(255, 184, 64, 0.6); }
.pickbox { width: 22px; flex: none; background: none; border: 0; cursor: pointer; font-size: 17px; color: var(--dim); padding: 0; text-align: center; } .pickbox.on { color: var(--amber); }
.group-box { padding: 8px; border-radius: 8px; background: rgba(255, 184, 64, 0.12); display: flex; flex-direction: column; gap: 4px; }
.hint.reminder { padding: 8px; background: rgba(64, 217, 199, 0.14); border-radius: 8px; }
.hint.reminder.due { background: rgba(255, 184, 64, 0.14); }
.row.top { align-items: flex-start; }
/* the top bar: the left side shrinks first so End Turn never leaves the screen */
#topbar { overflow: hidden; }
#topbar > .tb-name { flex: 0 1 auto; min-width: 44px; overflow: hidden; flex-shrink: 5; }
#topbar > .stats { flex: 0 1 auto; min-width: 0; overflow: hidden; flex-shrink: 3; }
#topbar > .tb-seat { flex: 0 1 auto; min-width: 40px; flex-shrink: 2; }
#topbar > .divider { flex: none; }
#topbar > .grow { flex: 1 1 0; min-width: 0; }
#topbar > .pill { flex: none; }
.tb-name .galaxy-name { max-width: none; overflow: hidden; text-overflow: ellipsis; }
.stat { min-width: 0; } .stat-val { white-space: nowrap; }
.reduce-motion *, .reduce-motion *::before, .reduce-motion *::after { animation: none !important; transition: none !important; }
@media (max-width: 1100px) { .tech-grid { grid-template-columns: 190px minmax(0, 1fr) 64px; } .reports-body { flex-direction: column; overflow-y: auto; } .bat-col { flex: none; } }

.panel.battle-win { position: fixed; top: 8px; bottom: 8px; max-height: none; z-index: 25; }
.panel.battle-win { background: var(--surface); }
.stat { overflow: hidden; flex: 0 1 auto; } .stat > div:last-child { min-width: 0; overflow: hidden; } .stat-line { min-width: 0; overflow: hidden; white-space: nowrap; }
.stat > div:last-child > .small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gameover .pill:not(.prominent) { background: rgba(10, 11, 26, 0.82); }
.menu button:disabled { opacity: 0.4; cursor: default; } .menu button:disabled:hover { background: none; } .menu hr { margin: 4px 8px; width: auto; }

/* ---- stage 3: language switch, help, tour, tips */
.lang-switch { position: absolute; top: 14px; right: 14px; z-index: 2; display: flex; background: rgba(28, 31, 52, 0.7); border: 1px solid var(--line); border-radius: 999px; padding: 0; }
.lang-seg { border: 0; background: none; color: var(--dim); font-size: 12px; font-weight: 700; letter-spacing: 0.08em; padding: 5px 12px; border-radius: 999px; cursor: pointer; }
.lang-seg.on { background: var(--amber); color: rgba(0, 0, 0, 0.85); }
.tour-tabs { display: inline-flex; gap: 10px; flex: none; }
.help-body { flex-direction: row; gap: 0; padding: 0; overflow: hidden; }
.help-side { flex: none; width: 230px; display: flex; flex-direction: column; gap: 2px; padding: 12px; background: var(--space, rgba(8, 9, 20, 0.5)); border-right: 1px solid var(--line); overflow-y: auto; }
.help-topic { display: flex; align-items: center; gap: 8px; text-align: left; background: none; border: 0; color: var(--dim); padding: 7px 10px; border-radius: 8px; cursor: pointer; font-size: 14px; }
.help-topic.on { background: var(--raised); color: var(--text); font-weight: 600; }
.help-icon { width: 20px; text-align: center; color: var(--teal); flex: none; } .help-topic.on .help-icon { color: var(--amber); }
.help-main { flex: 1 1 auto; min-width: 0; overflow-y: auto; padding: 20px 26px 26px; display: flex; flex-direction: column; gap: 12px; }
.help-title { font-size: 24px; font-weight: 700; } .help-lead { color: var(--dim); font-size: 16px; }
.help-point { display: grid; grid-template-columns: 124px 1fr; gap: 14px; padding: 6px 0; align-items: baseline; }
.help-head { color: var(--amber); font-weight: 600; }
@media (max-width: 900px) { .help-point { grid-template-columns: 1fr; gap: 2px; } .help-side { width: 170px; } }
.tour { position: fixed; inset: 0; z-index: 60; }
.tour-block { position: absolute; inset: 0; }
.tour-dim { position: absolute; inset: 0; background: rgba(0, 0, 0, 0.66); pointer-events: none; }
.tour-hole { position: absolute; border: 2px solid var(--amber); border-radius: 10px; box-shadow: 0 0 0 100vmax rgba(0, 0, 0, 0.66); pointer-events: none; transition: left 0.2s, top 0.2s, width 0.2s, height 0.2s; }
.tour-card, .tip-card { position: absolute; box-sizing: border-box; background: var(--card); border: 1.5px solid rgba(255, 184, 64, 0.7); border-radius: 14px; padding: 18px; box-shadow: 0 6px 16px rgba(0, 0, 0, 0.5); display: flex; flex-direction: column; gap: 10px; transition: left 0.2s, top 0.2s; }
.tour-card h3, .tip-card h3 { font-size: 18px; font-weight: 600; } .tour-card p, .tip-card p { font-size: 14px; line-height: 1.4; }
.tour-card .row.end { justify-content: flex-end; gap: 10px; } .tour-card > .row { gap: 10px; }
.tour-dots { gap: 5px !important; } .tour-dots i { width: 7px; height: 7px; border-radius: 50%; background: rgba(150, 157, 190, 0.4); display: inline-block; } .tour-dots i.on { background: var(--amber); }
.tip-back { position: absolute; inset: 0; z-index: 5; background: rgba(0, 0, 0, 0.5); display: grid; place-items: center; border-radius: inherit; }
.tip-card { position: static; width: min(360px, calc(100% - 32px)); transition: none; } .tip-card .row.end { justify-content: flex-end; }
.reduce-motion .tour-hole, .reduce-motion .tour-card { transition: none !important; }
@media (prefers-reduced-motion: reduce) { .tour-hole, .tour-card { transition: none; } }
/* French words run longer: table headers shrink a little, wrap where they are phrases, and a few columns widen */
html[lang="fr"] .fhead .fc, html[lang="fr"] .shead .sc { font-size: 10px; letter-spacing: 0.3px; white-space: normal; line-height: 1.15; }
html[lang="fr"] .fhead, html[lang="fr"] .shead { align-items: flex-end; }
html[lang="fr"] .fc-count { width: 58px; } html[lang="fr"] .sc-people { width: 76px; } html[lang="fr"] .sc-fleets { width: 56px; }
html[lang="fr"] .sc-seen { width: 40px; } html[lang="fr"] .sc-name { width: 100px; } html[lang="fr"] .sc-verdict { width: 128px; flex: 1 1 128px; }
/* the top bar in French: tighter pills and gaps, and the stats give way last (name and seat badge shrink first) */
html[lang="fr"] #topbar { gap: 7px; padding: 0 12px; }
html[lang="fr"] #topbar .pill:not(.large) { padding-left: 9px; padding-right: 9px; font-size: 13px; }
html[lang="fr"] #topbar .pill.large { padding-left: 14px; padding-right: 14px; font-size: 14px; }
html[lang="fr"] .tour-tabs { gap: 7px; }
html[lang="fr"] #topbar > .stats { flex-shrink: 1; gap: 10px; }
html[lang="fr"] #topbar > .tb-seat { flex-shrink: 6; }
html[lang="fr"] #topbar > .tb-name { flex-shrink: 8; }
html[lang="fr"] #topbar .pill.large { white-space: normal; max-width: 160px; line-height: 1.1; text-align: center; padding-top: 6px; padding-bottom: 6px; }

/* stage 4: strips, hot-seat cover, timer, auto play, halls, replay, print */
.strips { display: flex; flex-direction: column; }
.strips:empty { display: none; }
.strip { display: flex; align-items: center; gap: 12px; padding: 7px 16px; font-size: 14px; border-bottom: 1px solid; }
.strip.teal { background: rgba(64, 217, 199, 0.16); border-color: rgba(64, 217, 199, 0.5); color: var(--text); }
.strip.coral { background: rgba(255, 143, 133, 0.16); border-color: rgba(255, 143, 133, 0.5); color: var(--text); }
.spinner.small { width: 14px; height: 14px; border-width: 2px; }
.cover { position: fixed; inset: 0; z-index: 90; background: var(--space); display: grid; place-items: center; }
.cover-body { display: flex; flex-direction: column; align-items: center; gap: 18px; padding: 40px; text-align: center; max-width: 90vw; }
.cover-hand { font-size: 54px; line-height: 1; }
.cover h1 { font-size: 34px; font-weight: 800; font-family: ui-rounded, "Segoe UI", system-ui, sans-serif; overflow-wrap: anywhere; }
.timer-badge { display: inline-flex; align-items: center; gap: 4px; padding: 4px 10px; border: 1px solid var(--line); border-radius: 999px; background: var(--card); font-weight: 600; white-space: nowrap; }
.timer-badge.low { color: var(--coral); border-color: var(--coral); }
.pill.large.wide { width: 180px; white-space: normal; line-height: 1.15; text-align: center; padding: 6px 12px; }
#topbar .pill.large { white-space: normal; line-height: 1.15; text-align: center; }
.timer-badge { flex-shrink: 0; }
.radio-row { display: flex; gap: 10px; align-items: flex-start; cursor: pointer; padding: 3px 0; }
.radio-row input { accent-color: var(--amber); margin-top: 3px; }
.dialog.autoplay { width: min(460px, 94vw); }
.linkbtn { background: none; border: 0; color: var(--teal); text-decoration: underline; cursor: pointer; padding: 0; font: inherit; }
.center-text { text-align: center; align-items: center; }
.row.center { justify-content: center; } .row.wrap { flex-wrap: wrap; }
.adv-head.sub { background: none; border: 0; padding: 4px 0; cursor: pointer; font-weight: 600; text-align: left; width: 100%; }
.halls-list { display: flex; flex-direction: column; gap: 8px; }
.halls-head { display: flex; gap: 14px; text-transform: uppercase; font-weight: 700; padding: 0 14px; }
.hall-row { display: flex; gap: 14px; align-items: flex-start; padding: 12px 14px; background: var(--card); border: 1px solid var(--line); border-radius: 12px; }
.col-year { width: 90px; text-align: right; } .col-rating { width: 60px; text-align: right; }
.panel.replay-win { position: fixed; top: 8px; bottom: 8px; max-height: none; z-index: 25; background: var(--surface); width: min(1180px, calc(100% - 16px)); }
.replay-head { display: flex; align-items: center; gap: 14px; padding: 4px 4px 8px; }
.replay-head h3 { font-size: 18px; font-weight: 600; }
.replay-main { display: flex; flex: 1 1 auto; min-height: 0; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.replay-mapbox { position: relative; flex: 1 1 auto; min-width: 0; background: var(--space); }
.replay-map { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }
.replay-events { width: 300px; flex: none; overflow-y: auto; padding: 14px; border-left: 1px solid var(--line); display: flex; flex-direction: column; gap: 8px; }
.replay-controls { padding: 10px 4px 0; flex-wrap: wrap; }
.replay-controls input[type=range] { width: 100%; accent-color: var(--amber); }
.panel-body:has(.replay-main) { overflow: hidden; }
.crash-back { position: fixed; inset: 0; z-index: 200; background: rgba(5, 6, 15, 0.82); display: grid; place-items: center; }
.crash-card { width: min(520px, 94vw); background: var(--surface); border: 1px solid var(--coral); border-radius: 14px; padding: 22px 24px; display: flex; flex-direction: column; gap: 12px; max-height: 92vh; overflow: auto; }
.crash-card h2 { color: var(--coral); font-size: 20px; }
.crash-card pre { white-space: pre-wrap; overflow-wrap: anywhere; margin: 6px 0 0; max-height: 160px; overflow: auto; }
.print-back { background: rgba(5, 6, 15, 0.86); align-items: start; overflow: auto; z-index: 60; }
.print-preview { margin: 14px auto; width: min(1040px, 96vw); display: flex; flex-direction: column; gap: 10px; }
.print-bar { flex-wrap: wrap; background: var(--surface); padding: 10px 14px; border-radius: 10px; border: 1px solid var(--line); }
.print-sheet { background: #fbfaf6; box-shadow: 0 8px 30px rgba(0, 0, 0, 0.5); }
.print-page { display: block; width: 100%; height: auto; }
.set-row input[type=range] { width: 180px; accent-color: var(--teal); }
@media print {
  @page { size: letter landscape; margin: 0; }
  html, body { background: #fff; overflow: visible; height: auto; }
  body.printing #root > *:not(#modal), body.printing #loading, body.printing .toast, body.printing .crash-back { display: none !important; }
  body.printing #modal { position: static; }
  body.printing .modal-back { position: static; background: none; display: block; overflow: visible; }
  body.printing .print-bar { display: none !important; }
  body.printing .print-preview { margin: 0; width: 100%; }
  body.printing .print-sheet { box-shadow: none; }
  body.printing #root { position: static; }
}
.tech-chip { display: inline-flex; align-items: center; gap: 1px; font-size: 9px; white-space: nowrap; } .tech-chip b { color: var(--dim); } .tech-chip i { font-style: normal; font-size: 8px; margin-right: 2px; }
.player-row.clickable { cursor: pointer; } #players .player-rows { max-height: 290px; overflow-y: auto; }
@media (max-width: 1200px) { .pill.large.wide { width: 150px; font-size: 12px; padding: 4px 8px; } .galaxy-name { max-width: 110px; overflow: hidden; text-overflow: ellipsis; } .stats { gap: 10px; } }
.menu button { display: flex; justify-content: space-between; gap: 18px; align-items: center; }
.menu kbd { font: inherit; font-size: 11px; color: var(--dim); border: 1px solid var(--line); border-radius: 4px; padding: 0 5px; }

/* the top bar's figures give way when the bar is narrow: the change figures first (they stay in the tooltip), then the pictures */
#topbar.no-deltas .stat-line .small { display: none; }
#topbar.no-icons .stat-icon { display: none; }
/* the Mac's toggle switches */
.switch-row input[type="checkbox"], .settings-body .set-row input[type="checkbox"] { appearance: none; -webkit-appearance: none; width: 34px; height: 20px; border-radius: 10px; background: rgba(194, 201, 222, 0.28); position: relative; cursor: pointer; flex: none; margin: 0; transition: background 0.15s; border: 0; }
.switch-row input[type="checkbox"]::after, .settings-body .set-row input[type="checkbox"]::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #f3f4f8; transition: left 0.15s; }
.switch-row input[type="checkbox"]:checked, .settings-body .set-row input[type="checkbox"]:checked { background: var(--teal); }
.switch-row input[type="checkbox"]:checked::after, .settings-body .set-row input[type="checkbox"]:checked::after { left: 16px; }
.reduce-motion .switch-row input[type="checkbox"], .reduce-motion .switch-row input[type="checkbox"]::after, .reduce-motion .set-row input[type="checkbox"], .reduce-motion .set-row input[type="checkbox"]::after { transition: none; }
/* the Fleets table gives way to the panel's width (the last three columns shrink and show the rest in their tooltips) */
.fc-design { width: 150px; flex: none; } .fc-type { width: 66px; flex: none; } .fc-values { width: 70px; flex: none; } .fc-count { width: 46px; flex: none; }
.fc-where { flex: 1.3 1 110px; width: auto; min-width: 0; } .fc-fuel { flex: 1.1 1 100px; width: auto; min-width: 0; } .fc-status { flex: 1 1 100px; width: auto; min-width: 0; }
.frow .fc-where, .frow .fc-fuel, .frow .fc-status { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
html[lang="fr"] .fc-count { width: 58px; }
#topbar.compact .stat-val { font-size: 13px; } #topbar.compact .stats { gap: 8px; } #topbar.compact .stat { gap: 4px; }
#topbar.no-labels .stat > div > .small.dim { display: none; }
/* the Mac's short fades: the budget strip folding (0.18 s) and the tour card changing (0.2 s); none with reduced motion */
@keyframes fadein { from { opacity: 0; } to { opacity: 1; } }
#budget .full, #budget .slim { animation: fadein 0.18s ease-in-out; }
.tour-card { animation: fadein 0.2s ease-in-out; }
.reduce-motion #budget .full, .reduce-motion #budget .slim, .reduce-motion .tour-card { animation: none; }
@media (prefers-reduced-motion: reduce) { #budget .full, #budget .slim, .tour-card { animation: none; } }

/* drawn icons (icons.js) */
.ico { vertical-align: -2px; flex: none; }
.lock { color: var(--dim); display: inline-flex; align-items: center; } .lock.on { color: var(--amber); }
.iconbtn { color: var(--teal); display: inline-flex; align-items: center; }
.rel { display: inline-flex; align-items: center; gap: 4px; }
.locate { display: inline-flex; align-items: center; opacity: 0.9; }
.pill .ico { vertical-align: -2px; }

/* a button row never leaves its card: it wraps when the (French) labels are long */
.tour { overflow: hidden; }
.tour-card .row, .tip-card .row { flex-wrap: wrap; row-gap: 8px; }
.tour-card, .tip-card { max-width: calc(100vw - 16px); }
.tour-card .tour-nav { margin-left: auto; flex-wrap: nowrap; }

/* the Star List is as wide as its columns need (French wording is longer) */
.stars-panel { width: min(1240px, calc(100% - 24px)); }
html[lang="fr"] .sc-gravity { width: 150px; } html[lang="fr"] .sc-people { width: 72px; } html[lang="fr"] .sc-fleets { width: 58px; } html[lang="fr"] .sc-seen { width: 44px; }
.dialog .row, .dialog .row.end { flex-wrap: wrap; row-gap: 8px; }
.crash-card .row, .crash-card .row.end { flex-wrap: wrap; row-gap: 8px; }
html[lang="fr"] #topbar .pill.large.wide { max-width: 200px; width: 200px; font-size: 13px; }
/* a narrow window (1024 CSS pixels, e.g. 1280 wide at 125 percent): the bar's buttons shrink so the money figures keep their room */
@media (max-width: 1100px) {
  #topbar { gap: 6px; }
  html[lang] #topbar .pill.large.wide { max-width: 170px; width: 170px; font-size: 12px; }
  #topbar .pill:not(.large) { font-size: 12px; padding: 4px 8px; }
  #topbar .seat-badge { max-width: 150px; width: auto; justify-content: flex-start; font-size: 12px; padding: 4px 8px; }
  .galaxy-name { max-width: 84px; }
  #topbar > .stats, html[lang="fr"] #topbar > .stats { flex-shrink: 0; }
  #topbar > :first-child { min-width: 72px; flex-shrink: 1; overflow: hidden; }
  #topbar .seat-badge { flex-shrink: 1; min-width: 34px; }
}

/* Drawn icons stand where the page used emoji and text symbols (js/icons.js): centre them in the round and square buttons and chips that carry them. */
.dice, .pencil, .x, .pickbox, .help-icon, .envelope, .boost, .low-chip, .strip > span:first-child { display: inline-flex; align-items: center; justify-content: center; }
.warn { display: flex; gap: 6px; align-items: flex-start; } .warn .ico { margin-top: 3px; } .low-chip { gap: 4px; }
.x { padding: 4px 6px; }
.boost { gap: 2px; }
.pickbox .ico { vertical-align: 0; }

/* Star List: long French cells (an enemy's full name, "Vieille info", header words) wrap onto a second line instead of being cut off; the full text is also in each cell's tooltip. */
.srow { align-items: flex-start; }
.srow .sc { white-space: normal; overflow: visible; text-overflow: clip; overflow-wrap: anywhere; line-height: 1.25; text-align: left; }
.srow.shead .sc { white-space: normal; }
.sc-status { width: 132px; } .sc-people { width: 72px; }
.srow.shead .sc { overflow-wrap: normal; } .sc-temp { width: 52px; } .sc-people { width: 86px; } .sc-fleets { width: 62px; }

/* Fleets: where, fuel and status wrap onto a second line when they do not fit (the full text is also in the tooltip). */
.frow { align-items: flex-start; }
.frow .fc-where, .frow .fc-fuel, .frow .fc-status, .frow .fc-type, .frow .fc-values { white-space: normal; overflow: visible; text-overflow: clip; overflow-wrap: anywhere; line-height: 1.25; }
.frow .fc-design { align-items: flex-start; }
/* Star List: the numeric columns keep their width (a header word never overlaps its neighbour); Name, Status and the verdict give way and wrap. */
.sc-temp, .sc-gravity, .sc-climate, .sc-metal, .sc-people, .sc-max, .sc-income, .sc-fleets, .sc-seen { flex-shrink: 0; }
.sc-name { flex: 1 1 100px; min-width: 92px; } .sc-status { flex: 1 1 100px; min-width: 70px; } .sc-verdict { min-width: 70px; }
.sc-gravity { width: 112px; } .sc-climate { width: 104px; }
/* Star List: when the window is narrower than the table, header and rows scroll sideways together. */
.sscroll { display: flex; flex-direction: column; flex: 1 1 auto; min-height: 0; overflow-x: auto; overflow-y: hidden; }
.sscroll > .srow.shead, .sscroll > .sbody { min-width: 1060px; } .sscroll > .sbody { flex: 1 1 auto; min-height: 0; }
/* A wide system font (Verdana in the ?font=test check): "POPULATION" must not touch "MAX", the ship values stay on one line. */
.sc-people { width: 98px; } .sc-max { width: 70px; } .sscroll > .srow.shead, .sscroll > .sbody { min-width: 1100px; }
.frow .fc-values { white-space: nowrap; width: 104px; } .fc-values { width: 104px; }
.row.wrap { flex-wrap: wrap; }
.star-head { flex-wrap: wrap; } .star-head > div { min-width: 0; overflow-wrap: anywhere; }
html[lang="fr"] .sc-people { width: 98px; } html[lang="fr"] .sc-fleets { width: 62px; }
/* Economy tiles: the big figure shrinks with the tile instead of sticking out of it (narrow window, wide font). */
.etile-v { font-size: clamp(14px, 1.6vw, 18px); }
.etiles { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
/* Narrow window with a wide system font: the top bar's pills tighten before they push End Turn out of the window. */
@media (max-width: 1100px) { #topbar { gap: 6px; } #topbar .pill:not(.large) { padding-left: 7px; padding-right: 7px; font-size: 12px; } #topbar .pill.amber { padding-left: 10px; padding-right: 10px; } .stats { gap: 8px; } }
@media (max-width: 1100px) { html[lang="fr"] #topbar { gap: 4px; padding: 0 8px; } html[lang="fr"] #topbar .pill:not(.large) { padding-left: 6px; padding-right: 6px; font-size: 11.5px; } html[lang="fr"] #topbar .pill.large { padding-left: 9px; padding-right: 9px; font-size: 12.5px; } #topbar .divider { display: none; } }
.grow > input[type="range"] { width: 100%; box-sizing: border-box; }
.grow > input[type="range"] { margin: 0; } span.grow:has(> input[type="range"]) { display: flex; min-width: 0; }
/* Star List: a star name is one word and never breaks in the middle; a very long one ends in an ellipsis (tooltip has it). */
.srow .sc.sc-name, html[lang="fr"] .srow .sc.sc-name { flex: 0 0 124px; width: 124px; min-width: 124px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; overflow-wrap: normal; }
.sscroll > .srow.shead, .sscroll > .sbody { min-width: 1130px; }
/* Economy: the colony table keeps its own height (it was squeezed to two rows while the ledger cards below kept theirs);
   when the window is too short for everything, the whole window scrolls instead. */
.eco-scroll { flex: none; max-height: max(330px, 46vh); }
