:root {
  --canvas: #f3f0e8;
  --surface: #fffdf8;
  --surface-strong: #ffffff;
  --ink: #172522;
  --muted: #6f7772;
  --line: #dedbd2;
  --forest: #153f38;
  --forest-soft: #d9e9e3;
  --mint: #a9d2c3;
  --orange: #d45e32;
  --orange-soft: #f5dfd2;
  --gold: #d5a53d;
  --positive: #287c5b;
  --negative: #b94f3c;
  --shadow: 0 14px 40px rgba(25, 44, 39, .08);
  --radius-lg: 24px;
  --radius-md: 16px;
  --radius-sm: 12px;
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--canvas);
}

* { box-sizing: border-box; }
html { background: var(--canvas); }
body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  background:
    radial-gradient(circle at 80% -10%, rgba(169, 210, 195, .42), transparent 34%),
    var(--canvas);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
}
button, input { font: inherit; }
button { -webkit-tap-highlight-color: transparent; }
button:focus-visible { outline: 3px solid rgba(212, 94, 50, .34); outline-offset: 2px; }
button:disabled { opacity: .45; cursor: not-allowed; }

.app-shell { max-width: 760px; min-height: 100vh; margin: 0 auto; padding-bottom: 104px; }
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: calc(16px + env(safe-area-inset-top)) 20px 16px;
}
.brand { display: flex; gap: 12px; align-items: center; }
.brand-mark {
  display: grid; place-items: center; width: 40px; height: 40px; border-radius: 14px;
  color: #fff; background: var(--forest); font: 700 20px/1 Georgia, serif;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.14);
}
.brand strong { display: block; font-size: 15px; font-weight: 650; margin-top: 3px; }
.eyebrow {
  display: block; color: var(--muted); font-size: 10px; line-height: 1.2;
  letter-spacing: .14em; font-weight: 650;
}
.eyebrow.light { color: rgba(255,255,255,.66); }
.icon-button {
  width: 40px; height: 40px; border: 1px solid var(--line); border-radius: 14px;
  background: rgba(255,255,255,.62); color: var(--ink); cursor: pointer;
  transition: transform .18s ease, background .18s ease;
}
.icon-button:hover { background: var(--surface); }
.icon-button:active { transform: scale(.94); }
.icon-button svg { width: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.icon-button.loading svg { animation: spin .8s linear infinite; }

main { padding: 0 16px; }
.screen { display: none; animation: screen-in .24s ease both; }
.screen.active { display: block; }
.status-row { display: flex; justify-content: space-between; align-items: center; margin: 4px 4px 12px; }
.status-pill, .fact-badge, .count-badge {
  display: inline-flex; align-items: center; min-height: 24px; padding: 4px 9px;
  border-radius: 999px; font-size: 11px; font-weight: 650;
}
.status-pill { color: var(--positive); background: #dcece3; }
.status-pill.stale { color: var(--negative); background: #f7ded7; }
.quiet-label { color: var(--muted); font-size: 12px; }

.hero-card {
  position: relative; overflow: hidden; display: grid; grid-template-columns: 1fr 1.05fr;
  gap: 16px; align-items: end; min-height: 174px; padding: 24px;
  border-radius: 28px; color: #fff; background:
    linear-gradient(140deg, rgba(255,255,255,.03), rgba(255,255,255,0)),
    var(--forest);
  box-shadow: var(--shadow);
}
.hero-card::after {
  content: ""; position: absolute; width: 180px; height: 180px; right: -70px; top: -95px;
  border: 1px solid rgba(255,255,255,.1); border-radius: 50%;
}
.hero-number { margin-top: 8px; font-size: 40px; line-height: .98; font-weight: 650; letter-spacing: -.04em; }
.hero-caption { margin-top: 8px; color: rgba(255,255,255,.72); font-size: 13px; }
.sparkline { min-height: 84px; align-self: center; }
.sparkline svg, .growth-chart svg { width: 100%; height: 100%; overflow: visible; }

.section-heading { display: flex; justify-content: space-between; align-items: end; gap: 16px; margin: 32px 4px 14px; }
.section-heading h1, .section-heading h2, .method-card h2, .instruction-card h2 {
  margin: 5px 0 0; font-size: 21px; line-height: 1.15; font-weight: 650; letter-spacing: -.025em;
}
.section-heading h2, .method-card h2, .instruction-card h2 { font-size: 18px; }
.sticky-heading { position: sticky; top: 0; z-index: 5; padding: 12px 0 8px; margin-top: 0; background: linear-gradient(var(--canvas) 82%, transparent); }
.text-button {
  padding: 6px 0; border: 0; color: var(--orange); background: transparent; cursor: pointer; font-weight: 650;
}
.text-button:hover { color: #a94425; }
.text-button:active { transform: translateY(1px); }
.confidence-key { color: var(--muted); font-size: 11px; }
.count-badge { color: var(--forest); background: var(--forest-soft); }

.metric-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 10px; }
.metric-card {
  min-height: 110px; padding: 16px; border: 1px solid rgba(222,219,210,.8);
  border-radius: var(--radius-md); background: rgba(255,253,248,.86);
}
.metric-label { color: var(--muted); font-size: 12px; }
.metric-value { display: block; margin-top: 13px; font-size: 25px; line-height: 1; font-weight: 650; letter-spacing: -.035em; }
.metric-note { display: block; margin-top: 8px; color: var(--muted); font-size: 11px; }

.stack-list, .evidence-list { display: grid; gap: 10px; }
.action-card, .evidence-card, .notice-card, .method-card, .instruction-card, .data-score-card, .source-list {
  border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--surface);
}
.action-card {
  display: grid; grid-template-columns: 36px 1fr auto; gap: 12px; align-items: center; padding: 14px;
  cursor: pointer; transition: transform .18s ease, border-color .18s ease, box-shadow .18s ease;
}
.action-card:hover { border-color: var(--mint); box-shadow: 0 8px 24px rgba(25,44,39,.06); }
.action-card:active { transform: scale(.985); }
.action-icon { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 12px; color: var(--forest); background: var(--forest-soft); }
.action-card[data-priority="content"] .action-icon { color: #9a3f20; background: var(--orange-soft); }
.action-copy strong { display: block; font-size: 14px; font-weight: 650; }
.action-copy p { margin: 4px 0 0; color: var(--muted); font-size: 12px; line-height: 1.4; }
.action-arrow { color: var(--muted); }

.horizontal-list { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(222px, 76%); gap: 12px; overflow-x: auto; scroll-snap-type: x mandatory; padding: 2px 2px 12px; scrollbar-width: none; }
.horizontal-list::-webkit-scrollbar, .filter-scroll::-webkit-scrollbar { display: none; }
.leader-card {
  scroll-snap-align: start; padding: 18px; border-radius: 20px; color: #fff;
  background: linear-gradient(145deg, #25554c, #133832); cursor: pointer;
  transition: transform .18s ease;
}
.leader-card:nth-child(2n) { background: linear-gradient(145deg, #b9522d, #8c3a20); }
.leader-card:active { transform: scale(.975); }
.leader-rank { color: rgba(255,255,255,.64); font-size: 11px; }
.leader-card h3 { min-height: 42px; margin: 20px 0 18px; font-size: 15px; line-height: 1.35; font-weight: 650; }
.leader-metrics { display: flex; gap: 16px; }
.leader-metrics span { color: rgba(255,255,255,.7); font-size: 10px; }
.leader-metrics strong { display: block; margin-top: 3px; color: #fff; font-size: 14px; }

.filter-scroll { display: flex; gap: 8px; overflow-x: auto; margin: 0 -16px 14px; padding: 0 16px 8px; scrollbar-width: none; }
.filter-chip {
  flex: 0 0 auto; padding: 9px 13px; border: 1px solid var(--line); border-radius: 999px;
  color: var(--muted); background: var(--surface); cursor: pointer;
  transition: color .18s ease, background .18s ease, transform .18s ease;
}
.filter-chip:hover { border-color: var(--mint); color: var(--forest); }
.filter-chip:active { transform: scale(.96); }
.filter-chip.active { border-color: var(--forest); color: #fff; background: var(--forest); }
.reels-list { display: grid; gap: 10px; }
.reel-row {
  display: grid; grid-template-columns: 54px minmax(0,1fr) auto; gap: 12px; align-items: center;
  padding: 12px; border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--surface);
  cursor: pointer; transition: transform .18s ease, border-color .18s ease;
}
.reel-row:hover { border-color: var(--mint); }
.reel-row:active { transform: scale(.99); }
.reel-thumb {
  display: grid; place-items: center; width: 54px; height: 64px; border-radius: 12px;
  color: rgba(255,255,255,.8); background: linear-gradient(145deg, var(--forest), #2e665d);
  font-size: 18px;
}
.reel-copy { min-width: 0; }
.reel-copy h3 { overflow: hidden; margin: 0; font-size: 13px; font-weight: 650; line-height: 1.35; text-overflow: ellipsis; white-space: nowrap; }
.reel-copy p { margin: 6px 0 0; color: var(--muted); font-size: 11px; }
.reel-kpi { text-align: right; }
.reel-kpi strong { display: block; font-size: 14px; }
.reel-kpi span { color: var(--muted); font-size: 10px; }
.metric-tags { display: flex; gap: 5px; margin-top: 8px; }
.metric-tag { padding: 3px 6px; border-radius: 6px; color: var(--muted); background: #efede6; font-size: 9px; }
.metric-tag.strong { color: var(--positive); background: #dcece3; }
.metric-tag.weak { color: var(--negative); background: #f7ded7; }

.chart-card { padding: 20px; border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--surface); box-shadow: var(--shadow); }
.chart-meta { display: flex; justify-content: space-between; align-items: start; }
.chart-total { display: block; margin-top: 6px; font-size: 32px; font-weight: 650; letter-spacing: -.04em; }
.fact-badge { color: var(--positive); background: #dcece3; }
.growth-chart { height: 210px; margin-top: 24px; }
.notice-card { display: grid; grid-template-columns: 28px 1fr; gap: 10px; margin-top: 12px; padding: 14px; }
.notice-icon { display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; color: #fff; background: var(--forest); font-size: 12px; font-weight: 650; }
.notice-card p { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.5; }
.notice-card strong { color: var(--ink); }

.screen-intro { margin: -4px 4px 18px; color: var(--muted); font-size: 13px; line-height: 1.5; }
.evidence-card { padding: 18px; }
.evidence-top { display: flex; justify-content: space-between; gap: 12px; }
.evidence-card h3 { margin: 0; font-size: 15px; font-weight: 650; }
.confidence { flex: 0 0 auto; padding: 4px 8px; border-radius: 999px; font-size: 9px; text-transform: uppercase; letter-spacing: .08em; }
.confidence.high { color: var(--positive); background: #dcece3; }
.confidence.medium { color: #8a651a; background: #f5e9c8; }
.evidence-statement { margin: 14px 0 8px; font-size: 14px; line-height: 1.45; }
.evidence-proof { margin: 0; padding-left: 12px; border-left: 2px solid var(--mint); color: var(--muted); font-size: 12px; line-height: 1.5; }
.evidence-sample { display: block; margin-top: 12px; color: var(--muted); font-size: 10px; }
.method-card, .instruction-card { margin-top: 20px; padding: 20px; }
.method-card ul { margin: 14px 0 0; padding-left: 18px; color: var(--muted); font-size: 12px; line-height: 1.65; }

.data-score-card { display: grid; grid-template-columns: 88px 1fr; gap: 16px; align-items: center; padding: 18px; }
.data-score-card h2 { margin: 0; font-size: 17px; font-weight: 650; }
.data-score-card p { margin: 6px 0 0; color: var(--muted); font-size: 12px; line-height: 1.4; }
.ring { --coverage: 0%; display: grid; place-items: center; width: 80px; height: 80px; border-radius: 50%; background: conic-gradient(var(--forest) var(--coverage), #e5e1d8 0); position: relative; }
.ring::before { content: ""; position: absolute; inset: 8px; border-radius: 50%; background: var(--surface); }
.ring span { position: relative; font-size: 15px; font-weight: 650; }
.source-list { margin-top: 12px; overflow: hidden; }
.source-row { display: grid; grid-template-columns: 10px 1fr auto; gap: 12px; align-items: center; padding: 15px 16px; border-bottom: 1px solid var(--line); }
.source-row:last-child { border-bottom: 0; }
.source-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--forest); }
.source-dot.exact { background: var(--orange); }
.source-dot.ocr { background: var(--gold); }
.source-row strong { font-size: 13px; font-weight: 650; }
.source-row p { margin: 3px 0 0; color: var(--muted); font-size: 10px; line-height: 1.35; }
.source-state { color: var(--muted); font-size: 9px; }
.instruction-card p { margin: 12px 0; color: var(--muted); font-size: 12px; }
code { padding: 3px 6px; border-radius: 6px; color: var(--forest); background: var(--forest-soft); }
.primary-button {
  width: 100%; min-height: 46px; margin-top: 10px; border: 0; border-radius: 14px;
  color: #fff; background: var(--forest); cursor: pointer; font-weight: 650;
  transition: background .18s ease, transform .18s ease;
}
.primary-button:hover { background: #0d332d; }
.primary-button:active { transform: scale(.985); }

.bottom-nav {
  position: fixed; z-index: 20; left: 50%; bottom: 0; transform: translateX(-50%);
  display: grid; grid-template-columns: repeat(5, 1fr); width: min(760px,100%);
  padding: 8px 8px calc(8px + env(safe-area-inset-bottom));
  border-top: 1px solid rgba(222,219,210,.82); background: rgba(255,253,248,.94);
  backdrop-filter: blur(18px);
}
.nav-item {
  display: grid; place-items: center; gap: 2px; min-height: 52px; border: 0; border-radius: 12px;
  color: var(--muted); background: transparent; cursor: pointer; font-size: 9px;
  transition: color .18s ease, background .18s ease, transform .18s ease;
}
.nav-item:hover { color: var(--forest); background: rgba(217,233,227,.5); }
.nav-item:active { transform: scale(.94); }
.nav-item.active { color: var(--forest); font-weight: 650; }
.nav-icon { font-size: 20px; line-height: 1; }

.sheet-backdrop { position: fixed; z-index: 50; inset: 0; display: flex; align-items: end; justify-content: center; background: rgba(14,32,28,.42); backdrop-filter: blur(4px); }
.sheet-backdrop[hidden] { display: none; }
.detail-sheet {
  position: relative; width: min(760px,100%); max-height: 88vh; overflow-y: auto;
  padding: 24px 18px calc(28px + env(safe-area-inset-bottom)); border-radius: 28px 28px 0 0;
  background: var(--surface); animation: sheet-up .25s ease both;
}
.sheet-handle { width: 42px; height: 4px; margin: -10px auto 18px; border-radius: 999px; background: var(--line); }
.sheet-close { position: absolute; top: 14px; right: 16px; width: 34px; height: 34px; border: 0; border-radius: 50%; color: var(--ink); background: #efede6; cursor: pointer; font-size: 22px; }
.detail-title { max-width: 86%; margin: 8px 0; font-size: 21px; line-height: 1.25; font-weight: 650; }
.detail-date { color: var(--muted); font-size: 11px; }
.detail-grid { display: grid; grid-template-columns: repeat(2,1fr); gap: 8px; margin-top: 20px; }
.detail-metric { padding: 14px; border-radius: 14px; background: #f3f0e8; }
.detail-metric span { color: var(--muted); font-size: 10px; }
.detail-metric strong { display: block; margin-top: 8px; font-size: 19px; font-weight: 650; }
.benchmark { margin-top: 20px; }
.benchmark-row { display: grid; grid-template-columns: 90px 1fr 38px; gap: 10px; align-items: center; margin: 12px 0; font-size: 11px; }
.benchmark-track { height: 7px; overflow: hidden; border-radius: 999px; background: #e6e2d9; }
.benchmark-fill { height: 100%; border-radius: inherit; background: var(--forest); }
.detail-proof { margin-top: 20px; padding: 16px; border-radius: 14px; background: var(--forest-soft); }
.detail-proof h3 { margin: 0; font-size: 14px; font-weight: 650; }
.detail-proof p { margin: 8px 0 0; color: #315c53; font-size: 12px; line-height: 1.5; }

.loading-state, .error-state {
  position: fixed; z-index: 100; inset: 0; display: grid; place-content: center; justify-items: center;
  padding: 28px; text-align: center; background: var(--canvas);
}
.loading-state[hidden], .error-state[hidden] { display: none; }
.loading-state strong, .error-state h1 { margin: 20px 0 0; font-size: 20px; font-weight: 650; }
.loading-state p, .error-state p { margin: 8px 0 0; color: var(--muted); font-size: 13px; }
.loader { width: 38px; height: 38px; border: 3px solid var(--forest-soft); border-top-color: var(--forest); border-radius: 50%; animation: spin .8s linear infinite; }
.error-mark { display: grid; place-items: center; width: 54px; height: 54px; border-radius: 18px; color: #fff; background: var(--orange); font-size: 28px; font-weight: 650; }
.error-state .primary-button { max-width: 240px; margin-top: 20px; }

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes screen-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes sheet-up { from { transform: translateY(30%); opacity: .5; } to { transform: none; opacity: 1; } }

@media (min-width: 640px) {
  main { padding: 0 24px; }
  .topbar { padding-left: 28px; padding-right: 28px; }
  .metric-grid { grid-template-columns: repeat(4,1fr); }
  .horizontal-list { grid-auto-columns: 280px; }
  .detail-grid { grid-template-columns: repeat(4,1fr); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
