/* StampQuest 2 — a quiet travel journal in the Namela palette.
   Forest green and gold on stone paper; deep green-charcoal paper in dark mode.
   Every colour comes from the tokens below, so a palette change is one edit. */

@font-face { font-family: "Geist"; src: url("fonts/Geist-Variable.woff2") format("woff2"); font-weight: 100 900; font-display: swap; }
@font-face { font-family: "Geist Mono"; src: url("fonts/GeistMono-Variable.woff2") format("woff2"); font-weight: 100 900; font-display: swap; }

:root {
  color-scheme: light;
  --bg: #F2F1EC;
  --paper: #F8F7F2;
  --surface: #FFFFFF;
  --sunk: #E9E8E1;
  --ink: #17241B;
  --ink-2: #33433A;
  --muted: #5B675F;
  --line: #DCDBD2;
  --line-2: #C9C8BC;
  --primary: #2F4231;
  --primary-hover: #243427;
  --on-primary: #FFFFFF;
  --tonal: #E3E9DF;
  --tonal-ink: #22352A;
  --gold: #E2B045;
  --gold-soft: #F5E8C6;
  --gold-ink: #7A5A10;
  --accent: #C56B26;
  --accent-ink: #9A4F15;
  --danger: #A3382A;
  --danger-soft: #F6E2DD;
  --focus-ring: #C56B26;
  --pattern: rgba(47, 66, 49, .06);
  --shadow-sm: 0 1px 2px rgba(23, 36, 27, .06), 0 2px 8px rgba(23, 36, 27, .05);
  --shadow: 0 1px 2px rgba(23, 36, 27, .07), 0 8px 24px rgba(23, 36, 27, .08);
  --shadow-lg: 0 18px 50px rgba(23, 36, 27, .18);
  --stamp-shadow: drop-shadow(0 1px 1px rgba(23, 36, 27, .18)) drop-shadow(0 8px 14px rgba(23, 36, 27, .14));
  --radius: 16px;
  --radius-sm: 10px;
  --sans: "Geist", "Helvetica Neue", Arial, sans-serif;
  --mono: "Geist Mono", ui-monospace, Menlo, monospace;
  --serif: Georgia, "Times New Roman", serif;
  --nav-h: 68px;
  box-sizing: border-box;
  padding-top: env(safe-area-inset-top, 0px);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #111713; --paper: #161E18; --surface: #1C251F; --sunk: #0D120F;
    --ink: #EDEDE4; --ink-2: #CDD2C6; --muted: #9EA79A; --line: #2B372E; --line-2: #3A483D;
    --primary: #E2B045; --primary-hover: #EDC165; --on-primary: #1A1608;
    --tonal: #243127; --tonal-ink: #E4ECDC;
    --gold: #E8BD5E; --gold-soft: #2E2814; --gold-ink: #EDC979;
    --accent: #E28A4A; --accent-ink: #F0A66E; --danger: #F08A78; --danger-soft: #3A1E19;
    --focus-ring: #E8BD5E; --pattern: rgba(232, 189, 94, .05);
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4); --shadow: 0 2px 4px rgba(0, 0, 0, .35), 0 10px 28px rgba(0, 0, 0, .35);
    --shadow-lg: 0 18px 50px rgba(0, 0, 0, .55);
    --stamp-shadow: drop-shadow(0 1px 1px rgba(0, 0, 0, .5)) drop-shadow(0 10px 18px rgba(0, 0, 0, .45));
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #111713; --paper: #161E18; --surface: #1C251F; --sunk: #0D120F;
  --ink: #EDEDE4; --ink-2: #CDD2C6; --muted: #9EA79A; --line: #2B372E; --line-2: #3A483D;
  --primary: #E2B045; --primary-hover: #EDC165; --on-primary: #1A1608;
  --tonal: #243127; --tonal-ink: #E4ECDC;
  --gold: #E8BD5E; --gold-soft: #2E2814; --gold-ink: #EDC979;
  --accent: #E28A4A; --accent-ink: #F0A66E; --danger: #F08A78; --danger-soft: #3A1E19;
  --focus-ring: #E8BD5E; --pattern: rgba(232, 189, 94, .05);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4); --shadow: 0 2px 4px rgba(0, 0, 0, .35), 0 10px 28px rgba(0, 0, 0, .35);
  --shadow-lg: 0 18px 50px rgba(0, 0, 0, .55);
  --stamp-shadow: drop-shadow(0 1px 1px rgba(0, 0, 0, .5)) drop-shadow(0 10px 18px rgba(0, 0, 0, .45));
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; height: 100%; scroll-padding-top: env(safe-area-inset-top, 0px); }
body {
  margin: 0; overflow-x: clip; min-height: 100%; font-family: var(--sans); font-size: 16px; line-height: 1.5; color: var(--ink);
  background: var(--bg); -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
body.no-scroll { overflow: hidden; }
img, canvas { max-width: 100%; display: block; }
h1, h2, h3, h4 { margin: 0 0 .35em; line-height: 1.12; letter-spacing: -.015em; }
h1 { font-weight: 750; font-size: clamp(1.75rem, 4.6vw, 2.5rem); letter-spacing: -.03em; }
.h2 { font-size: 1.3rem; font-weight: 700; }
.h3 { font-size: 1.06rem; font-weight: 650; display: flex; align-items: center; gap: 8px; letter-spacing: -.01em; }
.h4 { font-size: .95rem; font-weight: 650; display: flex; align-items: center; gap: 6px; margin-top: 18px; }
p { margin: 0 0 .7em; }
a { color: var(--primary); text-underline-offset: 3px; }
.display { font-size: clamp(2.4rem, 7.5vw, 4.2rem); font-weight: 800; letter-spacing: -.045em; line-height: .98; margin-bottom: .3em; }
.lede { font-size: 1.08rem; color: var(--ink-2); max-width: 46ch; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.hint { font-size: .84rem; color: var(--muted); margin: 4px 0 0; }
.block { display: block; }
.center { text-align: center; }
.strong { font-weight: 650; margin: 0; }
.fine { font-size: .82rem; color: var(--muted); display: flex; gap: 6px; align-items: center; margin-top: 14px; }
.fine.center { justify-content: center; }
.mt { margin-top: 18px; }
.pre { white-space: pre-wrap; }
.serif-quote { font-family: var(--serif); font-style: italic; font-size: 1.08rem; color: var(--ink-2); }
.sr-only { position: absolute !important; width: 1px !important; height: 1px !important; min-height: 0 !important; padding: 0 !important; margin: -1px !important; overflow: hidden !important; clip: rect(0 0 0 0) !important; white-space: nowrap !important; border: 0 !important; }
:focus-visible { outline: 3px solid var(--focus-ring); outline-offset: 2px; border-radius: 6px; }
main:focus, h1:focus { outline: none; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--ink); color: var(--bg); padding: .6rem 1rem; border-radius: 8px; z-index: 200; }
.skip:focus { left: 8px; }
.icon { flex: none; }

/* ---------- layout ---------- */
.app { min-height: 100vh; }
main { padding-bottom: calc(var(--nav-h) + 28px + env(safe-area-inset-bottom, 0px)); }
.app-bare main { padding-bottom: 32px; }
.page { max-width: 1120px; margin: 0 auto; padding: 22px 18px 24px; display: flex; flex-direction: column; gap: 18px; }
.page-narrow { max-width: 720px; }
.page-head { display: flex; align-items: flex-start; gap: 10px; }
.page-head .icon-btn { margin-top: 4px; }
.page-head-text { flex: 1; min-width: 0; }
.page-head-text h1 { margin: 0; overflow-wrap: anywhere; }
.page-sub { margin: 4px 0 0; }
.page-head-actions { display: flex; gap: 8px; align-items: center; }
.row-between { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.row-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-top: 10px; }
.grid-2 { display: grid; grid-template-columns: 1fr; gap: 0 14px; }
@media (min-width: 560px) { .grid-2 { grid-template-columns: 1fr 1fr; } }
.boot { min-height: 70vh; display: grid; place-items: center; }

/* ---------- navigation ---------- */
.nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
  height: calc(var(--nav-h) + env(safe-area-inset-bottom, 0px)); padding-bottom: env(safe-area-inset-bottom, 0px);
  display: flex; justify-content: space-around; align-items: center;
  background: color-mix(in srgb, var(--paper) 94%, transparent); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid var(--line);
}
.nav-brand { display: none; }
.nav-item { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px; text-decoration: none; color: var(--muted); font-size: .7rem; font-weight: 600; padding: 6px 0; min-height: 52px; justify-content: center; }
.nav-item.active { color: var(--ink); }
.nav-icon { display: grid; place-items: center; width: 52px; height: 30px; border-radius: 15px; transition: background .2s; }
.nav-item.active .nav-icon { background: var(--tonal); color: var(--tonal-ink); }
.nav-create .nav-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.nav-create .nav-icon { width: 58px; height: 58px; border-radius: 18px; background: var(--primary) !important; color: var(--on-primary) !important; margin-top: -30px; box-shadow: var(--shadow-lg); border: 4px solid var(--bg); transform: rotate(-4deg); }
.brand-mark {
  width: 22px; height: 26px; display: inline-block; flex: none; border-radius: 2px; background: var(--gold);
  -webkit-mask: radial-gradient(circle 3px at 50% 0, #0000 98%, #000) top/6px 51% repeat-x, radial-gradient(circle 3px at 50% 100%, #0000 98%, #000) bottom/6px 51% repeat-x;
  mask: radial-gradient(circle 3px at 50% 0, #0000 98%, #000) top/6px 51% repeat-x, radial-gradient(circle 3px at 50% 100%, #0000 98%, #000) bottom/6px 51% repeat-x;
  box-shadow: inset 0 0 0 4px var(--gold), inset 0 0 0 10px var(--primary);
}
@media (min-width: 900px) {
  .app:not(.app-bare) { display: grid; grid-template-columns: 236px 1fr; }
  main { padding-bottom: 48px; }
  .nav { position: sticky; top: 0; height: 100vh; flex-direction: column; justify-content: flex-start; align-items: stretch; gap: 2px; padding: 24px 14px; border-top: 0; border-right: 1px solid var(--line); background: var(--paper); }
  .nav-brand { display: flex; order: -2; align-items: center; gap: 10px; font-weight: 800; font-size: 1.25rem; letter-spacing: -.03em; padding: 4px 10px 24px; color: var(--ink); text-decoration: none; }
  .nav-item { flex: 0; flex-direction: row; justify-content: flex-start; gap: 12px; font-size: .95rem; padding: 6px 8px; border-radius: 12px; min-height: 46px; }
  .nav-item:hover { background: var(--sunk); color: var(--ink); }
  .nav-icon { width: 36px; height: 34px; border-radius: 10px; }
  .nav-create { order: -1; margin-bottom: 16px; background: var(--primary); color: var(--on-primary) !important; }
  .nav-create:hover { background: var(--primary-hover) !important; }
  .nav-create .nav-label { position: static; width: auto; height: auto; overflow: visible; clip: auto; }
  .nav-create .nav-icon { margin: 0; width: 34px; height: 34px; border: 0; box-shadow: none; background: transparent !important; transform: none; border-radius: 0; }
  .hide-mobile { display: inline-flex !important; }
}
.hide-mobile { display: none !important; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 0 20px;
  border-radius: 14px; border: 1.5px solid transparent; font: 600 .98rem/1 var(--sans); letter-spacing: -.005em;
  cursor: pointer; text-decoration: none; transition: background .15s, transform .1s, box-shadow .15s; white-space: nowrap;
}
.btn:active { transform: translateY(1px); }
.btn[disabled], .btn.disabled { opacity: .5; cursor: not-allowed; pointer-events: none; }
.btn-primary { background: var(--primary); color: var(--on-primary) !important; box-shadow: var(--shadow-sm); }
.btn-primary:hover { background: var(--primary-hover); }
.btn-secondary { background: var(--tonal); color: var(--tonal-ink) !important; }
.btn-secondary:hover { background: color-mix(in srgb, var(--tonal) 80%, var(--ink) 8%); }
.btn-ghost { background: transparent; color: var(--ink) !important; border-color: var(--line-2); }
.btn-ghost:hover { background: var(--sunk); }
.btn-danger { background: var(--danger); color: #fff !important; }
:root[data-theme="dark"] .btn-danger { color: #1a0d0a !important; }
.btn-sm { min-height: 40px; padding: 0 14px; font-size: .9rem; border-radius: 12px; }
.btn-lg { min-height: 56px; padding: 0 26px; font-size: 1.04rem; border-radius: 16px; }
.btn.wide { width: 100%; }
.icon-btn { display: inline-grid; place-items: center; width: 44px; height: 44px; border-radius: 12px; border: 0; background: transparent; color: var(--ink); cursor: pointer; flex: none; text-decoration: none; }
.icon-btn:hover { background: var(--sunk); }
.text-link { background: none; border: 0; padding: 6px 0; font: 600 .95rem var(--sans); color: var(--primary); cursor: pointer; text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; }
.text-link.small { font-size: .85rem; }
.danger-text { color: var(--danger) !important; }
.spinner { width: 18px; height: 18px; border-radius: 50%; border: 2.5px solid currentColor; border-right-color: transparent; animation: spin .7s linear infinite; flex: none; }
@keyframes spin { to { transform: rotate(360deg); } }
.loading { display: flex; align-items: center; gap: 10px; color: var(--muted); padding: 10px 0; font-size: .92rem; }
.chip { position: relative; display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 0 14px; border-radius: 999px; border: 1.5px solid var(--line-2); background: var(--surface); color: var(--ink); font: 550 .9rem var(--sans); cursor: pointer; }
.chip.on { background: var(--primary); color: var(--on-primary); border-color: var(--primary); }
.chip:has(input:focus-visible) { outline: 3px solid var(--focus-ring); outline-offset: 2px; }

/* ---------- form controls ---------- */
.field { display: flex; flex-direction: column; gap: 6px; margin-top: 14px; }
.field > label, .field .label { font-weight: 600; font-size: .9rem; }
input:not([type=checkbox]):not([type=radio]):not([type=range]), select, textarea {
  width: 100%; min-height: 48px; padding: 11px 14px; border-radius: 12px; border: 1.5px solid var(--line-2);
  background: var(--surface); color: var(--ink); font: 400 1rem var(--sans);
}
textarea { resize: vertical; line-height: 1.45; }
input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 3px solid var(--focus-ring); outline-offset: 1px; border-color: transparent; }
.has-error input { border-color: var(--danger); }
.field-error { color: var(--danger); font-size: .85rem; margin: 0; }
.search-field { position: relative; display: flex; align-items: center; flex: 1; min-width: 200px; }
.search-field .icon { position: absolute; left: 14px; color: var(--muted); pointer-events: none; }
.search-field input { padding-left: 42px !important; }
.segmented { display: flex; background: var(--sunk); border-radius: 14px; padding: 4px; gap: 4px; }
.segmented label { flex: 1; position: relative; display: grid; place-items: center; min-height: 42px; padding: 0 10px; border-radius: 11px; font-weight: 600; font-size: .9rem; color: var(--muted); cursor: pointer; text-align: center; line-height: 1.15; }
.segmented label.on { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-sm); }
.segmented input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }
.segmented label:has(input:focus-visible) { outline: 3px solid var(--focus-ring); outline-offset: 1px; }
.toggle-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 12px 0; border-top: 1px solid var(--line); }
.toggle-row:first-child { border-top: 0; }
.toggle-text { display: flex; flex-direction: column; gap: 2px; cursor: pointer; font-weight: 550; }
.switch { appearance: none; -webkit-appearance: none; width: 50px; height: 30px; border-radius: 15px; background: var(--line-2); position: relative; cursor: pointer; flex: none; transition: background .2s; margin: 0; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.25); transition: transform .2s; }
.switch:checked { background: var(--primary); }
.switch:checked::after { transform: translateX(20px); }
.inline-check { display: inline-flex; gap: 8px; align-items: center; font-size: .9rem; margin-top: 8px; }
.inline-check input, .check-row input { width: 20px; height: 20px; accent-color: var(--primary); }
fieldset { border: 0; padding: 0; margin: 14px 0 0; min-width: 0; min-inline-size: 0; }
legend { font-weight: 600; font-size: .9rem; margin-bottom: 8px; padding: 0; }
.kinds { display: flex; flex-wrap: wrap; gap: 8px; }
.kinds legend { width: 100%; }
input[type=range] { width: 100%; accent-color: var(--primary); min-height: 32px; }

