/* The Berean Heart app
   Layout: one reading column (max 46rem) inside an app shell; tab bar at the bottom on phones,
   a left rail from 960px. The airmail envelope on Home is the one loud element; everything else stays quiet. */
:root {
  --paper: #F1F2EE;      /* onionskin airmail paper, faint grey-green */
  --sheet: #FAFAF7;      /* raised surfaces */
  --ink: #17213B;        /* blue-black fountain pen ink */
  --ink-2: #464E66;
  --ink-3: #6E7589;
  --rule: #D7D9D1;
  --tint: #E4E7E1;
  --red: #A3232C;        /* airmail red, the heart */
  --blue: #2B4C8C;       /* airmail blue */
  --blue-tint: #E3E9F3;
  --on-red: #FFFFFF;
  --bar: #17213B;        /* mini player */
  --on-bar: #F1F2EE;
  --shadow: 0 1px 2px rgb(23 33 59 / .06), 0 8px 24px rgb(23 33 59 / .08);

  --font-display: "Young Serif", "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  --font-read: "Literata", "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  --font-ui: "Atkinson Hyperlegible", "Segoe UI", system-ui, -apple-system, sans-serif;

  --tabs-h: 4.25rem;
  --mini-h: 4rem;
  --rail-w: 14rem;
  --scale: 1;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #0F1424; --sheet: #161D31; --ink: #E9EAE4; --ink-2: #BCC1CD; --ink-3: #8D93A5;
    --rule: #283149; --tint: #1F2840; --red: #E35A62; --blue: #92ADE4; --blue-tint: #1E2A47;
    --on-red: #FFFFFF; --bar: #E9EAE4; --on-bar: #0F1424;
    --shadow: 0 1px 2px rgb(0 0 0 / .3), 0 10px 28px rgb(0 0 0 / .35);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #0F1424; --sheet: #161D31; --ink: #E9EAE4; --ink-2: #BCC1CD; --ink-3: #8D93A5;
  --rule: #283149; --tint: #1F2840; --red: #E35A62; --blue: #92ADE4; --blue-tint: #1E2A47;
  --on-red: #FFFFFF; --bar: #E9EAE4; --on-bar: #0F1424;
  --shadow: 0 1px 2px rgb(0 0 0 / .3), 0 10px 28px rgb(0 0 0 / .35);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 1rem/1.5 var(--font-ui);
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
  padding-block: 0 calc(var(--tabs-h) + env(safe-area-inset-bottom, 0px) + 1.5rem);
  -webkit-font-smoothing: antialiased;
}
body.has-mini { padding-bottom: calc(var(--tabs-h) + var(--mini-h) + env(safe-area-inset-bottom, 0px) + 2rem); }
body::before { content: ""; position: fixed; inset: 0 0 auto; height: env(safe-area-inset-top, 0px); z-index: 30; background: var(--paper); }
body.locked { overflow: hidden; }
img { max-width: 100%; display: block; }
button { font: inherit; color: inherit; }
a { color: var(--blue); }
:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; border-radius: 4px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.icon { width: 1.4rem; height: 1.4rem; flex: none; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- Shell ---------- */
.app { max-width: 46rem; margin: 0 auto; }
.topbar {
  position: sticky; top: env(safe-area-inset-top, 0px); z-index: 20;
  display: flex; align-items: center; gap: .75rem;
  padding-block: .75rem; background: var(--paper);
  border-bottom: 1px solid transparent; transition: border-color .2s;
}
.topbar.scrolled { border-bottom-color: var(--rule); }
.wordmark { font-family: var(--font-display); font-size: 1.2rem; line-height: 1.1; color: var(--ink); text-decoration: none; display: flex; align-items: center; gap: .5rem; margin-right: auto; }
.wordmark svg { width: 1.6rem; height: 1.6rem; flex: none; }
.icon-btn {
  display: inline-grid; place-items: center; min-width: 2.75rem; height: 2.75rem; padding: 0 .5rem;
  border: 0; border-radius: 999px; background: transparent; color: var(--ink-2); cursor: pointer;
}
.icon-btn:hover { background: var(--tint); color: var(--ink); }
.pill-btn {
  display: inline-flex; align-items: center; gap: .4rem; min-height: 2.5rem; padding: 0 .9rem;
  border: 1px solid var(--rule); border-radius: 999px; background: var(--sheet); color: var(--ink);
  font-weight: 700; font-size: .9rem; cursor: pointer; text-decoration: none;
}
.pill-btn:hover { border-color: var(--ink-3); }
.pill-btn .icon { width: 1.15rem; height: 1.15rem; }

.tabs {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 25;
  display: grid; grid-template-columns: repeat(5, 1fr);
  padding-left: max(8px, env(safe-area-inset-left, 0px));
  padding-right: max(8px, env(safe-area-inset-right, 0px));
  padding-bottom: env(safe-area-inset-bottom, 0px);
  height: calc(var(--tabs-h) + env(safe-area-inset-bottom, 0px));
  background: var(--sheet); border-top: 1px solid var(--rule);
}
.tabs .rail-brand { display: none; }
.tab {
  display: grid; justify-items: center; align-content: center; gap: .2rem;
  color: var(--ink-3); text-decoration: none; font-size: .78rem; font-weight: 700; letter-spacing: .01em;
}
.tab[aria-current="page"] { color: var(--red); }
.tab .icon { width: 1.5rem; height: 1.5rem; }

@media (min-width: 960px) {
  body { padding-left: calc(var(--rail-w) + 2.5rem); padding-bottom: 3rem; }
  body.has-mini { padding-bottom: calc(var(--mini-h) + 3rem); }
  .topbar .wordmark { visibility: hidden; }
  .tabs {
    top: 0; right: auto; width: var(--rail-w); height: auto;
    grid-template-columns: 1fr; grid-auto-rows: min-content; align-content: start; gap: .25rem;
    padding: calc(env(safe-area-inset-top, 0px) + 1.25rem) 1rem 1rem max(1rem, env(safe-area-inset-left, 0px));
    border-top: 0; border-right: 1px solid var(--rule);
  }
  .tabs .rail-brand { display: flex; margin: 0 0 1.25rem .5rem; }
  .tab { grid-template-columns: auto 1fr; justify-items: start; align-items: center; gap: .75rem; padding: .7rem .75rem; border-radius: 8px; font-size: 1rem; }
  .tab:hover { background: var(--tint); }
  .tab[aria-current="page"] { background: var(--tint); }
}

/* ---------- Type ---------- */
.page-head { display: grid; gap: .35rem; margin: .75rem 0 1.5rem; }
.page-title { font-family: var(--font-display); font-weight: 400; font-size: clamp(1.9rem, 6vw, 2.4rem); line-height: 1.1; margin: 0; text-wrap: balance; }
.page-sub { margin: 0; color: var(--ink-2); font-family: var(--font-read); font-size: 1.02rem; max-width: 34rem; }
.section { margin-top: 2.25rem; display: grid; gap: .9rem; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; }
.section-title { font-family: var(--font-display); font-weight: 400; font-size: 1.3rem; margin: 0; }
.see-all { font-weight: 700; font-size: .9rem; color: var(--blue); text-decoration: none; background: none; border: 0; padding: .25rem 0; cursor: pointer; }
.meta { color: var(--ink-3); font-size: .85rem; font-variant-numeric: tabular-nums; }
.meta-row { display: flex; flex-wrap: wrap; gap: .4rem .6rem; align-items: center; }
.series-tag { color: var(--red); font-weight: 700; font-size: .82rem; }
.clamp-2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.clamp-3 { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }

/* ---------- Media with typographic fallback ---------- */
.media { position: relative; overflow: hidden; background: var(--tint); }
.media > img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.media .fallback { position: absolute; inset: 0; display: grid; place-items: center; padding: .75rem; text-align: center; font-family: var(--font-display); color: var(--ink-2); line-height: 1.15; }
.media.video .fallback { background: var(--blue-tint); color: var(--blue); }

/* ---------- The envelope (latest letter) ---------- */
.envelope {
  position: relative; padding: 7px; border-radius: 6px;
  background: repeating-linear-gradient(135deg, var(--red) 0 14px, var(--sheet) 14px 21px, var(--blue) 21px 35px, var(--sheet) 35px 42px);
  box-shadow: var(--shadow);
}
.envelope-inner { position: relative; background: var(--sheet); border-radius: 2px; padding: 1.25rem 1.25rem 1.15rem; display: grid; gap: .8rem; }
.envelope .from { font-size: .85rem; color: var(--ink-3); font-weight: 700; padding-right: 7rem; }
.envelope .day { font-family: var(--font-read); font-style: italic; color: var(--ink-2); font-size: 1.05rem; margin: 0; }
.envelope .word { font-family: var(--font-display); font-weight: 400; font-size: clamp(2rem, 8.5vw, 2.75rem); line-height: 1.05; margin: 0; text-wrap: balance; overflow-wrap: anywhere; }
.envelope .passage { font-family: var(--font-read); font-size: 1.1rem; color: var(--ink); margin: 0; }
.envelope .summary { font-family: var(--font-read); color: var(--ink-2); margin: 0; max-width: 34rem; }
.postmark { position: absolute; top: .55rem; right: .7rem; width: 6.25rem; height: auto; color: var(--ink-3); opacity: .85; transform: rotate(-9deg); pointer-events: none; }
.postmark text { fill: currentColor; font-family: var(--font-ui); font-weight: 700; }
.postmark .pm-ring { fill: none; stroke: currentColor; }
.postmark .pm-wave { fill: none; stroke: currentColor; stroke-width: 1.4; }
.play-row { display: flex; align-items: center; gap: .9rem; flex-wrap: wrap; }
.play-big {
  display: inline-flex; align-items: center; gap: .6rem; min-height: 3.1rem; padding: 0 1.4rem 0 1rem;
  border: 0; border-radius: 999px; background: var(--red); color: var(--on-red); font-weight: 700; font-size: 1.02rem; cursor: pointer;
}
.play-big .icon { width: 1.5rem; height: 1.5rem; }
.play-big:hover { filter: brightness(1.06); }

/* ---------- This week's letters ---------- */
.week-strip { display: grid; gap: 0; background: var(--sheet); border: 1px solid var(--rule); border-radius: 8px; overflow: hidden; }
.week-strip .letter-row { padding-inline: .9rem; }
.week-strip .letter-row + .letter-row { border-top: 1px solid var(--rule); }

/* Postage stamp tile: the letter number. Friday's whole-letter stamp is red. Played letters get a cancellation. */
.stamp {
  --behind: var(--sheet);
  position: relative; display: block; width: 3rem; height: 3.5rem; flex: none; padding: 4px;
  background: radial-gradient(circle at center, var(--behind) 2.1px, var(--stamp-ink, var(--tint)) 2.6px) -4px -4px / 8px 8px;
}
.stamp > span {
  display: grid; place-items: center; width: 100%; height: 100%;
  background: var(--stamp-ink, var(--tint)); color: var(--stamp-num, var(--ink));
  font-family: var(--font-display); font-size: 1.05rem; font-variant-numeric: tabular-nums;
}
.stamp.apex { --stamp-ink: var(--red); --stamp-num: var(--on-red); }
.stamp.blank > span { color: var(--ink-3); }
.stamp.played::after {
  content: ""; position: absolute; inset: 22% -18% 22% -18%;
  background: var(--ink); opacity: .55;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 60 30'%3E%3Cpath d='M0 6q7.5-6 15 0t15 0 15 0 15 0M0 15q7.5-6 15 0t15 0 15 0 15 0M0 24q7.5-6 15 0t15 0 15 0 15 0' fill='none' stroke='black' stroke-width='2.2'/%3E%3C/svg%3E") center / 100% 100% no-repeat;
          mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 60 30'%3E%3Cpath d='M0 6q7.5-6 15 0t15 0 15 0 15 0M0 15q7.5-6 15 0t15 0 15 0 15 0M0 24q7.5-6 15 0t15 0 15 0 15 0' fill='none' stroke='black' stroke-width='2.2'/%3E%3C/svg%3E") center / 100% 100% no-repeat;
}
.stamp.apex.played::after { background: var(--on-red); opacity: .7; }

.letter-row {
  display: grid; grid-template-columns: auto 1fr auto; gap: .9rem; align-items: center;
  padding-block: .75rem; text-align: left; width: 100%; background: none; border: 0; color: inherit;
}
.letter-row .open { all: unset; display: grid; grid-template-columns: auto 1fr; gap: .9rem; align-items: center; min-width: 0; cursor: pointer; grid-column: 1 / 3; }
.letter-row .open:focus-visible { outline: 2px solid var(--blue); outline-offset: 4px; border-radius: 4px; }
.letter-row .txt { min-width: 0; display: grid; gap: .1rem; }
.letter-row .dayname { font-size: .82rem; font-weight: 700; color: var(--ink-3); }
.letter-row .ttl { font-family: var(--font-read); font-size: 1.05rem; line-height: 1.3; color: var(--ink); overflow-wrap: anywhere; }
.letter-row.future { opacity: .55; }
.letter-row .bar { height: 3px; border-radius: 3px; background: var(--rule); overflow: hidden; margin-top: .3rem; max-width: 12rem; }
.letter-row .bar > i { display: block; height: 100%; background: var(--red); }
.row-play {
  display: grid; place-items: center; width: 2.75rem; height: 2.75rem; border-radius: 999px; flex: none;
  border: 1px solid var(--rule); background: var(--sheet); color: var(--ink); cursor: pointer;
}
.row-play:hover { border-color: var(--red); color: var(--red); }
.row-play .icon { width: 1.15rem; height: 1.15rem; }
.row-play.on { background: var(--red); border-color: var(--red); color: var(--on-red); }
.row-link { font-weight: 700; font-size: .85rem; color: var(--blue); text-decoration: none; white-space: nowrap; }

/* ---------- Letters tab ---------- */
.letters-head { display: grid; grid-template-columns: 5.5rem 1fr; gap: 1rem; align-items: center; margin: .75rem 0 1.25rem; }
.letters-head .media { width: 5.5rem; aspect-ratio: 1; border-radius: 6px; }
.letters-head .media .fallback { font-size: .9rem; }
.letters-head h1 { margin: 0; }
.chips { display: flex; gap: .5rem; overflow-x: auto; padding-bottom: .25rem; scrollbar-width: none; margin-inline: -2px; padding-inline: 2px; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: none; min-height: 2.4rem; padding: 0 .95rem; border-radius: 999px; border: 1px solid var(--rule);
  background: var(--sheet); color: var(--ink-2); font-weight: 700; font-size: .88rem; cursor: pointer; white-space: nowrap;
}
.chip[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: var(--paper); }
.search {
  display: flex; align-items: center; gap: .5rem; min-height: 2.9rem; padding: 0 .9rem;
  border: 1px solid var(--rule); border-radius: 999px; background: var(--sheet); color: var(--ink-3);
}
.search:focus-within { border-color: var(--blue); }
.search input { flex: 1; min-width: 0; border: 0; background: transparent; color: var(--ink); font: inherit; font-size: 1rem; outline: none; min-height: 2.6rem; }
.search .icon { width: 1.2rem; height: 1.2rem; }
.tools { display: grid; gap: .75rem; margin-bottom: 1.25rem; }
.week { display: grid; gap: .25rem; margin-top: 1.75rem; }
.week-head { display: grid; gap: .1rem; padding-bottom: .4rem; border-bottom: 1px solid var(--rule); }
.week-head h2 { font-family: var(--font-display); font-weight: 400; font-size: 1.35rem; margin: 0; }
.week-head .meta em { font-family: var(--font-read); }
.week .stamp { --behind: var(--paper); }
.season-note { font-family: var(--font-read); font-style: italic; color: var(--ink-2); margin: 0; }

/* ---------- Articles ---------- */
.post-list { display: grid; }
.post-row {
  display: grid; grid-template-columns: 1fr 5.75rem; gap: 1rem; align-items: start;
  padding-block: 1rem; border-top: 1px solid var(--rule); text-decoration: none; color: inherit; cursor: pointer;
  background: none; border-left: 0; border-right: 0; border-bottom: 0; text-align: left; width: 100%;
}
.post-row:first-child { border-top: 0; }
.post-row .txt { min-width: 0; display: grid; gap: .3rem; }
.post-row h3 { font-family: var(--font-read); font-weight: 600; font-size: 1.08rem; line-height: 1.3; margin: 0; text-wrap: balance; }
.post-row p { margin: 0; color: var(--ink-2); font-size: .95rem; }
.post-row .media { width: 5.75rem; aspect-ratio: 1; border-radius: 6px; }
.post-row .media .fallback { font-size: 1.6rem; }
.post-row:hover h3 { color: var(--blue); }
.post-feature { display: grid; gap: .6rem; text-decoration: none; color: inherit; cursor: pointer; background: none; border: 0; padding: 0; text-align: left; width: 100%; }
.post-feature .media { aspect-ratio: 16 / 9; border-radius: 8px; max-width: 100%; }
.post-feature .media .fallback { font-size: 1.6rem; }
.post-feature h3 { font-family: var(--font-display); font-weight: 400; font-size: 1.45rem; line-height: 1.2; margin: 0; text-wrap: balance; }
.post-feature p { margin: 0; color: var(--ink-2); font-family: var(--font-read); }
.post-feature:hover h3 { color: var(--blue); }
.load-more { justify-self: center; margin-top: 1rem; }
.empty { padding: 2rem 1rem; text-align: center; color: var(--ink-2); font-family: var(--font-read); display: grid; gap: .5rem; justify-items: center; }
.empty h3 { font-family: var(--font-display); font-weight: 400; font-size: 1.25rem; margin: 0; color: var(--ink); }

/* ---------- Coffee Chat ---------- */
.video-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 15rem), 1fr)); gap: 1.5rem 1rem; }
.video-card { display: grid; gap: .5rem; text-decoration: none; color: inherit; cursor: pointer; background: none; border: 0; padding: 0; text-align: left; }
.video-card .media { aspect-ratio: 16 / 9; border-radius: 8px; max-width: 100%; }
.video-card .media .fallback { font-size: 1.15rem; }
.video-card h3 { font-family: var(--font-read); font-weight: 600; font-size: 1.05rem; line-height: 1.3; margin: 0; }
.video-card:hover h3 { color: var(--blue); }
.play-glyph { position: absolute; left: .6rem; bottom: .6rem; display: grid; place-items: center; width: 2.6rem; height: 2.6rem; border-radius: 999px; background: rgb(15 20 36 / .78); color: #fff; }
.play-glyph .icon { width: 1.1rem; height: 1.1rem; }
.video-feature .media { aspect-ratio: 16 / 9; }
.video-feature h3 { font-family: var(--font-display); font-weight: 400; font-size: 1.35rem; }

/* ---------- Home extras ---------- */
.shelf { display: grid; grid-auto-flow: column; grid-auto-columns: min(78%, 17rem); gap: .9rem; overflow-x: auto; padding-bottom: .4rem; scrollbar-width: thin; }
.resume-card { display: grid; grid-template-columns: auto 1fr; gap: .75rem; align-items: center; padding: .75rem; background: var(--sheet); border: 1px solid var(--rule); border-radius: 8px; cursor: pointer; text-align: left; color: inherit; }
.resume-card .ttl { font-family: var(--font-read); font-size: .98rem; line-height: 1.25; }
.hint { display: grid; grid-template-columns: 1fr auto; gap: .5rem 1rem; align-items: start; padding: 1rem; background: var(--blue-tint); border-radius: 8px; margin-top: 1rem; }
.hint p { margin: 0; color: var(--ink); }
.hint strong { font-family: var(--font-display); font-weight: 400; font-size: 1.1rem; display: block; margin-bottom: .2rem; }
.more-list { display: grid; border-top: 1px solid var(--rule); }
.more-list a { display: grid; grid-template-columns: 1fr auto; gap: .2rem 1rem; align-items: center; padding: .9rem 0; border-bottom: 1px solid var(--rule); text-decoration: none; color: var(--ink); }
.more-list a span:first-child { font-family: var(--font-read); font-weight: 600; }
.more-list a small { grid-column: 1; color: var(--ink-3); font-size: .88rem; }
.more-list .icon { grid-row: 1 / span 2; grid-column: 2; color: var(--ink-3); width: 1.2rem; height: 1.2rem; }
.footer-note { margin-top: 2rem; color: var(--ink-3); font-size: .85rem; display: flex; gap: .5rem 1rem; flex-wrap: wrap; align-items: center; }
.footer-note button { background: none; border: 0; padding: 0; color: var(--blue); font-weight: 700; cursor: pointer; font-size: .85rem; }
.offline-bar { margin-top: .5rem; padding: .6rem .9rem; border-radius: 8px; background: var(--tint); color: var(--ink-2); font-size: .9rem; }

/* ---------- Sheets (reader, letter, video) ---------- */
.sheet {
  position: fixed; inset: 0; z-index: 40; background: var(--paper);
  overflow-y: auto; overscroll-behavior: contain;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
  padding-block: 0 calc(env(safe-area-inset-bottom, 0px) + 6rem);
  animation: sheet-in .22s ease-out;
}
@keyframes sheet-in { from { transform: translateY(14px); opacity: 0; } to { transform: none; opacity: 1; } }
.sheet-bar {
  position: sticky; top: 0; z-index: 2; display: flex; align-items: center; gap: .25rem;
  max-width: 44rem; margin: 0 auto; padding-top: calc(env(safe-area-inset-top, 0px) + .5rem); padding-bottom: .5rem; background: var(--paper);
}
.sheet-bar .spacer { flex: 1; }
.sheet-body { max-width: 40rem; margin: 0 auto; }
.text-size { display: inline-flex; border: 1px solid var(--rule); border-radius: 999px; overflow: hidden; }
.text-size button { border: 0; background: var(--sheet); padding: 0 .8rem; min-height: 2.4rem; cursor: pointer; font-family: var(--font-read); color: var(--ink); }
.text-size button + button { border-left: 1px solid var(--rule); }
.text-size .sm { font-size: .85rem; }
.text-size .lg { font-size: 1.15rem; }
.icon-btn.saved { color: var(--red); }
.icon-btn.saved .icon { fill: currentColor; }

.article-head { display: grid; gap: .6rem; margin: .5rem 0 1.5rem; }
.article-head h1 { font-family: var(--font-display); font-weight: 400; font-size: clamp(1.85rem, 6.5vw, 2.5rem); line-height: 1.12; margin: 0; text-wrap: balance; }
.article-head .media { aspect-ratio: 16 / 9; border-radius: 8px; max-width: 100%; margin-top: .5rem; }
.article-foot { margin-top: 2.5rem; padding-top: 1.25rem; border-top: 1px solid var(--rule); display: flex; flex-wrap: wrap; gap: .75rem; }

.prose { font-family: var(--font-read); font-size: calc(1.1rem * var(--scale)); line-height: 1.72; color: var(--ink); overflow-wrap: break-word; }
.prose > * { margin: 0 0 1.1em; }
.prose h2 { font-family: var(--font-display); font-weight: 400; font-size: 1.45em; line-height: 1.2; margin: 1.8em 0 .6em; text-wrap: balance; }
.prose h3, .prose h4 { font-weight: 600; font-size: 1.12em; line-height: 1.3; margin: 1.5em 0 .5em; }
.prose a { color: var(--blue); text-underline-offset: .15em; }
.prose blockquote { margin-inline: 0; padding: .2em 0 .2em 1.1em; border-left: 3px solid var(--blue); color: var(--ink); }
.prose blockquote p { margin: 0 0 .6em; }
.prose blockquote p:last-child { margin-bottom: 0; }
.prose cite { display: block; margin-top: .5em; font-family: var(--font-ui); font-style: normal; font-weight: 700; font-size: .78em; color: var(--ink-3); }
.prose .pullquote { margin: 2em 0; padding: 1.1em 0; border-top: 2px solid var(--red); border-bottom: 2px solid var(--red); }
.prose .pullquote blockquote { border: 0; padding: 0; font-family: var(--font-display); font-size: 1.3em; line-height: 1.35; }
.prose .note { font-size: .88em; color: var(--ink-2); }
.prose ul, .prose ol { padding-left: 1.3em; }
.prose li { margin-bottom: .45em; }
.prose img { height: auto; border-radius: 6px; }
.prose figure { margin-inline: 0; }
.prose figcaption { font-family: var(--font-ui); font-size: .8em; color: var(--ink-3); margin-top: .4em; }
.prose .gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(8rem, 1fr)); gap: .5rem; }
.prose .gallery figure { margin: 0; }
.prose .table-wrap, .prose > table { overflow-x: auto; display: block; }
.prose table { border-collapse: collapse; font-family: var(--font-ui); font-size: .82em; line-height: 1.45; min-width: 100%; }
.prose th, .prose td { padding: .55em .7em; border-bottom: 1px solid var(--rule); text-align: left; vertical-align: top; }
.prose th { background: var(--blue-tint); color: var(--ink); font-weight: 700; }
.prose hr { border: 0; border-top: 1px solid var(--rule); }
.prose .buttons { display: flex; flex-wrap: wrap; gap: .5rem; }
.prose .button { display: inline-flex; align-items: center; min-height: 2.6rem; padding: 0 1.1rem; border-radius: 999px; background: var(--ink); color: var(--paper); text-decoration: none; font-family: var(--font-ui); font-weight: 700; font-size: .9em; }
.yt-embed, .video-frame { position: relative; aspect-ratio: 16 / 9; max-width: 100%; border-radius: 8px; overflow: hidden; background: var(--blue-tint); }
.yt-embed button, .video-frame button { all: unset; position: absolute; inset: 0; cursor: pointer; display: grid; place-items: center; }
.yt-embed img, .video-frame img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.yt-embed .big-play, .video-frame .big-play { position: relative; display: grid; place-items: center; width: 4rem; height: 4rem; border-radius: 999px; background: var(--red); color: var(--on-red); box-shadow: var(--shadow); }
.yt-embed .big-play .icon, .video-frame .big-play .icon { width: 1.6rem; height: 1.6rem; }
.yt-embed iframe, .video-frame iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.preview-note { font-family: var(--font-ui); font-size: .9rem; color: var(--ink-2); background: var(--tint); border-radius: 8px; padding: .8rem 1rem; }

