/* Shared components (docs/DESIGN-SYSTEM.md §5). Class names are generic on purpose: the map chrome, the
   neighbourhood panel and the game quest screens all use them. Everything reads tokens.css; nothing here knows
   about a map. Motion is transform/opacity only and is switched off for prefers-reduced-motion in app.css. */
:root { font-family: var(--font-ui); color: var(--c-ink); -webkit-font-smoothing: antialiased; }
* { box-sizing: border-box; }
[hidden] { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
/* icons: the hidden sprite host and the inline badge (here, not in icons.css, because the first paint has icons) */
.snm-sprite { position: absolute; width: 0; height: 0; overflow: hidden; pointer-events: none; }
.ic { display: inline-block; flex: none; vertical-align: -0.28em; margin-right: 6px; }
.muted { color: var(--c-muted); }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--c-accent); }
:focus-visible { outline: 2.5px solid var(--c-focus); outline-offset: 2px; }
h1, h2, h3, h4, .display { font-family: var(--font-display); font-weight: var(--fw-display); letter-spacing: var(--track-snug); }

/* ---- glass: a surface that floats on the map (frosted when tokens.css `fx-glass` is on, near-solid otherwise) ---- */
.glass { background: var(--c-glass); -webkit-backdrop-filter: var(--glass-filter); backdrop-filter: var(--glass-filter);
  box-shadow: inset 0 0 0 .5px var(--c-glass-edge), var(--shadow-1); }

/* ---- card: any floating surface ---- */
.card { background: var(--c-surface); border-radius: var(--r-l); box-shadow: var(--shadow-1); }
.card.pop { box-shadow: var(--shadow-2); animation: pop-in var(--dur-base) var(--ease); transform-origin: top center; }
@keyframes pop-in { from { opacity: 0; transform: translateY(-6px) scale(.98); } }

/* ---- buttons ---- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: var(--tap); padding: 10px 18px; border: 0; border-radius: 14px;
  font-family: var(--font-display); font-weight: var(--fw-display); font-size: var(--fs-l); line-height: 1.15; letter-spacing: var(--track-snug); text-align: center; text-decoration: none;
  transition: transform var(--dur-fast) var(--ease), opacity var(--dur-fast) var(--ease); }
.btn:active { transform: scale(var(--press-scale)); }
.btn-primary { background: linear-gradient(180deg, var(--c-gold-2), var(--c-gold) 70%); color: var(--c-on-gold); box-shadow: inset 0 0 0 .5px rgba(120, 84, 6, .35), var(--shelf-gold); }
.btn-accent { background: linear-gradient(180deg, var(--c-accent-2), var(--c-accent) 75%); color: var(--c-on-accent); box-shadow: var(--shelf-accent); }
.btn-ghost { background: var(--c-chip); color: var(--c-ink); font-family: var(--font-ui); font-weight: 600; font-size: var(--fs-sm); letter-spacing: 0; min-height: 40px; padding: 6px 12px; border-radius: var(--r-m); }
.btn-ghost:hover { background: var(--c-hover); }
.icon-btn:active, .tool-btn:active { transform: scale(var(--press-scale)); }
.btn-block { display: flex; width: 100%; }
.btn[disabled], .btn[aria-disabled="true"] { opacity: .5; cursor: default; box-shadow: none; }
.icon-btn { width: 32px; height: 32px; display: grid; place-items: center; border: 0; border-radius: 50%; background: var(--c-chip); color: var(--c-ink-2);
  transition: transform var(--dur-fast) var(--ease); }
.icon-btn:hover { background: var(--c-hover); }
.tool-btn { width: var(--tap); height: var(--tap); display: grid; place-items: center; border: 0; border-radius: 14px; color: var(--c-ink);
  transition: transform var(--dur-fast) var(--ease); }
.tool-btn svg { width: var(--ico); height: var(--ico); }
.tool-btn[aria-expanded="true"], .tool-btn[aria-pressed="true"] { background: var(--c-ink); color: var(--c-surface); }

/* hover (pointer devices only): things you can press rise by a pixel */
@media (hover: hover) {
  .btn-primary:hover, .btn-accent:hover, .tool-btn:hover, .chip-lens:hover, .meter:hover, .choice:hover { transform: translateY(-1px); }
  .btn-primary:active, .btn-accent:active, .tool-btn:active, .chip-lens:active, .meter:active, .choice:active { transform: scale(var(--press-scale)); }
}

