/* worldbid — one stylesheet for every page. Themes are driven by [data-theme] on <html>. */

:root {
  --bg: #ffffff;
  --bg-raised: #fafafa;
  --ink: #111113;
  --ink-2: #52525b;
  --muted: #8a8a93;
  --line: #e6e6ea;
  --line-strong: #d4d4d8;
  --land: #e4e4e7;
  --land-hover: #c9c9cf;
  --crown: #e0a81a;
  --crown-soft: #fff4d6;
  --danger: #d13f3f;
  --ok: #1f9d55;
  --shadow: 0 1px 2px rgba(0,0,0,.05), 0 8px 24px rgba(0,0,0,.06);
  --radius: 12px;
  --font-ui: "Geist", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-display: var(--font-ui);
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color-scheme: light;
}
html[data-theme="dark"] {
  --bg: #0c0c0e;
  --bg-raised: #141417;
  --ink: #f4f4f5;
  --ink-2: #b4b4bc;
  --muted: #76767f;
  --line: #232327;
  --line-strong: #2f2f35;
  --land: #27272c;
  --land-hover: #3d3d45;
  --crown: #f2b82b;
  --crown-soft: #2a2311;
  --shadow: 0 1px 2px rgba(0,0,0,.4), 0 12px 32px rgba(0,0,0,.5);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font-ui);
  font-size: 15px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--bg);
  font-feature-settings: "tnum" 1, "cv11" 1;
}
a { color: inherit; text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; border-radius: 4px; }
img { display: block; }
.hidden { display: none !important; }

.wrap { width: 100%; max-width: 760px; margin: 0 auto; padding: 0 20px; }
.wrap-wide { max-width: 1120px; }

/* ---------- header ---------- */
.site-header {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 18px 0 14px;
}
.brand { font-family: var(--font-display); font-weight: 700; font-size: 18px; letter-spacing: -.02em; }
.brand:hover { text-decoration: none; }
.nav { display: flex; align-items: center; gap: 4px; }
.nav a { padding: 6px 10px; border-radius: 8px; color: var(--ink-2); font-size: 14px; }
.nav a:hover { background: var(--bg-raised); text-decoration: none; color: var(--ink); }
.nav a[aria-current="page"] { color: var(--ink); font-weight: 600; }
.theme-btn {
  width: 34px; height: 34px; border-radius: 8px; border: 1px solid var(--line); background: var(--bg);
  display: grid; place-items: center; color: var(--ink-2);
}
.theme-btn:hover { border-color: var(--line-strong); color: var(--ink); }
.theme-btn svg { width: 16px; height: 16px; }
html[data-theme="dark"] .theme-btn .sun { display: block; }
html[data-theme="dark"] .theme-btn .moon { display: none; }
.theme-btn .sun { display: none; }

.statline { font-size: 13px; color: var(--muted); margin: 0 0 26px; }
.statline a { color: var(--muted); }
.statline .live::before {
  content: ""; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--ok);
  margin-right: 7px; vertical-align: 1px; box-shadow: 0 0 0 3px color-mix(in srgb, var(--ok) 20%, transparent);
}

