:root {
  --bg: #eef1f5;
  --card: rgba(255, 255, 255, 0.92);
  --ink: #14161a;
  --ink-2: #3a3f47;
  --muted: #6b7280;
  --line: #e6e9ee;
  --soft: #f4f6f9;
  --yellow: #ffc83d;
  --primary: #ea4c89;
  --primary-hover: #d93a77;
  --mint: #2fbf71;
  --coral: #ff5b5b;
  --blue: #5b6cff;
  --radius: 18px;
  --shadow: 0 1px 2px rgba(20, 22, 26, .04), 0 8px 30px rgba(20, 22, 26, .08);
  --font: 'Manrope', system-ui, -apple-system, 'Segoe UI', sans-serif;
  color-scheme: light;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; overflow: hidden; }
body { background: var(--bg); color: var(--ink); font: 500 14px/1.45 var(--font); -webkit-font-smoothing: antialiased; }
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
h2 { margin: 0; font-size: 22px; line-height: 1.15; font-weight: 800; letter-spacing: -0.02em; }
p { margin: 0; }
a { color: inherit; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.skip { position: absolute; left: -999px; top: 8px; z-index: 100; background: var(--ink); color: #fff; padding: 8px 12px; border-radius: 10px; }
.skip:focus { left: 8px; }
:focus-visible { outline: 3px solid var(--blue); outline-offset: 2px; }

#city { position: fixed; inset: 0; }
#city canvas { display: block; cursor: grab; touch-action: none; }
#city canvas:active { cursor: grabbing; }

.card { background: var(--card); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); border: 1px solid rgba(255,255,255,.7); border-radius: var(--radius); box-shadow: var(--shadow); }

/* ---------- top bar ---------- */
.topbar { position: fixed; top: 16px; left: 16px; right: 16px; display: flex; align-items: flex-start; gap: 12px; pointer-events: none; z-index: 10; }
.topbar > * { pointer-events: auto; }
.brand { display: flex; align-items: center; gap: 12px; padding: 10px 16px 10px 12px; }
.brand strong { display: block; font-size: 17px; font-weight: 800; letter-spacing: -0.02em; }
.brand small { color: var(--muted); font-size: 12px; }
.mark { display: inline-flex; align-items: flex-end; gap: 3px; width: 34px; height: 34px; padding: 6px; border-radius: 10px; background: var(--ink); }
.mark i { display: block; width: 6px; background: #fff; border-radius: 1.5px 1.5px 0 0; }
.mark i:nth-child(1) { height: 10px; } .mark i:nth-child(2) { height: 22px; background: var(--yellow); } .mark i:nth-child(3) { height: 15px; }
.stats { margin-left: auto; display: flex; gap: 4px; padding: 6px; }
.stat { padding: 6px 12px; border-radius: 12px; color: var(--muted); white-space: nowrap; font-size: 13px; }
.stat b { color: var(--ink); font-weight: 800; font-variant-numeric: tabular-nums; }
.stat + .stat { border-left: 1px solid var(--line); border-radius: 0; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--mint); margin-right: 6px; box-shadow: 0 0 0 3px rgba(47,191,113,.18); animation: pulse 2s infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 6px rgba(47,191,113,.05); } }

