:root {
  --bg: #f5f5f4;
  --surface: #ffffff;
  --surface-2: #fafaf9;
  --text: #1c1917;
  --muted: #78716c;
  --border: #e7e5e4;
  --accent: #b45309;
  --accent-hover: #92400e;
  --on-accent: #ffffff;
  --accent-soft: rgba(180, 83, 9, 0.12);
  --danger: #b91c1c;
  --canvas-outside: #eceae6;
  --canvas-paper: #ffffff;
  --canvas-grid: rgba(28, 25, 23, 0.06);
  --canvas-border: rgba(28, 25, 23, 0.22);
  --canvas-locked: rgba(28, 25, 23, 0.035);
  --canvas-seam: rgba(28, 25, 23, 0.12);
  --premium: rgba(217, 119, 6, 0.22);
  --sel-fill: rgba(180, 83, 9, 0.24);
  --shadow: 0 12px 32px rgba(28, 25, 23, 0.14), 0 2px 6px rgba(28, 25, 23, 0.08);
  --radius: 12px;
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0c0a09;
    --surface: #1c1917;
    --surface-2: #231f1d;
    --text: #f5f5f4;
    --muted: #a8a29e;
    --border: #322d29;
    --accent: #f59e0b;
    --accent-hover: #fbbf24;
    --on-accent: #1c1917;
    --accent-soft: rgba(245, 158, 11, 0.14);
    --danger: #f87171;
    --canvas-outside: #0c0a09;
    --canvas-paper: #171412;
    --canvas-grid: rgba(255, 255, 255, 0.06);
    --canvas-border: rgba(255, 255, 255, 0.22);
    --canvas-locked: rgba(255, 255, 255, 0.03);
  --canvas-seam: rgba(255, 255, 255, 0.08);
    --premium: rgba(245, 158, 11, 0.16);
    --sel-fill: rgba(245, 158, 11, 0.26);
    --shadow: 0 12px 32px rgba(0, 0, 0, 0.5), 0 2px 6px rgba(0, 0, 0, 0.4);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0c0a09;
  --surface: #1c1917;
  --surface-2: #231f1d;
  --text: #f5f5f4;
  --muted: #a8a29e;
  --border: #322d29;
  --accent: #f59e0b;
  --accent-hover: #fbbf24;
  --on-accent: #1c1917;
  --accent-soft: rgba(245, 158, 11, 0.14);
  --danger: #f87171;
  --canvas-outside: #0c0a09;
  --canvas-paper: #171412;
  --canvas-grid: rgba(255, 255, 255, 0.06);
  --canvas-border: rgba(255, 255, 255, 0.22);
  --canvas-locked: rgba(255, 255, 255, 0.03);
  --canvas-seam: rgba(255, 255, 255, 0.08);
  --premium: rgba(245, 158, 11, 0.16);
  --sel-fill: rgba(245, 158, 11, 0.26);
  --shadow: 0 12px 32px rgba(0, 0, 0, 0.5), 0 2px 6px rgba(0, 0, 0, 0.4);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 14px/1.45 var(--font);
  -webkit-font-smoothing: antialiased;
}
[hidden] { display: none !important; }
a { color: var(--accent); }
button { font: inherit; color: inherit; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 36px; padding: 0 14px; border-radius: 9px; border: 1px solid transparent;
  font-weight: 600; cursor: pointer; text-decoration: none; white-space: nowrap;
  transition: background-color .15s, border-color .15s, color .15s;
}
.btn.primary { background: var(--accent); color: var(--on-accent); }
.btn.primary:hover { background: var(--accent-hover); }
.btn.primary:disabled { opacity: .5; cursor: not-allowed; }
.btn.ghost { background: transparent; border-color: var(--border); color: var(--text); }
.btn.ghost:hover, .btn.ghost.on { background: var(--accent-soft); border-color: var(--accent); }
.btn.square { width: 36px; padding: 0; font-size: 16px; }
.btn.small { height: 30px; padding: 0 12px; font-size: 13px; }
.btn.wide { width: 100%; }
.btn:focus-visible, .icon-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.icon-btn {
  width: 32px; height: 32px; border-radius: 8px; border: 0; background: transparent;
  font-size: 18px; line-height: 1; cursor: pointer; color: var(--muted);
}
.icon-btn:hover { background: var(--accent-soft); color: var(--text); }

