/* Region — HUD styles.
   Layout: a slim top bar, a dock along the bottom with a build flyout above it, one side
   sheet on the right, an inspector bottom-left and a minimap bottom-right. Everything floats
   over the map and nothing is modal. System fonts only (a Discord Activity may not load
   anything from another origin). */

:root {
  --bg: #0b1319;
  --panel: rgba(14, 24, 32, 0.9);
  --panel-2: rgba(255, 255, 255, 0.045);
  --line: rgba(255, 255, 255, 0.08);
  --line-strong: rgba(255, 255, 255, 0.16);
  --text: #e8eef2;
  --muted: #9db0b9;
  --dim: #6c8089;
  --accent: #5ee0b0;
  --accent-2: #59c2ff;
  --warn: #f0b45a;
  --bad: #ef6a5e;
  --good: #6fe08a;
  --r: #6fd08a;
  --c: #6fb8ff;
  --i: #f0c46a;
  --mega: #c9a2ff;
  --radius: 14px;
  --shadow: 0 10px 34px rgba(0, 0, 0, 0.42);
  --gap: 8px;
  --top-h: 54px;
  --dock-h: 62px;
  --sheet-w: 380px;
  font-synthesis: none;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 12px;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  user-select: none;
  -webkit-user-select: none;
}
button, input, select { font-family: inherit; }
button { cursor: pointer; color: inherit; }
.hidden { display: none !important; }
.ic { flex: 0 0 auto; display: block; }
kbd {
  font-family: inherit; font-size: 10px; font-weight: 700; color: var(--muted);
  background: rgba(255, 255, 255, 0.08); border: 1px solid var(--line-strong); border-radius: 5px; padding: 1px 5px;
}

#game { position: fixed; inset: 0; display: block; touch-action: none; cursor: crosshair; }
#game[data-tool="select"] { cursor: grab; }
#game[data-tool="select"]:active { cursor: grabbing; }

.glass {
  background: var(--panel);
  border: 1px solid var(--line);
  backdrop-filter: blur(14px) saturate(120%);
  -webkit-backdrop-filter: blur(14px) saturate(120%);
  box-shadow: var(--shadow);
}
.icon-btn {
  width: 28px; height: 28px; display: grid; place-items: center; flex: 0 0 auto;
  border-radius: 8px; background: transparent; border: 1px solid transparent; color: var(--muted);
}
.icon-btn:hover { background: rgba(255, 255, 255, 0.09); color: var(--text); }
.neg { color: var(--bad) !important; }
.pos { color: var(--good) !important; }
.dim { color: var(--dim); }

