/* src/styles.css — Act of God: dark, numbers-first prototype theme */

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

:root {
  --bg:         #0e0e12;
  --surface:    #16161e;
  --surface2:   #1e1e2a;
  --border:     #2e2e3e;
  --text:       #d0d0e0;
  --text-dim:   #7070a0;
  --text-muted: #404060;
  --accent-civ: #c0392b;   /* reddish — civStability */
  --accent-res: #2980b9;   /* bluish  — resilience */
  --accent-ep:  #f1c40f;   /* gold    — EP */
  --tag-dis:    #8b1a1a;
  --tag-dep:    #1a4a1a;
  --btn-bg:     #252535;
  --btn-hover:  #353550;
  --btn-active: #4040a0;
  --danger:     #e74c3c;
  --ok:         #27ae60;

  /* One font everywhere; Consolas/Cascadia read far cleaner than Courier New. */
  --font: ui-monospace, 'Cascadia Code', 'Cascadia Mono', Consolas, 'Courier New', monospace;
  /* One type scale — use these, not one-off px, so sizes stay consistent. */
  --fs-xs:  11px;   /* tiny labels / chips (floor — never smaller) */
  --fs-sm:  12.5px; /* secondary text */
  --fs-md:  14px;   /* base / body */
  --fs-lg:  16px;   /* emphasis / headings */
  --fs-xl:  20px;   /* modal titles */
  --fs-2xl: 27px;   /* screen titles */
}

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: var(--fs-md);
  line-height: 1.45;
}

#app {
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
}

/* ── app layout ──────────────────────────────────────────────────────── */

.app-root {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
}

.app-main {
  display: flex;
  flex: 1 1 auto;
  overflow: hidden;
}

/* Force theming: each force tints the chrome via --force, so a fire game feels
   like fire and an ocean game feels like ocean. */
