/* ============================================================
   City page — paper atlas
   ============================================================ */

.city-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(280px, 0.65fr);
  gap: clamp(32px, 6vw, 88px);
  align-items: center;
  padding: 52px 0 40px;
}
.hero-kicker {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  margin: 0 0 20px;
  font-size: 12.5px;
  color: var(--ink-3);
  letter-spacing: 0.02em;
}
.hero-kicker::before {
  content: '';
  width: 18px; height: 1px;
  background: var(--seal);
}
.city-hero h1 {
  font-size: clamp(46px, 5.8vw, 84px);
  line-height: 1.14;
  letter-spacing: -0.025em;
  font-weight: 600;
  margin: 0;
  color: var(--ink);
}
.city-hero h1 .h1-line { display: block; }
.city-hero h1 .h1-line + .h1-line { margin-top: 0.05em; }
.hero-lede {
  margin: 26px 0 0;
  font-size: 16.5px;
  line-height: 1.9;
  color: var(--ink-2);
  max-width: 54ch;
}
.hero-lede .mono { font-size: 12px; color: var(--ink-2); background: var(--paper-2); padding: 1px 5px; border-radius: 2px; }
.hero-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin-top: 30px;
}
.hero-note {
  margin-top: 18px;
  font-size: 12.5px;
  color: var(--ink-3);
  line-height: 1.8;
}
.hero-note .mono { font-size: 11px; color: var(--ink-2); }

.hero-postcard {
  justify-self: end;
  width: min(100%, 330px);
  background: var(--paper-card);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  padding: 22px 22px 18px;
  box-shadow: var(--shadow);
  transform: rotate(-1.6deg);
  position: relative;
  transition: transform 0.5s cubic-bezier(.2,.8,.2,1);
}
.hero-postcard:hover { transform: rotate(-0.5deg) translateY(-3px); }
.hero-postcard::before,
.hero-postcard::after {
  content: '';
  position: absolute;
  top: -10px;
  width: 72px; height: 22px;
  background: rgba(214, 197, 165, 0.5);
  border: 1px solid rgba(191, 179, 157, 0.4);
  transform: rotate(-4deg);
}
.hero-postcard::before { left: 18px; }
.hero-postcard::after { right: 18px; transform: rotate(3deg); }
.postcard-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  border-bottom: 1px dashed var(--line-strong);
  padding-bottom: 12px;
  margin-bottom: 8px;
}
.postcard-head .serif { font-size: 17px; font-weight: 600; }
.postcard-head .mono { font-size: 9px; color: var(--ink-3); text-align: right; line-height: 1.5; }
.postcard-mascot {
  width: 100%;
  max-height: 220px;
  object-fit: contain;
  margin: 4px auto 0;
  filter: drop-shadow(0 8px 14px rgba(70, 50, 25, 0.13));
}
.postcard-caption {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 10px;
  border-top: 1px dashed var(--line-strong);
  padding-top: 12px;
}
.postcard-caption .who { font-size: 12.5px; color: var(--ink-2); }
.postcard-caption .pulse {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--teal);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.postcard-caption .pulse::before {
  content: '';
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--ok);
  box-shadow: 0 0 0 3px rgba(76, 122, 91, 0.14);
}
.postcard-stamp {
  position: absolute;
  top: 18px; right: 18px;
  width: 46px; height: 54px;
  border: 1px solid rgba(178, 80, 44, 0.45);
  color: var(--seal-ink);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  transform: rotate(4deg);
  background: rgba(251, 248, 241, 0.9);
  z-index: 1;
}
.postcard-stamp span:first-child { font-family: var(--serif); font-size: 17px; font-weight: 700; line-height: 1; }
.postcard-stamp span:last-child { font-family: var(--mono); font-size: 6.5px; letter-spacing: 0.04em; }
.postcard-head .mono { padding-right: 52px; }

@media (max-width: 980px) {
  .city-hero { grid-template-columns: 1fr; padding-top: 40px; }
  .hero-postcard { display: none; }
}
@media (max-width: 560px) {
  .city-hero { padding: 30px 0 26px; }
  .city-hero h1 { font-size: clamp(40px, 11vw, 56px); }
  .hero-lede { font-size: 15.5px; margin-top: 20px; }
  .hero-actions { margin-top: 22px; }
  .hero-actions .btn { flex: 1 1 auto; }
}