/* ---- chips ---- */
.chip { display: inline-flex; align-items: center; gap: 6px; min-height: 30px; padding: 4px 12px; border: 0; border-radius: var(--r-pill); background: var(--c-chip);
  color: var(--c-ink); font-size: var(--fs-sm); font-weight: 600; white-space: nowrap; text-decoration: none; }
.chip .ic { margin: 0; flex: none; }
.chip-soft { background: var(--c-accent-soft); }
.chip-muted { background: var(--c-chip-muted); color: var(--c-ink-2); }
.chip-gold { background: var(--c-gold-soft); }
/* lens chip: one of several, exactly one active */
.chip-lens { height: 38px; padding: 0 14px 0 7px; background: var(--c-glass); box-shadow: var(--shadow-1); font-family: var(--font-display); font-weight: 600; font-size: var(--fs-base);
  letter-spacing: var(--track-snug); transition: transform var(--dur-fast) var(--ease), background-color var(--dur-base) var(--ease), color var(--dur-base) var(--ease); }
.chip-lens.no-icon { padding-left: 14px; }
.chip-lens.active { background: var(--c-accent); color: var(--c-on-accent); box-shadow: var(--shelf-accent); }
.chip-lens:active, .chip-toggle:active { transform: scale(var(--press-scale)); }
/* toggle chip: on/off */
.chip-toggle { min-height: 36px; padding: 3px 12px 3px 6px; background: var(--c-surface); box-shadow: inset 0 0 0 1px var(--c-line-strong); color: var(--c-ink-2);
  transition: transform var(--dur-fast) var(--ease); }
.chip-toggle .ic { opacity: .45; filter: grayscale(1); }
.chip-toggle[aria-pressed="true"] { background: var(--c-accent-soft); box-shadow: inset 0 0 0 1.5px var(--c-accent); color: var(--c-ink); }
.chip-toggle[aria-pressed="true"] .ic { opacity: 1; filter: none; }
.chip-toggle:disabled { opacity: .5; cursor: default; }

/* ---- segmented control ---- */
.segmented { display: inline-flex; padding: 3px; gap: 2px; border-radius: 14px; }
.segmented button { border: 0; background: transparent; min-width: 38px; height: 38px; padding: 0 10px; border-radius: 11px; font-family: var(--font-display); font-weight: var(--fw-display);
  font-size: var(--fs-sm); letter-spacing: .01em; color: var(--c-muted); transition: transform var(--dur-fast) var(--ease), background-color var(--dur-base) var(--ease), color var(--dur-base) var(--ease); }
.segmented button.active { background: var(--c-ink); color: var(--c-surface); }
.segmented button:active { transform: scale(var(--press-scale)); }

/* ---- tiles: one fact each, icon + big number + short label ---- */
.tile { border-radius: var(--r-l); padding: 14px; background: var(--c-surface); box-shadow: var(--ring), var(--shelf); }
.tile-top { display: flex; align-items: center; gap: 8px; min-height: 28px; }
.tile-top .ic { margin: 0; }
.tile-label { font-family: var(--font-display); font-weight: var(--fw-display); font-size: var(--fs-md); letter-spacing: var(--track-snug); }
.tile-hero { color: #fff; background: linear-gradient(150deg, var(--c-accent-2) -10%, var(--c-accent) 48%, var(--c-accent-deep) 115%); box-shadow: inset 0 0 0 .5px rgba(255, 255, 255, .18), var(--shelf-accent);
  position: relative; overflow: hidden; border-radius: 20px; padding: 16px; }
.tile-hero::after { content: ''; position: absolute; inset: 0; background: radial-gradient(120% 90% at 100% 0, rgba(255, 255, 255, .2), rgba(255, 255, 255, 0) 55%); pointer-events: none; }
.tile-hero > * { position: relative; z-index: 1; }
.tile-hero .tile-label { color: rgba(255, 255, 255, .92); font-weight: 600; }
.num-hero { margin: 8px 0 0; font-family: var(--font-display); font-weight: var(--fw-num); font-size: var(--fs-hero); line-height: 1.02; letter-spacing: var(--track-tight); font-variant-numeric: tabular-nums; }
.tag-tiny { margin-left: auto; font-size: var(--fs-2xs); font-weight: 700; letter-spacing: .02em; padding: 3px 8px; border-radius: var(--r-pill); white-space: nowrap; background: rgba(255, 255, 255, .18); color: #fff;
  box-shadow: inset 0 0 0 .5px rgba(255, 255, 255, .35); }