/* ---------- type ---------- */
h1, h2, h3 { font-family: var(--font-display); letter-spacing: -.025em; line-height: 1.1; margin: 0; }
h1 { font-size: clamp(32px, 5.5vw, 48px); font-weight: 700; letter-spacing: -.035em; }
h2 { font-size: 20px; font-weight: 700; margin: 0 0 14px; }
h3 { font-size: 16px; font-weight: 700; }
.lede { font-size: 17px; color: var(--ink-2); max-width: 58ch; margin: 14px 0 0; }
.lede strong { color: var(--ink); font-weight: 600; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.num { font-variant-numeric: tabular-nums; }
section { margin: 40px 0; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.section-head h2 { margin: 0; }
.section-head .small { text-align: right; }

/* ---------- buttons & inputs ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 40px; padding: 0 16px; border-radius: 10px; border: 1px solid var(--ink);
  background: var(--ink); color: var(--bg); font-weight: 600; font-size: 14px; white-space: nowrap;
}
.btn:hover { text-decoration: none; opacity: .9; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-ghost { background: var(--bg); color: var(--ink); border-color: var(--line-strong); }
.btn-ghost:hover { background: var(--bg-raised); opacity: 1; }
.btn-sm { height: 30px; padding: 0 10px; font-size: 13px; border-radius: 8px; }
.btn-block { width: 100%; height: 46px; font-size: 15px; }
.input {
  width: 100%; height: 42px; padding: 0 12px; border-radius: 10px; border: 1px solid var(--line-strong);
  background: var(--bg); color: var(--ink);
}
.input::placeholder { color: var(--muted); }
.input:focus { outline: none; border-color: var(--ink); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ink) 10%, transparent); }
.input[aria-invalid="true"] { border-color: var(--danger); }
label.field { display: block; font-size: 13px; font-weight: 600; color: var(--ink-2); margin-bottom: 6px; }

/* ---------- map ---------- */
.map-shell { position: relative; margin-top: 28px; }
.map-toolbar { display: flex; gap: 8px; align-items: center; justify-content: space-between; flex-wrap: wrap; margin-bottom: 10px; }
.map-search { position: relative; flex: 1 1 220px; max-width: 340px; }
.map-search .input { height: 38px; padding-left: 36px; }
.map-search svg { position: absolute; left: 12px; top: 11px; width: 16px; height: 16px; color: var(--muted); pointer-events: none; }
.map-search-results {
  position: absolute; z-index: 20; top: 42px; left: 0; right: 0; max-height: 280px; overflow: auto;
  background: var(--bg); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow); padding: 4px;
}
.map-search-results button {
  display: flex; width: 100%; align-items: center; gap: 10px; padding: 8px 10px; border: 0; background: none; border-radius: 6px; text-align: left;
}
.map-search-results button:hover, .map-search-results button[aria-selected="true"] { background: var(--bg-raised); }
.map-search-results .price { margin-left: auto; color: var(--muted); font-size: 13px; }
.map-legend { display: flex; gap: 14px; font-size: 13px; color: var(--muted); flex-wrap: wrap; }
.map-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.zoom-btns { display: flex; gap: 4px; }
.zoom-btns button { width: 34px; height: 34px; border-radius: 8px; border: 1px solid var(--line); background: var(--bg); color: var(--ink-2); font-size: 18px; line-height: 1; display: grid; place-items: center; }
.zoom-btns button:hover { border-color: var(--line-strong); color: var(--ink); }

.map-frame {
  position: relative; border: 1px solid var(--line); border-radius: 16px; background: var(--bg-raised);
  overflow: hidden; touch-action: none; user-select: none; -webkit-user-select: none;
}
.map-frame svg { display: block; width: 100%; height: auto; aspect-ratio: 1010 / 640; cursor: grab; }
.map-frame svg.dragging { cursor: grabbing; }
.map-frame path { fill: var(--land); stroke: var(--bg-raised); stroke-width: .35; transition: fill .15s; cursor: pointer; vector-effect: non-scaling-stroke; }
.map-frame path:hover, .map-frame path.hot { fill: var(--land-hover); }
.map-frame path.owned:hover, .map-frame path.owned.hot { filter: brightness(.85); }
.map-frame path.selected { stroke: var(--ink); stroke-width: 1.4; }
.pin { cursor: pointer; }
.pin circle.ring { fill: var(--bg); }
.pin image { pointer-events: none; }
.pin text { fill: #fff; font-weight: 700; text-anchor: middle; dominant-baseline: central; pointer-events: none; font-family: var(--font-ui); }
.map-hint { position: absolute; right: 12px; bottom: 10px; font-size: 11px; color: var(--muted); background: color-mix(in srgb, var(--bg) 75%, transparent); padding: 3px 8px; border-radius: 6px; pointer-events: none; }
.map-loading { position: absolute; inset: 0; display: grid; place-items: center; color: var(--muted); font-size: 13px; }

.tip {
  position: fixed; z-index: 50; pointer-events: none; opacity: 0; transform: translateY(4px); transition: opacity .12s, transform .12s;
  background: var(--bg); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow); padding: 10px 12px; min-width: 180px; max-width: 260px;
}
.tip.show { opacity: 1; transform: none; }
.tip .t-name { font-weight: 700; display: flex; align-items: center; gap: 8px; }
.tip .t-owner { display: flex; align-items: center; gap: 8px; margin-top: 8px; font-size: 13px; }
.tip .t-price { margin-top: 6px; font-size: 13px; color: var(--ink-2); }
.tip .t-cta { margin-top: 6px; font-size: 12px; color: var(--muted); }

/* ---------- avatars & flags ---------- */
.avatar { width: 28px; height: 28px; border-radius: 50%; background: var(--land); object-fit: cover; flex: none; }
.avatar.sq { border-radius: 7px; }
.avatar.lg { width: 56px; height: 56px; }
.avatar.sm { width: 20px; height: 20px; }
.avatar-fallback {
  display: grid; place-items: center; font-weight: 700; font-size: 12px; color: #fff; text-transform: uppercase;
}
.flag { font-size: 18px; line-height: 1; font-family: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", "Twemoji Mozilla", sans-serif; }
.flag.lg { font-size: 28px; }

/* ---------- king card ---------- */
.king {
  display: grid; grid-template-columns: auto 1fr auto; gap: 18px; align-items: center;
  border: 1px solid var(--crown); background: var(--crown-soft); border-radius: 16px; padding: 18px 20px;
}
.king .crown { position: relative; }
.king .crown::after { content: "👑"; position: absolute; top: -16px; left: 50%; transform: translateX(-50%) rotate(-12deg); font-size: 22px; }
.king .k-label { font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--crown); }
.king .k-name { font-family: var(--font-display); font-size: 22px; font-weight: 800; letter-spacing: -.02em; }
.king .k-meta { color: var(--ink-2); font-size: 14px; margin-top: 2px; }
.king .k-flags { margin-top: 8px; display: flex; flex-wrap: wrap; gap: 4px; }
.king .k-flags .flag { font-size: 20px; }
.king .k-side { text-align: right; font-size: 13px; color: var(--ink-2); }
.king .k-side b { display: block; font-family: var(--font-display); font-size: 26px; color: var(--ink); letter-spacing: -.02em; }
.king.empty { grid-template-columns: 1fr; text-align: center; color: var(--ink-2); }
@media (max-width: 560px) { .king { grid-template-columns: auto 1fr; } .king .k-side { grid-column: 1 / -1; text-align: left; display: flex; gap: 18px; } .king .k-side b { display: inline; font-size: 18px; margin-right: 6px; } }

/* ---------- lists ---------- */
.list { border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: var(--bg); }
.row {
  display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-top: 1px solid var(--line); min-width: 0;
}
.row:first-child { border-top: 0; }
.row.link:hover { background: var(--bg-raised); text-decoration: none; }
.row .rank { width: 28px; flex: none; color: var(--muted); font-size: 13px; font-weight: 600; }
.row .rank.top { color: var(--crown); }
.row .body { flex: 1; min-width: 0; }
.row .title { display: flex; align-items: center; gap: 8px; font-weight: 600; min-width: 0; }
.row .title .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .sub { font-size: 13px; color: var(--muted); margin-top: 2px; display: flex; gap: 6px; flex-wrap: wrap; }
.row .sub .sep::before { content: "·"; margin: 0 2px; }
.row .right { text-align: right; flex: none; }
.row .right .price { font-weight: 700; font-size: 15px; }
.row .right .sub { justify-content: flex-end; }
.row .claim { flex: none; }
.row .flags { display: flex; flex-wrap: wrap; gap: 2px; margin-top: 4px; max-height: 46px; overflow: hidden; }
.row .flags .flag { font-size: 15px; }
.empty { padding: 28px 16px; text-align: center; color: var(--muted); font-size: 14px; }
.show-more { margin-top: 8px; font-size: 13px; color: var(--muted); background: none; border: 0; padding: 6px 0; }
.show-more:hover { color: var(--ink); text-decoration: underline; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
@media (max-width: 720px) { .two-col { grid-template-columns: 1fr; } }
@media (max-width: 520px) { .row .claim .btn { padding: 0 8px; } .row .sub .hide-sm { display: none; } }

/* ---------- chart ---------- */
.chart-card { border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.chart-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.chart-tabs { display: flex; gap: 2px; background: var(--bg-raised); border: 1px solid var(--line); border-radius: 8px; padding: 2px; }
.chart-tabs button { border: 0; background: none; padding: 4px 10px; border-radius: 6px; font-size: 13px; color: var(--muted); }
.chart-tabs button[aria-pressed="true"] { background: var(--bg); color: var(--ink); box-shadow: 0 1px 2px rgba(0,0,0,.08); }
.chart-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 10px; margin-bottom: 14px; }
.kpi { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; }
.kpi { min-width: 0; }
.kpi .v { font-family: var(--font-display); font-size: 20px; overflow-wrap: anywhere; font-weight: 800; letter-spacing: -.02em; line-height: 1.1; }
.kpi .l { font-size: 12px; color: var(--muted); margin-top: 2px; }
.chart { width: 100%; height: auto; display: block; }
.chart .bar { fill: var(--ink); opacity: .85; }
.chart .bar:hover { opacity: 1; }
.chart .bar.revenue { fill: var(--crown); }
.chart .axis { fill: var(--muted); font-size: 10px; }
.chart .grid { stroke: var(--line); stroke-width: 1; }
.chart-legend { display: flex; gap: 14px; font-size: 12px; color: var(--muted); margin-top: 8px; }
.chart-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 5px; vertical-align: -1px; }

.api-down { display: none; margin: 0 0 18px; padding: 12px 14px; border-radius: 10px; border: 1px solid var(--danger); background: color-mix(in srgb, var(--danger) 10%, var(--bg)); font-size: 13px; line-height: 1.5; }
.api-down.show { display: block; }
.api-down code { font-family: var(--font-mono); font-size: 12px; background: color-mix(in srgb, var(--ink) 8%, transparent); padding: 1px 5px; border-radius: 4px; }

/* ---------- dialog ---------- */
dialog.sheet {
  border: 1px solid var(--line); border-radius: 18px; padding: 0; background: var(--bg); color: var(--ink);
  width: min(460px, calc(100vw - 24px)); box-shadow: var(--shadow);
}
dialog.sheet::backdrop { background: rgba(0,0,0,.45); backdrop-filter: blur(2px); }
.sheet-body { padding: 22px 22px 20px; }
.sheet-head { display: flex; align-items: center; gap: 12px; margin-bottom: 6px; }
.sheet-head h2 { margin: 0; font-size: 22px; }
.sheet-close { margin-left: auto; width: 32px; height: 32px; border-radius: 8px; border: 0; background: var(--bg-raised); color: var(--muted); font-size: 18px; }
.holder { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--ink-2); padding: 10px 12px; border: 1px dashed var(--line-strong); border-radius: 10px; margin: 12px 0 18px; }
.holder b { color: var(--ink); }
.amount { display: grid; grid-template-columns: 44px 1fr 44px; gap: 6px; align-items: center; }
.amount button { height: 44px; border-radius: 10px; border: 1px solid var(--line-strong); background: var(--bg); font-size: 20px; color: var(--ink-2); }
.amount button:hover { background: var(--bg-raised); }
.amount .amount-field { position: relative; }
.amount .amount-field span { position: absolute; left: 14px; top: 9px; font-size: 18px; color: var(--muted); }
.amount .input { height: 44px; padding-left: 30px; font-size: 20px; font-weight: 700; text-align: left; }
.preview { display: flex; align-items: center; gap: 10px; min-height: 44px; margin: 10px 0 14px; font-size: 13px; color: var(--ink-2); }
.preview .pay { margin-left: auto; font-weight: 700; color: var(--ink); white-space: nowrap; }
.preview.err { color: var(--danger); }
.donate-note { margin: 12px 0 0; padding: 10px 12px; border-radius: 10px; font-size: 13px; line-height: 1.45; color: var(--ink-2); background: color-mix(in srgb, var(--crown) 12%, var(--bg)); border: 1px solid color-mix(in srgb, var(--crown) 35%, transparent); }
.donate-note b { color: var(--ink); }
.made-donate { margin-top: 14px !important; font-size: 15px; }
.made-donate b { color: var(--ink); }
.fine { font-size: 12px; color: var(--muted); margin-top: 12px; line-height: 1.5; }
.fine a { text-decoration: underline; text-underline-offset: 2px; }

