/* Layout + base theme. Era tinting lives in eras.css.

   Palette note (WP-019 §4): every colour variable in this file and in eras.css was measured
   against both --bg and --panel with a headless Chromium at the six era themes in sequence, and
   --muted, --warn and --good were nudged darker (5–15%, hue kept) until every one of the six
   cleared WCAG AA 4.5:1 for body text. Nothing about the era drift moved.

   WP-020 UI pass (Jason's playtest feedback): the layout was rebuilt around information
   design rather than recolored — fixed grid columns for every number (tabular figures,
   right-aligned, nowrap everywhere a number lives), a real type scale (11/12/13/14/17),
   two-column card grids for buildings/techs so the center column stops being a monotonous
   stack of full-width bars, jobs and rosters constrained to readable measures, and press/
   hover states on everything clickable. Era palettes are untouched. */

:root {
  --bg: #f7f2e7;
  --fg: #2b2620;
  --muted: #6f665a;
  --accent: #6b4f2a;
  --panel: #efe7d5;
  --border: #d8cdb4;
  --good: #397339;
  --bad: #a03d2e;
  --warn: #83631d;
  /* WP-034: the flame/coal accent, a tenth variable so the path palettes (eras.css) can set
     different ember temperatures against soot or moss. Base value = the shipped icon orange. */
  --ember: #c96a1e;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--fg);
  font: 14px/1.5 Georgia, "Times New Roman", serif;
}

button { font: inherit; }

/* Every number in the game sits in a column with other numbers. */
.res-amount, .res-cap, .res-rate, .building-cost, .tech-cost, .culture-cost,
.trade-cost, .craft-cost, .era-cost, .people-summary-line, .job-count {
  font-variant-numeric: tabular-nums;
}

#game { display: flex; flex-direction: column; height: 100%; }

/* ---- Top bar ---------------------------------------------------------------- */

#topbar {
  padding: 9px 16px 8px;
  border-bottom: 1px solid var(--border);
  background: var(--panel);
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  flex: 0 0 auto;
}

#game-title {
  font-variant: small-caps;
  letter-spacing: 2.5px;
  font-size: 17px;
  color: var(--accent);
}

#topbar-right { display: flex; align-items: baseline; gap: 14px; }
#calendar-strip { color: var(--muted); font-size: 13px; letter-spacing: 0.3px; }

#btn-settings {
  background: none;
  border: none;
  font-size: 16px;
  line-height: 1;
  color: var(--muted);
  cursor: pointer;
  padding: 0 2px;
  transition: color 0.12s ease, transform 0.12s ease;
}
#btn-settings:hover { color: var(--accent); transform: rotate(30deg); }

/* ---- Three columns ---------------------------------------------------------- */

#columns { display: flex; flex: 1; min-height: 0; }

#sidebar {
  width: 264px;
  min-width: 232px;
  border-right: 1px solid var(--border);
  padding: 10px 12px 16px;
  overflow-y: auto;
  overflow-x: hidden;
  background: var(--panel);
}

#center { flex: 1; padding: 12px 20px 24px; overflow-y: auto; min-width: 0; }
.tab-panel { max-width: 940px; }

#log-panel {
  width: 316px;
  min-width: 240px;
  border-left: 1px solid var(--border);
  padding: 12px 14px;
  overflow-y: auto;
  background: var(--panel);
}

/* ---- Tabs ------------------------------------------------------------------- */

#tabbar { border-bottom: 1px solid var(--border); margin-bottom: 14px; }
#tabbar button {
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  color: var(--muted);
  padding: 5px 13px 6px;
  cursor: pointer;
  letter-spacing: 0.2px;
  transition: color 0.12s ease;
}
#tabbar button:hover { color: var(--fg); }
#tabbar button.active { color: var(--fg); border-bottom-color: var(--accent); }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ---- Sidebar: resource grid ------------------------------------------------- */
/* Four fixed columns — name (with optional craft chip) | amount | /cap | rate — so every
   figure lines up down the column and nothing can ever wrap. The annotation (brownout or
   tension band) takes a second grid line, right-aligned, only when present. */

.res-row {
  display: grid;
  grid-template-columns: minmax(52px, 1fr) max-content max-content 54px;
  align-items: baseline;
  column-gap: 6px;
  padding: 1.5px 0;
  font-size: 13px;
  white-space: nowrap;
}

