/* Tokens from Iris's prototype (docs/design/screens.html) and flow-and-visual.md §3.5. */
:root {
  --paper: #FBFAF7; --ink: #1C1C1E; --ink2: rgba(28,28,30,.55); --ink3: rgba(28,28,30,.48);
  --accent: #5856D6; --accentCap: rgba(88,86,214,.18); --accentText: #4B49C8; --red: #FF3B30;
  --glass: rgba(255,255,255,.62); --glassHi: rgba(255,255,255,.85); --glassBorder: rgba(255,255,255,.7);
  --glassShadow: rgba(0,0,0,.14); --fill: rgba(120,120,128,.14);
  --serif: "New York", ui-serif, "Iowan Old Style", Georgia, serif;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --paper: #0F0F11; --ink: #F2F2F2; --ink2: rgba(242,242,242,.55); --ink3: rgba(242,242,242,.40);
    --accent: #5E5CE6; --accentCap: rgba(94,92,230,.30); --accentText: #9F9DF7; --red: #FF453A;
    --glass: rgba(44,44,48,.55); --glassHi: rgba(255,255,255,.18); --glassBorder: rgba(255,255,255,.14);
    --glassShadow: rgba(0,0,0,.5); --fill: rgba(120,120,128,.28);
  }
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { background: var(--paper); -webkit-text-size-adjust: 100%; }
body {
  background: var(--paper); color: var(--ink); min-height: 100vh;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "PingFang SC", "Hiragino Sans GB", "Helvetica Neue", sans-serif;
  -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent;
}
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
button:disabled { cursor: default; opacity: .4; }
button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
[hidden] { display: none !important; }

/* nav */
.nav {
  position: sticky; top: 0; z-index: 15; display: flex; align-items: center; justify-content: space-between; gap: 12px;
  max-width: 720px; margin: 0 auto; padding: calc(env(safe-area-inset-top) + 8px) 20px 12px 24px;
  background: linear-gradient(var(--paper) 72%, transparent);
}
.ttl { display: flex; align-items: center; gap: 6px; min-width: 0; font-size: 17px; font-weight: 600; letter-spacing: -.2px; text-align: left; }
.ttl span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ttl svg { flex: none; width: 12px; height: 12px; stroke: var(--ink2); fill: none; stroke-width: 2.2; }
.meta { flex: none; font-size: 15px; color: var(--ink2); font-variant-numeric: tabular-nums; }
.meta.rec { color: var(--red); font-weight: 600; }
.meta.rec::before { content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--red); margin-right: 6px; vertical-align: 1px; }

/* passage: the text is the hero */
main { max-width: 720px; margin: 0 auto; padding: 6px 24px 260px; }
.passage { position: relative; font-family: var(--serif); font-size: 22px; line-height: 1.5; letter-spacing: .1px; }
@media (min-width: 700px) { .passage { font-size: 24px; } }
.w { position: relative; z-index: 1; white-space: nowrap; cursor: pointer; transition: color .15s; }
.passage.m-listen { color: var(--ink2); }
.passage.m-listen .w.past, .passage.m-listen .w.cur { color: var(--ink); }
.cap { position: absolute; z-index: 0; border-radius: 999px; background: var(--accentCap); pointer-events: none;
  transition: left 90ms ease-out, top 90ms ease-out, width 90ms ease-out; }
.cap.snap { transition: none; }
@media (prefers-reduced-motion: reduce) { .cap { transition: none; } }

