:root {
  --brick: #A63A2B; --brick-dk: #7E2B20; --mustard: #E3A72F; --celery: #9BB55A;
  --river: #2E6F8E; --cream: #F4EBDD; --ink: #2A1D17; --muted: #5E4D42; --line: #D9CCB8;
  --head: 'Barlow Condensed', 'Arial Narrow', sans-serif;
  --body: 'Barlow', system-ui, sans-serif;
  --script: 'Yellowtail', cursive;
  --tabs-h: 64px;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--cream); color: var(--ink); font-family: var(--body); font-size: 16px; }
body { padding-bottom: calc(var(--tabs-h) + env(safe-area-inset-bottom)); }
a { color: var(--river); }
img { max-width: 100%; display: block; }
button { font: inherit; cursor: pointer; }
:focus-visible { outline: 3px solid var(--river); outline-offset: 2px; }

/* Top bar */
.top { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between;
  gap: 12px; padding: 10px 16px; padding-top: calc(10px + env(safe-area-inset-top)); background: var(--cream); border-bottom: 2px solid var(--ink); }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); }
.brand img { border-radius: 8px; }
.brand-text { display: flex; flex-direction: column; line-height: 1; }
.brand-small { font-family: var(--head); font-weight: 700; font-size: 11px; letter-spacing: 3px; color: var(--brick); }
.brand-big { font-family: var(--head); font-weight: 800; font-size: 22px; }
.lang-btn { min-height: 44px; padding: 0 14px; border-radius: 22px; border: 2px solid var(--ink); background: transparent; color: var(--ink); font-weight: 700; }

/* Bottom tabs */
.tabs { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr));
  height: calc(var(--tabs-h) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom);
  background: var(--cream); border-top: 2px solid var(--ink); }
.tabs a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  text-decoration: none; color: var(--ink); font-size: 12px; font-weight: 600; min-height: 44px; }
.tabs svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.tabs a[aria-current="page"] { color: var(--brick); font-weight: 800; }

main { max-width: 640px; margin: 0 auto; outline: none; }
.pad { padding: 20px 16px; }
h1, h2, h3 { font-family: var(--head); font-weight: 800; margin: 0; line-height: 1; }
h1 { font-size: 40px; } h2 { font-size: 28px; } h3 { font-size: 22px; }
.kicker { font-family: var(--head); font-weight: 700; font-size: 13px; letter-spacing: 4px; color: var(--brick); margin: 0 0 8px; }
.muted { color: var(--muted); }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 52px; padding: 0 22px;
  border-radius: 26px; border: 2px solid var(--ink); background: var(--mustard); color: var(--ink); font-weight: 700; font-size: 17px; text-decoration: none; }
.btn.secondary { background: transparent; }
.btn.dark { background: var(--ink); color: var(--cream); }
.btn.block { width: 100%; }
.btn[disabled] { opacity: .45; cursor: not-allowed; }
.row { display: flex; gap: 10px; flex-wrap: wrap; }

/* Hero */
.hero { background: var(--brick); color: var(--cream); padding: 28px 16px 32px; position: relative; overflow: hidden; }
.hero .kicker { color: var(--mustard); }
.hero-top { display: flex; align-items: center; gap: 14px; margin-bottom: 14px; }
.hero-top .badge-logo { flex-shrink: 0; }
.hero-top .kicker { margin: 0; line-height: 1.6; }
.hero h1 { font-size: clamp(56px, 17vw, 96px); line-height: .86; color: var(--cream); }
.hero .script { font-family: var(--script); font-size: clamp(48px, 13vw, 72px); color: var(--mustard); display: inline-block; transform: rotate(-6deg); margin: 4px 0 8px 30%; }
.hero p { font-size: 18px; line-height: 1.45; margin: 8px 0 20px; max-width: 34ch; }
.hero .btn.secondary { border-color: var(--cream); color: var(--cream); }
.waves { display: block; width: 100%; height: 28px; }

/* Steps */
.steps { list-style: none; margin: 16px 0 0; padding: 0; display: flex; flex-direction: column; gap: 14px; }
.steps li { display: flex; gap: 14px; align-items: flex-start; font-size: 17px; line-height: 1.4; }
.steps .num { flex-shrink: 0; width: 40px; height: 40px; border-radius: 20px; background: var(--mustard); display: flex; align-items: center; justify-content: center; font-family: var(--head); font-weight: 800; font-size: 22px; }