.app-root.force-ocean      { --force: #3a93e6; --force-soft: rgba(58,147,230,0.13); }
.app-root.force-fire       { --force: #e0673a; --force-soft: rgba(224,103,58,0.13); }
.app-root.force-earth      { --force: #c08a45; --force-soft: rgba(192,138,69,0.13); }
.app-root.force-atmosphere { --force: #6fc7df; --force-soft: rgba(111,199,223,0.13); }
.app-root                  { background:
                              radial-gradient(120% 80% at 50% -10%, var(--force-soft, transparent), transparent 60%),
                              var(--bg); }
.app-root .top-bar         { border-bottom: 2px solid var(--force, var(--border)); }
.app-root .menu-btn:hover  { border-color: var(--force, var(--accent-ep)); }
.app-root .speed-btn.active { background: var(--force, var(--btn-active)); border-color: var(--force, #6060c0); color: #08121d; }

/* ── top bar ─────────────────────────────────────────────────────────── */

.top-bar {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 8px 14px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  flex-wrap: wrap;
}

/* meters: [label] [bar] [value] — short label, fixed bar, aligned across both */
.meter {
  display: flex;
  align-items: center;
  gap: 8px;
}

.meter-label {
  color: var(--text);
  font-size: var(--fs-sm);
  letter-spacing: .02em;
  white-space: nowrap;
  min-width: 76px;
  flex-shrink: 0;
}

.meter--civ .meter-label { color: #e98b80; }
.meter--res .meter-label { color: #7fb2dd; }

.meter-track {
  width: 150px;
  height: 12px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
  flex-shrink: 0;
}

.meter-fill {
  height: 100%;
  transition: width 0.15s ease;
}

.fill-civ { background: var(--accent-civ); }
.fill-res { background: var(--accent-res); }

.meter-num {
  color: var(--text);
  font-size: var(--fs-sm);
  width: 44px;
  text-align: right;
  flex-shrink: 0;
  font-variant-numeric: tabular-nums;
}

/* top stats */
.top-stats {
  display: flex;
  gap: 16px;
  align-items: center;
}

.stat-day, .stat-ep {
  font-size: var(--fs-md);
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.stat-ep { color: var(--accent-ep); font-weight: 700; }

/* speed controls */
.speed-controls {
  display: flex;
  gap: 4px;
  margin-left: auto;
}

.speed-btn {
  background: var(--btn-bg);
  border: 1px solid var(--border);
  color: var(--text-dim);
  padding: 4px 10px;
  cursor: pointer;
  font-family: inherit;
  font-size: var(--fs-sm);
  border-radius: 5px;
}

.speed-btn:hover {
  background: var(--btn-hover);
  color: var(--text);
}

.speed-btn.active {
  background: var(--btn-active);
  border-color: #6060c0;
  color: #fff;
}

/* ── dashboard (left column) ─────────────────────────────────────────── */

.dashboard {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  overflow: hidden;
}

/* ── region grid ─────────────────────────────────────────────────────── */

.region-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 8px;
  overflow-y: auto;
  flex: 1 1 auto;
  align-content: flex-start;
}

.region-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 8px;
  width: 170px;
  cursor: pointer;
  flex-shrink: 0;
}

.region-card:hover {
  border-color: #5050a0;
  background: var(--surface2);
}

.region-card--focused {
  border-color: #e0c040;
  outline: 2px solid #e0c040;
  outline-offset: 1px;
  background: var(--surface2);
}

.region-name {
  font-size: var(--fs-sm);
  font-weight: bold;
  color: var(--text);
  margin-bottom: 6px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* system bars */
.region-systems {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-bottom: 6px;
}

.sys-row {
  display: flex;
  align-items: center;
  gap: 4px;
}

.sys-label {
  color: var(--text-dim);
  font-size: var(--fs-xs);
  width: 30px;
  flex-shrink: 0;
}

.sys-track {
  flex: 1 1 auto;
  height: 6px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 1px;
  overflow: hidden;
}

.sys-fill {
  height: 100%;
  background: var(--ok);
  transition: width 0.15s ease;
}

/* Color system bar by health level using inline width tricks:
   done via JS-set width already; we add a gradient on the fill track instead */
.sys-track { position: relative; }
.sys-fill { background: linear-gradient(to left, #e74c3c 0%, #e67e22 30%, #27ae60 70%); background-size: 200% 100%; background-position: right center; }

.sys-num {
  color: var(--text-dim);
  font-size: var(--fs-xs);
  width: 20px;
  text-align: right;
  flex-shrink: 0;
}

/* disaster / deployment tags */
.region-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 2px;
}

.tag {
  font-size: var(--fs-xs);
  padding: 1px 4px;
  border-radius: 2px;
  white-space: nowrap;
}

.tag-disaster {
  background: var(--tag-dis);
  color: #ffa0a0;
  border: 1px solid #8b2a2a;
}

.tag-deploy {
  background: var(--tag-dep);
  color: #90d090;
  border: 1px solid #2a6a2a;
}

/* ── right panels column ─────────────────────────────────────────────── */

.panels {
  display: flex;
  flex-direction: column;
  gap: 0;
  width: 240px;
  flex-shrink: 0;
  border-left: 1px solid var(--border);
  overflow-y: auto;
  background: var(--surface);
}

.panel {
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
}

.panel-title {
  font-size: var(--fs-xs);
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 6px;
}

/* evolution tree */
.tree-branch {
  margin-bottom: 8px;
}

.branch-title {
  font-size: var(--fs-xs);
  color: var(--text-muted);
  text-transform: uppercase;
  margin-bottom: 4px;
}

.tree-node {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  background: var(--btn-bg);
  border: 1px solid var(--border);
  color: var(--text-dim);
  padding: 3px 6px;
  margin-bottom: 3px;
  cursor: pointer;
  font-family: inherit;
  font-size: var(--fs-xs);
  border-radius: 2px;
  text-align: left;
}

.tree-node.affordable {
  border-color: var(--accent-ep);
  color: var(--text);
  cursor: pointer;
}

.tree-node.affordable:hover {
  background: var(--btn-hover);
}

.tree-node.owned {
  border-color: #404080;
  color: #8080c0;
  cursor: default;
}

.tree-node.locked {
  opacity: 0.4;
  cursor: not-allowed;
}

.tree-node:disabled {
  cursor: not-allowed;
}

.node-label { flex: 1; }
.node-cost  { color: var(--accent-ep); font-size: var(--fs-xs); margin-left: 6px; }

/* abilities */
.ability-btn {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  background: var(--btn-bg);
  border: 1px solid var(--border);
  color: var(--text-dim);
  padding: 4px 8px;
  margin-bottom: 4px;
  cursor: pointer;
  font-family: inherit;
  font-size: var(--fs-xs);
  border-radius: 2px;
  text-align: left;
}

.ability-btn.ready {
  border-color: var(--ok);
  color: #80e080;
}

.ability-btn.ready:hover {
  background: var(--btn-hover);
}

.ability-btn.cooling {
  opacity: 0.5;
  cursor: not-allowed;
}

.ability-label { flex: 1; }

/* research */
.research-row {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-bottom: 4px;
}

.research-name {
  color: var(--text-dim);
  font-size: var(--fs-xs);
  width: 90px;
  flex-shrink: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.research-track {
  flex: 1 1 auto;
  height: 5px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 1px;
  overflow: hidden;
}

.research-fill {
  height: 100%;
  background: var(--accent-res);
  transition: width 0.15s ease;
}

.research-num {
  font-size: var(--fs-xs);
  color: var(--text-dim);
  width: 28px;
  text-align: right;
  flex-shrink: 0;
}

.research-row.unlocked .research-name { color: var(--ok); }
.research-row.unlocked .research-num  { color: var(--ok); }
.research-row.unlocked .research-fill { background: var(--ok); }

/* ── ticker / news strip ─────────────────────────────────────────────── */

.ticker {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 5px 10px;
  border-top: 1px solid var(--border);
  background: var(--surface);
  flex-shrink: 0;
  min-height: 48px;
  max-height: 80px;
  overflow: hidden;
}

.bubble-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  flex-shrink: 0;
  align-self: center;
}

.ep-bubble {
  background: #3a3000;
  border: 1px solid #a08000;
  color: var(--accent-ep);
  padding: 2px 7px;
  font-family: inherit;
  font-size: var(--fs-xs);
  cursor: pointer;
  border-radius: 3px;
}

.ep-bubble:hover {
  background: #504200;
}

.news-feed {
  flex: 1 1 auto;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.news-item {
  display: flex;
  gap: 6px;
  font-size: var(--fs-xs);
}

.news-tick {
  color: var(--text-muted);
  flex-shrink: 0;
}

.news-text {
  color: var(--text-dim);
}

/* ── new-game chooser ────────────────────────────────────────────────── */

.chooser {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  gap: 16px;
  background: var(--bg);
}

.chooser h1 {
  font-size: var(--fs-2xl);
  letter-spacing: 0.2em;
  color: var(--text);
}

.chooser label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: var(--fs-md);
  color: var(--text-dim);
}

.choose-force,
.choose-region {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 4px 8px;
  font-family: inherit;
  font-size: var(--fs-md);
  border-radius: 2px;
}

.choose-force:focus,
.choose-region:focus {
  outline: 1px solid #5050a0;
}

.chooser-hint {
  max-width: 460px;
  text-align: center;
  font-size: var(--fs-sm);
  line-height: 1.5;
  color: var(--text-muted);
  margin: 0;
}

.start-btn {
  background: var(--btn-active);
  border: 1px solid #6060c0;
  color: #fff;
  padding: 8px 28px;
  font-family: inherit;
  font-size: var(--fs-md);
  letter-spacing: 0.05em;
  cursor: pointer;
  border-radius: 3px;
  margin-top: 8px;
}

.start-btn:hover {
  background: #5050b0;
}

/* ── main menu (guided new-game: ① Force → ② Origin) ────────────────── */
.mainmenu        { min-height: 100vh; display: flex; flex-direction: column; align-items: center;
                   gap: 10px; padding: 22px 16px 44px; background: var(--bg); overflow-y: auto; }
.mainmenu-title  { font-size: var(--fs-2xl); letter-spacing: .24em; margin: 4px 0 0; color: var(--text); }
.mainmenu-sub    { color: var(--text-muted); font-size: var(--fs-md); margin: 0; text-align: center; }
.menu-tabs       { display: flex; gap: 8px; margin-top: 8px; }
.menu-tab        { background: var(--surface); border: 1px solid var(--border); color: var(--text-dim);
                   border-radius: 999px; padding: 7px 22px; font: inherit; font-size: var(--fs-md); cursor: pointer; }
.menu-tab:hover  { border-color: var(--accent-ep); }
.menu-tab.active { background: var(--btn-active); border-color: #6060c0; color: #fff; }
.menu-panel      { width: min(940px, 97vw); background: var(--surface); border: 1px solid var(--border);
                   border-radius: 12px; padding: 16px; }
.force-picker    { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.force-opt       { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 14px 6px;
                   background: var(--surface2); border: 1px solid var(--border); border-radius: 10px;
                   color: var(--text); font: inherit; cursor: pointer; transition: border-color .12s ease; }
.force-opt:hover { border-color: var(--accent-ep); }
.force-opt.selected { border-color: #e8c84b; box-shadow: inset 0 0 0 1px #e8c84b; }
.force-opt-icon  { font-size: 26px; line-height: 1; }
.force-opt-name  { font-size: var(--fs-md); letter-spacing: .04em; }
.force-blurb     { color: var(--text-dim); font-size: var(--fs-md); line-height: 1.55; margin: 14px 4px; text-align: center; }
.force-tree-preview { border: 1px solid var(--border); border-radius: 10px; padding: 12px; background: #0e141d; }
.preview-h       { margin: 0 0 10px; font-size: var(--fs-xs); letter-spacing: 1px; text-transform: uppercase; color: var(--text-muted); }
.menu-footer     { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 14px; }
.menu-footer-spacer { flex: 1; }
.origin-head     { text-align: center; color: var(--text-dim); font-size: var(--fs-md); margin: 0 0 10px; }
.origin-pick     { flex: 1; text-align: center; font-size: var(--fs-sm); color: var(--text-dim); }
.origin-pick--good { color: #6fd08c; font-weight: 600; }
@media (max-width: 680px) { .force-picker { grid-template-columns: repeat(2, 1fr); } }

/* ── end overlay ─────────────────────────────────────────────────────── */

.end-overlay {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
}

.end-won  { background: rgba(60, 0, 0, 0.85); }
.end-lost { background: rgba(0, 20, 60, 0.85); }

.end-card {
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: 6px;
  padding: 32px 48px;
  text-align: center;
  max-width: 480px;
}

.end-won  .end-card { border-color: var(--danger); }
.end-lost .end-card { border-color: var(--accent-res); }

.end-card h1 {
  font-size: var(--fs-xl);
  letter-spacing: 0.1em;
  margin-bottom: 12px;
}

.end-won  .end-card h1 { color: var(--danger); }
.end-lost .end-card h1 { color: var(--accent-res); }

.end-card p {
  color: var(--text-dim);
  font-size: var(--fs-md);
}

.end-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px 22px;
  margin: 18px 0 22px;
  text-align: left;
}
.end-stat   { display: flex; justify-content: space-between; gap: 12px;
              border-bottom: 1px solid var(--border); padding-bottom: 4px; }
.end-stat-k { color: var(--text-dim); font-size: var(--fs-sm); }
.end-stat-v { color: var(--text); font-size: var(--fs-sm); font-weight: 700; font-variant-numeric: tabular-nums; }

/* ── juice: floating tap feedback + event flash ──────────────────────── */
.fx-float        { position: fixed; transform: translate(-50%, -50%); pointer-events: none; z-index: 200;
                   font-weight: 700; font-size: var(--fs-lg); text-shadow: 0 1px 4px #000, 0 0 8px #000;
                   animation: fx-rise .9s ease-out forwards; }
.fx-ep           { color: var(--accent-ep); }
.fx-suppress     { color: #5aa9e6; font-size: var(--fs-md); }
@keyframes fx-rise {
  0%   { opacity: 0; transform: translate(-50%, -40%) scale(.8); }
  18%  { opacity: 1; }
  100% { opacity: 0; transform: translate(-50%, -165%) scale(1.12); }
}
.fx-flash        { position: fixed; inset: 0; pointer-events: none; z-index: 150;
                   background: radial-gradient(120% 100% at 50% 50%, rgba(255,255,255,.18), transparent 55%);
                   animation: fx-flash .5s ease-out forwards; }
@keyframes fx-flash { 0% { opacity: 0; } 30% { opacity: 1; } 100% { opacity: 0; } }

/* ── scrollbar styling (webkit) ──────────────────────────────────────── */

::-webkit-scrollbar               { width: 6px; height: 6px; }
::-webkit-scrollbar-track         { background: var(--bg); }
::-webkit-scrollbar-thumb         { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover   { background: #4040a0; }

/* ── world map ───────────────────────────────────────────────────────── */
.map-wrap        { position: relative; width: 100%; padding: 6px; }
.world-svg       { width: 100%; height: auto; max-height: 62vh; display: block;
                   border: 1px solid var(--border); border-radius: 8px; background: #081523;
                   box-shadow: 0 0 0 1px rgba(0,0,0,.4), 0 0 46px var(--force-soft, transparent); }
.map-wrap::after { content: ''; position: absolute; inset: 6px; border-radius: 8px; pointer-events: none;
                   box-shadow: inset 0 0 90px rgba(0,0,0,.6); }
.region-disc     { cursor: pointer; transition: filter .12s ease; }
.region-disc:hover { filter: brightness(1.25) drop-shadow(0 0 4px rgba(255,255,255,.4)); }
.spread-blob     { filter: blur(5px); pointer-events: none; transition: fill-opacity .4s ease; }
.region-label    { paint-order: stroke; stroke: #0a1018; stroke-width: 1.6px; stroke-linejoin: round;
                   fill: #eef4ff; font-weight: 600; font-family: var(--font); pointer-events: auto; }
.region-label-bg { stroke: rgba(255,255,255,.06); stroke-width: .5px; }
.disaster-icon   { transform-box: fill-box; transform-origin: center; animation: aog-pulse 1.6s ease-in-out infinite; }
@keyframes aog-pulse { 0%,100% { opacity: .7; transform: scale(1); } 50% { opacity: 1; transform: scale(1.18); } }
.region-flash    { animation: aog-flash .9s ease-out; }
@keyframes aog-flash { 0% { stroke: #fff; stroke-width: 6; } 100% { stroke: #0a1626; stroke-width: 2.5; } }
.map-bubble      { animation: aog-pulse 1.2s ease-in-out infinite; transform-box: fill-box; transform-origin: center; cursor: pointer; }
.disaster-ring   { animation: aog-ring 1.8s ease-in-out infinite; pointer-events: none; }
@keyframes aog-ring { 0%,100% { opacity: .5; } 50% { opacity: 1; } }
.aog-icon        { display: block; }

/* ── map legend (collapsible, anchored inside the map corner) ────────── */
.map-legend-wrap { position: absolute; right: 12px; bottom: 12px; z-index: 6;
                   display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.legend-toggle   { background: rgba(14,20,29,.92); border: 1px solid var(--border); color: var(--text);
                   border-radius: 6px; padding: 5px 11px; font: inherit; font-size: var(--fs-xs); cursor: pointer; }
.legend-toggle:hover { border-color: var(--accent-ep); }
.map-legend      { display: none; flex-direction: column; gap: 7px;
                   background: rgba(10,16,24,.96); border: 1px solid var(--border);
                   border-radius: 8px; padding: 11px 13px; box-shadow: 0 8px 30px rgba(0,0,0,.5); }
.map-legend-wrap.open .map-legend { display: flex; }
.leg-item        { display: flex; align-items: center; gap: 8px; font-size: var(--fs-xs); color: #c2cde0; }
.leg-sym         { font-size: var(--fs-md); line-height: 1; width: 18px; text-align: center; }
.leg-text        { white-space: nowrap; }
.leg-swatch      { width: 13px; height: 13px; border-radius: 50%; flex: 0 0 auto;
                   border: 1px solid rgba(255,255,255,.18); }
.leg-swatch--soft  { filter: blur(.4px); opacity: .8; }
.leg-swatch--health{ background: conic-gradient(#3fa34d 0 33%, #e0a93a 0 66%, #c0392b 0 100%); }

/* ── Plague-style scrolling news bar (top) ───────────────────────────── */
.news-bar        { display: flex; align-items: center; gap: 10px; background: #11151c;
                   border-bottom: 1px solid var(--border); padding: 4px 10px; overflow: hidden; }
.news-badge      { flex: 0 0 auto; color: #e0533a; font-weight: 700; font-size: var(--fs-xs); letter-spacing: 1px; }
.news-track      { flex: 1; overflow: hidden; white-space: nowrap; }
.news-scroll     { display: inline-block; white-space: nowrap; padding-left: 100%;
                   font-size: var(--fs-sm); color: #c9d4e6; animation: news-marquee 38s linear infinite; }
@keyframes news-marquee { from { transform: translateX(0); } to { transform: translateX(-100%); } }

/* ── top-bar menu buttons + active-ability strip ─────────────────────── */
.menu-btns       { display: flex; gap: 6px; }
.menu-btn        { background: var(--btn-bg); border: 1px solid var(--border); color: var(--text);
                   border-radius: 6px; padding: 4px 10px; font: inherit; font-size: var(--fs-sm); cursor: pointer; }
.menu-btn:hover  { background: var(--btn-hover); border-color: var(--accent-ep); }
.menu-btn--restart { color: #e8b0a0; }
.menu-btn--restart:hover { border-color: var(--danger); color: #fff; }
.ability-strip   { display: flex; gap: 6px; flex-wrap: wrap; padding: 4px 8px; }
.ability-strip:empty { display: none; }
.ability-btn     { background: rgba(232,176,75,0.16); border: 1px solid #8a6d2a; color: #f1d99a;
                   border-radius: 6px; padding: 4px 9px; font: inherit; font-size: var(--fs-sm); cursor: pointer; }
.ability-btn.ready:hover { background: rgba(232,176,75,0.34); }
.ability-btn.cooling, .ability-btn:disabled { opacity: 0.5; cursor: default; }

/* ── modal overlay ───────────────────────────────────────────────────── */
.modal-overlay   { position: fixed; inset: 0; background: rgba(4,7,12,0.74); z-index: 50;
                   display: flex; align-items: center; justify-content: center; padding: 24px; }
.modal-window    { background: var(--surface); border: 1px solid var(--accent-ep); border-radius: 10px;
                   width: min(880px, 96vw); max-height: 88vh; display: flex; flex-direction: column;
                   box-shadow: 0 14px 60px rgba(0,0,0,0.6); }
.modal-head      { display: flex; align-items: center; justify-content: space-between;
                   padding: 10px 14px; border-bottom: 1px solid var(--border); }
.modal-title     { color: var(--accent-ep); font-size: var(--fs-lg); letter-spacing: 1px; }
.modal-close     { background: none; border: 1px solid var(--border); color: var(--text-dim);
                   border-radius: 6px; width: 28px; height: 28px; cursor: pointer; font-size: var(--fs-md); }
.modal-close:hover { color: #fff; border-color: var(--danger); }
.modal-body      { padding: 14px; overflow: auto; }

/* ── major-event popup (pauses the game; acknowledge to resume) ──────── */
.event-overlay   { z-index: 80; background: rgba(4,7,12,0.86); }
.event-window    { width: min(460px, 94vw); border-color: #e8b04b; text-align: center;
                   padding: 22px 24px 24px; gap: 14px;
                   box-shadow: 0 0 0 1px rgba(232,176,75,.25), 0 18px 70px rgba(0,0,0,.7);
                   animation: aog-event-in .28s ease-out; }
@keyframes aog-event-in { from { transform: scale(.92); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.event-title     { font-size: var(--fs-xl); color: #f2d28a; letter-spacing: .5px; margin: 0 0 10px; }
.event-body      { font-size: var(--fs-md); line-height: 1.5; color: #d7deea; margin: 0 0 18px; }
.event-ack       { background: #e8b04b; border: none; color: #221703; font-weight: 700;
                   border-radius: 7px; padding: 9px 22px; font: inherit; font-size: var(--fs-md); cursor: pointer; }
.event-ack:hover { background: #f3c463; }

/* ── skill tree (Evolve modal) ───────────────────────────────────────── */
.evolve-ep       { color: var(--accent-ep); font-weight: 700; margin-bottom: 12px; }
.skilltree       { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.skill-col       { display: flex; flex-direction: column; align-items: stretch; gap: 0; }
.skill-branch    { text-transform: uppercase; letter-spacing: 1px; font-size: var(--fs-xs); text-align: center;
                   margin-bottom: 8px; padding-bottom: 4px; border-bottom: 1px solid var(--border); }
.skill-branch--spread   { color: #7fb0e8; }
.skill-branch--severity { color: #e8a06b; }
.skill-branch--ability  { color: #e8c84b; }
.skill-node      { position: relative; background: var(--surface2); border: 1px solid var(--border);
                   border-radius: 8px; padding: 9px 10px; margin: 0 0 18px; cursor: pointer; text-align: left;
                   display: flex; flex-direction: column; gap: 3px; color: var(--text); font: inherit; }
.skill-node:not(:last-child)::after { content: ''; position: absolute; left: 50%; bottom: -18px;
                   width: 2px; height: 18px; background: var(--border); }
.skill-head      { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.skill-name      { font-size: var(--fs-sm); font-weight: 600; }
.skill-cost      { font-size: var(--fs-xs); color: var(--text-dim); white-space: nowrap; }
.skill-desc      { font-size: var(--fs-xs); color: var(--text-dim); line-height: 1.35; }
.skill-active-badge { font-size: var(--fs-xs); color: #e8c84b; border: 1px solid #8a6d2a; border-radius: 4px;
                   padding: 0 5px; margin-left: 6px; letter-spacing: .06em; }
.skill-node.affordable .skill-desc, .skill-node.owned .skill-desc { color: #aab4c8; }
.skill-node.owned     { border-color: #5a8f5a; background: rgba(90,143,90,0.16); }
.skill-node.owned .skill-cost { color: #7fd18a; }
.skill-node.affordable{ border-color: var(--accent-ep); box-shadow: 0 0 0 1px rgba(241,196,15,0.4) inset; }
.skill-node.locked    { opacity: 0.5; cursor: default; }
.skill-node:disabled  { cursor: default; }

/* ── modal tabs (used by the World modal: World / Timeline) ──────────── */
.modal-tabs      { display: flex; gap: 6px; margin-bottom: 14px; border-bottom: 1px solid var(--border); }
.modal-tab       { background: none; border: none; border-bottom: 2px solid transparent; color: var(--text-dim);
                   padding: 6px 12px 8px; font: inherit; font-size: var(--fs-sm); cursor: pointer; }
.modal-tab:hover { color: var(--text); }
.modal-tab.active { color: var(--accent-ep); border-bottom-color: var(--accent-ep); }

/* ── timeline (World modal → Timeline tab) ───────────────────────────── */
.timeline        { display: flex; flex-direction: column; }
.timeline-empty  { color: var(--text-dim); font-size: var(--fs-sm); padding: 8px 2px; }
.timeline-row    { display: flex; gap: 10px; padding: 6px 4px; border-bottom: 1px solid rgba(255,255,255,.05);
                   font-size: var(--fs-sm); }
.timeline-row:hover { background: var(--surface2); }
.timeline-day    { flex: 0 0 64px; color: var(--text-dim); font-variant-numeric: tabular-nums; }
.timeline-text   { color: var(--text); }

/* ── how-to-play (help modal) ────────────────────────────────────────── */
.help-modal      { max-width: 560px; }
.help-intro      { font-size: var(--fs-md); line-height: 1.5; color: var(--accent-ep); font-weight: 700; margin-bottom: 16px; }
.help-row        { display: flex; gap: 12px; align-items: flex-start; margin-bottom: 14px; }
.help-icon       { flex: 0 0 38px; width: 38px; height: 38px; display: flex; align-items: center; justify-content: center;
                   background: var(--surface2); border: 1px solid var(--border); border-radius: 9px; }
.help-row-h      { font-size: var(--fs-md); font-weight: 700; color: var(--text); }
.help-row-d      { font-size: var(--fs-sm); line-height: 1.5; color: var(--text-dim); margin-top: 2px; }
.help-swatch     { width: 22px; height: 22px; border-radius: 50%; display: block; }
.help-swatch--reach { background: radial-gradient(circle, #e0673a 0%, rgba(224,103,58,.15) 75%); }
.help-goal       { margin-top: 18px; border-top: 1px solid var(--border); padding-top: 14px; }
.help-goal-row   { display: flex; align-items: center; gap: 10px; margin-top: 8px; }
.help-goal-label { flex: 0 0 78px; font-size: var(--fs-sm); color: var(--text-dim); }
.help-goal-track { flex: 1; height: 10px; background: var(--surface2); border: 1px solid var(--border); border-radius: 6px; overflow: hidden; }
.help-goal-fill  { height: 100%; }
.help-goal-fill.goal-civ { background: var(--accent-civ); }
.help-goal-fill.goal-res { background: var(--accent-res); }
.help-goal-note  { flex: 0 0 auto; font-size: var(--fs-xs); color: var(--text-dim); }

/* ── world modal (research + regions) ────────────────────────────────── */
.world-modal     { display: grid; grid-template-columns: 1fr 1.4fr; gap: 18px; }
.world-h         { font-size: var(--fs-sm); letter-spacing: 1px; color: var(--text-dim); margin-bottom: 8px; text-transform: uppercase; }
.research-row    { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; font-size: var(--fs-sm); }
.research-name   { flex: 0 0 130px; }
.research-track  { flex: 1; height: 6px; background: rgba(255,255,255,0.08); border-radius: 4px; overflow: hidden; }
.research-fill   { height: 100%; background: #4b9be0; }
.research-num    { flex: 0 0 64px; text-align: right; color: var(--text-dim); }
.research-row.unlocked .research-num { color: var(--danger); }
.country-row     { padding: 7px 8px; border: 1px solid var(--border); border-radius: 7px; margin-bottom: 6px;
                   cursor: pointer; }
.country-row:hover { border-color: var(--accent-ep); background: var(--surface2); }
.country-head    { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.country-name    { font-size: var(--fs-sm); font-weight: 600; }
.country-terrain { display: flex; gap: 4px; flex-wrap: wrap; }
.terr-tag        { font-size: var(--fs-xs); padding: 1px 6px; border-radius: 10px; color: var(--text-dim);
                   background: rgba(255,255,255,.05); border: 1px solid var(--border); }
.terr-tag--fav   { color: #0d1a10; background: #6fd08c; border-color: #6fd08c; font-weight: 700; }
.country-sys     { display: grid; grid-template-columns: repeat(5, 1fr); gap: 5px; margin-top: 5px; }
.csys            { display: flex; flex-direction: column; gap: 2px; }
.csys-label      { font-size: var(--fs-xs); text-transform: uppercase; color: var(--text-muted); }
.csys-track      { height: 5px; background: rgba(255,255,255,0.08); border-radius: 3px; overflow: hidden; }
.csys-fill       { height: 100%; }
.csys-num        { font-size: var(--fs-xs); color: var(--text-dim); text-align: right; }
@media (max-width: 700px) { .skilltree { grid-template-columns: 1fr; } .world-modal { grid-template-columns: 1fr; } }

.map-focus-card  { position: absolute; left: 16px; bottom: 16px; width: 178px;
                   max-height: 60%; overflow: hidden;
                   background: rgba(10,14,22,.93); border: 1px solid var(--accent-ep);
                   border-radius: 7px; padding: 8px 10px; font-size: var(--fs-xs); }
.focus-name      { font-weight: 700; color: var(--accent-ep); margin-bottom: 5px; }
.focus-sys-row   { display: flex; align-items: center; gap: 5px; margin-bottom: 2px; }
.focus-sys-label { width: 30px; color: var(--text-dim); text-transform: uppercase; font-size: var(--fs-xs); }
.focus-sys-track { flex: 1; height: 5px; background: rgba(255,255,255,.08); border-radius: 3px; overflow: hidden; }
.focus-sys-fill  { height: 100%; background: #4b9be0; border-radius: 3px; }
.focus-tags      { display: flex; flex-wrap: wrap; gap: 3px; margin-top: 6px; }
.focus-tag       { font-size: var(--fs-xs); padding: 1px 5px; border-radius: 4px; }
.focus-tag--dis  { background: var(--tag-dis); }
.focus-tag--cm   { background: var(--tag-dep); }
.focus-tag--more { background: rgba(255,255,255,.08); color: var(--text-dim); }
