/* =========================================================================
   StampMyWay — styles for every explorer page. The admin panel adds admin/assets/admin.css.
   html.smw = every page, html.page-<name> = one page (same pattern as Zero Fans / Haru Haru).
   Design tokens from the mockups (designs/*.dc.html), see CLAUDE.md → Design system.
   ========================================================================= */
:root {
  --paper: #f6f1e7;
  --card: #fffbf3;
  --white: #ffffff;
  --sand: #eadfc9;
  --ink: #2b2620;
  --muted: #5b5346;
  --faint: #6b6253;
  --border: #e2d7c3;
  --border-strong: #d6c8ae;
  --red: #b4421f;          /* laterite — primary */
  --red-dark: #963619;
  --green: #2f5d50;        /* jungle */
  --indigo: #3b4a8c;
  --plum: #7a2e55;
  --gold: #c9962b;
  --you: #2563eb;
  --font-display: 'Fraunces', Georgia, serif;
  --font-body: 'Kantumruy Pro', system-ui, sans-serif;
  --krama: repeating-linear-gradient(90deg, rgba(246,241,231,.35) 0 4px, transparent 4px 12px),
           repeating-linear-gradient(0deg, rgba(246,241,231,.35) 0 4px, transparent 4px 12px);
  --shadow: 0 6px 18px rgba(43,38,32,.08);
}

* { box-sizing: border-box; }
html { color-scheme: light; background: var(--paper); }
body {
  margin: 0; min-height: 100dvh;
  background: var(--paper); color: var(--ink);
  font-family: var(--font-body); font-size: 16px; line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; }
button { font-family: inherit; font-size: inherit; cursor: pointer; color: inherit; }
input, textarea, select { font: inherit; }
h1, h2, h3 { font-family: var(--font-display); margin: 0; font-weight: 700; }
p { margin: 0; }
:focus-visible { outline: 3px solid var(--indigo); outline-offset: 2px; }

.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.tiny { font-size: 12px; }
.bold { font-weight: 700; }
.green { color: var(--green); }
.red { color: var(--red); }
.row { display: flex; align-items: center; gap: 8px; }
.row.between { justify-content: space-between; }
.row.wrap { flex-wrap: wrap; }
.stack { display: flex; flex-direction: column; gap: 8px; }
.grow { flex: 1; min-width: 0; }
.eyebrow { font-size: 12px; font-weight: 700; letter-spacing: 2px; color: var(--red); text-transform: uppercase; }
.loading { padding: 40px 20px; color: var(--muted); text-align: center; }

/* ------------------------------------------------ app shell (phone column) */
.app {
  max-width: 480px; margin: 0 auto; min-height: 100dvh;
  display: flex; flex-direction: column; background: var(--paper);
}
.krama { height: 8px; flex: none; background-color: var(--green); background-image: var(--krama); }
.krama.red { background-color: var(--red); }
#page { flex: 1; display: flex; flex-direction: column; padding-bottom: 92px; }
html.no-tabs #page { padding-bottom: 24px; }
.pad { padding: 0 20px; }
.screen-head { padding: 18px 20px 14px; display: flex; flex-direction: column; gap: 12px; }
.screen-head h1 { font-size: 30px; line-height: 1.15; }
.screen-head > .row.between > .stack { min-width: 0; }
@media (max-width: 400px) { .screen-head h1 { font-size: 24px; } }

/* bottom tab bar */
.tabs {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  max-width: 480px; margin: 0 auto; height: 76px; display: flex;
  border-top: 1px solid var(--border); background: var(--card);
  padding-bottom: env(safe-area-inset-bottom);
}
.tabs a {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  text-decoration: none; color: var(--faint); font-size: 12px; font-weight: 600;
}
.tabs a[aria-current='page'] { color: var(--red); font-weight: 700; }