.res-name { display: flex; align-items: baseline; gap: 6px; min-width: 0; }
.res-name-text { overflow: hidden; text-overflow: ellipsis; }

.res-amount { text-align: right; font-size: 12.5px; }
.res-cap { text-align: right; color: var(--muted); font-size: 11px; }
.res-rate { text-align: right; font-size: 11.5px; color: var(--muted); }
.res-rate.pos { color: var(--good); }
.res-rate.neg { color: var(--bad); }

.res-divider {
  padding: 10px 0 3px;
  margin-top: 8px;
  font-size: 10.5px;
  font-weight: bold;
  letter-spacing: 1.2px;
  color: var(--muted);
  text-transform: uppercase;
  border-top: 1px solid var(--border);
}
.res-divider:first-child { margin-top: 0; border-top: none; padding-top: 2px; }

/* Craft chip on a crafted resource's row (WP-020). */
.res-craft-btn {
  font-size: 10px;
  line-height: 1.5;
  padding: 0 5px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 2px;
  color: var(--accent);
  cursor: pointer;
  letter-spacing: 0.5px;
  transition: border-color 0.12s ease, background 0.12s ease;
}
.res-craft-btn:hover { border-color: var(--accent); background: var(--panel); }
.res-craft-btn:active { transform: translateY(1px); }
.res-craft-btn.unaffordable { color: var(--muted); border-style: dashed; cursor: default; }
.res-craft-btn.unaffordable:active { transform: none; }

/* Multi-recipe craft rows (coin's sale routes) — compact, indented under their resource. */
.res-craft-row { padding: 1px 0 1px 14px; }
.res-craft-row-btn {
  width: 100%;
  text-align: left;
  font-size: 11.5px;
  padding: 2px 7px;
  margin: 0;
}

/* Brownout / tension annotations: their own right-aligned line under the row. */
.res-brownout-flag, .res-tension-band {
  grid-column: 1 / -1;
  justify-self: end;
  font-size: 10.5px;
  font-style: italic;
  letter-spacing: 0.2px;
}
.res-brownout-flag:empty, .res-tension-band:empty { display: none; }
.res-row.brownout .res-name-text { color: var(--warn); }
.res-brownout-flag { color: var(--warn); }

/* Tension counters read inverted: rising is bad news. */
.res-row.tension .res-name-text { font-style: italic; }
.res-row.tension .res-rate.pos { color: var(--bad); }
.res-row.tension .res-rate.neg { color: var(--good); }
.res-tension-band { color: var(--muted); }

/* ---- Buttons (shared) ------------------------------------------------------- */

.game-btn {
  display: block;
  width: 100%;
  text-align: left;
  margin: 0;
  padding: 7px 10px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 2px;
  cursor: pointer;
  transition: border-color 0.12s ease, box-shadow 0.12s ease, background 0.12s ease;
}
.game-btn:hover { border-color: var(--accent); box-shadow: 0 1px 3px rgba(43, 38, 32, 0.08); }
.game-btn:active { transform: translateY(1px); box-shadow: none; }
.game-btn.unaffordable { cursor: default; background: transparent; }
.game-btn.unaffordable:hover { border-color: var(--border); box-shadow: none; }
.game-btn.unaffordable:active { transform: none; }
.game-btn.unaffordable .building-label,
.game-btn.unaffordable .tech-label,
.game-btn.unaffordable .culture-label,
.game-btn.unaffordable .trade-label { color: var(--muted); }

/* ---- Settlement: gather + building grid ------------------------------------- */

#gather-buttons {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 7px;
  margin-bottom: 14px;
}
#gather-buttons .game-btn { text-align: center; font-size: 14px; padding: 9px 10px; }

#building-buttons {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
  gap: 7px;
}

/* A card: name (count) on the first line, cost on the second. Nothing wraps; the tooltip
   carries the full detail. */