.stat-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.stat { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; padding: 12px 11px 11px; border-radius: var(--r-l); background: var(--c-surface-2); min-width: 0; }
.stat .ic { margin: 0 0 6px; }
.stat-val { font-family: var(--font-display); font-weight: var(--fw-num); font-size: var(--fs-2xl); line-height: 1; letter-spacing: var(--track-tight); font-variant-numeric: tabular-nums; }
.stat-label { font-size: var(--fs-sm); font-weight: 600; line-height: 1.2; color: var(--c-ink-2); overflow-wrap: anywhere; }
.stat-sub { font-size: var(--fs-2xs); color: var(--c-muted); line-height: 1.2; }
/* reveal: children of .reveal land one after another (set --i on each) */
.reveal > * { animation: tile-in var(--dur-pop) var(--ease) both; animation-delay: calc(var(--i, 0) * var(--stagger) + 60ms); }
@keyframes tile-in { from { opacity: 0; transform: translateY(10px); } }
/* icon row: icon, two lines of text, a value on the right (schools, stores, quest answers) */
.row-chip { display: grid; grid-template-columns: 30px 1fr auto; align-items: center; column-gap: 10px; padding: 8px 10px 8px 8px; border-radius: var(--r-m); background: var(--c-surface-2); margin: 0; }
.row-chip .ic { margin: 0; grid-row: 1 / span 2; }
.row-title { font-weight: 600; font-size: var(--fs-base); line-height: 1.2; letter-spacing: var(--track-snug); min-width: 0; overflow-wrap: anywhere; }
.row-sub { grid-column: 2; font-size: var(--fs-xs); color: var(--c-muted); }
.row-val { grid-column: 3; grid-row: 1 / span 2; font-weight: 600; font-size: var(--fs-sm); padding: 3px 9px; border-radius: var(--r-pill);
  background: var(--c-surface); box-shadow: var(--ring); white-space: nowrap; font-variant-numeric: tabular-nums; }
.eyebrow { margin: 0 0 3px; font-size: var(--fs-2xs); font-weight: 700; letter-spacing: var(--track-caps); text-transform: uppercase; color: var(--c-accent); }

/* ---- progress: ring meter (HUD), bar, steps (quest) ---- */
.meter { display: inline-flex; align-items: center; gap: 6px; border: 0; padding: 0 12px 0 8px; font-family: var(--font-display); font-weight: var(--fw-display); color: var(--c-ink);
  transition: transform var(--dur-fast) var(--ease); }
.meter:active { transform: scale(var(--press-scale)); }
.meter-track { stroke: rgba(28, 26, 38, .09); }
.meter-arc { stroke: var(--c-gold); transition: stroke-dasharray var(--dur-pop) var(--ease); }
.meter-star { fill: var(--c-gold); }
.meter-text { display: inline-flex; align-items: baseline; gap: 1px; font-size: var(--fs-md); font-variant-numeric: tabular-nums; }
.meter-text span { font-size: var(--fs-xs); color: var(--c-muted); font-family: var(--font-ui); font-weight: 600; }
.meter.bump { animation: bump var(--dur-pop) var(--ease-pop); }
@keyframes bump { 40% { transform: scale(1.1); } }
.progress { height: 8px; border-radius: var(--r-pill); background: var(--c-surface-3); overflow: hidden; }
.progress > i { display: block; height: 100%; width: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--c-gold-2), var(--c-gold)); transform-origin: left center;
  transform: scaleX(var(--p, 0)); transition: transform var(--dur-pop) var(--ease); }
.steps { display: flex; gap: 6px; list-style: none; margin: 0; padding: 0; }
.steps li { flex: 1; height: 4px; border-radius: 2px; background: var(--c-surface-3); }
.steps li.done { background: var(--c-accent); }
.steps li.now { background: var(--c-gold); }
.level { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: var(--r-pill); background: var(--c-gold-soft); color: var(--c-on-gold);
  font-weight: 600; font-size: var(--fs-sm); }

/* ---- toast: short feedback, top centre, leaves by itself ---- */
#toasts { position: absolute; left: 0; right: 0; top: calc(var(--top-h) + var(--gap) * 2 + 52px); z-index: 9; display: grid; justify-items: center; gap: 6px; pointer-events: none; }
.toast { display: inline-flex; align-items: center; gap: 8px; max-width: min(92vw, 420px); padding: 8px 16px 8px 9px; border-radius: var(--r-pill); background: var(--c-tooltip); color: var(--c-on-tooltip);
  font-weight: 600; font-size: var(--fs-base); letter-spacing: var(--track-snug); box-shadow: var(--shadow-2); animation: toast-in var(--dur-pop) var(--ease-pop) both; }