/* ------------------------------------------------ buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 0 18px; border-radius: 999px;
  border: 1px solid var(--border-strong); background: var(--card); color: var(--ink);
  font-weight: 600; text-decoration: none; white-space: nowrap;
}
.btn-primary { background: var(--red); border-color: var(--red); color: var(--white); font-weight: 700; }
.btn-primary:hover { background: var(--red-dark); }
.btn-green { background: var(--green); border-color: var(--green); color: var(--white); font-weight: 700; }
.btn-dark { background: var(--ink); border-color: var(--ink); color: var(--white); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn-lg { min-height: 54px; font-size: 16px; padding: 0 24px; }
.btn-sm { min-height: 40px; padding: 0 14px; font-size: 14px; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: .55; cursor: default; }
.icon-btn {
  position: relative; width: 44px; height: 44px; border-radius: 50%; flex: none;
  border: 1px solid var(--border-strong); background: var(--card);
  display: inline-flex; align-items: center; justify-content: center; text-decoration: none;
}
.icon-btn.bare { border: 0; background: transparent; }
.count-badge {
  position: absolute; top: -4px; right: -4px; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 10px;
  background: var(--red); color: var(--white); font-size: 11px; font-weight: 700; border: 2px solid var(--paper);
  display: flex; align-items: center; justify-content: center;
}
.pill-link {
  height: 44px; padding: 0 14px; border-radius: 22px; border: 1px solid var(--border-strong); background: var(--card);
  text-decoration: none; font-size: 13px; font-weight: 600; display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; flex: none;
}
.chips { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 2px; scrollbar-width: none; }
.chip {
  min-height: 40px; padding: 0 16px; border-radius: 999px; border: 1px solid var(--border-strong);
  background: var(--card); white-space: nowrap; font-weight: 600; font-size: 14px;
}
.chip[aria-pressed='true'] { background: var(--ink); border-color: var(--ink); color: var(--white); }

/* ------------------------------------------------ cards, bars, labels */
.card { background: var(--card); border: 1px solid var(--border-strong); border-radius: 18px; padding: 16px; }
.card.soft { border-color: var(--border); }
.section { padding: 20px; border-top: 1px solid var(--border); display: flex; flex-direction: column; gap: 10px; }
.section h2 { font-size: 20px; }
.progress { height: 8px; border-radius: 4px; background: var(--border); overflow: hidden; }
.progress > span { display: block; height: 100%; background: var(--red); border-radius: 4px; }
.ad-card {
  margin: 10px 20px 0; text-decoration: none; display: flex; align-items: center; gap: 12px; padding: 10px 12px;
  border-radius: 14px; background: var(--white); border: 1px solid var(--border);
}
.ad-label {
  font-size: 10px; font-weight: 700; letter-spacing: 1px; color: var(--muted);
  border: 1px solid var(--border-strong); padding: 2px 6px; border-radius: 6px; flex: none;
}
.tag { font-size: 11px; font-weight: 700; letter-spacing: 1px; padding: 3px 8px; border-radius: 8px; background: var(--sand); color: var(--muted); }
.tag.live { background: var(--green); color: var(--white); }
.tag.new { background: var(--red); color: var(--white); }
.tip-chip { font-size: 13px; padding: 6px 10px; border-radius: 10px; background: var(--card); border: 1px solid var(--border); }
.placeholder { color: var(--muted); font-style: italic; }
.price-row { display: flex; justify-content: space-between; padding: 10px 0; border-bottom: 1px dashed var(--border-strong); font-size: 15px; }
.price-row:last-of-type { border-bottom: 0; }
ul.manners { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 6px; }
.input {
  width: 100%; min-height: 48px; padding: 0 16px; border-radius: 14px;
  border: 1px solid var(--border-strong); background: var(--white);
}

