:root {
  --bg: #0b1220;
  --panel: #131d2e;
  --card: #1a2740;
  --line: #26344d;
  --ink: #e9eef8;
  --muted: #8ea3bf;
  --gold: #f5c26b;
  --teal: #57e0c0;
  --red: #ff7f7f;
  --blue: #7aa8ff;
}

* { box-sizing: border-box; }
html, body { height: 100%; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", "PingFang SC", sans-serif;
  background:
    radial-gradient(1100px 600px at 15% -10%, #1b2b4a 0%, transparent 60%),
    radial-gradient(900px 500px at 100% 0%, #231b3a 0%, transparent 50%),
    var(--bg);
  color: var(--ink);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

.muted { color: var(--muted); }
.danger { color: var(--red) !important; }

/* ---------------- header ---------------- */
.hud {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
  padding: 10px 22px;
  border-bottom: 1px solid var(--line);
  background: rgba(11, 18, 32, 0.86);
  backdrop-filter: blur(12px);
  position: sticky;
  top: 0;
  z-index: 20;
}
.hud-brand { display: flex; gap: 12px; align-items: center; min-width: 200px; }
.logo { display: block; width: 40px; height: 40px; flex: 0 0 40px; border-radius: 10px; image-rendering: pixelated; }
.hud-brand h1 { font-size: 16px; margin: 0; letter-spacing: 1px; }
.hud-brand p { margin: 3px 0 0; color: var(--muted); font-size: 10px; letter-spacing: 1px; }
.hud-stats { display: flex; gap: 16px; flex-wrap: wrap; align-items: center; }
.stat { display: flex; flex-direction: column; gap: 2px; min-width: 54px; }
.stat .k { font-size: 9px; color: var(--muted); letter-spacing: 1px; }
.stat .v { font-size: 15px; font-weight: 700; font-variant-numeric: tabular-nums; }
.stat .v.money { color: var(--gold); }
.stat .v.rep { color: var(--teal); }
.stat .v.best { color: var(--muted); font-size: 11px; font-weight: 600; }
.stat .v.town { color: var(--gold); font-size: 13px; }
.stat .v.town.max { color: var(--teal); }
.stat-sub { font-size: 8px; color: var(--muted); font-weight: 600; }
.stat-sub.pos { color: var(--teal); }
.stat .v.sat.mid { color: var(--gold); }
.stat .v.sat.pos { color: var(--teal); }
.stat .v.sat.neg, .stat .v.labor.neg { color: var(--red); }

/* ---------------- layout ---------------- */
.layout {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr) 380px;
  gap: 14px;
  padding: 14px 22px 90px;
  max-width: 1600px;
  margin: 0 auto;
  align-items: start;
}
.col { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.panel {
  background: linear-gradient(180deg, var(--panel), #101a2a);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 13px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.18);
  min-width: 0;
}
.panel-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; margin-bottom: 10px; }
.panel-head h2 { font-size: 12px; margin: 0; letter-spacing: 2px; color: #dbe6f6; white-space: nowrap; }
.hint { color: var(--muted); font-size: 9px; text-align: right; line-height: 1.4; }
.empty { color: var(--muted); font-size: 10px; text-align: center; padding: 16px 10px; border: 1px dashed var(--line); border-radius: 10px; line-height: 1.7; }
.empty.small { padding: 10px; font-size: 9px; }

/* ---------------- construction goals ---------------- */
.goal-panel { grid-column: 1 / -1; border-color: #37505b; padding: 12px 15px; }
.goal-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 9px; }
.goal-heading h2 { font-size: 13px; margin: 0; color: var(--gold); }
.goal-state { font-size: 10px; color: var(--muted); }
.goal-state.met, .goal-condition.met .goal-check, .scenario-record.cleared, .end-result.cleared { color: var(--teal); }
.goal-conditions { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.goal-condition { display: flex; align-items: center; gap: 8px; padding: 9px 11px; background: rgba(26, 39, 64, .7); border: 1px solid var(--line); border-radius: 9px; }
.goal-condition.met { border-color: rgba(87, 224, 192, .35); }
.goal-check { color: var(--gold); font-size: 14px; }
.goal-condition > div { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 12px; min-width: 0; }
.goal-condition span { font-size: 10px; }
.goal-condition b { font-size: 13px; font-variant-numeric: tabular-nums; }
.goal-condition b small { color: var(--muted); font-size: 10px; font-weight: 400; }
.goal-gap { margin-left: auto; font-size: 9px; color: var(--muted); white-space: nowrap; }
.goal-note { font-size: 10px; line-height: 1.6; color: var(--muted); margin: 8px 0 0; }
.scenario-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.scenario-card { display: flex; flex-direction: column; align-items: stretch; position: relative; text-align: left; font: inherit; color: var(--ink); background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 14px; cursor: pointer; }
.scenario-card:hover, .scenario-card:focus-visible { border-color: var(--gold); outline: 2px solid rgba(245, 194, 107, .25); outline-offset: 2px; }
.scenario-tag { font-size: 10px; color: var(--gold); padding-right: 30px; }
.scenario-icon { position: absolute; top: 14px; right: 14px; font-size: 24px; }
.scenario-card h3 { font-size: 17px; margin: 12px 30px 8px 0; }
.scenario-card p { font-size: 11px; line-height: 1.6; color: var(--muted); margin: 0 0 8px; }
.scenario-card ul { font-size: 11px; line-height: 1.7; padding-left: 17px; margin: auto 0 10px; }
.scenario-record { font-size: 10px; color: var(--muted); margin-bottom: 9px; }
.scenario-card .pick-btn { text-align: center; }
.opening-goals, .end-goals { margin-bottom: 14px; }
.end-result { margin: 12px 0; color: var(--gold); font-size: 21px; }
.setup-goal { font-size: 11px; line-height: 1.7; color: var(--gold); margin: 0 0 16px; }
.setup-group { border: 0; padding: 0; margin: 0 0 18px; min-width: 0; }
.setup-group legend { font-size: 12px; font-weight: 700; margin-bottom: 9px; }
.setup-options { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 9px; }
.setup-options.difficulties { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.setup-option { cursor: pointer; font: inherit; text-align: left; border: 1px solid var(--line); border-radius: 10px; background: var(--card); color: var(--ink); padding: 12px; }
.setup-option b { display: block; font-size: 12px; margin-bottom: 7px; }
.setup-option span { display: block; color: var(--muted); font-size: 10px; line-height: 1.6; }
.setup-option.selected { border-color: var(--teal); background: rgba(87,224,192,.08); }
.setup-option:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.setup-summary { display: flex; flex-direction: column; gap: 7px; padding: 13px; border-radius: 10px; border: 1px solid var(--line); background: rgba(0,0,0,.12); font-size: 11px; }
.setup-summary b { color: var(--teal); font-size: 13px; }
.setup-summary span { color: var(--muted); }
.setup-details { font-size: 11px; margin-top: 14px; }
.setup-details summary { cursor: pointer; color: var(--gold); padding: 4px 0; }
.setup-table { width: 100%; border-collapse: collapse; font-size: 10px; margin-top: 8px; }
.setup-table td, .setup-table th { text-align: left; padding: 8px 5px; border-bottom: 1px solid var(--line); }
.setup-table th { color: var(--muted); font-weight: 400; }
.end-config { color: var(--muted); font-size: 11px; margin-top: 8px; }
.setup-option small { display: block; color: var(--gold); margin-top: 8px; font-size: 10px; }
.setup-option:disabled { cursor: not-allowed; opacity: .5; }
.loadout-advice, .loadout-presets { padding: 14px; margin: 16px 0; border: 1px solid var(--line); border-radius: 10px; background: rgba(87,224,192,.04); }
.loadout-advice > b, .loadout-presets summary { font-size: 12px; color: var(--gold); }
.loadout-advice p, .loadout-presets p { font-size: 11px; line-height: 1.7; margin: 8px 0; }
.loadout-advice > div { display: flex; justify-content: space-between; align-items: center; gap: 10px; font-size: 11px; }
.loadout-advice small { display: block; color: var(--muted); font-size: 10px; line-height: 1.7; margin-top: 8px; }
.loadout-advice .btn { flex-shrink: 0; }
.loadout-presets summary { cursor: pointer; }
.loadout-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin-top: 12px; }
.loadout-slot { display: flex; min-width: 0; flex-direction: column; gap: 8px; padding: 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--card); }
.loadout-slot label { font-size: 10px; color: var(--muted); }
.loadout-slot input { box-sizing: border-box; min-width: 0; width: 100%; font: inherit; font-size: 12px; padding: 8px; border: 1px solid var(--line); border-radius: 6px; color: var(--ink); background: rgba(0,0,0,.16); }
.loadout-slot input:focus-visible { outline: 2px solid var(--teal); }
.loadout-slot > span, .loadout-slot > small { overflow-wrap: anywhere; font-size: 10px; line-height: 1.7; }
.loadout-slot > small { color: var(--muted); margin-top: auto; }
.loadout-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.loadout-actions .btn { padding: 7px 9px; font-size: 10px; }
.growth-summary { display: flex; gap: 12px; align-items: center; justify-content: space-between; padding: 14px; margin: 14px 0; border: 1px solid var(--line); border-radius: 10px; background: rgba(87,224,192,.04); }
.growth-summary b, .growth-summary span, .growth-summary small { display: block; line-height: 1.7; }
.growth-summary b { color: var(--teal); font-size: 13px; }
.growth-summary span, .growth-summary small { color: var(--muted); font-size: 10px; }
.growth-summary .btn { flex-shrink: 0; }
.growth-list { display: grid; gap: 9px; margin-top: 16px; }
.growth-item { display: flex; gap: 12px; justify-content: space-between; padding: 13px; border: 1px solid var(--line); border-radius: 9px; }
.growth-item b { display: block; font-size: 12px; line-height: 1.6; }
.growth-item span, .growth-item small { display: block; font-size: 10px; color: var(--muted); line-height: 1.7; }
.growth-item small { flex-shrink: 0; text-align: right; }
.growth-item.unlocked b, .end-growth { color: var(--teal); }
.end-growth { font-size: 12px; margin: 14px 0; }
.setup-rewards, .growth-settlement, .failure-advice { padding: 14px; margin: 14px 0; border: 1px solid var(--line); border-radius: 10px; background: rgba(87,224,192,.04); }
.setup-rewards b, .setup-rewards span, .setup-rewards small { display: block; line-height: 1.8; }
.setup-rewards b, .growth-settlement h3, .failure-advice b { font-size: 12px; color: var(--gold); }
.setup-rewards span, .growth-settlement p { font-size: 12px; }
.setup-rewards small { font-size: 10px; color: var(--muted); }
.growth-settlement { text-align: left; }
.growth-settlement h3 { margin: 0 0 10px; }
.growth-settlement dl { margin: 0; }
.growth-settlement dl > div { display: flex; justify-content: space-between; gap: 12px; padding: 6px 0; font-size: 12px; }
.growth-settlement dd { margin: 0; color: var(--teal); font-weight: 700; }
.growth-settlement .growth-total { border-top: 1px solid var(--line); margin-top: 5px; padding-top: 10px; font-weight: 700; }
.growth-new { color: var(--teal); font-size: 12px; margin-top: 12px; }
.growth-new ul, .failure-advice ul { margin: 8px 0 0; padding-left: 18px; line-height: 1.8; }
.failure-advice { text-align: left; font-size: 11px; }
.scenario-card.locked { opacity: .55; cursor: not-allowed; }
.scenario-card.locked .pick-btn { color: var(--muted); }
.draw-reroll { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin: 14px 0; }
.draw-reroll small { font-size: 10px; color: var(--muted); }

/* ---------------- resources ---------------- */
.res-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.res-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 8px 9px;
  min-width: 0;
}
.res-card.advanced { border-left: 3px solid var(--blue); }
.res-card.basic { border-left: 3px solid var(--teal); }
.res-card.full { border-color: rgba(87, 224, 192, 0.45); }
.res-card.zero { opacity: 0.78; }
.res-card.over { border-color: rgba(245, 107, 107, 0.55); }
.res-card.full { border-color: rgba(87, 224, 192, 0.45); }
.res-top { display: flex; align-items: center; gap: 5px; min-width: 0; }
.res-icon { font-size: 14px; flex: 0 0 auto; }
.res-name { font-size: 10px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.res-tag { margin-left: auto; font-size: 8px; color: var(--muted); border: 1px solid var(--line); border-radius: 99px; padding: 0 4px; flex: 0 0 auto; }
.res-nums { display: flex; align-items: baseline; gap: 3px; margin-top: 4px; font-variant-numeric: tabular-nums; }
.res-nums b { font-size: 15px; line-height: 1.1; }
.res-sub { font-size: 8px; color: var(--muted); font-weight: 400; }
.res-score { margin-left: auto; font-size: 12px; color: var(--teal); font-weight: 800; }
.res-card.zero .res-score { color: var(--red); }
.bar { height: 5px; border-radius: 99px; background: #0e1727; overflow: hidden; margin-top: 5px; }
.bar i { display: block; height: 100%; border-radius: 99px; background: linear-gradient(90deg, var(--teal), #9af0d8); transition: width 0.3s ease; }
.bar.res-bar { display: flex; gap: 0; }
.bar.res-bar i { border-radius: 0; }
.bar.res-bar i.occ { background: linear-gradient(90deg, var(--gold), #ffe0a3); }
.bar.res-bar i.dem { background: linear-gradient(90deg, var(--teal), #9af0d8); }
.res-card.advanced .bar.res-bar i.dem { background: linear-gradient(90deg, var(--blue), #b9ccff); }
.bar.res-bar i.shortfall { background: repeating-linear-gradient(45deg, var(--red), var(--red) 3px, #8e3140 3px, #8e3140 6px); }
.res-card.over .bar.res-bar i.occ { background: var(--red); }
.res-card.short { border-color: rgba(245, 107, 107, 0.45); }
.res-card.zero .bar.res-bar i.dem { background: #26344a; }
.res-foot { margin-top: 4px; font-size: 8px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.res-flow { display: flex; align-items: baseline; gap: 3px; margin-top: 4px; flex-wrap: wrap; font-variant-numeric: tabular-nums; }
.rf-label { font-size: 8px; color: var(--muted); }
.res-flow b { font-size: 15px; line-height: 1.1; }
.res-arrow { color: var(--muted); font-size: 9px; }
.res-next { color: var(--gold); }
.res-next.up { color: var(--teal); }
.res-next.down { color: var(--red); }
.res-scoreline { margin-top: 1px; font-size: 8px; color: var(--muted); font-variant-numeric: tabular-nums; }
.res-scoreline b { font-size: 10px; color: var(--teal); }
.res-scoreline b.up { color: var(--teal); }
.res-scoreline b.down { color: var(--red); }
.res-extra { display: flex; align-items: baseline; gap: 4px; margin-top: 3px; padding: 2px 5px; border-radius: 6px; background: rgba(87, 224, 192, 0.07); font-variant-numeric: tabular-nums; }
.res-extra span { font-size: 8px; color: var(--muted); }
.res-extra b { font-size: 17px; line-height: 1; color: var(--teal); font-weight: 800; }
.res-extra small { font-size: 7px; color: var(--muted); }
.res-extra.neg { background: rgba(245, 107, 107, 0.09); }
.res-extra.neg b { color: var(--red); }
.res-extra.pos b { color: var(--teal); }
.sat-detail { margin-left: 6px; color: var(--muted); font-size: 8px; }
.sat-neg { color: var(--red); font-weight: 700; }
.sat-rep { margin-left: 6px; font-size: 9px; color: var(--teal); font-weight: 700; }
.res-over { color: var(--red); font-weight: 700; }
.res-stopped { color: var(--red); font-weight: 700; }
.task-card.blocked { opacity: 0.62; }
.sat-math {
  margin-top: 10px;
  padding: 7px 9px;
  border-radius: 8px;
  border: 1px solid rgba(245, 194, 107, 0.18);
  background: rgba(245, 194, 107, 0.06);
  color: #c7d6ea;
  font-size: 9px;
  line-height: 1.6;
}
.sat-math b { color: var(--gold); font-size: 12px; }

/* ---------------- city ---------------- */
.city-list { display: flex; flex-direction: column; gap: 5px; max-height: 280px; overflow: auto; padding-right: 2px; }
.city-row { display: flex; align-items: center; gap: 7px; background: var(--card); border: 1px solid var(--line); border-radius: 9px; padding: 6px 7px; }
.city-row.off { opacity: 0.5; }
.cr-icon { font-size: 14px; flex: 0 0 auto; }
.cr-main { display: flex; flex-direction: column; gap: 1px; min-width: 0; flex: 1; }
.cr-main b { font-size: 10px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cr-main small { font-size: 8px; color: var(--muted); }
.cr-total { color: var(--muted); font-weight: 500; font-size: 8px; margin-left: 4px; }
.cr-stepper { display: flex; align-items: center; gap: 3px; flex: 0 0 auto; }
.step {
  width: 22px;
  height: 22px;
  padding: 0;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: #1b2942;
  color: var(--ink);
  font-size: 13px;
  line-height: 1;
  cursor: pointer;
  font-family: inherit;
}
.step:hover:not(:disabled) { border-color: var(--gold); color: var(--gold); }
.step:disabled { opacity: 0.3; cursor: not-allowed; }
.step-val { min-width: 14px; text-align: center; font-size: 10px; font-weight: 700; font-variant-numeric: tabular-nums; }
.btn.tiny { padding: 3px 6px; font-size: 9px; border-radius: 7px; flex: 0 0 auto; }

/* ---------------- tasks ---------------- */
.task-panel { display: flex; flex-direction: column; max-height: calc(100vh - 120px); min-height: 420px; }
.board-list { display: flex; flex-direction: column; gap: 8px; overflow: auto; padding-right: 3px; flex: 1 1 auto; min-height: 120px; }
.filter-bar { display: flex; gap: 5px; margin: 0 0 9px; flex-wrap: wrap; }
.filter-btn { background: transparent; border: 1px solid var(--line); color: var(--muted); border-radius: 99px; padding: 3px 9px; font-size: 9px; cursor: pointer; font-family: inherit; }
.filter-btn:hover { border-color: var(--gold); color: var(--ink); }
.filter-btn.on { background: rgba(245, 194, 107, 0.12); border-color: var(--gold); color: var(--gold); }
.task-card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 9px 10px; display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.task-card.timed { border-left: 3px solid var(--gold); }
.task-card.malignant { border-left: 3px solid var(--red); }
.task-card.normal { border-left: 3px solid var(--teal); }
.task-card.active { border-style: dashed; }
.tc-top { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.tc-top b { font-size: 12px; }
.badge { font-size: 8px; padding: 1px 6px; border-radius: 99px; background: #26344d; color: #c7d6ea; letter-spacing: 0.5px; }
.badge.timed { background: rgba(245, 194, 107, 0.14); color: var(--gold); }
.badge.malignant { background: rgba(255, 127, 127, 0.14); color: var(--red); }
.tc-dur { margin-left: auto; font-size: 8px; color: var(--muted); font-variant-numeric: tabular-nums; }
.tc-occ { font-size: 9px; color: #c7d6ea; }
.tc-occ .tc-lack { color: var(--red); font-weight: 700; }
.tc-occ .tc-surplus { color: var(--teal); font-weight: 700; }
.tc-reward { font-size: 9px; color: var(--gold); line-height: 1.5; }
.tc-deadline { font-size: 8px; color: var(--muted); line-height: 1.5; }
.tc-deadline.urgent { color: var(--red); }
.tc-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 2px; flex-wrap: wrap; }
.tc-sat { font-size: 9px; color: var(--muted); font-variant-numeric: tabular-nums; }
.tc-sat.neg { color: var(--red); font-weight: 700; }
.tc-sat.pos { color: var(--teal); }
.tc-sat.mid { color: var(--gold); }
.tc-delta { margin-left: 4px; font-size: 8px; font-weight: 700; }
.tc-delta.pos { color: var(--teal); }
.tc-delta.neg { color: var(--red); }
.sub-head { margin: 12px 0 8px; font-size: 9px; color: var(--muted); letter-spacing: 2px; }
.sub-head span { color: var(--gold); }
.active-list { display: flex; flex-direction: column; gap: 7px; max-height: 230px; overflow: auto; padding-right: 3px; flex: 0 0 auto; }

/* ---------------- build ---------------- */
.build-panel { display: flex; flex-direction: column; }
.town-upgrade { margin: 2px 0 10px; }
.town-box {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 5px 10px;
  align-items: center;
  background: linear-gradient(180deg, #17263e, #111c2e);
  border: 1px solid #2a3d5b;
  border-radius: 12px;
  padding: 9px 10px;
}
.town-box.ready { border-color: rgba(245, 194, 107, 0.55); }
.town-box.maxed { border-color: rgba(93, 214, 192, 0.45); }
.town-main { display: flex; align-items: center; gap: 8px; min-width: 0; }
.town-lv {
  flex: none;
  font-size: 11px;
  font-weight: 800;
  color: #1a1206;
  background: var(--gold);
  border-radius: 6px;
  padding: 3px 7px;
}
.town-main b { display: block; font-size: 11px; }
.town-main small { display: block; color: var(--muted); font-size: 8px; margin-top: 2px; }
.town-btn {
  font-family: inherit;
  font-size: 10px;
  font-weight: 700;
  color: #1a1206;
  background: var(--gold);
  border: 0;
  border-radius: 7px;
  padding: 6px 11px;
  cursor: pointer;
}
.town-btn:disabled { background: #26364e; color: #70839d; cursor: not-allowed; }
.town-note { grid-column: 1 / -1; color: var(--gold); font-size: 9px; }
.town-note.muted { color: var(--muted); }
.town-tag { grid-column: 2; color: var(--teal); font-size: 10px; font-weight: 800; letter-spacing: 1px; }
.build-list { max-height: calc(100vh - 390px); overflow: auto; padding-right: 3px; }
.build-group { margin-bottom: 10px; }
.group-head { display: flex; justify-content: space-between; color: var(--muted); font-size: 9px; letter-spacing: 1px; margin: 6px 2px; }
.build-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }
.build-card {
  position: relative;
  display: flex;
  gap: 6px;
  align-items: center;
  text-align: left;
  padding: 7px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--ink);
  cursor: pointer;
  transition: transform 0.14s ease, border-color 0.14s ease, background 0.14s ease;
  min-height: 58px;
  font-family: inherit;
  min-width: 0;
}
.build-card:hover:not(:disabled) { border-color: var(--gold); transform: translateY(-1px); background: #1e2d49; }
.build-card.is-dis { opacity: 0.42; cursor: not-allowed; }
.bc-icon { font-size: 17px; flex: 0 0 auto; }
.bc-main { display: flex; flex-direction: column; gap: 1px; min-width: 0; flex: 1; }
.bc-main b { font-size: 10px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bc-main small { color: var(--muted); font-size: 8px; line-height: 1.35; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bc-main small.extra { color: var(--red); opacity: 0.8; }
.bc-right { display: flex; flex-direction: column; align-items: flex-end; gap: 1px; flex: 0 0 auto; }
.bc-cost { color: var(--gold); font-size: 10px; font-weight: 700; }
.bc-count { color: var(--muted); font-size: 8px; }
.bc-reason { position: absolute; right: 4px; top: 4px; font-size: 7px; color: var(--red); background: rgba(255, 127, 127, 0.1); padding: 1px 3px; border-radius: 4px; }
.bc-main small.bp-note { color: var(--gold); opacity: 0.88; white-space: normal; overflow: visible; text-overflow: clip; font-size: 7.5px; line-height: 1.3; }
.bc-main small.bc-net { color: var(--teal); font-size: 8px; font-weight: 700; white-space: nowrap; }

/* ---------------- log ---------------- */
.log-panel { flex: 0 0 auto; }
.log-list { display: flex; flex-direction: column; gap: 4px; max-height: 190px; overflow: auto; padding-right: 2px; }
.log-line { display: flex; gap: 6px; font-size: 9px; color: #b9c8dd; line-height: 1.45; }
.log-turn { color: var(--gold); font-size: 8px; min-width: 24px; flex: 0 0 auto; }
.log-line.good { color: var(--teal); }
.log-line.bad { color: var(--red); }
.log-line.warn { color: var(--gold); }
.log-line.draw { color: #c7b3ff; }
.log-line.end { color: var(--gold); font-weight: 700; }

/* ---------------- buttons ---------------- */
.btn { border: 1px solid var(--line); background: #1b2942; color: var(--ink); border-radius: 9px; padding: 7px 11px; font-size: 10px; cursor: pointer; font-family: inherit; transition: transform 0.14s ease, border-color 0.14s ease, filter 0.14s ease; }
.btn:hover:not(:disabled) { border-color: var(--gold); }
.btn.primary { background: linear-gradient(180deg, #f5c26b, #e0a84a); color: #1a1206; border-color: #f5c26b; font-weight: 700; }
.btn.primary:hover:not(:disabled) { filter: brightness(1.06); }
.btn.ghost { background: transparent; }
.btn.small { padding: 4px 8px; font-size: 9px; }
.btn.big { padding: 11px 28px; font-size: 13px; }
.btn.warn { color: var(--gold); border-color: rgba(245, 194, 107, 0.45); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* ---------------- action bar ---------------- */
.action-bar { position: fixed; bottom: 0; left: 0; right: 0; display: flex; gap: 10px; align-items: center; padding: 9px 22px; background: rgba(11, 18, 32, 0.93); border-top: 1px solid var(--line); backdrop-filter: blur(12px); z-index: 20; }
.action-hint { color: var(--muted); font-size: 10px; margin-left: 4px; }
.action-hint.danger { color: var(--red); }
.save-note { color: var(--muted); font-size: 9px; opacity: 0.8; white-space: nowrap; }

/* ---------------- modal ---------------- */
.modal { position: fixed; inset: 0; background: rgba(4, 8, 16, 0.74); backdrop-filter: blur(5px); display: flex; align-items: center; justify-content: center; padding: 20px; z-index: 50; }
.modal.hidden { display: none; }
.show-modal { position: fixed; right: 24px; bottom: 78px; z-index: 60; box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45); }
.show-modal.hidden { display: none; }
.modal-view-actions { margin-top: 10px; justify-content: flex-start; }
.modal-view-actions .btn { font-size: 10px; }
.modal-card { width: min(860px, 100%); max-width: 100%; box-sizing: border-box; max-height: 90vh; overflow: auto; background: linear-gradient(180deg, #16233a, #101a2b); border: 1px solid #2c3f5f; border-radius: 18px; padding: 20px; box-shadow: 0 30px 80px rgba(0, 0, 0, 0.55); }
.modal-head h2 { margin: 0 0 6px; font-size: 19px; letter-spacing: 1px; }
.modal-head p { margin: 0 0 14px; color: var(--muted); font-size: 10px; line-height: 1.6; }
.build-preview { display: flex; flex-direction: column; gap: 10px; }
.bp-stats { display: flex; flex-wrap: wrap; gap: 7px 18px; font-size: 10px; color: var(--muted); }
.bp-stats b { color: var(--ink); font-variant-numeric: tabular-nums; }
.bp-compare { background: #111d30; border: 1px solid #263a57; border-radius: 12px; padding: 10px 12px; }
.bp-subhead { margin-bottom: 6px; color: var(--gold); font-size: 10px; font-weight: 700; letter-spacing: .5px; }
.bp-row { display: grid; grid-template-columns: 44px minmax(0, 1fr) minmax(0, 1fr); gap: 6px; padding: 3px 0; border-top: 1px dashed #22344d; font-size: 10px; color: #c7d6ea; }
.bp-row:first-of-type { border-top: 0; }
.bp-row b { color: var(--ink); }
.bp-name { color: var(--muted); }
.bp-next { font-size: 10px; color: var(--muted); }
.bp-next b { color: var(--teal); }
.bp-net { background: rgba(87, 224, 192, 0.08); border: 1px solid rgba(87, 224, 192, 0.28); border-radius: 10px; padding: 8px 10px; font-size: 10px; color: var(--muted); line-height: 1.55; }
.bp-net b { color: var(--teal); font-size: 13px; }
.bp-net span { display: block; font-size: 8px; opacity: 0.85; margin-top: 2px; }
.bp-reasons { background: rgba(245, 107, 107, 0.07); border: 1px solid rgba(245, 107, 107, 0.3); border-radius: 12px; padding: 10px 12px; font-size: 10px; line-height: 1.6; }
.bp-reasons.none { background: #111d30; border-color: #263a57; }
.bp-reasons ul { margin: 4px 0 2px; padding-left: 18px; }
.bp-reasons li { margin: 2px 0; color: #e7d6d6; }
.bp-reasons b { color: #fff; }
.bp-warn { margin: 0; color: var(--red); font-weight: 700; }
.bp-good { margin: 0; color: var(--teal); font-weight: 700; }
.bp-none { margin: 0; color: var(--muted); }
.bp-before-label { margin: 8px 0 0; color: var(--muted); }
.bp-before li { color: var(--muted); }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 14px; }
.intro { margin: 0 0 14px; padding: 10px 12px; border: 1px solid rgba(245, 194, 107, 0.2); background: rgba(245, 194, 107, 0.06); border-radius: 10px; }
.intro-goal { color: var(--gold); font-size: 11px; margin-bottom: 6px; }
.intro ul { margin: 0; padding-left: 16px; color: #c7d6ea; font-size: 10px; line-height: 1.7; }
.intro li { margin: 2px 0; }
.intro b { color: var(--ink); }
.rules { color: #c7d6ea; font-size: 11px; line-height: 1.75; }
.rules h2 { margin: 2px 0 10px; color: var(--ink); font-size: 20px; }
.rules p { margin: 0 0 10px; }
.rules b { color: var(--gold); }
.rules .btn { margin-top: 6px; }
.pick-note { color: var(--gold) !important; font-size: 9px !important; line-height: 1.45 !important; min-height: 0 !important; }
.pick-net { color: var(--teal); font-size: 8px; font-weight: 700; }
.reward-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.reward-card { display: flex; flex-direction: column; align-items: center; gap: 6px; min-width: 0; width: 100%; background: var(--card); border: 1px solid var(--line); border-radius: 13px; padding: 16px 12px; cursor: pointer; color: var(--ink); font-family: inherit; transition: border-color 0.14s ease, transform 0.14s ease; }
.reward-card:hover { border-color: var(--gold); transform: translateY(-2px); }
.reward-kicker { font-size: 8px; color: var(--muted); letter-spacing: 1px; }
.reward-card b { color: var(--gold); font-size: 16px; }
.reward-sub { font-size: 9px; color: var(--muted); line-height: 1.5; text-align: center; min-height: 27px; }
.reward-common { font-size: 9px; color: var(--teal); }
.reward-btn { margin-top: 2px; font-size: 9px; color: #1a1206; background: var(--gold); border-radius: 6px; padding: 3px 12px; font-weight: 700; }
.reward-more { margin: 10px 0 0; font-size: 9px; color: var(--muted); text-align: center; }
.pick-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.pick-grid.five { grid-template-columns: repeat(3, 1fr); }
.pick-card { background: var(--card); border: 1px solid var(--line); border-radius: 13px; padding: 13px 10px; text-align: center; display: flex; flex-direction: column; gap: 5px; align-items: center; cursor: pointer; color: var(--ink); font-family: inherit; transition: border-color 0.14s ease, transform 0.14s ease; }
.pick-card:hover { border-color: var(--gold); transform: translateY(-2px); }
.pick-card.selected { border-color: var(--gold); box-shadow: 0 0 0 2px rgba(245, 194, 107, 0.22); background: #1c2b42; }
.pick-card.selected .pick-btn { background: var(--teal); color: #061412; }
.pick-icon { font-size: 30px; }
.pick-card h3 { margin: 0; font-size: 12px; }
.pick-card p { margin: 0; font-size: 9px; color: var(--muted); line-height: 1.55; min-height: 32px; }
.pick-req { font-size: 8px; padding: 3px 7px; border-radius: 6px; background: #0f1a2b; color: #c7d6ea; }
.pick-cost { font-size: 10px; color: var(--gold); font-weight: 700; }
.pick-btn { margin-top: 2px; font-size: 9px; color: #1a1206; background: var(--gold); border-radius: 6px; padding: 2px 10px; font-weight: 700; }
.pick-foot { display: flex; justify-content: flex-end; align-items: center; gap: 12px; margin-top: 14px; }
.pick-count { color: var(--muted); font-size: 10px; font-variant-numeric: tabular-nums; }

/* ---------------- end ---------------- */
.end { text-align: center; }
.end-kicker { color: var(--muted); font-size: 10px; letter-spacing: 4px; }
.end-rep { font-size: 40px; font-weight: 800; color: var(--teal); line-height: 1.1; margin-top: 4px; }
.end-rep small { font-size: 12px; color: var(--muted); font-weight: 400; margin-left: 4px; }
.end-sub { color: var(--muted); font-size: 10px; margin: 4px 0 14px; }
.end-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; margin-bottom: 14px; }
.end-stat { background: var(--card); border: 1px solid var(--line); border-radius: 11px; padding: 9px; }
.end-stat b { display: block; font-size: 15px; }
.end-stat span { font-size: 8px; color: var(--muted); }
.end-best { color: var(--muted); font-size: 9px; margin-bottom: 13px; }

/* ---------------- toast ---------------- */
.toast { position: fixed; left: 50%; bottom: 70px; transform: translateX(-50%) translateY(10px); background: #f5c26b; color: #1a1206; font-size: 10px; font-weight: 700; padding: 7px 15px; border-radius: 99px; opacity: 0; pointer-events: none; transition: opacity 0.2s ease, transform 0.2s ease; z-index: 60; box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35); white-space: nowrap; }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

.affix-actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0; }

/* City hall and progressive disclosure */
.hidden { display: none !important; }
button, a, summary, input { -webkit-tap-highlight-color: transparent; }
button:focus-visible, a:focus-visible, summary:focus-visible { outline: 2px solid var(--gold); outline-offset: 4px; }
button, input { font: inherit; }
.btn { font-size: 12px; min-height: 36px; }
.text-btn { padding: 6px 2px; border: 0; background: none; color: var(--muted); cursor: pointer; font: inherit; font-size: 12px; }
.text-btn:hover { color: var(--gold); }
.eyebrow { color: var(--muted); font-size: 11px; letter-spacing: 1px; }
.home-screen { width: min(1180px, 100%); margin: auto; padding: 0 30px; }
.home-header { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 20px 0; border-bottom: 1px solid var(--line); }
.home-header-actions { display: flex; align-items: center; gap: 18px; }
.home-brand { display: flex; align-items: center; gap: 12px; text-decoration: none; color: var(--ink); }
.home-brand img { border-radius: 12px; image-rendering: pixelated; }
.home-brand h1 { font-size: 19px; letter-spacing: 2px; margin: 0 0 5px; }
.home-brand span { color: var(--muted); font-size: 11px; }
.home-brand .wordmark { display: block; width: 252px; height: auto; border-radius: 0; }
.brand-lockup h1 { line-height: 0; }
.hud-brand .wordmark { display: block; width: 180px; height: auto; image-rendering: pixelated; }
.brand-lockup > span { display: inline-block; margin-top: 8px; }
.home-hero { display: grid; grid-template-columns: 1.5fr 1fr; align-items: center; gap: 40px; padding: 24px 0 20px; }
.home-welcome h2 { margin: 12px 0; font-size: clamp(25px, 3vw, 34px); letter-spacing: 1px; }
.home-welcome > p { color: var(--muted); margin: 0; font-size: 14px; }
.home-counts { display: flex; flex-wrap: wrap; gap: 25px; margin-top: 18px; color: var(--muted); font-size: 12px; }
.home-counts b { color: var(--ink); font-size: 17px; }
.home-progress { padding: 18px 22px; border: 1px solid #37514f; border-radius: 16px; background: linear-gradient(135deg, rgba(87,224,192,.07), rgba(87,224,192,.015)); }
.home-progress strong { display: block; font-size: 32px; color: var(--teal); margin: 6px 0 9px; font-variant-numeric: tabular-nums; }
.progress-track { height: 5px; background: #23364a; border-radius: 10px; overflow: hidden; }
.progress-track i { display: block; height: 100%; background: var(--teal); }
.home-progress p { margin: 12px 0 0; font-size: 12px; line-height: 1.7; }
.home-progress p span { display: block; color: var(--muted); font-size: 11px; }
.continue-card, .learn-card { display: flex; align-items: center; gap: 16px; padding: 14px 20px; border: 1px solid var(--line); border-radius: 13px; background: rgba(26,39,64,.6); margin-bottom: 12px; }
.continue-card { border-color: #6b593c; }
.continue-card > div, .learn-card > div { flex: 1; }
.continue-card h3 { font-size: 17px; margin: 5px 0; }
.continue-card p, .learn-card p { font-size: 12px; color: var(--muted); line-height: 1.6; margin: 5px 0 0; }
.learn-card b { font-size: 14px; }
.learn-icon { font-size: 25px; color: var(--gold); }
.home-nav { display: flex; border-bottom: 1px solid var(--line); gap: 24px; margin: 22px 0; }
.home-nav button { display: flex; align-items: center; gap: 10px; padding: 0 0 15px; background: none; color: var(--muted); border: 0; border-bottom: 2px solid transparent; cursor: pointer; font-size: 15px; }
.home-nav button.selected { color: var(--ink); border-bottom-color: var(--gold); }
.home-nav small { color: var(--muted); font-size: 10px; padding: 4px 6px; background: #1a293c; border-radius: 5px; }
.section-heading { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 16px; }
.section-heading h2 { font-size: 17px; margin: 0; }
.section-heading > span, .section-heading p { color: var(--muted); font-size: 12px; margin: 7px 0 0; line-height: 1.5; }
.section-heading h2 small { color: var(--teal); margin-left: 10px; font-size: 13px; }
.chapter { margin-bottom: 30px; }
.home-scenarios, .blueprint-catalog { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 13px; }
.home-scenario { display: flex; flex-direction: column; min-width: 0; padding: 18px; text-align: left; border: 1px solid var(--line); border-radius: 14px; background: linear-gradient(140deg, #1b2a40, #131e2f); color: var(--ink); cursor: pointer; transition: border-color .15s, transform .15s; }
.home-scenario:hover:not(:disabled) { border-color: #738778; transform: translateY(-2px); }
.home-scenario.locked { background: rgba(19,29,46,.6); cursor: default; }
.scenario-top, .scenario-bottom { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.scenario-number { font-size: 10px; color: var(--muted); }
.status-pill { font-size: 10px; color: var(--muted); white-space: nowrap; }
.status-pill.complete { color: var(--teal); }
.scenario-name { display: flex; align-items: center; gap: 12px; margin: 22px 0 18px; }
.scenario-name > span { font-size: 30px; }
.scenario-name h3 { font-size: 20px; margin: 0; }
.requirement-chips { display: flex; align-items: flex-start; flex-wrap: wrap; gap: 6px; font-size: 11px; line-height: 1.7; }
.requirement-chips > span { display: inline-block; padding: 4px 7px; border-radius: 6px; background: rgba(142,163,191,.08); color: #abbdd3; }
.requirement-chips > span { max-width: 100%; }
.active-section { margin-bottom: 18px; }
.active-section .sub-head { margin-top: 0; }
.active-section .active-list { max-height: 220px; }
.requirement-chips b { color: var(--ink); font-weight: 600; margin-left: 4px; }
.scenario-bottom { margin-top: auto; padding-top: 22px; font-size: 11px; color: var(--muted); }
.scenario-bottom b { color: var(--gold); font-weight: 500; }
.locked .scenario-name, .locked .catalog-heading { color: #99aabe; }
.locked .scenario-bottom b { color: var(--muted); }
.growth-overview { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin: 20px 0 28px; }
.growth-overview > div { padding: 20px; border: 1px solid var(--line); background: #142133; border-radius: 12px; }
.growth-overview b { display: block; font-size: 28px; color: var(--teal); margin-bottom: 10px; }
.growth-overview small { font-size: 12px; color: var(--muted); font-weight: 400; }
.growth-overview span { font-size: 12px; color: var(--muted); }
.growth-track { display: grid; gap: 9px; }
.milestone { display: flex; align-items: center; gap: 16px; border: 1px solid var(--line); border-radius: 11px; padding: 18px; background: rgba(19,29,46,.6); }
.milestone.next { border-color: #65553c; background: rgba(245,194,107,.035); }
.milestone-mark { font-size: 18px; color: var(--muted); }
.milestone.unlocked .milestone-mark { color: var(--teal); }
.milestone > div:nth-child(2) { flex: 1; }
.milestone b { font-size: 13px; }
.milestone p { color: var(--muted); line-height: 1.7; font-size: 12px; margin: 6px 0 0; }
.milestone-threshold { flex-shrink: 0; text-align: right; }
.milestone-threshold b { color: var(--gold); }
.milestone-threshold small { display: block; font-size: 10px; color: var(--muted); margin-top: 6px; }
.catalog-card { display: flex; flex-direction: column; padding: 19px; border: 1px solid var(--line); border-radius: 13px; background: #152134; }
.catalog-heading { display: flex; gap: 13px; align-items: center; margin-bottom: 15px; }
.catalog-heading h3 { font-size: 16px; margin: 0 0 7px; }
.catalog-icon { display: grid; place-items: center; width: 48px; height: 48px; font-size: 27px; background: #1e3045; border-radius: 10px; }
.catalog-output { color: var(--teal); line-height: 1.8; font-size: 12px; margin: 0 0 5px; }
.catalog-input { font-size: 11px; color: var(--muted); margin: 0 0 18px; line-height: 1.7; }
.catalog-footer { display: flex; flex-direction: column; gap: 8px; font-size: 11px; color: var(--muted); margin-top: auto; padding-top: 12px; border-top: 1px solid var(--line); }
.catalog-footer b { font-size: 10px; color: var(--gold); font-weight: 400; }
.home-note, .home-footer { color: var(--muted); font-size: 11px; line-height: 1.7; margin: 20px 0; }
.home-footer { padding: 25px 0; text-align: center; border-top: 1px solid var(--line); margin-top: 40px; }
.plain-details { margin: 14px 0; font-size: 12px; }
.plain-details summary { color: var(--muted); cursor: pointer; padding: 5px 0; line-height: 1.6; }
.plain-details summary:hover { color: var(--gold); }
.plain-details p { color: var(--muted); line-height: 1.85; margin: 10px 0; }
.plain-details[open] > summary { margin-bottom: 10px; color: var(--gold); }
.setup-group legend { font-size: 13px; }
.setup-option { padding: 13px; }
.setup-option b { font-size: 13px; }
.setup-option span { font-size: 12px; }
.setup-option small { font-size: 11px; }
.setup-goal { margin-bottom: 22px; }
.setup-mini-stats { display: grid; grid-template-columns: repeat(3, 1fr); border: 1px solid var(--line); border-radius: 10px; margin-top: 20px; }
.setup-mini-stats > span { display: flex; flex-direction: column; gap: 8px; color: var(--muted); font-size: 11px; padding: 15px; }
.setup-mini-stats b { font-size: 18px; color: var(--ink); }
.setup-rewards { padding: 13px 15px; }
.setup-rewards span { font-size: 12px; }
.setup-actions { position: sticky; bottom: -20px; background: #142034; margin: 16px -20px -20px; padding: 14px 20px; border-top: 1px solid var(--line); z-index: 2; }
.loadout-presets { padding: 0; border: 0; background: none; }
.loadout-presets summary { color: var(--muted); font-weight: 400; }
.modal-head p, .setup-goal, .setup-summary, .setup-details, .setup-table, .growth-summary span, .growth-summary small { font-size: 12px; }
.modal-head h2 { font-size: 21px; }
.opening-tip { font-size: 12px; line-height: 1.7; padding: 12px; border-radius: 8px; background: rgba(245,194,107,.06); color: var(--gold); margin-bottom: 18px; }
.pick-card { padding: 20px 13px; gap: 10px; }
.pick-card h3 { font-size: 16px; }
.pick-card p { font-size: 12px; }
.pick-note { font-size: 11px !important; }
.pick-req, .pick-cost, .pick-btn { font-size: 11px; }
.pick-btn { padding: 6px 16px; }
.help-quick { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 20px 0; }
.help-quick > div { padding: 15px; border-radius: 10px; background: var(--card); }
.help-quick b, .help-quick span { display: block; font-size: 12px; }
.help-quick b { color: var(--gold); margin-bottom: 10px; }
.help-quick span { color: var(--muted); line-height: 1.7; }
.help-sections { margin-top: 25px; }
.help-sections details { padding: 10px 0; border-bottom: 1px solid var(--line); }

/* In-city hierarchy: balance first, calculations on demand. */
.stat:last-child { display: none; }
.stat .k { font-size: 10px; letter-spacing: 0; }
.stat .v { font-size: 17px; }
.stat-sub { font-size: 10px; }
.hud-brand p { letter-spacing: 0; font-size: 11px; }
.res-grid { gap: 9px; }
.res-card { padding: 12px; }
.res-name { font-size: 12px; }
.res-tag { font-size: 9px; }
.resource-balance { display: flex; align-items: baseline; gap: 8px; margin-top: 14px; color: var(--teal); }
.resource-balance span { font-size: 10px; color: var(--muted); }
.resource-balance b { font-size: 21px; font-variant-numeric: tabular-nums; }
.resource-forecast { color: var(--muted); font-size: 10px; margin-top: 8px; line-height: 1.6; }
.resource-forecast b { font-weight: 500; margin-left: 5px; }
.positive { color: var(--teal); }
.negative { color: var(--red); }
.resource-warning { font-size: 9px; display: block; color: var(--gold); line-height: 1.6; margin-top: 6px; }
.res-data { display: none; font-size: 10px; line-height: 1.8; color: var(--muted); margin-top: 12px; border-top: 1px solid var(--line); padding-top: 8px; }
.show-details .res-data { display: block; }
.satisfaction-summary { display: flex; gap: 8px; flex-wrap: wrap; justify-content: space-between; font-size: 12px; line-height: 1.7; }
.sat-math .plain-details { margin-bottom: 0; font-size: 10px; }
.goal-conditions { grid-template-columns: repeat(auto-fit,minmax(175px,1fr)); }
.goal-condition span { font-size: 12px; }
.goal-condition b { font-size: 15px; }
.goal-condition .goal-gap { font-size: 10px; }
.goal-rules { font-size: 11px; margin: 8px 0 0; }
.goal-state { font-size: 11px; }
.panel-head h2 { font-size: 14px; letter-spacing: 1px; }
.hint { font-size: 10px; }
.tc-top b { font-size: 13px; }
.tc-occ, .tc-reward { font-size: 11px; line-height: 1.8; }
.tc-foot .tc-sat { font-size: 11px; }
.tc-delta { font-size: 10px; }
.tc-deadline { font-size: 10px; }
.btn.small { min-height: 32px; font-size: 11px; padding: 6px 10px; }
.task-card { padding: 13px; gap: 7px; }
.build-grid { grid-template-columns: 1fr; }
.build-card { padding: 12px; gap: 10px; min-height: 70px; }
.bc-main b { font-size: 13px; }
.bc-main small { white-space: normal; font-size: 11px; line-height: 1.6; }
.bc-icon { font-size: 23px; }
.bc-cost { font-size: 12px; }
.bc-count { font-size: 10px; }
.bc-reason { position: static; background: none; font-size: 9px; max-width: 80px; text-align: right; line-height: 1.5; }
.town-main b { font-size: 13px; }
.town-main small, .town-note { font-size: 11px; line-height: 1.7; }
.cr-main b { font-size: 13px; }
.cr-main small { font-size: 11px; }
.step { min-width: 32px; min-height: 32px; font-size: 16px; }
.empty { font-size: 12px; }
.empty.small { font-size: 11px; }
.action-hint { font-size: 11px; }
.log-panel summary { font-size: 11px; color: var(--muted); cursor: pointer; }
.log-panel .panel-head .hint { display: none; }
.log-list { margin-top: 15px; }
.log-line { font-size: 11px; }
.city-nav { display: none; }
.tutorial-panel { display: flex; justify-content: space-between; align-items: center; gap: 22px; max-width: 1556px; margin: 14px 22px 0; padding: 20px; background: #172c35; border: 1px solid #527968; border-radius: 12px; scroll-margin-top: 90px; }
.tutorial-panel h2, .tutorial-callout h2 { font-size: 19px; margin: 9px 0; }
.tutorial-panel p, .tutorial-callout p { font-size: 13px; margin: 0; color: #b8cbd8; line-height: 1.8; }
.guide-actions { display: flex; gap: 16px; align-items: center; flex-shrink: 0; }
.tutorial-callout { padding: 18px; margin-bottom: 22px; border: 1px solid #4f7466; border-radius: 10px; background: rgba(87,224,192,.06); }
.tutorial-callout .guide-actions { margin-top: 12px; }
.is-tutorial .goal-rules, .is-tutorial .log-panel, .is-tutorial .city-nav { display: none; }
.is-tutorial[data-tutorial-step="build"] .build-panel, .is-tutorial[data-tutorial-step="upgrade"] .build-panel,
.is-tutorial[data-tutorial-step="accept"] .task-panel, .is-tutorial[data-tutorial-step="turn"] .task-panel { border-color: var(--gold); }
.is-tutorial .modal-view-actions { display: none; }
.is-tutorial .build-card:disabled { opacity: .35; cursor: default; }
.is-tutorial[data-tutorial-step="accept"] #boardList .task-card:not(.guide-target),
.is-tutorial[data-tutorial-step="turn"] #boardList,
.is-tutorial[data-tutorial-step="turn"] #taskFilter,
.is-tutorial[data-tutorial-step="build"] #townUpgrade,
.is-tutorial[data-tutorial-step="upgrade"] #buildList { display: none; }
.is-tutorial .guide-target { border-color: var(--gold); }
.bp-row { grid-template-columns: 70px minmax(0,1fr) minmax(0,1fr); font-size: 12px; line-height: 1.7; }
.bp-stats, .bp-next, .bp-net, .bp-reasons { font-size: 12px; line-height: 1.7; }
.bp-net span { font-size: 11px; }
.reward-card b { font-size: 19px; }
.reward-sub, .reward-common, .reward-btn { font-size: 12px; }
.reward-kicker { font-size: 10px; }
.reward-card:disabled { opacity: .5; cursor: default; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; animation: none !important; } }

/* ---------------- responsive ---------------- */
@media (max-width: 1240px) {
  .layout { grid-template-columns: 300px minmax(0, 1fr); }
  .col-right { grid-column: 1 / -1; display: grid; grid-template-columns: 1fr 1fr; align-items: start; }
  .task-panel { max-height: none; }
  .board-list { max-height: 480px; }
  .build-list { max-height: 420px; }
}
@media (max-width: 900px) {
  .loadout-grid { grid-template-columns: 1fr; }
  .loadout-advice > div { align-items: flex-start; flex-direction: column; }
  .growth-item { flex-direction: column; gap: 6px; }
  .growth-item small { text-align: left; }
  .setup-options { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .scenario-grid { grid-template-columns: 1fr; }
  .scenario-card { padding: 14px; }
  .goal-conditions { grid-template-columns: 1fr; }
  .goal-heading { align-items: flex-start; }
  .layout { grid-template-columns: 1fr; padding: 10px 10px 94px; }
  .col-right { grid-template-columns: 1fr; }
  .task-panel { max-height: none; }
  .board-list { max-height: none; }
  .build-list { max-height: none; }
  .city-list { max-height: 240px; }
  .hud { flex-direction: column; align-items: flex-start; gap: 7px; padding: 9px 13px; }
  .hud-stats { gap: 11px; }
  .pick-grid { grid-template-columns: 1fr; }
  .pick-grid.five { grid-template-columns: 1fr; }
  .end-grid { grid-template-columns: 1fr 1fr; }
  .action-bar { padding: 8px 10px; flex-wrap: wrap; }
  .action-hint { width: 100%; margin-left: 0; }
}
@media (max-width: 520px) {
  .res-grid { grid-template-columns: 1fr 1fr; }
  .build-grid { grid-template-columns: 1fr 1fr; }
  .hud-brand p { display: none; }
  .reward-grid { grid-template-columns: 1fr; }
  .show-modal { right: 12px; bottom: 76px; font-size: 10px; padding: 8px 10px; }
  .modal { padding: 12px; }
  .modal-card { padding: 16px 14px; }
}

@media (max-width: 900px) {
  .home-screen { padding: 0 20px; }
  .home-hero { gap: 20px; padding-top: 28px; grid-template-columns: 1.2fr 1fr; }
  .home-scenarios, .blueprint-catalog { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .home-nav { gap: 25px; }
  .home-nav button { font-size: 14px; }
  .layout { display: flex; flex-direction: column; padding-bottom: 140px; }
  .layout .col { display: contents; }
  .layout .panel { width: 100%; }
  .hud { position: relative; }
  .hud-stats { display: grid; grid-template-columns: repeat(4,1fr); width: 100%; gap: 11px; }
  .stat { min-width: 0; }
  .stat:nth-child(6) .k { white-space: nowrap; }
  .city-nav { display: flex; padding: 0 10px; background: #0e1828; border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 21; }
  .city-nav button { padding: 14px 0; flex: 1; background: none; color: var(--muted); font-size: 13px; border: 0; border-bottom: 2px solid transparent; cursor: pointer; }
  .city-nav button.on { color: var(--gold); border-bottom-color: var(--gold); }
  body[data-city-tab="resources"] .task-panel, body[data-city-tab="resources"] .build-panel, body[data-city-tab="resources"] .city-panel, body[data-city-tab="resources"] .log-panel,
  body[data-city-tab="tasks"] .res-panel, body[data-city-tab="tasks"] .build-panel, body[data-city-tab="tasks"] .city-panel, body[data-city-tab="tasks"] .log-panel,
  body[data-city-tab="build"] .res-panel, body[data-city-tab="build"] .task-panel, body[data-city-tab="build"] .city-panel, body[data-city-tab="build"] .log-panel,
  body[data-city-tab="city"] .res-panel, body[data-city-tab="city"] .build-panel, body[data-city-tab="city"] .task-panel { display: none; }
  .goal-conditions { grid-template-columns: repeat(2,minmax(0,1fr)); gap: 6px; }
  .goal-condition { flex-wrap: wrap; gap: 5px; padding: 9px; }
  .goal-condition > div { gap: 4px; }
  .goal-gap { margin-left: 0; }
  .goal-heading h2 { font-size: 12px; }
  .goal-state { font-size: 10px; }
  .build-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .build-card { flex-wrap: wrap; }
  .bc-main { flex: 1 1 70px; }
  .bc-right { flex-direction: row; justify-content: space-between; align-items: center; width: 100%; margin-left: 0; }
  .bc-reason { max-width: 100%; }
  .save-note { display: none; }
  .action-bar .btn { min-height: 40px; }
  .action-bar #btnNext { flex: 1; }
  .tutorial-panel { margin: 10px; padding: 15px; align-items: flex-start; gap: 10px; }
  .tutorial-panel { scroll-margin-top: 10px; }
  .tutorial-panel .guide-actions { flex-direction: column; }
}
@media (max-width: 600px) {
  .home-screen { padding: 0 16px; }
  .home-header { padding: 18px 0; }
  .home-header-actions { gap: 12px; }
  .home-header-actions .text-btn, .home-header-actions .btn { font-size: 11px; }
  .home-header { gap: 10px; }
  .home-brand .home-app-icon { display: none; }
  .home-brand .wordmark { width: clamp(145px, 44vw, 180px); height: auto; }
  .home-header-actions { gap: 8px; }
  .home-header-actions .btn { padding: 6px 8px; }
  .home-brand .brand-lockup > span { font-size: 10px; margin-top: 6px; }
  .hud-brand .wordmark { width: 174px; }
  .home-brand img { width: 42px; height: 42px; }
  .home-brand h1 { font-size: 17px; }
  .home-hero { grid-template-columns: 1fr; gap: 22px; padding: 28px 0 20px; }
  .home-welcome h2 { font-size: 26px; }
  .home-counts { margin-top: 18px; }
  .home-progress { padding: 19px; }
  .home-progress strong { font-size: 32px; }
  .home-progress p span { display: inline; margin-left: 12px; }
  .continue-card, .learn-card { padding: 16px; gap: 12px; flex-wrap: wrap; }
  .learn-card > div { flex: 1 1 70%; }
  .learn-card .btn { margin-left: 37px; }
  .home-nav { gap: 0; justify-content: space-between; margin: 25px 0; }
  .home-nav button { flex-direction: column; align-items: flex-start; gap: 8px; padding-bottom: 12px; font-size: 14px; }
  .home-scenarios, .blueprint-catalog { grid-template-columns: 1fr; }
  .home-scenario { padding: 18px; }
  .scenario-name { margin: 18px 0; }
  .section-heading { align-items: flex-start; flex-direction: column; gap: 4px; }
  .section-heading > span { font-size: 11px; }
  .growth-overview { grid-template-columns: repeat(2,1fr); }
  .growth-overview > div { padding: 16px; }
  .milestone { align-items: flex-start; gap: 10px; padding: 14px; flex-wrap: wrap; }
  .milestone > div:nth-child(2) { flex-basis: 75%; }
  .milestone-threshold { margin-left: 28px; text-align: left; display: flex; align-items: baseline; gap: 10px; }
  .setup-options.affixes { grid-template-columns: 1fr 1fr; }
  .setup-actions { bottom: -16px; margin: 16px -14px -16px; padding: 12px 14px; }
  .setup-mini-stats > span { padding: 12px 8px; font-size: 10px; }
  .setup-mini-stats b { font-size: 16px; }
  .setup-table { font-size: 10px; }
  .modal-card { max-height: 92dvh; }
  .pick-grid, .pick-grid.five { grid-template-columns: 1fr; }
  .pick-card { padding: 16px; display: grid; grid-template-columns: 42px 1fr auto; gap: 7px 12px; align-items: center; text-align: left; }
  .pick-icon { grid-row: 1 / 3; grid-column: 1; }
  .pick-card h3 { grid-column: 2; }
  .pick-card p { grid-column: 2 / 4; min-height: 0; }
  .pick-cost { grid-column: 3; grid-row: 1; }
  .pick-req { grid-column: 2; }
  .pick-btn { grid-column: 3; padding: 5px 10px; }
  .help-quick { gap: 6px; }
  .help-quick > div { padding: 12px 9px; }
  .help-quick b { font-size: 11px; }
  .help-quick span { font-size: 10px; }
  .tutorial-panel { flex-direction: column; }
  .tutorial-panel .guide-actions { flex-direction: row; }
  .tutorial-panel h2, .tutorial-callout h2 { font-size: 16px; }
  .tutorial-panel p, .tutorial-callout p { font-size: 12px; }
  .tutorial-callout { padding: 14px; margin-bottom: 18px; }
  .toast { max-width: calc(100vw - 24px); white-space: normal; width: max-content; border-radius: 10px; font-size: 12px; text-align: center; line-height: 1.6; }
}