.toast.out { animation: toast-out var(--dur-base) var(--ease) both; }
.toast-ico { width: 24px; height: 24px; flex: none; display: grid; place-items: center; border-radius: 50%; background: var(--c-gold); color: var(--c-on-gold); }
@keyframes toast-in { from { opacity: 0; transform: translateY(-12px) scale(.94); } }
@keyframes toast-out { to { opacity: 0; transform: translateY(-8px); } }

/* ---- sheet: a card on wide screens, a bottom sheet on phones (ui/sheet.js moves it) ---- */
.sheet-grab { display: none; }
@media (max-width: 720px) {
  .sheet-grab { display: block; position: absolute; top: 0; left: 50%; transform: translateX(-50%); width: 96px; height: 24px; border: 0; background: transparent; z-index: 3; padding: 0;
    touch-action: none; cursor: grab; }
  .sheet-grab span { display: block; width: 36px; height: 5px; margin: 8px auto 0; border-radius: 3px; background: rgba(28, 26, 38, .18); }
}

/* ---- forms (quest answers, lead form) ---- */
.field { display: grid; gap: 4px; margin: 0 0 12px; }
.field > span { font-size: var(--fs-sm); font-weight: 600; color: var(--c-ink-2); }
.field input, .field select, .field textarea { min-height: var(--tap); padding: 10px 12px; border: 1px solid var(--c-line-strong); border-radius: var(--r-m); background: var(--c-surface); font-size: 16px; }
.field input:focus-visible, .field select:focus-visible, .field textarea:focus-visible { outline-offset: 0; border-color: var(--c-accent); }
.field .hint { font-size: var(--fs-xs); color: var(--c-muted); }
/* choice: a quest answer. One big target, icon left, pressed = chosen */
.choice { display: grid; grid-template-columns: 36px 1fr; align-items: center; gap: 12px; width: 100%; min-height: 56px; padding: 10px 14px; border: 0; border-radius: var(--r-l); background: var(--c-surface);
  box-shadow: var(--ring), var(--shelf); text-align: left; font-family: var(--font-display); font-weight: 600; font-size: var(--fs-md); letter-spacing: var(--track-snug);
  transition: transform var(--dur-fast) var(--ease); }
.choice small { display: block; font-family: var(--font-ui); font-weight: 400; font-size: var(--fs-xs); letter-spacing: 0; color: var(--c-muted); }
.choice:active { transform: scale(var(--press-scale)); }
.choice[aria-pressed="true"], .choice[aria-checked="true"] { background: var(--c-accent-soft); box-shadow: inset 0 0 0 1.5px var(--c-accent); }
.consent { display: grid; grid-template-columns: 22px 1fr; gap: 10px; align-items: start; font-size: var(--fs-xs); color: var(--c-ink-2); line-height: 1.4; }
.consent input { width: 20px; height: 20px; margin: 0; accent-color: var(--c-accent); }

/* ---- notes ---- */
.note { color: var(--c-muted); font-size: var(--fs-xs); margin: 4px 0; }
.caveat { color: var(--c-ink-2); font-size: var(--fs-xs); margin: 8px 0; padding: 7px 10px; background: var(--c-surface-2); border-radius: var(--r-s); }
.src { color: var(--c-muted); font-size: var(--fs-xs); margin: 0 0 4px; }
.badge { background: var(--c-badge); color: var(--c-on-badge); font-weight: 700; font-size: 11px; padding: 2px 8px; border-radius: 6px; letter-spacing: .04em; }
/* build-here massing label (game funnel): sits on a 3D block; always says it is illustrative */
.massing-label { display: inline-grid; gap: 1px; padding: 6px 10px; border-radius: var(--r-m); background: var(--c-tooltip); color: var(--c-on-tooltip); font-size: var(--fs-xs); box-shadow: var(--shadow-2); }
.massing-label b { font-weight: var(--fw-display); font-size: var(--fs-md); }
.massing-label em { font-style: normal; color: var(--c-gold-2); }

/* "Get new listings here" box (js/ui/signup.js). Opens only on a tap; phone = bottom sheet, desktop = centred card. */
.cta-quiet { margin-top: 8px; }
.su-root { position: fixed; inset: 0; z-index: 20; display: flex; align-items: flex-end; justify-content: center; }
.su-scrim { position: absolute; inset: 0; background: var(--c-scrim); }
.su-box { position: relative; width: 100%; max-width: 440px; max-height: 92dvh; overflow-y: auto; overscroll-behavior: contain;
  border-radius: var(--r-l) var(--r-l) 0 0; padding: 0 16px calc(16px + env(safe-area-inset-bottom)); }