.building-btn, .tech-btn, .culture-btn { display: block; }
.building-label, .tech-label, .culture-label {
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.building-cost, .tech-cost, .culture-cost {
  display: block;
  color: var(--muted);
  font-size: 11.5px;
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.building-btn.unaffordable .building-cost,
.tech-btn.unaffordable .tech-cost,
.culture-btn.unaffordable .culture-cost { color: var(--bad); }

/* Wonders and maxed-out builds. */
.building-btn.wonder { border-color: var(--accent); box-shadow: inset 2px 0 0 var(--accent); }
.building-btn.maxed { color: var(--muted); cursor: default; font-style: italic; background: transparent; }
.building-btn.maxed .building-cost { color: var(--muted); }
.building-btn.maxed:hover { box-shadow: inset 2px 0 0 var(--accent); }

/* ---- Log -------------------------------------------------------------------- */

#log { font-size: 12.5px; line-height: 1.5; }
.log-entry {
  margin-bottom: 6px;
  padding-left: 8px;
  border-left: 2px solid transparent;
}
.log-entry .ts {
  display: block;
  color: var(--muted);
  font-size: 10px;
  letter-spacing: 0.6px;
  text-transform: uppercase;
}
.log-entry .ts:empty { display: none; }
.log-entry.warning { border-left-color: var(--warn); }
.log-entry.warning .log-text { color: var(--warn); }
.log-entry.event { border-left-color: var(--accent); }
.log-entry.event .log-text { color: var(--accent); }
.log-entry.season .log-text { color: var(--muted); font-style: italic; }
.log-entry.flavor .log-text { font-style: italic; }

/* ---- Section headings (shared) ---------------------------------------------- */

#tab-people h3, #tab-research h3, .culture-tier-heading, #era-panel h3 {
  margin: 18px 0 6px;
  font-size: 12px;
  font-variant: small-caps;
  font-weight: bold;
  letter-spacing: 1.5px;
  color: var(--accent);
  border-bottom: 1px solid var(--border);
  padding-bottom: 3px;
}
#tab-people h3:first-child { margin-top: 0; }

/* ---- People tab ------------------------------------------------------------- */

#people-summary { margin-bottom: 4px; }
.people-summary-line { font-size: 13.5px; margin-bottom: 2px; }

#jobs-list { max-width: 380px; }
.job-row {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 2.5px 0;
  font-size: 13px;
}
.job-label {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.job-btn {
  display: inline-block;
  width: 26px;
  margin: 0;
  padding: 1px 0;
  text-align: center;
  font-size: 13px;
  line-height: 1.4;
}
.job-btn[disabled] { color: var(--border); border-color: var(--border); cursor: default; box-shadow: none; }
.job-btn[disabled]:hover { border-color: var(--border); }
.idle-row { color: var(--muted); font-style: italic; margin-top: 6px; }

/* Roster: two columns of quiet rows; notables lead and carry the accent. */
#people-list { columns: 2; column-gap: 28px; max-width: 720px; }
.person-row {
  padding: 2.5px 0;
  font-size: 12.5px;
  color: var(--muted);
  border-bottom: 1px dotted var(--border);
  break-inside: avoid;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.person-notable { color: var(--accent); font-weight: bold; }
.people-more-row { color: var(--muted); font-style: italic; border-bottom: none; }
.people-empty { color: var(--muted); font-style: italic; }

/* Artisan recipe selector rows (WP-020). */
.assignment-row { padding-left: 14px; }
.assignment-label { color: var(--muted); font-size: 12px; }
.assignment-row .recipe-select {
  font: inherit;
  font-size: 12px;
  padding: 1px 4px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 2px;
}

/* ---- Research tab ----------------------------------------------------------- */

#research-available {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
  gap: 7px;
}
#research-done { columns: 2; column-gap: 28px; max-width: 720px; margin-top: 4px; }
.tech-row {
  padding: 2.5px 0;
  font-size: 12.5px;
  color: var(--muted);
  border-bottom: 1px dotted var(--border);
  break-inside: avoid;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.research-empty { color: var(--muted); font-style: italic; }

/* ---- Era panel (foot of Research) ------------------------------------------- */

#era-panel {
  margin-top: 22px;
  max-width: 480px;
  border: 1px solid var(--border);
  background: var(--panel);
  padding: 10px 14px 12px;
  border-radius: 2px;
}
#era-panel h3 { margin-top: 0; border-bottom: none; padding-bottom: 0; }
.era-current, .era-next, .era-reqs, .era-cost { font-size: 13px; padding: 1.5px 0; }
.era-next { color: var(--accent); }
.era-reqs { color: var(--muted); }
.era-req.met { color: var(--good); }
.era-req.unmet { color: var(--muted); }
.era-cost.unmet { color: var(--bad); }
.era-note { font-size: 13px; color: var(--muted); font-style: italic; }
.era-btn { margin-top: 10px; background: var(--bg); }

/* ---- The Fork (WP-025) ------------------------------------------------------- */
/* Sits directly under the era panel and reads as a heavier version of it: same frame, more
   weight on the border, and the three options side by side so the choice is one glance. */

#fork-panel:empty { display: none; }
#fork-panel {
  margin-top: 18px;
  max-width: 780px;
  border: 1px solid var(--accent);
  border-top-width: 3px;
  background: var(--panel);
  padding: 10px 14px 14px;
  border-radius: 2px;
}
#fork-panel h3 { margin-top: 0; border-bottom: none; padding-bottom: 0; }
.fork-intro, .fork-note, .fork-reqs { font-size: 13px; padding: 1.5px 0; color: var(--muted); }
.fork-intro { color: var(--fg); }
.fork-req.met { color: var(--good); }
.fork-req.unmet { color: var(--muted); }

.fork-options { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 10px; }
.fork-option {
  flex: 1 1 220px;
  min-width: 200px;
  border: 1px solid var(--border);
  border-radius: 2px;
  background: var(--bg);
  padding: 9px 11px 11px;
}
.fork-option-name { font-weight: bold; font-size: 13px; margin-bottom: 4px; }
.fork-option-desc { font-size: 12px; color: var(--fg); margin-bottom: 6px; }
.fork-option-not { font-size: 12px; color: var(--muted); font-style: italic; margin-bottom: 6px; }
.fork-option-cost { font-size: 12px; color: var(--muted); }
.fork-option-cost.unmet { color: var(--bad); }
.fork-btn { margin-top: 8px; width: 100%; background: var(--panel); }
.fork-option.chosen { border-color: var(--accent); border-left-width: 3px; }
.fork-option.fork-locked { border-style: dashed; opacity: 0.55; }
.fork-option.fork-locked .fork-option-name { font-weight: normal; }
.fork-another-history { font-size: 12px; color: var(--muted); font-style: italic; }

/* The one solemn confirmation. Inline, in the panel, never an overlay and never a browser
   dialog (README project rules); quiet rather than loud, per GAME_DESIGN.md Appendix B Q2. */
#fork-confirm:empty { display: none; }
.fork-confirm-box {
  margin-top: 12px;
  padding: 11px 13px;
  border: 1px solid var(--accent);
  border-left-width: 3px;
  border-radius: 2px;
  background: var(--bg);
}
.fork-confirm-title { font-weight: bold; font-size: 13px; margin-bottom: 7px; }
.fork-confirm-chosen, .fork-confirm-forgone { font-size: 13px; margin-bottom: 7px; }
.fork-confirm-forgone { color: var(--muted); }
.fork-confirm-buttons { display: flex; gap: 8px; }
.fork-confirm-btn { margin: 0; background: var(--panel); }
.fork-cancel-btn { color: var(--muted); }

/* The earned-Collapse banner: top of the centre column, above the tabs, not dismissable. */
#fork-warning:empty { display: none; }
.fork-warning-box {
  margin-bottom: 10px;
  padding: 9px 12px;
  border: 1px solid var(--bad);
  border-left-width: 4px;
  border-radius: 2px;
  background: var(--panel);
}
.fork-warning-title { font-weight: bold; font-size: 13px; color: var(--bad); margin-bottom: 4px; }
.fork-warning-body, .fork-warning-stop, .fork-warning-time { font-size: 12px; padding: 1px 0; }
.fork-warning-stop { color: var(--fg); }
.fork-warning-time { color: var(--muted); }

/* ---- Path tab (WP-025) ------------------------------------------------------- */

#tab-path h3 {
  font-size: 13px;
  margin: 16px 0 6px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 3px;
}
#tab-path h3:first-child { margin-top: 0; }