/* ------------------------------------------------------------------ top bar */
#topbar {
  position: fixed; top: var(--gap); left: var(--gap); right: var(--gap); height: var(--top-h);
  display: flex; align-items: center; gap: 10px; padding: 0 8px; border-radius: var(--radius); z-index: 30;
}
.tb-city { display: flex; align-items: center; gap: 9px; min-width: 0; flex: 0 1 auto; }
.logo {
  width: 36px; height: 36px; flex: 0 0 auto; display: grid; place-items: center; border: 0; border-radius: 11px;
  background: linear-gradient(145deg, var(--accent), #2fb893); color: #06120d;
}
.logo:hover { filter: brightness(1.08); }
.tb-name { min-width: 0; }
.city-name { font-size: 14px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 190px; cursor: text; }
.city-name:hover { color: var(--accent); }
.city-name .rename {
  width: 170px; font-size: 13px; font-weight: 700; color: var(--text); background: rgba(0, 0, 0, 0.35);
  border: 1px solid var(--accent); border-radius: 7px; padding: 2px 6px; outline: none;
}
.mayor { font-size: 10.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 190px; }

.tb-stats { display: flex; align-items: stretch; gap: 2px; flex: 1; justify-content: center; min-width: 0; overflow: hidden; }
.stat {
  display: flex; flex: 0 0 auto; flex-direction: column; justify-content: center; gap: 1px; min-width: 76px; padding: 4px 10px;
  border: 0; border-radius: 10px; background: transparent; text-align: left; color: var(--text);
}
button.stat:hover { background: rgba(255, 255, 255, 0.07); }
.stat label { font-size: 9px; text-transform: uppercase; letter-spacing: 0.9px; color: var(--dim); font-weight: 700; pointer-events: none; }
.stat b { font-size: 15px; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1.1; white-space: nowrap; }
.stat .sub { font-size: 10px; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.rci { display: flex; align-items: flex-end; gap: 3px; height: 17px; }
.rci i { position: relative; width: 9px; height: 100%; border-radius: 2px; background: rgba(255, 255, 255, 0.09); overflow: hidden; }
.rci em { position: absolute; left: 0; right: 0; bottom: 0; border-radius: 2px; transition: height 0.4s ease; }
.rci .r em { background: var(--r); } .rci .c em { background: var(--c); } .rci .i em { background: var(--i); }

.tb-speed { display: flex; flex: 0 0 auto; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.tb-speed button { width: 30px; height: 30px; display: grid; place-items: center; background: transparent; border: 0; color: var(--muted); }
.tb-speed button:hover { background: rgba(255, 255, 255, 0.08); color: var(--text); }
.tb-speed button.on { background: rgba(94, 224, 176, 0.16); color: var(--accent); }
.tb-speed.shared { opacity: 0.4; }

.tb-menu { display: flex; gap: 4px; flex: 0 0 auto; }
.tb-btn {
  position: relative; display: flex; align-items: center; gap: 6px; height: 34px; padding: 0 10px; border-radius: 10px;
  background: var(--panel-2); border: 1px solid var(--line); color: var(--text); font-size: 11.5px; font-weight: 600;
}
.tb-btn:hover { background: rgba(255, 255, 255, 0.1); border-color: var(--line-strong); }
.tb-btn.on { background: rgba(94, 224, 176, 0.14); border-color: rgba(94, 224, 176, 0.5); color: var(--accent); }
.tb-btn .badge {
  min-width: 16px; height: 16px; padding: 0 4px; border-radius: 8px; background: var(--accent-2); color: #06202c;
  font-size: 10px; font-weight: 800; display: grid; place-items: center;
}
.tb-btn.attention { border-color: var(--accent-2); animation: attn 1.6s ease-in-out infinite; }
@keyframes attn { 50% { background: rgba(89, 194, 255, 0.22); } }

/* ------------------------------------------------------------------ alerts, headline, toasts, tooltip */
#alerts {
  position: fixed; top: calc(var(--gap) * 2 + var(--top-h)); left: var(--gap); z-index: 25;
  display: flex; flex-direction: column; align-items: flex-start; gap: 6px; max-width: min(320px, 46vw);
}
.alert {
  display: flex; align-items: flex-start; gap: 7px; padding: 7px 11px 7px 9px; text-align: left;
  background: rgba(14, 24, 32, 0.92); border: 1px solid var(--line); border-left: 3px solid var(--warn);
  border-radius: 10px; color: var(--text); font-size: 11.5px; line-height: 1.35; box-shadow: var(--shadow);
}
.alert .ic { margin-top: 1px; color: var(--warn); }
.alert.bad { border-left-color: var(--bad); } .alert.bad .ic { color: var(--bad); }
.alert:hover { background: rgba(28, 40, 50, 0.96); }

#headline {
  position: fixed; top: calc(var(--gap) * 2 + var(--top-h)); left: 50%; transform: translateX(-50%); z-index: 24;
  display: flex; align-items: center; gap: 8px; max-width: min(540px, 50vw); padding: 7px 14px; border-radius: 999px;
  font-size: 12px; color: var(--text); animation: drop 0.35s ease;
}
#headline span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#headline.good .ic { color: var(--good); } #headline.bad .ic { color: var(--bad); } #headline.info .ic { color: var(--accent-2); }
@keyframes drop { from { opacity: 0; transform: translate(-50%, -8px); } }

.toasts {
  position: fixed; left: 50%; top: calc(var(--gap) * 3 + var(--top-h) + 36px); transform: translateX(-50%); z-index: 70;
  display: flex; flex-direction: column; gap: 6px; align-items: center; pointer-events: none; max-width: min(520px, 92vw);
}
.toast {
  background: rgba(10, 18, 24, 0.95); border: 1px solid var(--line-strong); border-radius: 12px; padding: 8px 14px;
  font-size: 12px; text-align: center; box-shadow: var(--shadow); animation: drop2 0.25s ease;
}
.toast.bad { border-color: rgba(239, 106, 94, 0.55); color: #ffd7d2; }
.toast.good { border-color: rgba(111, 224, 138, 0.5); color: #d4f8dd; }
@keyframes drop2 { from { opacity: 0; transform: translateY(-6px); } }

.tooltip {
  position: fixed; z-index: 60; pointer-events: none; max-width: 250px; opacity: 0; transition: opacity 0.1s;
  background: rgba(8, 15, 20, 0.95); border: 1px solid var(--line-strong); border-radius: 10px; padding: 8px 10px;
  font-size: 11.5px; line-height: 1.4; box-shadow: var(--shadow);
}
.tooltip.show { opacity: 1; }
.tooltip b { display: block; font-size: 12px; }
.tooltip span { display: block; color: var(--muted); font-size: 10.5px; }
.tooltip p { margin: 4px 0 0; color: var(--muted); }
.tooltip p.bad { color: var(--bad); }

/* ------------------------------------------------------------------ dock */
#dock {
  position: fixed; bottom: var(--gap); left: 50%; transform: translateX(-50%); z-index: 30;
  max-width: calc(100vw - var(--gap) * 2); height: var(--dock-h);
  display: flex; align-items: stretch; gap: 2px; padding: 5px 6px; border-radius: 16px;
  overflow-x: auto; overflow-y: hidden; scrollbar-width: none;
}
#dock::-webkit-scrollbar { display: none; }
.dk {
  position: relative; flex: 0 0 auto; min-width: 46px; padding: 4px 5px 3px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  background: transparent; border: 1px solid transparent; border-radius: 11px;
  color: var(--muted); font-size: 9.5px; font-weight: 600; white-space: nowrap;
}
.dk:hover { background: rgba(255, 255, 255, 0.07); color: var(--text); }
.dk.on { background: rgba(94, 224, 176, 0.15); border-color: rgba(94, 224, 176, 0.55); color: var(--accent); }
.dk.open { background: rgba(255, 255, 255, 0.11); border-color: var(--line-strong); color: var(--text); }
.dk kbd { position: absolute; top: 2px; right: 2px; font-size: 8px; padding: 0 3px; border: 0; background: transparent; color: var(--dim); }
.dk.zr { color: var(--r); } .dk.zc { color: var(--c); } .dk.zi { color: var(--i); }
.dk.zr.on { background: rgba(111, 208, 138, 0.18); border-color: var(--r); color: var(--r); }
.dk.zc.on { background: rgba(111, 184, 255, 0.18); border-color: var(--c); color: var(--c); }
.dk.zi.on { background: rgba(240, 196, 106, 0.18); border-color: var(--i); color: var(--i); }
.dk-mega { color: var(--mega); }
.dk-sep { flex: 0 0 1px; margin: 8px 3px; background: var(--line); }
.dens { display: flex; align-items: flex-end; gap: 2px; height: 20px; }
.dens i { width: 5px; border-radius: 1px; background: currentColor; opacity: 0.25; }
.dens i:nth-child(1) { height: 8px; } .dens i:nth-child(2) { height: 13px; } .dens i:nth-child(3) { height: 18px; }
.dk-density[data-level="1"] .dens i:nth-child(-n+1),
.dk-density[data-level="2"] .dens i:nth-child(-n+2),
.dk-density[data-level="3"] .dens i { opacity: 1; }

/* ------------------------------------------------------------------ build flyout */
#flyout {
  position: fixed; bottom: calc(var(--gap) * 2 + var(--dock-h)); left: 50%; transform: translateX(-50%); z-index: 29;
  width: min(1060px, calc(100vw - var(--gap) * 2)); max-height: min(54vh, 400px);
  display: flex; flex-direction: column; padding: 10px 12px 12px; border-radius: 16px;
}
/* with a sheet open the flyout takes the room that is left instead of sliding under it */
#sheet:not(.hidden) ~ #flyout {
  left: var(--gap); transform: none; width: calc(100vw - var(--sheet-w) - var(--gap) * 3);
}
.fly-head { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; min-height: 28px; }
.fly-head b { font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.9px; color: var(--accent); }
.fly-head .icon-btn { margin-left: auto; }
.link { background: none; border: 0; padding: 0; color: var(--accent-2); font-size: 11px; text-decoration: underline; }
.search { display: flex; align-items: center; gap: 6px; background: rgba(0, 0, 0, 0.3); border: 1px solid var(--line-strong); border-radius: 9px; padding: 5px 9px; color: var(--muted); }
.search input { width: 190px; background: transparent; border: 0; outline: 0; color: var(--text); font-size: 12px; }
.fly-body { overflow: auto; min-height: 0; scrollbar-width: thin; scrollbar-color: rgba(255, 255, 255, 0.16) transparent; }
.fly-section h5 { margin: 10px 0 6px; font-size: 10px; text-transform: uppercase; letter-spacing: 0.8px; color: var(--dim); }
.fly-section:first-child h5 { margin-top: 0; }
.fly-note { margin: 0 0 8px; font-size: 11px; color: var(--muted); line-height: 1.45; }
.cards { display: flex; flex-wrap: wrap; gap: 8px; }
.cards.row { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 4px; scrollbar-width: thin; scrollbar-color: rgba(255, 255, 255, 0.16) transparent; }
.card {
  position: relative; flex: 0 0 auto; width: 118px; padding: 8px 8px 7px; border-radius: 12px;
  display: flex; flex-direction: column; align-items: flex-start; gap: 2px; text-align: left;
  background: var(--panel-2); border: 1px solid var(--line); color: var(--text); transition: transform 0.1s, border-color 0.1s;
}
.card .thumb { align-self: center; margin-bottom: 3px; }
.card:hover { border-color: var(--line-strong); transform: translateY(-1px); background: rgba(255, 255, 255, 0.08); }
.card.on { border-color: var(--accent); background: rgba(94, 224, 176, 0.12); }
.card.locked { opacity: 0.55; }
.card.locked .thumb { filter: grayscale(0.9); }
.card-name { font-size: 11.5px; font-weight: 600; line-height: 1.2; }
.card-cost { font-size: 11px; color: var(--accent); font-variant-numeric: tabular-nums; }
.card-meta { font-size: 9.5px; color: var(--muted); line-height: 1.3; }
.card-flag {
  position: absolute; top: 6px; left: 6px; display: flex; align-items: center; gap: 3px; padding: 2px 6px;
  border-radius: 999px; background: rgba(0, 0, 0, 0.66); font-size: 9px; font-weight: 700;
}
.card-flag.lock, .card-flag.wip { color: var(--warn); } .card-flag.done { color: var(--good); }
.card-mega { width: 152px; border-color: rgba(201, 162, 255, 0.28); }
.card-mega .card-cost { color: var(--mega); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.chip { background: var(--panel-2); border: 1px solid var(--line); color: var(--muted); font-size: 11px; font-weight: 600; padding: 5px 11px; border-radius: 999px; }
.chip:hover { color: var(--text); border-color: var(--line-strong); }
.chip.on { background: rgba(89, 194, 255, 0.16); color: var(--accent-2); border-color: rgba(89, 194, 255, 0.5); }

/* ------------------------------------------------------------------ side sheet */
#sheet {
  position: fixed; top: calc(var(--gap) * 2 + var(--top-h)); right: var(--gap); bottom: calc(var(--gap) * 2 + var(--dock-h));
  width: var(--sheet-w); z-index: 28; display: flex; flex-direction: column; border-radius: var(--radius); overflow: hidden;
  animation: slide 0.18s ease;
}
@keyframes slide { from { opacity: 0; transform: translateX(14px); } }
.sheet-head { display: flex; align-items: center; justify-content: space-between; padding: 10px 10px 9px 14px; border-bottom: 1px solid var(--line); }
.sheet-title { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 700; min-width: 0; }
.sheet-title span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sheet-title .ic { color: var(--accent); }
.sheet-body {
  flex: 1; min-height: 0; overflow-y: auto; padding: 10px; display: flex; flex-direction: column; gap: 10px;
  scrollbar-width: thin; scrollbar-color: rgba(255, 255, 255, 0.16) transparent; user-select: text; -webkit-user-select: text;
}
.box { background: var(--panel-2); border: 1px solid var(--line); border-radius: 12px; padding: 11px 12px; }
.box.attention { border-color: rgba(89, 194, 255, 0.55); }
.box h4 {
  display: flex; justify-content: space-between; align-items: baseline; gap: 8px; margin: 0 0 8px;
  font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.9px; color: var(--muted);
}
.box h4 span { text-transform: none; letter-spacing: 0; font-weight: 500; color: var(--dim); }
.box h5 { margin: 12px 0 6px; font-size: 10px; text-transform: uppercase; letter-spacing: 0.8px; color: var(--dim); }
.box p { margin: 0 0 8px; font-size: 12px; line-height: 1.55; color: var(--muted); }
.box p:last-child { margin-bottom: 0; }
.box p b, .steps b { color: var(--text); }
.hint { font-size: 10.5px !important; color: var(--dim) !important; line-height: 1.45 !important; margin: 8px 0 0 !important; }
.kv { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; padding: 3.5px 0; font-size: 12px; }
.kv span { color: var(--muted); } .kv a { color: var(--accent-2); text-decoration: none; } .kv a:hover { text-decoration: underline; }
.kv b { font-weight: 600; font-variant-numeric: tabular-nums; text-align: right; }
.kv.good b { color: var(--good); } .kv.bad b { color: var(--bad); } .kv.warn b { color: var(--warn); } .kv.dim b { color: var(--dim); font-weight: 500; }
.kv.strong b { font-size: 13.5px; }
.meter { display: grid; grid-template-columns: 76px 1fr auto; align-items: center; gap: 8px; padding: 3.5px 0; font-size: 11.5px; }
.meter span { color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.meter b { min-width: 26px; text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; }
.bar { height: 6px; border-radius: 3px; background: rgba(255, 255, 255, 0.09); overflow: hidden; }
.bar i { display: block; height: 100%; border-radius: 3px; background: var(--accent); transition: width 0.4s ease; }
.bar.r i { background: var(--r); } .bar.c i { background: var(--c); } .bar.i i { background: var(--i); }
.bar.bad i { background: var(--bad); } .bar.warn i { background: var(--warn); }
.row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.btn {
  background: rgba(255, 255, 255, 0.07); border: 1px solid var(--line-strong); color: var(--text);
  border-radius: 9px; padding: 7px 11px; font-size: 11.5px; font-weight: 600; white-space: nowrap;
}
.btn:hover { background: rgba(255, 255, 255, 0.13); }
.btn.primary { background: linear-gradient(145deg, var(--accent), #3fc9a4); color: #06120d; border-color: transparent; }
.btn.primary:hover { filter: brightness(1.07); }
.btn.danger { background: rgba(239, 106, 94, 0.14); border-color: rgba(239, 106, 94, 0.42); color: #ffc9c3; }
.btn:disabled { opacity: 0.4; cursor: not-allowed; filter: none; }
.slider { display: grid; grid-template-columns: 64px 1fr 36px; align-items: center; gap: 10px; padding: 4px 0; font-size: 12px; }
.slider span { color: var(--muted); } .slider b { text-align: right; font-variant-numeric: tabular-nums; }
.slider input { width: 100%; accent-color: var(--accent); }
.news { display: flex; flex-direction: column; gap: 6px; }
.news-item { display: flex; flex-direction: column; gap: 2px; padding: 6px 9px; border-left: 2px solid var(--line-strong); font-size: 11.5px; line-height: 1.4; }
.news-item em { font-style: normal; font-size: 9.5px; color: var(--dim); }
.news-item.good { border-left-color: var(--good); } .news-item.bad { border-left-color: var(--bad); }
.tip {
  display: flex; align-items: flex-start; gap: 9px; width: 100%; margin-bottom: 6px; padding: 8px 10px; text-align: left;
  background: transparent; border: 1px solid var(--line); border-radius: 10px; color: var(--text); font-size: 12px; line-height: 1.4;
}
.tip:hover { background: rgba(255, 255, 255, 0.06); border-color: var(--line-strong); }
.tip i { flex: 0 0 8px; height: 8px; margin-top: 4px; border-radius: 50%; background: var(--accent-2); }
.tip.bad i { background: var(--bad); } .tip.warn i { background: var(--warn); } .tip.good i { background: var(--good); }
.steps { margin: 0; padding-left: 18px; font-size: 12px; line-height: 1.5; color: var(--muted); }
.steps li { margin: 4px 0; }
.keys { display: grid; grid-template-columns: auto 1fr; gap: 7px 12px; align-items: baseline; font-size: 11.5px; color: var(--muted); }
.keys kbd { justify-self: start; white-space: nowrap; }

/* region panel */
.region-map { display: grid; gap: 2px; margin-bottom: 6px; }
.plot { display: block; aspect-ratio: 1; border-radius: 3px; background: rgba(255, 255, 255, 0.05); cursor: pointer; position: relative; }
.region-map .plot:hover { outline: 1.5px solid #fff; z-index: 2; }
.plot.you { background: var(--accent); } .plot.human { background: #8f9bff; } .plot.ai { background: rgba(89, 194, 255, 0.36); }
.plot.linked { box-shadow: inset 0 0 0 1.5px var(--warn); }
.plot.sel { outline: 2px solid #fff; z-index: 3; }
.plot.has-mega::after { content: ""; position: absolute; inset: 30%; border-radius: 50%; background: var(--mega); }
.legend .plot { display: inline-block; width: 10px; height: 10px; margin: 0 3px 0 8px; vertical-align: -1px; cursor: default; }
.legend .plot:first-child { margin-left: 0; }
.deal { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 10px; margin-bottom: 6px; border: 1px solid var(--line); border-radius: 10px; font-size: 11.5px; }
.deal > div:first-child { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.deal em { font-style: normal; font-size: 10px; color: var(--accent-2); }
.deal span { color: var(--muted); font-size: 10.5px; }
.deal-btns { display: flex; gap: 6px; flex: 0 0 auto; }
.deal-form { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.deal-form select, .deal-form .btn { grid-column: 1 / -1; }
.deal-form label { display: flex; flex-direction: column; gap: 3px; font-size: 9.5px; text-transform: uppercase; letter-spacing: 0.6px; color: var(--dim); }
.deal-form select, .deal-form input {
  width: 100%; background: rgba(0, 0, 0, 0.3); border: 1px solid var(--line-strong); color: var(--text);
  border-radius: 8px; padding: 7px 8px; font-size: 12px; outline: none;
}
.deal-form select:focus, .deal-form input:focus { border-color: var(--accent); }
.deal-form option { background: #101a22; }
.project { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 8px; }
.mega-line { display: flex; align-items: center; gap: 9px; padding: 5px 0; }
.mega-line > div { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.mega-line b { font-size: 12px; } .mega-line span { font-size: 10.5px; color: var(--muted); }
.mega-line .meter { grid-template-columns: 0 1fr auto; gap: 0 8px; padding: 2px 0 0; }

/* megastructure panel */
.mega-card { background: var(--panel-2); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; }
.mega-card.locked { opacity: 0.72; } .mega-card.locked .thumb { filter: grayscale(0.85); }
.mega-card.wip { border-color: rgba(240, 180, 90, 0.5); }
.mega-card.built { border-color: rgba(111, 224, 138, 0.45); }
.mega-top { display: flex; gap: 12px; align-items: flex-start; }
.mega-top > div { min-width: 0; }
.mega-top b { display: block; font-size: 13.5px; }
.mega-cost { display: block; margin: 2px 0 5px; font-size: 10.5px; color: var(--mega); }
.mega-top p { margin: 0; font-size: 11.5px; line-height: 1.45; color: var(--muted); }
.mega-state { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 9px; font-size: 11.5px; color: var(--muted); }
.mega-state.done { color: var(--good); } .mega-state.lock { color: var(--warn); }
.mega-state .btn { margin-left: auto; } .mega-state .btn + .btn { margin-left: 0; }
.grow { flex: 1; }

/* ------------------------------------------------------------------ inspector */
#inspector {
  position: fixed; left: var(--gap); bottom: calc(var(--gap) * 2 + var(--dock-h)); width: 292px; z-index: 27;
  padding: 11px 12px 12px; border-radius: var(--radius); animation: rise 0.16s ease;
}
@keyframes rise { from { opacity: 0; transform: translateY(8px); } }
.insp-head { display: flex; align-items: center; gap: 10px; }
.insp-title { flex: 1; min-width: 0; }
.insp-title b { display: block; font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.insp-title span { display: block; font-size: 10.5px; color: var(--muted); }
.insp-note { margin: 8px 0 2px; font-size: 11px; line-height: 1.45; color: var(--muted); }
.insp-rows { margin-top: 6px; }
.insp-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.insp-actions .danger { margin-left: auto; }

/* ------------------------------------------------------------------ minimap */
#minimapBox {
  position: fixed; right: var(--gap); bottom: calc(var(--gap) * 2 + var(--dock-h)); width: 212px; height: 118px; z-index: 26;
  border-radius: var(--radius); overflow: hidden; transition: right 0.18s ease;
}
#sheet:not(.hidden) ~ #minimapBox { right: calc(var(--gap) * 2 + var(--sheet-w)); }
.mm-tilt { position: absolute; left: 50%; top: 50%; width: 136px; height: 136px; transform: translate(-50%, -50%) scaleY(0.5) rotate(45deg); }
#minimap { display: block; width: 100%; height: 100%; cursor: pointer; border-radius: 3px; image-rendering: pixelated; touch-action: none; }
.mm-toggle { position: absolute; top: 3px; right: 3px; z-index: 2; width: 26px; height: 26px; }
#minimapBox.collapsed { width: 34px; height: 34px; }
#minimapBox.collapsed .mm-tilt { display: none; }
#minimapBox.collapsed .mm-toggle { top: 3px; right: 3px; }

/* ------------------------------------------------------------------ start screen */
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.9px; color: var(--muted); margin-bottom: 6px; font-weight: 600; }
.field input {
  width: 100%; background: rgba(0, 0, 0, 0.3); border: 1px solid var(--line-strong);
  color: var(--text); border-radius: 9px; padding: 10px 12px; font-size: 13px; outline: none;
}
.field input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(94, 224, 176, 0.12); }
.hintline { font-size: 10.5px; color: var(--dim); margin-top: 5px; }
.error { background: rgba(239, 106, 94, 0.12); border: 1px solid rgba(239, 106, 94, 0.35); color: #ffc9c3; padding: 9px 12px; border-radius: 8px; font-size: 12px; margin-bottom: 12px; }
.start-screen { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; overflow: hidden; background: #081014; }
.start-screen.fade { animation: fadeOut 0.4s ease forwards; }
@keyframes fadeOut { to { opacity: 0; visibility: hidden; } }
.start-bg {
  position: absolute; inset: -20%;
  background:
    radial-gradient(circle at 20% 20%, rgba(94, 224, 176, 0.18), transparent 40%),
    radial-gradient(circle at 80% 70%, rgba(89, 194, 255, 0.14), transparent 45%),
    radial-gradient(circle at 50% 100%, rgba(240, 180, 90, 0.08), transparent 50%),
    #081014;
  animation: bgShift 18s ease-in-out infinite alternate;
}
@keyframes bgShift { to { transform: translate3d(2%, -2%, 0) scale(1.05); } }
.start-bg::after {
  content: ""; position: absolute; inset: 0;
  background-image: linear-gradient(rgba(255, 255, 255, 0.035) 1px, transparent 1px), linear-gradient(90deg, rgba(255, 255, 255, 0.035) 1px, transparent 1px);
  background-size: 46px 46px;
  mask-image: radial-gradient(circle at 50% 50%, black, transparent 75%);
  -webkit-mask-image: radial-gradient(circle at 50% 50%, black, transparent 75%);
}
.start-inner { position: relative; width: min(480px, calc(100vw - 32px)); text-align: center; }
.start-brand { font-size: 44px; font-weight: 800; letter-spacing: 10px; display: flex; align-items: center; justify-content: center; gap: 14px; }
.start-brand .glyph { color: var(--accent); font-size: 38px; text-shadow: 0 0 30px rgba(94, 224, 176, 0.5); }
.start-sub { color: var(--muted); font-size: 12.5px; margin: 8px 0 26px; letter-spacing: 0.3px; }
.start-card { border-radius: 18px; padding: 22px; text-align: left; background: rgba(13, 23, 30, 0.82); }
.mode-buttons { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
.mode-buttons button { padding: 11px; border-radius: 10px; font-size: 12.5px; font-weight: 600; background: rgba(255, 255, 255, 0.06); border: 1px solid var(--line-strong); color: var(--text); }
.mode-buttons button:hover { background: rgba(255, 255, 255, 0.12); }
.mode-buttons .primary { background: linear-gradient(145deg, var(--accent), #3fc9a4); color: #06120d; border: 0; font-weight: 700; }
.mode-buttons .primary:hover { filter: brightness(1.06); background: linear-gradient(145deg, var(--accent), #3fc9a4); }
.start-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 16px; }
.start-foot .ghost {
  background: rgba(255, 255, 255, 0.06); border: 1px solid var(--line-strong); color: var(--text);
  font-size: 11.5px; font-weight: 600; padding: 7px 12px; border-radius: 9px;
}
.start-foot .ghost:hover { background: rgba(255, 255, 255, 0.12); }
.tagline { font-size: 10px; color: var(--dim); line-height: 1.35; text-align: right; margin-left: auto; }
.start-notes { margin-top: 18px; font-size: 9.5px; color: var(--dim); }
.loading { position: fixed; inset: 0; z-index: 110; background: rgba(8, 16, 20, 0.92); display: grid; place-items: center; gap: 14px; align-content: center; }
.spinner { width: 34px; height: 34px; border-radius: 50%; border: 3px solid rgba(94, 224, 176, 0.18); border-top-color: var(--accent); animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
#loadingText { font-size: 12px; color: var(--muted); letter-spacing: 0.4px; }

/* ------------------------------------------------------------------ smaller screens */
@media (max-width: 1240px) {
  :root { --sheet-w: 340px; }
  .tb-btn .lbl { display: none; }
  .tb-btn { width: 36px; padding: 0; justify-content: center; }
  .tb-btn .badge { position: absolute; top: -4px; right: -4px; }
  .city-name, .mayor { max-width: 150px; }
}
@media (max-width: 980px) {
  .s-demand { display: none; }
  .stat { min-width: 0; padding: 4px 8px; }
  .dk kbd { display: none; }
  #minimapBox { display: none; }
}
@media (max-width: 760px) {
  :root { --top-h: 48px; }
  .tb-stats { justify-content: flex-start; }
  .s-date, .s-demand { display: none; }
  .alert:nth-child(n+2) { display: none; }
  #sheet:not(.hidden) ~ #flyout { left: 50%; transform: translateX(-50%); width: calc(100vw - var(--gap) * 2); }
  .s-approval, .mayor, .stat .sub { display: none; }
  .tb-speed button { width: 26px; }
  #sheet { left: var(--gap); width: auto; top: auto; height: 56vh; }
  #inspector { width: auto; right: var(--gap); }
  #headline { display: none; }
  .stat b { font-size: 13px; }
}
@media (max-width: 560px) {
  .tb-name { display: none; }
  #topbar { gap: 6px; padding: 0 6px; }
  .tb-menu { gap: 2px; } .tb-btn { width: 30px; height: 30px; }
  .tb-speed button:nth-child(n+3) { display: none; }
  .stat { min-width: 0; padding: 4px 6px; }
}
@media (max-width: 470px) {
  .tb-stats .stat:nth-child(n+2) { display: none; }
}
@media (max-height: 620px) {
  :root { --top-h: 46px; --dock-h: 54px; }
  #flyout { max-height: 60vh; }
  .dk { gap: 1px; }
  .stat .sub { display: none; }
}

/* keep the population figure in view on small windows by giving up some of the city name */
@media (max-width: 760px) { .city-name { max-width: 104px; } }