@media (min-width: 720px) { .su-root { align-items: center; } .su-box { border-radius: var(--r-l); padding-bottom: 20px; } }
.su-head { position: sticky; top: 0; z-index: 1; display: flex; align-items: flex-start; justify-content: space-between; gap: 12px;
  padding: 14px 0 10px; background: var(--c-surface); }
.su-step { margin: 0; color: var(--c-muted); font-size: var(--fs-xs); font-weight: 600; }
.su-title { margin: 2px 0 0; font-family: var(--font-display); font-size: var(--fs-xl); line-height: 1.2; }
.su-close { flex: none; width: 40px; height: 40px; font-size: 24px; line-height: 1; }
.su-form { display: flex; flex-direction: column; gap: 14px; }
.su-set { margin: 0; padding: 0; border: 0; display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.su-set[hidden] { display: none; }
.su-set legend { padding: 0; margin-bottom: 8px; font-weight: 700; font-size: var(--fs-md); }
.su-opt { color: var(--c-muted); font-weight: 500; font-size: var(--fs-sm); }
.su-choices { display: flex; flex-wrap: wrap; gap: 8px; }
.su-choice { position: relative; display: inline-flex; }
.su-choice input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.su-choice span { display: inline-flex; align-items: center; min-height: var(--tap); padding: 8px 16px; border-radius: var(--r-pill);
  background: var(--c-surface); box-shadow: inset 0 0 0 1px var(--c-line-strong); font-weight: 600; font-size: var(--fs-base); }
.su-choice input:checked + span { background: var(--c-accent-soft); box-shadow: inset 0 0 0 2px var(--c-accent); color: var(--c-accent-deep); }
.su-choice input:focus-visible + span { outline: 2px solid var(--c-focus); outline-offset: 2px; }
.su-tick { display: flex; align-items: flex-start; gap: 10px; min-height: var(--tap); padding: 10px 12px; border-radius: var(--r-m);
  background: var(--c-surface-2); font-size: var(--fs-base); line-height: 1.35; cursor: pointer; }
.su-tick input { flex: none; width: 22px; height: 22px; margin: 0; accent-color: var(--c-accent); }
.su-note { margin: -2px 0 0; color: var(--c-muted); font-size: var(--fs-sm); }
.su-field { display: flex; flex-direction: column; gap: 6px; }
.su-field > label { font-weight: 700; font-size: var(--fs-base); }
.su-field input:not([type="checkbox"]) { min-height: var(--tap); padding: 10px 12px; border: 0; border-radius: var(--r-m); font: inherit; font-size: 16px;
  box-shadow: inset 0 0 0 1px var(--c-control-edge); background: var(--c-surface); color: var(--c-ink); width: 100%; box-sizing: border-box; }
.su-field input[aria-invalid="true"] { box-shadow: inset 0 0 0 2px var(--c-coral); }
.su-consent .su-tick { font-size: var(--fs-sm); }
.su-privacy { font-size: var(--fs-xs); align-self: flex-start; }
.su-hp { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }
.su-error { margin: 0; color: #b42318; font-size: var(--fs-sm); font-weight: 600; }
.su-nav { display: flex; gap: 8px; align-items: center; justify-content: flex-end; margin-top: 4px; }
.su-nav .su-next { flex: 1 1 auto; max-width: 240px; }
.su-nav .btn-ghost { min-height: var(--tap); }
.su-check:empty { display: none; }
.su-check { margin-top: 10px; }
.su-done { display: flex; flex-direction: column; gap: 10px; padding-bottom: 4px; }
.su-done p { margin: 0; font-size: var(--fs-base); }
.su-done-title { font-family: var(--font-display); font-weight: 700; font-size: var(--fs-xl) !important; }
.su-talk { margin-top: 6px; padding: 12px; border-radius: var(--r-m); background: var(--c-surface-2); display: flex; flex-direction: column; gap: 8px; }
.su-talk-h { font-weight: 700; }
.su-talk-row { display: flex; flex-wrap: wrap; gap: 8px; }
.su-talk-row .btn { min-height: var(--tap); text-decoration: none; }
body.signup-open { overflow: hidden; }
.p-signup { margin: 12px 0 4px; }
