/* ============================================================
   ZELTEZ v2 — "Obsidian Terminal"
   Deep-ink glass surfaces, aurora emerald→cyan brand gradient,
   price-tier colored map pills (Hogangnono-grade visibility).
   v1 backup lives in /v1-backup. All v1 class names preserved.
   ============================================================ */

:root {
  --canvas:      #07090d;   /* page — deep blue-black ink */
  --paper:       rgba(18, 21, 28, 0.86);   /* glass card */
  --paper-solid: #12151c;
  --wash:        #1a1e27;   /* hover / track / inset */
  --wash-2:      #1a1e27;

  --ink:         #f5f6f8;
  --ink-2:       #a6acb9;
  --ink-3:       #8b91a0;
  --ink-4:       #6b7180;

  --rule:        #232936;   /* hairline */
  --rule-2:      #303849;

  --accent:      #2ee59d;   /* aurora emerald */
  --accent-2:    #1fc8e3;   /* cyan end of the brand gradient */
  --accent-ink:  #19b87b;
  --accent-wash: rgba(46, 229, 157, 0.12);
  --brand-grad:  linear-gradient(135deg, #2ee59d 0%, #1fc8e3 100%);

  --pos:         #2ee59d;
  --pos-wash:    rgba(46, 229, 157, 0.12);
  --neg:         #ff6b61;
  --neg-wash:    rgba(255, 107, 97, 0.12);
  --gold:        #ecc35c;

  /* price-tier ramp (t0 affordable → t4 luxury) */
  --t0: #2ee59d;  --t0-bg: #0c211a;  --t0-bd: #1d5c43;
  --t1: #8be94f;  --t1-bg: #16210c;  --t1-bd: #45641f;
  --t2: #f3c44d;  --t2-bg: #251d0a;  --t2-bd: #6e591f;
  --t3: #ff9447;  --t3-bg: #28160a;  --t3-bd: #7a4520;
  --t4: #ff6b9d;  --t4-bg: #260d18;  --t4-bd: #76264a;

  --shadow-sm:  0 1px 2px rgba(0, 0, 0, 0.5);
  --shadow-md:  0 10px 28px -10px rgba(0, 0, 0, 0.66), 0 1px 3px rgba(0, 0, 0, 0.5);
  --shadow-pop: 0 24px 48px -16px rgba(0, 0, 0, 0.75), 0 0 0 1px rgba(255,255,255,0.02);
}

* { border-color: var(--rule); }

body {
  background: var(--canvas);
  color: var(--ink);
  font-family: 'Inter', ui-sans-serif, system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

.font-display {
  font-family: 'Fraunces', Georgia, 'Times New Roman', serif;
  font-optical-sizing: auto;
  letter-spacing: -0.01em;
}

/* ---- semantic color utilities ---- */
.bg-canvas { background: var(--canvas); }
.bg-paper  { background: var(--paper); }
.bg-wash   { background: var(--wash); }
.text-ink  { color: var(--ink); }
.text-ink-2{ color: var(--ink-2); }
.text-muted{ color: var(--ink-3); }
.text-accent{ color: var(--accent); }
.text-pos  { color: var(--pos); }
.text-neg  { color: var(--neg); }
.rule      { border-color: var(--rule); }

/* ---- Glass panels ---- */
.panel {
  background: var(--paper);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  border: 1px solid var(--rule);
  border-radius: 16px;
  box-shadow: var(--shadow-sm);
}

/* ---- Market list rows ---- */
.market-row {
  display: grid;
  grid-template-columns: 1fr 78px 66px 46px;
  align-items: center;
  padding: 9px 12px;
  font-size: 12.5px;
  line-height: 1.15;
  border-bottom: 1px solid var(--rule);
  transition: background .1s ease;
  cursor: pointer;
}
.market-row:last-child { border-bottom: none; }
.market-row .name { font-weight: 500; color: var(--ink); }
.market-row:hover { background: var(--wash); }
.market-row.active {
  background: var(--accent-wash);
  box-shadow: inset 3px 0 0 var(--accent);
}

/* ---- Change pills ---- */
.change-pill {
  font-weight: 600;
  letter-spacing: -.2px;
  padding: 1.5px 7px;
  border-radius: 6px;
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.pill-pos { background: var(--pos-wash); color: var(--pos); }
.pill-neg { background: var(--neg-wash); color: var(--neg); }

/* ---- Segmented tabs ---- */
.modern-tab {
  text-align: center;
  padding: 5px 12px;
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-3);
  border-radius: 8px;
  transition: all .12s cubic-bezier(.4, 0, .2, 1);
}
.modern-tab.active {
  background: #2b3242;
  color: var(--ink);
  box-shadow: var(--shadow-sm);
}

/* ---- Insight cards ---- */
.insight-card {
  background: rgba(26, 30, 39, 0.65);
  border: 1px solid var(--rule);
  border-radius: 12px;
  padding: 10px 12px;
  transition: border-color .12s ease, box-shadow .12s ease, transform .12s ease;
}
.insight-card:hover { border-color: var(--rule-2); transform: translateY(-1px); }

/* ---- Editorial eyebrow ---- */
.section-title {
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  background: var(--brand-grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

/* ---- Map ---- */
#marketMap { background: #0d1016; position: fixed; inset: 0; z-index: 0; }

.map-ticker {
  background: var(--paper);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  border: 1px solid var(--rule);
  border-radius: 12px;
  padding: 8px 12px;
  box-shadow: var(--shadow-md);
}

/* ---- Chart terminal ---- */
.chart-terminal {
  background: #0e1117;
  border: 1px solid var(--rule);
  border-radius: 13px;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.025), var(--shadow-sm);
}
#priceChart a[href*="tradingview"],
#priceChart #tv-attr-logo { display: none !important; }

/* ---- Time-range buttons ---- */
.time-btn {
  font-size: 11px;
  padding: 4px 10px;
  border-radius: 7px;
  font-weight: 600;
  color: var(--ink-3);
  transition: all .12s ease;
}
.time-btn.active { background: var(--brand-grad); color: #04110b; box-shadow: var(--shadow-sm); }
.time-btn:hover:not(.active) { background: var(--wash); color: var(--ink); }

/* ---- Inputs ---- */
input[type="text"] {
  background: var(--wash-2);
  border: 1px solid var(--rule);
  color: var(--ink);
  transition: all .12s ease;
}
input[type="text"]:focus {
  background: #0c0f15;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-wash);
}

button:focus-visible,
[tabindex]:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 8px;
}

.star { transition: color .12s ease; }

/* ---- Scrollbar ---- */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb {
  background: #323a4b;
  border: 3px solid var(--paper-solid);
  border-radius: 99px;
}
::-webkit-scrollbar-thumb:hover { background: #424b60; }
::-webkit-scrollbar-track { background: transparent; }

/* ============================================================
   Map shell: floating glass UI
   ============================================================ */

/* Search dock — brand wordmark + search */
.search-bar {
  display: flex; align-items: center; gap: 6px;
  height: 46px; padding: 0 10px;
  background: var(--paper);
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
  border: 1px solid var(--rule);
  border-radius: 15px;
  box-shadow: var(--shadow-md);
  transition: border-color .15s ease, box-shadow .15s ease;
}
.search-bar:focus-within {
  border-color: rgba(46, 229, 157, 0.45);
  box-shadow: 0 0 0 3px var(--accent-wash), var(--shadow-md);
}
.search-bar input {
  flex: 1; min-width: 0;
  background: transparent; border: none; outline: none;
  color: var(--ink); font-size: 13.5px;
}
.search-bar input:focus { box-shadow: none; border: none; background: transparent; }
.search-bar input::placeholder { color: var(--ink-3); }
.brand-z {
  width: 28px; height: 28px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  background: var(--brand-grad);
  border-radius: 9px;
  color: #04110b; font-weight: 700; font-size: 16px;
  box-shadow: 0 2px 10px rgba(46, 229, 157, 0.35);
}
.brand-name {
  font-size: 13.5px; font-weight: 600; letter-spacing: 2px;
  background: linear-gradient(135deg, #f5f6f8 30%, #8b91a0 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  flex-shrink: 0; padding-right: 2px; user-select: none;
}

/* live coverage chip */
.live-dot {
  width: 7px; height: 7px; border-radius: 99px; flex-shrink: 0;
  background: var(--accent);
  box-shadow: 0 0 0 0 rgba(46, 229, 157, 0.6);
  animation: livepulse 2.2s ease-out infinite;
}
@keyframes livepulse {
  0%   { box-shadow: 0 0 0 0 rgba(46, 229, 157, 0.55); }
  70%  { box-shadow: 0 0 0 7px rgba(46, 229, 157, 0); }
  100% { box-shadow: 0 0 0 0 rgba(46, 229, 157, 0); }
}

/* Left slide-in detail panel — glass */
.detail-panel {
  /* top-aligned; the search bar is centered & narrow so it clears the left panel */
  position: fixed; top: 12px; left: 12px; bottom: 12px;
  width: 700px; max-width: calc(100vw - 24px);
  z-index: 950;
  display: flex; flex-direction: column;
  background: var(--paper);
  -webkit-backdrop-filter: blur(18px);
  backdrop-filter: blur(18px);
  border: 1px solid var(--rule);
  border-radius: 18px;
  box-shadow: var(--shadow-pop);
  overflow: hidden;
  transform: translateX(calc(-100% - 20px));
  opacity: 0; pointer-events: none;
  transition: transform .3s cubic-bezier(.4, 0, .2, 1), opacity .22s ease;
}
.detail-panel.is-open { transform: translateX(0); opacity: 1; pointer-events: auto; }

/* Top navigator inside the panel — bold segmented pills, app-nav visibility */
.dp-nav {
  display: flex; align-items: center; gap: 9px;
  padding: 10px 12px; flex-shrink: 0;
  background: rgba(13, 16, 22, 0.6);
  border-bottom: 1px solid var(--rule);
}
.dpn-tab {
  /* compact tab cluster on the left, with a little air between entries */
  flex: 0 0 auto; text-align: center;
  padding: 9px 21px; font-size: 12.5px; font-weight: 600; letter-spacing: .2px;
  color: var(--ink-3); border-radius: 9px;
  transition: all .13s ease; white-space: nowrap;
}
.dpn-tab:hover { color: var(--ink); background: var(--wash); }
.dpn-tab.active {
  color: #04110b; background: var(--brand-grad);
  box-shadow: 0 3px 10px rgba(46, 229, 157, 0.2);
  font-weight: 700;
}
.live-ticker {
  margin-left: auto;
  display: flex; align-items: center; gap: 6px;
  padding: 5px 11px; border-radius: 999px;
  background: rgba(46, 229, 157, 0.08);
  border: 1px solid rgba(46, 229, 157, 0.25);
  cursor: pointer; transition: all .12s ease;
}
.live-ticker:hover { background: rgba(46, 229, 157, 0.14); }
.live-text { font-size: 11px; font-weight: 700; color: var(--ink); font-variant-numeric: tabular-nums; white-space: nowrap; }
.live-arrow { font-size: 12px; font-weight: 800; color: var(--accent); animation: liverise 1.6s ease-in-out infinite; }
@keyframes liverise { 0%, 100% { transform: translateY(1px); } 50% { transform: translateY(-2px); } }

/* search dock: panel-toggle button sits immediately left of the search bar */
.dock-row { display: flex; align-items: center; gap: 8px; }
.dock-row .search-bar { flex: 1; min-width: 0; }
.dock-toggle {
  flex-shrink: 0; width: 40px; height: 40px; display: flex; align-items: center; justify-content: center;
  border-radius: 12px; color: #cfd2da; cursor: pointer;
  background: linear-gradient(180deg, rgba(26, 32, 41, 0.92), rgba(13, 17, 23, 0.92));
  border: 1px solid var(--rule);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.25);
  transition: border-color .12s ease, color .12s ease, background .12s ease;
}
.dock-toggle:hover { border-color: rgba(46, 229, 157, 0.45); color: #fff; }
.dock-toggle.active { color: var(--accent); border-color: rgba(46, 229, 157, 0.4); background: linear-gradient(180deg, rgba(20, 40, 33, 0.92), rgba(13, 23, 19, 0.92)); }

/* circular loading spinner (replaces "Loading…" text in sidebar lists) */
.zspin-wrap { display: flex; align-items: center; justify-content: center; padding: 30px 0; }
.zspin {
  width: 24px; height: 24px; border-radius: 50%;
  border: 2.5px solid rgba(255, 255, 255, 0.13);
  border-top-color: var(--accent);
  animation: zspin 0.7s linear infinite;
}
@keyframes zspin { to { transform: rotate(360deg); } }

/* rolling rank ticker (always visible under the tab bar) */
.rank-ticker {
  display: flex; align-items: center; gap: 10px;
  margin: 0 0 14px; padding: 9px 12px;
  background: rgba(26, 30, 39, 0.55);
  border: 1px solid var(--rule); border-radius: 11px;
  cursor: pointer; transition: border-color .12s ease, background .12s ease;
  flex-shrink: 0; text-align: left;
}
.dpn-ticker {
  /* sized for an average city name ("San Francisco") — longer ones ellipsize */
  display: flex; align-items: center; gap: 7px; flex: 0 0 218px; margin-left: auto;
  padding: 6px 11px; overflow: hidden; text-align: left;
  background: linear-gradient(180deg, rgba(26, 32, 41, 0.9), rgba(13, 17, 23, 0.9));
  border: 1px solid rgba(46, 229, 157, 0.22);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
  border-radius: 999px;
}
.dpn-ticker:hover { border-color: rgba(46, 229, 157, 0.45); }
.rt-trend { flex-shrink: 0; width: 15px; height: 15px; color: var(--accent); stroke-width: 2.6; }
.dpn-tab.active.dpn-ticker .rt-trend { color: #04110b; }
.dpn-ticker .rt-viewport { height: 19px; }
.dpn-ticker .rt-item { gap: 6px; }
.dpn-ticker .rt-rank {
  width: auto; height: auto; background: none; border-radius: 0;
  font-size: 12.5px; font-weight: 800; font-style: italic; color: var(--ink-4);
  font-variant-numeric: tabular-nums;
}
.dpn-ticker .rt-rank.rr1 { color: #f3c44d; background: none; }
.dpn-ticker .rt-rank.rr2 { color: #c3cbd8; background: none; }
.dpn-ticker .rt-rank.rr3 { color: #d98e55; background: none; }
.dpn-ticker .rt-name { font-size: 12px; font-weight: 650; letter-spacing: .1px; }
.dpn-ticker .rt-views {
  font-size: 10.5px; font-weight: 700; color: var(--accent);
  display: inline-flex; align-items: baseline; gap: 2px;
}
.rt-flag { font-size: 8.5px; font-weight: 700; letter-spacing: .4px; color: rgba(255,255,255,0.95); background: rgba(255,255,255,0.12); padding: 1px 5px; border-radius: 4px; flex-shrink: 0; }
.dpn-tab.active.dpn-ticker .rt-flag { color: rgba(4,17,11,0.6); background: rgba(4,17,11,0.12); }
.rt-caret { font-size: 8px; animation: liverise 1.6s ease-in-out infinite; display: inline-block; }
.dpn-tab.active.dpn-ticker { background: var(--brand-grad); border-color: transparent; }
.dpn-tab.active.dpn-ticker .rt-name { color: #04110b; }
.dpn-tab.active.dpn-ticker .rt-views { color: #065f41; }
.dpn-tab.active.dpn-ticker .rt-rank, .dpn-tab.active.dpn-ticker .rt-rank.rr1, .dpn-tab.active.dpn-ticker .rt-rank.rr2, .dpn-tab.active.dpn-ticker .rt-rank.rr3 { color: rgba(4, 17, 11, 0.65); }
.dpn-tab.active.dpn-ticker .rt-trend { color: #04110b; }
.rt-badge {
  font-size: 10px; font-weight: 800; letter-spacing: .6px;
  background: linear-gradient(135deg, #ff5d4f, #ff8a3d); color: #fff;
  padding: 3px 9px; border-radius: 999px; flex-shrink: 0;
  box-shadow: 0 2px 10px rgba(255, 93, 79, 0.3);
}
.rt-viewport { position: relative; flex: 1; min-width: 0; height: 21px; overflow: hidden; }
.rt-item {
  position: absolute; inset: 0;
  display: flex; align-items: center; gap: 9px;
  transition: transform .45s cubic-bezier(.3, .85, .3, 1), opacity .45s ease;
}
.rt-item { transition: transform .5s cubic-bezier(.25, .9, .25, 1.05), opacity .4s ease, filter .4s ease; }
.rt-item.rt-in { transform: translateY(115%); opacity: 0; filter: blur(3px); }
.rt-item.rt-out { transform: translateY(-115%); opacity: 0; filter: blur(3px); }
.rt-rank {
  width: 20px; height: 20px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 11.5px; font-weight: 800; color: var(--ink-3);
  background: var(--wash); border-radius: 6px; font-variant-numeric: tabular-nums;
}
.rt-rank.rr1 { background: linear-gradient(135deg, #f7d04b, #e8a93a); color: #2a1d05; }
.rt-rank.rr2 { background: linear-gradient(135deg, #d7dde6, #aab4c2); color: #1d242e; }
.rt-rank.rr3 { background: linear-gradient(135deg, #e2a36b, #c07c43); color: #2b1708; }
.rt-name { flex: 1; min-width: 0; font-size: 13px; font-weight: 700; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rt-views { font-size: 12px; font-weight: 800; color: #ff6b5b; font-variant-numeric: tabular-nums; flex-shrink: 0; }

/* community board */
.comm-write {
  background: rgba(26, 30, 39, 0.45); border: 1px solid var(--rule);
  border-radius: 14px; padding: 16px 16px 14px; margin-bottom: 18px;
}
.comm-write input, .comm-write textarea {
  width: 100%; background: var(--wash); border: 1px solid var(--rule); border-radius: 10px;
  color: var(--ink); padding: 13px 14px; font-size: 13.5px; line-height: 1.55;
  margin-bottom: 12px; resize: vertical;
}
.comm-write textarea { min-height: 130px; }
.comm-write .z-est-btn { margin-top: 2px !important; padding: 12px; }
.post-card {
  display: flex; gap: 11px;
  background: rgba(26, 30, 39, 0.6); border: 1px solid var(--rule);
  border-radius: 12px; padding: 11px 13px 12px 9px;
  transition: border-color .12s ease;
}
.post-card:hover { border-color: var(--rule-2); }
.post-voterail { display: flex; flex-direction: column; align-items: center; gap: 1px; flex-shrink: 0; width: 30px; padding-top: 1px; }
.post-vote {
  font-size: 15px; line-height: 1; color: var(--ink-4);
  padding: 3px 6px; border-radius: 6px; transition: all .1s ease;
}
.post-vote:hover { color: var(--accent); background: var(--accent-wash); }
.post-vote.voted { color: var(--accent); }
.post-score { font-size: 12px; font-weight: 700; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.post-score.voted { color: var(--accent); }
.post-main { flex: 1; min-width: 0; }
.post-del { margin-left: auto; font-size: 11px; color: var(--ink-4); padding: 2px 7px; border-radius: 6px; }
.post-del:hover { color: var(--neg); background: var(--neg-wash); }
.comm-divider { height: 1px; background: var(--rule); margin: 18px 0 16px; }

/* community trending window (day/week/month) — reuses .seg shell, own buttons so it
   doesn't collide with the global Buy/Rent .seg-btn click handler */
/* headline Source line hidden for a cleaner panel — sources still cited in the briefing detail */
#dpSource { display: none; }
.win-btn { padding: 4px 12px; font-size: 11.5px; font-weight: 600; color: var(--ink-3); border-radius: 7px; transition: all .12s ease; }
.win-btn.active { background: var(--brand-grad); color: #04110b; box-shadow: var(--shadow-sm); }
.hot-label { font-size: 10.5px; font-weight: 800; letter-spacing: .6px; color: #ff8a3d; text-transform: uppercase; margin-bottom: 8px; }
.post-hot { border-color: rgba(255,138,61,0.35); background: rgba(40,30,22,0.5); }

/* comments */
.post-comment-toggle { margin-top: 9px; font-size: 11.5px; font-weight: 600; color: var(--ink-3); padding: 3px 8px; border-radius: 7px; transition: all .12s ease; }
.post-comment-toggle:hover { color: var(--ink); background: var(--wash); }
.post-comments { margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--rule); }
.comment-row { display: flex; gap: 8px; padding: 6px 0; }
.comment-avatar { width: 20px; height: 20px; border-radius: 99px; object-fit: cover; flex-shrink: 0; margin-top: 1px; }
.comment-avatar-blank { background: var(--wash); }
.comment-meta { font-size: 10.5px; color: #6b7180; display: flex; align-items: center; gap: 5px; }
.comment-author { font-weight: 700; color: #9aa1b0; }
.comment-del { font-size: 10px; color: var(--ink-4); padding: 0 5px; border-radius: 5px; }
.comment-del:hover { color: var(--neg); background: var(--neg-wash); }
.comment-body { font-size: 12.5px; color: #c5cad4; line-height: 1.5; margin-top: 2px; word-break: break-word; }
.comment-compose { display: flex; gap: 7px; margin-top: 9px; }
.comment-input { flex: 1; min-width: 0; background: var(--wash); border: 1px solid var(--rule); border-radius: 9px; color: var(--ink); padding: 8px 11px; font-size: 12.5px; }
.comment-input:focus { outline: none; border-color: var(--accent); }
.comment-submit { flex-shrink: 0; padding: 0 14px; font-size: 12px; font-weight: 700; color: #04110b; background: var(--brand-grad); border-radius: 9px; }
.post-avatar { width: 18px; height: 18px; border-radius: 99px; object-fit: cover; }
.post-area {
  font-size: 9.5px; font-weight: 600; color: var(--accent);
  background: var(--accent-wash); padding: 1px 7px; border-radius: 99px;
}

/* area chip (community board scope) */
.area-chip {
  font-size: 11px; font-weight: 600; color: var(--accent);
  background: var(--accent-wash); border: 1px solid rgba(46,229,157,0.25);
  padding: 3px 10px; border-radius: 999px; cursor: default;
}

/* trending leaderboard */
.trend-row {
  position: relative; overflow: hidden;
  display: flex; align-items: center; gap: 12px; width: 100%;
  padding: 12px 14px; border-radius: 12px; text-align: left;
  background: rgba(26, 30, 39, 0.5);
  border: 1px solid var(--rule); cursor: pointer;
}
.trend-rank, .trend-label, .trend-views { position: relative; z-index: 1; }
.trend-rank {
  width: 30px; height: 30px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 13.5px; font-weight: 800; font-variant-numeric: tabular-nums;
  color: var(--ink-3); background: var(--wash); border-radius: 9px;
}
.trend-rank.r1 { background: linear-gradient(135deg, #f7d04b, #e8a93a); color: #2a1d05; }
.trend-rank.r2 { background: linear-gradient(135deg, #d7dde6, #aab4c2); color: #1d242e; }
.trend-rank.r3 { background: linear-gradient(135deg, #e2a36b, #c07c43); color: #2b1708; }
.trend-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; position: relative; z-index: 1; }
.trend-label { font-size: 14px; font-weight: 700; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: flex; align-items: center; gap: 7px; }
.trend-sub { font-size: 10.5px; color: var(--ink-4); }
.trend-views { font-size: 11.5px; font-weight: 600; color: var(--accent); font-variant-numeric: tabular-nums; white-space: nowrap; }
.trend-delta { font-size: 10px; font-weight: 800; padding: 1px 6px; border-radius: 99px; flex-shrink: 0; }
.trend-delta.up { color: #2ee59d; background: rgba(46,229,157,0.13); }
.trend-delta.down { color: #ff6b61; background: rgba(255,107,97,0.13); }
.trend-delta.new { color: var(--gold); background: rgba(236,195,92,0.13); }
.trend-row { will-change: transform; }
.trend-row.enter { animation: trendenter .5s ease-out; }
@keyframes trendenter { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
.trend-row.moved { animation: trendflash 1.2s ease-out; }
@keyframes trendflash {
  0% { background: rgba(46, 229, 157, 0.18); border-color: rgba(46,229,157,0.45); }
  100% { background: rgba(26, 30, 39, 0.5); border-color: var(--rule); }
}

/* news list */
.news-row {
  display: block; padding: 12px 13px; border-radius: 11px;
  border: 1px solid transparent; border-left: 3px solid transparent;
  transition: all .12s ease;
}
.news-row:hover { background: var(--wash); border-color: var(--rule); border-left-color: var(--accent); }

.dp-header {
  display: flex; align-items: center; gap: 6px;
  padding: 12px 10px 12px 7px;
  border-bottom: 1px solid var(--rule);
  flex-shrink: 0;
  background: linear-gradient(180deg, rgba(46,229,157,0.045), transparent);
}
.dp-icon {
  width: 30px; height: 30px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  border-radius: 8px; color: var(--ink-2); font-size: 15px;
  transition: background .1s ease, color .1s ease;
}
.dp-icon:hover { background: var(--wash); color: var(--ink); }
#dpStar.on { color: var(--gold); }

.dp-body { flex: 1; overflow-y: auto; padding: 16px 18px; }
.dp-footer { padding: 12px 14px; border-top: 1px solid var(--rule); flex-shrink: 0; }

/* segmented Buy/Rent */
.seg { display: flex; background: var(--wash); border-radius: 10px; padding: 3px; }
.seg-btn {
  padding: 5px 16px; font-size: 13px; font-weight: 600;
  color: var(--ink-3); border-radius: 7px; transition: all .12s ease;
}
.seg-btn.active { background: var(--brand-grad); color: #04110b; box-shadow: var(--shadow-sm); }

.size-pick {
  display: flex; align-items: center; gap: 4px;
  padding: 5px 10px; font-size: 12px; font-weight: 600;
  color: var(--ink-2);
  background: var(--wash); border: 1px solid var(--rule); border-radius: 8px;
}

.viewers-badge {
  font-size: 10px; font-weight: 600; color: var(--gold);
  background: rgba(236, 195, 92, 0.08);
  border: 1px solid rgba(236, 195, 92, 0.26);
  padding: 3px 8px; border-radius: 7px; white-space: nowrap;
}

.cta-btn {
  width: 100%; padding: 12px; border-radius: 12px;
  background: var(--brand-grad); color: #04110b;
  font-size: 13px; font-weight: 700;
  transition: filter .12s ease, transform .12s ease;
  box-shadow: 0 4px 18px rgba(46, 229, 157, 0.22);
}
.cta-btn:hover { filter: brightness(1.07); transform: translateY(-1px); }

/* Right vertical tool rail */
.tool-rail {
  position: fixed; top: 50%; right: 12px; transform: translateY(-50%);
  z-index: 1000; display: flex; flex-direction: column; gap: 6px;
}
.tool-rail button {
  width: 40px; height: 40px;
  display: flex; align-items: center; justify-content: center;
  background: var(--paper);
  -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
  border: 1px solid var(--rule);
  border-radius: 12px; color: var(--ink-2);
  box-shadow: var(--shadow-sm); transition: all .12s ease;
}
.tool-rail button:hover { color: var(--accent); border-color: var(--rule-2); background: var(--wash); }

.index-chip {
  display: flex; align-items: center; gap: 7px;
  background: var(--paper);
  -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
  border: 1px solid var(--rule);
  border-radius: 12px; padding: 8px 13px;
  box-shadow: var(--shadow-sm);
}
.acct-btn {
  width: 40px; height: 40px;
  display: flex; align-items: center; justify-content: center;
  background: var(--paper);
  -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
  border: 1px solid var(--rule);
  border-radius: 12px; color: var(--ink-2);
  box-shadow: var(--shadow-sm); transition: all .12s ease;
}
.acct-btn:hover { color: var(--ink); background: var(--wash); }

/* map style toggle: light ↔ satellite. Icon = next mode (light→satellite, satellite→sun) */
#mapThemeToggle .ic-moon, #mapThemeToggle .ic-sun, #mapThemeToggle .ic-sat { display: none; }
#mapThemeToggle[data-theme="light"] .ic-sat { display: block; }
#mapThemeToggle[data-theme="satellite"] .ic-sun { display: block; }

.panel-toggle {
  position: fixed; top: 12px; left: 12px; z-index: 940;
  width: 40px; height: 40px;
  display: none; align-items: center; justify-content: center;
  background: var(--paper);
  -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
  border: 1px solid var(--rule);
  border-radius: 12px; color: var(--ink-2);
  box-shadow: var(--shadow-md); transition: all .12s ease;
}
.panel-toggle.show { display: flex; }
.panel-toggle:hover { color: var(--ink); background: var(--wash); }

.bottom-cta {
  position: fixed; bottom: 16px; left: 50%; transform: translateX(-50%);
  z-index: 1000;
  display: flex; align-items: center; gap: 7px;
  padding: 11px 20px; border-radius: 999px;
  background: var(--brand-grad); color: #04110b;
  font-size: 13px; font-weight: 700;
  box-shadow: 0 10px 30px -6px rgba(46, 229, 157, 0.4);
  transition: transform .12s ease;
}
.bottom-cta:hover { transform: translateX(-50%) translateY(-1px); }

/* ============================================================
   Map price pills — tier-colored (t0 affordable → t4 luxury)
   ============================================================ */
.pill-marker { cursor: pointer; }
/* Hogangnono-grade pill: ONE clean white capsule — the number does the talking.
   Price tier shows only as a thin underline (no rainbow noise). */
.pill {
  display: flex; align-items: center; gap: 4px;
  background: #ffffff; border: 1px solid #ccd1da; color: #161a26;
  font-size: 11.5px; font-weight: 700; font-variant-numeric: tabular-nums;
  padding: 3.5px 10px 5px; border-radius: 10px;
  box-shadow: 0 2px 8px rgba(15, 18, 28, 0.28);
  white-space: nowrap;
  transition: transform .12s ease, box-shadow .12s ease;
}
/* NOTE: never set position on .pill-marker — MapLibre positions marker elements absolutely
   via inline transform; overriding it makes every pill a full-width block (the stretch bug). */
.pill { position: relative; }
.pill::after {
  /* anchor tip — points the pill at its exact building */
  content: ""; position: absolute; left: 50%; bottom: -4px;
  width: 8px; height: 8px; transform: translateX(-50%) rotate(45deg);
  background: inherit; border-right: 1px solid; border-bottom: 1px solid;
  border-color: inherit; border-radius: 1px;
}
.pill .pill-price { color: #10131c; }
.pill .pill-name {
  font-weight: 600; color: #5a6172; font-size: 0.92em;
  max-width: 92px; overflow: hidden; text-overflow: ellipsis;
}
.pill .pill-arrow { font-size: 8px; }
.pill.up .pill-arrow { color: #1faa6e; }
.pill.down .pill-arrow { color: #e5544b; }
/* Korea reads red=up / blue=down — flipped semantics in KR mode */
body[data-region="kr"] .pill.up .pill-arrow { color: #e5544b; }
body[data-region="kr"] .pill.down .pill-arrow { color: #3b6fe0; }
.pill-marker:hover .pill { transform: scale(1.09); box-shadow: 0 6px 16px rgba(15,18,28,0.4); z-index: 5; }
.pill-marker.active .pill {
  background: var(--brand-grad); border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-wash), 0 6px 16px rgba(0,0,0,0.5);
}
.pill-marker.active .pill .pill-price, .pill-marker.active .pill .pill-name, .pill-marker.active .pill .pill-arrow { color: #04110b; }

/* price tier = thin underline inside the pill (subtle, not a rainbow) */
.pill::before {
  content: ""; position: absolute; left: 9px; right: 9px; bottom: 2.5px;
  height: 2.5px; border-radius: 2px; background: transparent;
}
.pill-marker.t0 .pill::before { background: #19c87f; }
.pill-marker.t1 .pill::before { background: #7ed321; }
.pill-marker.t2 .pill::before { background: #f0b429; }
.pill-marker.t3 .pill::before { background: #f4762f; }
.pill-marker.t4 .pill::before { background: #e84a7f; }
.pill-marker.active .pill::before { background: rgba(4,17,11,0.35); }

/* metro & world-country pills — two lines, Hogangnono-style:
   place name on top, price (or YoY %) + arrow beneath */
.metro-pill .pill, .world-pill .pill { flex-direction: column; gap: 1px; font-size: 12.5px; padding: 5px 13px 7px; font-weight: 800; }
.metro-pill .pill .pill-name, .world-pill .pill .pill-name { max-width: 150px; font-size: 10px; letter-spacing: .2px; }
.metro-pill .pill .pill-bottom, .world-pill .pill .pill-bottom { display: flex; align-items: center; gap: 4px; }
.world-pill .pill.up .pill-price { color: #1faa6e; }
.world-pill .pill.down .pill-price { color: #e5544b; }
/* Korea 시군구 pills match the metro two-line layout */
.kr-pill .pill { flex-direction: column; gap: 1px; padding: 5px 13px 7px; }
.kr-pill .pill .pill-name { font-size: 10px; max-width: 150px; }

/* drill-down layers progressively smaller */
.zip-pill .pill { font-size: 10.5px; padding: 2.5px 8px 4.5px; }
.bldg-pill .pill { font-size: 10px; padding: 2px 7px 4px; }

/* Searched ZIP / address pin — gold ring so it stands out */
.zip-pin .pill { outline: 2px solid var(--gold); outline-offset: 1px; box-shadow: 0 0 0 4px rgba(236,195,92,0.16), 0 3px 10px rgba(0,0,0,0.6); }
.zip-pin .pill .pill-arrow { color: var(--gold); }

/* Korea pills inherit tier colors; tint border slightly violet to read as KR */
.kr-pill .pill-arrow, .kr-apt-pill .pill-arrow { display: none; }
.kr-pill.active .pill, .kr-apt-pill.active .pill { background: var(--brand-grad); color: #04110b; border-color: var(--accent); }

/* Zeltez Estimate card */
.z-est-grid { display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: 8px; }
.z-est-grid label { display: flex; flex-direction: column; gap: 4px; font-size: 11px; color: var(--ink-3); }
.z-est-grid input {
  background: #0e1117; border: 1px solid #2c3340; border-radius: 8px;
  color: var(--ink); padding: 7px 9px; font-size: 13px; font-variant-numeric: tabular-nums; width: 100%;
}
.z-est-grid input:focus { outline: none; border-color: var(--gold); }
.z-est-btn {
  margin-top: 10px; width: 100%; padding: 9px 12px; border-radius: 10px;
  background: var(--brand-grad); color: #04110b; font-weight: 600; font-size: 13.5px; cursor: pointer; border: 0;
  transition: filter .12s ease;
}
.z-est-btn:hover { filter: brightness(1.06); }
.z-est-out:not(:empty) { margin-top: 10px; }
.z-est-val { font-family: var(--font-display, inherit); font-weight: 600; font-size: 24px; color: var(--ink); font-variant-numeric: tabular-nums; }

/* MapLibre controls */
.maplibregl-ctrl-group {
  background: var(--paper) !important;
  border: 1px solid var(--rule) !important;
  border-radius: 12px !important;
  box-shadow: var(--shadow-md) !important;
  overflow: hidden;
}
.maplibregl-ctrl-group button { background: transparent !important; }
.maplibregl-ctrl-group button + button { border-top: 1px solid var(--rule) !important; }
.maplibregl-ctrl-group button .maplibregl-ctrl-icon { filter: invert(0.85); }
.maplibregl-ctrl-attrib {
  background: rgba(18, 21, 28, 0.75) !important;
  border-radius: 8px !important;
}
.maplibregl-ctrl-attrib a, .maplibregl-ctrl-attrib { color: var(--ink-3) !important; }
.maplibregl-ctrl-attrib-button { filter: invert(0.85); }
.maplibregl-ctrl-attrib.maplibregl-compact:not(.maplibregl-compact-show) .maplibregl-ctrl-attrib-inner { display: none; }
.pill-viewers {
  font-size: 9px; font-weight: 600; color: var(--gold);
  background: #15120a; border: 1px solid #3a3320;
  padding: 1px 6px; border-radius: 7px; white-space: nowrap;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.5);
}

/* ---- Tool-rail price-filter popover ---- */
.filter-pop {
  position: fixed; top: 50%; right: 62px; transform: translateY(-50%) translateX(8px);
  z-index: 1001; width: 230px;
  background: var(--paper);
  -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px);
  border: 1px solid var(--rule); border-radius: 14px;
  padding: 13px 14px; box-shadow: var(--shadow-pop);
  opacity: 0; pointer-events: none;
  transition: opacity .15s ease, transform .15s ease;
}
.filter-pop.show { opacity: 1; pointer-events: auto; transform: translateY(-50%) translateX(0); }
.filter-pop input {
  width: 100%; min-width: 0;
  background: var(--wash); border: 1px solid var(--rule); border-radius: 8px;
  color: var(--ink); padding: 7px 9px; font-size: 12.5px; font-variant-numeric: tabular-nums;
}
.f-btn {
  flex: 1; padding: 7px 0; border-radius: 8px; font-size: 12px; font-weight: 600;
  background: var(--wash); color: var(--ink-2); transition: all .12s ease;
}
.f-btn:hover { color: var(--ink); }
.f-apply { background: var(--brand-grad); color: #04110b; }

/* ---- Account dropdown (Google sign-in / profile) ---- */
/* Country dropdown — anchored under the region button inside #topRight */
.region-pop {
  position: absolute; top: 46px; left: 0; z-index: 1100; min-width: 192px;
  display: flex; flex-direction: column; gap: 2px;
  background: var(--paper);
  -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px);
  border: 1px solid var(--rule); border-radius: 14px;
  padding: 6px; box-shadow: var(--shadow-pop);
  opacity: 0; pointer-events: none; transform: translateY(-6px);
  transition: opacity .15s ease, transform .15s ease;
}
.region-pop.show { opacity: 1; pointer-events: auto; transform: translateY(0); }
.region-opt {
  display: flex; align-items: center; gap: 8px;
  padding: 9px 12px; border-radius: 9px;
  font-size: 13px; font-weight: 600; color: var(--ink-2); text-align: left;
}
.region-opt:hover { background: var(--wash); color: var(--ink); }

.acct-pop {
  position: fixed; top: 58px; right: 12px; z-index: 1100; width: 262px;
  background: var(--paper);
  -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px);
  border: 1px solid var(--rule); border-radius: 14px;
  padding: 14px; box-shadow: var(--shadow-pop);
  opacity: 0; pointer-events: none; transform: translateY(-6px);
  transition: opacity .15s ease, transform .15s ease;
}
.acct-pop.show { opacity: 1; pointer-events: auto; transform: translateY(0); }
.acct-avatar { display: none; width: 26px; height: 26px; border-radius: 99px; object-fit: cover; }
.me-avatar { width: 36px; height: 36px; border-radius: 99px; object-fit: cover; border: 1px solid var(--rule); }

/* ---- Toast ---- */
.toast {
  position: fixed; bottom: 66px; left: 50%; transform: translateX(-50%) translateY(8px);
  z-index: 1200;
  background: var(--paper);
  -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
  border: 1px solid var(--rule); border-radius: 11px;
  color: var(--ink); font-size: 12.5px; font-weight: 600;
  padding: 9px 16px; box-shadow: var(--shadow-md);
  opacity: 0; pointer-events: none;
  transition: opacity .18s ease, transform .18s ease;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* Legacy Leaflet styles kept harmless */
.leaflet-container { background: #0d1016; font-family: 'Inter', sans-serif; }

/* ============================================================
   Mobile (≤640px) — bottom-sheet panel, compact chrome
   ============================================================ */
@media (max-width: 640px) {
  body { overscroll-behavior: none; }

  /* search dock: slimmer, leaves room for the account cluster */
  .search-bar { height: 44px; padding: 0 10px; gap: 7px; }
  .brand-name { display: none; }
  .search-bar input { font-size: 16px; }   /* ≥16px stops iOS zoom-on-focus */

  /* top-right cluster: hide the stats chip, tighten buttons */
  .index-chip { display: none; }
  .acct-btn { width: 38px; height: 38px; }

  /* detail panel → bottom sheet with a grab handle */
  .detail-panel {
    top: auto; left: 0; right: 0; bottom: 0;
    width: 100%; max-width: 100%;
    height: 78vh;
    border-radius: 18px 18px 0 0;
    border-left: none; border-right: none; border-bottom: none;
    transform: translateY(106%);
    padding-bottom: env(safe-area-inset-bottom);
  }
  .detail-panel.is-open { transform: translateY(0); }
  .detail-panel::before {
    content: ""; position: absolute; top: 7px; left: 50%; transform: translateX(-50%);
    width: 42px; height: 4px; border-radius: 99px; background: var(--rule-2); z-index: 5;
  }
  .dp-nav { padding-top: 15px; }

  /* tabs fit a narrow sheet */
  .dpn-tab { flex: 1 1 auto; font-size: 11.5px; padding: 7px 3px; letter-spacing: 0; }
  .dpn-ticker { flex: 0 0 128px; padding: 5px 6px; }
  .dpn-ticker .rt-name { font-size: 11px; }
  .dpn-ticker .rt-views { font-size: 9.5px; }
  #dpName { font-size: 19px; }
  #dpPrice { font-size: 32px; }

  /* chart slightly shorter on small screens */
  .chart-terminal { height: 175px !important; }

  /* tool rail: bottom-right, stubs hidden */
  .tool-rail { top: auto; bottom: calc(16px + env(safe-area-inset-bottom)); right: 10px; transform: none; }
  .tool-rail button { width: 38px; height: 38px; }
  #btnSchools, #btnTransit, #btnSaved { display: none; }

  /* reopen toggle joins the bottom edge; dead CTA goes away on phones */
  .panel-toggle { top: auto; bottom: calc(16px + env(safe-area-inset-bottom)); left: 10px; }
  .bottom-cta { display: none; }

  /* popovers fit the screen */
  .filter-pop { left: 10px; right: 10px; width: auto; }
  .acct-pop { width: min(262px, calc(100vw - 16px)); }

  /* community / posts breathing room on touch */
  .comm-write input, .comm-write textarea, .comment-input { font-size: 16px; }
  /* day/week/month trending tabs fit the narrow sheet header */
  #commWin { padding: 2px; }
  .win-btn { padding: 5px 10px; font-size: 11px; }
  .hot-label { font-size: 10px; }
  /* comments: tighter rows + full-width reply on phones */
  .comment-body { font-size: 13px; }
  .comment-compose { flex-wrap: wrap; }
  .comment-submit { padding: 9px 14px; }
  /* country dropdown anchors to the right edge so it never runs off-screen */
  .region-pop { left: auto; right: 0; }
  /* search keeps the full placeholder ("…or city") readable on phones */
  .search-bar input { font-size: 16px; }
  /* metro/world pill names don't overflow tiny screens */
  .metro-pill .pill .pill-name, .world-pill .pill .pill-name, .kr-pill .pill .pill-name { max-width: 120px; }
}

/* very small phones */
@media (max-width: 380px) {
  .dpn-ticker { flex: 0 0 112px; }
  .dpn-tab { font-size: 11px; }
}

/* mobile: stack the search dock (row 1) and the button cluster (row 2) — no more overlap */
@media (max-width: 640px) {
  #searchDock {
    left: 10px !important; right: 10px !important;
    top: calc(10px + env(safe-area-inset-top)) !important;
    width: auto !important; max-width: none !important;
    transform: none !important;   /* cancel desktop -translate-x-1/2 (full-width row on phones) */
  }
  #topRight {
    top: calc(62px + env(safe-area-inset-top)) !important;
    right: 10px !important;
  }
  .acct-pop { top: calc(108px + env(safe-area-inset-top)); }
  /* keep the tool rail clear of the map attribution ⓘ */
  .tool-rail { bottom: calc(64px + env(safe-area-inset-bottom)); }
  /* prominent "open panel" button bottom-left on phones — accent so it reads as the primary action */
  .panel-toggle {
    bottom: calc(64px + env(safe-area-inset-bottom)); left: 12px;
    width: 46px; height: 46px;
    background: var(--brand-grad); color: #04110b; border-color: transparent;
    box-shadow: 0 8px 22px -6px rgba(46, 229, 157, 0.5);
  }
  .panel-toggle:hover { background: var(--brand-grad); color: #04110b; }
}

/* first-load hint floating over the map */
.map-hint {
  position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%);
  z-index: 980; padding: 10px 18px; border-radius: 999px;
  background: rgba(13, 17, 23, 0.86); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  border: 1px solid rgba(46, 229, 157, 0.3); color: var(--ink);
  font-size: 13px; font-weight: 600; box-shadow: var(--shadow-md);
  opacity: 0; animation: hintIn .5s ease .4s forwards;
  pointer-events: none;
}
.map-hint.gone { opacity: 0; transition: opacity .4s ease; }
@keyframes hintIn { from { opacity: 0; transform: translate(-50%, 8px); } to { opacity: 1; transform: translate(-50%, 0); } }
@media (max-width: 640px) { .map-hint { display: none; } }