/* WP-043: the Fork's shadow in the era panel — one quiet line per age. */
.era-foreshadow {
  font-size: 12px;
  color: var(--muted);
  font-style: italic;
  margin-top: 4px;
  max-width: 46ch;
}

/* WP-044 (Chewy): the log's hierarchy, made visible — a choice or a warning is heavier than
   passing flavor, so the eye learns what may be skimmed. */
.log-entry.flavor { opacity: 0.75; }
.log-entry.warning { border-left-width: 3px; }

/* ---- The scenario-link question (WP-040) -------------------------------------- */
/* Shown only when a link's prepared history meets a standing run. Same quiet chrome as the
   rest of the page; the two buttons are ordinary game buttons. */

#scenario-offer:empty { display: none; }
.scenario-offer-box {
  margin-bottom: 12px;
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  background: var(--panel);
  padding: 10px 14px;
  border-radius: 2px;
}
.scenario-offer-text { font-size: 13px; margin-bottom: 8px; }
.scenario-offer-buttons { display: flex; gap: 8px; }
.scenario-offer-buttons .game-btn { padding: 5px 12px; }

/* ---- The finale frame (WP-026) ----------------------------------------------- */
/* A page in the record, not a modal — quieter than the Fork panel it sits above: a plain
   border, no accent stripe, nothing that reads as a reward screen. */

