/* Functional test styles — design pass is the owner's. Tokens on :root. */
:root {
  --bg: #05060a;
  --panel: rgba(12, 14, 22, 0.92);
  --line: rgba(255, 255, 255, 0.12);
  --text: #f2f2f2;
  --muted: #9aa0ad;
  --accent: #ffb347;
  --draft: #7cffb2;
  --danger: #ff6b6b;
  --radius: 14px;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); overflow: hidden; }
#map { position: fixed; inset: 0; }
.maplibregl-popup-content { background: var(--panel); color: var(--text); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; }
.maplibregl-popup-tip { display: none; }
.pop b { display: block; font-size: 15px; margin-bottom: 4px; }
.pop a { color: var(--accent); font-size: 13px; }

.top { position: fixed; top: 0; left: 0; right: 0; display: flex; justify-content: space-between; align-items: center;
  padding: 16px; pointer-events: none; }
.brand { font-weight: 800; letter-spacing: 0.14em; font-size: 14px; }
.counter { color: var(--muted); font-size: 13px; }

.cta-bar { position: fixed; left: 0; right: 0; bottom: 24px; display: flex; flex-direction: column; align-items: center; gap: 10px;
  padding: 0 16px; }
.tagline { margin: 0; color: var(--muted); font-size: 14px; text-align: center; }

.btn { display: inline-flex; justify-content: center; align-items: center; gap: 6px; padding: 12px 20px; border-radius: 999px;
  border: 1px solid var(--line); background: rgba(255, 255, 255, 0.06); color: var(--text); font: inherit; font-weight: 600;
  text-decoration: none; cursor: pointer; }
.btn.primary { background: var(--accent); color: #1a1205; border-color: transparent; }
.btn.wide { width: 100%; margin-top: 8px; }
.btn:disabled { opacity: 0.5; cursor: wait; }

.panel { position: fixed; top: 0; right: 0; bottom: 0; width: min(420px, 100%); background: var(--panel);
  border-left: 1px solid var(--line); padding: 20px 16px 24px; overflow-y: auto; backdrop-filter: blur(10px); }
.panel h2 { margin: 0 0 6px; font-size: 20px; }
.close { position: absolute; top: 10px; right: 12px; background: none; border: 0; color: var(--muted); font-size: 26px; cursor: pointer; }
.hint { color: var(--draft); font-size: 13px; margin: 0 0 14px; }
label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 12px; }
input, textarea { display: block; width: 100%; margin-top: 6px; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.04); color: var(--text); font: inherit; font-size: 16px; resize: vertical; }
.error { color: var(--danger); font-size: 13px; min-height: 1em; }
.fineprint { color: var(--muted); font-size: 11px; margin-top: 14px; }
#ts-widget { margin: 12px 0 4px; min-height: 65px; }

.tip { background: rgba(0, 0, 0, 0.8); padding: 6px 10px; border-radius: 8px; font-size: 13px; }

