@import url("https://fonts.googleapis.com/css2?family=Archivo:wght@400;600;700;800&display=swap");

:root {
  --bg: #f7f6f2;
  --panel: rgba(247, 246, 242, 0.94);
  --text: #201e1d;
  --muted: #605d5d;
  --line: rgba(32, 30, 29, 0.42);
  --accent: #ec3013;
  --shadow: 0 12px 34px rgba(32, 30, 29, 0.18);
}

* { box-sizing: border-box; }
html, body, #app { width: 100%; height: 100%; margin: 0; overflow: hidden; }
body { font-family: Archivo, system-ui, sans-serif; color: var(--text); background: var(--bg); }
button, input, select { font: inherit; }
button { border: 0; cursor: pointer; background: transparent; color: inherit; }

#city-canvas { position: fixed; inset: 0; cursor: grab; background: linear-gradient(180deg, #f7f6f2, #d5d1c8); }
.panel {
  background: var(--panel);
  border: 2px solid var(--line);
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
}

.topbar {
  position: fixed;
  inset: 0 0 auto;
  z-index: 20;
  height: 66px;
  display: grid;
  grid-template-columns: 176px minmax(280px, 1fr) auto auto;
  align-items: center;
  gap: 22px;
  padding: 0 24px;
  background: rgba(247, 246, 242, 0.94);
  border-bottom: 2px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; font: 800 18px/1 Archivo, sans-serif; }
.logo { width: 28px; height: 28px; display: grid; place-items: center; background: var(--text); color: var(--bg); font-size: 10px; }
.ticker { display: flex; align-items: center; gap: 10px; min-width: 0; padding: 8px 12px; border-inline: 2px solid var(--line); font-weight: 800; font-size: 12px; }
.ticker span { width: 8px; height: 8px; flex: none; background: var(--accent); animation: pulse 1.4s ease-in-out infinite; }
.ticker p { margin: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
nav { display: flex; gap: 16px; font-weight: 800; font-size: 12px; }
nav button { color: var(--muted); }
nav button.is-active { color: var(--text); }

.primary {
  background: var(--accent);
  color: var(--bg);
  min-height: 36px;
  padding: 0 18px;
  font-weight: 800;
}
.ghost { color: var(--accent); font-weight: 800; padding: 0 10px; }
.full { width: 100%; justify-content: center; margin-top: 14px; }

.intro {
  position: fixed;
  z-index: 12;
  top: 90px;
  left: 28px;
  width: min(388px, calc(100vw - 56px));
  padding: 24px;
}
.kicker { margin: 0 0 8px; color: var(--accent); font: 800 10px/1 Archivo, sans-serif; text-transform: uppercase; letter-spacing: .08em; }
h1, h2, h3 { margin: 0; line-height: 1.06; letter-spacing: 0; }
h1 { font-size: 32px; }
h2 { font-size: 21px; }
h3 { font-size: 16px; }
.intro > p:not(.kicker), .side-view > p, #modal-copy, .fineprint { color: var(--muted); line-height: 1.5; font-size: 14px; }
.price-grid { display: grid; grid-template-columns: repeat(3, 1fr); margin: 18px 0; border: 1px solid var(--line); }
.price-grid div { padding: 10px; border-right: 1px solid var(--line); }
.price-grid div:last-child { border-right: 0; }
.price-grid strong { display: block; font-size: 18px; }
.price-grid span, .stats span { display: block; color: var(--muted); font-size: 10px; font-weight: 700; }
.actions { display: flex; gap: 10px; align-items: center; }

.district-panel {
  position: fixed;
  z-index: 12;
  top: 82px;
  right: 24px;
  width: 250px;
  padding-top: 12px;
}
.district-panel .kicker, .district-panel h2 { padding-inline: 12px; }
.district-panel h2 { margin-bottom: 10px; }
#district-list button {
  width: 100%;
  min-height: 36px;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: center;
  padding: 0 12px;
  border-top: 1px solid rgba(32, 30, 29, .2);
  font-size: 12px;
  font-weight: 800;
  text-align: left;
}
#district-list strong { color: var(--accent); }

.side-view {
  position: fixed;
  top: 88px;
  right: 24px;
  z-index: 22;
  width: min(390px, calc(100vw - 32px));
  max-height: calc(100vh - 126px);
  overflow: auto;
  padding: 20px;
}
.close-side, .close {
  float: right;
  width: 30px;
  height: 30px;
  border: 1px solid var(--line);
  font-weight: 800;
}
dl { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 18px 0 0; }
.metric-grid {
  padding: 12px;
  background: rgba(238, 234, 225, 0.62);
  border: 1px solid rgba(32, 30, 29, 0.18);
}
dt { color: var(--muted); font-size: 11px; }
dd { margin: 2px 0 0; font-weight: 800; font-size: 13px; }
.side-actions { display: grid; gap: 8px; margin-top: 14px; }
.ghost-action {
  min-height: 36px;
  border: 1px solid var(--line);
  color: var(--accent);
  font-weight: 800;
  background: rgba(247, 246, 242, 0.72);
}
.panel-list {
  display: grid;
  gap: 8px;
  margin-top: 16px;
}
.panel-row {
  width: 100%;
  min-height: 64px;
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 10px;
  border: 1px solid rgba(32, 30, 29, 0.18);
  background: rgba(247, 246, 242, 0.74);
  text-align: left;
}
.panel-row:hover { border-color: var(--accent); background: #fffaf0; }
.rank, .lot-type {
  height: 34px;
  display: grid;
  place-items: center;
  background: var(--text);
  color: var(--bg);
  font-size: 11px;
  font-weight: 800;
}
.lot-type.billboard { background: var(--accent); }
.row-main {
  min-width: 0;
  display: grid;
  gap: 4px;
}
.row-main strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 14px;
}
.row-main small {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.25;
}
.row-metric, .row-price {
  min-width: 46px;
  text-align: right;
  font-weight: 800;
}
.row-metric strong { display: block; font-size: 16px; }
.row-metric small { color: var(--muted); font-size: 10px; }

