:root {
  --bg: #F1F3EB;
  --surface: #FFFFFB;
  --white: #FFFFFF;
  --ink: #1F2A22;
  --ink-2: #435047;
  --ink-3: #4A574D;
  --line: #D9DED0;
  --line-2: #BFC7B4;
  --line-3: #E3E7DB;
  --hover: #E4E8DC;
  --seg: #E1E6D8;
  --bubble: #E6EADF;
  --muted-btn: #7E8A7F;
  --track-off: #9AA392;
  --accent: oklch(0.42 0.07 150);
  --accent-hover: oklch(0.37 0.07 150);
  --accent-ink: oklch(0.34 0.06 150);
  --accent-soft: oklch(0.93 0.035 150);
  --accent-softer: oklch(0.95 0.025 150);
  --accent-deep: oklch(0.28 0.05 150);
  --scrim: rgba(24, 36, 28, .38);
  --font: 'Atkinson Hyperlegible', sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: var(--bg); font-family: var(--font); color: var(--ink); -webkit-font-smoothing: antialiased; }
button, input, textarea { font-family: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--accent); }
a:hover { color: var(--accent-hover); }
input::placeholder, textarea::placeholder { color: #5E6A60; }
h1, h2, h3, p { margin: 0; }

.app { position: relative; height: 100dvh; display: flex; flex-direction: column; background: var(--bg); overflow: clip; }
.wrap { max-width: 912px; margin: 0 auto; }
.narrow { max-width: 752px; margin: 0 auto; }

/* Buttons */
.ghost { min-height: 48px; padding: 0 16px; background: none; border: none; border-radius: 10px; font: 700 17px var(--font); color: var(--ink); display: flex; align-items: center; gap: 10px; }
.ghost:hover { background: var(--hover); }
.ghost.accent { color: var(--accent); }
.primary { min-height: 50px; padding: 0 20px; border: none; border-radius: 12px; background: var(--accent); color: var(--surface); font: 700 17px var(--font); }
.primary:hover:not(:disabled) { background: var(--accent-hover); }
.primary.off { background: var(--muted-btn); }
.primary:disabled { background: #A3ADA1; cursor: default; }
.outline { min-height: 48px; padding: 0 18px; border: 1.5px solid var(--line-2); border-radius: 12px; background: var(--surface); font: 700 17px var(--font); }
.outline:hover { background: var(--bg); }
.link-btn { align-self: flex-start; min-height: 44px; padding: 0 2px; background: none; border: none; font: 700 17px var(--font); color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }
.back-chev { width: 10px; height: 10px; border-left: 2.5px solid var(--ink); border-bottom: 2.5px solid var(--ink); transform: rotate(45deg); }
.chev { flex: none; width: 9px; height: 9px; border-top: 2px solid var(--ink-3); border-right: 2px solid var(--ink-3); transform: rotate(45deg); margin-right: 6px; }

/* Header */
.header { position: relative; z-index: 30; background: var(--bg); }
.topbar { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; padding: 10px 4px 2px; }
.topbar h1 { font: 700 24px var(--font); }
.topbar .ghost:first-child { justify-self: start; }
.topbar .ghost:last-child { justify-self: end; }
.bars { transition: height .25s ease, opacity .2s ease; height: 128px; }
.bars.hidden { height: 0; opacity: 0; overflow: hidden; }
.bars-inner { padding: 8px 16px 0; }
.searchrow { position: relative; height: 48px; max-width: 600px; }
.closed-row { position: absolute; inset: 0; z-index: 1; display: flex; align-items: center; justify-content: space-between; }
.filter-btn { width: 75%; height: 48px; padding: 0 16px; display: flex; align-items: center; justify-content: space-between; gap: 10px; background: var(--surface); border: 1.5px solid var(--line-2); border-radius: 12px; font: 700 17px var(--font); }
.filter-btn.open { background: var(--bubble); border-color: var(--accent); }
.badge { min-width: 26px; height: 26px; padding: 0 8px; border-radius: 999px; background: var(--accent); color: var(--surface); font: 700 14px var(--font); display: inline-flex; align-items: center; justify-content: center; }
.caret { width: 0; height: 0; border-left: 5px solid transparent; border-right: 5px solid transparent; border-top: 6px solid var(--ink); transition: transform .2s; }
.open .caret { transform: rotate(180deg); }
.search-btn { flex: 1; justify-content: center; }
.open-row { position: absolute; inset: 0; display: flex; align-items: center; gap: 4px; opacity: 0; pointer-events: none; }
.open-row.on { opacity: 1; pointer-events: auto; }
.open-row input { flex: 1; min-width: 0; height: 48px; padding: 0 16px; border: 2px solid var(--accent); border-radius: 12px; background: var(--white); font: 400 17px var(--font); outline: none; }
.open-row button { height: 48px; padding: 0 6px 0 10px; background: none; border: none; font: 700 17px var(--font); color: var(--accent); }

.filter-panel { position: absolute; top: 56px; left: 0; width: 100%; z-index: 31; display: flex; flex-direction: column; max-height: min(64dvh, 560px); background: var(--surface); border: 1.5px solid var(--line-2); border-radius: 16px; box-shadow: 0 12px 32px rgba(24,36,28,.18); overflow: hidden; }
.fp-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 12px 10px 18px; gap: 12px; min-height: 64px; }
.fp-head h2 { font: 700 19px var(--font); }
.fp-head button { min-height: 40px; padding: 0 10px; background: none; border: none; font: 700 16px var(--font); color: var(--accent); }
.local-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin: 0 10px; padding: 12px 10px; min-height: 64px; background: var(--bg); border: none; border-radius: 12px; text-align: left; }
.local-row.on { background: var(--accent-softer); }
.local-row b { display: block; font: 700 18px var(--font); }
.local-row small { display: block; font: 400 15px var(--font); color: var(--ink-2); margin-top: 2px; }
.switch { flex: none; width: 52px; height: 32px; border-radius: 999px; background: var(--track-off); position: relative; transition: background .2s; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 26px; height: 26px; border-radius: 50%; background: var(--white); box-shadow: 0 1px 3px rgba(0,0,0,.25); transition: transform .2s; }
.switch.on { background: var(--accent); }
.switch.on::after { transform: translateX(20px); }
.divider { height: 1px; background: var(--line); margin: 12px 0 0; }
.eyebrow { font: 700 14px var(--font); letter-spacing: .06em; text-transform: uppercase; color: var(--ink-2); }
.fp-eyebrow { padding: 14px 20px 6px; }
.cat-grid { flex: 1; min-height: 0; overflow: auto; padding: 0 10px 10px; display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); align-content: start; gap: 2px; }
.cat { display: flex; align-items: center; gap: 14px; min-height: 48px; padding: 6px 10px; background: transparent; border: none; border-radius: 10px; text-align: left; font: 400 17px/1.25 var(--font); }
.cat.on { background: var(--accent-softer); font-weight: 700; }
.box { flex: none; width: 24px; height: 24px; border-radius: 6px; border: 2px solid var(--muted-btn); background: var(--white); display: flex; align-items: center; justify-content: center; color: var(--surface); font: 700 16px/1 var(--font); }
.cat.on .box { border-color: var(--accent); background: var(--accent); }
.fp-foot { padding: 10px 12px 12px; border-top: 1px solid var(--line); background: var(--surface); }
.fp-foot .primary { width: 100%; }

