/* Feedforward — dopamine-optimised deep-reading loop (ADR-0009).
   Recreated from design/feedforward/HANDOFF.md in the project's minimal,
   CDN-free stack: vanilla CSS, system font fallbacks. Mobile-first; the app is
   a phone-width column centred on any screen.

   Fonts: the design calls for Newsreader (editorial serif) + Space Grotesk (UI).
   To honour the no-CDN rule we do NOT link Google Fonts. Drop self-hosted WOFF2
   files into web/fonts/ and add @font-face blocks here to reach full fidelity;
   until then these high-quality system stacks stand in. */
:root {
  /* paper / ink */
  --paper: #f4f0e8;
  --reader-bg: #f7f4ec;
  --card: #fffdf8;
  --ink: #17140f;
  --ink-2: #241f18;
  --muted: #6f6a60;
  --muted-2: #8a8271;
  --muted-3: #605a4f;
  --hair: #ece5d6;
  --hair-2: #e6dfd0;
  --hair-3: #eae3d5;
  /* dark surfaces */
  --dark: #161310;
  --dark-2: #17140f;
  --on-dark: #f4efe6;
  --on-dark-muted: #8f8676;
  --on-dark-muted-2: #9a917f;
  --on-dark-soft: #c9c0b0;
  /* accent (reward / dopamine) */
  --accent: #ff5124;
  --accent-2: #ff7a52;
  --accent-3: #d8461d;
  --accent-4: #c33a19;
  --accent-5: #b8371a;
  --accent-soft: #fff2ea;
  --accent-soft-b: #ffd9c7;
  /* status */
  --green: #2e9e6f;
  --green-2: #1f7a55;
  --green-soft: #e9f5ee;
  --amber: #c07a12;
  --amber-soft: #fbf0d8;
  /* dose colours */
  --dose-s: #d9a441;
  --dose-m: #d2703a;
  --dose-l: #b8371a;

  --maxw: 440px;
  --serif: "Newsreader", "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, "Times New Roman", serif;
  --sans: "Space Grotesk", ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }
/* The Reader/Reward overlays set `display:flex`, which (as an author rule) beats
   the UA `[hidden]{display:none}`. Force the hidden attribute to always win, or
   an empty full-screen overlay covers the app at load and the page looks blank. */
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--sans);
  color: var(--ink);
  background: radial-gradient(120% 90% at 50% 0%, #efe9dd 0%, #e7e0d2 55%, #ded6c6 100%);
  min-height: 100vh;
}
a { color: inherit; text-decoration: none; }
button { font-family: inherit; }
::-webkit-scrollbar { width: 0; height: 0; }

/* ---- App column (phone-width, centred) ---- */
.app {
  position: relative;
  max-width: var(--maxw);
  /* Fixed viewport height (not min-height) so the .ff-scroll flex child is forced
     to shrink + scroll internally instead of growing .app to content height. */
  height: 100vh;
  height: 100dvh;
  margin: 0 auto;
  background: var(--paper);
  color: var(--ink);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 40px 90px -40px rgba(40, 30, 15, .45);
}
@media (min-width: 480px) {
  .app { height: min(100dvh, 924px); margin: max(0px, calc((100dvh - 924px) / 2)) auto; border-radius: 28px; }
}

/* ---- Header ---- */
.ff-header {
  flex-shrink: 0;
  padding: calc(14px + var(--safe-t)) 20px 12px;
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
}
.wordmark { display: flex; align-items: center; gap: 7px; color: var(--ink); }
.wordmark .mark { width: 20px; height: 20px; }
.wordmark span { font-weight: 700; font-size: 18px; letter-spacing: -.3px; }
.header-right { display: flex; align-items: center; gap: 7px; }