#path-finale:empty { display: none; }

.finale-pending { margin-bottom: 16px; font-size: 13px; }
.finale-pending h3 { margin-top: 0; }
.finale-note { color: var(--muted); padding: 1.5px 0; }
.finale-reqs { margin-top: 6px; }
.finale-req { font-size: 12.5px; padding: 1px 0; }
.finale-req.met { color: var(--good); }
.finale-req.unmet { color: var(--muted); }

.finale-panel {
  margin-bottom: 18px;
  max-width: 620px;
  border: 1px solid var(--border);
  background: var(--panel);
  padding: 10px 14px 14px;
  border-radius: 2px;
}
.finale-panel h3 { margin-top: 0; border-bottom: none; padding-bottom: 0; }
/* WP-034 (Ember Icons II): the closing numbers sit under a double rule, apart from the
   record's lines — the design's "at the close" treatment, quieter here. */
.finale-numbers { margin: 8px 0 10px; border-top: 3px double var(--border); padding-top: 8px; }
.finale-number { font-size: 12.5px; color: var(--fg); padding: 1px 0; }
.finale-remembered { font-size: 13px; color: var(--muted); font-style: italic; }

/* ---- The record, underway (WP-032 frame, WP-034 dressing) --------------------- */
/* The ending as a page being written: the record mark on the heading, each played line on
   its own hairline, the newest arriving with a 6px rise. A standing question is set in
   against the accent. Same quiet framing as .finale-panel — it is the same page, earlier. */

.finale-underway {
  margin-bottom: 18px;
  max-width: 620px;
  border: 1px solid var(--border);
  background: var(--panel);
  padding: 10px 14px 14px;
  border-radius: 2px;
}
.finale-underway h3 {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0 0 4px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 6px;
}
.finale-line {
  font-size: 13.5px;
  line-height: 1.55;
  padding: 7px 0;
  border-bottom: 1px solid var(--border);
}
.finale-line:last-child { border-bottom: none; }
.finale-choice-note {
  margin-top: 10px;
  padding: 8px 12px;
  border-left: 2px solid var(--accent);
  background: var(--bg);
  font-size: 13px;
  color: var(--fg);
}

@keyframes record-in {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}
.record-in { animation: record-in 0.5s ease-out both; }
@media (prefers-reduced-motion: reduce) {
  .record-in { animation: none; }
}

/* ---- Culture tab ------------------------------------------------------------ */