/* ---------- toast ---------- */
.toast {
  position: fixed; z-index: 60; left: 50%; bottom: 22px; transform: translate(-50%, 20px); opacity: 0; transition: .2s;
  background: var(--ink); color: var(--bg); padding: 12px 16px; border-radius: 10px; font-size: 14px; box-shadow: var(--shadow); max-width: calc(100vw - 32px);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- footer ---------- */
.site-footer .credit { display: block; margin-top: 8px; font-size: 12px; opacity: .7; }
.made { text-align: center; margin: 64px 0 24px; }
.made .made-num { font-family: var(--font-display); font-size: clamp(44px, 9vw, 72px); font-weight: 800; letter-spacing: -.04em; line-height: 1; margin: 8px 0; }
.made p { margin: 0; color: var(--ink-2); }
.site-footer { border-top: 1px solid var(--line); padding: 20px 0 40px; font-size: 13px; color: var(--muted); text-align: center; }
.site-footer a { color: var(--muted); }

/* ---------- prose pages ---------- */
.prose { max-width: 640px; }
.prose h1 { margin-bottom: 18px; }
.prose h2 { margin-top: 34px; }
.prose p { color: var(--ink-2); }
.prose ul { padding-left: 20px; color: var(--ink-2); }
.prose li { margin: 6px 0; }
.prose li::marker { color: var(--muted); }
.prose strong { color: var(--ink); }
.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin: 22px 0; }
.facts .kpi .v { font-size: 26px; }
.author { display: flex; align-items: center; gap: 14px; margin-top: 36px; padding: 16px; border: 1px solid var(--line); border-radius: var(--radius); }
.author p { margin: 0; }

@media (max-width: 520px) {
  .site-header { padding-top: 14px; }
  .brand { font-size: 16px; }
  .nav { gap: 0; }
  .nav a { padding: 6px 7px; font-size: 13px; }
  .theme-btn { width: 30px; height: 30px; margin-left: 2px; }
  .map-legend { display: none; }
}

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; animation: none !important; } }
