/* 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);
  --meta: rgba(28,28,30,.64); --cell: #FFFFFF; --sep: rgba(60,60,67,.18); --greenText: #178244; --amberText: #A35F00;
  --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);
    --meta: rgba(242,242,242,.64); --cell: #1C1C1F; --sep: rgba(84,84,88,.5); --greenText: #30D158; --amberText: #FFB340;
  }
}

* { 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; }
.sh-foot .lnk { color: var(--accentText); font-size: 13px; min-height: 44px; }
/* source after the text (D43, Iris §2.12): 14 px sans, ink.meta, 18 px below the last line */
.src { font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", sans-serif; font-size: 14px; line-height: 1.5; color: var(--meta);
  margin: 18px 0 0; cursor: pointer; }
.credits-p { margin: 0 4px 6px; }
.cr { padding: 11px 16px; border-bottom: .5px solid var(--fill); }
.cr:last-child { border-bottom: 0; }
.cr b { display: block; font-family: var(--serif); font-size: 17px; font-weight: 500; }
.cr small { font-size: 13px; color: var(--meta); }

.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; }

/* account (Iris: screens-library-account.html @ 07944c0, flow-and-visual §2.13; web frames w-lib, w-signin, w-acct) */
a { color: var(--accentText); text-decoration: none; }
a:focus-visible, input:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.grp { display: flex; justify-content: space-between; align-items: baseline; }
.grp span { font-weight: 400; font-variant-numeric: tabular-nums; }
/* collapsed level (Iris §2.11): header style, one 44 px line, chevron; opens in place */
.grp.col { min-height: 44px; align-items: center; margin: 0 4px; padding: 0; width: calc(100% - 8px); text-align: left; }
.grp.col span { display: flex; align-items: center; gap: 6px; }
.grp.col .chev { width: 12px; height: 12px; stroke: var(--meta); fill: none; stroke-width: 2.2; }
.grp.col[aria-expanded="true"] { margin-bottom: 8px; }
.grp.col[aria-expanded="true"] .chev { display: none; }
.shtop { font-size: 13.5px; color: var(--meta); margin: -6px 4px 12px; }
.badge { flex: none; font: 600 15px ui-rounded, "SF Pro Rounded", -apple-system, sans-serif; font-variant-numeric: tabular-nums; }
.badge.ok { color: var(--greenText); } .badge.no { color: var(--amberText); }
.acct-foot { position: sticky; bottom: calc(-18px - env(safe-area-inset-bottom)); margin: 12px -18px calc(-18px - env(safe-area-inset-bottom));
  padding: 10px 18px calc(18px + env(safe-area-inset-bottom)); background: var(--paper); border-top: .5px solid var(--sep); }
.acctrow { width: 100%; display: flex; align-items: center; gap: 10px; background: var(--cell); border-radius: 16px; padding: 11px 14px;
  font-size: 15px; text-align: left; min-height: 44px; }