/* ---------- App shell ---------- */
body.app { height: 100dvh; display: grid; grid-template-rows: auto auto 1fr auto; overflow: hidden; }
.bar {
  display: flex; align-items: center; gap: 16px; padding: 10px 16px;
  background: var(--surface); border-bottom: 1px solid var(--border); flex-wrap: wrap;
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; min-width: 0; }
.coin {
  flex: none; width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center;
  background: radial-gradient(circle at 35% 30%, #fcd34d, #d97706 70%); color: #1c1917;
  font-weight: 800; font-size: 17px; box-shadow: inset 0 0 0 2px rgba(120, 53, 15, .35);
}
.brand-text { display: flex; flex-direction: column; min-width: 0; }
.brand-text b { font-size: 15px; letter-spacing: -.01em; }
.brand-text small { color: var(--muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stats { flex: 1; display: flex; align-items: center; gap: 10px; justify-content: center; color: var(--muted); font-size: 13px; min-width: 0; font-variant-numeric: tabular-nums; }
.progress { width: 120px; height: 6px; border-radius: 3px; background: var(--border); overflow: hidden; flex: none; }
.progress-fill { height: 100%; background: var(--accent); border-radius: 3px; transition: width .6s; }
.actions { display: flex; gap: 8px; }

.stage { position: relative; overflow: hidden; min-height: 0; }
#cv { position: absolute; inset: 0; width: 100%; height: 100%; touch-action: none; cursor: grab; display: block; }

.hint {
  position: absolute; top: 16px; left: 50%; transform: translateX(-50%);
  background: var(--text); color: var(--bg); padding: 8px 14px; border-radius: 999px;
  font-size: 13px; box-shadow: var(--shadow); pointer-events: none; white-space: nowrap;
}

.zoom {
  position: absolute; top: 16px; left: 16px; display: flex; flex-direction: column;
  background: var(--surface); border: 1px solid var(--border); border-radius: 10px; box-shadow: var(--shadow); overflow: hidden;
}
.zoom button { width: 36px; height: 36px; border: 0; background: transparent; font-size: 18px; cursor: pointer; color: var(--text); }
.zoom button + button { border-top: 1px solid var(--border); }
.zoom button:hover { background: var(--accent-soft); }

/* ---------- Live ticker ---------- */
.ticker {
  display: flex; align-items: center; height: 34px; overflow: hidden;
  background: var(--surface); border-top: 1px solid var(--border); font-size: 12.5px;
}
.ticker-label {
  flex: none; display: flex; align-items: center; gap: 6px; padding: 0 12px 0 16px; height: 100%;
  font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted);
  border-right: 1px solid var(--border); background: var(--surface); z-index: 1;
}
.dot { width: 7px; height: 7px; border-radius: 50%; background: #22c55e; box-shadow: 0 0 0 3px rgba(34, 197, 94, .2); }
.ticker-track { flex: 1; overflow: hidden; height: 100%; mask-image: linear-gradient(90deg, transparent, #000 24px, #000 calc(100% - 24px), transparent); }
.ticker-move { display: inline-flex; height: 100%; white-space: nowrap; animation: tick var(--dur, 60s) linear infinite; }
.ticker:hover .ticker-move { animation-play-state: paused; }
@keyframes tick { to { transform: translateX(-50%); } }
.tick {
  display: inline-flex; align-items: center; gap: 4px; height: 100%; padding: 0 18px; border: 0; background: none;
  color: var(--muted); cursor: pointer; font-size: inherit; position: relative;
}
.tick::after { content: ""; position: absolute; right: 0; top: 50%; width: 3px; height: 3px; margin-top: -1.5px; border-radius: 50%; background: var(--border); }
.tick b { color: var(--text); font-weight: 600; }
.tick.takeover b:nth-of-type(2) { color: var(--accent); }
.tick.zone { color: var(--accent); font-weight: 600; }
.tick .ago { opacity: .7; margin-left: 4px; }
.tick:hover { color: var(--text); }
@media (prefers-reduced-motion: reduce) {
  .ticker-move { animation: none; }
  .ticker-track { overflow-x: auto; mask-image: none; }
}

/* ---------- Hover card ---------- */
.card {
  position: absolute; width: 260px; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; pointer-events: none; z-index: 5;
}
.card-media {
  height: 92px; display: grid; place-items: center; font-size: 36px; font-weight: 800;
}
.card-media img { width: 100%; height: 100%; object-fit: cover; display: block; }
.card-body { padding: 10px 12px 12px; }
.card-title { font-weight: 700; font-size: 15px; }
.card-host { color: var(--muted); font-size: 12px; }
.card-desc { margin: 6px 0 0; font-size: 13px; }
.card-meta { margin-top: 8px; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.card .btn { display: none; margin-top: 10px; }
.card.sticky { pointer-events: auto; left: 50% !important; top: auto !important; bottom: 16px; transform: translateX(-50%); }
.card.sticky .btn { display: inline-flex; }

/* ---------- Buy panel ---------- */
.panel {
  position: absolute; top: 16px; right: 16px; bottom: 16px; width: 340px; overflow: auto;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 14px 16px 16px; z-index: 6;
}
.panel-head { display: flex; align-items: center; justify-content: space-between; }
.panel-head h2 { margin: 0; font-size: 16px; }
.price-box { margin: 10px 0 12px; padding: 12px; border-radius: 10px; background: var(--accent-soft); }
.price { font-size: 30px; font-weight: 800; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.dims { font-weight: 600; margin-top: 2px; }
.break { color: var(--muted); font-size: 12.5px; margin-top: 4px; }
.warn { margin: 0 0 12px; color: var(--accent); font-weight: 600; font-size: 13px; }
.error { margin: 0; color: var(--danger); font-weight: 600; font-size: 13px; }
form { display: flex; flex-direction: column; gap: 10px; }
label { display: flex; flex-direction: column; gap: 4px; font-weight: 600; font-size: 13px; }
.opt { font-weight: 400; color: var(--muted); font-size: 12px; }
input, textarea {
  font: inherit; font-weight: 400; color: var(--text); background: var(--surface-2);
  border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px; width: 100%;
}
textarea { resize: vertical; }
input:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: transparent; }
input[type="file"] { padding: 6px; font-size: 12.5px; }
input[type="color"] { padding: 2px; height: 36px; width: 56px; cursor: pointer; }
.row { display: flex; gap: 10px; align-items: flex-end; }
.row .grow { flex: 1; min-width: 0; }
.fine { margin: 0; color: var(--muted); font-size: 12px; }

/* ---------- New-purchase toast ---------- */
.toast {
  position: absolute; top: 16px; left: 50%; transform: translateX(-50%); z-index: 7;
  display: flex; align-items: center; gap: 8px; max-width: calc(100% - 32px);
  background: var(--surface); color: var(--text); border: 1px solid var(--accent); border-radius: 999px;
  padding: 7px 14px 7px 7px; box-shadow: var(--shadow); cursor: pointer; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.toast .tag { background: var(--accent); color: var(--on-accent); font-weight: 700; font-size: 11px; text-transform: uppercase; letter-spacing: .06em; padding: 3px 8px; border-radius: 999px; }
.toast.enter { animation: toastIn .5s cubic-bezier(.34, 1.56, .64, 1); }
@keyframes toastIn { from { opacity: 0; transform: translate(-50%, -24px) scale(.9); } to { opacity: 1; transform: translate(-50%, 0); } }

@media (prefers-reduced-motion: reduce) {
  .toast.enter { animation: none; }
}

/* ---------- History bar ---------- */
.history {
  position: absolute; left: 50%; bottom: 16px; transform: translateX(-50%);
  width: min(560px, calc(100% - 32px)); display: flex; align-items: center; gap: 10px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 999px;
  box-shadow: var(--shadow); padding: 6px 8px 6px 6px; z-index: 4;
}
.history input[type="range"] { flex: 1; accent-color: var(--accent); padding: 0; border: 0; background: none; }
.history .play { background: var(--accent); color: var(--on-accent); border-radius: 50%; font-size: 13px; }
.history .play:hover { background: var(--accent-hover); color: var(--on-accent); }
.h-label { font-size: 12.5px; color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; min-width: 110px; }

@media (max-width: 900px) {
  .brand-text small { display: none; }
  .progress { width: 70px; }
}
@media (max-width: 700px) {
  .bar { gap: 8px 12px; padding: 8px 12px; }
  .stats { order: 3; flex-basis: 100%; justify-content: flex-start; font-size: 12px; }
  .brand-text b { font-size: 14px; }
  .actions { margin-left: auto; }
  .btn { height: 32px; padding: 0 10px; font-size: 13px; }
  .btn.square { width: 32px; }
  .actions { gap: 6px; }
  .zoom { top: 8px; left: 8px; }
  .zoom button { width: 32px; height: 32px; }
  .hint { top: auto; bottom: 16px; white-space: normal; width: calc(100% - 32px); text-align: center; border-radius: 12px; }
  .panel { top: auto; left: 0; right: 0; bottom: 0; width: auto; max-height: 72dvh; border-radius: 16px 16px 0 0; }
  .card.sticky { width: calc(100% - 32px); z-index: 8; }
  .h-label { min-width: 0; font-size: 11.5px; }
}

@media (max-width: 420px) {
  .brand-text { display: none; }          /* coin + buttons fit one row on a phone */
  .bar { padding: 8px 10px; }
}
@media (hover: none) {
  #zIn, #zOut { display: none; }          /* pinch to zoom instead */
}

/* ---------- King of the Hill ---------- */
.crown {
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 18px;
  padding: 10px 16px; border-bottom: 1px solid var(--border);
  background: linear-gradient(90deg, rgba(252, 196, 25, .22), rgba(252, 196, 25, 0) 55%), var(--surface);
}
.crown-label { display: flex; align-items: center; gap: 10px; }
.crown-icon { font-size: 30px; line-height: 1; filter: drop-shadow(0 2px 4px rgba(180, 120, 0, .35)); animation: bob 3s ease-in-out infinite; }
@keyframes bob { 0%, 100% { transform: translateY(0) rotate(-6deg); } 50% { transform: translateY(-3px) rotate(6deg); } }
.crown-label b { display: block; font-size: 15px; letter-spacing: -.01em; }
.crown-label small { color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.crown-body { display: flex; align-items: center; gap: 14px; min-width: 0; color: var(--text); text-decoration: none; }
.crown-body[href]:hover .crown-media { transform: translateY(-2px); box-shadow: 0 10px 24px rgba(0, 0, 0, .18); }
.crown-media {
  flex: none; width: 264px; height: 88px; border-radius: 12px; overflow: hidden;
  display: flex; align-items: center; justify-content: center; gap: 10px; padding: 0 14px;
  font-weight: 800; font-size: 20px; letter-spacing: -.01em; white-space: nowrap;
  background: var(--accent-soft); box-shadow: 0 0 0 2px #fcc419, 0 6px 18px rgba(0, 0, 0, .12);
  transition: transform .2s, box-shadow .2s;
}
.crown-media span:last-child { overflow: hidden; text-overflow: ellipsis; }
.crown-media img { width: 100%; height: 100%; object-fit: cover; display: block; margin: 0 -14px; }
.crown-emoji { font-size: 40px; font-family: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", sans-serif; }
.crown-text { display: flex; flex-direction: column; min-width: 0; }
.crown-text b { font-size: 18px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.crown-text span { color: var(--muted); font-size: 13.5px; }
.crown-cta { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.crown-cta .btn { height: 40px; padding: 0 18px; font-size: 14.5px; }
.crown-cta small { color: var(--muted); font-size: 12px; text-align: right; max-width: 300px; }
body.buying .crown, body.history-mode .crown { opacity: .5; pointer-events: none; }

.crown-dialog {
  width: min(440px, calc(100% - 24px)); max-height: 90dvh; overflow: auto; padding: 16px;
  border: 1px solid var(--border); border-radius: 16px; background: var(--surface); color: var(--text); box-shadow: var(--shadow);
}
.crown-dialog::backdrop { background: rgba(12, 10, 9, .5); }
.crown-dialog .sub { margin: 4px 0 12px; }

.live-pill { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; color: var(--text); white-space: nowrap; }
.card.ghost .card-media { background: var(--accent-soft) !important; color: var(--accent); font-size: 44px; font-weight: 300; border-bottom: 1px dashed var(--accent); }
.maker { margin: 20px 4px 0; color: var(--muted); font-size: 13px; text-align: center; }

@media (max-width: 900px) {
  .crown { grid-template-columns: minmax(0, 1fr) auto; }
  .crown-label { display: none; }
  .crown-media { width: 200px; height: 72px; }
}
@media (max-width: 700px) {
  .crown { grid-template-columns: 1fr; gap: 10px; padding: 12px; }
  .crown-label { display: flex; }
  .crown-body { flex-direction: column; align-items: stretch; gap: 8px; }
  .crown-media { width: 100%; height: auto; aspect-ratio: 3 / 1; font-size: 22px; }
  .crown-cta { align-items: stretch; }
  .crown-cta .btn { width: 100%; }
  .crown-cta small { text-align: center; max-width: none; }
  .live-pill { font-size: 12px; }
}
@media (prefers-reduced-motion: reduce) { .crown-icon { animation: none; } }

/* ---------- Under-the-map section (phones) ---------- */
.below { display: none; }
@media (max-width: 700px) {
  body.app { display: block; height: auto; min-height: 100dvh; overflow: visible; }
  .bar { position: sticky; top: 0; z-index: 20; }
  .stage { height: min(100vw, 72dvh); }      /* square map, full width */
  .ticker { display: none; }                 /* replaced by the list below */
  .below { display: block; padding: 4px 12px 40px; }
  .panel, .card.sticky { position: fixed; z-index: 30; }
}
.cta {
  margin-top: 12px; padding: 16px; border-radius: 14px;
  background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow);
}
.cta-title { font-size: 18px; font-weight: 800; letter-spacing: -.01em; }
.cta-sub { color: var(--muted); font-size: 13px; margin: 4px 0 12px; }
.below .section { margin-top: 20px; }
.below h3 {
  display: flex; align-items: center; gap: 6px; margin: 0 0 8px;
  font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted);
}
.top, .feedlist {
  list-style: none; margin: 0; padding: 0; overflow: hidden;
  background: var(--surface); border: 1px solid var(--border); border-radius: 14px;
}
.top li + li, .feedlist li + li { border-top: 1px solid var(--border); }
.top-item, .feed-item {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 10px 12px;
  border: 0; background: none; text-align: left; cursor: pointer; font: inherit; color: var(--text);
}
.top-item:active, .feed-item:active { background: var(--accent-soft); }
.rank { flex: none; width: 16px; text-align: center; color: var(--muted); font-weight: 700; font-size: 13px; }
.thumb-sm {
  flex: none; width: 40px; height: 40px; border-radius: 8px; overflow: hidden;
  display: grid; place-items: center; font-weight: 800; font-size: 15px; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .06);
}
.thumb-sm img { width: 100%; height: 100%; object-fit: cover; display: block; }
.top-text { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.3; }
.top-text b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top-text small { color: var(--muted); font-size: 12px; }
.top-price { flex: none; font-weight: 700; font-variant-numeric: tabular-nums; }
.feed-item { display: block; color: var(--muted); font-size: 13.5px; line-height: 1.4; }
.feed-item b { color: var(--text); font-weight: 600; }
.feed-item.takeover b:nth-of-type(2) { color: var(--accent); }
.feed-item.zone { color: var(--accent); font-weight: 600; }
.feed-item .ago { display: block; margin-top: 2px; font-size: 12px; opacity: .75; }
.how ul {
  margin: 0; padding: 12px 16px 12px 32px; font-size: 13.5px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 14px;
}
.how li + li { margin-top: 6px; }

/* ---------- Plain pages (pay / manage) ---------- */
body.page { min-height: 100dvh; display: flex; justify-content: center; padding: 32px 16px; }
.sheet { width: 100%; max-width: 560px; }
.sheet .brand { margin-bottom: 20px; }
.box { background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 20px; box-shadow: var(--shadow); }
.box + .box { margin-top: 16px; }
.box h1 { margin: 0 0 4px; font-size: 22px; letter-spacing: -.01em; }
.box h2 { margin: 0 0 10px; font-size: 15px; }
.sub { color: var(--muted); margin: 0 0 16px; }
.summary { display: flex; gap: 14px; align-items: center; margin-bottom: 16px; }
.thumb {
  flex: none; width: 88px; height: 88px; border-radius: 10px; display: grid; place-items: center;
  font-weight: 800; font-size: 30px; overflow: hidden; border: 1px solid var(--border);
}
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.summary .t { font-weight: 700; font-size: 16px; }
.summary .m { color: var(--muted); font-size: 13px; word-break: break-all; }
.total { display: flex; justify-content: space-between; align-items: baseline; padding: 14px 0; border-top: 1px solid var(--border); margin-bottom: 12px; }
.total b { font-size: 26px; font-variant-numeric: tabular-nums; }
.test-note { margin: 12px 0 0; font-size: 12.5px; color: var(--muted); padding: 10px 12px; border-radius: 8px; background: var(--surface-2); border: 1px dashed var(--border); }
.tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.tile { background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; }
.tile .k { font-size: 12px; color: var(--muted); }
.tile .v { font-size: 20px; font-weight: 700; font-variant-numeric: tabular-nums; }
.log { list-style: none; margin: 0; padding: 0; }
.log li { padding: 8px 0; border-top: 1px solid var(--border); font-size: 13px; }
.log li:first-child { border-top: 0; }
.log time { color: var(--muted); font-size: 12px; display: block; }
.code { font: 12px/1.5 ui-monospace, SFMono-Regular, Menlo, monospace; resize: none; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
@media (max-width: 520px) { .tiles { grid-template-columns: repeat(2, 1fr); } }

/* =====================================================================
   v3 — the map takes the first screen; search and the directory sit
   around it. These rules come last so they override the shared layout.
   ===================================================================== */
body.app.v3 { display: block; height: auto; min-height: 100dvh; overflow: visible; }
body.v3 .bar { position: sticky; top: 0; z-index: 20; }
body.v3 .stage { height: calc(100dvh - var(--chrome, 210px)); min-height: 380px; }

/* Slim crown: one line above the map */
.crown.slim {
  display: flex; align-items: center; gap: 10px; padding: 6px 16px; min-height: 52px;
  grid-template-columns: none;
}
.crown.slim .crown-icon { font-size: 22px; }
.crown.slim .crown-body { flex: 1; gap: 10px; }
.crown.slim .crown-media {
  width: 38px; height: 38px; padding: 0; border-radius: 9px; font-size: 20px; flex: none;
  box-shadow: 0 0 0 2px #fcc419;
}
.crown.slim .crown-media img { margin: 0; }
.crown.slim .crown-emoji { font-size: 22px; }
.crown.slim .crown-text b { font-size: 14.5px; }
.crown.slim .crown-text small { color: var(--muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.crown.slim .btn { flex: none; height: 32px; }

/* Search + category chips */
.toolbar {
  display: flex; align-items: center; gap: 10px; padding: 8px 16px;
  background: var(--surface); border-bottom: 1px solid var(--border);
}
.search {
  flex: 0 1 340px; display: flex; flex-direction: row; align-items: center; gap: 6px;
  padding: 0 10px; height: 34px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border);
  font-weight: 400;
}
.search:focus-within { border-color: var(--accent); }
.search input { border: 0; background: none; padding: 0; height: 100%; outline: none; }
.search input:focus { outline: none; }
.chips { flex: 1; display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; mask-image: linear-gradient(90deg, #000 92%, transparent); }
.chips::-webkit-scrollbar { display: none; }
.chip-btn {
  flex: none; display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 11px;
  border-radius: 999px; border: 1px solid var(--border); background: var(--surface); color: var(--text);
  font-size: 13px; cursor: pointer; white-space: nowrap;
}
.chip-btn span { color: var(--muted); font-size: 11.5px; font-variant-numeric: tabular-nums; }
.chip-btn:hover { border-color: var(--accent); }
.chip-btn[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.chip-btn[aria-pressed="true"] span { color: inherit; opacity: .8; }

/* Hints on the map */
.wheel-hint {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); z-index: 6;
  background: rgba(28, 25, 23, .82); color: #fff; padding: 10px 16px; border-radius: 12px; font-size: 14px; pointer-events: none;
}
.wheel-hint kbd { font: inherit; font-weight: 700; padding: 1px 6px; border-radius: 5px; background: rgba(255, 255, 255, .18); }
.scroll-hint {
  position: absolute; left: 50%; bottom: 12px; transform: translateX(-50%); z-index: 3;
  height: 32px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--border);
  background: color-mix(in srgb, var(--surface) 92%, transparent); color: var(--text); box-shadow: var(--shadow);
  font-size: 13px; font-weight: 600; cursor: pointer;
}
body.buying .scroll-hint, body.history-mode .scroll-hint { display: none; }

/* Hover card actions */
.card-actions { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; }
.card .card-actions .btn { display: none; margin: 0; }
.card.sticky .card-actions .btn:not([hidden]) { display: inline-flex; }

/* Directory below the map */
body.v3 .ticker, body.v3 .below { display: none; }
.explore { max-width: 1200px; margin: 0 auto; padding: 28px 16px 48px; scroll-margin-top: 64px; }
.explore-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.explore-head h2 { margin: 0; font-size: 22px; letter-spacing: -.01em; }
.tabs { display: inline-flex; padding: 3px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border); }
.tabs button { height: 30px; padding: 0 14px; border: 0; border-radius: 999px; background: none; color: var(--muted); font: inherit; font-weight: 600; font-size: 13px; cursor: pointer; }
.tabs button[aria-selected="true"] { background: var(--surface); color: var(--text); box-shadow: 0 1px 3px rgba(0, 0, 0, .1); }
.pgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 12px; }
.pcard {
  display: flex; gap: 12px; padding: 12px; border-radius: 14px;
  background: var(--surface); border: 1px solid var(--border); transition: border-color .15s, transform .15s, box-shadow .15s;
}
.pcard:hover { border-color: var(--accent); transform: translateY(-2px); box-shadow: var(--shadow); }
.pthumb {
  flex: none; width: 56px; height: 56px; border-radius: 12px; overflow: hidden; display: grid; place-items: center;
  font-size: 28px; font-weight: 800; text-decoration: none; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .06);
}
.pthumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pbody { min-width: 0; flex: 1; display: flex; flex-direction: column; gap: 4px; }
.ptitle { color: var(--text); font-weight: 700; font-size: 15px; text-decoration: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ptitle:hover { color: var(--accent); }
.ptags { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { display: inline-flex; align-items: center; gap: 4px; height: 22px; padding: 0 8px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border); font-size: 11.5px; color: var(--muted); font-weight: 600; }
.chip.new { background: #22c55e; border-color: #22c55e; color: #fff; }
.pdesc { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.pfoot { display: flex; justify-content: space-between; align-items: center; margin-top: auto; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.linkish { border: 0; background: none; color: var(--accent); font: inherit; font-weight: 600; cursor: pointer; padding: 0; }
.empty { color: var(--muted); grid-column: 1 / -1; text-align: center; padding: 24px 0; }
#more { margin-top: 14px; }
.explore-cols { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; margin-top: 32px; align-items: start; }
.explore-cols .section { margin-top: 0; }
.explore-cols .cta { margin-top: 0; }
.explore .feedlist { max-height: 360px; overflow: auto; }

/* Project page (/p/:id) */
.project { text-align: left; }
.project-media {
  height: 200px; border-radius: 12px; margin-bottom: 14px; overflow: hidden;
  display: grid; place-items: center; font-size: 72px; font-weight: 800; color: #fff;
}
.project-media img { width: 100%; height: 100%; object-fit: cover; }
.project h1 { margin: 10px 0 6px; font-size: 26px; }
.lead { font-size: 16px; margin: 0 0 14px; }
.project-meta { margin: 14px 0 0; font-size: 13px; }

@media (max-width: 900px) {
  .explore-cols { grid-template-columns: 1fr; }
}
@media (max-width: 700px) {
  body.v3 .stage { height: min(100vw, 72dvh); }
  .crown.slim { padding: 6px 10px; min-height: 48px; }
  .crown.slim .crown-icon { display: none; }
  .crown.slim .btn { padding: 0 10px; font-size: 12.5px; }
  .crown.slim .crown-text small { display: block; }
  .toolbar { flex-direction: column; align-items: stretch; gap: 8px; padding: 8px 10px; }
  .search { flex: none; }
  .scroll-hint { bottom: 8px; height: 28px; font-size: 12px; }
  .explore { padding: 18px 10px 40px; }
  .explore-head h2 { font-size: 18px; }
  .pgrid { grid-template-columns: 1fr; gap: 8px; }
  .wheel-hint { display: none; }
}

/* ---------- v3 phones: give the screen to the map ---------- */
.search-toggle { display: none; }
.crown-take .short, #crownTake .short { display: none; }
@media (max-width: 700px) {
  /* Header: one row — coin + buttons */
  body.v3 .bar { flex-wrap: nowrap; gap: 6px; padding: 6px 10px; }
  body.v3 .brand-text, body.v3 .stats { display: none; }
  body.v3 .actions { margin-left: auto; gap: 6px; }
  body.v3 .actions .btn { height: 34px; padding: 0 10px; font-size: 13px; }
  body.v3 .actions .btn.square { width: 34px; padding: 0; }
  body.v3 .coin { width: 30px; height: 30px; font-size: 15px; }
  .search-toggle { display: inline-flex; }
  body.search-open .search-toggle { background: var(--accent-soft); border-color: var(--accent); }

  /* Crown: one row */
  .crown.slim { padding: 6px 10px; min-height: 0; gap: 8px; }
  .crown.slim .crown-body { flex-direction: row; align-items: center; gap: 8px; min-width: 0; }
  .crown.slim .crown-media { width: 32px; height: 32px; aspect-ratio: auto; }
  .crown.slim .crown-emoji { font-size: 18px; }
  .crown.slim .crown-text { min-width: 0; }
  .crown.slim .crown-text b { font-size: 14px; }
  .crown.slim .crown-text small { font-size: 11.5px; }
  .crown.slim .btn { height: 32px; padding: 0 12px; font-size: 13px; width: auto; }
  #crownTake .long { display: none; }
  #crownTake .short { display: inline; }

  /* Search + chips hide until 🔎 is tapped */
  body.v3 .toolbar { display: none; }
  body.v3.search-open .toolbar { display: flex; }

  /* Map: full width, edge to edge */
  body.v3 .stage { height: min(100vw, 78dvh); }
  body.v3 .zoom { top: 6px; left: 6px; }
}

/* ---------- v3: bigger crown, taller map on phones ---------- */
.crown.slim { min-height: 62px; padding: 8px 16px; }
.crown.slim .crown-media { width: 46px; height: 46px; border-radius: 12px; }
.crown.slim .crown-emoji { font-size: 27px; }
.crown.slim .crown-text b { font-size: 16.5px; }
.crown.slim .crown-text small { font-size: 12.5px; }
.crown.slim .btn { height: 38px; padding: 0 16px; font-size: 14px; }
@media (max-width: 700px) {
  .crown.slim { padding: 8px 10px; min-height: 62px; }
  .crown.slim .crown-media { width: 46px; height: 46px; }
  .crown.slim .crown-text b { font-size: 16.5px; }
  .crown.slim .crown-text small { font-size: 12px; }
  .crown.slim .btn { height: 40px; padding: 0 14px; font-size: 15px; }
  body.v3 .stage { height: calc(100dvh - var(--chrome, 180px)); min-height: 320px; }
}

/* ---------- v3: whole canvas visible, like the 2005 page ---------- */
@media (max-width: 700px) {
  /* The canvas is square and shown whole, so the stage is a full-width square: no empty band under it */
  body.v3 .stage { height: calc(100dvh - var(--chrome, 180px)); min-height: 320px; }   /* phone-shaped board fills the screen */
}
@media (max-width: 700px) {
  body.v3 .scroll-hint { display: none; }   /* the directory starts right under the square, no need to cover banners */
}
@media (min-width: 701px) {
  body.v3 .scroll-hint { left: 16px; transform: none; }   /* sits in the grey margin beside the square, not over banners */
}

/* ---------- v3 desktop: the tall board spans the full width; scroll down through it (like 2005) ---------- */
@media (min-width: 701px) {
  body.v3 .stage { height: var(--stage-h, calc(100dvh - var(--chrome, 210px))); min-height: 0; }
  body.v3 .panel { position: fixed; top: 76px; bottom: 16px; right: 16px; z-index: 30; }
  body.v3 .toast { position: fixed; top: 80px; z-index: 31; }
  body.v3 .history { position: fixed; bottom: 16px; z-index: 30; }
  body.v3 .zoom { position: fixed; top: auto; left: auto; right: 16px; bottom: 16px; z-index: 25; }
  body.v3 .hint { position: fixed; top: 84px; z-index: 31; }
  body.v3 .scroll-hint, body.v3 .wheel-hint { display: none !important; }
}

/* ---------- v3 phones: full-width board too (Safari's bars make the screen shorter than it looks) ---------- */
@media (max-width: 700px) {
  body.v3 .stage { height: var(--stage-h, calc(100dvh - var(--chrome, 180px))); min-height: 0; }
  body.v3 .history { position: fixed; bottom: 12px; z-index: 30; }
}

/* ---------- v3 landscape screens: the flipped board fills the window exactly ---------- */
body.v3.tr .stage { height: var(--stage-h, calc(100dvh - var(--chrome, 160px))); }
/* On every screen the search row hides under the magnifier, so the map gets the room */
body.v3 .search-toggle { display: inline-flex; }
body.v3 .toolbar { display: none; }
body.v3.search-open .toolbar { display: flex; }
body.v3.search-open .search-toggle { background: var(--accent-soft); border-color: var(--accent); }
body.v3.tr .scroll-hint { display: inline-flex !important; left: 16px; bottom: 12px; transform: none; }

/* ---------- Market: for-sale tags, offers and auctions ---------- */
.card-market { display: flex; flex-direction: column; gap: 3px; margin-top: 8px; font-size: 12.5px; }
.card-market b { color: var(--text); }
.card-market a { color: var(--accent); text-decoration: none; font-weight: 600; pointer-events: auto; }
.card-market small { color: var(--muted); }
.card.sticky .card-actions #cardDeal:not([hidden]) { display: inline-flex; }
.chip.sale { border: 0; cursor: pointer; font: inherit; font-size: 11.5px; font-weight: 700; background: #fff3bf; color: #8a5a00; }
.chip.sale.auction { background: #ffe3e3; color: #a51d1d; }
[data-theme="dark"] .chip.sale { background: #4a3a10; color: #ffd43b; }
[data-theme="dark"] .chip.sale.auction { background: #4a1818; color: #ffa8a8; }
.feed-item.market, .tick.market { }
.market-dialog .m-spot { display: flex; gap: 12px; align-items: center; margin: 6px 0 12px; }
.market-dialog .m-thumb { width: 56px; height: 56px; flex: none; border-radius: 10px; overflow: hidden; display: grid; place-items: center; font-size: 26px; font-weight: 800; }
.market-dialog .m-thumb img { width: 100%; height: 100%; object-fit: cover; }
.market-dialog .m-info { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.market-dialog .m-info small { color: var(--muted); font-size: 12.5px; }
.market-dialog .m-amount { display: flex; align-items: center; gap: 6px; font-size: 22px; font-weight: 700; }
.market-dialog .m-amount input { font-size: 20px; font-weight: 700; }
.market-dialog .m-amount input[readonly] { background: transparent; border-color: transparent; padding-left: 0; }
.market-dialog .m-bids { list-style: none; margin: 0 0 12px; padding: 8px 10px; border: 1px solid var(--border); border-radius: 10px; font-size: 13px; max-height: 120px; overflow: auto; color: var(--muted); font-variant-numeric: tabular-nums; }
.market-dialog .m-bids li.lead { color: var(--text); font-weight: 700; }
.market-dialog .m-bids li.lead::after { content: ' · top bid'; color: #e03131; font-weight: 600; }
.market-dialog .fine { margin-top: 10px; }
.market-box h2 { margin: 0 0 6px; font-size: 18px; }

/* ---------- Owner dashboard (selling) and deal pages ---------- */
.seg { display: inline-flex; gap: 4px; padding: 3px; border: 1px solid var(--border); border-radius: 10px; margin-bottom: 10px; }
.seg label { display: inline-flex; align-items: center; gap: 6px; margin: 0; padding: 6px 12px; border-radius: 8px; cursor: pointer; font-weight: 600; font-size: 14px; }
.seg label:has(input:checked) { background: var(--accent-soft); color: var(--accent); }
.seg input { accent-color: var(--accent); }
.sell-form .m-amount, .page .m-amount { display: flex; align-items: center; gap: 6px; font-weight: 700; }
.sale-status { margin: 0 0 8px; font-weight: 600; }
.log.bids a, .offers a { color: var(--accent); font-weight: 600; }
.offers { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.offer { border: 1px solid var(--border); border-radius: 12px; padding: 10px 12px; }
.offer.declined { opacity: .55; }
.offer.accepted { border-color: var(--accent); }
.offer-top { display: flex; flex-wrap: wrap; gap: 6px; align-items: baseline; }
.offer-top b { font-size: 18px; }
.offer-top time { margin-left: auto; color: var(--muted); font-size: 12px; }
.offer p { margin: 6px 0 0; font-size: 14px; }
.offer .btn-row { margin-top: 8px; }
.offer small { color: var(--muted); }
.steps { list-style: none; counter-reset: st; margin: 16px 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.steps li { counter-increment: st; display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 14px; }
.steps li::before { content: counter(st); width: 24px; height: 24px; flex: none; display: grid; place-items: center; border-radius: 50%; border: 1px solid var(--border); font-size: 12px; font-weight: 700; }
.steps li.done { color: var(--text); }
.steps li.done::before { content: '✓'; background: var(--accent); border-color: var(--accent); color: var(--on-accent, #fff); }
.steps li.now { color: var(--text); font-weight: 700; }
.steps li.now::before { border-color: var(--accent); color: var(--accent); }

/* ---------- Crypto checkout ---------- */
.coins { display: flex; flex-wrap: wrap; gap: 6px; margin: 12px 0; }
.coin-chip { padding: 3px 9px; border: 1px solid var(--border); border-radius: 999px; font-size: 12px; font-weight: 700; letter-spacing: .02em; }
.coin-chip.more { border-style: dashed; color: var(--muted); font-weight: 600; }
.wallet { border: 1px solid var(--border); border-radius: 12px; padding: 10px 12px 4px; margin: 0 0 12px; }
.wallet legend { padding: 0 6px; font-weight: 700; font-size: 14px; }
.sub.small { font-size: 13px; margin: 0 0 8px; }
label.net { flex: 0 0 auto; max-width: 46%; }
label.net select { max-width: 100%; }
.invoice { margin-top: 8px; }
.invoice h2 { margin: 0 0 8px; font-size: 18px; }
.invoice .addr { display: block; padding: 10px 12px; margin: 0 0 12px; border: 1px dashed var(--border); border-radius: 10px; font-size: 13px; word-break: break-all; }
.waiting { display: flex; align-items: center; gap: 10px; font-weight: 700; margin: 14px 0 6px; }
.spinner { width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--border); border-top-color: var(--accent); animation: spin .9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation: none; } }
#payoutBox.need { border-color: var(--accent); }
/* Selects look like the other fields everywhere (pay page, dashboard, dialogs) */
select {
  font: inherit; font-weight: 400; color: var(--text); background: var(--surface-2);
  border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px; width: 100%; min-height: 38px;
}
select:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: transparent; }
.wallet .row, #payoutForm .row { align-items: flex-end; }
.invoice label { margin-bottom: 8px; }
.seg label { flex-direction: row; }

/* =====================================================================
   v5 — "ledger + copper penny"
   Paper, ink and one copper. Square corners, 1px ink rules, no blur, no gradients.
   Numbers are set in a till-like mono; everything else in Archivo.
   ===================================================================== */
:root.v5 {
  --bg: #f1ede4;
  --surface: #f8f6f0;
  --surface-2: #f1ede4;
  --text: #161513;
  --muted: #6c675d;
  --border: #161513;
  --rule: rgba(22, 21, 19, 0.16);
  --accent: #b4632e;
  --accent-hover: #934d20;
  --on-accent: #f8f6f0;
  --accent-soft: rgba(180, 99, 46, 0.12);
  --danger: #a3271f;
  --canvas-outside: #e6e1d5;
  --canvas-paper: #f8f6f0;
  --canvas-grid: rgba(22, 21, 19, 0.05);
  --canvas-border: #161513;
  --canvas-locked: rgba(22, 21, 19, 0.035);
  --canvas-seam: rgba(22, 21, 19, 0.2);
  --sel-fill: rgba(180, 99, 46, 0.22);
  --shadow: none;
  --radius: 0px;
  --font: "Archivo", ui-sans-serif, system-ui, -apple-system, sans-serif;
  --mono: "Fragment Mono", ui-monospace, Menlo, monospace;
  --hard: 3px 3px 0 #161513;
}
@media (prefers-color-scheme: dark) {
  :root.v5:not([data-theme="light"]) {
    --bg: #12110f; --surface: #1a1916; --surface-2: #12110f; --text: #ece7dc; --muted: #9a9487;
    --border: #ece7dc; --rule: rgba(236, 231, 220, 0.16); --accent: #d4874f; --accent-hover: #e39c66; --on-accent: #12110f;
    --accent-soft: rgba(212, 135, 79, 0.16); --canvas-outside: #0d0c0b; --canvas-paper: #1a1916;
    --canvas-grid: rgba(236, 231, 220, 0.05); --canvas-border: #ece7dc; --canvas-locked: rgba(236, 231, 220, 0.03);
    --canvas-seam: rgba(0, 0, 0, 0.5); --sel-fill: rgba(212, 135, 79, 0.25); --hard: 3px 3px 0 #ece7dc;
  }
}
:root.v5[data-theme="dark"] {
  --bg: #12110f; --surface: #1a1916; --surface-2: #12110f; --text: #ece7dc; --muted: #9a9487;
  --border: #ece7dc; --rule: rgba(236, 231, 220, 0.16); --accent: #d4874f; --accent-hover: #e39c66; --on-accent: #12110f;
  --accent-soft: rgba(212, 135, 79, 0.16); --canvas-outside: #0d0c0b; --canvas-paper: #1a1916;
  --canvas-grid: rgba(236, 231, 220, 0.05); --canvas-border: #ece7dc; --canvas-locked: rgba(236, 231, 220, 0.03);
  --canvas-seam: rgba(0, 0, 0, 0.5); --sel-fill: rgba(212, 135, 79, 0.25); --hard: 3px 3px 0 #ece7dc;
}

/* Square everything, no soft shadows, no blur */
.v5 *, .v5 *::before, .v5 *::after { border-radius: 0 !important; box-shadow: none !important; backdrop-filter: none !important; }
.v5 body { font-family: var(--font); background: var(--bg); color: var(--text); letter-spacing: -0.005em; }
.v5 .spinner { border-radius: 0 !important; }

/* Masthead */
.v5 .coin-img { width: 32px; height: 32px; image-rendering: pixelated; flex: none; display: block; }
.v5 .bar { background: var(--surface); border-bottom: 1px solid var(--border); }
.v5 .brand-text b { font-stretch: 125%; font-weight: 800; text-transform: uppercase; letter-spacing: 0.02em; font-size: 14px; }
.v5 .brand-text small { font-family: var(--mono); font-size: 11px; letter-spacing: 0; text-transform: none; }
.v5 .till { display: flex; flex-direction: column; align-items: flex-start; line-height: 1; padding: 0 14px; border-left: 1px solid var(--rule); border-right: 1px solid var(--rule); flex: none; }
.v5 .till small { font-family: var(--mono); font-size: 10px; color: var(--muted); margin-top: 4px; text-transform: uppercase; letter-spacing: .04em; }
.v5 .till-num { font-family: var(--mono); font-size: 22px; color: var(--text); display: inline-flex; overflow: hidden; height: 1.1em; align-items: flex-end; }
.v5 .till-num .dg, .v5 .till-num .sep { display: inline-block; }
.v5 .till-num .roll { animation: till-roll .45s cubic-bezier(.2, .8, .2, 1) both; color: var(--accent); }
@keyframes till-roll { from { transform: translateY(-100%); } 70% { transform: translateY(6%); } to { transform: translateY(0); } }
@media (prefers-reduced-motion: reduce) { .v5 .till-num .roll { animation: none; } }
.v5 .stats { font-family: var(--mono); font-size: 11.5px; text-transform: uppercase; letter-spacing: .02em; }
.v5 .progress { height: 10px; width: 140px; background: transparent; border: 1px solid var(--border); padding: 1px; }
.v5 .progress-fill { background: repeating-linear-gradient(90deg, var(--accent) 0 6px, transparent 6px 8px); }

/* Buttons: ink outline, square, a hard print shadow on hover */
.v5 .btn { border: 1px solid var(--border); font-family: var(--font); font-weight: 650; letter-spacing: .01em; transition: transform .08s, filter .08s; }
.v5 .btn.primary { background: var(--accent); color: var(--on-accent); border-color: var(--border); }
.v5 .btn.primary:hover:not(:disabled), .v5 .btn.ghost:hover { transform: translate(-1px, -1px); filter: drop-shadow(2px 2px 0 var(--border)); }
.v5 .btn.ghost { background: var(--surface); border-color: var(--border); }
.v5 .btn.ghost:hover, .v5 .btn.ghost.on { background: var(--surface); border-color: var(--border); }
.v5 .btn:active { transform: translate(1px, 1px) !important; filter: none !important; }
.v5 input, .v5 textarea, .v5 select { background: var(--surface); border: 1px solid var(--border); font-family: var(--font); }
.v5 input[type="number"], .v5 .m-amount { font-family: var(--mono); }
.v5 label:has(> input[name="emoji"]), .v5 label.grow:has(input[name="emoji"]) { display: none; }   /* no emoji in v5 */

/* King of the hill as a printed notice */
.v5 .crown.slim { background: var(--surface); border-bottom: 1px solid var(--border); }
.v5 .crown-icon { color: var(--accent); font-size: 20px !important; }
.v5 .crown-media { border: 1px solid var(--border); }
.v5 .crown-text small { font-family: var(--mono); }

/* Search + categories */
.v5 .toolbar { background: var(--surface); border-bottom: 1px solid var(--border); }
.v5 .search { border: 1px solid var(--border); background: var(--surface); }
.v5 .q-label { font-family: var(--mono); font-size: 11px; text-transform: uppercase; color: var(--muted); padding-right: 10px; border-right: 1px solid var(--rule); align-self: stretch; display: flex; align-items: center; }
/* the field is the box: the input inside has no box of its own */
.v5 .search { gap: 10px; }
.v5 .search input { flex: 1; min-width: 0; border: 0; background: none; padding: 0; height: 100%; font-size: 14px; box-shadow: none; }
.v5 .search input:focus { outline: none; border: 0; }
.v5 .search:focus-within { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.v5 .chip-btn { border: 1px solid var(--border); background: var(--surface); font-weight: 600; }
.v5 .chip-btn span { font-family: var(--mono); font-weight: 400; }
.v5 .chip-btn[aria-pressed="true"] { background: var(--text); color: var(--surface); border-color: var(--text); }
.v5 .chip-btn[aria-pressed="true"] span { color: inherit; opacity: .7; }

/* The board sits on the page like a printed plate */
.v5 .stage { background: var(--canvas-outside); }
.v5 .zoom button, .v5 .scroll-hint { border: 1px solid var(--border); background: var(--surface); font-family: var(--mono); }

/* Hover card: paper slip with a hard shadow */
.v5 .card, .v5 .panel, .v5 .toast, .v5 .crown-dialog, .v5 .history { border: 1px solid var(--border); background: var(--surface); filter: drop-shadow(4px 4px 0 var(--border)); }
.v5 .card-media { border-bottom: 1px solid var(--border); font-family: var(--font); font-weight: 800; font-size: 34px; letter-spacing: -.02em; }
.v5 .card-title { font-weight: 750; font-size: 16px; }
.v5 .card-host, .v5 .card-meta { font-family: var(--mono); font-size: 11.5px; }
.v5 .card-market b { font-family: var(--mono); font-weight: 400; text-transform: uppercase; font-size: 11.5px; color: var(--accent); }
.v5 .price { font-family: var(--mono); font-weight: 400; }
.v5 .dims, .v5 .break { font-family: var(--mono); font-size: 12px; }

/* Directory: catalogue cards with ink rules */
.v5 .explore-head h2, .v5 .section h3, .v5 .box h1, .v5 .box h2, .v5 .cta-title { font-stretch: 112%; font-weight: 800; letter-spacing: -0.01em; }
.v5 .tabs button { font-family: var(--mono); text-transform: uppercase; font-size: 11.5px; letter-spacing: .03em; }
.v5 .tabs button[aria-selected="true"] { background: var(--text); color: var(--surface); }
.v5 .pcard { border: 1px solid var(--border); background: var(--surface); }
.v5 .pcard:hover { filter: drop-shadow(3px 3px 0 var(--border)); transform: translate(-1px, -1px); }
.v5 .pthumb { border-right: 1px solid var(--border); font-weight: 800; font-family: var(--font); }
.v5 .ptitle { font-weight: 750; }
.v5 .pfoot, .v5 .chip { font-family: var(--mono); font-size: 11px; }
.v5 .chip { border: 1px solid var(--rule); background: transparent; text-transform: uppercase; letter-spacing: .02em; }
.v5 .chip.new { border-color: var(--accent); color: var(--accent); background: transparent; }
.v5 .chip.sale { background: transparent; border: 1px solid var(--accent); color: var(--accent); }
.v5 .chip.sale.auction { border-color: var(--danger); color: var(--danger); }
.v5 .cta { border: 1px solid var(--border); background: var(--surface); }
.v5 .section, .v5 .how { border-top: 1px solid var(--border); }
.v5 .section h3 .dot { background: var(--accent); }

/* The ledger: time · what · ……… · amount */
.v5 .feedlist { border: 1px solid var(--border); background: var(--surface); padding: 4px 12px; }
.v5 .feedlist li + li { border-top: 1px dashed var(--rule); }
.v5 .feed-item.ledger { display: grid; grid-template-columns: 52px minmax(0, 1fr) auto; align-items: baseline; gap: 8px; width: 100%; padding: 7px 0; color: var(--text); font-size: 13px; text-align: left; }
.v5 .feed-item.ledger time { font-family: var(--mono); font-size: 11px; color: var(--muted); }
.v5 .feed-item.ledger .desc { display: flex; align-items: baseline; min-width: 0; }
.v5 .feed-item.ledger .dt { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--muted); }
.v5 .feed-item.ledger .dt b { color: var(--text); font-weight: 650; }
.v5 .feed-item.ledger .desc::after { content: ''; flex: 1; min-width: 16px; margin: 0 2px 3px 6px; border-bottom: 1px dotted var(--muted); }
.v5 .feed-item.ledger .amt { font-family: var(--mono); font-size: 12.5px; }
.v5 .feed-item.ledger.market .amt { color: var(--accent); }
.v5 .feed-item.ledger.zone .dt, .v5 .feed-item.ledger.zone .dt b { color: var(--accent); }

/* Inner pages: paper sheets */
.v5 .box, .v5 .tile, .v5 .offer, .v5 .wallet, .v5 .invoice .addr, .v5 .m-bids { border: 1px solid var(--border); background: var(--surface); }
.v5 .box { filter: drop-shadow(4px 4px 0 var(--border)); }
.v5 .tile .v, .v5 .total b, .v5 .offer-top b, .v5 .sale-status, .v5 .log, .v5 .coin-chip, .v5 time { font-family: var(--mono); font-weight: 400; }
.v5 .tile .k { font-family: var(--mono); text-transform: uppercase; font-size: 10.5px; letter-spacing: .04em; }
.v5 .thumb { border: 1px solid var(--border); font-weight: 800; }
.v5 .test-note { border: 1px dashed var(--border); background: transparent; font-family: var(--mono); font-size: 11.5px; }
.v5 .coin-chip { border-color: var(--border); }
.v5 .steps li::before { border-color: var(--border); font-family: var(--mono); }

/* Phones: the till shrinks into the masthead next to the coin */
@media (max-width: 700px) {
  .v5 body.v3 .till { display: flex; padding: 0 8px; border: 0; margin-right: auto; }
  .v5 .till small { display: none; }
  .v5 .till-num { font-size: 15px; }
}

/* The receipt */
.v5 .receipt-wrap { display: flex; flex-direction: column; align-items: center; gap: 12px; margin: 0 auto 28px; }
.v5 .receipt-wrap[hidden] { display: none; }
.v5 .receipt { position: relative; width: min(340px, 100%); background: #f8f6f0; color: #161513; padding: 22px 22px 30px; font-family: var(--mono); font-size: 13px; line-height: 1.7; filter: drop-shadow(4px 4px 0 var(--border)); animation: print-out .9s steps(12) both; transform-origin: top; }
.v5 .receipt::after { content: ''; position: absolute; left: 0; right: 0; bottom: -10px; height: 10px;
  background: linear-gradient(-45deg, transparent 7px, #f8f6f0 0) 0 0 / 12px 10px repeat-x, linear-gradient(45deg, transparent 7px, #f8f6f0 0) 0 0 / 12px 10px repeat-x; }
@keyframes print-out { from { clip-path: inset(0 0 100% 0); } to { clip-path: inset(0 0 -20px 0); } }
@media (prefers-reduced-motion: reduce) { .v5 .receipt { animation: none; } }
.v5 .r-coin { display: block; width: 48px; height: 48px; margin: 0 auto 8px; image-rendering: pixelated; }
.v5 .r-title { text-align: center; font-weight: 700; font-size: 15px; letter-spacing: .04em; }
.v5 .r-note { text-align: center; color: #6c675d; font-size: 12px; }
.v5 .r-rule { border-top: 1px dashed #161513; margin: 8px 0; }
.v5 .r-row { display: flex; justify-content: space-between; gap: 12px; }
.v5 .r-row span:last-child { text-align: right; }
.v5 .r-big { font-size: 18px; color: #b4632e; margin: 4px 0; }
.v5 .receipt { filter: drop-shadow(0 2px 0 rgba(22, 21, 19, 0.14)); }
/* Inner pages show the owner's colour muted, like the map (logos stay as they are) */
.v5 .thumb:not(:has(img)) { filter: saturate(.4) brightness(.72); color: #fff; }
/* Phone masthead: coin · till · search · history · add (the theme follows the phone's own setting) */
.v5 .brand { flex: none; }
@media (max-width: 700px) {
  .v5 body.v3 .bar { gap: 6px; }
  .v5 body.v3 .till { padding: 0 2px 0 4px; }
  .v5 .till-num { font-size: 13.5px; }
  .v5 #btnTheme { display: none; }
  .v5 body.v3 .bar .btn:not(.square) { padding: 0 10px; font-size: 13px; }
}

/* Real pixels: enlarged with hard edges, never blurred */
.v5 .px-art, .v5 img[data-px], .v5 .project-media img { image-rendering: pixelated; }
.v5 .card-media .px-art { width: auto; height: 100%; aspect-ratio: 1; object-fit: contain; margin: 0 auto; }
.v5 .card-media:has(.px-art) { display: flex; justify-content: center; }
.v5 .pthumb .px-art, .v5 .m-thumb .px-art { width: 100%; height: 100%; object-fit: contain; display: block; }
.v5 .thumb img[data-px], .v5 .project-media img { object-fit: contain; }
.v5 #statsText { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.v5 .stats { min-width: 0; overflow: hidden; }

/* Logo style choice in the buy panel */
.v5 .px-choice { border: 1px solid var(--border); padding: 8px 10px 10px; margin: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.v5 .px-choice[hidden] { display: none; }
.v5 .px-choice legend { padding: 0 4px; font-weight: 650; font-size: 13px; }
.v5 .px-choice label { display: grid; grid-template-columns: auto 1fr; grid-template-rows: auto auto; gap: 6px 8px; align-items: center; cursor: pointer; padding: 6px; border: 1px solid var(--rule); font-weight: 400; }
.v5 .px-choice label:has(input:checked) { border-color: var(--border); background: var(--accent-soft); }
.v5 .px-choice input { grid-row: 1; accent-color: var(--accent); margin: 0; }
.v5 .px-choice canvas { grid-row: 1; width: 100%; aspect-ratio: 1; image-rendering: pixelated; border: 1px solid var(--border); background: var(--surface); }
.v5 .px-choice span { grid-column: 1 / -1; display: flex; flex-direction: column; }
.v5 .px-choice b { font-size: 13px; }
.v5 .px-choice small { color: var(--muted); font-size: 11.5px; }

/* Logos as uploaded: full quality, no pixel rendering */
.v5 img.logo-img { width: 100%; height: 100%; object-fit: contain; display: block; image-rendering: auto; }
.v5 .card-media img.logo-img { width: auto; height: 100%; aspect-ratio: 1; margin: 0 auto; }
.v5 .card-media:has(img.logo-img) { display: flex; justify-content: center; }
.v5 .px-choice canvas.sharp { image-rendering: auto; }
.v5 img[data-px][data-art="0"] { image-rendering: auto; }

/* Demo: how the map grows */
.v5 .zoom .demo-btn { color: var(--accent); font-size: 13px; }   /* ▶ next to + − ⤢ */
.v5 .zoom .demo-btn[hidden] { display: none; }
.v5 .demo-banner { position: absolute; left: 50%; top: 12px; transform: translateX(-50%); z-index: 6; width: min(560px, calc(100% - 24px)); display: flex; gap: 12px; align-items: center; padding: 10px 12px; background: var(--surface); border: 1px solid var(--border); filter: drop-shadow(3px 3px 0 var(--border)); }
.v5 .demo-banner[hidden] { display: none; }
.v5 .demo-text { display: flex; flex-direction: column; gap: 2px; font-size: 13px; min-width: 0; }
.v5 .demo-text b { font-family: var(--mono); font-weight: 400; text-transform: uppercase; color: var(--accent); font-size: 12px; }
.v5 .demo-text span { color: var(--muted); }
.v5 .demo-actions { display: flex; flex-direction: column; gap: 6px; flex: none; }
@media (max-width: 700px) {
  .v5 .demo-banner { flex-direction: column; align-items: stretch; top: 8px; }
  .v5 .demo-actions { flex-direction: row; }
  .v5 .demo-actions .btn { flex: 1; }
}
.v5 .scale-note { margin: 6px 0 0; font-family: var(--mono); font-size: 11.5px; color: var(--muted); }
.v5 body.buying .demo-btn, .v5 body.history-mode .demo-btn { display: none; }

.v5 .demo-link { display: block; margin: 0 0 8px; font-family: var(--mono); font-size: 12.5px; color: var(--accent); background: none; border: 0; padding: 0; cursor: pointer; text-align: left; }
.v5 .demo-link:hover { text-decoration: underline; }
.v5 body.demo-mode .h-label { white-space: normal; overflow: visible; text-overflow: clip; line-height: 1.25; font-size: 11.5px; min-width: 0; }

/* The spinning penny: 8 hand-made frames (face → edge → face), switched sharply like an 8-bit sprite */
.v5 .coin-sprite { display: block; width: 32px; height: 32px; flex: none; background: url(/coin-spin.svg) 0 0 / 256px 32px no-repeat; image-rendering: pixelated; }
.v5 .coin-sprite.spin { animation: coin-spin 0.64s step-end 2; }
.v5 .brand:hover .coin-sprite { animation: coin-spin 0.64s step-end infinite; }
@keyframes coin-spin {
  0% { background-position: 0 0; } 12.5% { background-position: -32px 0; } 25% { background-position: -64px 0; } 37.5% { background-position: -96px 0; }
  50% { background-position: -128px 0; } 62.5% { background-position: -160px 0; } 75% { background-position: -192px 0; } 87.5% { background-position: -224px 0; }
  100% { background-position: 0 0; }
}
@media (prefers-reduced-motion: reduce) { .v5 .coin-sprite.spin, .v5 .brand:hover .coin-sprite { animation: none; } }

/* Reports */
.v5 .card.sticky .card-actions .report-btn:not([hidden]) { display: inline-flex; }
.v5 .report-btn { color: var(--muted); }
.v5 .r-reasons { border: 1px solid var(--border); padding: 8px 12px; margin: 0 0 10px; display: flex; flex-direction: column; gap: 6px; }
.v5 .r-reasons legend { padding: 0 4px; font-weight: 650; font-size: 13px; }
.v5 .r-reasons label { flex-direction: row; align-items: center; gap: 8px; font-weight: 400; font-size: 14px; cursor: pointer; }
.v5 .r-reasons input { accent-color: var(--accent); }
.v5 .report-link { color: var(--muted); }

.v5 .mod-box { border-color: var(--danger); }
.v5 .mod-box h2 { color: var(--danger); }
.v5 .r-reasons label { display: flex; flex-direction: row; justify-content: flex-start; text-align: left; }
.v5 .r-reasons input[type="radio"] { width: auto; flex: none; margin: 0; }

/* Rules · Privacy · contact under the directory */
.maker.legal { margin-top: 6px; font-family: var(--mono); font-size: 12px; }
.maker.legal a { color: inherit; }

/* Checkout: the refund wallet hides behind a link unless it is needed */
.v5 .wallet-toggle { display: block; margin: 2px 0 14px; font-size: 14px; }
.v5 .wallet-toggle .opt { color: var(--muted); font-weight: 400; }
.v5 .coins { margin-bottom: 14px; }
@media (max-width: 480px) { .v5 .wallet .row { flex-direction: column; align-items: stretch; } .v5 .wallet .row .net, .v5 .wallet .row .grow { width: 100%; flex: none; max-width: none; } .v5 .wallet .row .net select { width: 100%; } }

/* Owner key in the dashboard */
.v5 .owner-key { font: 600 clamp(15px, 4.2vw, 20px) var(--mono); letter-spacing: .04em; padding: 12px 14px; border: 1px dashed var(--border); background: var(--surface-2); margin: 4px 0 12px; overflow-wrap: break-word; user-select: all; }
.v5 .key-box.need { outline: 2px solid var(--accent); outline-offset: 2px; }

/* The coin is the "1" of the name: [coin] CENT MAP. The 1 stays in the text for screen readers and search. */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.v5 .brand { gap: 8px; }

/* The pixel crown: same palette and pixel size as the coin (crown.svg, 16×16) */
.pixel-crown { display: inline-block; width: 16px; height: 16px; flex: none; vertical-align: -2px; background: url(/crown.svg) center / 100% 100% no-repeat; image-rendering: pixelated; }
.pixel-crown.x2 { width: 32px; height: 32px; vertical-align: middle; }
.v5 .crown.slim .crown-icon.pixel-crown { font-size: 0; }
.v5 .crown-media .pixel-crown { margin: 0; }
/* Pixel art does not rotate well: the crown hops up and down in whole pixels instead */
@keyframes px-hop { 0%, 70%, 100% { transform: translateY(0); } 80% { transform: translateY(-2px); } 90% { transform: translateY(-1px); } }
.v5 .crown-icon.pixel-crown { animation: px-hop 3.2s steps(1, end) infinite; filter: none; }
@media (prefers-reduced-motion: reduce) { .v5 .crown-icon.pixel-crown { animation: none; } }

/* One crown only: the left icon is the crown, the empty slot invites you in */
.v5 .crown.slim .crown-icon.pixel-crown { width: 24px; height: 24px; }
.v5 .crown-media.empty { background: transparent !important; border: 1px dashed var(--border); box-shadow: none; }
.v5 .crown-media .crown-you { font: 11px var(--mono); text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }

/* The wordmark sits on the coin's middle; the tagline goes underneath it */
@media (min-width: 901px) {
  .v5 .bar .brand { display: grid; grid-template-columns: auto 1fr; column-gap: 8px; align-items: center; justify-items: start; }
  .v5 .bar .brand .coin-img { grid-row: 1; grid-column: 1; }
  .v5 .bar .brand-text { display: contents; }
  .v5 .bar .brand-text b { grid-row: 1; grid-column: 2; line-height: 1; }
  .v5 .bar .brand-text small { grid-row: 2; grid-column: 2; margin-top: -7px; font-size: 10px; line-height: 1.1; }   /* tucked under the wordmark, next to the coin: the header stays low */
}

/* Picture: upload or make from text */
.v5 #buyForm label.color { display: none; }   /* the spot's colour now comes from its picture */
.v5 .pic-source { border: 1px solid var(--border); padding: 8px 10px 10px; margin: 0; display: grid; gap: 8px; }
.v5 .pic-source legend { padding: 0 4px; font-weight: 650; font-size: 13px; }
.v5 .pic-source legend .opt { font-weight: 400; }
.v5 .seg { display: flex; border: 1px solid var(--border); width: max-content; max-width: 100%; }
.v5 .seg label { flex-direction: row; align-items: center; gap: 0; padding: 6px 12px; font-weight: 600; font-size: 13px; cursor: pointer; border-right: 1px solid var(--border); margin: 0; }
.v5 .seg label:last-child { border-right: 0; }
.v5 .seg input { position: absolute; opacity: 0; width: 1px; height: 1px; pointer-events: none; }
.v5 .seg label:has(input:checked) { background: var(--text); color: var(--surface); }
.v5 .seg label:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 1px; }
.v5 .seg.small label { padding: 4px 10px; font-size: 12px; }
.v5 #picText { display: grid; gap: 8px; }
.v5 #picText[hidden], .v5 #picUpload[hidden] { display: none; }
.v5 .swatches { display: flex; gap: 6px; flex-wrap: wrap; }
.v5 .swatch { width: 26px; height: 26px; border: 1px solid var(--border); padding: 0; cursor: pointer; }
.v5 .swatch[aria-pressed="true"] { outline: 2px solid var(--accent); outline-offset: 2px; }
.v5 .pic-need { margin: 0; font-size: 12.5px; color: var(--muted); }
.v5 .pic-need[hidden] { display: none; }

/* Wide screens: [ledger] [square map] [directory] */
.deck { display: block; }
.side { display: none; }
body.sides .deck { display: flex; align-items: stretch; height: var(--stage-h); border-bottom: 1px solid var(--border); }
body.sides .stage { flex: none; height: var(--stage-h); border-left: 1px solid var(--border); border-right: 1px solid var(--border); }
body.sides .side { display: flex; flex-direction: column; gap: 14px; flex: 1 1 0; min-width: 0; overflow-y: auto; padding: 16px; background: var(--bg); overscroll-behavior: contain; }
body.sides .side .cta { margin: 0; }
body.sides .side .section { margin: 0; }
body.sides .side .feedlist { max-height: none; }
body.sides .side-r .explore-head { margin: 0; flex-direction: column; align-items: stretch; gap: 10px; }
body.sides .side-r .explore-head h2 { font-size: 18px; }
body.sides .side-r .tabs { display: flex; flex-wrap: nowrap; }
body.sides .side-r .tabs button { flex: 1 1 auto; padding: 0 6px; font-size: 10.5px; white-space: nowrap; }
/* One "Add your project" is enough: the header's is always in view, so the side box only tells how the zone is filling */
body.sides .side .cta #ctaBuy { display: none; }
body.sides .side-r .pgrid { grid-template-columns: 1fr; gap: 8px; }
body.sides .explore { display: none; }   /* everything it held is in the side columns now */
body.sides.v3 .zoom { position: absolute; right: 12px; bottom: 12px; top: auto; left: auto; }   /* on the map, not over the directory */

/* Header meter: the bar, and under it a short live line (spots free · how many more until the map grows) */
.v5 .stats { flex-direction: column; align-items: flex-start; justify-content: center; gap: 5px; cursor: default; }
.v5 .stats .progress { width: 200px; }
.v5 .stats { flex: 0 1 auto; min-width: max-content; }   /* never squeeze the live line: it is short */
.v5 #statsText { overflow: visible; text-overflow: clip; }
.v5 #statsText { font-size: 10.5px; letter-spacing: .04em; color: var(--text); }
body.sides .side .cta { display: none; }   /* the header line says the same */
/* the short tagline fits every desktop width; phones hide it with the rest of the brand text */
.v5 .bar .actions { margin-left: auto; }   /* buttons stay at the right edge whatever the live line is doing */
body.sides .side-l .cta + .section { border-top: 0; padding-top: 0; }   /* the ledger opens the column now: no rule above it */
/* Side columns: the ledger's heading starts at the same height as "Projects" on the right */
body.sides .side .section > h3:first-child { margin-top: 0; }
body.sides .side .section > h3 { font-size: 18px; letter-spacing: -0.01em; }   /* same size as "Explore projects" on the right */

/* Below the map: Hall of fame, questions, footer */
.after-map { max-width: 1180px; margin: 0 auto; padding: 40px 16px 24px; }
.after-cols { display: grid; grid-template-columns: 1fr; gap: 36px; }
@media (min-width: 900px) { .after-cols { grid-template-columns: 1fr 1fr; gap: 48px; } }
.after-map h2 { margin: 0 0 14px; font-size: 22px; font-stretch: 112%; font-weight: 800; letter-spacing: -0.01em; }
.after-map h3 { margin: 22px 0 8px; font-size: 15px; font-stretch: 112%; font-weight: 800; }
.after-map h3[hidden], .kings[hidden] { display: none; }
.records { display: grid; border: 1px solid var(--text); background: var(--surface); }
.record { display: grid; grid-template-columns: 40px 1fr auto; gap: 12px; align-items: center; padding: 10px 12px; }
.record + .record { border-top: 1px dashed var(--border); }
.rthumb { width: 40px; height: 40px; display: grid; place-items: center; overflow: hidden; border: 1px solid var(--border); }
.rthumb > * { width: 100%; height: 100%; object-fit: cover; }
.rthumb.crown-slot { background: var(--bg); }
.rthumb.crown-slot .pixel-crown { width: 24px; height: 24px; }
.rbody { min-width: 0; display: grid; gap: 1px; }
.rlabel { font: 11px var(--mono); color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; }
.rtitle { all: unset; cursor: pointer; font-weight: 700; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rtitle:hover { color: var(--accent); }
.rtitle:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.rvalue { font: 14px var(--mono); white-space: nowrap; }
.kings { list-style: none; margin: 0; padding: 0; }
.kings li { display: grid; grid-template-columns: 1fr auto auto; gap: 12px; align-items: baseline; padding: 7px 0; border-bottom: 1px dashed var(--border); font-size: 14px; }
.kings li.now .ktitle { font-weight: 700; }
.kings .ktitle { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kings .kdate { font: 12px var(--mono); color: var(--muted); }
.kings .kprice { font: 14px var(--mono); color: var(--accent); }
.faq details { border-bottom: 1px solid var(--border); }
.faq details:first-of-type { border-top: 1px solid var(--border); }
.faq summary { cursor: pointer; list-style: none; padding: 12px 28px 12px 0; font-weight: 650; font-size: 15px; position: relative; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: '+'; position: absolute; right: 4px; top: 10px; font: 18px var(--mono); color: var(--muted); }
.faq details[open] summary::after { content: '−'; }
.faq summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.faq details p { margin: 0 0 14px; font-size: 14.5px; line-height: 1.55; color: var(--muted); }
.faq details p a { color: var(--text); }
.site-foot { margin-top: 44px; padding-top: 18px; border-top: 1px solid var(--text); }
.site-foot .maker { margin-top: 0; }
body.app .bar { z-index: 30; }   /* the sticky header stays above the map's zoom buttons when the page scrolls */
/* Phones: the fill line sits in a strip under the map */
.map-meter { padding: 8px 12px; border-bottom: 1px solid var(--border); background: var(--surface); }
.map-meter[hidden] { display: none; }
body.v3 .map-meter .stats { display: flex; flex-direction: row; align-items: center; gap: 10px; min-width: 0; width: 100%; }
.map-meter .stats .progress { flex: 1 1 auto; width: auto; min-width: 60px; }
.map-meter .stats #statsText { flex: none; white-space: nowrap; }

/* ---------- Phones first ---------- */
@media (max-width: 700px) {
  /* the fill line under the map: words on top (what's free, who's here), the meter across the full width */
  body.v3 .map-meter .stats { display: grid; grid-template-columns: 1fr auto; grid-template-areas: "text live" "bar bar"; align-items: center; gap: 6px 10px; }
  .map-meter .stats #statsText { grid-area: text; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
  .map-meter .stats .live-pill { grid-area: live; }
  .map-meter .stats .progress { grid-area: bar; width: 100%; min-width: 0; }
  /* buying: the sheet leaves a good strip of map, the crown steps aside */
  body.v3.buying .crown { display: none; }
  body.v3 .panel { max-height: 58dvh; }
  /* email and Telegram one under the other */
  #buyForm .row { flex-direction: column; align-items: stretch; }
  /* same side gutters as the directory, less dead space between sections */
  .after-map { padding: 28px 10px 20px; }
  .after-cols { gap: 32px; }
  .site-foot { margin-top: 32px; }
}
@media (max-width: 380px) {
  /* small Androids: the whole header still fits on one row */
  body.v3 .bar { gap: 4px; padding: 6px 8px; }
  body.v3 .actions { gap: 4px; }
  html.v5 body.v3 .bar .actions .btn { padding: 0 8px; font-size: 12.5px; }
  html.v5 body.v3 .bar .actions .btn.square { width: 34px; padding: 0; }
  .v5 .till-num { font-size: 13px; }
}
/* Header: "N watching now" sits beside the meter, so the header stays two lines high */
#bar .stats { display: grid; grid-template-columns: auto auto; grid-template-areas: "bar live" "text text"; align-items: center; justify-content: start; gap: 5px 10px; }
#bar .stats .progress { grid-area: bar; }
#bar .stats .live-pill { grid-area: live; }
#bar .stats #statsText { grid-area: text; }

/* ---------- Project and category pages (SEO) ---------- */
.seo-sheet { max-width: 760px; }
.crumbs { font: 12.5px var(--mono); color: var(--muted); margin: 6px 0 10px; display: flex; flex-wrap: wrap; gap: 4px 8px; }
.crumbs a { color: inherit; }
.crumbs span { color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 60vw; }
.project a.chip { text-decoration: none; color: inherit; }
.project .about { margin: 10px 0 4px; }
.project .about p { margin: 0 0 10px; font-size: 15.5px; line-height: 1.6; }
.more-links { list-style: none; padding: 0; margin: 12px 0 0; display: flex; flex-wrap: wrap; gap: 6px 14px; font: 13px var(--mono); }
.more-links a { color: var(--accent); }
.similar h2 { margin: 0 0 12px; font-size: 18px; }
.minis { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 8px; margin-bottom: 12px; }
.mini { display: grid; grid-template-columns: 48px 1fr; gap: 10px; align-items: center; padding: 8px; border: 1px solid var(--border); background: var(--surface); color: var(--text); text-decoration: none; min-width: 0; }
.mini:hover { border-color: var(--text); }
.mini-media { width: 48px; height: 48px; display: grid; place-items: center; overflow: hidden; font: 800 16px var(--sans, inherit); color: #fff; }
.mini-media img { width: 100%; height: 100%; object-fit: cover; }
.mini-text { min-width: 0; display: grid; gap: 2px; }
.mini-text b { font-size: 14.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mini-text span { font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cat-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.cat-chips a { border: 1px solid var(--border); padding: 5px 10px; font-size: 13px; font-weight: 600; color: var(--text); text-decoration: none; background: var(--surface); }
.cat-chips a i { font: normal 11.5px var(--mono); color: var(--muted); }
.cat-chips a[aria-current="page"] { background: var(--text); color: var(--surface); border-color: var(--text); }
.cat-chips a[aria-current="page"] i { color: inherit; opacity: .7; }
.pager { display: flex; justify-content: space-between; align-items: center; font: 13px var(--mono); margin-top: 8px; }
.pager a { color: var(--accent); }
.seo-foot { margin-top: 18px; font-size: 13px; color: var(--muted); text-align: center; display: grid; gap: 6px; }
.seo-foot a { color: inherit; }
.maker.cats { margin-top: 0; margin-bottom: 8px; font-size: 12.5px; line-height: 1.8; }
.maker.cats a { color: inherit; }
.links-field { border: 1px solid var(--border); padding: 8px 10px 10px; margin: 0; display: grid; gap: 6px; }
.links-field legend { padding: 0 4px; font-weight: 650; font-size: 13px; }

/* After a purchase: tell people */
.share-now { margin-top: 14px; border-top: 1px dashed var(--border); padding-top: 12px; }
.share-now .share-title { margin: 0 0 8px; font-weight: 700; font-size: 15px; }

/* ---------- The daily coin ---------- */
.flipcard { display: flex; align-items: center; gap: 12px; width: 100%; padding: 10px 12px; border: 0; border-bottom: 1px solid var(--border); background: var(--surface); color: var(--text); font: inherit; text-align: left; cursor: pointer; }
.flipcard:hover .flipcard-go { text-decoration: underline; }
.flipcard-coin { width: 32px; height: 32px; flex: none; background: url(/coin-spin.svg) 0 0 / 256px 32px no-repeat; image-rendering: pixelated; animation: coinspin32 1.2s steps(8) infinite; }
.flipcard-text { flex: 1; min-width: 0; display: grid; }
.flipcard-text b { font-weight: 800; font-stretch: 112%; font-size: 15px; }
.flipcard-text small { color: var(--muted); font-size: 12.5px; }
.flipcard-go { font: 13px var(--mono); color: var(--accent); white-space: nowrap; }
body.sides .side .flipcard { border: 1px solid var(--border); background: var(--surface); filter: drop-shadow(3px 3px 0 var(--border)); }
/* the sprite has 8 frames side by side: slide it a whole strip in 8 hard steps */
@keyframes coinspin32 { from { background-position: 0 0; } to { background-position: -256px 0; } }
@keyframes coinspin128 { from { background-position: 0 0; } to { background-position: -1024px 0; } }
.flip-dialog .flipcoin { width: 128px; height: 128px; margin: 6px auto 10px; background: url(/coin-spin.svg) 0 0 / 1024px 128px no-repeat; image-rendering: pixelated; }
.flip-dialog .flipcoin.spin { animation: coinspin128 .45s steps(8) infinite; }
/* after the flip: heads shows the "1", tails the coin's back with the cent sign */
.flip-dialog .flipcoin.heads { background: url(/coin.svg) center / 100% 100% no-repeat; }
.flip-dialog .flipcoin.tails { background: url(/coin-tails.svg) center / 100% 100% no-repeat; }
.flip-dialog .flip-msg { text-align: center; font-size: 15px; line-height: 1.5; margin: 0 0 12px; }
.flip-dialog .flip-auth { display: grid; gap: 8px; }
.flip-dialog .flip-auth .sub { margin: 0; text-align: center; }
.flip-dialog form.flip-email { display: flex; flex-direction: row; align-items: stretch; gap: 8px; }
.flip-dialog .flip-email input { flex: 1; min-width: 0; width: auto; }
.flip-dialog .flip-email .btn { flex: none; width: auto; height: auto; }
.flip-dialog .fine { font-size: 12px; color: var(--muted); margin: 0; text-align: center; }
.flip-dialog .flip-meta { font: 12px var(--mono); color: var(--muted); text-align: center; margin: 12px 0 0; }