.tooltip {
  position: fixed;
  z-index: 30;
  width: 238px;
  padding: 14px 16px;
  pointer-events: none;
}
.tooltip p { margin: 3px 0; color: var(--muted); font-size: 12px; }
.tooltip div { display: flex; justify-content: space-between; margin-top: 10px; font-size: 12px; font-weight: 800; }
.tooltip strong { display: block; margin-top: 6px; color: var(--accent); font-size: 11px; text-transform: uppercase; }

.hud {
  position: fixed;
  z-index: 18;
  left: 24px;
  right: 24px;
  bottom: 18px;
  display: grid;
  grid-template-columns: 140px auto 1fr;
  gap: 10px;
  align-items: end;
}
.minimap { height: 120px; position: relative; }
.minimap span { position: absolute; width: 12px; height: 12px; background: #8f8d89; }
.minimap b { position: absolute; left: 62px; top: 56px; width: 12px; height: 12px; background: var(--accent); }
.controls { display: flex; }
.controls button { min-height: 118px; padding: 0 12px; color: var(--accent); border-right: 1px solid var(--line); font-weight: 800; }
.controls button:last-child { border-right: 0; }
.stats { justify-self: end; display: flex; }
.stats div { min-width: 112px; height: 118px; padding: 14px 14px 0; text-align: right; border-right: 1px solid var(--line); }
.stats div:last-child { border-right: 0; }
.stats strong { display: block; font-size: 16px; }

dialog {
  width: min(460px, calc(100vw - 28px));
  padding: 0;
  border: 2px solid var(--line);
  color: var(--text);
  box-shadow: var(--shadow);
}
dialog::backdrop { background: rgba(32, 30, 29, .36); backdrop-filter: blur(2px); }
.modal { padding: 22px; background: var(--bg); }
.fields { display: grid; gap: 10px; margin-top: 18px; }
label { display: grid; gap: 5px; font-size: 12px; font-weight: 800; color: var(--muted); }
input, select {
  width: 100%;
  min-height: 38px;
  border: 1px solid var(--line);
  background: #eeeae1;
  color: var(--text);
  padding: 0 10px;
}
.logo-preview {
  min-height: 58px;
  display: grid;
  grid-template-columns: 42px 1fr;
  gap: 10px;
  align-items: center;
  padding: 8px;
  border: 1px solid rgba(32, 30, 29, 0.18);
  background: rgba(238, 234, 225, 0.62);
}
.logo-preview img, .side-logo {
  width: 42px;
  height: 42px;
  object-fit: contain;
  background: #fff;
  border: 1px solid rgba(32, 30, 29, 0.16);
}
.logo-preview strong, .logo-preview span {
  display: block;
  font-size: 12px;
}
.logo-preview span { color: var(--muted); margin-top: 2px; }
.side-logo {
  margin-top: 14px;
  width: 52px;
  height: 52px;
}
.summary, .receipt div {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 14px;
  padding: 12px;
  border: 1px solid var(--line);
  font-weight: 800;
}
.receipt div { margin-top: -1px; }
.fineprint { margin: 14px 0 0; }
.share-card {
  margin-top: 16px;
  padding: 18px;
  background: var(--text);
  color: var(--bg);
  font-size: 22px;
  font-weight: 800;
  line-height: 1.1;
}

@keyframes pulse {
  0%, 100% { opacity: .45; transform: scale(.8); }
  50% { opacity: 1; transform: scale(1.12); }
}

@media (max-width: 900px) {
  .topbar { grid-template-columns: 1fr auto; height: auto; min-height: 62px; padding: 10px 14px; }
  .ticker, nav, .district-panel { display: none; }
  .intro { top: 76px; left: 14px; width: calc(100vw - 28px); padding: 18px; }
  .hud { left: 12px; right: 12px; bottom: 12px; grid-template-columns: 102px 1fr; }
  .controls { display: grid; grid-template-columns: repeat(2, 1fr); }
  .controls button { min-height: 48px; font-size: 11px; }
  .stats { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(2, 1fr); justify-self: stretch; }
  .stats div { min-width: 0; height: 48px; }
  .minimap { height: 102px; }
  .side-view { top: 76px; right: 14px; left: 14px; width: auto; max-height: calc(100vh - 162px); }
}

button:disabled { cursor: not-allowed; opacity: 0.48; }