.acctrow .l { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.acctrow .l small { display: block; font-size: 12.5px; color: var(--meta); white-space: normal; }
.acctrow .a { color: var(--accentText); font-weight: 600; }
.acct-foot .sh-foot { margin: 12px 0 0; }

.sh-hd.center { position: relative; justify-content: center; min-height: 36px; }
.sh-hd.center b { font-size: 17px; font-weight: 600; }
.sh-hd.center .back { position: absolute; left: 0; font-size: 17px; color: var(--accentText); min-height: 44px; }
.lead { font-size: 15px; line-height: 1.5; margin: 0 4px 16px; }
.center { text-align: center; }
.field { display: block; width: 100%; height: 50px; border-radius: 14px; border: 0; background: var(--fill); color: var(--ink);
  padding: 0 16px; font: inherit; font-size: 17px; margin-bottom: 10px; }
.field::placeholder { color: var(--ink3); }
.field:focus { outline: none; box-shadow: inset 0 0 0 2px var(--accent); }
.hint { font-size: 13px; color: var(--ink); margin: -4px 4px 10px; }
.btn.wide { width: 100%; flex: none; }
.consent { display: flex; gap: 10px; align-items: flex-start; margin: 18px 4px 0; font-size: 13px; line-height: 1.45; color: var(--meta); cursor: pointer; min-height: 44px; }
.consent input { appearance: none; -webkit-appearance: none; flex: none; width: 22px; height: 22px; margin: -1px 0 0; border-radius: 11px;
  box-shadow: inset 0 0 0 1.5px var(--ink2); display: grid; place-content: center; cursor: pointer; }
.consent input::after { content: ""; width: 12px; height: 12px; opacity: 0;
  background: no-repeat center/12px url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 14 14'%3E%3Cpath d='M2.5 7.5l3 3 6-7' fill='none' stroke='white' stroke-width='2.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"); }
.consent input:checked { background: var(--accent); box-shadow: none; }
.consent input:checked::after { opacity: 1; }
.consent input[aria-invalid="true"] { box-shadow: inset 0 0 0 1.5px var(--ink); }
.consent .hint { display: block; margin: 3px 0 0; }
.consent.shake { animation: shake .3s cubic-bezier(.3,1.6,.5,1); }
@keyframes shake { 0%,100% { transform: none; } 17%,50%,83% { transform: translateX(-6px); } 33%,67% { transform: translateX(6px); } }
@media (prefers-reduced-motion: reduce) { .consent.shake { animation: none; } }
.legal { font-size: 12px; color: var(--meta); line-height: 1.5; margin: 8px 4px 0 36px; }

.codes { position: relative; display: flex; gap: 8px; justify-content: center; margin: 6px 0 14px; }
.codes i { width: 46px; height: 56px; border-radius: 12px; background: var(--fill); display: flex; align-items: center; justify-content: center;
  font: 600 26px ui-rounded, "SF Pro Rounded", -apple-system, sans-serif; font-style: normal; }
.codes:focus-within i.cur { box-shadow: inset 0 0 0 2px var(--accent); }
.codes input { position: absolute; inset: 0; width: 100%; opacity: 0; font-size: 16px; border: 0; }
.links { display: flex; justify-content: space-between; align-items: center; font-size: 14.5px; margin: 0 6px; }
.links .dis { color: var(--meta); }
.links button { color: var(--accentText); min-height: 44px; }
.spam { font-size: 13px; color: var(--meta); margin: 6px 6px 0; }

.grpc { background: var(--cell); border-radius: 20px; overflow: hidden; }
.grpc.gap { margin-top: 22px; } .grpc.far { margin-top: 120px; }
.cell { width: 100%; display: flex; align-items: center; gap: 12px; min-height: 48px; padding: 10px 16px; border-bottom: .5px solid var(--sep); font-size: 16.5px; }
.cell:last-child { border-bottom: 0; }
.cell .l { flex: 1; min-width: 0; text-align: left; }
.cell .v { color: var(--meta); font-size: 15.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cell.act { color: var(--accentText); justify-content: center; }
.cell.del { color: var(--red); justify-content: center; }
.gf { font-size: 12.5px; color: var(--meta); margin: 6px 16px 0; line-height: 1.45; }
.gf.center { margin-top: 12px; }
.del-p { font-size: 15px; line-height: 1.55; margin: 10px 4px 22px; }
.del-p p { margin-bottom: 10px; } .del-p b { font-weight: 600; }
.btn.redtint { background: color-mix(in srgb, var(--red) 14%, transparent); color: var(--red); }
@media (prefers-color-scheme: dark) { .btn.redtint { color: #FF6961; } }
.confirm { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; background: rgba(0,0,0,.28); }
.confirm-in { width: min(300px, calc(100% - 48px)); border-radius: 20px; background: var(--cell); text-align: center; overflow: hidden; }
.confirm-in b { display: block; font-size: 17px; font-weight: 600; padding: 18px 16px 4px; }
.confirm-in p { font-size: 13px; color: var(--meta); padding: 0 16px 16px; }
.confirm-btns { display: flex; border-top: .5px solid var(--sep); }
.confirm-btns button { flex: 1; min-height: 46px; font-size: 17px; color: var(--accentText); }
.confirm-btns button + button { border-left: .5px solid var(--sep); }
.confirm-btns .danger { color: var(--red); font-weight: 600; }
