/* ============================================================
   ReFound — aged-paper vintage design system
   palette: cream paper / terracotta / teal / ink / gold
   type:    DM Serif Display (heads) + DM Sans (body)
   ============================================================ */

:root {
  --cream:      #F9F5EC;   /* page background */
  --cream-2:    #F2ECDD;
  --paper:      #FFFFFF;   /* card surface */
  --paper-2:    #F6F1E6;
  --paper-deep: #EAE2D2;
  --ink:        #3D2B1E;
  --ink-soft:   #7A6D61;
  --ink-faint:  #C6B7A5;
  --terra:      #B24D3E;   /* primary accent */
  --terra-deep: #8E3A2D;
  --terra-soft: #EBD4C8;
  --teal:       #2E7D6B;   /* secondary accent */
  --teal-deep:  #1F5B4E;
  --teal-soft:  #B7D5CC;
  --gold:       #C89B3C;
  --gold-soft:  #F3E3B8;
  --danger:     #D32F2F;
  --warn:       #F57C00;
  --ok:         #1B5E20;
  --peach:      #FFF3E0;   /* deal-meter card */
  --line:       rgba(122, 109, 97, 0.16);
  --line-strong: rgba(122, 109, 97, 0.30);
  --field-line: #F0EDE9;
  --shadow-sm:  0 1px 3px rgba(80, 58, 38, 0.08);
  --shadow-md:  0 6px 20px rgba(80, 58, 38, 0.10);
  --shadow-lg:  0 18px 44px rgba(80, 58, 38, 0.18);
  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 16px;
  --r-xl: 20px;
  --nav-h: 66px;
  --font-head: 'DM Serif Display', Georgia, 'Times New Roman', serif;
  --font-body: 'DM Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0; padding: 0;
  background: var(--cream);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 16px; line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* --- aged-paper grain overlay ----------------------------------------- */
.paper-grain {
  position: fixed; inset: 0; z-index: 0; pointer-events: none;
  opacity: .5; mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='140' height='140'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/><feColorMatrix type='saturate' values='0'/></filter><rect width='100%25' height='100%25' filter='url(%23n)' opacity='0.05'/></svg>");
}

.app { position: relative; z-index: 1; min-height: 100dvh; }

.view-root {
  max-width: 640px;
  margin: 0 auto;
  padding: 22px 22px 118px; /* bottom: nav (66) + air (≈48) — fallback if env() unsupported */
  padding-bottom: calc(var(--nav-h) + env(safe-area-inset-bottom) + 48px);
}

/* ---------------------------------------------------------------- views - */
.view { display: none; padding-top: 14px; }
.view.active { display: block; animation: viewIn .4s cubic-bezier(.22, .8, .35, 1); }
@keyframes viewIn {
  from { opacity: 0; transform: translateY(12px) scale(.995); }
  to   { opacity: 1; transform: none; }
}

/* ------------------------------------------------------------ typography - */
h1, h2, h3, .serif { font-family: var(--font-head); font-weight: 400; line-height: 1.15; }
h1 { font-size: 2.25rem; margin: 0 0 .25rem; }
h2 { font-size: 1.5rem; margin: 0 0 .35rem; }
h3 { font-size: 1.16rem; margin: 0 0 .3rem; }
.muted { color: var(--ink-soft); }
.faint { color: var(--ink-faint); }
.small { font-size: .82rem; }
.tiny { font-size: .72rem; letter-spacing: .02em; }
strong { font-weight: 700; }
.eyebrow {
  font-family: var(--font-body); font-size: .72rem; font-weight: 700;
  letter-spacing: .14em; text-transform: uppercase; color: var(--teal-deep);
  margin: 0 0 .2rem;
}
.tagline { color: var(--ink-soft); margin: 0 0 1.2rem; font-size: .98rem; }

/* ---------------------------------------------------------------- cards - */
.card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
  padding: 20px;
  margin-bottom: 18px;
  position: relative;
}
.card.flat { border-radius: var(--r-md); box-shadow: none; }
.card.sunken { background: var(--paper-2); border: 1px dashed var(--line-strong); }