/* ---------- surfaces & messages ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow-sm); }
.card > .h3:first-child { margin-bottom: 8px; }
.notice, .alert, .tip, .storage-note {
  display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-radius: 14px; font-size: .92rem;
}
.notice { background: var(--gold-soft); color: var(--ink); }
.notice .text-link { margin-left: auto; }
.alert { background: var(--danger-soft); color: var(--ink); }
.alert .icon { color: var(--danger); }
.tip { background: var(--sunk); align-items: flex-start; }
.tip p { margin: 0; color: var(--ink-2); }
.storage-note { background: var(--paper); border: 1px dashed var(--line-2); flex-wrap: wrap; }
.storage-note .icon { color: var(--accent); }
.storage-note div { flex: 1; min-width: 200px; }
.storage-note .storage-link { font-weight: 650; }
.storage-note.compact { padding: 10px 14px; }
.guide { background: var(--gold-soft); border-radius: 12px; padding: 12px 14px; margin: 6px 0 10px; }
.guide p { margin: 0 0 4px; }
.guide.soft { background: var(--sunk); }
.source-chip { display: inline-flex; align-items: center; gap: 6px; font-size: .85rem; color: var(--ink-2); background: var(--tonal); padding: 4px 10px; border-radius: 999px; margin: 0 0 8px; }
.empty { text-align: center; padding: 40px 18px; display: flex; flex-direction: column; align-items: center; }
.empty p { max-width: 42ch; }
.empty-mark { width: 64px; height: 64px; border-radius: 18px; display: grid; place-items: center; background: var(--tonal); color: var(--tonal-ink); margin-bottom: 14px; transform: rotate(-4deg); }
.empty-actions { display: flex; flex-direction: column; gap: 10px; align-items: center; margin-top: 8px; }
.toasts { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(var(--nav-h) + 18px + env(safe-area-inset-bottom, 0px)); z-index: 300; display: flex; flex-direction: column; gap: 8px; width: min(440px, calc(100vw - 28px)); pointer-events: none; }
@media (min-width: 900px) { .toasts { bottom: 24px; } }
.toast { pointer-events: auto; display: flex; align-items: center; gap: 12px; background: var(--ink); color: var(--bg); padding: 13px 16px; border-radius: 14px; box-shadow: var(--shadow-lg); font-size: .93rem; animation: toast-in .25s ease-out; }
.toast-action { margin-left: auto; background: none; border: 0; color: var(--gold); font: 700 .93rem var(--sans); cursor: pointer; padding: 4px 6px; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }
.offline-pill { position: fixed; top: calc(env(safe-area-inset-top, 0px) + 10px); left: 50%; transform: translateX(-50%); z-index: 50; display: flex; gap: 6px; align-items: center; background: var(--ink); color: var(--bg); padding: 6px 12px; border-radius: 999px; font-size: .8rem; font-weight: 600; box-shadow: var(--shadow); }

/* ---------- sheets ---------- */
.sheet-layer { position: fixed; inset: 0; z-index: 100; background: rgba(10, 16, 12, .5); display: flex; align-items: flex-end; justify-content: center; animation: fade .2s; }
.sheet { width: 100%; max-width: 560px; max-height: 92vh; overflow: auto; background: var(--paper); border-radius: 22px 22px 0 0; padding: 8px 20px calc(22px + env(safe-area-inset-bottom, 0px)); box-shadow: var(--shadow-lg); animation: sheet-up .28s cubic-bezier(.2, .8, .2, 1); overscroll-behavior: contain; }
.sheet:focus { outline: none; }
.sheet-wide { max-width: 860px; }
.sheet-grip { width: 40px; height: 5px; border-radius: 3px; background: var(--line-2); margin: 4px auto 6px; }
.sheet-head { display: flex; align-items: center; gap: 8px; position: sticky; top: -8px; background: var(--paper); padding: 6px 0; z-index: 2; }
.sheet-title { flex: 1; font-size: 1.2rem; font-weight: 700; margin: 0; }
.sheet-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 20px; flex-wrap: wrap; }
@media (min-width: 700px) {
  .sheet-layer { align-items: center; padding: 24px; }
  .sheet { border-radius: 22px; padding-bottom: 24px; }
  .sheet-grip { display: none; }
}
@keyframes fade { from { opacity: 0; } }
@keyframes sheet-up { from { transform: translateY(40px); opacity: .4; } }
.sheet-full { max-width: 760px; background: var(--sunk); }
.sheet-full .sheet-head { background: var(--sunk); }
.full-stamp { display: grid; place-items: center; padding: 8px 0 12px; }
.full-stamp img { max-height: 78vh; width: auto; filter: var(--stamp-shadow); }