.pill { display: inline-flex; align-items: center; gap: 5px; padding: 6px 10px; border-radius: 20px; font-weight: 700; font-size: 13px; white-space: nowrap; }
.pill svg { width: 14px; height: 14px; }
.pill.minutes { background: #efeadf; color: #5a554b; }
.pill.minutes svg { stroke: var(--muted-2); fill: none; }
.pill.streak { background: var(--accent-soft); border: 1px solid var(--accent-soft-b); color: var(--accent-3); padding-left: 8px; }
.pill.streak svg { fill: var(--accent); stroke: none; animation: ff-flame 2.4s ease-in-out infinite; }
.pill.streak.hide, .pill.minutes.hide { display: none; }

/* Account control (Sign in with Apple) folded into the header (ADR-0008/0010) */
.account { position: relative; }
.acct-btn {
  display: inline-flex; align-items: center; gap: 6px; cursor: pointer;
  font-size: 12.5px; font-weight: 700; letter-spacing: .1px;
  padding: 6px 11px; border-radius: 20px; border: 1px solid #000; background: #000; color: #fff;
}
.acct-btn:hover { opacity: .9; }
.acct-btn .apple-glyph { width: 14px; height: 14px; }
.acct-name {
  display: inline-flex; align-items: center; gap: 6px; cursor: pointer;
  font-size: 12.5px; font-weight: 600; color: var(--ink);
  padding: 5px 10px 5px 6px; border-radius: 20px; background: #efeadf; border: 1px solid transparent;
}
.acct-name:hover { border-color: var(--hair-2); }
.acct-avatar {
  width: 20px; height: 20px; border-radius: 50%; flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--ink); color: var(--paper); font-size: 10px; font-weight: 700; letter-spacing: 0;
}
.acct-name .chev { width: 12px; height: 12px; stroke: var(--muted-2); }
.acct-menu {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 40;
  background: var(--card); border: 1px solid var(--hair-2); border-radius: 12px;
  box-shadow: 0 16px 34px -18px rgba(40, 30, 15, .5); padding: 6px; min-width: 160px;
}
.acct-menu .who { padding: 6px 10px 8px; border-bottom: 1px solid var(--hair); margin-bottom: 4px; }
.acct-menu .who b { display: block; font-size: 13px; }
.acct-menu .who small { color: var(--muted-2); font-size: 11px; }
.acct-menu button { display: block; width: 100%; text-align: left; background: none; border: 0; padding: 8px 10px; border-radius: 8px; font-size: 13px; font-weight: 600; color: var(--ink); cursor: pointer; }
.acct-menu button:hover { background: #f2ece0; }

/* ---- Scroll body ---- */
/* min-height:0 is load-bearing: without it a flex child won't shrink below its
   content, so the feed grows .app to content height (~13000px), floats the fixed
   nav below the fold, and opens the Reader onto blank space. Keep it. */
.ff-scroll { flex: 1; min-height: 0; overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 0 20px calc(96px + var(--safe-b)); }
.tabview[hidden] { display: none; }

/* Date + mood row */
.date-row { display: flex; align-items: center; justify-content: space-between; margin: 2px 0 14px; gap: 10px; }
.date-label { font-size: 12.5px; font-weight: 500; color: var(--muted); letter-spacing: .2px; }
.mood { display: inline-flex; align-items: center; gap: 6px; padding: 5px 11px; border-radius: 20px; background: #efeadf; font-size: 12px; font-weight: 600; color: #5a554b; white-space: nowrap; }
.mood .dot { width: 6px; height: 6px; border-radius: 50%; }

/* Loop card (dark) */
.loop-card { border-radius: 20px; background: var(--dark); color: var(--on-dark); padding: 15px 16px 14px; margin-bottom: 22px; box-shadow: 0 18px 34px -22px rgba(0,0,0,.5); cursor: pointer; border: 0; width: 100%; text-align: left; }
.loop-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 15px; }
.loop-head .label { font-size: 11px; font-weight: 600; letter-spacing: 1.5px; text-transform: uppercase; color: var(--on-dark-muted); }
.trend-badge { display: inline-flex; align-items: center; gap: 5px; padding: 4px 10px; border-radius: 20px; background: rgba(255,255,255,.08); font-size: 11.5px; font-weight: 700; }
.trend-badge .arrow { font-size: 13px; line-height: 1; }
.trend-badge .vs { font-weight: 500; opacity: .7; }
.loop-cells { display: flex; gap: 8px; }
.loop-cell { flex: 1; background: rgba(255,255,255,.05); border-radius: 14px; padding: 12px 6px; text-align: center; }
.loop-cell svg { width: 18px; height: 18px; margin-bottom: 6px; }
.loop-cell .num { font-size: 26px; font-weight: 700; line-height: 1; }
.loop-cell .cap { font-size: 10.5px; color: var(--on-dark-muted-2); margin-top: 4px; }

/* Source filter (by publisher / source_id) */
.src-filter { display: flex; gap: 8px; overflow-x: auto; -webkit-overflow-scrolling: touch; padding: 2px 0 4px; margin: 0 0 20px; scrollbar-width: none; }
.src-filter::-webkit-scrollbar { display: none; }
.fchip { flex: 0 0 auto; display: inline-flex; align-items: center; gap: 6px; padding: 7px 13px; border-radius: 20px; border: 1px solid var(--hair-2); background: var(--card); color: var(--muted); font-size: 12.5px; font-weight: 600; cursor: pointer; white-space: nowrap; }
.fchip.on { background: var(--ink); color: var(--on-dark); border-color: var(--ink); }
.fchip .n { font-size: 11px; font-weight: 700; opacity: .55; }
.fchip.on .n { opacity: .7; }
.fchip .fl { display: inline-flex; color: var(--accent-5); }
.fchip.on .fl { color: var(--accent-2); }
.fchip .fl svg { width: 12px; height: 12px; }
.linklike { background: none; border: 0; padding: 0; color: var(--accent-5); font: inherit; font-weight: 700; cursor: pointer; text-decoration: underline; }

/* Section labels */
.sec-label { font-size: 12px; font-weight: 600; letter-spacing: 1.4px; text-transform: uppercase; color: #a89f8c; }
.today-row { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 10px; gap: 12px; }
.today-row .throughline { font-size: 12px; color: var(--muted-2); text-align: right; }
.feed-label { margin-bottom: 10px; }

/* Featured "deep read of the day" */
.featured { position: relative; border-radius: 22px; overflow: hidden; background: var(--dark); color: var(--on-dark); margin-bottom: 24px; cursor: pointer; box-shadow: 0 22px 40px -24px rgba(0,0,0,.5); border: 0; width: 100%; text-align: left; display: block; }
.featured .band { height: 112px; position: relative; overflow: hidden; background: radial-gradient(140% 120% at 82% -10%, #ff5124 0%, #b8371a 42%, #161310 78%); }
.featured .band svg { position: absolute; inset: 0; opacity: .5; }
.featured .chip { position: absolute; top: 14px; left: 16px; display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px; border-radius: 20px; background: rgba(0,0,0,.28); backdrop-filter: blur(4px); font-size: 10.5px; font-weight: 600; letter-spacing: 1px; text-transform: uppercase; }
.featured .body { padding: 16px 18px; }
.featured .src { display: flex; align-items: center; gap: 8px; margin-bottom: 9px; }
.featured .src .dot { width: 7px; height: 7px; border-radius: 50%; }
.featured .src .txt { font-size: 11px; font-weight: 600; letter-spacing: 1px; text-transform: uppercase; color: #b7ad9b; }
.featured h2 { font-family: var(--serif); font-weight: 500; font-size: 24px; line-height: 1.12; letter-spacing: -.2px; margin: 0 0 8px; text-wrap: pretty; }
.featured .dek { font-family: var(--serif); font-size: 15px; line-height: 1.42; color: var(--on-dark-soft); margin: 0 0 14px; text-wrap: pretty; }
.featured .foot { display: flex; align-items: center; justify-content: space-between; }
.featured .cta { display: inline-flex; align-items: center; gap: 7px; font-size: 13px; font-weight: 600; color: var(--on-dark); }
.featured .cta svg { width: 15px; height: 15px; }
.featured .len { font-size: 11px; color: var(--on-dark-muted); }

/* 3-minute brief */
.brief { border-radius: 18px; background: var(--card); border: 1px solid var(--hair); overflow: hidden; margin-bottom: 26px; }
.brief-head { padding: 12px 15px 10px; border-bottom: 1px solid #f0eadd; display: flex; align-items: center; gap: 8px; }
.brief-head svg { width: 15px; height: 15px; stroke: var(--accent); fill: none; }
.brief-head .label { font-size: 12px; font-weight: 600; letter-spacing: .8px; text-transform: uppercase; color: #5a554b; }
.brief-row { display: flex; align-items: center; gap: 11px; padding: 13px 15px; border-top: 1px solid #f4eee2; cursor: pointer; background: none; border-left: 0; border-right: 0; border-bottom: 0; width: 100%; text-align: left; }
.brief-row .dot { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; }
.brief-row .mid { flex: 1; min-width: 0; }
.brief-row .t { font-family: var(--serif); font-size: 16px; line-height: 1.22; font-weight: 500; margin-bottom: 2px; text-wrap: pretty; }
.brief-row .s { font-size: 11px; color: var(--muted-2); font-weight: 500; text-transform: uppercase; letter-spacing: .5px; }
.brief-row .m { font-size: 12px; font-weight: 600; color: #a89f8c; }
.brief-row .check { stroke: var(--green); fill: none; width: 17px; height: 17px; }

/* Feed cards */
.feed-list { display: flex; flex-direction: column; gap: 14px; }
.card { border-radius: 18px; background: var(--card); border: 1px solid var(--hair); padding: 15px 16px 13px; box-shadow: 0 6px 16px -12px rgba(60,45,20,.4); }
.card.done { opacity: .62; }
.card .tap { cursor: pointer; }
.card .toprow { display: flex; align-items: center; justify-content: space-between; margin-bottom: 9px; gap: 8px; }
.card .src { display: flex; align-items: center; gap: 7px; min-width: 0; }
.card .src .dot { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; }
.card .src .txt { font-size: 10.5px; font-weight: 600; letter-spacing: 1px; text-transform: uppercase; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.status-pill { font-size: 10px; font-weight: 600; letter-spacing: .6px; text-transform: uppercase; padding: 3px 8px; border-radius: 10px; white-space: nowrap; flex-shrink: 0; }
.status-pill.progress { color: var(--amber); background: var(--amber-soft); }
.status-pill.read { color: var(--green); background: var(--green-soft); }
.status-pill.locked { color: var(--accent-5); background: #f6e7e1; display: inline-flex; align-items: center; gap: 4px; }
.status-pill.locked svg { width: 11px; height: 11px; }
.card h3 { font-family: var(--serif); font-weight: 500; font-size: 20px; line-height: 1.16; letter-spacing: -.2px; margin: 0 0 6px; text-wrap: pretty; }
.card .dek { font-family: var(--serif); font-size: 14.5px; line-height: 1.4; color: var(--muted-3); margin: 0 0 13px; text-wrap: pretty; }
.card .ctrls { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.doses { display: flex; gap: 5px; }
.dose-pill { padding: 5px 9px; border-radius: 9px; font-size: 11px; font-weight: 600; cursor: pointer; border: 1px solid var(--hair-2); background: transparent; color: var(--muted-2); }
.dose-pill.on { background: var(--ink); color: var(--on-dark); border-color: var(--ink); }
.icon-btns { display: flex; gap: 3px; align-items: center; }
.icon-btn { width: 33px; height: 33px; border: 0; background: none; border-radius: 9px; display: flex; align-items: center; justify-content: center; cursor: pointer; color: #a89f8c; }
.icon-btn svg { width: 17px; height: 17px; }
.icon-btn.on { color: #c15f3c; }
.icon-btn.on svg { fill: #c15f3c; }

/* Saved list */
.saved-block { margin-top: 28px; }
.saved-block .sec-label { display: block; margin-bottom: 10px; }
.saved-list { display: flex; flex-direction: column; gap: 10px; }
.saved-row { display: flex; align-items: center; gap: 11px; border-radius: 14px; background: var(--card); border: 1px solid var(--hair); padding: 12px 14px; cursor: pointer; text-align: left; width: 100%; }
.saved-row .dot { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; }
.saved-row .mid { flex: 1; min-width: 0; }
.saved-row .t { font-family: var(--serif); font-size: 16px; line-height: 1.2; font-weight: 500; text-wrap: pretty; }
.saved-row .s { font-size: 11px; color: var(--muted-2); font-weight: 500; text-transform: uppercase; letter-spacing: .5px; margin-top: 2px; }
.saved-row .bm { width: 16px; height: 16px; fill: #c15f3c; stroke: #c15f3c; }

/* Feed empty / cleared */
.cleared { text-align: center; padding: 40px 20px; }
.cleared .ring { width: 56px; height: 56px; border-radius: 50%; background: var(--green-soft); display: flex; align-items: center; justify-content: center; margin: 0 auto 14px; }
.cleared .ring svg { width: 26px; height: 26px; stroke: var(--green); fill: none; }
.cleared .t { font-family: var(--serif); font-size: 20px; margin-bottom: 5px; }
.cleared .s { font-size: 13.5px; color: var(--muted-2); line-height: 1.5; }
.boot-error { max-width: var(--maxw); margin: 20px auto; padding: 0 20px; text-align: center; color: var(--accent-4); font-size: 14px; }

/* ---- Stats tab ---- */
.stats-h { font-family: var(--serif); font-weight: 500; font-size: 26px; margin: 4px 0 16px; }
.hero-tiles { display: flex; gap: 10px; margin-bottom: 14px; }
.hero { flex: 1; border-radius: 18px; padding: 16px; }
.hero svg { width: 20px; height: 20px; margin-bottom: 8px; }
.hero .num { font-size: 30px; font-weight: 700; line-height: 1; }
.hero .cap { font-size: 11.5px; margin-top: 3px; }
.hero.streak { background: linear-gradient(160deg, #ff5124, #c33a19); color: #fff; }
.hero.streak svg { fill: #fff; opacity: .9; }
.hero.streak .cap { opacity: .85; }
.hero.long { background: var(--dark-2); color: var(--on-dark); }
.hero.long svg { stroke: var(--accent); fill: none; }
.hero.long .cap { opacity: .6; }
.stats-sub { display: flex; align-items: center; justify-content: center; gap: 7px; font-size: 12.5px; color: var(--muted-2); margin: 0 0 16px; }
.stats-sub svg { width: 14px; height: 14px; stroke: #a89f8c; fill: none; }
.stats-sub b { color: #5a554b; font-weight: 700; }
.stats-card { border-radius: 18px; background: var(--card); border: 1px solid var(--hair); padding: 16px 16px 14px; margin-bottom: 14px; }
.stats-card .hd { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 16px; gap: 10px; }
.stats-card .hd .t { font-size: 12.5px; font-weight: 600; letter-spacing: .4px; color: #5a554b; }
.stats-card .hd .s { font-size: 11.5px; color: var(--on-dark-muted-2); margin-top: 2px; }
.trend-badge.light { padding: 5px 11px; font-size: 12.5px; }
.trend-badge.light .arrow { font-size: 14px; }
.bars { position: relative; display: flex; align-items: flex-end; justify-content: space-between; height: 78px; gap: 8px; }
.bars .avg { position: absolute; left: 0; right: 0; border-top: 1.5px dashed #d3c9b6; z-index: 1; }
.bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; height: 100%; justify-content: flex-end; position: relative; z-index: 2; }
.bar-col .bar { width: 100%; border-radius: 5px; transition: height .4s ease; }
.bar-col .bl { font-size: 10px; color: #a89f8c; font-weight: 500; }
.rhythm .hd { margin-bottom: 2px; align-items: center; }
.rhythm .hd .c { font-size: 11.5px; color: var(--on-dark-muted-2); }
.dayline { position: relative; margin: 12px 0 4px 36px; }
.dayline .axis { position: absolute; left: 0; top: -4px; bottom: -4px; width: 2px; background: #eae1d0; border-radius: 2px; }
.dayline .tick { position: absolute; left: -36px; width: 30px; text-align: right; transform: translateY(-6px); font-size: 10px; color: #c2b9a6; font-weight: 500; }
.dayline .sess { position: absolute; left: -4px; transform: translateY(-5px); display: flex; align-items: center; gap: 9px; }
.dayline .sess .dot { width: 10px; height: 10px; border-radius: 50%; box-shadow: 0 0 0 3px var(--card); flex-shrink: 0; }
.dayline .sess .lab { display: inline-flex; align-items: baseline; gap: 7px; padding: 4px 10px; border-radius: 11px; background: #f5f0e6; white-space: nowrap; }
.dayline .sess .lab .tm { font-size: 12px; font-weight: 600; color: #3a352c; }
.dayline .sess .lab .mn { font-size: 11px; color: var(--muted-2); }
.src-list .src-row { display: flex; align-items: center; gap: 10px; padding: 7px 0; }
.src-list .src-row .dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.src-list .src-row .nm { flex: 1; font-size: 13.5px; font-weight: 500; }
.src-list .src-row .ct { font-size: 12px; font-weight: 600; color: #a89f8c; }
.src-title { font-size: 12.5px; font-weight: 600; letter-spacing: .4px; color: #5a554b; margin-bottom: 12px; }

/* ---- Graph tab ---- */
.graph-h { font-family: var(--serif); font-weight: 500; font-size: 26px; margin: 4px 0 4px; }
.graph-p { font-size: 13px; color: var(--muted-2); margin: 0 0 8px; line-height: 1.45; }
.graph-canvas { border-radius: 20px; background: var(--dark); padding: 8px 6px 4px; margin-bottom: 14px; overflow: hidden; }
.graph-inner { position: relative; }
.graph-inner svg { display: block; width: 100%; }
.graph-overlay { position: absolute; inset: 0; pointer-events: none; }
.graph-overlay .gcount { position: absolute; transform: translate(-50%, -50%); font-family: var(--sans); font-size: 13px; font-weight: 700; color: #fff; }
.graph-overlay .glabel { position: absolute; transform: translate(-50%, -50%); font-family: var(--sans); font-size: 11px; white-space: nowrap; }
.topic-card { border-radius: 18px; background: var(--card); border: 1px solid var(--hair); padding: 15px 16px; animation: ff-rise .3s ease both; }
.topic-card .hd { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.topic-card .hd .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--accent); }
.topic-card .hd .t { font-size: 15px; font-weight: 700; }
.topic-card .hd .c { font-size: 11.5px; color: var(--on-dark-muted-2); margin-left: auto; }
.topic-arts { display: flex; flex-direction: column; gap: 9px; }
.topic-art { display: flex; align-items: center; gap: 10px; cursor: pointer; text-align: left; background: none; border: 0; width: 100%; padding: 0; }
.topic-art .check { width: 16px; height: 16px; stroke: var(--green); fill: none; flex-shrink: 0; }
.topic-art .hollow { width: 16px; height: 16px; border-radius: 50%; border: 1.5px solid #d8cfbc; flex-shrink: 0; }
.topic-art .mid { flex: 1; min-width: 0; }
.topic-art .t { font-family: var(--serif); font-size: 15.5px; line-height: 1.2; font-weight: 500; text-wrap: pretty; }
.topic-art .s { font-size: 10.5px; color: var(--muted-2); text-transform: uppercase; letter-spacing: .5px; margin-top: 1px; }
.topic-art .chev { width: 16px; height: 16px; stroke: #c2b9a6; fill: none; flex-shrink: 0; }
.graph-hint { text-align: center; padding: 8px 20px 4px; font-size: 12.5px; color: #a89f8c; }

/* ---- Bottom nav ---- */
.ff-nav {
  position: absolute; bottom: 0; left: 0; right: 0; z-index: 30;
  background: rgba(247,244,236,.9); backdrop-filter: blur(14px);
  border-top: 1px solid #e7e0d1;
  padding: 9px 30px calc(14px + var(--safe-b)); display: flex; justify-content: space-between;
}
.nav-btn { background: none; border: 0; display: flex; flex-direction: column; align-items: center; gap: 4px; cursor: pointer; color: #b3aa98; }
.nav-btn svg { width: 23px; height: 23px; }
.nav-btn span { font-size: 10px; font-weight: 600; }
.nav-btn[aria-current="true"] { color: var(--ink); }

/* ---- Voice FAB ---- */
.ff-fab-wrap { position: absolute; bottom: calc(96px + var(--safe-b)); right: 16px; z-index: 35; display: flex; align-items: center; gap: 10px; }
.fab-label { padding: 9px 15px; border-radius: 22px; background: rgba(23,20,15,.94); color: var(--on-dark); font-size: 12.5px; font-weight: 600; box-shadow: 0 12px 30px -12px rgba(0,0,0,.5); white-space: nowrap; }
.ff-fab { position: relative; width: 60px; height: 60px; border-radius: 50%; border: 0; background: var(--dark-2); color: #fff; cursor: pointer; display: flex; align-items: center; justify-content: center; box-shadow: 0 14px 30px -10px rgba(0,0,0,.45); transition: transform .15s ease, background .2s ease; }
.ff-fab svg { width: 26px; height: 26px; position: relative; z-index: 1; }
.ff-fab.talking { background: var(--accent); transform: scale(1.08); }
.ff-fab.talking::before { content: ""; position: absolute; inset: 0; border-radius: 50%; background: var(--accent); animation: ff-pulse 1.2s ease-out infinite; }
.ff-reader:not([hidden]) ~ .ff-fab-wrap, .ff-reader:not([hidden]) ~ .ff-nav { display: none; }

/* ---- Reader (slide-over) ---- */
.ff-reader { position: absolute; inset: 0; z-index: 50; display: flex; flex-direction: column; background: var(--reader-bg); animation: ff-slide .28s cubic-bezier(.4,0,.2,1) both; }
.reader-top { position: relative; padding: calc(16px + var(--safe-t)) 20px 12px; background: var(--reader-bg); z-index: 20; border-bottom: 1px solid var(--hair-3); }
.reader-top .row { display: flex; align-items: center; justify-content: space-between; }
.back-btn { display: flex; align-items: center; gap: 4px; background: none; border: 0; padding: 6px 2px; color: var(--ink); cursor: pointer; font-size: 14px; font-weight: 500; }
.back-btn svg { width: 20px; height: 20px; stroke: currentColor; fill: none; }
.reader-actions { display: flex; gap: 6px; align-items: center; }
.r-act { width: 38px; height: 38px; border-radius: 12px; border: 1px solid var(--hair-2); background: var(--card); display: flex; align-items: center; justify-content: center; cursor: pointer; color: var(--ink); }
.r-act svg { width: 18px; height: 18px; stroke: currentColor; fill: none; }
.r-act.on { color: #c15f3c; }
.r-act.on svg { fill: #c15f3c; }
.progress { height: 3px; margin-top: 12px; border-radius: 2px; background: #eae1d0; overflow: hidden; }
.progress .fill { height: 100%; border-radius: 2px; background: var(--accent); width: 0; transition: width .12s linear; }
.reader-body { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 22px 24px calc(130px + var(--safe-b)); }
.reader-body .src { display: flex; align-items: center; gap: 8px; margin-bottom: 14px; }
.reader-body .src .dot { width: 7px; height: 7px; border-radius: 50%; }
.reader-body .src .txt { font-size: 11.5px; font-weight: 600; letter-spacing: 1.1px; text-transform: uppercase; color: var(--muted); }
.reader-body h1 { font-family: var(--serif); font-weight: 500; font-size: 31px; line-height: 1.12; letter-spacing: -.3px; margin: 0 0 12px; text-wrap: pretty; }
.reader-body .rdek { font-family: var(--serif); font-size: 18px; line-height: 1.5; color: #4a463d; margin: 0 0 20px; font-style: italic; }
.dose-tabs { display: flex; gap: 7px; margin-bottom: 24px; }
.dose-tab { flex: 1; padding: 11px 6px; border-radius: 12px; border: 1px solid var(--hair-2); background: var(--card); color: var(--muted); font-size: 12.5px; font-weight: 500; cursor: pointer; }
.dose-tab.on { background: var(--ink); color: var(--on-dark); border-color: var(--ink); font-weight: 600; }
.dose-tab .sub { opacity: .6; font-weight: 400; }
.dose-tab:disabled { opacity: .45; cursor: default; }
.article p { font-family: var(--serif); font-size: 18px; line-height: 1.62; color: var(--ink-2); margin: 0 0 18px; text-wrap: pretty; }
.article :is(h2,h3) { font-family: var(--serif); color: var(--ink); line-height: 1.25; margin: 1.1em 0 .35em; }
.article h2 { font-size: 22px; } .article h3 { font-size: 19px; }
.article ul, .article ol { padding-left: 1.25em; margin: .7em 0; font-family: var(--serif); font-size: 18px; color: var(--ink-2); }
.article li { margin: .35em 0; line-height: 1.55; }
.article a { color: var(--accent-5); text-underline-offset: 2px; text-decoration: underline; }
.article blockquote { font-family: var(--serif); font-size: 19px; font-style: italic; margin: 1em 0; padding-left: 16px; border-left: 3px solid var(--accent); color: var(--ink); }
.article pre { background: rgba(23,20,15,.06); padding: 12px; border-radius: 8px; overflow-x: auto; font-size: 14px; }
.article code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .9em; }
.article img { max-width: 100%; height: auto; border-radius: 8px; }
.reader-foot { margin-top: 26px; }
.mark-read { width: 100%; padding: 17px; border: 0; border-radius: 16px; background: var(--dark-2); color: var(--reader-bg); font-weight: 600; font-size: 15.5px; letter-spacing: .2px; cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 9px; box-shadow: 0 12px 26px -12px rgba(0,0,0,.5); }
.mark-read svg { width: 18px; height: 18px; stroke: currentColor; fill: none; }
.read-badge { display: flex; align-items: center; justify-content: center; gap: 8px; padding: 16px; border-radius: 16px; background: var(--green-soft); color: var(--green-2); font-weight: 600; font-size: 14px; }
.read-badge svg { width: 18px; height: 18px; stroke: currentColor; fill: none; }

/* Gate (ADR-0008): subscription teaser + open-content sign-in gate */
.gate { margin-top: 8px; padding: 18px; border: 1px solid var(--hair-2); border-radius: 16px; background: rgba(247,244,236,.6); }
.gate .lock { display: inline-flex; color: var(--accent-5); margin-bottom: 10px; }
.gate .lock svg { width: 22px; height: 22px; }
.gate .note { margin: 0 0 12px; color: var(--muted-2); font-size: 13.5px; line-height: 1.5; }
.gate .read-on { display: inline-flex; align-items: center; gap: 6px; font-weight: 700; color: var(--accent-5); }
.gate .acct-btn { margin: 4px 8px 4px 0; }
.gate-open::before { content: ""; display: block; height: 40px; margin-top: -40px; background: linear-gradient(to bottom, transparent, var(--reader-bg)); pointer-events: none; position: relative; }
.loading { color: var(--muted-2); font-size: 14px; padding: 8px 0; }

/* ---- Reward modal ---- */
.ff-cel { position: absolute; inset: 0; z-index: 60; display: flex; align-items: center; justify-content: center; padding: 26px; background: rgba(18,15,11,.5); backdrop-filter: blur(3px); }
.confetti { position: absolute; top: 24%; left: 0; right: 0; height: 0; pointer-events: none; }
.confetti span { position: absolute; animation: ff-confetti 1.15s ease-in forwards; }
.cel-modal { width: 100%; max-width: 320px; background: var(--reader-bg); border-radius: 26px; padding: 30px 24px 22px; text-align: center; animation: ff-pop .45s cubic-bezier(.34,1.56,.64,1) both; box-shadow: 0 30px 60px -20px rgba(0,0,0,.5); }
.cel-ring { width: 74px; height: 74px; margin: 0 auto 18px; position: relative; }
.cel-ring .chk { position: absolute; top: 22px; left: 22px; width: 30px; height: 30px; stroke: var(--green); fill: none; animation: ff-pop .4s .3s both; }
.cel-head { font-family: var(--serif); font-size: 23px; line-height: 1.15; margin-bottom: 6px; }
.cel-sub { font-size: 13.5px; color: #7a7264; line-height: 1.45; margin-bottom: 18px; }
.cel-tiles { display: flex; gap: 10px; margin-bottom: 18px; }
.cel-tile { flex: 1; border-radius: 14px; padding: 12px 8px; }
.cel-tile.streak { background: var(--accent-soft); }
.cel-tile.streak .n { font-size: 22px; font-weight: 700; color: var(--accent-3); display: flex; align-items: center; justify-content: center; gap: 4px; }
.cel-tile.streak .n svg { width: 16px; height: 16px; fill: var(--accent); }
.cel-tile.streak .c { font-size: 11px; color: #a86b52; margin-top: 2px; font-weight: 500; }
.cel-tile.mins { background: #efeadf; }
.cel-tile.mins .n { font-size: 22px; font-weight: 700; color: var(--ink); }
.cel-tile.mins .c { font-size: 11px; color: var(--muted-2); margin-top: 2px; font-weight: 500; }
.bonus { border-radius: 15px; background: var(--dark); color: var(--on-dark); padding: 13px 15px; text-align: left; cursor: pointer; margin-bottom: 11px; display: flex; align-items: center; gap: 11px; animation: ff-rise .4s .35s both; border: 0; width: 100%; }
.bonus .ic { width: 34px; height: 34px; border-radius: 10px; background: radial-gradient(120% 120% at 30% 20%, #ff5124, #8f2a12); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.bonus .ic svg { width: 17px; height: 17px; fill: #fff; }
.bonus .mid { flex: 1; min-width: 0; }
.bonus .k { font-size: 10px; font-weight: 600; letter-spacing: .8px; text-transform: uppercase; color: #ff8c6b; margin-bottom: 2px; }
.bonus .t { font-family: var(--serif); font-size: 15px; line-height: 1.15; text-wrap: pretty; }
.bonus .chev { width: 18px; height: 18px; stroke: var(--on-dark-muted); fill: none; flex-shrink: 0; }
.cel-close { width: 100%; padding: 14px; border: 0; border-radius: 14px; font-weight: 600; font-size: 14.5px; cursor: pointer; }
.cel-close.primary { background: var(--ink); color: var(--on-dark); }
.cel-close.secondary { background: #efeadf; color: var(--ink); }

/* ---- Toast ---- */
.ff-toast { position: absolute; bottom: calc(96px + var(--safe-b)); left: 50%; transform: translateX(-50%); z-index: 70; padding: 10px 18px; border-radius: 22px; background: rgba(23,20,15,.94); color: var(--on-dark); font-size: 13px; font-weight: 500; white-space: nowrap; animation: ff-toast .25s ease both; box-shadow: 0 12px 30px -12px rgba(0,0,0,.5); }

/* ---- Keyframes (verbatim from the prototype) ---- */
@keyframes ff-pop { 0% { transform: scale(.6); opacity: 0; } 55% { transform: scale(1.08); } 100% { transform: scale(1); opacity: 1; } }
@keyframes ff-ring { from { stroke-dashoffset: 189; } to { stroke-dashoffset: 0; } }
@keyframes ff-rise { from { transform: translateY(14px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
@keyframes ff-confetti { 0% { transform: translateY(0) rotate(0); opacity: 1; } 100% { transform: translateY(230px) rotate(320deg); opacity: 0; } }
@keyframes ff-toast { from { transform: translate(-50%, 12px); opacity: 0; } to { transform: translate(-50%, 0); opacity: 1; } }
@keyframes ff-flame { 0%,100% { transform: scale(1); } 50% { transform: scale(1.18); } }
@keyframes ff-slide { from { transform: translateX(100%); } to { transform: translateX(0); } }
@keyframes ff-pulse { 0% { transform: scale(1); opacity: .5; } 100% { transform: scale(2.1); opacity: 0; } }

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
}
