:root {
  color-scheme: dark;
  --ink: #171a25;
  --ink-soft: #252a3a;
  --sky-top: #6f7896;
  --sky-mid: #a47f91;
  --sky-low: #e2a687;
  --cream: #fff0ba;
  --accent: #b9efd2;
  --accent-strong: #73d6b2;
  --danger: #ff8c88;
  --road-height: 34px;
  --horizon: 59%;
  --column-width: 72px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

html, body { width: 100%; height: 100%; margin: 0; overflow: hidden; }

button, input { font: inherit; }
button { color: inherit; }

body {
  background: #12151f;
  color: #f8f3e6;
  user-select: none;
  -webkit-user-select: none;
  overscroll-behavior: none;
}

#game {
  width: 100%;
  height: 100dvh;
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  background: #12151f;
}

#worldViewport {
  position: relative;
  min-height: 0;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;
  touch-action: pan-x;
  cursor: grab;
  outline: none;
  background: linear-gradient(var(--sky-top), var(--sky-mid) 60%, var(--sky-low));
}

#worldViewport::-webkit-scrollbar { display: none; }
#worldViewport.dragging { cursor: grabbing; }

#world {
  position: relative;
  height: 100%;
  min-height: 410px;
  isolation: isolate;
  overflow: hidden;
  background:
    radial-gradient(circle at 64% 32%, rgba(255, 218, 174, .2), transparent 26%),
    linear-gradient(180deg, var(--sky-top), var(--sky-mid) 52%, var(--sky-low) 100%);
}

.sky-wash {
  position: absolute;
  inset: 0 0 auto;
  height: var(--horizon);
  background:
    linear-gradient(90deg, transparent 8%, rgba(255,255,255,.055) 35%, transparent 58%),
    linear-gradient(180deg, rgba(16,20,35,.05), transparent 50%, rgba(255,193,150,.14));
  pointer-events: none;
}

.sun {
  position: absolute;
  width: 88px;
  aspect-ratio: 1;
  top: 14%;
  left: 51%;
  border-radius: 50%;
  background: rgba(255, 227, 181, .58);
  box-shadow: 0 0 50px rgba(255, 213, 164, .23);
  pointer-events: none;
}

.cloud-layer, .plane-layer, .building-layer, .pedestrian-layer,
.surface-hit-layer, .effect-layer {
  position: absolute;
  inset: 0;
}

.cloud-layer, .plane-layer, .building-layer, .pedestrian-layer, .effect-layer { pointer-events: none; }

.cloud {
  position: absolute;
  width: 170px;
  height: 34px;
  opacity: .19;
  filter: blur(.2px);
  animation: cloud-drift var(--duration) linear infinite;
}

.cloud::before, .cloud::after, .cloud span {
  content: "";
  position: absolute;
  background: #f3edf0;
  border-radius: 999px;
}

.cloud::before { width: 100%; height: 20px; left: 0; bottom: 0; }
.cloud::after { width: 66px; height: 44px; left: 30px; bottom: 5px; }
.cloud span { width: 78px; height: 52px; right: 24px; bottom: 2px; }

@keyframes cloud-drift {
  from { transform: translateX(-260px); }
  to { transform: translateX(var(--travel)); }
}

.far-city {
  position: absolute;
  z-index: 0;
  left: 0;
  right: 0;
  bottom: calc(100% - var(--horizon));
  height: 64px;
  opacity: .11;
  background:
    linear-gradient(to top, var(--ink) 0 15px, transparent 15px),
    repeating-linear-gradient(90deg, transparent 0 22px, var(--ink) 22px 42px, transparent 42px 60px),
    repeating-linear-gradient(90deg, transparent 0 88px, var(--ink) 88px 122px, transparent 122px 174px);
  clip-path: polygon(0 100%, 0 62%, 4% 62%, 4% 30%, 7% 30%, 7% 70%, 11% 70%, 11% 45%, 14% 45%, 14% 82%, 19% 82%, 19% 52%, 23% 52%, 23% 68%, 28% 68%, 28% 24%, 31% 24%, 31% 75%, 36% 75%, 36% 48%, 40% 48%, 40% 82%, 44% 82%, 44% 35%, 48% 35%, 48% 68%, 53% 68%, 53% 16%, 56% 16%, 56% 70%, 61% 70%, 61% 42%, 66% 42%, 66% 79%, 70% 79%, 70% 30%, 74% 30%, 74% 66%, 80% 66%, 80% 45%, 84% 45%, 84% 76%, 89% 76%, 89% 24%, 93% 24%, 93% 66%, 100% 66%, 100% 100%);
}