/* ---------- welcome ---------- */
.welcome { min-height: 100vh; display: grid; gap: 28px; align-content: center; padding-top: 32px; }
.welcome-art { display: grid; place-items: center; position: relative; padding: 10px 0 0; }
.welcome-art::before { content: ""; position: absolute; inset: 8% 14%; background: radial-gradient(circle, var(--gold-soft), transparent 70%); border-radius: 50%; }
.welcome-stamp { width: min(64vw, 300px); transform: rotate(-5deg); filter: var(--stamp-shadow); position: relative; animation: settle .9s cubic-bezier(.2, .8, .2, 1) both; }
@keyframes settle { from { transform: rotate(-12deg) translateY(30px) scale(.94); opacity: 0; } }
.brand-line { display: flex; align-items: center; gap: 10px; font-weight: 800; letter-spacing: -.03em; font-size: 1.1rem; }
.welcome-steps { list-style: none; padding: 0; margin: 18px 0 22px; display: grid; gap: 10px; }
.welcome-steps li { display: flex; gap: 12px; align-items: center; color: var(--ink-2); }
.welcome-steps .icon { color: var(--accent); }
.welcome-actions { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; }
@media (min-width: 860px) {
  .welcome { grid-template-columns: 1fr 1.1fr; align-items: center; gap: 56px; }
  .welcome-art { order: 2; }
  .welcome-stamp { width: 380px; }
}