/* glass dock */
.glass {
  background: var(--glass); -webkit-backdrop-filter: blur(18px) saturate(1.8); backdrop-filter: blur(18px) saturate(1.8);
  border: .5px solid var(--glassBorder);
  box-shadow: 0 10px 34px var(--glassShadow), inset 0 1px 0 var(--glassHi), inset 0 -.5px 0 rgba(0,0,0,.05);
}
.dock {
  position: fixed; z-index: 25; left: 0; right: 0; margin: 0 auto; width: calc(100% - 24px); max-width: 600px;
  bottom: max(12px, env(safe-area-inset-bottom)); border-radius: 34px; padding: 14px;
}
.chips { display: flex; gap: 6px; margin-bottom: 12px; }
.chip { flex: 1; font-size: 14px; padding: 7px 0; border-radius: 18px; background: var(--fill); }
.chip[aria-checked="true"] { background: var(--accent); color: #fff; }
.prog { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--ink2); font-variant-numeric: tabular-nums; margin: 0 4px 12px; }
.bar { flex: 1; height: 4px; border-radius: 2px; background: var(--fill); overflow: hidden; }
.bar i { display: block; height: 100%; width: 0; background: var(--ink); }
body[data-mode="idle"] .bar.mine i { background: var(--accent); }
.caption { font-size: 14px; line-height: 1.45; color: var(--ink); text-align: center; margin: 2px 6px 12px; }
.row { display: flex; align-items: center; justify-content: center; gap: 10px; }
.btn { height: 52px; border-radius: 26px; display: flex; align-items: center; justify-content: center; gap: 7px;
  font-size: 17px; font-weight: 600; user-select: none; -webkit-user-select: none; white-space: nowrap; }
.btn svg { width: 17px; height: 17px; fill: currentColor; flex: none; }
.btn.pri { flex: 1; background: var(--accent); color: #fff; box-shadow: inset 0 1px 0 rgba(255,255,255,.35), 0 4px 14px rgba(88,86,214,.35); }
.btn.sec { padding: 0 18px; background: var(--fill); }
.btn.tint { flex: 1; background: var(--accentCap); color: var(--accentText); }
#record svg { fill: var(--red); }
.done { height: 52px; min-width: 150px; padding: 0 26px; border-radius: 26px; display: flex; align-items: center; justify-content: center; gap: 8px;
  font-size: 17px; font-weight: 600; background: var(--fill); color: var(--accentText); box-shadow: inset 0 1px 0 var(--glassHi);
  transition: transform 120ms linear; }
.done svg { width: 17px; height: 17px; }

/* library sheet */
.sheet { margin: auto auto 0; width: 100%; max-width: 600px; max-height: 82vh; padding: 0; border: 0; border-radius: 34px 34px 0 0;
  background: var(--paper); color: var(--ink); box-shadow: 0 -10px 40px rgba(0,0,0,.18); }
.sheet::backdrop { background: rgba(0,0,0,.22); }
@media (min-width: 700px) { .sheet { margin: auto; border-radius: 28px; } }
.sheet-in { padding: 14px 18px calc(18px + env(safe-area-inset-bottom)); }
.sh-hd { display: flex; justify-content: space-between; align-items: center; margin: 4px 4px 12px; }
.sh-hd b { font-size: 22px; font-weight: 700; outline: none; }
.x { width: 32px; height: 32px; border-radius: 16px; background: var(--fill); color: var(--ink2); font-size: 13px; }
.grp { font-size: 13px; font-weight: 600; color: var(--ink2); margin: 14px 4px 8px; }
.list { background: var(--fill); border-radius: 20px; overflow: hidden; }
.li { width: 100%; display: flex; align-items: center; gap: 12px; padding: 12px 16px; text-align: left; border-bottom: .5px solid var(--fill); }
.li:last-child { border-bottom: 0; }
.li .t { flex: 1; min-width: 0; }
.li .t b { display: block; font-family: var(--serif); font-size: 18px; font-weight: 500; }
.li .t small { font-size: 13px; color: var(--ink2); font-variant-numeric: tabular-nums; }
.li .now { font-size: 12px; color: var(--accentText); font-weight: 600; }
.sh-foot { font-size: 12.5px; color: var(--ink2); text-align: center; margin-top: 14px; }

.toast { position: fixed; z-index: 40; top: calc(env(safe-area-inset-top) + 64px); left: 50%; transform: translateX(-50%);
  max-width: calc(100% - 32px); border-radius: 22px; padding: 10px 18px; font-size: 14.5px; font-weight: 500;
  background: color-mix(in srgb, var(--paper) 82%, transparent); }
.load { color: var(--ink2); font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", sans-serif; font-size: 16px; }