/* card (shared by panel preview and /c/<id>) */
.mini-card, .card { border: 1px solid var(--line); border-radius: var(--radius); padding: 18px;
  background: linear-gradient(160deg, #1b1430 0%, #0b0d16 60%, #2a1406 100%); margin: 12px 0; }
.card-kicker { font-size: 11px; letter-spacing: 0.2em; color: var(--accent); font-weight: 700; }
.card-title { font-size: 30px; line-height: 1.05; font-weight: 900; margin: 10px 0 12px; }
.card-line { margin: 6px 0; font-size: 14px; }
.card-line span { display: inline-block; min-width: 46px; color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: 0.1em; }
.card-foot { display: flex; justify-content: space-between; color: var(--muted); font-size: 13px; margin-top: 14px; }

.card-page { overflow: auto; }
.card-wrap { max-width: 520px; margin: 0 auto; padding: 40px 16px; }
.card-page .card { padding: 28px; }
.card-page .card-title { font-size: 44px; }
.card-actions { display: flex; flex-wrap: wrap; gap: 8px; }

.hint-muted { color: var(--muted); font-size: 14px; line-height: 1.45; margin: 0 0 16px; }
.btn.danger { color: var(--danger); border-color: rgba(255,107,107,0.4); }
.prose { line-height: 1.55; font-size: 15px; }
.prose h2 { font-size: 17px; margin-top: 24px; }
.prose a:not(.btn), .fineprint a { color: var(--accent); }
.card-page { overflow: auto; }
html:has(.card-page) { overflow: auto; }

/* hook input: «I [____] before GTA VI.» */
.hook-input { display: flex; align-items: center; gap: 8px; margin-top: 6px; color: var(--text); font-size: 15px; }
.hook-input input { margin-top: 0; flex: 1; min-width: 0; }
.hook-input span { white-space: nowrap; }
#done-card .relic-card { max-width: 100%; margin: 8px 0 12px; }
.hook-preview { font-family: "Instrument Serif", serif; font-size: 26px; line-height: 1.1; margin: 10px 0 4px; }
.card-still { width: 100%; max-width: 380px; border-radius: 22px; display: block; margin: 0 auto 12px; }
.card-page .relic-card { margin: 0 auto 16px; }
.chrome-off .top, .chrome-off .cta-bar, .chrome-off .maplibregl-ctrl-top-right, .chrome-off .maplibregl-ctrl-bottom-right { display: none !important; }

/* ===== approved UX (2026-11-16): one sheet over the globe ===== */
@font-face { font-family: 'Instrument Serif'; src: url('/fonts/instrument-serif-latin-400-normal.woff2') format('woff2'); font-display: swap; }
@font-face { font-family: 'JetBrains Mono'; src: url('/fonts/jetbrains-mono-latin-500-normal.woff2') format('woff2'); font-weight: 500; font-display: swap; }
:root { --cream: #efe9dc; --sheet-bg: rgba(14, 14, 16, 0.95); --serif: 'Instrument Serif', Georgia, serif; --mono: 'JetBrains Mono', ui-monospace, monospace; }
.top { padding: max(16px, env(safe-area-inset-top)) 18px 0; }
.brand { font-family: var(--mono); font-weight: 500; font-size: 11px; letter-spacing: 0.16em; }
.counter { font-family: var(--mono); font-size: 11px; }
.maplibregl-ctrl-bottom-left { bottom: 18px; }
.home-cta { position: fixed; left: 16px; right: 16px; bottom: max(24px, env(safe-area-inset-bottom)); transition: opacity 0.2s, transform 0.2s; }
.home-cta.hidden { opacity: 0; transform: translateY(20px); pointer-events: none; }
.cta { display: inline-flex; justify-content: center; align-items: center; width: 100%; height: 54px; border: 0; border-radius: 999px;
  background: var(--cream); color: #141414; font: 600 16px/1 -apple-system, BlinkMacSystemFont, 'Inter', system-ui, sans-serif; cursor: pointer; text-decoration: none; }
.cta:disabled { opacity: 0.55; cursor: progress; }
.cta.block { display: flex; margin-top: 14px; }
.ghost { height: 48px; min-width: 48px; border: 0; border-radius: 999px; background: rgba(255, 255, 255, 0.08); color: var(--text);
  font: 500 15px/1 -apple-system, BlinkMacSystemFont, 'Inter', system-ui, sans-serif; cursor: pointer; }
.ghost.round { font-size: 19px; }
.ghost:disabled { opacity: 0.35; }
.ghost.ok { background: rgba(124, 255, 178, 0.25); }
.grow { flex: 1; }
.actions { display: flex; gap: 8px; margin-top: 16px; }

.sheet { position: fixed; left: 0; right: 0; bottom: 0; max-height: 86vh; overflow-y: auto; z-index: 10;
  background: var(--sheet-bg); backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px); color: var(--text);
  border-radius: 28px 28px 0 0; border-top: 1px solid var(--line); padding: 8px 18px max(22px, env(safe-area-inset-bottom));
  transform: translateY(105%); transition: transform 0.35s cubic-bezier(.2,.8,.2,1); }
.sheet.open { transform: translateY(0); }
.grab { width: 40px; height: 5px; border-radius: 3px; background: rgba(255, 255, 255, 0.22); margin: 2px auto 12px; touch-action: none; }
.sheet-close { position: absolute; top: 8px; right: 12px; width: 34px; height: 34px; border: 0; border-radius: 50%; background: rgba(255, 255, 255, 0.08);
  color: var(--muted); font-size: 20px; cursor: pointer; display: none; }
@media (min-width: 760px) {
  .sheet { left: auto; right: 24px; top: 72px; bottom: auto; width: 380px; max-height: calc(100vh - 96px); border-radius: 28px; border: 1px solid var(--line);
    padding: 18px 20px 20px; transform: translateX(calc(100% + 90px)); }
  .sheet.open { transform: translateX(0); }
  .grab { display: none; }
  .sheet-close { display: block; }
  /* outside the panel so it never sits on the card image; .sheet scrolls, so it stays absolute to the panel's top-left */
  .sheet { overflow: visible; }
  #sheet-body { max-height: calc(100vh - 134px); overflow-y: auto; }
  .sheet-close { top: 0; right: auto; left: -46px; background: var(--sheet-bg); border: 1px solid var(--line); backdrop-filter: blur(20px); }
  .home-cta { left: 50%; right: auto; width: 340px; transform: translateX(-50%); }
  .home-cta.hidden { transform: translateX(-50%) translateY(20px); }
}

/* card pieces */
.card-compact { display: flex; gap: 14px; align-items: center; }
.card-compact .fig { width: 112px; height: 112px; flex: none; border-radius: 20px; overflow: hidden; background: #1a1a1d; position: relative; }
.card-compact .fig canvas { position: absolute; inset: 0; }
.card-compact.loading .fig { animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: 0.5; } }
.fig.mystery { display: grid; place-items: center; font: 400 54px/1 var(--serif); color: rgba(255, 255, 255, 0.35);
  background: radial-gradient(circle at 50% 40%, rgba(255, 62, 165, 0.25), #1a1a1d 70%); }
.fig.big { width: 100%; aspect-ratio: 1 / 0.82; border-radius: 22px; overflow: hidden; position: relative; background: #1a1a1d; margin-bottom: 14px; }
.fig.big canvas { position: absolute; inset: 0; }
.nick { font: 500 11.5px/1.2 var(--mono); color: var(--muted); margin-bottom: 4px; }
.hook { font: 400 23px/1.08 var(--serif); margin: 0; overflow-wrap: anywhere; }
.hook.big { font-size: 30px; }
.hook .fill { background: linear-gradient(transparent 62%, rgba(255, 62, 165, 0.45) 62%); }
.meta { font: 500 11px/1.2 var(--mono); color: var(--muted); margin-top: 8px; }
.text-link { display: block; margin: 12px auto 0; background: none; border: 0; color: var(--accent); font-size: 14px; cursor: pointer; }
.empty, .lead { font-size: 15px; color: var(--text); margin: 18px 0 4px; }
.fine { font-size: 12px; color: var(--muted); margin-top: 12px; }
.fine a { color: var(--accent); }
.done-label { font: 500 11px/1 var(--mono); letter-spacing: 0.08em; text-transform: uppercase; color: var(--accent); margin-bottom: 12px; }

/* steps */
.steps { display: flex; gap: 6px; margin-bottom: 14px; }
.steps span { width: 24px; height: 4px; border-radius: 2px; background: rgba(255, 255, 255, 0.15); }
.steps span.on { background: var(--accent); }
.building { padding: 12px; border-radius: 22px; background: rgba(255, 255, 255, 0.04); border: 1px solid var(--line); }
.building .fig { width: 84px; height: 84px; }
.building .hook { font-size: 20px; }
.q { display: block; font-size: 15px; font-weight: 600; color: var(--text); margin: 20px 0 10px; }
.field { display: flex; align-items: baseline; gap: 8px; padding: 12px 16px; border-radius: 18px; background: rgba(255, 255, 255, 0.06);
  border: 1.5px solid rgba(255, 255, 255, 0.12); }
.field:focus-within { border-color: var(--accent); }
.field .pre { font: 400 26px/1 var(--serif); color: var(--muted); }
.field input { flex: 1; min-width: 0; margin: 0; padding: 0; border: 0; background: none; color: var(--text); font: 400 26px/1.2 var(--serif); outline: none; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.chip { border: 0; border-radius: 999px; padding: 8px 12px; background: rgba(255, 255, 255, 0.08); color: var(--text); font-size: 13px; cursor: pointer; }
.hint { font-size: 13px; color: var(--muted); margin: 10px 0 0; }
#ts-widget { margin-top: 12px; }
.sheet .error { min-height: 1.2em; margin: 10px 0 0; }
.mine-links { display: flex; justify-content: center; gap: 22px; margin-top: 12px; }
.mine-links .text-link { margin: 0; }
.text-link.danger { color: var(--danger); }

/* the original card layout in the sheet */
.card-full .fig.big { aspect-ratio: 1 / 0.9; margin-bottom: 16px; }
.nick-pill { position: absolute; z-index: 2; top: 12px; right: 12px; background: #fff; color: #111; border-radius: 999px; padding: 6px 12px;
  font: 500 11px/1 var(--mono); }
.card-full .hook { margin: 0; }
.hook.h-xl { font-size: 32px; } .hook.h-l { font-size: 26px; } .hook.h-m { font-size: 21px; line-height: 1.12; } .hook.h-s { font-size: 17px; line-height: 1.18; }
.card-full .meta { margin-top: 10px; }
.card-full.loading .fig.big { animation: pulse 1.2s ease-in-out infinite; }
.skel { height: 22px; border-radius: 8px; background: rgba(255,255,255,0.07); margin-top: 6px; }
.skel.short { width: 45%; height: 12px; margin-top: 12px; }
@media (max-width: 759px) { .card-full .fig.big { aspect-ratio: 1 / 0.78; } }

/* the card's description: three words the person wrote */
.words { margin: 8px 0 0; font: 400 16px/1.3 var(--sans, system-ui, sans-serif); color: var(--text); opacity: 0.78; }
.building .words { font-size: 13px; margin-top: 4px; }
.q .opt { font-weight: 400; color: var(--muted); font-size: 0.8em; margin-left: 6px; }

/* map credit (OSM ODbL / OpenFreeMap terms require it): a bare translucent "i", tap shows the links */
.credit { display: flex; align-items: center; gap: 6px; margin: 0 8px 8px 0; font: 11px/1.3 system-ui, sans-serif; }
.credit-btn { width: 24px; height: 24px; border: 0; background: none; color: var(--text); opacity: 0.4; cursor: pointer;
  font: italic 600 15px/24px Georgia, serif; padding: 0; }
.credit-btn:hover, .credit.open .credit-btn { opacity: 0.8; }
.credit-text { display: none; color: var(--muted); }
.credit.open .credit-text { display: inline; }
.credit-text a { color: inherit; }

/* place step: the city name (from the server's list, never typed), locate button, public-consent tick */
.place-row { display: flex; gap: 8px; align-items: center; }
.place-name { flex: 1; min-height: 48px; display: flex; align-items: center; padding: 0 16px; border-radius: 14px;
  background: rgba(255,255,255,0.06); border: 1px solid var(--line); font-size: 17px; }
/* locate arrow on the map, like Google / Yandex Maps; phones: JS keeps it above the sheet or the CTA */
.locate-fab { position: fixed; right: 16px; bottom: 96px; z-index: 9; width: 44px; height: 44px; border-radius: 50%;
  display: grid; place-items: center; padding: 0; cursor: pointer; color: var(--accent);
  background: var(--sheet-bg); border: 1px solid var(--line); backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
  transition: bottom 0.35s cubic-bezier(.2,.8,.2,1); }
.locate-fab.busy svg { animation: pulse 1s ease-in-out infinite; }
@media (min-width: 760px) { .locate-fab { right: 24px; bottom: 44px !important; } }
.consent { display: flex; gap: 10px; align-items: center; margin-top: 12px; font-size: 14px; color: var(--text); cursor: pointer; }
.consent input { width: 18px; height: 18px; accent-color: var(--accent); flex: none; }
.cta:disabled { opacity: 0.4; cursor: default; }

/* ---------- v2 (radio.garden-style) ---------- */
.ring, .me-pin, .rail { display: none; }
body.v2 .locate-fab { display: none; }
body.v2 .ring { display: block; position: fixed; z-index: 5; left: var(--ring-x, 50%); top: var(--ring-y, 50%); width: 64px; height: 64px;
  margin: -32px 0 0 -32px; pointer-events: none;
  transition: transform 0.2s; } /* position follows the map each frame (syncRing), no CSS lag */
.ring svg { width: 100%; height: 100%; overflow: visible; }
.ring circle { fill: none; stroke: rgba(255, 255, 255, 0.28); stroke-width: 2; transition: stroke 0.2s; }
/* moving: 6 long dashes; picked: solid and brighter */
body.v2 .ring.moving circle { stroke-dasharray: 20 11.9; stroke: rgba(255, 255, 255, 0.45); }
body.v2 .ring.hit circle { stroke: rgba(255, 255, 255, 0.6); }
body.v2 .ring.hit { transform: scale(1.08); }
body.v2.placing .ring { display: none; }
/* the "me" balloon: its tip (the dot) marks the exact pin point = the ring centre */
body.v2.placing .me-pin { display: block; position: fixed; z-index: 6; left: var(--ring-x, 50%); top: var(--ring-y, 50%); width: 0; height: 0; pointer-events: none;
}
.me-pin span { position: absolute; left: -24px; top: -64px; width: 48px; height: 48px; border-radius: 50%; display: grid; place-items: center;
  background: #1b1d22; color: #fff; font: 600 15px/1 var(--mono); box-shadow: 0 6px 18px rgba(0,0,0,0.45); }
.me-pin span::after { content: ""; position: absolute; left: 50%; bottom: -7px; margin-left: -7px; border: 7px solid transparent; border-bottom: 0; border-top-color: #1b1d22; }
.me-pin::after { content: ""; position: absolute; left: -5px; top: -5px; width: 10px; height: 10px; border-radius: 50%; background: #fff; border: 2px solid #1b1d22; }
body.v2.placing #map canvas { cursor: grab; }
/* one rail of round buttons on the right, same style for all (pin, locate, zoom) */
body.v2 .rail { display: flex; flex-direction: column; gap: 8px; position: fixed; z-index: 9; right: 16px; bottom: 96px;
  transition: bottom 0.35s cubic-bezier(.2,.8,.2,1); }
.rail-btn { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; padding: 0; cursor: pointer;
  color: var(--text); background: var(--sheet-bg); border: 1px solid var(--line); backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
  font: 400 22px/1 system-ui, sans-serif; }
#rail-locate { color: var(--accent); }
.rail-pair { display: flex; flex-direction: column; border-radius: 22px; overflow: hidden; border: 1px solid var(--line); }
.rail-pair .rail-btn { border: 0; border-radius: 0; }
.rail-pair .rail-btn + .rail-btn { border-top: 1px solid var(--line); }
.rail-btn.busy svg { animation: pulse 1s ease-in-out infinite; }
@media (min-width: 760px) {
  body.v2 .rail { right: 24px; bottom: 44px !important; }
  /* card panel bottom-left, like radio.garden */
  body.v2 .sheet { left: 24px; right: auto; top: auto; bottom: 24px; transform: translateX(calc(-100% - 90px)); }
  body.v2 .sheet.open { transform: translateX(0); }
  body.v2 .sheet-close { left: auto; right: -46px; }
}


/* card actions, Twitter-like: ‹ › left, Read story middle, share right */
.view-card .actions .ghost.round { font-size: 22px; }
.view-card .actions .grow { flex: 1; }
/* the story: 3 lines on the card, all of it when reading (the panel grows, the figure shrinks) */
.story { margin: 10px 0 0; font: 400 15px/1.45 system-ui, sans-serif; color: var(--text); opacity: 0.86; white-space: pre-line;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.sheet.reading .story { display: block; -webkit-line-clamp: unset; overflow: visible; }
.sheet.reading .card-full .fig.big { aspect-ratio: 2.2 / 1; }
.sheet.reading { max-height: calc(100vh - 16px); }
/* desktop reading: anchored to the bottom, grows with its content, stops below the header */
@media (min-width: 760px) { body.v2 .sheet.reading #sheet-body { max-height: calc(100vh - 120px); } }
.story-input { width: 100%; box-sizing: border-box; resize: vertical; min-height: 150px; padding: 14px 16px; border-radius: 14px;
  background: rgba(255,255,255,0.06); border: 1px solid var(--line); color: var(--text); font: 400 16px/1.45 system-ui, sans-serif; }
.story-input:focus { outline: none; border-color: var(--accent); }
@media (max-width: 759px) { body.reading .rail, body.reading .ring { display: none !important; } }
.text-link.quiet { color: var(--muted); opacity: 0.7; }

/* card row: ‹ Share › */
.share-btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
/* "Read more" sits right under the clamped story */
.text-link.more { display: inline-block; margin-top: 6px; padding: 0; color: var(--accent); font-size: 14px; }

/* header: quiet sign-in for returning people, next to the counter */
.top-right { display: flex; align-items: center; gap: 14px; }
.signin-link { font: 500 12px/1 var(--mono); color: var(--text); text-decoration: none; padding: 7px 12px; border-radius: 999px;
  border: 1px solid var(--line); background: rgba(255,255,255,0.04); }
.signin-link:hover { border-color: rgba(255,255,255,0.3); }
.signin-link { pointer-events: auto; } /* the header itself lets clicks through to the map */
.signin-link[hidden] { display: none; }
