/* Lumin Reader: the meaning card and words deck, Words you'll meet, the Text and page panel with Reading help and the
   line guide, and the Reading options page (PB-U2; design 4, 12, 13, 14, build plan 6.6 and 6.10).
   Cards over the page take the paper's colors (--pcard, --ink, --pmuted from reader.css); every target is 44 px.
   Copyright (C) 2026 B7 Collective LLC. Licensed under AGPL-3.0-only. */

/* ===================================================================================================================
   The meaning card
   =================================================================================================================== */
.mcard { position: fixed; z-index: 34; box-sizing: border-box; display: flex; flex-direction: column; gap: 0; margin: 0; padding: 0; overflow: hidden;
  background: var(--pcard, #FFFDF8); color: var(--ink, #1F2328); border-radius: 26px;
  box-shadow: var(--float, 0 10px 30px rgb(0 0 0 / .18), 0 2px 6px rgb(0 0 0 / .10)), 0 0 0 1px var(--pline2, rgb(31 35 40 / .08));
  font-family: var(--sans); font-size: calc(18px * var(--cscale, 1)); line-height: 1.45; text-align: left; letter-spacing: normal; word-spacing: normal;
  transition: opacity 180ms var(--ease), transform 180ms var(--ease); -webkit-tap-highlight-color: transparent; }
.mcard.pop { border-radius: 20px; overflow: visible; }
.mcard.kid { font-size: calc(20px * var(--cscale, 1)); }
.reader[data-paper="night"] .mcard, .reader[data-paper="dusk"] .mcard { box-shadow: 0 0 0 1px var(--pline2), 0 26px 50px -18px rgb(0 0 0 / .75); }
/* Rising in and out (design 4.4): phones rise 240 ms from 24 px; popovers scale from .96; reduced motion: a short fade */
.mcard.phone { transition-duration: 240ms; }
.mcard.phone.in { opacity: 0; transform: translateY(24px); }
.mcard.pop.in { opacity: 0; transform: scale(.96); }
.mcard.phone[data-mode="top"].in { transform: translateY(-24px); }
.mcard.out { opacity: 0; transition-duration: 180ms; pointer-events: none; }
.mcard.phone.out { transform: translateY(16px); }
.mcard.pop[data-mode="below"] { transform-origin: top center; } .mcard.pop[data-mode="above"] { transform-origin: bottom center; }
.mgrab { flex-shrink: 0; width: 40px; height: 5px; border-radius: 3px; margin: 8px auto 0; background: color-mix(in srgb, var(--pmuted, #6B6458) 45%, transparent); }
.mscroll { flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 10px 18px 16px; border-radius: inherit; scrollbar-width: thin; }
.mcard.pop .mscroll { padding: 14px 18px 16px; }
.mhead { display: flex; align-items: center; gap: 8px; min-height: 44px; }
.mh { margin: 0; flex: 1 1 auto; min-width: 0; font: inherit; }
.mword { display: block; max-width: 100%; border: 0; padding: 0; margin: 0; background: none; color: var(--ink, #1F2328); text-align: left; cursor: pointer;
  font-family: var(--serif); font-weight: 400; font-size: calc(32px * var(--cscale, 1)); line-height: 1.1; letter-spacing: -.005em; overflow-wrap: anywhere; border-radius: 8px; }
.mword:disabled { cursor: default; opacity: 1; }
.mcount { flex-shrink: 0; font-size: 13px; font-weight: 700; color: var(--pmuted, #6B6458); font-variant-numeric: tabular-nums; }
.mclose { flex-shrink: 0; width: 44px; height: 44px; margin-right: -8px; border: 0; border-radius: 50%; background: none; color: var(--pmuted, #6B6458); display: inline-flex; align-items: center; justify-content: center; cursor: pointer; }
.mclose:hover { background: color-mix(in srgb, var(--ink) 7%, transparent); color: var(--ink); }
.mbody { display: flex; flex-direction: column; gap: 10px; margin-top: 6px; }
.mbody .skel.line { display: block; height: 14px; border-radius: 7px; background: color-mix(in srgb, var(--ink, #1F2328) 9%, transparent); }
.mbody .skel.line.short { width: 60%; }
.mmeta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; }
.mpron { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 14px 0 12px; border: 0; border-radius: 22px; cursor: pointer;
  background: color-mix(in srgb, var(--ink, #1F2328) 7%, transparent); color: var(--ink, #1F2328); font-family: var(--sans); font-size: 16px; -webkit-touch-callout: none; user-select: none; -webkit-user-select: none; }
.mpron .icon { color: var(--teal, #1F6F78); flex-shrink: 0; }
.reader[data-paper="night"] .mpron .icon, .reader[data-paper="dusk"] .mpron .icon { color: #7CC6CE; }
.mpron .ipa { font-family: "Atkinson Hyperlegible", "Noto Sans", "DejaVu Sans", system-ui, sans-serif; }
.mpron.playing .icon { animation: mplay 1s var(--ease) infinite; }
@keyframes mplay { 50% { opacity: .35; } }
.mpos { font-family: var(--serif); font-style: italic; font-size: 16px; color: var(--pmuted, #6B6458); }
.mlevel { font-size: 13px; font-weight: 700; color: var(--pmuted, #6B6458); }
.mform { margin: 0; font-size: 15px; color: var(--pmuted, #6B6458); }
.mform b { color: var(--ink); font-family: var(--serif); font-weight: 600; }
.mdef { margin: 0; font-size: 1em; line-height: 1.5; color: var(--ink, #1F2328); }
.mstate { margin: 0; font-size: 1em; line-height: 1.45; }
.mmuted { margin: 0; font-size: 15px; color: var(--pmuted, #6B6458); }
/* The sentence from the book, with a short marigold rule, the word in bold, two lines at most */
.msent { margin: 0; padding: 0 0 0 12px; border-left: 3px solid var(--accent, #F2B544); font-family: var(--serif); font-style: italic; font-size: 15px; line-height: 1.5; color: var(--pmuted, #6B6458);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.msent b { font-weight: 600; color: var(--ink, #1F2328); }
.mcard.kid .msent { font-style: normal; font-family: var(--sans); font-size: 16px; }
.mcard.more .msent { -webkit-line-clamp: 6; }
/* Actions: Save to Vocab fills the row; Highlight and Lookup carry their names */
.macts { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 8px; margin-top: 2px; }
.macts.one { grid-template-columns: auto; justify-content: start; }
/* The actions never leave the card: when the card is shorter than its contents (a short phone, a held word with its
   colors, a card above a low word) the row stays pinned at the bottom and the meaning scrolls under it, fading out */
.mcard .macts { position: sticky; bottom: -16px; z-index: 1; margin: 0 -18px -6px; padding: 8px 18px 16px; background: var(--pcard, #FFFDF8);
  box-shadow: 0 -18px 14px -12px var(--pcard, #FFFDF8); }
#layer > .mcard .macts { background: var(--card); box-shadow: 0 -18px 14px -12px var(--card); }
.macts.deck { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.mbtn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 50px; min-width: 50px; padding: 0 14px; border: 0; border-radius: 16px; cursor: pointer;
  background: color-mix(in srgb, var(--ink, #1F2328) 7%, transparent); color: var(--ink, #1F2328); font-family: var(--sans); font-weight: 700; font-size: 15px; text-decoration: none; white-space: nowrap; }
.mbtn:hover { background: color-mix(in srgb, var(--ink, #1F2328) 11%, transparent); }
.mbtn:disabled { opacity: .4; cursor: default; }
.mbtn.primary { background: var(--accent, #F2B544); color: #18212B; box-shadow: 0 2px 0 var(--accent-lip, #C88D21); }
.mbtn.primary:hover { filter: brightness(1.04); }
.mbtn.primary.on { background: color-mix(in srgb, var(--sage, #6F8F6C) 22%, transparent); color: var(--ink); box-shadow: none; }
.mbtn .icon { flex-shrink: 0; }
/* Highlight and Lookup: the icon over its name, so Save to Vocab keeps the room it needs */
.macts:not(.deck):not(.one) .mbtn:not(.primary) { flex-direction: column; gap: 2px; min-width: 64px; padding: 4px 10px; font-size: 12px; }
.mbtn.primary { overflow: hidden; }
.mbtn.primary > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
/* Narrow phones: the whole "Save to Vocab" label fits beside Highlight and Lookup */
@media (max-width: 399px) {
  .macts { gap: 6px; }
  .mcard .macts .mbtn.primary { padding: 0 10px; gap: 5px; }
  .macts:not(.deck):not(.one) .mbtn:not(.primary) { min-width: 0; padding: 4px 6px; }
}
@media (max-width: 339px) {
  .macts:not(.deck):not(.one) { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .macts:not(.deck):not(.one) .msave { grid-column: 1 / -1; }
  .macts:not(.deck):not(.one) .mbtn:not(.primary) { flex-direction: row; gap: 6px; min-height: 44px; font-size: 13px; }
}
.msaved { margin: -4px 0 0; font-size: 13px; color: var(--pmuted, #6B6458); }
.msaved[hidden] { display: none; }
.mmorebtn { align-self: flex-start; min-height: 44px; padding: 0 2px; border: 0; background: none; color: var(--teal, #1F6F78); font-family: var(--sans); font-weight: 700; font-size: 15px; cursor: pointer; }
.reader[data-paper="night"] .mmorebtn, .reader[data-paper="dusk"] .mmorebtn, .reader[data-paper="night"] .mreport, .reader[data-paper="dusk"] .mreport { color: #7CC6CE; }
.mall { display: flex; flex-direction: column; gap: 12px; padding-top: 4px; border-top: 1px solid var(--pline2, rgb(31 35 40 / .08)); }
.mall[hidden] { display: none; }
.mgroup { display: flex; flex-direction: column; gap: 4px; }
.mgpos { margin: 8px 0 0; font-family: var(--serif); font-style: italic; color: var(--pmuted, #6B6458); font-size: 16px; }
.mdefs { margin: 0; padding-left: 1.3em; display: flex; flex-direction: column; gap: 6px; font-size: .9em; }
.mdefs li::marker { color: var(--accent-lip, #C88D21); font-weight: 700; }
.mreport { align-self: flex-start; display: inline-flex; align-items: center; min-height: 44px; color: var(--teal, #1F6F78); font-size: 14px; font-weight: 700; }
.mnav { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; padding-top: 6px; border-top: 1px solid var(--pline2, rgb(31 35 40 / .08)); }
.mnav .mbtn { min-height: 44px; background: none; }
.mnav .mbtn:last-child { justify-self: end; }
.mcard :focus-visible { outline: 2px solid var(--link, #1F6F78); outline-offset: 2px; }
.reader[data-paper="night"] .mcard :focus-visible, .reader[data-paper="dusk"] .mcard :focus-visible { outline-color: #7CC6CE; }
/* The popover's pointer (18 px), toward the word */
.mptr { position: absolute; width: 18px; height: 18px; background: var(--pcard, #FFFDF8); transform: rotate(45deg); pointer-events: none; z-index: -1;
  box-shadow: 0 0 0 1px var(--pline2, rgb(31 35 40 / .08)); }
.mptr[hidden], .mcard.phone .mptr { display: none; }
.mcard[data-mode="below"] .mptr { top: -8px; margin-left: -9px; }
.mcard[data-mode="above"] .mptr { bottom: -8px; margin-left: -9px; }
.mcard[data-mode="right"] .mptr { left: -8px; margin-top: -9px; }
.mcard[data-mode="left"] .mptr { right: -8px; margin-top: -9px; }
/* The ring around the tapped word (with the teal tint from ::highlight(tapped)) */
.mring { position: fixed; z-index: 33; border-radius: 5px; box-shadow: 0 0 0 2px var(--sel-edge, #1F6F78); pointer-events: none; }
.reader[data-paper="night"] .mring, .reader[data-paper="dusk"] .mring { box-shadow: 0 0 0 2px #7CC6CE; }
/* Outside a book (the book page's words): the app's own card colors */
#layer > .mcard { background: var(--card); color: var(--ink); --pcard: var(--card); --pmuted: var(--muted); --pline2: var(--line); }

/* ===================================================================================================================
   Words you'll meet: the pill at a part's start, dotted lines, and the book page list
   =================================================================================================================== */
.prose .rwpill { display: flex; justify-content: center; margin: -.6em 0 1.4em; text-indent: 0; break-inside: avoid; break-after: avoid; }
.rwbtn { display: inline-flex; align-items: center; gap: 8px; min-height: 36px; padding: 0 14px 0 12px; border: 0; border-radius: 18px; cursor: pointer;
  background: color-mix(in srgb, var(--sage, #6F8F6C) 16%, transparent); color: var(--ink, #1F2328); font-family: var(--sans); font-weight: 700; font-size: max(14px, .72em); line-height: 1.2;
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--sage, #6F8F6C) 30%, transparent); position: relative; }
/* 36 px to the eye, 44 px to the finger */
.rwbtn::before { content: ""; position: absolute; inset: -4px 0; }
.rwbtn .icon { color: var(--sage, #6F8F6C); }
.reader[data-paper="night"] .rwbtn .icon, .reader[data-paper="dusk"] .rwbtn .icon { color: #A9C8A4; }
.rwchev { font-size: 1.2em; line-height: 1; color: var(--pmuted, #6B6458); }
.rwbtn:focus-visible { outline: 2px solid var(--link, #1F6F78); outline-offset: 3px; }
/* The first time a new word appears: a 1.5 px dotted line at 45% ink, 5 px under it */
.prose .rnw { text-decoration-line: underline; text-decoration-style: dotted; text-decoration-thickness: 1.5px; text-underline-offset: 5px; text-decoration-skip-ink: none;
  text-decoration-color: color-mix(in srgb, var(--ink, #1F2328) 45%, transparent); }
.prose .rnw.off { text-decoration: none; }

/* The book page (views.js puts this section in its slot) */
.wym { display: flex; flex-direction: column; gap: var(--s3, 12px); }
.wymhead { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.wymhead .sec-title { margin: 0; }
.wymfor { font-size: var(--t-s, 15px); font-weight: 700; color: var(--muted); }
.wymsub { margin: -6px 0 0; font-size: var(--t-s, 15px); color: var(--muted); }
.wymsub:empty { display: none; }
.wymlist { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; background: var(--card); border-radius: var(--r-l, 22px); box-shadow: var(--shadow); }
.wymrow { display: grid; grid-template-columns: 44px minmax(0, 1fr); align-items: start; gap: 12px; padding: 12px 16px 12px 10px; border-bottom: 1px solid var(--line); }
.wymrow:last-child { border-bottom: 0; }
.wymsay { width: 44px; height: 44px; border: 0; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; background: var(--soft); color: var(--teal, #1F6F78); }
.wymsay.playing .icon { animation: mplay 1s var(--ease) infinite; }
.wymtxt { min-width: 0; display: flex; flex-direction: column; gap: 2px; padding-top: 4px; }
.wymw { margin: 0; display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 10px; }
.wymword { border: 0; padding: 0; background: none; color: var(--ink); font-family: var(--serif); font-size: calc(20px * var(--scale, 1)); line-height: 1.25; cursor: pointer; text-align: left; min-height: 32px; }
.wymword:hover { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 4px; }
.wympos { font-family: var(--serif); font-style: italic; color: var(--muted); font-size: var(--t-s, 15px); }
.wymd { margin: 0; color: var(--ink); font-size: var(--t-s, 15px); line-height: 1.45; overflow-wrap: anywhere; }
.wymacts { display: flex; flex-wrap: wrap; gap: 8px; }
.wym.known .wymlist { opacity: .55; }
@media (max-width: 359px) { .wymacts .btn { flex: 1 1 100%; } .wymrow { padding-right: 10px; gap: 8px; } }

/* ===================================================================================================================
   The Text and page panel
   =================================================================================================================== */
.tpanel { position: fixed; z-index: 32; box-sizing: border-box; display: flex; flex-direction: column; gap: 0; margin: 0; padding: 0; overflow: hidden;
  background: var(--pcard, #FFFDF8); color: var(--ink, #1F2328); border-radius: 26px; font-family: var(--sans); font-size: calc(15px * var(--cscale, 1)); line-height: 1.35;
  box-shadow: var(--float, 0 10px 30px rgb(0 0 0 / .18), 0 2px 6px rgb(0 0 0 / .10)), 0 0 0 1px var(--pline2, rgb(31 35 40 / .08));
  transition: opacity 200ms var(--ease), transform 240ms var(--ease); letter-spacing: normal; word-spacing: normal; text-align: left; }
/* Night: the panel's small muted labels at 5.2:1 (APD-09: 4.49:1) */
.reader[data-paper="night"] .tpanel { --pmuted: #9AA4AE; }
.reader[data-paper="night"] .tpanel, .reader[data-paper="dusk"] .tpanel { box-shadow: 0 0 0 1px var(--pline2), 0 26px 50px -18px rgb(0 0 0 / .75); }
.tpanel.dock { bottom: calc(8px + var(--safe-bottom, env(safe-area-inset-bottom, 0px))); }
.tpanel.side, .tpanel.pop { border-radius: 20px; }
.tpanel.in { opacity: 0; } .tpanel.dock.in { transform: translateY(24px); } .tpanel.pop.in, .tpanel.side.in { transform: translateY(-6px); }
.tpanel.out { opacity: 0; transition-duration: 160ms; pointer-events: none; } .tpanel.dock.out { transform: translateY(16px); }
.tpgrab { flex-shrink: 0; width: 40px; height: 5px; border-radius: 3px; margin: 8px auto 0; background: color-mix(in srgb, var(--pmuted, #6B6458) 45%, transparent); }
.tpanel:not(.dock) .tpgrab { display: none; }
.tpbody { flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; }
.tpview { display: flex; flex-direction: column; gap: 10px; padding: 6px 16px 16px; }
.tpanel:not(.dock) .tpview { padding-top: 12px; }
.tphead { display: flex; align-items: center; gap: 8px; min-height: 44px; }
.tptitle { margin: 0 auto 0 0; font-family: var(--serif); font-weight: 400; font-size: calc(21px * var(--cscale, 1)); line-height: 1.2; outline: none; min-width: 0; }
.tpchip { flex-shrink: 0; min-height: 36px; padding: 0 12px; border: 0; border-radius: 18px; cursor: pointer; position: relative;
  background: color-mix(in srgb, var(--ink) 7%, transparent); color: var(--ink); font-family: var(--sans); font-weight: 700; font-size: 13px; }
.tpchip::before { content: ""; position: absolute; inset: -4px 0; }
.tpchip[aria-pressed="true"] { background: var(--teal, #1F6F78); color: #fff; }
.tpclose { flex-shrink: 0; width: 44px; height: 44px; margin-right: -8px; border: 0; border-radius: 50%; background: none; color: var(--pmuted); display: inline-flex; align-items: center; justify-content: center; cursor: pointer; }
.tpclose:hover { background: color-mix(in srgb, var(--ink) 7%, transparent); color: var(--ink); }
.tprow { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.tprl { margin: 0; font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--pmuted); }
/* Radio rows */
.tpseg { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 4px; padding: 3px; border-radius: 16px; background: color-mix(in srgb, var(--ink) 6%, transparent); }
.tpseg button { min-height: 44px; min-width: 0; padding: 4px 6px; border: 0; border-radius: 13px; background: none; color: var(--pmuted); cursor: pointer;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; font-family: var(--sans); font-weight: 700; font-size: 13px; line-height: 1.15; text-align: center; }
.tpseg button[aria-checked="true"] { background: var(--pcard, #FFFDF8); color: var(--ink); box-shadow: 0 1px 2px rgb(0 0 0 / .12), 0 0 0 2px var(--teal, #1F6F78); }
.reader[data-paper="night"] .tpseg button[aria-checked="true"], .reader[data-paper="dusk"] .tpseg button[aria-checked="true"] { background: color-mix(in srgb, var(--ink) 12%, var(--pcard)); box-shadow: 0 0 0 2px #7CC6CE; }
.tpseg button:disabled { opacity: .4; cursor: default; }
.tpseg button .icon { width: 20px; height: 20px; }
.tplab { overflow-wrap: anywhere; }
.tpseg button:focus-visible, .tpsw:focus-visible, .tpa:focus-visible, .tpmore:focus-visible, .tphelpbtn:focus-visible, .tpback:focus-visible, .tpchip:focus-visible, .tpclose:focus-visible, .tpreset:focus-visible { outline: 2px solid var(--link, #1F6F78); outline-offset: 2px; }
/* Papers: four swatches with "Aa" in their own colors */
.tpseg.papers { background: none; padding: 0; gap: 8px; }
.tpseg.papers button { min-height: 64px; padding: 0 0 2px; border-radius: 16px; gap: 3px; font-size: 12px; color: var(--ink); background: none; box-shadow: none; }
.tpseg.papers button[aria-checked="true"] { background: none; box-shadow: none; }
.tpaa { display: flex; align-items: center; justify-content: center; width: 100%; height: 48px; border-radius: 14px; font-family: var(--serif); font-size: 21px; font-weight: 400;
  box-shadow: inset 0 0 0 1px rgb(0 0 0 / .12); }
.tpaa[data-paper="paper"] { background: #F7F3EA; color: #1F2328; } .tpaa[data-paper="sepia"] { background: #F1E4CB; color: #3B2F22; }
.tpaa[data-paper="dusk"] { background: #3F444A; color: #DCDFE2; } .tpaa[data-paper="night"] { background: #14191F; color: #D8DDE2; box-shadow: inset 0 0 0 1px rgb(255 255 255 / .12); }
.tpseg.papers button[aria-checked="true"] .tpaa { box-shadow: 0 0 0 2.5px var(--pcard, #FFFDF8), 0 0 0 4.5px var(--teal, #1F6F78); }
.reader[data-paper="night"] .tpseg.papers button[aria-checked="true"] .tpaa, .reader[data-paper="dusk"] .tpseg.papers button[aria-checked="true"] .tpaa { box-shadow: 0 0 0 2.5px var(--pcard), 0 0 0 4.5px #7CC6CE; }
/* Faces: each sample in its own face, its name under it */
.tpface { font-size: 21px; font-weight: 400; line-height: 1.1; color: var(--ink); }
.tpface[data-face="serif"] { font-family: "Literata", Georgia, serif; }
.tpface[data-face="clear"] { font-family: "Atkinson Hyperlegible", system-ui, sans-serif; }
.tpface[data-face="system"] { font-family: ui-serif, "Iowan Old Style", "Noto Serif", Georgia, serif; }
.tpseg.faces button { min-height: 56px; font-size: 12px; font-weight: 700; }
.tpseg.faces .tpface { font-size: 19px; }
/* The last row: Layout beside Spacing and margins */
.tplast { display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; align-items: stretch; }
.tplast .tpseg.layout button { flex-direction: row; gap: 6px; font-size: 13px; padding: 4px 2px; }
.tpnav { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 8px; }
.tpnav .tpmore, .tpnav .tphelpbtn { min-height: 52px; }
@media (max-width: 339px) { .tpnav { grid-template-columns: minmax(0, 1fr); } }
/* Docked on a phone or tablet: compact, so the page above keeps as many lines as it can */
.tpanel.dock .tpview { gap: 8px; padding: 2px 14px 12px; }
.tpanel.dock .tpview.more { gap: 10px; }
.tpanel.dock .tphead { min-height: 40px; }
.tpanel.dock .tpseg.papers button { min-height: 52px; }
.tpanel.dock .tpaa { height: 38px; font-size: 18px; }
.tpanel.dock .tpseg.faces button { min-height: 46px; }
.tpanel.dock .tpseg.faces .tpface { font-size: 17px; }
.tpanel.dock .tpa { height: 44px; }
.tpanel.dock .tpgrab { margin-top: 6px; }
/* Docked on a phone: each paper's name sits in its own tile, in that paper's ink (one row instead of two) */
@media (max-width: 599px) {
  .tpanel.dock .tpseg.papers button { position: relative; min-height: 44px; padding: 0; }
  .tpanel.dock .tpaa { height: 44px; font-size: 0; }
  .tpanel.dock .tpseg.papers .tplab { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 700; pointer-events: none; }
  .tpanel.dock .tpseg.papers [data-v="paper"] .tplab { color: #1F2328; } .tpanel.dock .tpseg.papers [data-v="sepia"] .tplab { color: #3B2F22; }
  .tpanel.dock .tpseg.papers [data-v="dusk"] .tplab { color: #DCDFE2; } .tpanel.dock .tpseg.papers [data-v="night"] .tplab { color: #D8DDE2; }
  .tpanel.dock .tpa { height: 40px; }
  .tpanel.dock .tpseg.faces button { min-height: 44px; }
  .tpanel.dock .tpseg.layout button { min-height: 40px; }
}
.tpshort { display: none; }
/* Docked on a phone: the short typeface names fit on one line (screen readers still hear the full name) */
@media (max-width: 599px) {
  .tpanel.dock .tpseg.faces .tplong { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
  .tpanel.dock .tpseg.faces .tpshort { display: inline; }
}
.tpnav .tpmore, .tpnav .tphelpbtn { font-size: 14px; }
@media (max-width: 399px) {
  .tpnav .tplong { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
  .tpnav .tpshort { display: inline; }
}
.tpnav .tpmt > span:first-child { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tphsum { min-width: 0; font-weight: 400; font-size: 12px; color: var(--pmuted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* Size: A, the 18-step scale, A */
.tpsize { display: grid; grid-template-columns: 52px minmax(0, 1fr) 52px; align-items: center; gap: 6px; }
.tpa { height: 48px; border: 0; border-radius: 14px; cursor: pointer; background: color-mix(in srgb, var(--ink) 7%, transparent); color: var(--ink); font-family: var(--serif); line-height: 1; touch-action: manipulation; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
.tpa.small { font-size: 15px; } .tpa.large { font-size: 26px; }
.tpa:disabled { opacity: .35; cursor: default; }
.tpscale { display: flex; flex-direction: column; align-items: center; gap: 6px; min-width: 0; }
.tpdots { display: flex; align-items: center; justify-content: center; gap: 3px; flex-wrap: nowrap; }
.tpdots i { width: 5px; height: 5px; border-radius: 50%; background: color-mix(in srgb, var(--pmuted) 45%, transparent); flex-shrink: 0; }
.tpdots i.past { background: color-mix(in srgb, var(--pmuted) 80%, transparent); }
.tpdots i.on { width: 10px; height: 10px; background: var(--teal, #1F6F78); }
.reader[data-paper="night"] .tpdots i.on, .reader[data-paper="dusk"] .tpdots i.on { background: #7CC6CE; }
.tpsizel { font-size: 13px; font-weight: 700; color: var(--pmuted); font-variant-numeric: tabular-nums; }
.tplarge { margin: -4px 0 0; font-size: 13px; color: var(--pmuted); }
.tplarge[hidden] { display: none; }
.tpmore, .tphelpbtn, .tpback { display: flex; align-items: center; gap: 8px; min-height: 48px; border: 0; background: none; color: var(--ink); cursor: pointer; font-family: var(--sans); font-weight: 700; font-size: 15px; text-align: left; border-radius: 12px; }
.tpmore, .tphelpbtn { width: 100%; padding: 4px 8px 4px 12px; border-radius: 16px; background: color-mix(in srgb, var(--ink) 6%, transparent); line-height: 1.2; }
.tpmt { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.tpsum { min-width: 0; font-weight: 400; font-size: 12px; color: var(--pmuted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tpmore .icon, .tphelpbtn .icon { color: var(--pmuted); flex-shrink: 0; }
.tpback { padding: 0 6px 0 0; color: var(--pmuted); font-size: 14px; flex-shrink: 0; }
.tpview.more .tphead { justify-content: space-between; }
.tpview.more .tptitle { margin: -4px 0 0; }
.tphelp { margin: 8px 0 0; font-family: var(--serif); font-weight: 400; font-size: calc(19px * var(--cscale, 1)); }
.tpgroup { display: flex; flex-direction: column; border-radius: 16px; background: color-mix(in srgb, var(--ink) 4%, transparent); }
/* Switch rows */
.tpsw { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 52px; padding: 8px 12px; border: 0; background: none; color: var(--ink); cursor: pointer; text-align: left; font-family: var(--sans); border-radius: 16px; }
.tpsw + .tpsw { border-top: 1px solid var(--pline2, rgb(31 35 40 / .08)); border-radius: 0; }
.tpswt { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.tpswt b { font-size: 15px; }
.tpswt small { font-size: 13px; color: var(--pmuted); line-height: 1.35; }
.tpknob { flex-shrink: 0; position: relative; width: 46px; height: 28px; border-radius: 14px; background: color-mix(in srgb, var(--pmuted) 40%, transparent); transition: background-color 160ms; }
.tpknob::after { content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgb(0 0 0 / .3); transition: transform 200ms var(--ease); }
.tpsw[aria-checked="true"] .tpknob { background: var(--teal, #1F6F78); }
.tpsw[aria-checked="true"] .tpknob::after { transform: translateX(18px); }
.tpsw:disabled { cursor: default; }
.tpsw:disabled .tpknob, .tpsw:disabled b { opacity: .45; }
.tpreset { align-self: flex-start; display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 14px; margin-top: 4px; border: 0; border-radius: 22px; cursor: pointer;
  background: color-mix(in srgb, var(--ink) 7%, transparent); color: var(--ink); font-family: var(--sans); font-weight: 700; font-size: 14px; }
/* Under 340 px, or past 60% of the height (200% zoom): the rows stack, and the panel scrolls inside */
.tpanel.stack .tplast { grid-template-columns: minmax(0, 1fr); }
.tpanel.stack .tpsize { grid-template-columns: 1fr 1fr; grid-template-areas: "a b" "s s"; }
.tpanel.stack .tpa.small { grid-area: a; } .tpanel.stack .tpa.large { grid-area: b; } .tpanel.stack .tpscale { grid-area: s; }
.tpanel.stack .tpseg.faces, .tpanel.stack .tpseg.layout { grid-auto-flow: row; grid-auto-columns: auto; grid-template-columns: minmax(0, 1fr); }
.tpanel.stack .tpseg.faces button { flex-direction: row; justify-content: flex-start; gap: 10px; padding: 4px 12px; min-height: 48px; }
.tpanel.stack .tpseg.layout button { flex-direction: row; gap: 8px; }
.tpanel.stack .tplast .tpseg.layout { grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); grid-template-columns: none; }
@media (max-width: 239px) { .tpanel.stack .tpseg.papers { grid-auto-flow: row; grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.tpanel.stack .tpseg.papers { gap: 4px; }
.tpanel.stack .tpseg.three { grid-auto-flow: row; grid-template-columns: minmax(0, 1fr); }
.tpanel.stack .tphead { flex-wrap: wrap; row-gap: 4px; }
.tpanel.stack .tptitle { flex: 1 1 calc(100% - 60px); }
.tpanel.stack .tpchip { order: 3; }
.tpanel.stack .tpview { padding-inline: 12px; }
.tpanel.stack .tpdots i { width: 4px; height: 4px; } .tpanel.stack .tpdots i.on { width: 8px; height: 8px; } .tpanel.stack .tpdots { gap: 2px; }

/* ===================================================================================================================
   The line guide (Reading help)
   =================================================================================================================== */
.rlgwin { position: fixed; z-index: 8; pointer-events: none; border-radius: 8px; box-shadow: 0 0 0 200vmax color-mix(in srgb, var(--paper, #F7F3EA) 62%, transparent);
  transition: top 160ms var(--ease), height 160ms var(--ease); }
.rlgwin[hidden], .rlgctl[hidden] { display: none; }
.rlgctl { position: fixed; z-index: 11; display: flex; gap: 4px; padding: 2px; border-radius: 24px; background: var(--pcard, #FFFDF8); box-shadow: var(--float, 0 10px 30px rgb(0 0 0 / .18)), 0 0 0 1px var(--pline2); transition: top 160ms var(--ease); }
.rlgb { width: 44px; height: 44px; border: 0; border-radius: 50%; background: none; color: var(--ink); display: inline-flex; align-items: center; justify-content: center; cursor: pointer; }
.rlgb:focus-visible { outline: 2px solid var(--link, #1F6F78); outline-offset: 1px; }
.rlgctl.side { flex-direction: column; }
.reader.lgband .rstatus .rstext { visibility: hidden; }

/* ===================================================================================================================
   Reading options (a page in the app)
   =================================================================================================================== */
.ropts .srow.stack > .segctl { flex-wrap: wrap; border-radius: 18px; }
.ropts .srow.stack > .segctl button { flex: 1 1 auto; white-space: normal; line-height: 1.2; padding-block: 6px; }
.ropselw { position: relative; display: flex; align-items: center; }
.ropsel { appearance: none; -webkit-appearance: none; width: 100%; min-height: 48px; padding: 0 44px 0 16px; border-radius: 14px; border: 0; background: var(--bg); color: var(--ink); font: inherit; font-weight: 700; box-shadow: inset 0 0 0 1px var(--line); cursor: pointer; }
.ropsel:focus-visible { outline: 3px solid var(--link); outline-offset: 1px; }
.ropselw .icon { position: absolute; right: 14px; pointer-events: none; color: var(--muted); }
.hcnames { display: flex; flex-direction: column; gap: 8px; }
.hcrow { display: grid; grid-template-columns: 18px 84px minmax(0, 1fr); align-items: center; gap: 10px; }
.hcdot { width: 16px; height: 16px; border-radius: 50%; background: rgb(var(--hl-y, 242 181 68)); }
.hcdot.c-g { background: rgb(var(--hl-g, 120 170 110)); } .hcdot.c-b { background: rgb(var(--hl-b, 104 152 214)); } .hcdot.c-p { background: rgb(var(--hl-p, 222 122 152)); }
.hcdot.c-u { background: none; border-radius: 0; height: 3px; background: var(--ink); }
.hccol { font-size: var(--t-s, 15px); color: var(--muted); font-weight: 700; }
.hcrow input { min-height: 44px; width: 100%; min-width: 0; padding: 0 12px; border-radius: 12px; border: 0; background: var(--bg); color: var(--ink); font: inherit; box-shadow: inset 0 0 0 1px var(--line); }
@media (max-width: 359px) { .hcrow { grid-template-columns: 18px minmax(0, 1fr); } .hcrow .hccol { display: none; } }

/* ===================================================================================================================
   Reduced motion and Calmer motion: every card a short fade, nothing else moves
   =================================================================================================================== */
@media (prefers-reduced-motion: reduce) {
  .mcard, .tpanel { transition: opacity 120ms linear !important; transform: none !important; }
  .mpron.playing .icon, .wymsay.playing .icon { animation: none !important; }
  .rlgwin, .rlgctl, .tpknob, .tpknob::after { transition: none !important; }
}
html.calm .mcard, html.calm .tpanel { transition: opacity 120ms linear !important; transform: none !important; }
html.calm .mpron.playing .icon, html.calm .wymsay.playing .icon { animation: none !important; }
html.calm .rlgwin, html.calm .rlgctl { transition: none !important; }