/* Cards / lists */
.card { background: #fff; border: 2px solid var(--ink); border-radius: 16px; overflow: hidden; }
.card .body { padding: 14px 16px; display: flex; flex-direction: column; gap: 6px; }
.list { display: flex; flex-direction: column; gap: 12px; margin-top: 14px; }
.spot-row { display: flex; gap: 12px; align-items: center; padding: 10px; background: #fff; border: 2px solid var(--ink); border-radius: 14px; text-decoration: none; color: var(--ink); }
.spot-row .thumb { width: 64px; height: 64px; border-radius: 10px; flex-shrink: 0; overflow: hidden; }
.spot-row .info { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.spot-row .name { font-weight: 700; font-size: 17px; }
.badge { display: inline-block; font-size: 12px; font-weight: 700; padding: 2px 8px; border-radius: 10px; background: var(--cream); border: 1px solid var(--muted); color: var(--ink); }
.badge.warn { background: #FFF3D6; border-color: #A87710; color: #5C4106; }
.badge.ok { background: var(--celery); border-color: var(--ink); }

/* Photo tile with fallback */
.photo { position: relative; aspect-ratio: 1 / 1; background: var(--brick); color: var(--cream); display: flex; align-items: center; justify-content: center; overflow: hidden; }
.photo img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; z-index: 1; }
.photo { container-type: inline-size; }
.photo .fallback { font-family: var(--head); font-weight: 800; font-size: clamp(8px, 12cqi, 22px); letter-spacing: 0.08em; line-height: 1.05; text-align: center; padding: 6px; max-width: 100%; overflow-wrap: anywhere; }
.photo.c-food { background: var(--brick); } .photo.c-drinks { background: var(--river); } .photo.c-bakery { background: var(--mustard); color: var(--ink); }
.photo.c-art { background: var(--celery); color: var(--ink); } .photo.c-park { background: var(--ink); } .photo.c-music { background: var(--brick-dk); } .photo.c-library { background: var(--river); }

/* Chips */
.chips { display: flex; gap: 8px; overflow-x: auto; padding: 4px 0 8px; margin-top: 12px; }
.chip { flex-shrink: 0; min-height: 44px; padding: 0 16px; border-radius: 22px; border: 2px solid var(--ink); background: transparent; color: var(--ink); font-weight: 600; }
.chip[aria-pressed="true"] { background: var(--ink); color: var(--cream); }

/* Map embed */
.map-frame { width: 100%; aspect-ratio: 4 / 3; border: 2px solid var(--ink); border-radius: 16px; margin-top: 12px; background: #e6dccb; }

/* Quiz */
.quiz-q { font-family: var(--head); font-weight: 800; font-size: 32px; line-height: 1.05; margin: 12px 0 18px; }
.options { display: flex; flex-direction: column; gap: 10px; }
.option { min-height: 56px; text-align: left; padding: 12px 18px; border-radius: 14px; border: 2px solid var(--ink); background: #fff; color: var(--ink); font-size: 17px; font-weight: 600; }
.option:hover { background: #FFF3D6; }
.progress { height: 10px; border-radius: 5px; background: var(--line); overflow: hidden; }
.progress > div { height: 100%; background: var(--mustard); }

/* Check-in keypad */
.checkin { background: var(--ink); color: var(--cream); min-height: calc(100vh - 140px); padding: 24px 16px; display: flex; flex-direction: column; gap: 16px; }
.checkin h1 { color: var(--cream); font-size: 36px; }
.code-display { display: flex; gap: 10px; justify-content: center; margin: 8px 0; }
.code-display span { width: 54px; height: 64px; border-radius: 12px; border: 2px solid var(--cream); display: flex; align-items: center; justify-content: center; font-family: var(--head); font-size: 36px; font-weight: 800; }
.keypad { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; max-width: 320px; margin: 0 auto; width: 100%; }
.keypad button { min-height: 60px; border-radius: 14px; border: 2px solid var(--cream); background: transparent; color: var(--cream); font-family: var(--head); font-size: 28px; font-weight: 700; }
.msg { min-height: 24px; text-align: center; font-weight: 600; color: var(--mustard); }
.stamped { text-align: center; padding: 30px 16px; }
.stamped .script { font-family: var(--script); font-size: 64px; color: var(--brick); }

/* Passport */
.pp-card { background: var(--brick); color: var(--cream); border-radius: 18px; padding: 18px; display: flex; flex-direction: column; gap: 10px; margin-top: 14px; }
.pp-card .big { font-family: var(--head); font-weight: 800; font-size: 44px; line-height: 1; }
.pp-card .progress { background: var(--brick-dk); }
.stamp-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; margin-top: 16px; }
.stamp { display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; text-decoration: none; color: var(--ink); font-size: 12px; font-weight: 600; line-height: 1.25; }
.stamp .disc { width: 76px; height: 76px; border-radius: 50%; display: flex; align-items: center; justify-content: center; border: 2.5px dashed var(--muted); }
.stamp.got .disc { border: 3px solid var(--ink); }
.stamp .disc svg { width: 34px; height: 34px; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; opacity: .55; }
.stamp .ink { width: 84px; height: 84px; display: block; margin: -4px 0; }
.pp-top { display: flex; align-items: center; gap: 14px; }
.pp-top .badge-logo { flex-shrink: 0; }
.stamp-drop { display: flex; justify-content: center; }
.ink-big { width: min(240px, 66vw); height: auto; transform: rotate(-6deg); animation: stamp-in .45s cubic-bezier(.2, .9, .3, 1.2) both; }
@keyframes stamp-in { from { transform: rotate(-6deg) scale(1.5); opacity: 0; } to { transform: rotate(-6deg) scale(1); opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .ink-big { animation: none; } }

/* Rewards (demo placeholders) */
.rewards { display: flex; flex-direction: column; gap: 10px; margin-top: 6px; }
.rewards h2 { margin: 0; font-size: 20px; }
.reward { border: 2px dashed var(--cream); border-radius: 14px; padding: 12px; display: flex; flex-direction: column; gap: 6px; opacity: .85; }
.reward.open { border-style: solid; background: var(--cream); color: var(--ink); opacity: 1; }
.reward p { margin: 0; font-size: 14px; }
.reward .r-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.reward .r-state { font-size: 13px; font-weight: 700; }
.reward .r-code { font-family: var(--head); font-size: 28px; font-weight: 800; letter-spacing: .08em; text-align: center; border: 2px dashed var(--brick); border-radius: 10px; padding: 8px; color: var(--brick); }
.reward .r-note { font-size: 12px; color: #5E4D42; }
.stamped .reward { margin: 16px auto 0; max-width: 340px; text-align: left; }

/* Feed */
.feed { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-top: 14px; }
a.post { text-decoration: none; color: var(--ink); }
.spot-hero .photo { aspect-ratio: 16 / 10; }
.spot-hero { position: relative; }
.logo-badge { position: absolute; left: 12px; bottom: 12px; z-index: 2; display: flex; background: var(--cream); border: 2px solid var(--ink); border-radius: 10px; padding: 6px 8px; }
.logo-badge img { height: 40px; width: auto; max-width: 140px; object-fit: contain; }
.credit { margin: 0; font-size: 12px; color: var(--muted); }
.post { background: #fff; border: 2px solid var(--ink); border-radius: 14px; overflow: hidden; }
.post .meta { padding: 8px 10px; display: flex; flex-direction: column; gap: 4px; font-size: 13px; }
.post .report { align-self: flex-start; min-height: 36px; padding: 0 10px; border-radius: 18px; border: 1.5px solid var(--muted); background: transparent; color: var(--ink); font-size: 12px; font-weight: 600; }

/* Events */
.event { display: flex; gap: 14px; padding: 14px; background: #fff; border: 2px solid var(--ink); border-radius: 14px; }
.event .when { flex-shrink: 0; width: 64px; text-align: center; font-family: var(--head); font-weight: 800; color: var(--brick); font-size: 15px; line-height: 1.1; }

.footer { padding: 24px 16px 32px; font-size: 14px; color: var(--muted); }
.hidden { display: none !important; }

/* Build the Gateway */
.gw h2 { margin: 28px 0 10px; }
.gw .lead { font-size: 17px; line-height: 1.45; margin: 10px 0 0; }
.gw .concept { font-size: 13px; color: var(--muted); margin: 8px 0 0; line-height: 1.4; }
.ba { position: relative; aspect-ratio: 16 / 9; border-radius: 16px; overflow: hidden; border: 2px solid var(--ink); background: var(--line); touch-action: pan-y; }
.ba img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.ba .ba-after { clip-path: inset(0 0 0 var(--pos)); }
.ba-line { position: absolute; top: 0; bottom: 0; left: var(--pos); width: 3px; margin-left: -1.5px; background: var(--cream); pointer-events: none; }
.ba-knob { position: absolute; top: 50%; left: 50%; width: 40px; height: 40px; margin: -20px 0 0 -20px; border-radius: 50%; background: var(--cream); border: 3px solid var(--ink); }
.ba-knob::before { content: '\2039\00a0\203A'; position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 20px; color: var(--ink); }
.ba-range { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: ew-resize; }
.ba:focus-within { outline: 3px solid var(--river); outline-offset: 2px; }
.ba-tag { position: absolute; top: 10px; font-family: var(--head); font-weight: 800; font-size: 13px; letter-spacing: 2px; text-transform: uppercase; background: var(--ink); color: var(--cream); padding: 3px 8px; border-radius: 6px; pointer-events: none; }
.ba-tag.l { left: 10px; } .ba-tag.r { right: 10px; background: var(--brick); }
.ba-pair { margin: 18px 0 0; }
.ba-pair figcaption { font-family: var(--head); font-size: 20px; margin-bottom: 8px; }
.ba-pair .credit { margin: 6px 0 0; }
.ba-changes { margin: 8px 0 0; padding-left: 20px; line-height: 1.45; }
.gw-meter { background: #fff8ec; border: 2px solid var(--ink); border-radius: 18px; padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.gw-meter .arch { width: 100%; max-width: 360px; margin: 0 auto; display: block; }
.gw-num { font-family: var(--head); font-weight: 700; font-size: 20px; }
.gw-num .big { font-size: 40px; font-weight: 800; color: var(--brick); }
.gw-mine { margin: 0; font-weight: 600; }
.gw-stages { list-style: none; margin: 4px 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.gw-stages li { display: flex; gap: 10px; align-items: center; color: var(--muted); }
.gw-stages .pct { flex-shrink: 0; width: 52px; text-align: center; font-family: var(--head); font-weight: 800; border: 2px dashed var(--muted); border-radius: 8px; padding: 2px 0; }
.gw-stages li.done { color: var(--ink); font-weight: 600; }
.gw-stages li.done .pct { border-style: solid; border-color: var(--ink); background: var(--celery); }
.gw-card { display: flex; gap: 14px; align-items: center; text-decoration: none; color: var(--ink); background: #fff8ec; border: 2px solid var(--ink); border-radius: 18px; padding: 12px 14px; }
.gw-mini { width: 96px; flex-shrink: 0; }
.gw-mini .arch { width: 100%; display: block; }
.gw-card-text { display: flex; flex-direction: column; gap: 4px; }
.gw-card-text .kicker { margin: 0; }
.gw-card strong { font-family: var(--head); font-size: 24px; font-weight: 800; line-height: 1; }
.gw-card span { font-size: 14px; color: var(--muted); }
.brick-note { margin: 6px 0 0; font-weight: 700; }
.brick-note a { color: var(--brick); }

.vote { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
.vote-opt { position: relative; overflow: hidden; display: flex; justify-content: space-between; align-items: center; gap: 10px; min-height: 52px; padding: 10px 12px; border: 2px solid var(--ink); border-radius: 12px; background: #fff8ec; color: var(--ink); text-align: left; }
.vote-opt.on { border-color: var(--brick); border-width: 3px; }
.vote-bar { position: absolute; left: 0; top: 0; bottom: 0; background: #F1D9A0; z-index: 0; }
.vote-opt.on .vote-bar { background: #E9B9AE; }
.vote-label, .vote-n { position: relative; z-index: 1; }
.vote-label { font-weight: 600; }
.vote-n { flex-shrink: 0; font-family: var(--head); font-weight: 700; font-size: 15px; }
.future-stop { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; padding: 12px; border: 2px dashed var(--muted); border-radius: 12px; }