.banner { position: absolute; left: 50%; top: 58px; transform: translateX(-50%); display: flex; align-items: center; gap: 10px; padding: 10px 12px 10px 10px; border: 0; border-radius: 999px; background: var(--ink); color: #fff; box-shadow: 0 10px 30px rgba(20,22,26,.25); max-width: min(560px, calc(100vw - 32px)); animation: drop .5s cubic-bezier(.2,.9,.3,1.3); }
.banner-text { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.banner-cta { background: var(--yellow); color: var(--ink); padding: 4px 10px; border-radius: 999px; font-weight: 700; font-size: 12px; white-space: nowrap; }
@keyframes drop { from { transform: translate(-50%, -30px); opacity: 0; } }
.live-pill { background: var(--coral); color: #fff; font-weight: 800; font-size: 11px; letter-spacing: .06em; padding: 3px 8px; border-radius: 999px; animation: blink 1.6s infinite; }
.live-pill.sm { font-size: 10px; padding: 2px 6px; }
@keyframes blink { 50% { opacity: .65; } }

/* ---------- side panel ---------- */
.panel { position: fixed; right: 16px; top: 84px; bottom: 16px; width: 340px; display: flex; flex-direction: column; overflow: hidden; z-index: 9; }
.tabs { display: flex; gap: 4px; padding: 8px; border-bottom: 1px solid var(--line); }
.tabs button { flex: 1; border: 0; background: transparent; padding: 8px 6px; border-radius: 10px; font-weight: 700; color: var(--muted); }
.tabs button[aria-selected=true] { background: var(--ink); color: #fff; }
.tab-body { flex: 1; overflow-y: auto; padding: 14px; }
.eyebrow { font-size: 11px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin-bottom: 8px; }
.mt { margin-top: 18px; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.center { text-align: center; }
.empty { color: var(--muted); padding: 18px 4px; }
.list { display: flex; flex-direction: column; gap: 2px; margin: 8px 0 0; padding: 0; list-style: none; }
.row { display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 8px; border: 0; background: transparent; border-radius: 12px; text-align: left; }
.row:not(.static):hover { background: var(--soft); }
.row-icon { width: 32px; height: 32px; flex: none; display: grid; place-items: center; background: var(--soft); border-radius: 10px; font-size: 16px; }
.row-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.row-title { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-sub { color: var(--muted); font-size: 12px; }
.row-num { font-weight: 800; font-variant-numeric: tabular-nums; }
.row-num small { color: var(--muted); font-weight: 600; }
.rank { width: 24px; flex: none; text-align: center; font-weight: 800; color: var(--muted); }
.rank.r1 { color: #c99400; } .rank.r2 { color: #8a94a3; } .rank.r3 { color: #c0743a; }
.bar { display: block; height: 5px; border-radius: 4px; background: var(--soft); overflow: hidden; }
.bar i { display: block; height: 100%; border-radius: 4px; }
.tag { margin-left: 6px; font-size: 10px; padding: 1px 6px; border-radius: 6px; background: var(--yellow); vertical-align: middle; }
.logo { flex: none; border-radius: 10px; object-fit: contain; background: #fff; border: 1px solid var(--line); }
.logo-fallback { display: grid; place-items: center; color: #fff; font-weight: 800; border: 0; }
.restore { margin-top: 22px; padding-top: 14px; border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 8px; }

/* ---------- search & leaderboard ---------- */
.tools { display: flex; gap: 10px; align-items: flex-start; }
.search { position: relative; display: flex; align-items: center; gap: 8px; width: 300px; height: 46px; padding: 0 10px 0 14px; }
.search:focus-within { box-shadow: 0 0 0 2px var(--primary), var(--shadow); }
.search-icon { flex: none; color: var(--muted); }
.search input { flex: 1; min-width: 0; height: 100%; border: 0 !important; background: transparent !important; box-shadow: none !important; padding: 0 !important; font-weight: 600; }
.search input::-webkit-search-cancel-button { cursor: pointer; }
.search kbd { font: 700 11px var(--font); color: var(--muted); border: 1px solid var(--line); border-radius: 6px; padding: 1px 6px; background: var(--soft); }
.search input:not(:placeholder-shown) ~ kbd, .search:focus-within kbd { display: none; }
.search-results { position: absolute; left: 0; width: max(100%, 520px); max-width: calc(100vw - 32px); top: calc(100% + 8px); max-height: 60vh; overflow-y: auto; padding: 6px; background: #fff; z-index: 13; display: flex; flex-direction: column; gap: 2px; }
.search-results .row[aria-selected=true] { background: var(--soft); }
.search-results .empty { padding: 12px; }
.tag-free { font-size: 11px; font-weight: 800; color: #1f9d5a; background: #e3f6ea; padding: 2px 8px; border-radius: 999px; }
.tool-btn { display: flex; align-items: center; gap: 8px; height: 46px; padding: 0 16px 0 14px; border: 1px solid rgba(255,255,255,.7); font-weight: 700; white-space: nowrap; color: var(--ink); }
.tool-btn svg { color: var(--primary); }
.tool-btn:hover { background: #fff; }
.leaderboard .ranks .row-num { white-space: nowrap; font-size: 13px; }
.leaderboard .rank { font-size: 15px; }

/* ---------- owner button ---------- */
.me-wrap { position: relative; }
.me { display: flex; align-items: center; gap: 10px; height: 46px; padding: 6px 14px 6px 8px; border: 1px solid rgba(255,255,255,.7); font-weight: 700; white-space: nowrap; }
.me:hover { background: #fff; }
.me[aria-expanded=true] { box-shadow: 0 0 0 2px var(--ink), var(--shadow); }
.me-stack { display: flex; }
.me-stack .logo { border: 2px solid #fff; border-radius: 50%; box-shadow: 0 1px 3px rgba(0,0,0,.12); }
.me-stack .logo + .logo { margin-left: -10px; }
.me-label { max-width: 140px; overflow: hidden; text-overflow: ellipsis; }
.me-more { font-size: 11px; color: var(--muted); }
.me-key { width: 30px; height: 30px; display: grid; place-items: center; border-radius: 50%; background: var(--soft); font-size: 14px; }
.me:not(.owned) .me-label { color: var(--ink-2); font-weight: 600; }
.me-pop { position: absolute; right: 0; top: calc(100% + 8px); width: 330px; max-height: min(70vh, 520px); overflow-y: auto; padding: 14px; z-index: 12; background: #fff; animation: up .25s cubic-bezier(.2,.9,.3,1.2); }
.me-pop .restore { margin-top: 14px; }

/* ---------- dock ---------- */
.dock { position: fixed; left: 16px; bottom: 16px; display: flex; align-items: center; gap: 10px; z-index: 9; flex-wrap: wrap; }
.zoom { display: flex; padding: 4px; gap: 2px; }
.zoom button { min-width: 52px; height: 48px; padding: 4px 6px; border: 0; background: transparent; border-radius: 10px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; color: var(--ink); }
.zoom .zi { font-size: 18px; font-weight: 700; line-height: 1; }
.zoom .zl { font-size: 10px; font-weight: 600; color: var(--muted); line-height: 1.1; white-space: nowrap; }
.zoom button:hover .zl { color: var(--ink); }
.zoom button:hover { background: var(--soft); }
.legend { display: flex; gap: 14px; padding: 10px 14px; font-size: 12px; color: var(--muted); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.lg-free { background: #fff; border: 1.5px dashed #9aa3ad; }
.lg-held { background: #ffe3b8; }
.lg-live { background: var(--coral); }

/* ---------- buttons & form ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 4px; padding: 11px 18px; border-radius: 999px; border: 0; font-weight: 700; text-decoration: none; transition: transform .12s, background .15s; white-space: nowrap; }
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .55; cursor: progress; }
.btn-dark { background: var(--primary); color: #fff; }
.btn-dark:hover { background: var(--primary-hover); }
.btn-dark b { color: #fff; font-weight: 800; }
.btn-light { background: var(--soft); color: var(--ink); border: 1px solid var(--line); }
.btn-light:hover { background: #eaedf2; }
.btn-lg { padding: 14px 22px; font-size: 15px; box-shadow: 0 10px 24px rgba(234,76,137,.32); }
.link { border: 0; background: none; padding: 0; font-weight: 700; color: var(--blue); text-decoration: underline; text-underline-offset: 3px; }
.icon-btn { width: 34px; height: 34px; border-radius: 50%; border: 0; background: var(--soft); font-size: 14px; }
.stack { display: flex; flex-direction: column; gap: 14px; }
.link.forgot { align-self: flex-end; margin-top: -6px; font-size: 13px; }
.inline { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.between { display: flex; justify-content: space-between; gap: 8px; align-items: center; flex-wrap: wrap; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field-label { font-size: 12px; font-weight: 800; color: var(--ink-2); }
.field-label output { font-variant-numeric: tabular-nums; color: var(--blue); }
.hint { font-size: 12px; color: var(--muted); }
.hint.ok { color: #1f9d5a; } .hint.warn { color: #b56a00; }
input:not([type=range]):not([type=file]), textarea { width: 100%; padding: 11px 13px; border-radius: 12px; border: 1px solid var(--line); background: #fff; outline: none; transition: border .15s, box-shadow .15s; }
input:focus, textarea:focus { border-color: var(--blue); box-shadow: 0 0 0 4px rgba(91,108,255,.15); }
textarea { resize: vertical; min-height: 70px; }
.inline input { flex: 1; min-width: 0; }
input[type=range] { width: 100%; accent-color: var(--ink); }
.error { color: #d33; font-size: 13px; font-weight: 600; }
.error:empty { display: none; }
.logo-drop { display: flex; align-items: center; gap: 10px; padding: 6px 12px 6px 6px; border: 1.5px dashed #c6ccd5; border-radius: 14px; cursor: pointer; background: #fff; }
.logo-drop:hover { border-color: var(--ink); }
.logo-drop:focus-within { outline: 3px solid var(--blue); }
.logo-preview { width: 44px; height: 44px; display: grid; place-items: center; border-radius: 10px; background: var(--soft); font-size: 20px; color: var(--muted); overflow: hidden; }
.logo-preview img { width: 100%; height: 100%; object-fit: contain; }
.swatches { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.swatch { width: 24px; height: 24px; border-radius: 50%; border: 2px solid #fff; box-shadow: 0 0 0 1px var(--line); padding: 0; }
.swatch[aria-checked=true] { box-shadow: 0 0 0 2px var(--ink); }
.chips { display: flex; gap: 6px; }
.chip { border: 1px solid var(--line); background: #fff; border-radius: 999px; padding: 4px 10px; font-weight: 700; font-size: 12px; }
.chip:hover { border-color: var(--ink); }
.seg { display: flex; gap: 4px; padding: 4px; background: var(--soft); border-radius: 12px; }
.seg button { flex: 1; border: 1px solid transparent; background: transparent; padding: 8px; border-radius: 9px; font-weight: 700; font-size: 13px; color: var(--muted); white-space: nowrap; transition: background .15s, color .15s, border-color .15s; }
.seg button:hover { color: var(--ink); background: rgba(255,255,255,.6); }
.seg button[aria-checked=true], .seg button[aria-selected=true] { background: #fff; color: var(--ink); box-shadow: 0 1px 3px rgba(20,22,26,.1); }
.callout { padding: 12px 14px; border-radius: 14px; background: #fff8e1; border: 1px solid #ffe7a3; display: flex; flex-direction: column; gap: 6px; }
.callout.live { flex-direction: row; align-items: center; background: #fff0f0; border-color: #ffd1d1; }
.keybox { display: block; padding: 10px; border-radius: 10px; background: #fff; border: 1px solid var(--line); font-size: 12px; word-break: break-all; }

/* ---------- drawer ---------- */
.drawer { position: fixed; left: 16px; top: 84px; width: 380px; max-height: calc(100vh - 196px); overflow-y: auto; padding: 18px; z-index: 11; animation: slide .35s cubic-bezier(.2,.9,.3,1); }
@keyframes slide { from { transform: translateX(-20px); opacity: 0; } }
.drawer-head { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 12px; }
.drawer-head .eyebrow { margin: 0; color: var(--ink); }
.biz { display: flex; gap: 12px; align-items: center; }
.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.kpi { background: var(--soft); border-radius: 12px; padding: 10px 8px; display: flex; flex-direction: column; align-items: center; gap: 2px; }
.kpi b { font-size: 16px; font-weight: 800; font-variant-numeric: tabular-nums; }
.kpi span { font-size: 11px; color: var(--muted); }
.packages { display: flex; flex-direction: column; gap: 8px; }
.package { display: flex; gap: 12px; align-items: center; text-align: left; padding: 12px; border-radius: 14px; border: 1.5px solid var(--line); background: #fff; transition: border-color .15s, background .15s, box-shadow .15s, transform .1s; }
.package:hover { background: #fff7fa; }
.package:active { transform: scale(.99); }
.package[aria-checked=true] { background: #fdeef4; border-color: var(--primary); }
.package[aria-checked=true] .pk-price { color: #c2366d; }
.package:focus-visible { outline: 3px solid var(--primary); outline-offset: 2px; }
.pk-icon { font-size: 24px; }
.pk-main { flex: 1; display: flex; flex-direction: column; gap: 2px; }
.pk-price { font-weight: 800; white-space: nowrap; }
.pk-price small { color: var(--muted); font-weight: 600; }

/* ---------- overlays ---------- */
.tooltip { position: fixed; left: 0; top: 0; z-index: 20; pointer-events: none; display: flex; flex-direction: column; gap: 2px; padding: 8px 11px; border-radius: 12px; background: var(--ink); color: #fff; font-size: 12.5px; box-shadow: 0 8px 24px rgba(0,0,0,.2); }
.tooltip span { color: #c5cad3; }
.tooltip .ok { color: var(--yellow); }
#labels { position: fixed; inset: 0; pointer-events: none; z-index: 5; overflow: hidden; }
.label { position: absolute; left: 0; top: 0; white-space: nowrap; padding: 5px 10px 5px 5px; border-radius: 999px; background: #fff; box-shadow: var(--shadow); font-weight: 700; font-size: 12px; }
#toasts { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; align-items: center; z-index: 30; pointer-events: none; }
.toast { pointer-events: auto; display: flex; gap: 12px; align-items: center; padding: 11px 16px; border-radius: 14px; background: var(--ink); color: #fff; box-shadow: 0 12px 30px rgba(0,0,0,.2); max-width: min(460px, calc(100vw - 32px)); animation: up .35s cubic-bezier(.2,.9,.3,1.2); transition: opacity .4s, transform .4s; }
.toast.quiet { background: rgba(255,255,255,.95); color: var(--ink); }
.toast .link { color: var(--yellow); white-space: nowrap; }
.toast.quiet .link { color: var(--blue); }
.toast.out { opacity: 0; transform: translateY(10px); }
@keyframes up { from { transform: translateY(16px); opacity: 0; } }
.modal { position: fixed; inset: 0; z-index: 40; display: grid; place-items: center; padding: 16px; background: rgba(20,22,26,.35); backdrop-filter: blur(4px); }
.modal-card { width: min(460px, 100%); max-height: calc(100vh - 32px); overflow-y: auto; padding: 24px; background: #fff; animation: up .35s cubic-bezier(.2,.9,.3,1.2); }
.spinner { width: 36px; height: 36px; margin: 0 auto; border-radius: 50%; border: 4px solid var(--soft); border-top-color: var(--ink); animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
/* Bottom-right strip: payment mode badge */
.foot-bar { position: fixed; right: 372px; bottom: 16px; z-index: 8; display: flex; align-items: center; gap: 6px; }
.mode-badge { display: none; }
/* Terms | Privacy at the bottom of the Owner access menu */
.me-legal { display: flex; justify-content: center; align-items: center; gap: 8px; margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); font-size: 12.5px; font-weight: 700; color: var(--muted); }
.me-legal a { color: var(--ink-2); text-decoration: none; }
.me-legal a:hover { color: var(--primary); text-decoration: underline; }
.fatal { position: fixed; inset: 0; margin: auto; width: min(420px, 90vw); height: fit-content; padding: 24px; z-index: 50; }

/* Demo/test badge sits under the panel on desktop */
.mode-badge:not([hidden]) { display: block; padding: 6px 10px; border-radius: 999px; background: #fff3cd; color: #7a5a00; font-size: 12px; font-weight: 700; box-shadow: var(--shadow); }

/* ---------- responsive ---------- */
@media (max-width: 1100px) {
  .legend { display: none; }
}
@media (max-width: 820px) {
  .topbar { top: 10px; left: 10px; right: 10px; flex-wrap: wrap; }
  .brand small { display: none; }
  .stats { padding: 4px; }
  .stat { padding: 5px 8px; font-size: 12px; }
  .hide-sm { display: none; }
  .tools { order: 0; flex: 1; min-width: 0; gap: 8px; }
  .search { flex: 1; width: auto; height: 38px; padding: 0 8px 0 10px; }
  .search input { font-size: 13px; }
  .tool-btn { height: 38px; padding: 0 10px; }
  .tool-label { display: none; }
  .me-wrap { order: 1; }
  .stats { order: 4; }
  .me { height: 38px; padding: 4px 10px 4px 4px; }
  .me-label { max-width: 90px; font-size: 12px; }
  .me-pop { position: fixed; left: 10px; right: 10px; top: 62px; width: auto; }
  .banner { position: fixed; top: 112px; font-size: 13px; }
  .panel { left: 10px; right: 10px; top: auto; bottom: 10px; width: auto; height: 34vh; }
  .dock { left: 10px; right: 10px; bottom: calc(34vh + 20px); }
  .dock .btn-lg { padding: 12px 18px; font-size: 14px; }
  .drawer { left: 0; right: 0; bottom: 0; top: auto; width: auto; max-height: 78vh; border-radius: 22px 22px 0 0; padding: 18px 16px calc(18px + env(safe-area-inset-bottom)); animation-name: sheet; }
  @keyframes sheet { from { transform: translateY(40px); opacity: 0; } }
  .foot-bar { right: 10px; bottom: calc(34vh + 142px); }
  #toasts { bottom: calc(34vh + 142px); }
  .tooltip { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
@media (min-width: 821px) {
  body:has(#drawer:not([hidden])) .dock .btn-lg { display: none; }
}


/* ---------- city rules ---------- */
.rules { padding: 12px 14px; border-radius: 14px; background: #fff5f8; border: 1px solid #fbd3e2; display: flex; flex-direction: column; gap: 10px; }
.rules-title { font-size: 12px; font-weight: 800; color: #b8285e; }
.rule-tags { display: flex; flex-wrap: nowrap; gap: 5px; }
@media (max-width: 360px) { .rule-tags { flex-wrap: wrap; } } /* very small phones: let it wrap rather than spill out */
.rule-tag { white-space: nowrap; font-size: 12px; font-weight: 700; padding: 3px 8px; border-radius: 999px; background: #fff; border: 1px solid #fbd3e2; color: var(--ink-2); }
.check { display: flex; gap: 10px; align-items: flex-start; font-size: 12.5px; color: var(--ink-2); cursor: pointer; }
.check input[type=checkbox] { width: 18px; height: 18px; margin: 1px 0 0; padding: 0; flex: none; accent-color: var(--primary); box-shadow: none; }
.chips.wrap { flex-wrap: wrap; }
.chip[aria-checked=true] { background: var(--ink); color: #fff; border-color: var(--ink); }
.report-link { margin-left: auto; color: var(--muted); font-size: 12.5px; text-decoration: none; }
.report-link:hover { color: #d33; text-decoration: underline; }
.package { cursor: pointer; }
.pk-preview { align-self: flex-start; margin-top: 6px; padding: 5px 10px; border-radius: 999px; border: 1px solid var(--line); background: #fff; font-size: 12px; font-weight: 700; color: var(--ink-2); transition: background .15s, color .15s, border-color .15s; }
.pk-preview:hover { background: var(--primary); border-color: var(--primary); color: #fff; }
.package[aria-checked=true] .pk-preview { border-color: #f4b6cd; }

/* ---------- city switcher ---------- */
.city-wrap { position: relative; }
.city-btn { gap: 8px; padding: 0 14px 0 12px; font-weight: 800; }
.city-btn .city-icon { font-size: 17px; }
.city-btn .city-label { max-width: 180px; overflow: hidden; text-overflow: ellipsis; }
.city-btn .caret { color: var(--muted); font-size: 12px; }
.city-btn[aria-expanded=true] { background: #fff; }
.city-pop { left: 0; right: auto; width: 300px; }
.city-pop .row[aria-selected=true] { background: var(--soft); }
@media (max-width: 820px) {
  /* Row 1: search, leaderboard, owner. Row 2: city, stats. */
  .topbar::before { content: ""; order: 2; flex-basis: 100%; height: 0; margin-top: -4px; }
  .city-wrap { order: 3; }
  .stats .stat:nth-child(2) { display: none; }
  .city-btn { height: 38px; padding: 0 10px; }
  .city-btn .city-label { max-width: 96px; font-size: 12px; }
  .city-pop { position: fixed; left: 10px; right: 10px; top: 104px; width: auto; }
}

/* ---------- Lucide icons ---------- */
.lucide { flex: none; display: inline-block; vertical-align: -3px; }
.caret { color: var(--muted); transition: transform .2s; }
[aria-expanded=true] > .caret { transform: rotate(180deg); }
.me .caret { margin-left: -2px; }
.city-btn .city-icon { color: var(--primary); }
.me-key { color: var(--ink-2); }
.seg button { display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.with-icon { display: flex; align-items: center; gap: 8px; }
.title-icon { color: var(--primary); }
.eyebrow.with-icon .lucide { color: var(--primary); }
.rank.podium { display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; color: #fff; font-size: 12px; }
.rank.podium.r1 { background: #e2b33c; } .rank.podium.r2 { background: #a5aebb; } .rank.podium.r3 { background: #c98a55; }
.row-icon { color: var(--ink-2); }
.k-claim { background: #e3f6ea !important; color: #1f9d5a !important; }
.k-floors { background: #e8ecff !important; color: #4256e0 !important; }
.k-event, .ev-fireworks { background: #ffe8ef !important; color: #d6336c !important; }
.ev-spotlight { background: #fff4d1 !important; color: #a77700 !important; }
.ev-festival { background: #efe9ff !important; color: #7a4ff0 !important; }
.pk-icon { width: 40px; height: 40px; display: grid; place-items: center; border-radius: 12px; }
.rules-title { display: flex; align-items: center; gap: 6px; }
.report-link { display: inline-flex; align-items: center; gap: 5px; }
.banner-icon { color: var(--yellow); }
.label-icon { color: var(--primary); }
.label { display: inline-flex; align-items: center; gap: 5px; }
.logo-preview .lucide { color: var(--muted); }
.pk-preview { display: inline-flex; align-items: center; gap: 5px; }
.tool-btn .caret { color: var(--muted); }

/* ---------- claim flow on phones ---------- */
.pin-label { position: absolute; left: 0; top: 0; display: inline-flex; align-items: center; gap: 5px; padding: 6px 11px 6px 8px; border-radius: 999px; background: var(--primary); color: #fff; font-weight: 800; font-size: 12px; box-shadow: 0 6px 18px rgba(234,76,137,.4); white-space: nowrap; animation: pin-bob 1.6s ease-in-out infinite; }
.pin-label::after { content: ''; position: absolute; left: 50%; bottom: -5px; width: 10px; height: 10px; background: var(--primary); transform: translateX(-50%) rotate(45deg); border-radius: 2px; }
@keyframes pin-bob { 50% { margin-top: -5px; } }
.peek { gap: 12px; }
.peek-title { display: flex; gap: 12px; align-items: center; }
.peek-icon { width: 40px; height: 40px; flex: none; display: grid; place-items: center; border-radius: 12px; background: #fdeef4; color: var(--primary); }
.peek-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.peek-actions .btn { flex: 1 1 auto; }
.peek-actions .btn-lg { padding-left: 14px; padding-right: 14px; }
.chip.with-icon { display: inline-flex; align-items: center; gap: 5px; }
@media (max-width: 820px) {
  /* Map controls and the demo badge would sit on top of the sheet. */
  body:has(#drawer:not([hidden])) .dock,
  body:has(#drawer:not([hidden])) #panel,
  body:has(#drawer:not([hidden])) #footBar { display: none !important; }
  .drawer::before { content: ''; display: block; width: 40px; height: 4px; border-radius: 4px; background: #d6dbe2; margin: -6px auto 10px; }
  .drawer[data-sheet=peek] .drawer-head, .drawer[data-sheet=mini] .drawer-head { margin-bottom: 4px; }
}

/* ---------- full screen map (phones) ---------- */
.only-phone { display: none !important; }
#fullMap[aria-pressed=true] { color: var(--primary); }
#fullMap[aria-pressed=true] .zl { color: var(--primary); }
@media (max-width: 820px) {
  .only-phone { display: flex !important; }
  .zoom button { min-width: 0; flex: 1; padding: 4px 4px; }
  .zoom { flex: 1; }
  body.map-only .topbar,
  body.map-only #panel,
  body.map-only #footBar,
  body.map-only .dock .btn-lg,
  body.map-only .legend { display: none !important; }
  body.map-only .dock { bottom: calc(12px + env(safe-area-inset-bottom)); right: 10px; }
  body.map-only #toasts { bottom: calc(90px + env(safe-area-inset-bottom)); }
}

/* ---------- City Explorer ---------- */
.tool-btn.explore-btn { background: var(--primary); color: #fff; border-color: transparent; }
.tool-btn.explore-btn svg { color: #fff; }
.tool-btn.explore-btn:hover { background: var(--primary-hover); }
.tool-btn.explore-btn[aria-pressed=true] { background: var(--ink); }
.hud { position: fixed; left: 50%; bottom: 16px; transform: translateX(-50%); z-index: 10; display: flex; align-items: center; gap: 6px; padding: 6px; white-space: nowrap; animation: up .3s cubic-bezier(.2,.9,.3,1.2); }
.hud button { border: 0; background: transparent; }
.hud-coins { display: inline-flex; align-items: center; gap: 6px; padding: 8px 12px; border-radius: 12px; background: #fff4d1 !important; color: #8a6200; font-weight: 800; }
.hud-heat { display: inline-flex; align-items: center; gap: 6px; padding: 8px 12px; border-radius: 12px; background: var(--soft); font-weight: 700; font-size: 13px; color: var(--ink-2); }
.hud-heat.hot { background: #ffe1e1; color: #d33; animation: blink 1s infinite; }
.hud-heat.warm { background: #ffeedd; color: #c76a00; }
.hud-heat.cool { background: #e5f2ff; color: #2b6cb0; }
.hud-heat.cold { background: #eef1f5; color: #6b7280; }
.hud-btn { display: inline-flex; align-items: center; gap: 6px; padding: 8px 12px; border-radius: 12px; font-weight: 700; font-size: 13px; color: var(--ink-2); }
.hud-btn:hover { background: var(--soft) !important; }
.hud-btn.icon-only { padding: 8px; }
.you-label { position: absolute; left: 0; top: 0; padding: 3px 9px; border-radius: 999px; background: var(--ink); color: #fff; font-weight: 800; font-size: 11px; white-space: nowrap; }
.found .found-icon { width: 64px; height: 64px; margin: 0 auto; display: grid; place-items: center; border-radius: 20px; background: #fff4d1; color: #c99400; animation: pop .5s cubic-bezier(.2,.9,.3,1.6); }
.found h2 { font-size: 28px; }
@keyframes pop { from { transform: scale(.4); opacity: 0; } }
.hint-row.done .row-title { color: var(--muted); text-decoration: line-through; }
.hint-row .row-title { white-space: normal; }
.wallet-balance { display: flex; align-items: center; gap: 10px; padding: 14px; border-radius: 16px; background: #fff8e1; color: #8a6200; }
.wallet-balance b { font-size: 30px; color: var(--ink); }
.gift-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.gift { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; padding: 12px; border-radius: 14px; border: 1.5px solid var(--line); background: #fff; text-align: left; }
.gift:not(:disabled):hover { border-color: var(--primary); background: #fff7fa; }
.gift:disabled { opacity: .45; cursor: not-allowed; }
.gift .lucide { color: var(--primary); }
.status { font-size: 11px; font-weight: 800; padding: 3px 8px; border-radius: 999px; }
.s-pending { background: #fff4d1; color: #8a6200; } .s-sent { background: #e3f6ea; color: #1f9d5a; } .s-rejected { background: #ffe8e8; color: #d33; }
.row-num.plus { color: #1f9d5a; } .row-num.minus { color: #d33; }
body.exploring .dock .btn-lg, body.exploring .legend { display: none !important; }
@media (max-width: 820px) {
  body.exploring #panel, body.exploring #footBar { display: none !important; }
  body.exploring .dock { bottom: calc(12px + env(safe-area-inset-bottom)); }
  .hud { bottom: calc(76px + env(safe-area-inset-bottom)); left: 10px; right: 10px; transform: none; justify-content: space-between; }
  .hud-heat { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
  body.exploring #toasts { bottom: calc(140px + env(safe-area-inset-bottom)); }
}
/* Messages sit above the points bar while exploring, never on top of it. */
body.exploring #toasts { bottom: 84px; }
@media (max-width: 820px) { body.exploring #toasts { bottom: calc(140px + env(safe-area-inset-bottom)); } }
body.exploring #footBar { display: none !important; }
.k-tree { background: #e3f6ea !important; color: #2f8f5b !important; }
.found .found-icon.tree { background: #e3f6ea; color: #2f8f5b; }

/* ---------- owner accounts ---------- */
.account-callout { background: #fff; border-color: var(--line); }
.account-box input:not([type=checkbox]) { width: 100%; }
.saved { color: #1f9d5a; font-weight: 700; display: flex; align-items: center; gap: 6px; }
.owner-link summary { cursor: pointer; font-weight: 700; font-size: 13px; color: var(--ink-2); }
.owner-link[open] { display: flex; flex-direction: column; gap: 8px; }
.account-line { margin-top: 12px; }
#mePop > .btn { width: 100%; margin-top: 12px; }

/* ---------- top bar on mid-size screens ----------
   City switcher, search, Leaderboard, Earn Rewards, stats and the owner button need
   ~1450px; drop the least important pieces step by step so nothing runs off screen. */
@media (min-width: 821px) {
  .topbar > * { flex-shrink: 0; }
  .topbar .tools { min-width: 0; flex-shrink: 1; }
  .topbar .search { flex-shrink: 1; min-width: 160px; }
}
@media (max-width: 820px) {
  /* Phones: search shrinks so the trophy, gift and owner buttons all fit on row 1. */
  .topbar .search { min-width: 0; }
  .me-wrap { flex-shrink: 1; min-width: 0; }
  .me-label { max-width: 76px; }
}
@media (min-width: 821px) and (max-width: 1460px) {
  .stats .stat:nth-child(2), .stats .hide-sm { display: none; }
  .search { width: 240px; }
}
@media (min-width: 821px) and (max-width: 1240px) {
  #leaderBtn .tool-label { display: none; }
  #leaderBtn { padding: 0 12px; }
  .me-label { max-width: 110px; }
}
@media (min-width: 821px) and (max-width: 1080px) {
  #exploreBtn .tool-label { display: none; }
  #exploreBtn { padding: 0 12px; }
  .search { width: 200px; }
  .city-btn .city-label { max-width: 110px; }
}

/* Building style picker (claim form and Edit tab) */
.shapes { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; margin-top: 6px; }
.shape-opt { display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 7px 2px 6px; border-radius: 12px; border: 1px solid var(--line); background: #fff; cursor: pointer; font: inherit; }
.shape-opt svg { width: 26px; height: 36px; }
.shape-opt span { font-size: 11px; font-weight: 700; color: var(--ink-2); }
.shape-opt:hover { background: var(--soft); }
.shape-opt[aria-checked=true] { border-color: var(--primary); background: #fdeef4; box-shadow: 0 0 0 1px var(--primary); }
.shape-opt:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }

/* Explorer badges and leaderboard */
.badge-ic { --c: #8e99a8; display: inline-grid; place-items: center; flex: none; width: 24px; height: 24px; border-radius: 50%; color: #fff;
  background: radial-gradient(circle at 32% 28%, color-mix(in srgb, var(--c) 45%, #fff) 0%, var(--c) 58%, color-mix(in srgb, var(--c) 78%, #000) 100%);
  box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--c) 70%, #fff), inset 0 -3px 0 rgba(0,0,0,.12), 0 1px 3px rgba(20,22,26,.18); }
/* The coin must stay a centred grid wherever it sits, whatever the parent does to spans. */
span.badge-ic { display: inline-grid; place-items: center; aspect-ratio: 1; padding: 0; margin: 0; gap: 0; line-height: 0; box-sizing: border-box; }
.badge-ic svg { display: block; width: 56%; height: 56%; margin: 0; vertical-align: 0; stroke-width: 2.4; filter: drop-shadow(0 1px 0 rgba(0,0,0,.18)); }
.badge-ic.locked { width: 46px; height: 46px; background: var(--soft); color: var(--muted); box-shadow: inset 0 0 0 1.5px var(--line); }
.badge-ic.locked svg { width: 40%; height: 40%; filter: none; stroke-width: 2; }
.badge-name { margin-left: auto; font-weight: 800; font-size: 13px; padding: 4px 10px; border-radius: 999px; background: var(--soft); }
.badge-progress { display: flex; flex-direction: column; gap: 6px; }
.badge-progress .bar { height: 8px; }
.badge-progress .bar i { background: var(--primary); }
.badge-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.badge-card { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 12px 6px; border-radius: 14px; border: 1px solid var(--line); text-align: center; }
.badge-card b { font-size: 12.5px; line-height: 1.2; }
.badge-card:not(.got) b { color: var(--muted); }
.badge-card.got { background: #fff; }
.new-badge { display: flex; align-items: center; gap: 12px; padding: 10px 14px; border-radius: 14px; background: #fdeef4; text-align: left; }
.badge-legend { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 12px; color: var(--muted); font-weight: 600; }
.badge-legend > span { display: inline-flex; align-items: center; gap: 6px; }
.explorer-dot { width: 36px; height: 36px; border-radius: 50%; flex: none; display: grid; place-items: center; color: #fff; font-size: 13px; font-weight: 800; }
.ranks .you-row { background: #fdeef4; }
.ranks .gap { text-align: center; color: var(--muted); padding: 2px 0; }
@media (max-width: 480px) { .badge-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* Password fields: Show/Hide inside the input, on the right */
.pw-field { position: relative; display: block; }
.pw-field input { width: 100%; padding-right: 64px !important; }
.pw-toggle { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); border: 0; background: var(--soft); color: var(--ink-2); font: inherit; font-size: 12px; font-weight: 800; padding: 5px 10px; border-radius: 8px; cursor: pointer; }
.pw-toggle:hover { color: var(--primary); }
.pw-toggle:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }

/* ---------- explorer direction pad + vehicle switch ---------- */
.drive { position: fixed; left: 16px; bottom: 92px; z-index: 11; display: flex; align-items: flex-end; gap: 10px; animation: up .3s cubic-bezier(.2,.9,.3,1.2); }
.drive[hidden] { display: none; }
.vehicles { display: flex; flex-direction: column; gap: 4px; padding: 5px; border-radius: 18px; }
.veh { width: 40px; height: 40px; display: grid; place-items: center; border: 0; border-radius: 13px; background: transparent; color: var(--ink-2); }
.veh:hover { background: var(--soft); }
.veh[aria-checked="true"] { background: var(--ink); color: #fff; }
.pad { position: relative; width: 138px; height: 138px; border-radius: 50%; padding: 0; touch-action: none; user-select: none; -webkit-user-select: none; }
.pad-btn { position: absolute; display: grid; place-items: center; border: 0; background: transparent; color: var(--ink); touch-action: none; -webkit-tap-highlight-color: transparent; }
.pad-btn svg { stroke-width: 3.2; }
.pad-btn { width: 46px; height: 46px; border-radius: 50%; }
.pad-btn:hover, .pad-btn.on { background: var(--soft); color: var(--ink); }
.pad-btn.on { transform: scale(.94); }
.pad-up { top: 4px; left: 46px; } .pad-down { bottom: 4px; left: 46px; }
.pad-left { left: 4px; top: 46px; } .pad-right { right: 4px; top: 46px; }
.pad-hub { position: absolute; left: 59px; top: 59px; width: 20px; height: 20px; border-radius: 50%; background: var(--soft); pointer-events: none; }
@media (max-width: 820px) {
  .drive { left: auto; right: 10px; bottom: calc(142px + env(safe-area-inset-bottom)); flex-direction: row; }
  .pad { width: 126px; height: 126px; }
  .pad-btn { width: 42px; height: 42px; }
  .pad-up { left: 42px; } .pad-down { left: 42px; } .pad-left { top: 42px; } .pad-right { top: 42px; }
  .pad-hub { left: 53px; top: 53px; }
  .veh { width: 38px; height: 38px; }
  body.exploring #toasts { bottom: calc(282px + env(safe-area-inset-bottom)); }
}

/* ---------- phones: search is a round icon button that opens a full-width search bar ---------- */
@media (max-width: 820px) {
  .search { flex: none; width: 38px; padding: 0; justify-content: center; cursor: pointer; }
  .search .search-icon { color: var(--primary); }
  .search input { display: none; }
  body.search-open .search { position: fixed; left: 10px; right: 10px; top: 10px; width: auto; z-index: 14; justify-content: flex-start; padding: 0 8px 0 12px; cursor: auto; }
  body.search-open .search .search-icon { color: var(--muted); }
  body.search-open .search input { display: block; }
  .search-results { width: auto; right: 0; max-width: none; }
  /* The space search used to take now shows Earn Rewards with its name. */
  #exploreBtn .tool-label { display: inline; }
  #exploreBtn { padding: 0 12px 0 10px; }
}
@media (max-width: 820px) {
  /* Row 1 on phones: [search][trophy][Earn Rewards] on the left, the owner button takes what's left. */
  .tools { flex: none; }
  .me-wrap { flex: 1 1 0; min-width: 0; display: flex; justify-content: flex-end; }
  .me { min-width: 0; max-width: 100%; }
  .me-label { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
}