/* letter detail */
.letter-detail { display: grid; gap: 1rem; margin-top: .5rem; }
.letter-detail .top { display: grid; grid-template-columns: auto 1fr; gap: 1rem; align-items: center; }
.letter-detail .stamp { --behind: var(--paper); width: 3.6rem; height: 4.2rem; }
.letter-detail .stamp > span { font-size: 1.3rem; }
.letter-detail h1 { font-family: var(--font-display); font-weight: 400; font-size: clamp(1.8rem, 6vw, 2.3rem); line-height: 1.1; margin: 0; text-wrap: balance; overflow-wrap: anywhere; }
.letter-detail .actions { display: flex; flex-wrap: wrap; gap: .6rem; align-items: center; }

/* ---------- Mini player ---------- */
.mini {
  position: fixed; z-index: 24; left: 0; right: 0;
  bottom: calc(var(--tabs-h) + env(safe-area-inset-bottom, 0px) + .5rem);
  margin: 0 auto; max-width: 46rem;
  padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px));
}
.mini-inner {
  position: relative; display: grid; grid-template-columns: auto 1fr auto; gap: .75rem; align-items: center;
  height: var(--mini-h); padding: 0 .5rem 0 .6rem; border-radius: 10px; overflow: hidden;
  background: var(--bar); color: var(--on-bar); box-shadow: var(--shadow);
}
.mini-progress { position: absolute; left: 0; top: 0; height: 3px; background: var(--red); width: 0; }
.mini .stamp { --behind: var(--bar); --stamp-ink: var(--on-bar); --stamp-num: var(--bar); width: 2.4rem; height: 2.8rem; }
.mini .stamp > span { font-size: .9rem; }
.mini-open { all: unset; display: grid; gap: 0; min-width: 0; cursor: pointer; }
.mini-open .t1 { font-size: .78rem; opacity: .75; font-weight: 700; }
.mini-open .t2 { font-family: var(--font-read); font-size: 1rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mini .icon-btn { color: var(--on-bar); }
.mini .icon-btn:hover { background: rgb(127 127 127 / .2); color: var(--on-bar); }
.mini .icon-btn .icon { width: 1.6rem; height: 1.6rem; }
@media (min-width: 960px) {
  .mini { left: var(--rail-w); bottom: 1rem; }
}

/* ---------- Full player ---------- */
.player {
  position: fixed; inset: 0; z-index: 45; background: var(--paper); overflow-y: auto; overscroll-behavior: contain;
  padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px));
  padding-block: 0 calc(env(safe-area-inset-bottom, 0px) + 2rem);
  animation: sheet-in .22s ease-out;
}
.player-body { max-width: 30rem; margin: 0 auto; display: grid; gap: 1.1rem; }
.player-art { width: min(100%, 19rem); aspect-ratio: 1; justify-self: center; border-radius: 10px; box-shadow: var(--shadow); max-width: 100%; }
.player-art .fallback { font-size: 3.5rem; }
.player-titles { display: grid; gap: .25rem; text-align: center; }
.player-titles .dayname { color: var(--ink-3); font-weight: 700; font-size: .9rem; }
.player-titles h2 { font-family: var(--font-display); font-weight: 400; font-size: 1.9rem; line-height: 1.1; margin: 0; overflow-wrap: anywhere; }
.player-titles p { margin: 0; font-family: var(--font-read); color: var(--ink-2); }
.scrub { display: grid; gap: .3rem; }
.scrub input[type=range] { width: 100%; accent-color: var(--red); height: 1.75rem; margin: 0; }
.scrub .times { display: flex; justify-content: space-between; font-size: .85rem; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.controls { display: flex; align-items: center; justify-content: center; gap: 1.1rem; }
.controls .icon-btn { color: var(--ink); width: 3.25rem; height: 3.25rem; }
.controls .icon-btn .icon { width: 1.85rem; height: 1.85rem; }
.controls .main-play { width: 4.5rem; height: 4.5rem; border-radius: 999px; border: 0; background: var(--red); color: var(--on-red); display: grid; place-items: center; cursor: pointer; }
.controls .main-play .icon { width: 2rem; height: 2rem; }
.controls .speed { min-width: 3.25rem; font-weight: 700; font-variant-numeric: tabular-nums; font-size: .95rem; }
.player-notes { border-top: 1px solid var(--rule); padding-top: 1.25rem; --scale: .92; }
.player-notes h3 { font-family: var(--font-display); font-weight: 400; font-size: 1.15rem; margin: 0 0 .75rem; }

/* ---------- Toast ---------- */
.toast {
  position: fixed; z-index: 60; left: 50%; transform: translateX(-50%);
  bottom: calc(var(--tabs-h) + var(--mini-h) + env(safe-area-inset-bottom, 0px) + 1.25rem);
  max-width: min(92vw, 28rem); padding: .75rem 1rem; border-radius: 8px;
  background: var(--ink); color: var(--paper); font-size: .95rem; box-shadow: var(--shadow);
  display: flex; gap: 1rem; align-items: center;
}
.toast button { background: none; border: 0; color: inherit; font-weight: 700; text-decoration: underline; cursor: pointer; padding: 0; }

.skeleton { background: linear-gradient(90deg, var(--tint), var(--sheet), var(--tint)); background-size: 200% 100%; animation: shimmer 1.4s infinite linear; border-radius: 6px; height: 1rem; }
@keyframes shimmer { to { background-position: -200% 0; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