/* ---------- passport ---------- */
.passport-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; }
.passport-head h1 { margin-bottom: 8px; }
.passport-stats { display: flex; gap: 18px; flex-wrap: wrap; margin: 0; color: var(--muted); font-size: .95rem; }
.passport-stats strong { color: var(--ink); font-size: 1.35rem; font-weight: 750; letter-spacing: -.02em; margin-right: 3px; }
.filters { display: flex; flex-wrap: wrap; gap: 10px; margin: 6px 0 16px; align-items: center; }
.filters select { width: auto; min-width: 140px; flex: none; }
.passport-sheet {
  background-color: var(--paper);
  background-image:
    repeating-radial-gradient(circle at 0 0, transparent 0 14px, var(--pattern) 14px 15px),
    repeating-radial-gradient(circle at 100% 100%, transparent 0 14px, var(--pattern) 14px 15px);
  border: 1px solid var(--line); border-radius: 20px; padding: 22px 16px;
}
.stamp-grid { list-style: none; margin: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 26px 18px; }
@media (min-width: 640px) { .stamp-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 32px 24px; padding: 28px; } }
@media (min-width: 1040px) { .stamp-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.stamp-grid li { transform: rotate(var(--rot, 0deg)); transition: transform .2s; }
.stamp-grid li:hover { transform: rotate(0deg) translateY(-3px); }
.stamp-card { display: block; position: relative; text-decoration: none; color: var(--ink); border-radius: 8px; }
.stamp-thumb { aspect-ratio: 4 / 5; }
.stamp-thumb img { width: 100%; height: 100%; object-fit: contain; filter: var(--stamp-shadow); }
.stamp-thumb-ph { width: 100%; height: 100%; border-radius: 6px; background: linear-gradient(110deg, var(--sunk) 30%, var(--line) 50%, var(--sunk) 70%); background-size: 300% 100%; animation: shimmer 1.4s infinite; }
@keyframes shimmer { to { background-position: -150% 0; } }
.stamp-cap { display: flex; flex-direction: column; margin-top: 8px; padding: 0 4px; }
.stamp-cap-name { font-weight: 650; font-size: .92rem; line-height: 1.25; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stamp-cap-date { font-size: .8rem; color: var(--muted); }
.fav-dot { position: absolute; top: -6px; right: -6px; width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; background: var(--accent); color: #fff; box-shadow: var(--shadow-sm); }
.demo-tag { position: absolute; top: 8px; left: 8px; font-size: .7rem; font-weight: 700; background: var(--ink); color: var(--bg); padding: 2px 8px; border-radius: 999px; }
.empty-sheet { padding: 12px; }
.marks { display: flex; flex-direction: column; gap: 12px; }
.year-card { display: flex; align-items: center; gap: 16px; padding: 16px 18px; border-radius: 18px; background: #2F4231; color: #F4EEDB !important; text-decoration: none; box-shadow: var(--shadow); }
.year-num { font-size: 2.4rem; font-weight: 850; letter-spacing: -.05em; color: #E2B045; line-height: 1; }
.year-text { display: flex; flex-direction: column; flex: 1; font-size: .9rem; }
.year-text strong { font-size: 1.02rem; }
.mark-list { list-style: none; padding: 0; margin: 0; display: flex; gap: 10px; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
.mark { flex: none; display: flex; align-items: center; gap: 10px; background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: 6px 14px 6px 6px; font-size: .86rem; white-space: nowrap; }
.mark-seal { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: var(--gold-soft); color: var(--gold-ink); border: 1.5px dashed var(--gold); flex: none; }

/* ---------- create ---------- */
.stepper { display: flex; gap: 6px; margin-top: -6px; }
.stepper span { flex: 1; height: 4px; border-radius: 2px; background: var(--line); }
.stepper span.on { background: var(--primary); }
.processing { padding: 60px 0; display: grid; place-items: center; }
.source-grid { display: grid; grid-template-columns: 1fr; gap: 12px; border-radius: 20px; }
.source-grid.drag { outline: 3px dashed var(--primary); outline-offset: 6px; }
@media (min-width: 560px) { .source-grid { grid-template-columns: 1fr 1fr; } }
.source { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; padding: 22px; text-align: left; border-radius: 18px; border: 1.5px solid var(--line-2); background: var(--surface); color: var(--ink); font: inherit; cursor: pointer; box-shadow: var(--shadow-sm); transition: border-color .15s, transform .1s; }
.source:hover { border-color: var(--primary); }
.source:first-child { background: var(--primary); color: var(--on-primary); border-color: var(--primary); }
.source:first-child .muted { color: color-mix(in srgb, var(--on-primary) 78%, transparent); }
.source strong { font-size: 1.12rem; }
.source-icon { width: 52px; height: 52px; border-radius: 14px; display: grid; place-items: center; background: var(--tonal); color: var(--tonal-ink); margin-bottom: 6px; }
.source:first-child .source-icon { background: rgba(255,255,255,.14); color: inherit; }
.photo-step { display: flex; flex-direction: column; gap: 16px; }
.details { display: flex; flex-direction: column; gap: 14px; }
.photo-strip { display: flex; gap: 14px; align-items: center; }
.photo-mini { width: 76px; height: 76px; object-fit: cover; border-radius: 12px; box-shadow: var(--shadow-sm); }
canvas.photo-mini { width: auto; height: 76px; max-width: 120px; }
.photo-mini.ph { display: grid; place-items: center; background: var(--sunk); color: var(--muted); }
.place-search { margin-top: 6px; }
.results { list-style: none; padding: 0; margin: 8px 0 0; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.results li + li { border-top: 1px solid var(--line); }
.results button { width: 100%; text-align: left; display: flex; flex-direction: column; gap: 2px; padding: 12px 14px; background: var(--surface); border: 0; color: var(--ink); font: inherit; cursor: pointer; }
.results button:hover { background: var(--sunk); }
.wx-line { margin-bottom: 4px; }
.wx-main { font-size: 1.05rem; margin: 0; }
.wx-main strong { font-size: 1.3rem; }
.create-bar {
  position: sticky; bottom: calc(var(--nav-h) + env(safe-area-inset-bottom, 0px) + 8px); z-index: 20;
  display: grid; grid-template-columns: auto 1fr; gap: 10px; padding: 10px; border-radius: 18px;
  background: color-mix(in srgb, var(--paper) 92%, transparent); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border: 1px solid var(--line); box-shadow: var(--shadow);
}
@media (min-width: 900px) { .create-bar { bottom: 16px; } }
.design-step { display: flex; flex-direction: column; gap: 16px; }
.preview-wrap { display: grid; place-items: center; padding: 18px; background: var(--sunk); border-radius: 22px; }
.preview-stamp { width: min(100%, 420px); aspect-ratio: 4 / 5; filter: var(--stamp-shadow); touch-action: none; cursor: grab; border-radius: 4px; }
.preview-stamp:active { cursor: grabbing; }
.reposition { display: flex; flex-wrap: wrap; gap: 6px 16px; align-items: center; }
.reposition .hint { width: 100%; margin: 0; }
.zoom { display: flex; align-items: center; gap: 12px; flex: 1; min-width: 220px; font-weight: 600; font-size: .9rem; }
.design-options { display: flex; gap: 12px; overflow-x: auto; padding: 4px 2px 10px; scroll-snap-type: x mandatory; }
.design-opt { position: relative; flex: none; width: 128px; display: flex; flex-direction: column; gap: 2px; cursor: pointer; scroll-snap-align: start; padding: 8px; border-radius: 14px; border: 2px solid transparent; }
.design-opt.on { border-color: var(--primary); background: var(--surface); }
.design-opt:has(input:focus-visible) { outline: 3px solid var(--focus-ring); }
.mini-design { width: 100%; aspect-ratio: 4 / 5; filter: drop-shadow(0 2px 4px rgba(0,0,0,.18)); margin-bottom: 6px; }
.design-name { font-weight: 650; font-size: .9rem; }
.design-hint { font-size: .76rem; color: var(--muted); line-height: 1.25; }

/* ---------- stamp detail ---------- */
.stamp-layout { display: grid; gap: 22px; }
@media (min-width: 900px) { .stamp-layout { grid-template-columns: minmax(0, 1.05fr) minmax(320px, .95fr); align-items: start; gap: 40px; } .stamp-side { position: sticky; top: 24px; } }
.stamp-hero-wrap { background: var(--sunk); border-radius: 26px; padding: clamp(22px, 6vw, 48px); display: flex; flex-direction: column; align-items: center; }
.stamp-hero { border: 0; background: none; padding: 0; cursor: zoom-in; width: min(100%, 470px); border-radius: 4px; }
.stamp-hero canvas { width: 100%; aspect-ratio: 4 / 5; filter: var(--stamp-shadow); transform: rotate(-1.2deg); }
.stamp-hero.pressed canvas { animation: press .7s cubic-bezier(.2, .9, .3, 1.2) both; }
@keyframes press { 0% { transform: scale(1.12) rotate(-6deg); opacity: 0; } 55% { transform: scale(.97) rotate(-.6deg); opacity: 1; } 100% { transform: scale(1) rotate(-1.2deg); } }
.demo-note { font-size: .82rem; color: var(--muted); margin: 14px 0 0; text-align: center; }
.stamp-side { display: flex; flex-direction: column; gap: 16px; }
.primary-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.primary-actions .btn { min-height: 54px; font-size: 1.02rem; }
.split { display: flex; border-radius: 14px; box-shadow: var(--shadow-sm); }
.split-main { flex: 1; border-radius: 14px 0 0 14px !important; box-shadow: none !important; min-width: 0; }
.split-more { width: 46px; height: auto; border-radius: 0 14px 14px 0; background: var(--primary); color: var(--on-primary); border-left: 1px solid color-mix(in srgb, var(--on-primary) 25%, transparent); }
.split-more:hover { background: var(--primary-hover); }
.quiet-actions { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.qa { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 10px 4px; border-radius: 12px; border: 0; background: transparent; color: var(--ink-2); font: 550 .78rem var(--sans); cursor: pointer; text-decoration: none; }
.qa:hover { background: var(--sunk); }
.qa.on { color: var(--accent); }
.milestone-note { display: flex; align-items: center; gap: 12px; padding: 12px 12px 12px 14px; border-radius: 16px; background: var(--gold-soft); animation: toast-in .4s .5s both; }
.milestone-note > div { flex: 1; }
.facts { margin: 0; display: grid; gap: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.facts > div { display: grid; grid-template-columns: 90px 1fr; gap: 12px; padding: 13px 16px; border-top: 1px solid var(--line); }
.facts > div:first-child { border-top: 0; }
.facts dt { color: var(--muted); font-size: .86rem; padding-top: 2px; }
.facts dd { margin: 0; overflow-wrap: anywhere; }
.facts dd .icon { vertical-align: -3px; }
.tag { display: inline-block; margin: 0 6px 6px 0; padding: 3px 10px; border-radius: 999px; background: var(--tonal); color: var(--tonal-ink) !important; text-decoration: none; font-size: .86rem; font-weight: 550; }

/* ---------- share sheet ---------- */
.share-preview { display: grid; place-items: center; background: var(--sunk); border-radius: 16px; padding: 14px; margin-bottom: 14px; }
.share-preview img { max-height: 34vh; width: auto; border-radius: 6px; box-shadow: var(--shadow); }
.share-ph { min-height: 200px; display: grid; place-items: center; }
.share-ph.tall { min-height: 420px; }
.sheet .segmented { margin-bottom: 4px; }
.sheet .btn.wide { margin-top: 12px; }
.action-list { list-style: none; padding: 0; margin: 14px 0 0; border: 1px solid var(--line); border-radius: 14px; overflow: hidden; background: var(--surface); }
.action-list li + li { border-top: 1px solid var(--line); }
.action-list button, .action-list a { width: 100%; display: flex; align-items: center; gap: 14px; padding: 13px 16px; border: 0; background: none; text-align: left; font: inherit; color: var(--ink); cursor: pointer; text-decoration: none; }
.action-list button:hover, .action-list a:hover { background: var(--sunk); }
.action-list .icon { color: var(--primary); }
.action-list span { display: flex; flex-direction: column; }
.action-list .hint { margin: 0; }
.link-section { margin-top: 18px; padding-top: 6px; border-top: 1px solid var(--line); }
.link-row { display: flex; gap: 8px; align-items: center; }
.link-row input { flex: 1; min-width: 0; font-size: .88rem !important; }
.check-list { list-style: none; padding: 0; margin: 0; }
.check-row { display: flex; align-items: center; gap: 14px; padding: 12px 4px; border-bottom: 1px solid var(--line); cursor: pointer; }
.check-row > span { display: flex; flex-direction: column; }
.new-inline { margin-top: 10px; }

/* ---------- collections ---------- */
.group-grid { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 16px; }
.group-card { display: flex; flex-direction: column; gap: 12px; padding: 16px; border-radius: 18px; background: var(--surface); border: 1px solid var(--line); text-decoration: none; color: var(--ink); box-shadow: var(--shadow-sm); height: 100%; }
.group-card:hover { border-color: var(--line-2); box-shadow: var(--shadow); }
.group-stack { position: relative; height: 170px; background: var(--paper); border-radius: 12px; }
.gs { position: absolute; width: 104px; top: 14px; left: 50%; }
.gs-0 { transform: translateX(-50%) rotate(-2deg); z-index: 3; }
.gs-1 { transform: translateX(-112%) rotate(-9deg); z-index: 2; top: 22px; }
.gs-2 { transform: translateX(12%) rotate(8deg); z-index: 1; top: 22px; }
.gs-empty { width: 100%; left: 0; top: 0; height: 100%; display: grid; place-items: center; color: var(--muted); transform: none; }
.group-meta { display: flex; flex-direction: column; gap: 2px; }
.group-meta strong { font-size: 1.04rem; }
.group-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.pick-grid { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 14px; }
.pick { display: flex; flex-direction: column; gap: 6px; position: relative; padding: 6px; border-radius: 12px; border: 2px solid transparent; cursor: pointer; }
.pick.on { border-color: var(--primary); background: var(--tonal); }
.pick:has(input:focus-visible) { outline: 3px solid var(--focus-ring); }
.pick-name { font-size: .8rem; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pick-check { position: absolute; top: 0; right: 0; width: 26px; height: 26px; border-radius: 50%; display: none; place-items: center; background: var(--primary); color: var(--on-primary); }
.pick.on .pick-check { display: grid; }

/* ---------- year ---------- */
.year-layout { display: grid; gap: 22px; }
@media (min-width: 900px) { .year-layout { grid-template-columns: minmax(0, 1fr) minmax(300px, .9fr); align-items: start; gap: 36px; } }
.year-preview img { width: 100%; border-radius: 14px; box-shadow: var(--shadow-lg); }
.year-side { display: flex; flex-direction: column; gap: 10px; }
.months { list-style: none; padding: 0; margin: 0; display: grid; gap: 2px; }
.months li { display: grid; grid-template-columns: 44px 60px 1fr; gap: 10px; align-items: center; padding: 6px 0; font-size: .9rem; border-bottom: 1px solid var(--line); }
.m-name { color: var(--muted); font-weight: 600; }
.months li.has .m-name { color: var(--ink); }
.m-bar { height: 8px; border-radius: 4px; background: var(--gold); width: calc(min(var(--n), 6) * 10px); }
.m-places a { color: var(--ink); }

/* ---------- explore ---------- */
.nearby-intro { display: flex; flex-direction: column; align-items: flex-start; gap: 10px; }
.place-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.place-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 14px; border-radius: 14px; background: var(--surface); border: 1px solid var(--line); }
.place-row > div:first-child { min-width: 0; }
.place-row .row-actions { margin: 0; flex-wrap: nowrap; }
.card .place-list { margin-top: 10px; }
.map-wrap { position: relative; }
.map { position: relative; height: min(64vh, 560px); border-radius: 20px; overflow: hidden; background: var(--sunk); touch-action: none; cursor: grab; border: 1px solid var(--line); }
.tile { position: absolute; top: 0; left: 0; width: 256px; height: 256px; max-width: none; user-select: none; }
:root[data-theme="dark"] .tile { filter: brightness(.7) contrast(1.1) saturate(.6); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .tile { filter: brightness(.7) contrast(1.1) saturate(.6); } }
.pin { position: absolute; top: 0; left: 0; width: 0; height: 0; }
.pin-dot { position: absolute; left: -11px; top: -11px; width: 22px; height: 22px; border-radius: 50%; background: var(--accent); border: 3px solid #fff; box-shadow: 0 2px 6px rgba(0,0,0,.35); }
.map-controls { position: absolute; right: 12px; top: 12px; display: flex; flex-direction: column; gap: 6px; }
.map-controls .icon-btn { background: var(--surface); box-shadow: var(--shadow); }
.map-attrib { position: absolute; right: 10px; bottom: 6px; margin: 0; font-size: .72rem; background: rgba(255,255,255,.85); color: #222; padding: 1px 6px; border-radius: 6px; }
.map-attrib a { color: #222; }

/* ---------- profile ---------- */
.profile .card { display: flex; flex-direction: column; }
.status-block { display: flex; gap: 14px; padding: 14px; border-radius: 14px; margin-bottom: 14px; }
.status-block.local { background: var(--gold-soft); }
.status-block.local > .icon { color: var(--accent); }
.status-block.synced { background: var(--tonal); }
.status-block p { margin: 2px 0 0; }
.data-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-start; }
.data-actions > div { display: flex; flex-direction: column; }
.auth-form { margin-top: 6px; }
.form-msg { background: var(--sunk); padding: 10px 12px; border-radius: 10px; margin: 12px 0 0; font-size: .92rem; }
.plain-list { list-style: none; padding: 0; margin: 0 0 16px; display: grid; gap: 10px; }
.plain-list li { display: flex; gap: 12px; align-items: flex-start; color: var(--ink-2); font-size: .93rem; }
.plain-list .icon { margin-top: 2px; color: var(--primary); }
.profile .btn-danger { align-self: flex-start; }

/* ---------- public pages ---------- */
.public { min-height: 100vh; display: flex; flex-direction: column; align-items: center; padding: 18px; }
.public-head { display: flex; align-items: center; gap: 10px; font-size: 1.1rem; letter-spacing: -.02em; width: 100%; max-width: 620px; }
.public-main { flex: 1; width: 100%; max-width: 620px; padding: 28px 0; text-align: center; }
.public-title { margin-top: 8px; }
.public-img { width: 100%; max-width: 520px; margin: 18px auto; filter: var(--stamp-shadow); }
.public-foot { text-align: center; padding: 12px 0 calc(16px + env(safe-area-inset-bottom, 0px)); }

/* ---------- print ---------- */
.print-view { padding: 16px; }
.print-bar { position: sticky; top: 0; z-index: 10; display: flex; flex-wrap: wrap; gap: 12px; align-items: center; background: var(--paper); border: 1px solid var(--line); border-radius: 18px; padding: 10px 14px; margin: 0 auto 20px; max-width: 980px; box-shadow: var(--shadow); }
.print-bar-text { flex: 1; min-width: 200px; }
.print-bar-text h1 { margin: 0; }
.print-bar .segmented { min-width: 260px; }
.print-page { background: #fff; color: #17241B; width: min(100%, 794px); aspect-ratio: 210 / 297; margin: 0 auto 24px; box-shadow: var(--shadow); padding: 5%; display: flex; flex-direction: column; position: relative; }
.print-page.single { align-items: center; justify-content: center; }
.print-page.single img { width: 78%; }
.print-cap { margin-top: 14px; font-size: .9rem; }
.print-head, .print-foot { display: flex; justify-content: space-between; font-size: .8rem; color: #5B675F; }
.print-foot { margin-top: auto; }
.sheet-grid { flex: 1; display: grid; grid-template-columns: 1fr 1fr; grid-template-rows: repeat(3, 1fr); gap: 3% 8%; padding: 3% 6%; }
.sheet-grid figure { margin: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 0; }
.sheet-grid img { max-height: 88%; width: auto; }
.sheet-grid figcaption { font-size: .7rem; margin-top: 4px; text-align: center; }
.print-ph { width: 70%; aspect-ratio: 4 / 5; background: #eee; }
.cover { justify-content: center; align-items: center; background: #2F4231; color: #F4EEDB; }
.cover-inner { text-align: center; }
.cover-brand { color: #E2B045; font-weight: 800; letter-spacing: -.02em; font-size: 1.2rem; }
.cover-title { font-size: clamp(1.8rem, 5vw, 3rem); font-weight: 800; letter-spacing: -.04em; margin: 12px 0; }
.cover-sub { opacity: .85; }
.booklet { flex-direction: row; gap: 6%; align-items: center; }
.bk-stamp { flex: 1.2; }
.bk-text { flex: 1; font-size: .95rem; }
.bk-text h2 { font-size: 1.5rem; }
.bk-where { color: #5B675F; }
.bk-caption { font-family: var(--serif); font-style: italic; }
.bk-notes { white-space: pre-wrap; font-size: .85rem; color: #33433A; }
@media print {
  @page { size: A4; margin: 0; }
  body { background: #fff !important; }
  .no-print, .toasts, .offline-pill { display: none !important; }
  .print-view { padding: 0; }
  .print-page { width: 210mm; height: 297mm; aspect-ratio: auto; margin: 0; box-shadow: none; page-break-after: always; break-after: page; }
  .cover { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

/* ---------- motion ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
  .stamp-grid li:hover { transform: rotate(var(--rot, 0deg)); }
}
@media (forced-colors: active) {
  .btn, .chip, .segmented label.on, .card { border: 1px solid CanvasText; }
}