/* ------------------------------------------------ map screen */
.map-wrap {
  margin: 0 20px; height: 420px; position: relative; border-radius: 20px; overflow: hidden;
  background: var(--sand); border: 1px solid #dccfb6; flex: none;
}
#map { position: absolute; inset: 0; }
.map-note { position: absolute; left: 10px; top: 10px; z-index: 2; font-size: 11px; font-weight: 600; color: var(--muted);
  background: rgba(255,251,243,.92); padding: 3px 8px; border-radius: 8px; }
.pin { display: flex; flex-direction: column; align-items: center; gap: 4px; cursor: pointer; background: none; border: 0; padding: 0; }
.pin-dot { width: 30px; height: 30px; border-radius: 50%; display: flex; align-items: center; justify-content: center; }
.pin-dot.done { background: var(--red); color: var(--white); }
.pin-dot.locked { border: 2px dashed var(--red); background: var(--paper); color: var(--red); }
.pin-dot.pending { border: 2px solid var(--gold); background: var(--paper); color: var(--gold); }
.pin-label { font-size: 11px; font-weight: 600; background: var(--card); padding: 2px 6px; border-radius: 6px; white-space: nowrap; }
.you-dot { width: 16px; height: 16px; border-radius: 50%; background: var(--you); border: 3px solid var(--white); box-shadow: 0 0 0 6px rgba(37,99,235,.2); }
.near-card {
  margin: 14px 20px 0; padding: 14px; border-radius: 18px; background: var(--card); border: 1px solid var(--border-strong);
  display: flex; align-items: center; gap: 12px; box-shadow: var(--shadow);
}
.round-icon { width: 44px; height: 44px; border-radius: 50%; background: var(--green); color: var(--white); display: flex; align-items: center; justify-content: center; flex: none; }

/* ------------------------------------------------ stamps */
.stamp-ring {
  --ink: var(--red);
  width: 220px; height: 220px; border-radius: 50%; margin: 0 auto;
  border: 6px double var(--ink); color: var(--ink);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; text-align: center;
  padding: 24px; transform: rotate(-6deg); background: rgba(255,251,243,.6);
}
.stamp-ring .stamp-name { font-family: var(--font-display); font-size: 24px; font-weight: 700; line-height: 1.1; }
.stamp-ring .stamp-date { font-size: 12px; font-weight: 700; letter-spacing: 2px; }
.stamp-ring.pop { animation: stamp-pop .55s cubic-bezier(.2,1.6,.4,1) both; }
@keyframes stamp-pop { 0% { transform: scale(2.2) rotate(-18deg); opacity: 0; } 60% { opacity: 1; } 100% { transform: scale(1) rotate(-6deg); } }
@media (prefers-reduced-motion: reduce) { .stamp-ring.pop { animation: none; } }
.edition { font-size: 11px; font-weight: 700; letter-spacing: 2px; padding: 3px 10px; border-radius: 999px; background: var(--gold); color: var(--white); }

.passport-cover {
  margin: 0 20px; padding: 18px; border-radius: 18px; background: var(--green); color: var(--white);
  display: flex; flex-direction: column; gap: 12px; position: relative; overflow: hidden;
}
.passport-cover .fields { display: grid; grid-template-columns: 1.6fr 1fr 1fr; gap: 10px; }
.passport-cover .fields span:first-child { display: block; font-size: 10px; letter-spacing: 2px; opacity: .75; }
.passport-cover .fields span:last-child { font-weight: 700; }
.stamp-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; padding: 0 20px; }
.stamp-cell {
  aspect-ratio: 1; border-radius: 16px; background: var(--card); border: 1px solid var(--border);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; text-align: center;
  padding: 10px; text-decoration: none; position: relative;
}
.stamp-cell .mini-ring {
  width: 78px; height: 78px; border-radius: 50%; border: 4px double currentColor; transform: rotate(-8deg);
  display: flex; align-items: center; justify-content: center; font-family: var(--font-display); font-weight: 700; font-size: 26px;
}
.stamp-cell.locked { border-style: dashed; border-color: var(--border-strong); background: transparent; color: var(--muted); }
.stamp-cell.locked .mini-ring { border: 2px dashed var(--border-strong); transform: none; font-size: 0; }
.stamp-cell.hidden-slot { border-color: var(--plum); color: var(--plum); }
.stamp-cell .cell-name { font-size: 14px; font-weight: 700; color: var(--ink); line-height: 1.2; }
.stamp-cell .tag.new { position: absolute; top: 8px; right: 8px; }