/* --------------------------------------------------------------- buttons - */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font: 600 .95rem var(--font-body);
  color: var(--ink); background: var(--paper-2);
  border: 1px solid var(--line-strong);
  border-radius: 999px; padding: 13px 20px; cursor: pointer;
  transition: transform .15s ease, box-shadow .2s ease, background .2s ease, border-color .2s ease;
  user-select: none; text-decoration: none;
}
.btn:active { transform: scale(.97); }
.btn.primary { background: var(--terra); border-color: var(--terra); color: #FFF; box-shadow: 0 6px 14px rgba(178,77,62,.32); }
.btn.primary:hover { background: var(--terra-deep); }
.btn.outline { background: #fff; border-color: var(--line-strong); color: var(--ink-soft); }
.btn.outline:hover { border-color: var(--terra); color: var(--terra-deep); }
.btn.teal { background: var(--teal); border-color: var(--teal); color: #F4FFFA; }
.btn.gold { background: var(--gold); border-color: var(--gold); color: #3A2B16; }
.btn.ghost { background: transparent; border-color: var(--line-strong); }
.btn.plain { background: transparent; border: none; box-shadow: none; padding: 8px; }
.btn.block { width: 100%; }
.btn.sm { padding: 8px 14px; font-size: .85rem; }
.btn[disabled] { opacity: .5; pointer-events: none; }
.btn.big { padding: 15px 24px; font-size: 1.05rem; }

/* ----------------------------------------------------------------- chips - */
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: .78rem; font-weight: 600; color: var(--ink);
  background: var(--paper-2); border: 1px solid var(--line-strong);
  border-radius: 999px; padding: 6px 12px; cursor: pointer;
  transition: all .15s ease; user-select: none;
}
.chip.on { background: var(--teal); border-color: var(--teal); color: #F1FFFA; }
.chip .dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }

/* ----------------------------------------------------------------- forms - */
.field { margin-bottom: 14px; }
.field label { display: block; font-size: .82rem; font-weight: 600; color: var(--ink); margin-bottom: 6px; }
.field .lab-sub { color: var(--ink-faint); font-weight: 400; }
.field .hint { font-size: .74rem; color: var(--ink-faint); margin-top: 4px; }
.input, .select, .textarea {
  width: 100%; font: 400 1rem var(--font-body); color: var(--ink);
  background: #fff; border: 1px solid var(--field-line);
  border-radius: 10px; padding: 13px 14px; outline: none;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.select { appearance: none; background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='8'><path d='M1 1l5 5 5-5' stroke='%237A6D61' stroke-width='1.6' fill='none' stroke-linecap='round'/></svg>"); background-repeat: no-repeat; background-position: right 14px center; padding-right: 34px; }
.input:focus, .select:focus, .textarea:focus { border-color: var(--terra); box-shadow: 0 0 0 3px rgba(178,77,62,.12); }
.textarea { resize: vertical; min-height: 74px; }
.input::placeholder, .textarea::placeholder { color: var(--ink-faint); }
.chip-row { display: flex; flex-wrap: wrap; gap: 8px; }
.input-money { position: relative; }
.input-money .pre { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--ink-soft); font-weight: 600; }
.input-money .input { padding-left: 30px; }

/* dashed capture area (reference scan form) */
.capture-zone { border: 2px dashed rgba(178,77,62,.45); border-radius: var(--r-lg); padding: 18px; background: var(--paper-2); margin-bottom: 18px; }
.capture-zone .label-top { font-size: .84rem; color: var(--ink-soft); margin-bottom: 12px; font-weight: 600; }
.capture-rows { display: flex; gap: 12px; }
.capture-rows .cam { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 5px; padding: 14px 12px; }
.capture-rows .cam .btn-ico { font-size: 1.3rem; }

/* empty-state photo placeholder — the whole zone invites a tap */
.ph-empty { border-radius: var(--r-md); background: #fff; border: 1px solid var(--line); text-align: center; padding: 30px 16px 26px; cursor: pointer; transition: border-color .15s ease, transform .15s ease; }
.ph-empty:active { transform: scale(.985); border-color: var(--terra); }
.ph-empty .ph-ico { width: 58px; height: 58px; margin: 0 auto 12px; border-radius: 50%; background: var(--terra-soft); color: var(--terra-deep); display: flex; align-items: center; justify-content: center; font-size: 1.5rem; }
.ph-empty .ph-t { font-weight: 700; color: var(--ink); font-size: .95rem; }
.ph-empty .ph-s { font-size: .76rem; color: var(--ink-faint); margin-top: 4px; }

/* form rhythm: consistent 16px field spacing */
.form-card .field { margin-bottom: 16px; }
.form-duo { gap: 14px; }

/* helper hint card (reference "Not sure? …") */
.hint-card { display: flex; align-items: center; gap: 10px; background: var(--paper-2); border: 1px solid var(--line); border-radius: var(--r-md); padding: 12px 14px; color: var(--terra-deep); font-size: .88rem; font-weight: 600; cursor: pointer; margin-bottom: 14px; }
.hint-card .ico { font-size: 1.1rem; display: inline-flex; align-items: center; line-height: 1; flex: none; }

/* results: 2x2 metadata grid (reference) */
.metagrid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 14px; }
.metabox { background: var(--paper-2); border: 1px solid var(--line); border-radius: var(--r-md); padding: 10px 12px; }
.metabox .k { font-size: .62rem; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-faint); margin-bottom: 2px; }
.metabox .v { font-size: .9rem; font-weight: 600; color: var(--ink); line-height: 1.3; }
.metabox .v.okc { color: var(--ok); }

/* score descriptor under ring */
.score-desc { font-weight: 700; font-size: .95rem; letter-spacing: .04em; }
.score-desc.good { color: var(--ok); } .score-desc.mid { color: var(--warn); } .score-desc.bad { color: var(--danger); }

/* deal meter (reference) */
.deal-meter { border: 1px solid rgba(245,124,0,.25); background: var(--peach); border-radius: var(--r-lg); padding: 18px; box-shadow: var(--shadow-sm); }
.deal-meter .dm-head { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.deal-meter .dm-head .x { width: 22px; height: 22px; border-radius: 50%; background: var(--danger); color: #fff; display: inline-flex; align-items: center; justify-content: center; font-size: .72rem; flex: none; }
.deal-meter .dm-head .t { font-family: var(--font-head); font-size: 1.25rem; }
.deal-meter .dm-row { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; border-bottom: 1px dashed rgba(245,124,0,.22); }
.deal-meter .dm-row:last-child { border-bottom: 0; }
.deal-meter .dm-row .k { color: var(--ink-soft); font-size: .84rem; }
.deal-meter .dm-row .val { font-weight: 700; }
.deal-meter .dm-note { font-size: .82rem; color: var(--ink-soft); line-height: 1.5; margin-top: 8px; }

/* trending categories grid (reference home) */
.trendgrid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.trend { background: var(--paper); border: 1px solid var(--line); border-radius: var(--r-md); padding: 12px 6px; text-align: center; box-shadow: var(--shadow-sm); }
.trend .ico { width: 40px; height: 40px; margin: 0 auto 7px; border-radius: 50%; background: var(--paper-2); display: flex; align-items: center; justify-content: center; font-size: 1.15rem; color: var(--terra-deep); }
.trend .t { font-size: .7rem; font-weight: 600; color: var(--ink-soft); }

/* photo hero (results) */
.hero-photo { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; display: block; border-radius: var(--r-lg); }

/* ---------------------------------------------------------- header bars - */
.brandbar { display: flex; align-items: center; justify-content: space-between; padding: 8px 2px 14px; }
.brand { display: flex; flex-direction: column; line-height: 1.05; }
.brand .name { font-family: var(--font-head); font-size: 1.7rem; }
.brand .name em { font-style: italic; color: var(--terra); }
.brand .sub { font-size: .72rem; letter-spacing: .18em; text-transform: uppercase; color: var(--ink-faint); font-weight: 600; }

.token-pill {
  display: inline-flex; align-items: center; gap: 7px;
  background: var(--paper); border: 1px solid var(--line-strong);
  border-radius: 999px; padding: 7px 13px; font-weight: 700; font-size: .92rem;
  box-shadow: var(--shadow-sm); cursor: pointer;
}
.token-pill .coin {
  width: 17px; height: 17px; border-radius: 50%;
  background: radial-gradient(circle at 32% 28%, #F2D488, var(--gold) 62%, #9C6F1B);
  box-shadow: inset 0 -1px 2px rgba(0,0,0,.25); flex: none;
  position: relative;
}
.token-pill .coin::after { content: ""; position: absolute; inset: 4.5px; border-radius: 50%; border: 1px solid #FFF7DE; opacity: .8; }

/* ------------------------------------------------------------ bottom nav - */
.bottom-nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
  height: calc(var(--nav-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  display: flex; justify-content: space-around; align-items: stretch;
  background: rgba(247, 244, 236, .97); backdrop-filter: blur(10px);
  border-radius: 20px 20px 0 0;
  box-shadow: 0 -8px 24px rgba(80, 58, 38, .10);
  max-width: 640px; margin: 0 auto;
}
.nav-btn {
  flex: 1; border: 0; background: transparent; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  color: #A17B57; font: 600 .66rem var(--font-body);
  transition: color .2s ease, transform .15s ease;
  padding: 0 4px;
}
.nav-btn .nav-ico { width: 24px; height: 24px; display: flex; align-items: center; justify-content: center; }
.nav-btn .nav-ico svg { width: 24px; height: 24px; display: block; }
.nav-btn .nav-label { color: #6F6E69; margin-top: 2px; }
.nav-btn.on { color: #E85B3C; }
.nav-btn.on .nav-label { color: #E85B3C; }
.nav-btn.on .nav-ico { transform: translateY(-1px); }

/* ----------------------------------------------------------------- hero  - */
.hero {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--r-xl);
  padding: 24px 22px;
  box-shadow: var(--shadow-sm);
  margin-bottom: 16px; position: relative; overflow: hidden;
}
.hero h1 { font-size: 2.05rem; margin-bottom: .4rem; line-height: 1.12; }
.hero h1 em { font-style: italic; color: var(--terra); }
.hero .tagline { margin-bottom: 20px; font-size: 1rem; }
.hero .stamp { display: inline-block; color: var(--terra-deep); font-weight: 700; letter-spacing: .16em; text-transform: uppercase; font-size: .68rem; margin-bottom: 10px; padding: 4px 9px; border: 1px dashed var(--terra-soft); border-radius: 6px; }

/* home headline block (reference home) */
.home-head { padding: 6px 0 2px; width: 100%; }
.home-head .brand-line { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; }
.logo-block { display: flex; align-items: center; gap: 13px; }
.logo-block .logo-mark { display: block; flex: none; filter: drop-shadow(0 2px 4px rgba(90,48,30,.20)); }
.logo-block .wordmark { display: flex; flex-direction: column; line-height: 1.1; }
.logo-block .wordmark .name { font-family: var(--font-head); font-size: 1.72rem; font-weight: 600; line-height: 1; color: var(--ink); }
.logo-block .wordmark .sub { display: inline-flex; align-items: center; gap: 6px; font-size: .62rem; letter-spacing: .2em; text-transform: uppercase; color: var(--ink-soft); font-weight: 700; margin-top: 4px; }
.home-head .est-line {
  display: inline-flex; align-items: center; gap: 8px;
  font-family: var(--font-head);
  font-size: .62rem; font-weight: 400; letter-spacing: .3em;
  text-transform: uppercase; color: var(--terra);
  margin: 2px 0 14px;
}
.home-head .est-line::after {
  content: ""; width: 40px; height: 1px; background: rgba(178,77,62,.4); flex: none;
}
.home-head .headline { font-size: 2rem; margin: 0 0 10px; line-height: 1.13; font-weight: 400; color: var(--ink-soft); }
.home-head .headline b { color: var(--ink); font-weight: 600; }
.home-cta { display: flex; flex-direction: column; gap: 10px; margin: 20px 0 0; align-items: stretch; }
.cta-row { display: flex; flex-direction: column; gap: 10px; width: 100%; }
.cta-row .btn { width: 100%; }
.hp-caption { color: var(--ink-faint); margin: 4px 0 0; }
.cta-row { display: flex; gap: 10px; }
.cta-row .btn { flex: 1; }
.btn .btn-ico { font-size: 1.05rem; margin-right: 2px; }

/* step cards strip */
.steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 18px; }
.step { background: var(--paper); border: 1px solid var(--line); border-radius: var(--r-md); padding: 12px 10px; text-align: center; box-shadow: var(--shadow-sm); }
.step .n { font-family: var(--font-head); font-size: 1.5rem; color: var(--terra); line-height: 1; }
.step .t { font-size: .74rem; font-weight: 600; margin-top: 5px; }

/* ----------------------------------------------------------- image frames - */
.photo {
  border-radius: var(--r-md); overflow: hidden; position: relative;
  background: var(--paper-deep); border: 1px solid var(--line);
  display: block;
}
.photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo-ratio { aspect-ratio: 4 / 3; }
.polaroid {
  background: #FFFEFA; padding: 10px 10px 16px; border-radius: 8px;
  box-shadow: var(--shadow-md); border: 1px solid var(--line);
}
.polaroid img { border-radius: 4px; display: block; width: 100%; aspect-ratio: 4 / 3; object-fit: cover; }
.polaroid .cap { text-align: center; font-size: .78rem; color: var(--ink-soft); margin-top: 9px; font-weight: 600; }

/* opportunistic score gauge */
.gauge-wrap { display: flex; align-items: center; gap: 18px; }
.gauge { flex: none; width: 128px; height: 128px; }
.gauge .num { font-family: var(--font-head); font-size: 2.1rem; }
.gauge .lbl { font-size: .6rem; letter-spacing: .1em; font-weight: 700; color: var(--ink-soft); }
.gauge .unit { font-size: .8rem; font-weight: 700; color: var(--ink-soft); }

/* rating banner */
.rating .seal {
  width: 74px; height: 74px; border-radius: 50%; flex: none;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  border: 2px solid; text-align: center; font-family: var(--font-head);
}
.rating .seal .big { font-size: 1rem; line-height: 1.05; }
.rating .seal .tiny { font-size: .55rem; letter-spacing: .08em; text-transform: uppercase; font-family: var(--font-body); }
.seal.good { background: #EAF4E6; border-color: var(--ok); color: var(--ok); }
.seal.mid { background: #FBF2DA; border-color: var(--gold); color: #8A6416; }
.seal.bad { background: #F7E6E1; border-color: var(--danger); color: var(--danger); }

/* comparables + lists */
.rows { border-top: 1px solid var(--line); }
.row { display: flex; justify-content: space-between; gap: 14px; padding: 11px 2px; border-bottom: 1px solid var(--line); }
.row .l { min-width: 0; }
.row .l .venue { font-weight: 600; }
.row .l .item { font-size: .78rem; color: var(--ink-soft); }
.row .r { text-align: right; flex: none; }
.price { font-weight: 700; white-space: nowrap; }

/* market range */
.mkt-scale { position: relative; height: 12px; border-radius: 999px; margin: 22px 0 8px;
  background: linear-gradient(90deg, var(--teal-soft), var(--gold-soft), var(--terra-soft)); }
.mkt-scale .tick { position: absolute; top: 50%; width: 2px; height: 16px; background: var(--ink); transform: translateY(-50%); border-radius: 2px; }
.mkt-scale .ask { position: absolute; top: 50%; transform: translate(-50%, -50%); }
.mkt-scale .ask .pin { width: 22px; height: 22px; border-radius: 50%; background: var(--terra); border: 3px solid #FFF; box-shadow: var(--shadow-sm); }
.mkt-scale .ask .cap { position: absolute; top: 26px; left: 50%; transform: translateX(-50%); font-size: .62rem; font-weight: 800; color: var(--terra-deep); white-space: nowrap; text-transform: uppercase; letter-spacing: .02em; }

/* checklist */
.check { display: flex; gap: 10px; padding: 11px 2px; border-bottom: 1px solid var(--line); cursor: pointer; align-items: flex-start; }
.check .box { flex: none; width: 21px; height: 21px; border-radius: 7px; border: 2px solid var(--line-strong); margin-top: 1px; display: flex; align-items: center; justify-content: center; color: transparent; font-size: .8rem; transition: all .15s ease; }
.check.done .box { background: var(--teal); border-color: var(--teal); color: #FFF; }
.check .k { font-size: .82rem; line-height: 1.4; }
.check .k b { display: block; }
.check.done .k { color: var(--ink-soft); text-decoration: line-through; text-decoration-color: rgba(122,103,79,.4); }

/* repurpose idea card */
.idea { overflow: hidden; }
.idea .thumb { aspect-ratio: 16 / 9; }
.idea .diffs { display: flex; gap: 3px; align-items: center; }
.diff { width: 8px; height: 8px; border-radius: 50%; background: var(--paper-deep); border: 1px solid var(--line-strong); }
.diff.on { background: var(--terra); border-color: var(--terra); }
.metarow { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: .78rem; color: var(--ink-soft); margin-top: 8px; }
.metarow b { color: var(--ink); }

.tag { font-size: .68rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; border-radius: 6px; padding: 3px 8px; }
.tag.lock { background: var(--gold-soft); color: #7A5B12; }
.tag.est { background: var(--teal-soft); color: var(--teal-deep); }
.tag.prem { background: var(--terra-soft); color: var(--terra-deep); }

/* -------------------------------------------------------------- toasts ---- */
#toast-wrap { position: fixed; left: 0; right: 0; bottom: calc(var(--nav-h) + 18px); z-index: 60; display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; }
.toast {
  background: #3A2B1D; color: #FDF6E8; font-size: .88rem; font-weight: 600;
  border-radius: 12px; padding: 11px 18px; box-shadow: var(--shadow-lg);
  display: flex; align-items: center; gap: 8px; max-width: 88vw;
  animation: toastIn .35s cubic-bezier(.22,.8,.35,1);
}
.toast .coin-mini { width: 14px; height: 14px; border-radius: 50%; background: var(--gold); flex: none; }
@keyframes toastIn { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }

/* ---------------------------------------------------------------- modal ---- */
.modal-back {
  position: fixed; inset: 0; z-index: 70; display: flex; align-items: center; justify-content: center;
  background: rgba(44, 28, 16, .44); padding: 20px; animation: fadeIn .25s ease; backdrop-filter: blur(2px);
}
.modal {
  width: 100%; max-width: 460px; max-height: 86dvh; overflow: auto;
  background: var(--paper); border-radius: var(--r-xl); box-shadow: var(--shadow-lg);
  animation: popIn .35s cubic-bezier(.22, .8, .35, 1);
  position: relative;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes popIn { from { opacity: 0; transform: translateY(22px) scale(.96); } to { opacity: 1; transform: none; } }

/* ------------------------------------------------------ progress / steps ---- */
.stage-track { display: flex; flex-direction: column; gap: 10px; margin: 6px 0 2px; }
.stage {
  display: flex; align-items: center; gap: 12px; padding: 11px 14px;
  background: var(--paper-2); border: 1px solid var(--line); border-radius: var(--r-md);
  opacity: .42; transition: opacity .3s ease, transform .3s ease;
}
.stage.hot { opacity: 1; transform: translateX(2px); border-color: var(--terra); background: #FFF4EA; }
.stage.done { opacity: .72; }
.stage .ico { width: 30px; height: 30px; border-radius: 50%; display: flex; align-items: center; justify-content: center; background: var(--paper-deep); font-size: .9rem; flex: none; }
.stage.hot .ico { background: var(--terra-soft); }
.stage.done .ico { background: var(--teal-soft); color: var(--teal-deep); }
.stage .t { font-weight: 600; font-size: .9rem; }
.stage .s { font-size: .74rem; color: var(--ink-soft); }

/* scan progress: live mm:ss timer pulses once all four stages are lit,
   so a long analysis never looks like a frozen UI */
.timer.working { color: var(--terra-deep); font-weight: 700; animation: workPulse 1.6s ease-in-out infinite; }
@keyframes workPulse { 0%, 100% { opacity: 1; } 50% { opacity: .45; } }

.spinner { width: 18px; height: 18px; border-radius: 50%; border: 2px solid rgba(255,255,255,.35); border-top-color: #fff; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ------------------------------------------------------- community cards ---- */
.feedcard .bf { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.feedcard .bf .side { position: relative; }
.feedcard .bf .side span { position: absolute; top: 6px; left: 6px; font-size: .6rem; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; color: #fff; background: rgba(56,41,29,.66); padding: 2px 7px; border-radius: 6px; }
.feedcard .meta { display: flex; align-items: center; justify-content: space-between; margin-top: 12px; gap: 10px; }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--terra-soft); color: var(--terra-deep); font-weight: 800; display: inline-flex; align-items: center; justify-content: center; font-size: .82rem; flex: none; }
.you-avatar { background: var(--teal-soft); color: var(--teal-deep); }
.votebtn { display: inline-flex; align-items: center; gap: 6px; }
.votebtn .up { width: 0; height: 0; border-left: 6px solid transparent; border-right: 6px solid transparent; border-bottom: 9px solid currentColor; }
.votebtn.voted { background: var(--teal); border-color: var(--teal); color: #F1FFFA; }

/* challenge banner */
.challenge { border: none; overflow: hidden; background: var(--teal-deep); color: #EAF6F1; }
.challenge .eyebrow { color: #9FD6C6; }
.challenge h2 { color: #FFFDF6; }
.challenge .reward { display: inline-flex; align-items: center; gap: 8px; background: rgba(255,255,255,.12); border-radius: 999px; padding: 7px 13px; font-weight: 700; font-size: .88rem; }
.challenge .btn.gold { background: var(--gold); border-color: var(--gold); color: #362608; }

/* earn card rows */
.earn-row { display: flex; gap: 12px; align-items: center; padding: 10px 2px; border-bottom: 1px solid var(--line); }
.earn-row .ico { width: 36px; height: 36px; border-radius: 12px; display: flex; align-items: center; justify-content: center; font-size: 1rem; flex: none; background: var(--paper-2); }
.earn-row .amt { margin-left: auto; font-weight: 800; color: var(--teal-deep); white-space: nowrap; font-size: .95rem; }

/* section titles */
.sect { display: flex; align-items: baseline; justify-content: space-between; margin: 28px 0 14px; }
.sect h2 { margin: 0; font-size: 1.32rem; }
.sect .more { font-size: .78rem; font-weight: 700; color: var(--terra-deep); cursor: pointer; }

/* scan thumb strip */
.strip { display: flex; gap: 10px; overflow-x: auto; padding-bottom: 6px; scrollbar-width: none; }
.strip::-webkit-scrollbar { display: none; }
.strip .st { flex: none; width: 86px; text-align: center; cursor: pointer; }
.strip .st .photo { aspect-ratio: 1; }
.strip .st .nm { font-size: .68rem; margin-top: 4px; color: var(--ink-soft); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* empty state */
.empty { text-align: center; padding: 34px 16px; color: var(--ink-soft); }
.empty .big { font-family: var(--font-head); font-size: 2.4rem; color: var(--paper-deep); line-height: 1; margin-bottom: 8px; }

/* disclosure note */
.disclosure { font-size: .72rem; color: var(--ink-faint); line-height: 1.45; background: var(--paper-2); border-radius: var(--r-md); padding: 10px 12px; border: 1px dashed var(--line-strong); }

/* skeleton shimmer */
.skel { position: relative; overflow: hidden; background: var(--paper-2); }
.skel::after { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, transparent, rgba(255,255,255,.55), transparent); animation: shimmer 1.3s infinite; }
@keyframes shimmer { from { transform: translateX(-100%); } to { transform: translateX(100%); } }

/* misc */
.row-flex { display: flex; align-items: center; gap: 10px; }
.spread { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.stack > * + * { margin-top: 12px; }
.divider { height: 1px; background: var(--line); margin: 14px 0; }
[hidden] { display: none !important; }
.nowrap { white-space: nowrap; }
.text-center { text-align: center; }
.mt { margin-top: 16px; }
.mb { margin-bottom: 16px; }
.fade-in { animation: viewIn .45s cubic-bezier(.22,.8,.35,1); }

/* tap preview shake for empty fields */
@keyframes shake { 0%,100%{transform:none} 30%{transform:translateX(-4px)} 60%{transform:translateX(4px)} }
.shake { animation: shake .3s ease; }

/* print-friendly seed avatars etc. kept light */
.link { color: var(--teal-deep); font-weight: 600; text-decoration: none; }

/* ============================================================
   Responsive — mobile-first, tuned for phone + tablet + desktop
   ============================================================ */

.idea-grid { display: block; }
.feed-grid { display: block; }
.idea-grid > *, .feed-grid > * { margin-bottom: 0; }

@media (min-width: 560px) {
  .strip .st { width: 112px; }
  .brand .name { font-size: 1.8rem; }
}

@media (min-width: 720px) {
  .view-root { max-width: 940px; padding: 28px 30px calc(var(--nav-h) + env(safe-area-inset-bottom) + 52px); }

  .bottom-nav { max-width: 940px; }
  .nav-btn { min-height: 58px; }

  /* home: stacked full-width content; CTAs fill the container below */
  .home-head .headline { font-size: 2.35rem; }
  .home-head .tagline { font-size: 1.05rem; }
  .home-cta { margin-top: 24px; align-items: center; }
  .cta-row { flex-direction: row; gap: 14px; width: 100%; justify-content: center; }
  .cta-row .btn { flex: 1 1 0; min-width: 0; }

  .trend .ico { width: 46px; height: 46px; }
  .trend .t { font-size: .76rem; }

  /* results sections go 2-up on bigger screens */
  .idea-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
  .feed-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
  .stage-track { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

  .gauge { width: 144px; height: 144px; }

  /* scan form: pair rows into clean 2-up */
  .form-duo { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

  .hero-photo { aspect-ratio: 16/9; max-height: 460px; }
  .scantxt { font-size: .95rem; }
}

@media (min-width: 1024px) {
  .view-root { max-width: 1100px; padding: 32px 34px calc(var(--nav-h) + env(safe-area-inset-bottom) + 56px); }
  .bottom-nav { max-width: 1100px; }
  .home-head .headline { font-size: 2.6rem; }
  .trendgrid { gap: 14px; }
  .card { padding: 22px; }
  .hero-photo { max-height: 520px; }
}