#culture-content { max-width: 560px; }
.culture-locked-note, .culture-empty { font-size: 13px; color: var(--muted); font-style: italic; }
.culture-btn { margin: 4px 0; }
.culture-rival-locked {
  padding: 7px 10px;
  margin: 4px 0;
  border: 1px dashed var(--border);
  border-radius: 2px;
  color: var(--muted);
  font-style: italic;
  cursor: default;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.culture-adopted-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  padding: 5px 0;
  font-size: 13px;
  border-bottom: 1px dotted var(--border);
}
.culture-adopted-name { color: var(--fg); white-space: nowrap; }
.culture-creed {
  color: var(--muted);
  font-style: italic;
  text-align: right;
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ---- Trade tab -------------------------------------------------------------- */

#trade-content { max-width: 560px; }
.trade-empty { color: var(--muted); font-style: italic; }
.neighbor-section {
  margin-bottom: 16px;
  border: 1px solid var(--border);
  border-radius: 2px;
  background: var(--panel);
  padding: 10px 14px 12px;
}
.neighbor-header {
  font-size: 14px;
  font-variant: small-caps;
  letter-spacing: 1px;
  color: var(--accent);
}
.neighbor-flavor { font-size: 12.5px; color: var(--muted); font-style: italic; margin: 2px 0 6px; }
/* WP-026: the neighbour glimpse — quiet, easy to miss on purpose, and empty until the first one
   fires (a fresh Trade tab before any glimpse interval has elapsed shows nothing here). */
.neighbor-glimpse:empty { margin: 0; }
.neighbor-glimpse { font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.neighbor-standing { font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.trade-btn { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; margin: 4px 0; background: var(--bg); }
.trade-label { white-space: nowrap; }
.trade-cost {
  color: var(--muted);
  font-size: 11.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.trade-btn.unaffordable .trade-cost { color: var(--bad); }

/* ---- Shared tooltip --------------------------------------------------------- */

.tooltip {
  position: fixed;
  z-index: 100;
  max-width: 280px;
  padding: 7px 10px;
  background: var(--fg);
  color: var(--bg);
  font-size: 12px;
  line-height: 1.45;
  border-radius: 3px;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  white-space: pre-line;
  transition: opacity 0.08s ease;
  box-shadow: 0 2px 8px rgba(43, 38, 32, 0.25);
}
.tooltip.visible { opacity: 1; visibility: visible; }

/* ---- Inline event-choice panel (WP-008) -------------------------------------- */

#event-choice:empty { margin: 0; }
.event-choice-box {
  margin-bottom: 14px;
  padding: 10px 12px;
  border: 1px solid var(--accent);
  border-left-width: 3px;
  border-radius: 2px;
  background: var(--bg);
  box-shadow: 0 1px 4px rgba(43, 38, 32, 0.1);
}
.event-choice-text { font-size: 13px; margin-bottom: 9px; color: var(--fg); }
.event-choice-buttons { display: flex; flex-direction: column; gap: 5px; }
.event-choice-btn { margin: 0; background: var(--panel); }

/* ---- Settings overlay (WP-010) ----------------------------------------------- */

#settings-overlay {
  position: fixed;
  inset: 0;
  background: rgba(30, 26, 20, 0.35);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 8vh;
  z-index: 200;
}
#settings-overlay.hidden { display: none; }
#settings-panel {
  width: 380px;
  max-width: 92vw;
  max-height: 80vh;
  overflow-y: auto;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 2px;
  box-shadow: 0 4px 18px rgba(43, 38, 32, 0.3);
  padding: 14px 16px;
}
.settings-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 10px; }
.settings-title { font-variant: small-caps; letter-spacing: 1px; color: var(--accent); }
.settings-section { border-top: 1px solid var(--border); padding: 10px 0 4px; }
.settings-section:first-of-type { border-top: none; }
.settings-section h4 { margin: 0 0 4px; font-size: 12px; font-variant: small-caps; letter-spacing: 0.5px; color: var(--accent); }
.settings-note { margin: 0 0 6px; font-size: 12px; color: var(--muted); }
.settings-check { font-size: 13px; cursor: pointer; }
.settings-check input { vertical-align: middle; margin-right: 5px; }
.settings-btn { font-size: 12px; margin: 0 6px 6px 0; padding: 3px 8px; background: var(--panel); border: 1px solid var(--border); border-radius: 2px; cursor: pointer; }
.settings-btn:hover { border-color: var(--accent); }
.settings-btn[disabled] { color: var(--muted); border-style: dashed; cursor: default; }
.settings-btn-danger { color: var(--bad); }
.settings-btn-danger[disabled] { color: var(--muted); }
#save-io { width: 100%; margin-top: 4px; font-size: 11px; font-family: monospace; }
#wipe-confirm { width: 160px; font: inherit; font-size: 12px; padding: 3px 6px; margin: 0 6px 6px 0; border: 1px solid var(--border); background: var(--bg); }
.settings-msg { font-size: 12px; color: var(--muted); min-height: 1em; }
.settings-danger { border-top-style: dashed; }
.settings-phrase { color: var(--fg); font-style: italic; }

/* ---- Narrow windows ---------------------------------------------------------- */

@media (max-width: 1100px) {
  #sidebar { width: 240px; min-width: 216px; }
  #log-panel { width: 260px; min-width: 220px; }
  #people-list, #research-done { columns: 1; }
}

/* ---- Ember Icons (WP-022, from Jason's Claude Design "From Embers icons") ---- */

.icon {
  width: 15px;
  height: 15px;
  vertical-align: -2.5px;
  flex: 0 0 auto;
}
/* WP-034: the ember temperature became a variable (--ember, set in :root and shifted by the
   path palettes in eras.css) so soot and moss surfaces can warm or cool the coals. The
   shipped #c96a1e is the fallback and the base value — Hearth looks exactly as before. */
.icon-accent { color: var(--ember, #c96a1e); }
/* A stroke inside one symbol (the telling at the centre of `culture`) rather than a whole
   icon: coloured directly, whatever currentColor the rest of the mark inherits. */
.icon .ember { stroke: var(--ember, #c96a1e); }

#game-title { display: inline-flex; align-items: center; gap: 7px; }
#game-title .icon { width: 17px; height: 17px; }
/* WP-034: the wordmark's banked coals — a broken rule under the title, echoing the ground
   line in the embers mark. Takes the palette's ember temperature like everything else. */
#game-title {
  position: relative;
  padding-bottom: 5px;
}
#game-title::after {
  content: "";
  position: absolute;
  left: 24px; /* the rule underlines the word, not the flame */
  right: 0;
  bottom: 0;
  height: 2px;
  border-radius: 1px;
  background: linear-gradient(90deg,
    var(--ember, #c96a1e) 0 30%, transparent 30% 35%,
    var(--ember, #c96a1e) 35% 65%, transparent 65% 70%,
    var(--ember, #c96a1e) 70% 100%);
  opacity: 0.85;
}

h3[data-icon], #era-panel h3 { display: flex; align-items: center; gap: 6px; }
h3 .icon { width: 13px; height: 13px; color: var(--accent); }
#era-panel h3 .icon { color: var(--accent); }

.res-divider { display: flex; align-items: center; gap: 5px; }
.res-divider .icon { width: 12px; height: 12px; opacity: 0.8; }

/* ---- Ember Radio (WP-023): the ♪ button beside the settings gear ------------- */
#btn-radio {
  background: none;
  border: none;
  font-size: 16px;
  line-height: 1;
  color: var(--muted);
  cursor: pointer;
  padding: 0 2px;
  transition: color 0.12s ease;
}
#btn-radio:hover { color: var(--accent); }
#btn-radio.radio-on { color: var(--ember, #c96a1e); }

/* WP-042: the dial's other half — next station, shown only while playing. */
#btn-radio-next {
  background: none;
  border: none;
  font-size: 15px;
  line-height: 1;
  color: var(--muted);
  cursor: pointer;
  padding: 0 2px;
  transition: color 0.12s ease;
}
#btn-radio-next:hover { color: var(--accent); }

/* ---- Small screens (WP-024, Grok QA #2): stack the three columns ------------- */
/* Below ~720px the side-by-side layout can't fit without horizontal overflow, so the page
   becomes one column: header, stores, tabs, log. Not a full mobile experience — just an
   honest one: nothing clips, nothing pans sideways. */
@media (max-width: 720px) {
  #columns { flex-direction: column; }
  #sidebar, #log-panel {
    width: 100%;
    min-width: 0;
    border-right: none;
    border-left: none;
    border-bottom: 1px solid var(--border);
  }
  #sidebar { max-height: 34vh; }
  #log-panel { max-height: 26vh; border-bottom: none; border-top: 1px solid var(--border); }
  #center { padding: 10px 12px 18px; }
  #building-buttons, #research-available, #gather-buttons { grid-template-columns: 1fr; }
  #people-list, #research-done { columns: 1; }
  .res-row { grid-template-columns: minmax(52px, 1fr) max-content max-content 54px; }
}