/* ------------------------------------------------ phrases */
.phrase-card { border-radius: 18px; background: var(--card); border: 1px solid var(--border-strong); padding: 16px; display: flex; flex-direction: column; gap: 6px; }
.phrase-big { font-size: 30px; font-weight: 700; line-height: 1.3; }
.phrase-row { display: flex; align-items: center; gap: 12px; padding: 14px 0; border-bottom: 1px solid var(--border); }
.play-btn { width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--border-strong); background: var(--card); display: flex; align-items: center; justify-content: center; flex: none; }

/* ------------------------------------------------ sign-in & onboarding */
.provider-btn {
  display: flex; align-items: center; gap: 12px; width: 100%; min-height: 54px; padding: 0 18px;
  border-radius: 999px; border: 1px solid var(--border-strong); background: var(--white); font-weight: 600; font-size: 16px;
  text-decoration: none; color: var(--ink);
}
.provider-btn .mark { width: 28px; height: 28px; border-radius: 50%; display: flex; align-items: center; justify-content: center; flex: none; font-weight: 700; color: var(--white); }
.provider-btn.facebook .mark { background: #1877f2; }
.provider-btn.telegram .mark { background: #229ed9; }
.oauth-slot { min-height: 44px; display: flex; justify-content: center; }
.divider { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 13px; }
.divider::before, .divider::after { content: ''; flex: 1; height: 1px; background: var(--border-strong); }
.choice {
  text-align: left; padding: 16px; border-radius: 16px; background: var(--card); border: 1px solid var(--border-strong);
  display: flex; flex-direction: column; gap: 2px; width: 100%;
}
.choice[aria-pressed='true'] { border: 2px solid var(--red); padding: 15px; }
.choice .title { font-weight: 700; font-size: 16px; }
.country-row { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 14px; background: var(--card); border: 1px solid var(--border); text-decoration: none; width: 100%; text-align: left; }
.country-row .code { width: 40px; height: 40px; border-radius: 10px; background: var(--sand); display: flex; align-items: center; justify-content: center; font-weight: 700; flex: none; }
.push-banner { background: var(--ink); color: var(--white); border-radius: 18px; padding: 16px; display: flex; flex-direction: column; gap: 12px; }

/* ------------------------------------------------ sheets, toast, notices */
.sheet-backdrop { position: fixed; inset: 0; background: rgba(43,38,32,.45); z-index: 40; display: flex; align-items: flex-end; justify-content: center; }
.sheet { width: 100%; max-width: 480px; background: var(--paper); border-radius: 22px 22px 0 0; padding: 22px 20px calc(22px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 14px; }
.toast {
  position: fixed; left: 50%; bottom: 96px; transform: translateX(-50%); z-index: 50; max-width: calc(100% - 32px);
  background: var(--ink); color: var(--white); padding: 12px 18px; border-radius: 14px; font-size: 14px; box-shadow: var(--shadow);
}
.notice { padding: 12px 14px; border-radius: 14px; background: #fbeee4; border: 1px solid #ecc7b2; color: var(--red-dark); font-size: 14px; }
.notice.info { background: var(--card); border-color: var(--border-strong); color: var(--muted); }
.dev-box { padding: 14px; border-radius: 14px; border: 1px dashed var(--gold); display: flex; flex-direction: column; gap: 8px; }
.notif-row { display: flex; gap: 12px; padding: 14px 20px; border-bottom: 1px solid var(--border); text-decoration: none; }
.notif-row.unread { background: var(--card); }
.notif-row .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--red); margin-top: 8px; flex: none; }