.building-layer { z-index: 3; }

.city-object {
  position: absolute;
  bottom: calc(100% - var(--horizon));
  height: min(52vh, 430px);
  transform-origin: 50% 100%;
  filter: drop-shadow(0 8px 5px rgba(7, 9, 17, .14));
}

.city-object.entering { animation: build-rise .44s cubic-bezier(.2,.88,.24,1.16) both; }
.city-object.pulse { animation: object-pulse .48s ease both; }
.city-object.affected { animation: affected-glow .8s ease both; }
.city-object.demolition-target {
  filter: drop-shadow(0 0 11px rgba(255, 110, 105, .88));
  opacity: .8;
}

@keyframes build-rise {
  from { transform: scaleY(.08) translateY(10px); opacity: .35; }
  to { transform: scaleY(1) translateY(0); opacity: 1; }
}

@keyframes object-pulse {
  0%,100% { filter: drop-shadow(0 8px 5px rgba(7,9,17,.14)); }
  45% { filter: drop-shadow(0 0 15px rgba(255,239,178,.9)); transform: translateY(-4px); }
}

@keyframes affected-glow {
  50% { filter: drop-shadow(0 0 12px var(--accent)); }
}

.building-svg, .landmark-svg { display: block; width: 100%; height: 100%; overflow: visible; }
.building-svg .shell, .landmark-svg .shell { fill: var(--ink); }
.building-svg .shell-soft, .landmark-svg .shell-soft { fill: var(--ink-soft); }
.building-svg .trim, .landmark-svg .trim { fill: #363b50; }
.building-svg .window, .landmark-svg .window { fill: var(--cream); opacity: .84; }
.building-svg .window.dim, .landmark-svg .window.dim { opacity: .26; }
.building-svg .glass { fill: #93b2b2; opacity: .36; }
.building-svg .accent, .landmark-svg .accent { fill: #dfa780; }
.landmark-svg .green { fill: #334b45; }
.landmark-svg .leaf { fill: #263d39; }
.landmark-svg .line { fill: none; stroke: #484e62; stroke-width: 3; }

.surface-hit-layer {
  z-index: 5;
  bottom: calc(100% - var(--horizon));
  height: min(48vh, 385px);
  top: auto;
}

.build-cell {
  position: absolute;
  bottom: 0;
  width: var(--column-width);
  height: 100%;
  border: 0;
  padding: 0;
  background: transparent;
  cursor: pointer;
}

.build-cell::after {
  content: "";
  position: absolute;
  left: 7px;
  right: 7px;
  bottom: 2px;
  height: 5px;
  border-radius: 6px;
  background: transparent;
  transition: background .16s, box-shadow .16s, height .16s;
}

.build-cell:hover::after, .build-cell.focused::after {
  height: 8px;
  background: rgba(185,239,210,.68);
  box-shadow: 0 0 13px rgba(115,214,178,.72);
}

.build-cell.invalid::after {
  background: rgba(255,140,136,.78);
  box-shadow: 0 0 12px rgba(255,140,136,.45);
}

.build-cell.footprint-valid::after { background: var(--accent); }
.build-cell.footprint-invalid::after { background: var(--danger); }
.build-cell.demolish-target::after {
  height: 8px;
  background: var(--danger);
  box-shadow: 0 0 14px rgba(255, 110, 105, .72);
}
.build-cell.demolish-empty::after { background: rgba(255,140,136,.24); box-shadow: none; }

.road {
  position: absolute;
  z-index: 8;
  left: 0;
  right: 0;
  top: var(--horizon);
  height: var(--road-height);
  background: #232733;
  border-top: 4px solid #11141d;
  border-bottom: 4px solid #11141d;
  box-shadow: 0 4px 0 rgba(255,255,255,.03);
  pointer-events: none;
}

.road-line {
  position: absolute;
  left: 0;
  right: 0;
  top: 13px;
  height: 2px;
  opacity: .35;
  background: repeating-linear-gradient(90deg, transparent 0 34px, #e3c89c 34px 58px, transparent 58px 78px);
}

.vehicle-layer { position: absolute; inset: 0; overflow: hidden; }

.vehicle {
  position: absolute;
  top: var(--lane);
  left: 0;
  width: var(--vehicle-width, 24px);
  height: 9px;
  border-radius: 3px 5px 2px 2px;
  background: var(--vehicle-color, #c79579);
  box-shadow: inset 7px 1px 0 rgba(220,235,229,.42);
  animation: drive-right var(--drive-duration) linear forwards;
}

.vehicle::before, .vehicle::after {
  content: "";
  position: absolute;
  bottom: -2px;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: #0d1017;
}

.vehicle::before { left: 4px; }
.vehicle::after { right: 4px; }
.vehicle.reverse { animation-name: drive-left; transform: scaleX(-1); }
.vehicle.bus { height: 12px; border-radius: 2px; box-shadow: inset 5px 2px 0 rgba(230,244,236,.48), inset 12px 2px 0 rgba(230,244,236,.48), inset 19px 2px 0 rgba(230,244,236,.48); }

@keyframes drive-right { from { translate: -60px 0; } to { translate: var(--world-travel) 0; } }
@keyframes drive-left { from { translate: var(--world-travel) 0; } to { translate: -60px 0; } }

.pedestrian-layer { z-index: 7; bottom: calc(100% - var(--horizon)); top: auto; height: 20px; }

.pedestrian {
  position: absolute;
  bottom: 1px;
  width: 3px;
  height: 9px;
  border-radius: 3px 3px 1px 1px;
  background: #171a25;
  opacity: .82;
  animation: stroll var(--stroll-duration) ease-in-out infinite alternate;
}

.pedestrian::before {
  content: "";
  position: absolute;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  left: -.5px;
  top: -4px;
  background: #242838;
}

@keyframes stroll { from { transform: translateX(-12px); } to { transform: translateX(16px); } }

.underground {
  position: absolute;
  z-index: 1;
  left: 0;
  right: 0;
  top: calc(var(--horizon) + var(--road-height));
  bottom: 0;
  background-color: #171b29;
  background-image:
    linear-gradient(rgba(159,170,192,.10) 1px, transparent 1px),
    linear-gradient(90deg, rgba(159,170,192,.10) 1px, transparent 1px),
    linear-gradient(180deg, rgba(0,0,0,.10), rgba(0,0,0,.32));
  background-size: var(--column-width) 48px, var(--column-width) 48px, 100% 100%;
  pointer-events: none;
}

.coverage-layer, .tunnel-layer, .train-layer { position: absolute; inset: 0; }

.coverage-band {
  position: absolute;
  top: 0;
  bottom: 0;
  border: 1px solid rgba(185,239,210,.55);
  background:
    repeating-linear-gradient(90deg, rgba(119,218,182,.14) 0 calc(var(--column-width) - 1px), rgba(196,255,230,.30) calc(var(--column-width) - 1px) var(--column-width));
  box-shadow: inset 0 0 28px rgba(82,214,166,.17), 0 0 16px rgba(82,214,166,.14);
  animation: coverage-breathe 1.8s ease-in-out infinite alternate;
}

.coverage-band.invalid { border-color: rgba(255,140,136,.7); background-color: rgba(255,100,100,.08); }

@keyframes coverage-breathe { to { opacity: .67; } }

.station-underground {
  position: absolute;
  top: 43px;
  width: 54px;
  height: 39px;
  border: 3px solid #4e5d6c;
  border-radius: 8px 8px 2px 2px;
  background: #202737;
  box-shadow: inset 0 0 0 3px #171b29, 0 0 12px rgba(185,239,210,.15);
}

.station-underground::before {
  content: "";
  position: absolute;
  left: 7px;
  right: 7px;
  top: 9px;
  height: 8px;
  background: repeating-linear-gradient(90deg, var(--cream) 0 6px, transparent 6px 12px);
  opacity: .62;
}

.tunnel {
  position: absolute;
  top: 59px;
  height: 12px;
  border-top: 3px solid #495363;
  border-bottom: 3px solid #343c4b;
  background: rgba(6,8,14,.34);
}

.subway-train {
  position: absolute;
  top: 53px;
  left: 0;
  height: 14px;
  width: 46px;
  border: 2px solid #111520;
  border-radius: 5px 7px 3px 3px;
  background: #8cadac;
  box-shadow: inset 7px 2px #e5d6a3, inset 16px 2px #e5d6a3, inset 25px 2px #e5d6a3, inset 34px 2px #e5d6a3, 0 0 8px rgba(189,238,215,.34);
  animation: subway-run var(--train-duration) ease-in-out forwards;
}

@keyframes subway-run {
  0% { transform: translateX(var(--train-start)); }
  45%, 55% { transform: translateX(var(--train-end)); }
  100% { transform: translateX(var(--train-start)); }
}

.effect-layer { z-index: 12; }

.float-tax, .gain-indicator {
  position: absolute;
  bottom: calc(100% - var(--horizon) + var(--float-height, 120px));
  color: #fff6ca;
  font-weight: 850;
  font-size: 14px;
  letter-spacing: .02em;
  text-shadow: 0 2px 10px rgba(18,20,29,.72);
  animation: float-away 1.8s ease-out forwards;
  white-space: nowrap;
}

.gain-indicator { color: var(--accent); font-size: 15px; }
.gain-indicator.loss { color: #ffaaa3; }

.demolition-price {
  position: absolute;
  bottom: calc(100% - var(--horizon) + var(--float-height, 110px));
  transform: translateX(-50%);
  padding: 6px 9px;
  border: 1px solid rgba(255, 180, 176, .58);
  border-radius: 8px;
  color: #ffe1de;
  background: rgba(92, 37, 42, .94);
  box-shadow: 0 5px 18px rgba(27, 8, 12, .28);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: .08em;
  white-space: nowrap;
}

.demolition-price.unaffordable { color: #ffb7b2; border-color: rgba(255,120,115,.75); }

@keyframes float-away {
  0% { transform: translate(-50%, 8px) scale(.88); opacity: 0; }
  16% { transform: translate(-50%, 0) scale(1); opacity: 1; }
  100% { transform: translate(-50%, -38px) scale(.98); opacity: 0; }
}

.plane {
  position: absolute;
  z-index: 2;
  width: 54px;
  height: 18px;
  left: 0;
  top: var(--plane-top);
  opacity: .74;
  animation: plane-flight var(--plane-duration) ease-in-out forwards;
}

.plane svg { width: 100%; height: 100%; fill: #313747; }
.plane.reverse { transform: scaleX(-1); }

@keyframes plane-flight {
  from { translate: var(--plane-start) 100px; }
  15% { translate: calc(var(--plane-start) + 250px) 0; }
  to { translate: var(--plane-end) -80px; }
}

.topbar {
  position: fixed;
  z-index: 30;
  top: 0;
  left: 0;
  width: 100vw;
  min-height: 78px;
  display: grid;
  grid-template-columns: 1fr auto auto;
  align-items: center;
  gap: 22px;
  padding: max(14px, env(safe-area-inset-top)) 20px 14px;
  pointer-events: none;
  background: linear-gradient(180deg, rgba(22,25,37,.55), transparent);
}

.topbar button { pointer-events: auto; }

.identity { display: flex; gap: 11px; align-items: center; min-width: 0; }
.identity p, .identity h1 { margin: 0; }
.identity p { font-size: 9px; font-weight: 750; letter-spacing: .18em; opacity: .67; }
.identity h1 { margin-top: 2px; font-size: clamp(16px, 2vw, 22px); line-height: 1; letter-spacing: -.025em; }

.city-mark { width: 34px; height: 34px; display: flex; align-items: end; gap: 3px; border-bottom: 3px solid #f8f3e6; }
.city-mark i { display: block; width: 8px; background: #f8f3e6; border-radius: 2px 2px 0 0; }
.city-mark i:nth-child(1) { height: 15px; }
.city-mark i:nth-child(2) { height: 27px; }
.city-mark i:nth-child(3) { height: 20px; }

.economy {
  display: flex;
  align-items: stretch;
  gap: 1px;
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 9px 25px rgba(23,26,37,.15);
}

.economy > div { min-width: 128px; padding: 9px 15px; background: rgba(24,27,39,.78); backdrop-filter: blur(12px); }
.economy span { display: block; font-size: 9px; text-transform: uppercase; letter-spacing: .13em; opacity: .62; }
.economy strong { display: block; margin-top: 1px; font-size: 18px; font-variant-numeric: tabular-nums; }
.economy > div:last-child strong { color: var(--accent); }

.top-actions { display: flex; gap: 8px; }
.round-button {
  width: 40px;
  height: 40px;
  border: 1px solid rgba(255,255,255,.22);
  border-radius: 50%;
  background: rgba(24,27,39,.7);
  backdrop-filter: blur(10px);
  font-size: 18px;
  font-weight: 800;
  cursor: pointer;
}
.round-button:hover { background: rgba(35,40,55,.9); transform: translateY(-1px); }

.news-ticker {
  position: fixed;
  z-index: 32;
  top: 79px;
  left: 50%;
  width: min(880px, calc(100vw - 40px));
  height: 30px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) 28px;
  align-items: stretch;
  transform: translateX(-50%);
  overflow: hidden;
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 9px;
  color: #d9d9d6;
  background: rgba(24,27,39,.73);
  box-shadow: 0 7px 20px rgba(20,22,32,.12);
  backdrop-filter: blur(10px);
  pointer-events: auto;
}

.ticker-label {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 0 11px;
  border-right: 1px solid rgba(255,255,255,.11);
  color: var(--accent);
  background: rgba(25,29,40,.94);
  font-size: 9px;
  font-weight: 900;
  letter-spacing: .14em;
  white-space: nowrap;
}

.ticker-label i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent-strong);
  box-shadow: 0 0 7px rgba(115,214,178,.8);
  animation: wire-pulse 1.8s ease-in-out infinite alternate;
}

.ticker-viewport { min-width: 0; overflow: hidden; }

.ticker-message {
  width: max-content;
  min-width: 100%;
  margin: 0;
  padding-left: 100%;
  line-height: 28px;
  color: #dcddd9;
  font-size: 10px;
  font-weight: 650;
  letter-spacing: .035em;
  white-space: nowrap;
  animation: ticker-scroll var(--ticker-duration, 18s) linear forwards;
}

.news-ticker button {
  position: relative;
  z-index: 2;
  border: 0;
  border-left: 1px solid rgba(255,255,255,.10);
  color: #bfc4c5;
  background: rgba(25,29,40,.94);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
}

.news-ticker button:hover { color: white; background: #303544; }

@keyframes ticker-scroll { to { transform: translateX(-100%); } }
@keyframes wire-pulse { to { opacity: .4; box-shadow: 0 0 3px rgba(115,214,178,.25); } }

.tutorial {
  position: fixed;
  z-index: 31;
  top: 119px;
  left: 50%;
  width: max-content;
  max-width: calc(100vw - 32px);
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 11px 10px 15px;
  border: 1px solid rgba(255,255,255,.23);
  border-radius: 999px;
  color: #222535;
  background: rgba(255,244,210,.93);
  box-shadow: 0 8px 22px rgba(24,27,39,.16);
  font-size: 13px;
  font-weight: 700;
  pointer-events: auto;
  transition: opacity .25s, transform .25s;
}
.tutorial.hidden { opacity: 0; transform: translate(-50%, -8px); pointer-events: none; }
.tutorial button { border: 0; background: rgba(25,28,40,.09); color: #343747; width: 22px; height: 22px; border-radius: 50%; cursor: pointer; }

.drag-hint {
  position: fixed;
  z-index: 20;
  display: flex;
  left: 50%;
  top: calc(var(--horizon) + 46px);
  width: max-content;
  transform: translateX(-50%);
  gap: 9px;
  color: rgba(218,226,229,.47);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .13em;
  text-transform: uppercase;
  pointer-events: none;
  animation: hint-fade 6s 2s both;
}
.drag-hint span { font-size: 17px; line-height: 10px; }
@keyframes hint-fade { 0%,65% { opacity: 1; } 100% { opacity: 0; } }

.toast {
  position: fixed;
  z-index: 80;
  left: 50%;
  bottom: calc(var(--dock-height, 124px) + 16px);
  transform: translate(-50%, 12px);
  padding: 9px 14px;
  border-radius: 10px;
  color: #f9f3e4;
  background: rgba(19,22,32,.9);
  box-shadow: 0 8px 30px rgba(0,0,0,.2);
  font-size: 13px;
  font-weight: 700;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s, transform .2s;
}
.toast.visible { opacity: 1; transform: translate(-50%, 0); }
.toast.error { color: #ffd2ce; }

.build-dock {
  position: relative;
  z-index: 50;
  border-top: 1px solid rgba(255,255,255,.08);
  background: rgba(18,21,31,.98);
  box-shadow: 0 -10px 35px rgba(8,10,17,.22);
}

.tool-row, .option-row {
  display: flex;
  justify-content: safe center;
  gap: 8px;
  padding: 10px 14px;
  overflow-x: auto;
  scrollbar-width: none;
}
.tool-row::-webkit-scrollbar, .option-row::-webkit-scrollbar { display: none; }

.option-row {
  padding: 8px 14px 0;
  min-height: 0;
  max-height: 0;
  opacity: 0;
  transform: translateY(6px);
  transition: max-height .22s ease, opacity .18s, transform .2s;
}
.option-row.open { min-height: 61px; max-height: 70px; opacity: 1; transform: none; }

.tool-button, .option-button {
  flex: 0 0 auto;
  border: 1px solid rgba(255,255,255,.11);
  border-radius: 12px;
  background: #232735;
  color: #e9e5d9;
  cursor: pointer;
  transition: background .16s, border-color .16s, transform .16s, opacity .16s;
}
.tool-button:hover, .option-button:hover { transform: translateY(-2px); background: #292e3e; }
.tool-button.selected, .option-button.selected {
  border-color: rgba(185,239,210,.75);
  background: #34463f;
  box-shadow: inset 0 0 0 1px rgba(185,239,210,.12), 0 5px 18px rgba(0,0,0,.14);
}

.tool-button {
  width: min(190px, 22vw);
  min-width: 150px;
  min-height: 62px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 13px;
  text-align: left;
}
.tool-copy b, .tool-copy small { display: block; white-space: nowrap; }
.tool-copy b { font-size: 13px; }
.tool-copy small { margin-top: 3px; color: #a9adba; font-size: 10px; }
.selected .tool-copy small { color: #c3dfd2; }

.tool-icon { position: relative; width: 30px; height: 30px; flex: 0 0 30px; }
.house-icon::before { content: ""; position: absolute; left: 5px; bottom: 3px; width: 20px; height: 16px; border-radius: 2px; background: #d8b185; }
.house-icon::after { content: ""; position: absolute; left: 4px; top: 3px; width: 22px; height: 22px; background: #f0d5a6; clip-path: polygon(50% 0, 100% 45%, 87% 45%, 87% 100%, 13% 100%, 13% 45%, 0 45%); }
.shop-icon { border-radius: 4px; background: #b1c2bd; margin-top: 3px; height: 24px; }
.shop-icon::before { content: ""; position: absolute; inset: 3px 2px auto; height: 7px; background: repeating-linear-gradient(90deg,#e8cda0 0 5px,#7c9290 5px 10px); }
.shop-icon::after { content: ""; position: absolute; left: 6px; right: 6px; bottom: 3px; height: 7px; background: #1d2230; }
.transit-icon { border: 3px solid #acc7c3; border-radius: 7px 7px 4px 4px; }
.transit-icon::before { content: ""; position: absolute; inset: 5px 4px 10px; background: #e8d6a4; box-shadow: 0 10px 0 -2px #6e8c87; }
.transit-icon::after { content: ""; position: absolute; left: 3px; right: 3px; bottom: -5px; height: 3px; border-radius: 3px; background: #acc7c3; }
.landmark-icon { border-bottom: 5px solid #d0ae83; }
.landmark-icon::before { content: ""; position: absolute; left: 10px; top: 7px; width: 10px; height: 18px; background: #e6ce9d; clip-path: polygon(50% 0,100% 24%,85% 100%,15% 100%,0 24%); }
.demolish-icon::before { content: ""; position: absolute; left: 3px; bottom: 3px; width: 23px; height: 8px; border-radius: 2px; background: #e89891; transform: rotate(-13deg); }
.demolish-icon::after { content: ""; position: absolute; width: 13px; height: 13px; right: 1px; top: 1px; border-radius: 50%; background: #ffaaa3; box-shadow: -8px 9px 0 -5px #ffaaa3; }
.tool-button[data-category="demolish"].selected {
  border-color: rgba(255, 150, 145, .78);
  background: #503238;
  box-shadow: inset 0 0 0 1px rgba(255,150,145,.12), 0 5px 18px rgba(0,0,0,.14);
}
.tool-button[data-category="demolish"].selected .tool-copy small { color: #f3bbb6; }

.option-button {
  min-width: 126px;
  min-height: 48px;
  padding: 7px 12px;
  text-align: left;
}
.option-button b, .option-button small { display: block; }
.option-button b { font-size: 11px; }
.option-button small { margin-top: 3px; font-size: 10px; color: #b7bac4; }
.option-button.unaffordable { opacity: .46; }
.option-button.unaffordable:hover { opacity: .68; }
.safe-area-fill { height: env(safe-area-inset-bottom); }

.modal-backdrop {
  position: fixed;
  z-index: 100;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(12,14,22,.67);
  backdrop-filter: blur(9px);
}
.modal-backdrop[hidden], .modal[hidden] { display: none; }

.modal {
  position: relative;
  width: min(760px, 100%);
  max-height: calc(100dvh - 40px);
  overflow: auto;
  padding: clamp(24px, 4vw, 42px);
  border: 1px solid rgba(255,255,255,.13);
  border-radius: 24px;
  background: #202432;
  box-shadow: 0 25px 80px rgba(0,0,0,.36);
  user-select: text;
}
.compact-modal { width: min(460px, 100%); }
.confirm-modal { width: min(430px, 100%); text-align: center; }
.modal-close { position: absolute; top: 14px; right: 14px; width: 36px; height: 36px; border: 0; border-radius: 50%; color: #d8d7d4; background: rgba(255,255,255,.07); font-size: 21px; cursor: pointer; }
.eyebrow { margin: 0 0 7px; color: var(--accent); font-size: 10px; font-weight: 800; letter-spacing: .18em; }
.modal h2 { margin: 0 0 24px; font-size: clamp(28px,5vw,44px); letter-spacing: -.04em; }
.modal h3 { margin: 11px 0 4px; font-size: 14px; }
.modal p { line-height: 1.55; color: #bfc1c8; }

.how-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; }
.how-grid article { min-width: 0; }
.how-grid p { margin: 0; font-size: 13px; }
.mini-scene { display: block; position: relative; height: 50px; border-bottom: 2px solid #697082; overflow: hidden; }
.mini-scene::before, .mini-scene::after { content: ""; position: absolute; bottom: 0; background: #111520; }
.mini-scene.homes::before { left: 12px; width: 38px; height: 27px; clip-path: polygon(50% 0,100% 35%,88% 35%,88% 100%,12% 100%,12% 35%,0 35%); }
.mini-scene.homes::after { left: 64px; width: 24px; height: 44px; }
.mini-scene.commerce::before { left: 8px; width: 55px; height: 30px; clip-path: polygon(0 30%,18% 30%,27% 0,44% 30%,53% 0,70% 30%,100% 30%,100% 100%,0 100%); }
.mini-scene.commerce::after { left: 78px; width: 26px; height: 46px; box-shadow: inset 5px 6px #e4d39f, inset 16px 6px #e4d39f, inset 5px 18px #e4d39f, inset 16px 18px #e4d39f; }
.mini-scene.transit { background: repeating-linear-gradient(90deg,transparent 0 23px,rgba(115,214,178,.12) 23px 24px); }
.mini-scene.transit::before { left: 42px; width: 6px; height: 36px; background: #b8d7ce; }
.mini-scene.transit::after { left: 26px; bottom: 8px; width: 74px; height: 8px; background: #4c645f; border-radius: 5px; }
.mini-scene.skyline::before { left: 7px; width: 20px; height: 25px; box-shadow: 27px -16px #111520, 54px 2px #111520, 82px -24px #111520; }
.mini-scene.skyline::after { left: 91px; width: 5px; height: 48px; transform: rotate(25deg); transform-origin: bottom; }
.modal-note { padding: 13px 15px; border-left: 3px solid var(--accent); background: rgba(185,239,210,.06); font-size: 13px; }

.primary-button, .danger-button, .text-button { border-radius: 10px; padding: 11px 17px; font-weight: 800; cursor: pointer; }
.primary-button { border: 0; color: #1c2a25; background: var(--accent); }
.danger-button { border: 0; color: #2a181a; background: var(--danger); }
.text-button { border: 1px solid rgba(255,255,255,.12); background: transparent; color: #d6d5d2; }
.text-button.danger { color: var(--danger); }
.stats-list { display: grid; grid-template-columns: 1fr auto; margin: 0 0 24px; }
.stats-list div { display: contents; }
.stats-list dt, .stats-list dd { margin: 0; padding: 11px 0; border-bottom: 1px solid rgba(255,255,255,.08); }
.stats-list dt { color: #adafb8; }
.stats-list dd { font-weight: 800; font-variant-numeric: tabular-nums; }
.modal-actions, .confirm-actions { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.confirm-actions { justify-content: center; margin-top: 24px; }

.shake { animation: shake .35s ease; }
@keyframes shake { 25% { transform: translateX(-5px); } 50% { transform: translateX(5px); } 75% { transform: translateX(-3px); } }

@media (max-width: 720px) {
  :root { --horizon: 57%; --column-width: 64px; --road-height: 32px; }
  #world { min-height: 340px; }
  .topbar { grid-template-columns: 1fr auto; gap: 8px; min-height: 64px; padding: max(9px, env(safe-area-inset-top)) 10px 8px; }
  .identity p { display: none; }
  .identity h1 { font-size: 15px; }
  .city-mark { width: 27px; height: 27px; }
  .city-mark i { width: 6px; }
  .city-mark i:nth-child(1) { height: 12px; }
  .city-mark i:nth-child(2) { height: 21px; }
  .city-mark i:nth-child(3) { height: 16px; }
  .economy { position: fixed; top: max(8px, env(safe-area-inset-top)); left: 50%; transform: translateX(-50%); }
  .economy > div { min-width: 88px; padding: 7px 9px; }
  .economy span { font-size: 7px; }
  .economy strong { font-size: 14px; }
  .top-actions { position: absolute; z-index: 42; top: max(8px, env(safe-area-inset-top)); right: 8px; }
  .round-button { width: 35px; height: 35px; }
  #statsButton { display: none; }
  #helpButton { position: static; display: block; }
  .tutorial { font-size: 12px; }
  .news-ticker { top: 57px; width: calc(100vw - 20px); height: 29px; border-radius: 8px; }
  .ticker-label { padding: 0 8px; font-size: 8px; letter-spacing: .1em; }
  .ticker-label i { display: none; }
  .ticker-message { line-height: 27px; font-size: 9px; }
  .tutorial { top: 95px; }
  .tool-row, .option-row { justify-content: flex-start; padding-left: 10px; padding-right: 10px; }
  .tool-button { min-width: 136px; width: 136px; min-height: 55px; gap: 9px; padding: 7px 9px; }
  .tool-icon { transform: scale(.88); }
  .tool-copy b { font-size: 12px; }
  .tool-copy small { font-size: 9px; }
  .option-row.open { min-height: 57px; }
  .option-button { min-width: 112px; min-height: 45px; }
  .how-grid { grid-template-columns: 1fr; gap: 16px; }
  .modal { padding: 28px 22px; border-radius: 19px; }
  .modal h2 { margin-bottom: 18px; }
}

@media (max-height: 600px) {
  :root { --horizon: 57%; }
  .tool-button { min-height: 50px; }
  .option-row.open { min-height: 52px; }
  .option-button { min-height: 41px; }
  .city-object { height: min(55vh, 360px); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; scroll-behavior: auto !important; }
  .ticker-message { width: auto; min-width: 0; padding: 0 10px; overflow: hidden; text-overflow: ellipsis; transform: none !important; }
}