/* ---------- city section ---------- */
.city-section { padding: 8px 0 40px; }
.city-toolbar {
  display: grid;
  grid-template-columns: auto minmax(240px, 420px) auto;
  align-items: center;
  gap: 24px;
  margin-bottom: 18px;
}
.city-title h2 { font-size: clamp(26px, 2.6vw, 34px); }
.city-title p { margin: 5px 0 0; color: var(--ink-3); font-size: 13px; }
.city-search { position: relative; }
.city-search .search-box {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 44px;
  padding: 0 12px;
  background: var(--paper-card);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  box-shadow: var(--shadow-sm);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.city-search .search-box:focus-within {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(39, 71, 67, 0.08);
}
.city-search .search-box svg { color: var(--ink-3); flex: none; }
.city-search input {
  flex: 1 1 auto;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  font-size: 13.5px;
  color: var(--ink);
}
.city-search input::placeholder { color: #A79E8E; }
.city-search .search-kbd {
  flex: none;
  font-family: var(--mono);
  font-size: 10px;
  color: var(--ink-3);
  border: 1px solid var(--line);
  border-bottom-width: 2px;
  border-radius: 3px;
  padding: 1px 5px;
  background: var(--paper-2);
}
.search-results {
  position: absolute;
  top: calc(100% + 8px);
  left: 0; right: 0;
  z-index: 40;
  background: var(--paper-card);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  box-shadow: var(--shadow-lg);
  max-height: 380px;
  overflow-y: auto;
  padding: 6px;
  display: none;
}
.search-results.is-on { display: block; }
.search-result {
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  padding: 10px;
  border: 0;
  background: transparent;
  border-radius: var(--r-xs);
  text-align: left;
}
.search-result:hover, .search-result.is-active { background: var(--paper-2); }
.search-result img { width: 34px; height: 34px; object-fit: contain; flex: none; }
.search-result .sr-name { font-size: 13.5px; font-weight: 500; color: var(--ink); line-height: 1.4; }
.search-result .sr-meta { font-size: 11.5px; color: var(--ink-3); line-height: 1.5; margin-top: 1px; }
.search-result .sr-go { margin-left: auto; font-size: 11px; color: var(--ink-3); flex: none; }
.search-empty { padding: 18px 12px; font-size: 13px; color: var(--ink-3); text-align: center; }

.city-tools { display: flex; align-items: center; gap: 8px; justify-self: end; }
.zoom-group { display: inline-flex; border: 1px solid var(--line); background: var(--paper-card); border-radius: var(--r-sm); overflow: hidden; box-shadow: var(--shadow-sm); }
.zoom-group button {
  width: 36px; height: 40px;
  border: 0;
  background: transparent;
  color: var(--ink-2);
  display: inline-flex; align-items: center; justify-content: center;
}
.zoom-group button + button { border-left: 1px solid var(--line); }
.zoom-group button:hover { background: var(--paper-2); color: var(--ink); }
.theme-toggle {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 40px;
  padding: 0 12px;
  border: 1px solid var(--line);
  background: var(--paper-card);
  border-radius: var(--r-sm);
  box-shadow: var(--shadow-sm);
  font-size: 12.5px;
  color: var(--ink-2);
}
.theme-toggle:hover { background: var(--paper-2); color: var(--ink); }
.theme-toggle svg { width: 15px; height: 15px; }
.guide-open-btn { height: 40px; }

@media (max-width: 980px) {
  .city-toolbar { grid-template-columns: 1fr auto; gap: 14px; }
  .city-title { grid-column: 1 / -1; }
  .city-search { grid-column: 1 / 2; }
  .city-tools { grid-column: 2 / 3; }
  .zoom-group, .theme-toggle span { display: none; }
  .theme-toggle { padding: 0 10px; }
}
@media (max-width: 560px) {
  .city-toolbar { grid-template-columns: 1fr; }
  .city-tools { justify-self: start; grid-column: 1; }
  .city-search .search-kbd { display: none; }
  .guide-open-btn { display: none; }
}

/* ---------- board ---------- */
.board-frame {
  --board-paper: #F1E8D7;
  --board-line: #D8CBB5;
  --board-ink: #453F34;
  --road: #E8DCC4;
  --road-line: #BFAE91;
  --tree: #97AA8E;
  --tree-dark: #5F7A64;
  --water: #BED6CD;
  --water-line: #93B5AA;
  --platform-edge: #CBBDA5;
  --label-paper: #FBF8F1;
  --label-ink: #3A352C;
  --label-sub: #857C6C;
  --tag-paper: #FFFDF8;
  --tag-ink: #2C2923;
  --window-day: #AC9C81;
  --window-night: #F3C77A;
  --night-overlay: 0;

  position: relative;
  background: var(--paper-card);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  padding: 14px;
  box-shadow: var(--shadow);
}
.board-frame::before,
.board-frame::after {
  content: '';
  position: absolute;
  width: 12px; height: 12px;
  border-color: var(--line-strong);
  border-style: solid;
  pointer-events: none;
  z-index: 3;
}
.board-frame::before { top: 6px; left: 6px; border-width: 1px 0 0 1px; }
.board-frame::after { bottom: 6px; right: 6px; border-width: 0 1px 1px 0; }

.board-frame.is-night {
  --board-paper: #1F2C29;
  --board-line: #35433E;
  --board-ink: #D9D0BF;
  --road: #2B3935;
  --road-line: #455651;
  --tree: #3D584C;
  --tree-dark: #2C453B;
  --water: #274440;
  --water-line: #3D5C56;
  --platform-edge: #31413C;
  --label-paper: #24322E;
  --label-ink: #EDE5D6;
  --label-sub: #A8B5AE;
  --tag-paper: #2A3834;
  --tag-ink: #F0E8D8;
  --night-overlay: 1;
}
.board-frame.is-night .board-inner { background: #1A2522; }
.board-frame.is-night .b-faces { filter: brightness(0.72) saturate(0.85); }
.board-frame.is-night .b-shadow { opacity: 0.4; }
.board-frame.is-night .stars { opacity: 1; }
.board-frame.is-night .b-window { fill: var(--window-night); opacity: 0.88; }
.board-frame.is-night .board-cloud { opacity: 0.08; }

.board-inner {
  position: relative;
  border-radius: 2px;
  overflow: hidden;
  background: var(--board-paper);
  transition: background 0.6s ease;
}
.city-viewport {
  position: relative;
  width: 100%;
  aspect-ratio: 1600 / 1000;
  overflow: hidden;
  cursor: grab;
  touch-action: none;
  background:
    radial-gradient(120% 90% at 20% 0%, rgba(255, 255, 255, 0.45), transparent 55%),
    var(--board-paper);
  transition: background 0.6s ease;
}
.city-viewport.is-dragging { cursor: grabbing; }
.city-stage {
  position: absolute;
  inset: 0;
  transform-origin: 50% 50%;
  will-change: transform;
  transition: transform 0.28s cubic-bezier(.2,.8,.2,1);
}
.city-viewport.is-dragging .city-stage { transition: none; }
#city-svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.city-labels { position: absolute; inset: 0; pointer-events: none; }
.city-labels > * { pointer-events: auto; }

.board-base { fill: var(--board-paper); transition: fill 0.6s ease; }
.board-grid line { stroke: var(--board-line); stroke-width: 1; opacity: 0.35; }
.board-contour { fill: none; stroke: var(--board-line); stroke-width: 1; opacity: 0.28; }
.board-cloud { fill: #FFFCF4; opacity: 0.65; transition: opacity 0.6s ease; }
.stars { opacity: 0; transition: opacity 0.8s ease; }
.stars circle { fill: #F2E4C4; }
.moon { opacity: 0; transition: opacity 0.8s ease; }
.is-night .moon { opacity: 0.9; }
.sun-disc { transition: opacity 0.8s ease; }
.is-night .sun-disc { opacity: 0; }
.road { stroke: var(--road); stroke-width: 44; stroke-linecap: round; fill: none; transition: stroke 0.6s ease; }
.road-line { stroke: var(--road-line); stroke-width: 1.2; stroke-dasharray: 7 13; fill: none; opacity: 0.8; }
.water { fill: var(--water); transition: fill 0.6s ease; }
.water-line { fill: none; stroke: var(--water-line); stroke-width: 1.2; opacity: 0.7; }
.tree-canopy { fill: var(--tree); transition: fill 0.6s ease; }
.tree-canopy-2 { fill: var(--tree-dark); transition: fill 0.6s ease; }
.tree-trunk { fill: #8E7655; }
.platform-top { stroke: var(--platform-edge); stroke-width: 1; transition: stroke 0.6s ease; }
.platform-side { stroke: rgba(70, 58, 40, 0.08); stroke-width: 1; }
.platform-label-line { stroke: var(--board-ink); stroke-width: 1; opacity: 0.35; }
.b-faces { transition: filter 0.6s ease; }
.b-outline { stroke: rgba(64, 52, 36, 0.18); stroke-width: 1; }
.b-roof-strip { opacity: 0.85; }
.b-window { fill: var(--window-day); opacity: 0.5; transition: fill 0.6s ease, opacity 0.6s ease; }
.b-awning { opacity: 0.9; }
.b-shadow { fill: rgba(60, 48, 30, 0.12); transition: opacity 0.6s ease; }
.building { cursor: pointer; }
.building:hover .b-faces { filter: brightness(1.035); }
.building:hover .b-shadow { opacity: 0.2; }
.building.is-hover .b-faces { filter: brightness(1.035); }
.plaza-fountain { fill: var(--water); stroke: var(--water-line); }
.plaza-stone { fill: var(--platform-edge); }
.plaza-flag { fill: var(--seal); opacity: 0.85; }
.plaza-bulletin { fill: #F7F0E0; stroke: rgba(64,52,36,.2); }
.plaza-note { fill: #F0D7B4; stroke: rgba(120, 90, 50, 0.2); }
.compass-ring { fill: none; stroke: var(--board-ink); stroke-width: 1; opacity: 0.45; }
.compass-text { fill: var(--board-ink); font-family: var(--mono); font-size: 10px; opacity: 0.7; }
.map-cartouche { fill: var(--label-paper); stroke: var(--line-strong); stroke-width: 1; }
.map-title { font-family: var(--serif); font-weight: 600; fill: var(--label-ink); }
.map-sub { font-family: var(--mono); fill: var(--label-sub); font-size: 9px; letter-spacing: 0.05em; }
.map-scale { stroke: var(--board-ink); stroke-width: 1; opacity: 0.5; }

.is-night .city-label {
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.35);
}

/* district chip */
.district-chip {
  position: absolute;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  min-height: 44px;
  padding: 5px 12px 5px 6px;
  background: var(--label-paper);
  border: 1px solid var(--line-strong);
  border-left: 3px solid var(--chip-accent, var(--teal));
  border-radius: var(--r-sm);
  box-shadow: 0 5px 14px rgba(60, 48, 29, 0.14);
  color: var(--label-ink);
  text-align: left;
  cursor: pointer;
  transform: translateY(-100%);
  transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.6s ease;
  white-space: nowrap;
  z-index: 4;
}
.district-chip:hover { transform: translateY(calc(-100% - 3px)); box-shadow: 0 10px 24px rgba(60, 48, 29, 0.16); }
.district-chip img { width: 30px; height: 30px; object-fit: contain; flex: none; }
.district-chip .chip-text { display: flex; flex-direction: column; line-height: 1.25; }
.district-chip strong { font-family: var(--serif); font-size: 14px; font-weight: 600; letter-spacing: 0.01em; }
.district-chip small {
  font-family: var(--mono);
  font-size: 9px;
  color: var(--label-sub);
  letter-spacing: 0.03em;
  margin-top: 2px;
}

/* merchant tag */
.merchant-tag {
  position: absolute;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 26px;
  padding: 0 10px;
  border: 1px solid var(--line-strong);
  background: var(--tag-paper);
  color: var(--tag-ink);
  border-radius: 999px;
  font-size: 12px;
  line-height: 1;
  white-space: nowrap;
  box-shadow: 0 4px 10px rgba(60, 48, 29, 0.13);
  transform: translate(-50%, 0);
  transition: background 0.18s ease, color 0.18s ease, transform 0.18s ease, box-shadow 0.18s ease;
  z-index: 3;
}
.merchant-tag::before {
  content: '';
  width: 5px; height: 5px;
  border-radius: 50%;
  background: var(--ok);
  flex: none;
}
.merchant-tag:hover { transform: translate(-50%, -2px); background: var(--ink); color: var(--paper-card); border-color: var(--ink); box-shadow: var(--shadow-sm); }
.merchant-tag:hover::before { background: #A9D3B0; }
.merchant-tag.is-closed { color: var(--ink-3); }
.merchant-tag.is-closed::before { background: var(--ink-3); }
.merchant-tag .tag-star { color: var(--gold); font-size: 9px; }
.merchant-tag .tag-more { font-family: var(--mono); font-size: 9px; color: var(--ink-3); background: var(--paper-2); border-radius: 999px; padding: 1px 5px; margin-left: 2px; }
.merchant-tag:hover .tag-more { color: var(--paper-card); background: rgba(251,248,241,.16); }
.merchant-tag.primary-tag { z-index: 4; }

/* hover card */
.city-tooltip {
  position: absolute;
  width: 250px;
  background: var(--paper-card);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  box-shadow: var(--shadow-lg);
  padding: 14px;
  z-index: 8;
  transform: translate(-50%, -100%);
  pointer-events: auto;
  animation: tip-in 0.16s ease;
}
@keyframes tip-in { from { opacity: 0; transform: translate(-50%, calc(-100% + 4px)); } to { opacity: 1; transform: translate(-50%, -100%); } }
.city-tooltip::after {
  content: '';
  position: absolute;
  left: 50%; bottom: -5px;
  width: 8px; height: 8px;
  background: var(--paper-card);
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  transform: translateX(-50%) rotate(45deg);
}
.city-tooltip .tt-head { display: flex; gap: 10px; align-items: flex-start; }
.city-tooltip .tt-head img { width: 38px; height: 38px; object-fit: contain; flex: none; }
.city-tooltip .tt-head strong { font-family: var(--serif); font-size: 16px; line-height: 1.3; display: block; }
.city-tooltip .tt-head span { font-size: 11px; color: var(--ink-3); display: block; margin-top: 2px; }
.city-tooltip p { font-size: 12px; line-height: 1.6; color: var(--ink-2); margin: 10px 0; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.city-tooltip .tt-tags { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 10px; }
.city-tooltip .tt-tags span { font-size: 10.5px; padding: 1px 6px; border-radius: 999px; background: var(--paper-2); color: var(--ink-2); }
.city-tooltip .tt-actions { display: flex; gap: 8px; align-items: center; border-top: 1px solid var(--line); padding-top: 9px; }
.city-tooltip .tt-actions a { font-size: 11.5px; color: var(--teal); }
.city-tooltip .tt-actions a:hover { text-decoration: underline; }
.city-tooltip .tt-actions .mono { margin-left: auto; font-size: 9px; color: var(--ink-3); }

/* board caption */
.board-caption {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 10px 4px 0;
  font-family: var(--mono);
  font-size: 9.5px;
  color: var(--ink-3);
  letter-spacing: 0.02em;
}
.board-caption span:last-child { text-align: right; }

/* mobile city index */
.city-index { display: none; }
@media (max-width: 860px) {
  .board-frame { padding: 8px; }
  .city-viewport { display: none; }
  .city-index { display: grid; grid-template-columns: 1fr; gap: 10px; padding: 8px; }
  .board-caption { padding: 10px 8px 2px; }
  .board-caption span:last-child { display: none; }
  .zone-card {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 13px;
    background: var(--paper-card);
    border: 1px solid var(--line);
    border-radius: var(--r-sm);
    text-align: left;
    width: 100%;
  }
  .zone-card:hover { background: var(--paper-2); }
  .zone-card img { width: 44px; height: 44px; object-fit: contain; flex: none; }
  .zone-card .zc-text { flex: 1 1 auto; min-width: 0; }
  .zone-card strong { display: block; font-family: var(--serif); font-size: 16px; }
  .zone-card small { display: block; color: var(--ink-3); font-size: 11.5px; margin-top: 2px; }
  .zone-card .zc-count { font-family: var(--mono); font-size: 11px; color: var(--ink-3); flex: none; }
  .zone-merchants { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 6px; }
  .zone-merchants span { font-size: 10.5px; background: var(--paper-2); border-radius: 999px; padding: 1px 7px; color: var(--ink-2); }
}

/* ---------- ledger ---------- */
.pulse-ledger { margin-top: 34px; }
.ledger-panel {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  border: 1px solid var(--line);
  background: var(--paper-card);
  border-radius: var(--r-sm);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}
.ledger-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  border-right: 1px solid var(--line);
}
.ledger-stat {
  padding: 24px 22px 22px;
  border-right: 1px solid var(--line);
  position: relative;
}
.ledger-stat:last-child { border-right: 0; }
.ledger-stat .stat-label { font-size: 12px; color: var(--ink-3); display: flex; align-items: center; gap: 6px; }
.ledger-stat .stat-value {
  font-size: clamp(34px, 4vw, 48px);
  font-weight: 600;
  line-height: 1.05;
  letter-spacing: -0.03em;
  margin-top: 12px;
  font-variant-numeric: tabular-nums;
}
.ledger-stat .stat-value small { font-size: 15px; color: var(--ink-3); font-weight: 400; margin-left: 4px; letter-spacing: 0; }
.ledger-stat .stat-note { font-size: 11.5px; color: var(--ink-3); margin-top: 8px; line-height: 1.5; }
.ledger-chart { padding: 20px 24px; display: flex; flex-direction: column; justify-content: space-between; gap: 8px; }
.ledger-chart .chart-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.ledger-chart .chart-head strong { font-size: 13px; font-weight: 500; color: var(--ink-2); }
.ledger-chart .chart-head span { font-family: var(--mono); font-size: 10px; color: var(--ink-3); }
.spark-wrap { position: relative; height: 86px; }
.spark-wrap svg { width: 100%; height: 100%; overflow: visible; }
.spark-line { fill: none; stroke: var(--teal); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.spark-area { fill: rgba(39, 71, 67, 0.10); }
.spark-dot { fill: var(--seal); stroke: var(--paper-card); stroke-width: 2; }
.spark-label { font-family: var(--sans); font-size: 10px; fill: var(--ink-3); }
.spark-tip {
  position: absolute;
  transform: translate(-50%, -130%);
  background: var(--ink);
  color: var(--paper-card);
  font-size: 10.5px;
  padding: 4px 8px;
  border-radius: 3px;
  pointer-events: none;
  white-space: nowrap;
  opacity: 0;
  transition: opacity 0.12s ease;
}
.spark-tip.is-on { opacity: 1; }
.heat-strip {
  display: grid;
  grid-template-columns: repeat(10, 1fr);
  border-top: 1px solid var(--line);
  grid-column: 1 / -1;
}
.heat-item {
  padding: 14px 16px 16px;
  border-right: 1px solid var(--line);
  min-width: 0;
}
.heat-item:last-child { border-right: 0; }
.heat-item .heat-top { display: flex; align-items: center; gap: 6px; font-size: 11.5px; color: var(--ink-2); white-space: nowrap; }
.heat-item .heat-top span { overflow: hidden; text-overflow: ellipsis; }
.heat-item .heat-top .dot { background: var(--heat-accent); }
.heat-track { height: 5px; background: var(--paper-2); border-radius: 999px; margin-top: 10px; overflow: hidden; }
.heat-fill { height: 100%; background: var(--teal); border-radius: 999px; transition: width 0.8s cubic-bezier(.2,.8,.2,1); }
.heat-item .heat-value { font-family: var(--mono); font-size: 10px; color: var(--ink-3); margin-top: 6px; }

@media (max-width: 1180px) {
  .ledger-panel { grid-template-columns: 1fr; }
  .ledger-stats { border-right: 0; border-bottom: 1px solid var(--line); }
  .heat-strip { grid-template-columns: repeat(5, 1fr); }
  .heat-item:nth-child(5n) { border-right: 0; }
  .heat-item:nth-child(-n+5) { border-bottom: 1px solid var(--line); }
}
@media (max-width: 640px) {
  .ledger-stats { grid-template-columns: 1fr; }
  .ledger-stat { border-right: 0; border-bottom: 1px solid var(--line); }
  .ledger-stat:last-child { border-bottom: 0; }
  .heat-strip { grid-template-columns: repeat(2, 1fr); }
  .heat-item:nth-child(2n) { border-right: 0; }
  .heat-item:nth-child(-n+8) { border-bottom: 1px solid var(--line); }
}

/* ---------- machine strip ---------- */
.machine-strip {
  margin-top: 72px;
  background: var(--ink);
  color: #EDE4D2;
  position: relative;
  overflow: hidden;
}
.machine-strip::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(237, 228, 210, 0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(237, 228, 210, 0.045) 1px, transparent 1px);
  background-size: 36px 36px;
  pointer-events: none;
}
.machine-inner { padding: 54px 0 58px; position: relative; }
.machine-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 28px;
}
.machine-head h2 { color: #F3EAD8; font-size: clamp(26px, 2.8vw, 38px); }
.machine-head p { color: #A99F8D; font-size: 13.5px; margin: 8px 0 0; max-width: 56ch; }
.machine-head .mono { color: #8E8575; font-size: 10px; }
.machine-files {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1px;
  background: rgba(237, 228, 210, 0.16);
  border: 1px solid rgba(237, 228, 210, 0.16);
}
.file-card {
  background: var(--ink);
  padding: 20px 18px 18px;
  position: relative;
  min-height: 152px;
  display: flex;
  flex-direction: column;
  transition: background 0.2s ease;
}
.file-card:hover { background: #2A2822; }
.file-card .file-kind {
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.04em;
  color: #8E8575;
  display: flex;
  align-items: center;
  gap: 6px;
}
.file-card .file-kind svg { width: 12px; height: 12px; }
.file-card h3 { color: #F1E7D5; font-size: 16px; margin: 14px 0 4px; font-family: var(--sans); font-weight: 500; }
.file-card p { color: #A99F8D; font-size: 12px; line-height: 1.6; margin: 0 0 14px; }
.file-card .file-path {
  margin-top: auto;
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--mono);
  font-size: 10.5px;
  color: #D9CDB7;
}
.file-card .file-path .copy-mini {
  margin-left: auto;
  border: 1px solid rgba(237, 228, 210, 0.2);
  background: transparent;
  color: #B9AE9A;
  border-radius: 2px;
  width: 24px; height: 24px;
  display: inline-flex; align-items: center; justify-content: center;
}
.file-card .file-path .copy-mini:hover { background: rgba(237, 228, 210, 0.1); color: #F1E7D5; }
.machine-foot {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-top: 16px;
  color: #8E8575;
  font-family: var(--mono);
  font-size: 9.5px;
}
.machine-foot a { color: #C6BAA5; }
.machine-foot a:hover { color: #F1E7D5; text-decoration: underline; }
@media (max-width: 1000px) {
  .machine-files { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 560px) {
  .machine-head { flex-direction: column; align-items: flex-start; }
  .machine-files { grid-template-columns: 1fr; }
  .file-card { min-height: 132px; }
  .machine-foot { flex-direction: column; }
}

/* ---------- manual ---------- */
.city-manual { padding: 76px 0 10px; }
.manual-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0;
  border-top: 1px solid var(--line);
}
.manual-card {
  padding: 28px 28px 30px 0;
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  min-height: 230px;
}
.manual-card + .manual-card { padding-left: 28px; }
.manual-card:last-child { border-right: 0; padding-right: 0; }
.manual-card .manual-icon {
  width: 42px; height: 42px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--paper-2);
  color: var(--teal);
  margin-bottom: 20px;
}
.manual-card:nth-child(2) .manual-icon { color: var(--seal); background: var(--seal-soft); }
.manual-card:nth-child(3) .manual-icon { color: var(--gold); background: var(--warn-soft); }
.manual-card h3 { font-size: 22px; margin-bottom: 10px; }
.manual-card p { color: var(--ink-2); font-size: 13.5px; line-height: 1.8; margin: 0 0 20px; max-width: 40ch; }
.manual-card .manual-link {
  margin-top: auto;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 13px;
  color: var(--teal);
  font-weight: 500;
}
.manual-card .manual-link:hover { text-decoration: underline; text-underline-offset: 4px; }
.manual-card .manual-link svg { width: 14px; height: 14px; }
@media (max-width: 1180px) {
  .manual-grid { grid-template-columns: repeat(2, 1fr); }
  .manual-card:nth-child(2) { border-right: 0; }
  .manual-card:nth-child(-n+2) { border-bottom: 1px solid var(--line); }
}
@media (max-width: 860px) {
  .manual-grid { grid-template-columns: 1fr; }
  .manual-card { border-right: 0; border-bottom: 1px solid var(--line); padding: 24px 0; min-height: 0; }
  .manual-card + .manual-card { padding-left: 0; }
  .manual-card:last-child { border-bottom: 0; }
}

/* ---------- guide ---------- */
.guide-fab {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 70;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 6px 16px 6px 7px;
  background: var(--paper-card);
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  box-shadow: var(--shadow);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.guide-fab:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.guide-fab img { width: 42px; height: 42px; object-fit: contain; }
.guide-fab .fab-label { text-align: left; line-height: 1.25; }
.guide-fab strong { display: block; font-size: 13px; font-weight: 600; }
.guide-fab span { display: block; font-size: 10px; color: var(--ink-3); margin-top: 1px; }
.guide-fab .fab-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--ok);
  box-shadow: 0 0 0 3px rgba(76, 122, 91, 0.16);
  margin-left: 2px;
}

.guide-panel {
  position: fixed;
  right: 24px;
  bottom: 24px;
  width: min(410px, calc(100vw - 32px));
  height: min(640px, calc(100vh - 48px));
  z-index: 120;
  background: var(--paper-card);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform: translateY(16px) scale(0.98);
  opacity: 0;
  pointer-events: none;
  transition: transform 0.28s cubic-bezier(.2,.8,.2,1), opacity 0.24s ease;
}
.guide-panel.is-on { transform: none; opacity: 1; pointer-events: auto; }
.guide-head {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  background: var(--teal);
  color: var(--paper-card);
}
.guide-head img { width: 40px; height: 40px; object-fit: contain; background: rgba(251,248,241,.12); border-radius: 50%; padding: 2px; }
.guide-head .guide-title { flex: 1 1 auto; min-width: 0; }
.guide-head strong { display: block; font-family: var(--serif); font-size: 16px; font-weight: 600; }
.guide-head span { display: block; font-size: 10.5px; color: rgba(251, 248, 241, 0.66); margin-top: 1px; }
.guide-head .icon-btn { border-color: rgba(251,248,241,.22); background: transparent; color: var(--paper-card); width: 32px; height: 32px; }
.guide-head .icon-btn:hover { background: rgba(251,248,241,.12); color: var(--paper-card); }
.guide-stream {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 16px;
  background:
    linear-gradient(rgba(216, 206, 188, 0.14) 1px, transparent 1px);
  background-size: 100% 28px;
}
.guide-msg { display: flex; gap: 9px; margin-bottom: 14px; align-items: flex-start; }
.guide-msg .gm-avatar { width: 28px; height: 28px; border-radius: 50%; object-fit: contain; background: var(--paper-2); border: 1px solid var(--line); flex: none; }
.guide-msg .gm-body { max-width: 84%; }
.guide-msg .gm-name { font-size: 10px; color: var(--ink-3); margin-bottom: 4px; }
.guide-bubble {
  background: var(--paper-card);
  border: 1px solid var(--line);
  border-radius: 2px 10px 10px 10px;
  padding: 10px 12px;
  font-size: 13px;
  line-height: 1.75;
  color: var(--ink-2);
  box-shadow: 0 2px 6px rgba(60, 48, 29, 0.05);
}
.guide-bubble p { margin: 0 0 6px; }
.guide-bubble p:last-child { margin-bottom: 0; }
.guide-bubble ul { margin: 4px 0 6px; padding-left: 16px; list-style: disc; }
.guide-bubble li { margin-bottom: 3px; }
.guide-bubble code { font-family: var(--mono); font-size: 11px; background: var(--paper-2); padding: 1px 4px; border-radius: 2px; }
.guide-msg.is-user { flex-direction: row-reverse; }
.guide-msg.is-user .gm-body { display: flex; flex-direction: column; align-items: flex-end; }
.guide-msg.is-user .gm-name { text-align: right; }
.guide-msg.is-user .guide-bubble {
  background: var(--teal);
  color: var(--paper-card);
  border-color: var(--teal);
  border-radius: 10px 2px 10px 10px;
}
.guide-cards { display: grid; gap: 7px; margin-top: 9px; }
.guide-card {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px;
  border: 1px solid var(--line);
  background: var(--paper-card);
  border-radius: var(--r-xs);
  text-align: left;
  width: 100%;
}
.guide-card:hover { background: var(--paper-2); }
.guide-card img { width: 30px; height: 30px; object-fit: contain; flex: none; }
.guide-card .gc-text { flex: 1 1 auto; min-width: 0; }
.guide-card strong { display: block; font-size: 12.5px; font-weight: 500; }
.guide-card span { display: block; font-size: 10px; color: var(--ink-3); margin-top: 1px; }
.guide-card .gc-arrow { color: var(--ink-3); flex: none; }
.guide-prompts {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 0 16px 12px;
}
.guide-prompts button {
  border: 1px solid var(--line);
  background: var(--paper-card);
  border-radius: 999px;
  font-size: 11.5px;
  padding: 5px 10px;
  color: var(--ink-2);
}
.guide-prompts button:hover { background: var(--paper-2); color: var(--ink); }
.guide-inputbar {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 12px 14px;
  border-top: 1px solid var(--line);
  background: var(--paper-card);
}
.guide-inputbar textarea {
  flex: 1 1 auto;
  min-height: 40px;
  max-height: 110px;
  resize: none;
  border: 1px solid var(--line);
  background: #FFFDF8;
  border-radius: var(--r-sm);
  padding: 9px 11px;
  font-size: 13px;
  line-height: 1.55;
  outline: 0;
}
.guide-inputbar textarea:focus { border-color: var(--teal); box-shadow: 0 0 0 3px rgba(39,71,67,.08); }
.guide-inputbar button[type="submit"] {
  width: 40px; height: 40px;
  border: 0;
  border-radius: var(--r-sm);
  background: var(--teal);
  color: var(--paper-card);
  display: inline-flex; align-items: center; justify-content: center;
  flex: none;
}
.guide-inputbar button[type="submit"]:hover { background: var(--teal-2); }
.guide-inputbar button[type="submit"]:disabled { opacity: 0.5; }
.guide-meta {
  padding: 8px 16px;
  border-top: 1px dashed var(--line);
  font-size: 9.5px;
  color: var(--ink-3);
  display: flex;
  justify-content: space-between;
  gap: 10px;
}
.guide-meta .mono { font-size: 9px; }
@media (max-width: 560px) {
  .guide-fab { right: 14px; bottom: 14px; padding-right: 13px; }
  .guide-fab span { display: none; }
  .guide-fab img { width: 38px; height: 38px; }
  .guide-panel {
    right: 0; bottom: 0;
    width: 100%;
    height: calc(100vh - 20px);
    height: calc(100dvh - 20px);
    border-radius: var(--r-md) var(--r-md) 0 0;
  }
}

/* ---------- district drawer ---------- */
.zone-head {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  margin-bottom: 20px;
}
.zone-head img { width: 56px; height: 56px; object-fit: contain; flex: none; }
.zone-head h3 { font-size: 24px; }
.zone-head .zone-code { font-family: var(--mono); font-size: 10px; color: var(--ink-3); margin-top: 3px; }
.zone-head p { font-size: 13px; color: var(--ink-2); line-height: 1.75; margin: 10px 0 0; }
.zone-list { display: flex; flex-direction: column; gap: 10px; }
.zone-merchant {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--paper-card);
  transition: border-color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
  text-align: left;
  width: 100%;
}
.zone-merchant:hover { border-color: var(--line-strong); box-shadow: var(--shadow-sm); transform: translateY(-1px); }
.zone-merchant img { width: 46px; height: 46px; object-fit: contain; flex: none; }
.zone-merchant .zm-body { flex: 1 1 auto; min-width: 0; }
.zone-merchant .zm-name { display: flex; align-items: center; gap: 8px; font-family: var(--serif); font-size: 16px; font-weight: 600; }
.zone-merchant .zm-sub { font-size: 11.5px; color: var(--ink-3); margin-top: 2px; }
.zone-merchant .zm-tags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 8px; }
.zone-merchant .zm-tags span { font-size: 10px; background: var(--paper-2); padding: 1px 6px; border-radius: 999px; color: var(--ink-2); }
.zone-merchant .zm-agent { font-size: 10.5px; color: var(--teal); margin-top: 8px; display: flex; align-items: center; gap: 5px; }
.zone-merchant .zm-agent::before { content: ''; width: 5px; height: 5px; border-radius: 50%; background: var(--ok); }
.zone-merchant .zm-go { font-size: 11px; color: var(--ink-3); flex: none; align-self: center; }
.zone-foot { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line); display: flex; gap: 8px; flex-wrap: wrap; }
.zone-foot a { font-family: var(--mono); font-size: 10.5px; color: var(--ink-2); padding: 6px 8px; background: var(--paper-2); border-radius: 2px; }
.zone-foot a:hover { background: var(--paper-3); }

/* ---------- plaza drawer ---------- */
.plaza-note-card {
  padding: 16px;
  border: 1px solid var(--line);
  background: var(--paper-card);
  border-radius: var(--r-sm);
  margin-bottom: 10px;
}
.plaza-note-card h3 { font-size: 17px; margin-bottom: 5px; }
.plaza-note-card p { font-size: 12.5px; color: var(--ink-2); line-height: 1.7; margin: 0; }
.plaza-note-card .meta { font-size: 10.5px; color: var(--ink-3); margin-top: 8px; display: flex; gap: 10px; }

/* ---------- responsive board note ---------- */
@media (prefers-reduced-motion: reduce) {
  .city-stage { transition: none; }
}

/* load sequence — buildings rise once */
.b-group { opacity: 0; transform: translateY(16px); }
.city-stage.is-loaded .b-group {
  opacity: 1;
  transform: none;
  transition: opacity 0.55s ease, transform 0.8s cubic-bezier(.2,.8,.2,1);
  transition-delay: var(--d, 0ms);
}
@media (prefers-reduced-motion: reduce) {
  .b-group, .city-stage.is-loaded .b-group { opacity: 1; transform: none; transition: none; }
}
.plaza-mascot { transform-box: fill-box; transform-origin: bottom center; animation: mascot-bob 4.5s ease-in-out infinite; }
@keyframes mascot-bob { 0%,100% { transform: translateY(0) rotate(0); } 50% { transform: translateY(-3px) rotate(-1.2deg); } }

.road-under { stroke: var(--board-line); stroke-width: 50; fill: none; opacity: .32; stroke-linecap: round; }
.lamp-glow { fill: #F3C77A; opacity: 0; transition: opacity .6s ease; }
.board-frame.is-night .lamp-glow { opacity: .5; }
.board-frame.is-night .b-window { fill: #F3C77A; opacity: .92; }

/* ---------- scalable map: agent kiosks & directory ---------- */
.merchant-tag { max-width: 142px; overflow: hidden; text-overflow: ellipsis; }
.merchant-tag.is-agent::before { background: var(--teal); box-shadow: 0 0 0 3px rgba(39,71,67,.12); }
.merchant-tag.is-agent { border-color: rgba(39,71,67,.35); }
.merchant-tag.special-tag { background: var(--ink); color: var(--paper-card); border-color: var(--ink); }
.merchant-tag.special-tag::before { background: var(--gold); }
.merchant-tag.special-tag:hover { background: var(--seal); border-color: var(--seal); }
.agent-kiosk { cursor: pointer; }
.agent-kiosk:hover .b-faces, .agent-kiosk:hover circle { filter: brightness(1.03); }
.special-zone { cursor: pointer; }
.special-zone:hover { filter: brightness(1.02); }
.dir-tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin: 4px 0 12px; }
.dir-tabs button { border: 0; background: none; padding: 8px 10px; font-size: 12px; color: var(--ink-3); border-bottom: 2px solid transparent; margin-bottom: -1px; }
.dir-tabs button:hover { color: var(--ink); }
.dir-tabs button.is-active { color: var(--ink); border-bottom-color: var(--seal); }
.dir-search { margin-bottom: 10px; }
.dir-search .input { width: 100%; }
.dir-list { display: flex; flex-direction: column; gap: 8px; }
.dir-list .zone-merchant { width: 100%; }
.dir-more { display: flex; justify-content: center; padding: 14px 0 4px; }
.dir-more .btn[hidden] { display: none; }

@media (max-width: 980px) { .city-dir-btn { display: none; } }