.viewbar { padding: 12px 16px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.seg { display: flex; background: var(--seg); border-radius: 12px; padding: 4px; gap: 4px; }
.seg button { min-height: 40px; padding: 0 18px; border: none; border-radius: 9px; background: transparent; font: 400 15px var(--font); }
.seg button.on { background: var(--surface); box-shadow: 0 1px 2px rgba(30,50,30,.14); font-weight: 700; }
.result-count { font: 400 16px var(--font); color: var(--ink-2); }
.filter-scrim { position: absolute; inset: 0; z-index: 20; background: rgba(24,36,28,.14); }

/* List */
.list-scroll { flex: 1; min-height: 0; overflow: auto; }
.list-inner { padding: 0 16px 40px; }
.tiles { display: flex; flex-direction: column; gap: 12px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(164px, 1fr)); gap: 10px; }
.card { width: 100%; text-align: left; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 18px; display: flex; flex-direction: column; gap: 8px; }
.card:hover { border-color: #9FAA95; }
.card-title { font: 700 20px/1.25 var(--font); }
.card-meta { display: flex; justify-content: space-between; align-items: center; gap: 12px; font: 700 15px var(--font); }
.card-desc { font: 400 16px/1.45 var(--font); color: var(--ink-2); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.pill { align-self: flex-start; padding: 5px 10px; border-radius: 999px; background: var(--accent-soft); color: var(--accent-ink); font: 700 14px var(--font); }
.grid .card { border-radius: 14px; padding: 14px; }
.grid .card-title { font-size: 17px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.grid .card-desc { font-size: 15px; line-height: 1.4; -webkit-line-clamp: 3; }
.grid .pill { padding: 4px 8px; border-radius: 8px; line-height: 1.25; }
.stats { flex: none; display: flex; gap: 16px; align-items: center; font: 700 15px var(--font); }
.grid .stats { margin-top: auto; gap: 14px; }
.stat { display: flex; gap: 6px; align-items: center; }
.up { width: 0; height: 0; border-left: 6px solid transparent; border-right: 6px solid transparent; border-bottom: 8px solid var(--accent); }
.play { width: 20px; height: 20px; border: 1.5px solid var(--ink-3); border-radius: 50%; display: flex; align-items: center; justify-content: center; }
.play::after { content: ""; width: 0; height: 0; margin-left: 2px; border-top: 4px solid transparent; border-bottom: 4px solid transparent; border-left: 6px solid var(--ink-3); }
.empty { padding: 32px 4px; display: flex; flex-direction: column; align-items: flex-start; gap: 10px; }
.empty h2 { font: 700 20px var(--font); }
.empty p { font: 400 17px/1.45 var(--font); color: var(--ink-2); }

/* Sliding pages */
.page { position: absolute; inset: 0; background: var(--bg); display: flex; flex-direction: column; transform: translateX(100%); visibility: hidden; transition: transform .3s ease, visibility .3s; }
.page.on { transform: translateX(0); visibility: visible; }
.page.detail { z-index: 50; }
.page.sub { z-index: 70; }
.page-head { flex: none; border-bottom: 1px solid var(--line); }
.page-head .narrow { padding: 10px 4px 6px; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; }
.page-head .ghost { justify-self: start; }
.page-head h2 { font: 700 24px var(--font); }
.page-body { flex: 1; min-height: 0; overflow: auto; }
.page-body > .narrow { padding: 28px 20px 40px; display: flex; flex-direction: column; gap: 20px; }
.page-body p.lead { font: 400 18px/1.55 var(--font); text-wrap: pretty; }

/* Detail */
.detail-article { max-width: 752px; margin: 0 auto; padding: 20px 20px 56px; display: flex; flex-direction: column; gap: 22px; }
.photo { aspect-ratio: 16/9; border-radius: 16px; background: repeating-linear-gradient(135deg, var(--seg) 0 10px, #EAEDE3 10px 20px); display: flex; align-items: center; justify-content: center; font: 400 14px 'Atkinson Hyperlegible Mono', monospace; color: var(--ink-2); }
.detail-title { display: flex; flex-direction: column; gap: 12px; }
.detail-title .pill { padding: 5px 12px; font-size: 15px; }
.detail-title h2 { font: 700 30px/1.2 var(--font); text-wrap: balance; }
.facts { display: flex; flex-wrap: wrap; align-items: stretch; gap: 10px; }
.fact { flex: 1 1 100px; padding: 12px 16px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; display: flex; flex-direction: column; gap: 2px; text-align: left; }
.fact small { font: 400 15px var(--font); color: var(--ink-2); }
.fact b { font: 700 19px var(--font); }
.vote { flex: 1 1 140px; flex-direction: row; align-items: center; gap: 12px; border: 2px solid var(--accent); color: var(--accent-ink); transition: background .2s, transform .15s; }
.vote small, .vote b { color: inherit; }
.vote .tri { width: 0; height: 0; border-left: 9px solid transparent; border-right: 9px solid transparent; border-bottom: 12px solid currentColor; }
.vote .col { display: flex; flex-direction: column; gap: 2px; }
.vote.on { background: var(--accent); color: var(--surface); }
.vote.bump { transform: scale(1.04); }
.body-text { display: flex; flex-direction: column; gap: 10px; }
.body-text p { font: 400 18px/1.6 var(--font); text-wrap: pretty; }
.body-text p.source { font: 400 15px/1.45 var(--font); color: var(--ink-2); }
.section { display: flex; flex-direction: column; gap: 10px; }
.section .eyebrow { font-size: 15px; }
.section .value { font: 400 18px/1.45 var(--font); }
.visit { align-self: flex-start; min-height: 50px; padding: 0 20px; display: flex; align-items: center; gap: 10px; border-radius: 12px; background: var(--accent); color: var(--surface); text-decoration: none; font: 700 17px var(--font); }
.visit:hover { color: var(--surface); background: var(--accent-hover); }
.visit::after { content: ""; width: 9px; height: 9px; border-top: 2.5px solid var(--surface); border-right: 2.5px solid var(--surface); }
.hint { font: 400 15px var(--font); color: var(--ink-2); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { padding: 7px 12px; border-radius: 999px; border: 1.5px solid var(--line-2); background: var(--surface); font: 700 16px var(--font); }
.h3 { font: 700 22px var(--font); }
.video { display: flex; gap: 14px; align-items: flex-start; padding: 10px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; }
.thumb { flex: none; width: 128px; aspect-ratio: 16/10; border-radius: 10px; display: flex; align-items: center; justify-content: center; background: repeating-linear-gradient(135deg, var(--seg) 0 8px, #EAEDE3 8px 16px); }
.thumb.audio { background: #D5D9D1; font: 700 15px var(--font); }
.thumb .btn { width: 36px; height: 36px; border-radius: 50%; background: rgba(255,255,251,.92); border: 1.5px solid var(--ink); display: flex; align-items: center; justify-content: center; }
.thumb .btn::after { content: ""; width: 0; height: 0; margin-left: 3px; border-top: 7px solid transparent; border-bottom: 7px solid transparent; border-left: 11px solid var(--ink); }
.video-text { min-width: 0; display: flex; flex-direction: column; gap: 4px; padding-top: 2px; }
.video-text b { font: 700 17px/1.3 var(--font); }
.video-text span { font: 400 15px/1.4 var(--font); color: var(--ink-2); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.comments { display: flex; flex-direction: column; gap: 14px; padding-top: 10px; border-top: 1px solid var(--line); }
.comments-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-top: 12px; }
.tag { padding: 5px 10px; border-radius: 8px; background: var(--seg); font: 700 14px var(--font); }
.comments > p { font: 400 16px/1.5 var(--font); color: var(--ink-2); }
.comment { padding: 14px 16px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; display: flex; flex-direction: column; gap: 6px; }
.comment-top { display: flex; justify-content: space-between; gap: 12px; align-items: baseline; }
.comment-top b { font: 700 16px var(--font); }
.comment-top span { font: 400 15px var(--font); color: var(--ink-2); }
.comment p { font: 400 17px/1.5 var(--font); }
.field { display: flex; flex-direction: column; gap: 10px; }
.field label { font: 700 16px var(--font); }
.textarea, .text-input { width: 100%; padding: 14px 16px; border: 1.5px solid var(--line-2); border-radius: 12px; background: var(--white); font: 400 17px/1.45 var(--font); resize: vertical; outline-color: var(--accent); }
.text-input { height: 52px; padding: 0 16px; font-size: 18px; }
.field .primary { align-self: flex-start; min-height: 48px; }
.notice { padding: 14px 16px; border-radius: 12px; background: var(--accent-soft); font: 400 17px/1.45 var(--font); color: var(--accent-deep); }
.labeled { display: flex; flex-direction: column; gap: 6px; }
.labeled span { font: 400 15px var(--font); color: var(--ink-2); padding-left: 4px; }
.select { width: 100%; height: 52px; padding: 0 16px; display: flex; align-items: center; justify-content: space-between; border: 1.5px solid var(--line-2); border-radius: 12px; background: var(--white); font: 400 18px var(--font); }
.select::after { content: ""; width: 0; height: 0; border-left: 6px solid transparent; border-right: 6px solid transparent; border-top: 7px solid var(--ink); }

/* Drawers */
.scrim { position: absolute; inset: 0; z-index: 60; background: var(--scrim); opacity: 0; pointer-events: none; transition: opacity .25s ease; }
.scrim.on { opacity: 1; pointer-events: auto; }
.drawer { position: absolute; top: 0; bottom: 0; z-index: 61; background: var(--surface); display: flex; flex-direction: column; visibility: hidden; transition: transform .28s ease, visibility .28s; }
.drawer.on { transform: translateX(0); visibility: visible; }
.drawer.menu { left: 0; width: min(85%, 420px); box-shadow: 8px 0 24px rgba(24,36,28,.16); transform: translateX(-100%); }
.drawer.help { right: 0; width: min(85%, 484px); box-shadow: -8px 0 24px rgba(24,36,28,.16); transform: translateX(100%); }
.drawer.on { transform: translateX(0); }
.drawer-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 8px 8px 20px; }
.drawer.help .drawer-head { border-bottom: 1px solid var(--line-3); }
.drawer-head h2 { font: 700 22px var(--font); }
.drawer-head .close { min-height: 48px; padding: 0 12px; background: none; border: none; font: 700 17px var(--font); color: var(--accent); }
.brand { display: flex; align-items: center; gap: 6px; }
.brand img { display: block; width: 46px; height: 46px; margin-left: -6px; border-radius: 8px; }
.menu-body { flex: 1; min-height: 0; overflow: auto; padding: 8px 12px 24px; display: flex; flex-direction: column; gap: 22px; }
.menu-group { display: flex; flex-direction: column; gap: 4px; }
.menu-group > .eyebrow { padding: 0 8px 6px; }
.menu-row { min-height: 56px; padding: 0 8px; display: flex; align-items: center; justify-content: space-between; gap: 12px; background: none; border: none; border-bottom: 1px solid var(--line-3); font: 400 18px var(--font); text-align: left; white-space: nowrap; }
.menu-row:hover { background: var(--bg); }
.menu-row .value { display: flex; align-items: center; gap: 10px; font: 700 17px var(--font); }
.font-row { padding: 10px 8px 14px; display: flex; flex-direction: column; gap: 10px; border-bottom: 1px solid var(--line-3); font: 400 18px var(--font); }
.font-row .seg button { flex: 1; min-height: 44px; font-weight: 700; }
.menu-foot { flex: none; padding: 14px 20px 18px; display: flex; align-items: center; gap: 24px; border-top: 1px solid var(--line); background: var(--surface); box-shadow: 0 -6px 14px rgba(24,36,28,.06); }
.menu-foot .outline { min-height: 52px; padding: 0 16px; }
.menu-foot .link-btn { margin-left: auto; align-self: center; }

/* Help chat */
.thread { flex: 1; min-height: 0; overflow: auto; padding: 16px 14px 20px; display: flex; flex-direction: column; gap: 14px; }
.bot { align-self: flex-start; max-width: 92%; padding: 12px 16px; border-radius: 4px 16px 16px 16px; background: var(--bubble); font: 400 17px/1.45 var(--font); display: flex; flex-direction: column; gap: 10px; }
.user { align-self: flex-end; max-width: 85%; padding: 12px 16px; border-radius: 16px 4px 16px 16px; background: var(--accent); color: var(--surface); font: 400 17px/1.45 var(--font); }
.typing { font-weight: 700; color: var(--ink-2); letter-spacing: .2em; }
.presets-wrap { position: relative; }
.presets { max-height: 292px; overflow: auto; display: flex; flex-direction: column; gap: 8px; padding-bottom: 28px; }
.preset { flex: none; min-height: 48px; padding: 10px 14px; text-align: left; background: var(--surface); border: 1.5px solid var(--accent); border-radius: 14px; font: 700 16px/1.3 var(--font); color: var(--accent-ink); }
.preset:hover { background: var(--accent-softer); }
.more-fade { position: absolute; left: 0; right: 0; bottom: 0; height: 44px; background: linear-gradient(rgba(255,255,251,0), var(--surface) 70%); pointer-events: none; display: flex; align-items: flex-end; justify-content: center; font: 400 14px var(--font); color: var(--ink-2); }
.bot-tool { min-height: 48px; padding: 10px 14px; display: flex; align-items: center; justify-content: space-between; gap: 10px; text-align: left; background: var(--surface); border: 1px solid var(--line-2); border-radius: 12px; font: 700 16px/1.3 var(--font); }
.bot-tool::after { content: ""; flex: none; width: 8px; height: 8px; border-top: 2px solid var(--ink); border-right: 2px solid var(--ink); transform: rotate(45deg); }
.composer { flex: none; display: flex; gap: 8px; padding: 12px; border-top: 1px solid var(--line-3); background: var(--surface); }
.composer input { flex: 1; min-width: 0; height: 50px; padding: 0 14px; border: 1.5px solid var(--line-2); border-radius: 12px; background: var(--white); font: 400 17px var(--font); outline-color: var(--accent); }
.composer .primary { flex: none; padding: 0 16px; }

:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; } }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.pills { display: flex; flex-wrap: wrap; gap: 6px; }
.pill.review { background: #F3E7C9; color: #5C4410; }
.review-notice { background: #F3E7C9; color: #4A370D; }
img.photo { display: block; width: 100%; object-fit: cover; }
.tiles .card-title { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.source a { color: var(--accent); }
img.photo[hidden] { display: none; }
