/* RSVP · the touch skin (docs/MOBILE.md v2). Loaded on every device but inert off touch: every rule is scoped under
   body.t, which web/touch/render.js sets (no media gate, so a pointer change after load never strips the touch renderer
   of its CSS). app.css stays loaded underneath: it carries the tokens, the reset, the glow and the stage
   geometry (the guide, the word, the ghosts), which are the design language. The reader is driven by the hand; what is
   still pressed is a thin monoline icon in the guide's own stroke. Portrait and landscape are two deliberate layouts. */

body.t {
  --scrim: rgba(0, 0, 0, .62); --veil: rgba(0, 0, 0, .9);
  --ko: "Noto Sans KR", "Apple SD Gothic Neo", "Malgun Gothic", system-ui, sans-serif;
  --gut: 16px;
  --st: env(safe-area-inset-top, 0px); --sb: env(safe-area-inset-bottom, 0px);
  --sl: env(safe-area-inset-left, 0px); --sr: env(safe-area-inset-right, 0px);
  --pl: calc(var(--gut) + var(--sl)); --pr: calc(var(--gut) + var(--sr));
}
:root[data-theme="light"] body.t { --scrim: rgba(11, 13, 16, .28); --veil: rgba(246, 247, 251, .94); }
@media (prefers-color-scheme: light) {
  :root[data-theme="auto"] body.t { --scrim: rgba(11, 13, 16, .28); --veil: rgba(246, 247, 251, .94); }
}

body.t, body.t * { box-sizing: border-box; }
body.t {
  /* the visible screen; never 100vh/100lvh: under the opaque Home Screen bar they include the status bar (WebKit 316008) */
  height: 100%; height: 100dvh; display: grid; grid-template: "main" minmax(0, 1fr) "tabs" auto / minmax(0, 1fr);
  touch-action: manipulation; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none;
}
body.t button { touch-action: manipulation; -webkit-user-select: none; user-select: none; transition: opacity 120ms; }
body.t button:disabled { color: var(--ghost); cursor: default; }
body.t :is(button, .bk-main):active:not(:disabled) { opacity: .45; transition: none; }
body.t :focus { outline: none; }
html.kbd body.t :focus-visible { outline: 2px dotted var(--red); outline-offset: 3px; }
html.kbd body.t .kc { outline: 2px dotted var(--red); outline-offset: -2px; }
html.kbd body.t .sheet:focus-visible { outline: none; }
body.t .sr { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; border: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
body.t .probe {
  position: fixed; left: 0; top: 0; visibility: hidden; pointer-events: none;
  padding: env(safe-area-inset-top, 0px) env(safe-area-inset-right, 0px) env(safe-area-inset-bottom, 0px) env(safe-area-inset-left, 0px);
}
body.t .sheets { display: contents; }

/* icons: one 1.6 px monoline stroke at every size, butt ends, sharp joins; dots filled; active = red */
body.t .ic { width: 24px; height: 24px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: butt; stroke-linejoin: miter; }
body.t .ic * { vector-effect: non-scaling-stroke; }
body.t .ic .f { fill: currentColor; stroke: none; }
body.t .ic.sm { width: 16px; height: 16px; }
body.t .ic.xs { width: 12px; height: 12px; }
body.t .ib { display: flex; align-items: center; justify-content: center; min-width: 44px; min-height: 44px; color: var(--fg); }

/* bare tracked text controls (bold; uppercase for Latin) */
body.t :is(.c, .ttab, .dk, .opt, .rowbtn, .sh-foot button, .cbtns button, .st, .kick, .gok, .endbox button) {
  font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
}
:lang(ko) body.t :is(.c, .ttab, .dk, .opt, .rowbtn, .sh-foot button, .cbtns button, .st, .gok, .endbox button) { letter-spacing: .02em; }
body.t .kick { margin: 0; color: var(--blue); font-size: 13px; line-height: 1.3; }
body.t .kick:lang(ko) { letter-spacing: .04em; }
/* the one "selected" mark for text: --fg + a 2 px solid red underline (icons: a red stroke) */
body.t :is(.opt.sel, .rlist .rowbtn.sel .lt) {
  color: var(--fg); text-decoration: underline solid var(--red); text-decoration-thickness: 2px; text-underline-offset: .45em;
}

/* ---------------- views over a bottom icon tab bar (the reader has none) */

body.t .tmain { grid-area: main; position: relative; min-height: 0; overflow: hidden; }
body.t .view { position: absolute; inset: 0; display: flex; flex-direction: column; min-height: 0; }
body.t header.head {
  flex: none; display: flex; align-items: baseline; justify-content: space-between; gap: 12px;
  padding: calc(var(--st) + 14px) var(--pr) 10px var(--pl);
}
body.t .ttl { margin: 0; font: 700 28px/1.2 var(--ui); letter-spacing: .02em; white-space: nowrap; }
body.t .tstat { font-size: 13px; color: var(--fg2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
body.t .tstat.warn { color: var(--red); }
body.t .scroll {
  flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch;
  padding: 0 var(--pr) 24px var(--pl);
}
body.t .tabbar {
  grid-area: tabs; z-index: 3; display: grid; grid-template-columns: repeat(4, 1fr);
  height: calc(56px + var(--sb)); padding: 0 var(--sr) var(--sb) var(--sl); border-top: 1px solid var(--line);
}
body.t.view-reader .tabbar { display: none; }
body.t .ttab { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; min-height: 56px; font-size: 11px; color: var(--fg2); text-align: center; }
body.t .ttab.sel { color: var(--fg); }
body.t .ttab.sel .ic { color: var(--red); }
/* library tools live in the title row, far from the tab bar, so the two icon rows never look alike */
body.t header.head.lib { align-items: center; padding-top: calc(var(--st) + 8px); padding-bottom: 0; }
body.t .ltools { display: flex; margin-right: -6px; }
body.t .dk { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-width: 52px; min-height: 52px; font-size: 11px; color: var(--fg2); }
body.t .dk .ic { color: var(--fg); }
body.t :is(.dk.act, .dk.act .ic) { color: var(--red); }
body.t .libline { flex: none; margin: 0; padding: 0 var(--pr) 8px var(--pl); font-size: 13px; color: var(--fg2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
body.t .libline .act { color: var(--red); }
body.t .libline button { font-size: 13px; min-height: 44px; }

/* ---------------- library */

body.t .tkept { flex: none; display: flex; align-items: center; justify-content: space-between; min-height: 44px; padding: 0 var(--pr) 0 var(--pl); font-size: 14px; color: var(--fg2); border-bottom: 1px solid var(--line); }
body.t .tkept .c { color: var(--fg); min-height: 44px; padding-left: 16px; font-size: 14px; }
body.t .c { min-height: 44px; }
body.t .tbooks { margin: 0; padding: 0; list-style: none; }
body.t .tbooks li { display: grid; grid-template-columns: minmax(0, 1fr) auto; border-bottom: 1px solid var(--line); }
body.t .bk-main { display: grid; grid-template-columns: 48px minmax(0, 1fr); gap: 14px; padding: 14px 0; min-width: 0; text-align: left; }
body.t .gen .gt { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; }
body.t .tgrid .gen .gt { -webkit-line-clamp: 3; }
body.t .tlist .gen { gap: .3em; padding: .55em .45em; font-size: 13px; } /* 48 px wide: the title is what reads */
body.t .tlist .gen .ty { font-size: 7px; }
body.t .tlist .gen .gt { flex: none; -webkit-line-clamp: 3; }
body.t .tlist .gen .ga { display: none; }
body.t .b-txt { min-width: 0; display: flex; flex-direction: column; gap: 3px; }
body.t .b-title { color: var(--blue); font-weight: 700; font-size: 17px; line-height: 1.3; }
body.t .b-author { font-size: 14px; }
body.t .b-meta { font-size: 13px; color: var(--fg2); font-variant-numeric: tabular-nums; }
body.t .b-meta.warn { color: var(--red); }
body.t .bar { margin-top: 8px; }
body.t .bar i { transform: scaleX(0); }
body.t .more { display: flex; align-items: flex-start; justify-content: flex-end; min-width: 56px; min-height: 56px; padding: 14px 0 0 12px; color: var(--fg2); align-self: start; }
body.t .tbooks.tgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px 16px; padding-top: 4px; }
body.t .tgrid li { grid-template-columns: minmax(0, 1fr); border: 0; }
body.t .tgrid .bk-main { grid-template-columns: minmax(0, 1fr); gap: 10px; padding: 8px 0 0; }
body.t .tgrid .gen { font-size: 12px; }
body.t .tgrid .more { justify-content: flex-start; padding: 6px 0 0; min-height: 44px; }
body.t .libempty { display: flex; flex-direction: column; justify-content: flex-end; min-height: 100%; padding-bottom: 8px; }
body.t .libempty .big { margin: 0; font: 700 22px/1.35 var(--ko); }
body.t .libempty .sub { margin: 8px 0 18px; font-family: var(--ko); color: var(--fg2); }
body.t .libempty .c { display: block; width: 100%; min-height: 52px; font-size: 17px; color: var(--blue); text-align: left; border-top: 1px solid var(--line); }
/* the filter field docks at the top, over the title row, so the keyboard never covers it */
body.t .fbar {
  position: fixed; left: 0; right: 0; top: 0; z-index: 15; display: flex; align-items: center; gap: 12px;
  padding: calc(var(--st) + 10px) var(--pr) 8px var(--pl); background: var(--bg); border-bottom: 1px solid var(--line);
}
body.t .fbar .inp { border-bottom: 1px solid var(--red); }
body.t .fbar .c { flex: none; white-space: nowrap; min-height: 44px; font-size: 15px; }

/* ---------------- reader: a top band (library icon · chapter name · ⋯), the stage, the info line and the bar */

body.t .v-reader { touch-action: none; } /* the whole reader takes every touch (no page zoom, no bounce); taps still click */
body.t.zoomed .v-reader { touch-action: pan-x pan-y pinch-zoom; } /* entered already zoomed (library, a sheet): it can zoom back out */
body.t .rtop {
  flex: none; position: relative; display: grid; grid-template-columns: 56px minmax(0, 1fr) 56px; align-items: center;
  height: calc(var(--st) + 56px); padding: var(--st) var(--pr) 0 var(--pl); transition: opacity 200ms;
}
body.t .tolib { justify-content: flex-start; }
body.t .tolib .ic.sm { margin-right: -1px; }
body.t .rmore { justify-content: flex-end; }
body.t .chb { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; min-width: 0; min-height: 48px; padding: 0 6px; text-align: center; }
body.t .chl { display: flex; align-items: center; gap: 3px; max-width: 100%; }
body.t .chb .ch { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font: 700 15px/1.3 var(--ui); letter-spacing: .02em; color: var(--fg); }
body.t .chb .caret { color: var(--fg2); transition: transform 160ms; }
body.t .chb .bt { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; color: var(--fg2); }
body.t .chb .lx { display: none; }
body.t.nobook .rdock, body.t.nobook .rtop .chb { visibility: hidden; }
body.t.toc .rtop { z-index: 22; pointer-events: none; } /* the chapter name stays lit over the scrim and closes the list */
body.t.toc .rtop .chb { pointer-events: auto; }
body.t.toc .rtop .ib { visibility: hidden; }
body.t.toc .chb .caret { transform: rotate(180deg); }
body.t .rtop.thush :is(.bt, .lx) { visibility: hidden; } /* landscape: the toast is in the top line */

body.t .stage.hw { --half: calc(var(--size) * .84 + 6px); } /* a heading word: its underline stays clear of the bars */
body.t .g2 { top: calc(var(--ay) + var(--half) + var(--sgap, 0px)); }
body.t .w { transform-origin: 0 50%; }
body.t .ghost { font-size: .6em; }
body.t .w.head :is(.wb, .wp, .wa) { text-decoration-thickness: .05em; text-underline-offset: .24em; }
/* the live readout: a big number above the word while speed or size changes; the guide stops below it (no box) */
body.t .stage.ro .g1 { height: max(0px, calc(var(--ay) - var(--half) - 72px)); }
body.t .readout {
  position: absolute; left: var(--ax); top: calc(var(--ay) - var(--half) - 18px); transform: translate(-50%, -100%);
  padding: 0 10px; white-space: nowrap; pointer-events: none; text-align: center;
  font: 700 44px/1 var(--ui); letter-spacing: .02em; color: var(--fg); font-variant-numeric: tabular-nums;
}
body.t .readout small { font-size: 13px; color: var(--fg2); margin-left: .4em; letter-spacing: .08em; }
/* dragging the bar: the chapter over the big percent, here and never next to the finger */
body.t .readout .rch { display: block; margin-bottom: 6px; font: 700 15px/1.3 var(--ui); letter-spacing: .02em; color: var(--fg2); }
body.t .stage.ro.sc .g1 { height: max(0px, calc(var(--ay) - var(--half) - 100px)); }
/* the speed level meter: a hairline at the side with a red fill and a red tick, like a phone's volume, only while it changes */
body.t .meter {
  position: absolute; right: calc(var(--sr) + 8px); top: 16%; bottom: 16%; width: 2px; background: var(--ghost);
  opacity: 0; transition: opacity 260ms; pointer-events: none; --lv: .22; z-index: 2;
}
body.t .meter.l { right: auto; left: calc(var(--sl) + 8px); } /* the finger is on the right half: the meter goes left */
body.t .meter.on { opacity: 1; transition-duration: 60ms; }
body.t .meter i { position: absolute; left: 0; right: 0; bottom: 0; height: 100%; background: var(--red); transform-origin: 50% 100%; transform: scaleY(var(--lv)); }
body.t .meter b { position: absolute; left: -6px; width: 14px; height: 2px; margin-bottom: -1px; background: var(--red); bottom: calc(var(--lv) * 100%); }
body.t .meter span { position: absolute; right: 10px; font-size: 11px; line-height: 1; color: var(--fg2); white-space: nowrap; font-variant-numeric: tabular-nums; }
body.t .meter .mx { top: 0; }
body.t .meter .mn { bottom: 0; }
body.t .meter em { position: absolute; right: 10px; bottom: calc(var(--lv) * 100%); transform: translateY(50%); font: 700 11px/1 var(--ui); font-style: normal; color: var(--fg); white-space: nowrap; font-variant-numeric: tabular-nums; }
body.t .meter.l :is(span, em) { right: auto; left: 10px; }
body.t :is(.meter.hi .mx, .meter.lo .mn) { visibility: hidden; } /* the value beside the tick replaces the end label it would sit on */
body.t .sentence {
  position: absolute; left: 50%; transform: translateX(-50%); width: max-content; max-width: calc(100% - 2 * (var(--pr) + 24px));
  top: calc(var(--ay) + var(--half) + 22px); max-height: 4.5em; overflow: hidden; margin: 0; background: none;
  font: 400 16px/1.5 var(--ko); color: var(--fg2); text-align: center; pointer-events: none;
}
body.t .sentence .now { color: var(--fg); }
body.t .endbox {
  position: absolute; left: 50%; transform: translateX(-50%); top: calc(var(--ay) + var(--half) + 16px);
  display: flex; flex-direction: column; align-items: center; padding: 0 12px;
}
body.t .endbox p { margin: 0; font: 400 16px/1.5 var(--ko); color: var(--fg2); }
body.t .endbox div { display: flex; gap: 8px; }
body.t .endbox button { min-height: 52px; min-width: 112px; padding: 0 12px; font-size: 17px; }
body.t .stage .msg {
  position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px;
  padding: 0 var(--gut); background: var(--bg); text-align: center;
}
body.t .stage .msg p { margin: 0; font: 700 18px var(--ko); color: var(--fg2); }
body.t .stage .msg .c { color: var(--blue); font-size: 17px; min-height: 52px; padding: 0 16px; }

body.t .rdock { flex: none; position: relative; padding: 0 var(--pr) var(--sb) var(--pl); }
body.t .tinfo { display: flex; align-items: center; gap: 12px; height: 28px; font-size: 13px; color: var(--fg2); transition: opacity 200ms; }
body.t .tinfo .pct { color: var(--fg); font-weight: 700; letter-spacing: .04em; font-variant-numeric: tabular-nums; }
body.t .tinfo .shint { display: flex; align-items: center; gap: 5px; white-space: nowrap; font-variant-numeric: tabular-nums; }
body.t .tinfo .shint .ic { color: var(--fg); }
body.t .tinfo .left { flex: 1 1 auto; min-width: 0; text-align: right; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
body.t :is(.tinfo.hush, .tinfo.thush) > * { visibility: hidden; }
/* the bar: 56 px of touch for a 2 px line; a red playhead tick says "drag me" */
body.t .tl { position: relative; height: 56px; width: auto; margin: 0 calc(28px - var(--gut)); touch-action: none; cursor: pointer; }
body.t .tl .track { top: 27px; transition: background-color 200ms; }
body.t .tl .dot { top: 28px; }
body.t .knob { position: absolute; top: 20px; width: 2px; height: 16px; margin-left: -1px; background: var(--red); pointer-events: none; transition: top 120ms, height 120ms; }
body.t .tl.drag .knob { top: 13px; height: 30px; transition: none; }

/* playing = calm: the word, the guide and a quiet progress line stay. Nothing moves. */
body.t.playing :is(.rtop, .tinfo) { opacity: 0; pointer-events: none; }
body.t.playing :is(.tl .dot, .knob) { visibility: hidden; }
body.t.playing .tl .track { background: var(--ghost); }

/* first-run guide: drawn in the stage's own vocabulary over a veil; the real top band and bar stay lit above it */
body.t .guide {
  position: absolute; left: 0; right: 0; top: var(--gt, 56px); bottom: var(--gb, 90px); z-index: 8;
  display: flex; flex-direction: column; background: var(--veil); padding: 0 var(--pr) 0 var(--pl);
  overflow-y: auto; overscroll-behavior: contain; touch-action: pan-y; -webkit-overflow-scrolling: touch;
}
/* the tap zones' real borders: dashed blue at 30 % and 70 %, from the top band down to the bar */
body.t .guide::before, body.t .guide::after { content: ""; position: absolute; top: 0; bottom: 0; z-index: -1; border-left: 1px dashed var(--blue); pointer-events: none; }
body.t .guide::before { left: 30%; }
body.t .guide::after { left: 70%; }
body.t.guiding :is(.line, .sentence, .endbox, .tinfo, .readout, .meter) { visibility: hidden; }
body.t.guiding :is(.rtop, .tl) { z-index: 9; pointer-events: none; }
body.t .gk { display: block; color: var(--blue); font-size: 12px; font-weight: 700; letter-spacing: .04em; }
body.t .guide .gt { display: block; font: 700 16px/1.35 var(--ko); color: var(--fg); }
body.t .gcall { flex: none; position: relative; display: flex; flex-direction: column; align-items: center; gap: 2px; text-align: center; }
body.t .gcall.up { padding-top: 16px; }
body.t .gcall.down { padding-bottom: 16px; }
body.t .gcall::before { content: ""; position: absolute; left: 50%; width: 2px; height: 10px; margin-left: -1px; background: var(--blue); }
body.t .gcall.up::before { top: 2px; }
body.t .gcall.down::before { bottom: 2px; }
body.t .zones { flex: none; display: grid; grid-template-columns: 30% 40% 30%; margin: 18px calc(-1 * var(--pr)) 0 calc(-1 * var(--pl)); text-align: center; }
body.t .zones > div { padding: 12px 6px 16px; }
body.t .grows { flex: 1 0 auto; display: flex; flex-direction: column; justify-content: center; gap: 12px; }
body.t .grows div { display: grid; grid-template-columns: 42% 1fr; gap: 12px; align-items: baseline; }
body.t .grows .gt { font-size: 15px; }
body.t .gok {
  flex: none; min-height: 52px; margin: 8px calc(-1 * var(--pr)) 8px calc(-1 * var(--pl));
  border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); text-align: center; font-size: 17px; color: var(--fg);
}

/* ---------------- settings and account */

body.t .sec-k { padding: 22px 0 6px; }
body.t .set { border-bottom: 1px solid var(--line); padding: 12px 0 10px; }
body.t .set.inline { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 60px; padding: 8px 0; }
body.t .set-h { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
body.t .set-l { margin: 0; font-weight: 700; font-size: 16px; }
body.t .set-d { margin: 2px 0 0; font: 400 13px/1.5 var(--ko); color: var(--fg2); }
body.t .set:not(.inline) > .set-l { padding-top: 4px; }
body.t .opts { display: flex; flex-wrap: wrap; margin: 2px -10px 0; }
body.t .set.inline .opts { flex-wrap: nowrap; flex: none; margin: 0 -4px 0 0; }
body.t .opt { min-height: 44px; min-width: 52px; padding: 0 10px; font-size: 15px; color: var(--fg2); text-align: center; }
body.t .sv { margin: 0; font: 700 17px var(--ui); letter-spacing: .02em; white-space: nowrap; font-variant-numeric: tabular-nums; }
body.t .sv small { font-size: 12px; color: var(--fg2); margin-left: .35em; letter-spacing: .06em; }
body.t .slrow { display: flex; align-items: center; margin: 4px -8px 0; }
body.t .st { flex: none; min-width: 56px; min-height: 44px; font-size: 15px; text-align: center; font-variant-numeric: tabular-nums; }
body.t .sl { position: relative; flex: 1 1 auto; height: 44px; touch-action: pan-y; cursor: pointer; }
body.t .sl .track { top: 21px; }
body.t .sl .tick { position: absolute; top: 11px; width: 2px; height: 22px; margin-left: -1px; background: var(--red); pointer-events: none; }
body.t .foot-note { margin: 0; color: var(--fg2); font-size: 13px; padding: 18px 0 8px; }

body.t .rlist { margin: 0; padding: 0; list-style: none; }
body.t .rowbtn { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 52px; padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 16px; text-align: left; }
body.t .rowbtn > .ic { color: var(--fg2); }
body.t .rowbtn .lbl { min-width: 0; }
body.t .rowbtn .meta { margin-left: auto; font-weight: 400; font-size: 13px; letter-spacing: 0; text-transform: none; color: var(--fg2); white-space: nowrap; }
body.t .rowbtn .sub { display: block; font: 400 13px/1.45 var(--ko); letter-spacing: 0; text-transform: none; color: var(--fg2); margin-top: 2px; }
body.t .rowbtn.danger { color: var(--red); }
body.t .rowbtn.danger .sub { color: var(--red); opacity: .8; }
body.t .spacer { flex: 1 1 auto; }
body.t .bottomed { display: flex; flex-direction: column; }
body.t .me { padding: 6px 0 14px; }
body.t .me-n { margin: 0; font-size: 24px; font-weight: 700; }
body.t .me-s { margin: 2px 0 0; color: var(--fg2); font-size: 13px; }
body.t .hero-t { margin: 0; font: 700 22px/1.4 var(--ko); }
body.t .hero-s { margin: 8px 0 20px; font: 400 15px/1.6 var(--ko); color: var(--fg2); }
body.t .gap { height: 24px; flex: none; }

/* ---------------- sheets: flat panels, a hairline edge, no radius. Bottom sheets (portrait), side panels (landscape),
   the chapter list drops from the top (both), forms are top-docked pages */

body.t .scrim { position: fixed; inset: 0; z-index: 20; background: var(--scrim); opacity: 0; transition: opacity 160ms; }
body.t .scrim.in { opacity: 1; }
body.t .sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 21; display: flex; flex-direction: column;
  max-height: calc(100% - var(--st) - 24px);
  padding: 0 var(--pr) var(--sb) var(--pl); border-top: 1px solid var(--line);
  background-color: var(--bg); background-image: var(--glow); background-attachment: fixed;
  transform: translateY(28px); opacity: 0; transition: transform 180ms cubic-bezier(.2, .8, .2, 1), opacity 140ms;
}
body.t .sheet.in { transform: none; opacity: 1; }
body.t .sheet.out { transform: translateY(28px); opacity: 0; pointer-events: none; }
body.t .sheet.under { visibility: hidden; }
body.t .sheet.drag { transition: none; }
body.t .sheet.tall { height: 78%; }
body.t .sheet.page { top: 0; max-height: none; border-top: 0; padding-top: var(--st); transform: translateY(12px); }
body.t .sheet.page.in { transform: none; }
body.t .sheet.page.out { transform: translateY(12px); }
body.t .sheet.fromtop {
  top: var(--tp, 0px); bottom: auto; max-height: calc(100% - var(--tp, 0px) - 72px);
  padding-bottom: 0; border-top: 0; border-bottom: 1px solid var(--line); transform: translateY(-16px);
}
body.t .sheet.fromtop.in { transform: none; }
body.t .sheet.fromtop.out { transform: translateY(-16px); }
body.t .sh-head { flex: none; padding: 18px 0 12px; touch-action: none; }
body.t .page .sh-head { touch-action: auto; padding-top: 16px; }
body.t .fromtop .sh-head { touch-action: auto; padding: 12px 0 4px; }
body.t .tgrip { flex: none; display: flex; align-items: center; justify-content: center; height: 44px; color: var(--fg2); touch-action: none; cursor: pointer; }
body.t .sh-title { margin: 6px 0 0; font-size: 19px; font-weight: 700; line-height: 1.35; }
body.t .sh-title:first-child { margin-top: 0; }
body.t .sh-sub { margin: 4px 0 0; color: var(--fg2); font-size: 13px; }
body.t .sh-body { flex: 1 1 auto; min-height: 0; overflow-x: hidden; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
body.t .sh-foot { flex: none; display: flex; border-top: 1px solid var(--line); margin: 0 calc(-1 * var(--gut)); }
body.t .sh-foot button { flex: 1 1 0; min-height: 56px; text-align: center; font-size: 16px; }
body.t .sh-foot .mute { color: var(--fg2); }
body.t .sh-foot .pri { color: var(--fg); }
body.t .sh-foot.inl { margin-top: 8px; border-bottom: 1px solid var(--line); }
body.t .rlist li { display: flex; align-items: stretch; border-bottom: 1px solid var(--line); }
body.t .rlist li .rowbtn { border: 0; flex: 1 1 auto; min-width: 0; }
body.t .rlist .trail { flex: none; min-height: 52px; min-width: 64px; padding-left: 12px; font-size: 13px; color: var(--fg2); text-align: right; }
body.t .rlist .trail.ib { justify-content: flex-end; }
body.t .rlist .mk .lt { background: var(--mark); color: #000; font: 400 15px/1.55 var(--ko); letter-spacing: 0; text-transform: none; padding: 1px 2px; -webkit-box-decoration-break: clone; box-decoration-break: clone; }
body.t .sheet:is(.k-chapters, .k-marks, .k-results, .k-folders, .k-devices, .k-invites, .k-users) .rowbtn { text-transform: none; } /* content, not controls */
body.t .rlist .snip { font: 400 15px/1.55 var(--ko); letter-spacing: 0; text-transform: none; }
body.t .rlist li.sep { height: 10px; }
body.t .note { margin: 0; font-family: var(--ko); color: var(--fg2); font-size: 13px; padding: 12px 0 4px; line-height: 1.5; }
body.t .cq { font: 700 19px/1.4 var(--ko); }
body.t .cd { margin: 0; font: 400 15px/1.6 var(--ko); color: var(--fg2); padding-bottom: 18px; }
body.t .cbtns { flex: none; display: flex; flex-direction: column; margin: 0 calc(-1 * var(--gut)); }
body.t .cbtns button { min-height: 56px; border-top: 1px solid var(--line); text-align: center; font-size: 17px; }
body.t .cbtns .danger { color: var(--red); }
body.t .pline { margin: 0; font: 400 15px/1.55 var(--ko); padding: 6px 0; -webkit-user-select: text; user-select: text; overflow-wrap: anywhere; }
body.t .pline.link { font-family: var(--ui); color: var(--blue); font-weight: 700; }
/* ⋯: the search hits row (‘민서’ 3/12 ‹ ›) */
body.t .hitrow { display: flex; align-items: center; gap: 4px; min-height: 52px; border-bottom: 1px solid var(--line); }
body.t .hitrow > .ic { color: var(--fg2); margin-right: 8px; }
body.t .hitrow span { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 700; }
/* 본문 찾기: the input with 찾기 beside it */
body.t .srch { flex: none; display: flex; align-items: center; gap: 12px; border-bottom: 1px solid var(--red); margin-bottom: 4px; }
body.t .srch .c { flex: none; min-height: 44px; font-size: 15px; }

/* forms (top-docked pages) */
body.t .form { padding-bottom: 16px; overflow-x: hidden; }
body.t .intro { margin: -4px 0 14px; font: 400 14px/1.55 var(--ko); color: var(--fg2); }
body.t .fld { display: block; margin: 2px 0 16px; }
body.t .fld > .lbl { display: block; font-size: 13px; font-weight: 700; color: var(--fg2); margin-bottom: 2px; }
body.t .fld.act > .lbl { color: var(--red); }
body.t .inrow { display: flex; align-items: center; border-bottom: 1px solid var(--line); }
body.t .fld.act .inrow { border-bottom-color: var(--red); }
body.t .inp {
  flex: 1 1 auto; min-width: 0; width: 100%; padding: 10px 0; font: 400 16px/1.4 var(--ui); color: var(--fg);
  background: transparent; border: 0; border-radius: 0; outline: none; -webkit-appearance: none; appearance: none;
  -webkit-user-select: text; user-select: text;
}
body.t .inp::placeholder { color: var(--fg2); }
body.t .inp::-webkit-search-cancel-button { display: none; }
body.t textarea.inp { min-height: 9em; resize: none; font-family: var(--ko); }
body.t .reveal { flex: none; min-height: 44px; padding-left: 14px; font-size: 13px; color: var(--fg2); }
body.t .err { margin: -4px 0 10px; padding: 0; font-family: var(--ko); color: var(--red); font-size: 14px; }
body.t .chips { display: flex; margin: 0 -4px; }

/* 문맥 */
body.t .ctx { font: 400 18px/1.95 var(--ko); padding: 2px 4px 16px 0; touch-action: pan-y; }
body.t .ctx p { margin: 0; }
body.t .ctx p + p { margin-top: .8em; }
body.t .ctx p.h { font-weight: 700; }
body.t .ctxhint { margin: 0; font: 400 13px/1.5 var(--ko); color: var(--fg2); padding: 0 0 8px; }
body.t .selbar { flex: none; display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 44px; border-top: 1px solid var(--line); margin: 0 calc(-1 * var(--gut)); padding: 0 var(--gut); font-size: 14px; color: var(--fg2); }
body.t .selbar .c { color: var(--fg); min-height: 44px; font-size: 14px; }

/* 위치로 이동 */
body.t .goto { padding: 4px 0 8px; }
body.t .gbig { margin: 0; font-size: 44px; font-weight: 700; line-height: 1.1; letter-spacing: .02em; font-variant-numeric: tabular-nums; }
body.t .gsub { margin: 6px 0 4px; color: var(--fg2); font-size: 14px; min-height: 1.5em; }
body.t .gsl { position: relative; height: 72px; touch-action: none; cursor: pointer; }
body.t .gsl .track { top: 35px; }
body.t .gsl .dot { top: 36px; }
body.t .ghandle { position: absolute; top: 18px; width: 2px; height: 36px; margin-left: -1px; background: var(--red); pointer-events: none; }
body.t .gfine { display: grid; grid-template-columns: 1fr 1fr; border-top: 1px solid var(--line); margin: 0 calc(-1 * var(--gut)); }
body.t .gfine button { min-height: 52px; text-align: center; font-weight: 700; }

/* 사용법 */
body.t .gsec { padding: 18px 0 4px; }
body.t .grow { display: grid; grid-template-columns: 44% 1fr; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--line); font: 400 14px/1.5 var(--ko); }
body.t .grow b { font-weight: 700; }
body.t .grow span { color: var(--fg2); }
body.t .grow i { display: block; font-style: normal; color: var(--blue); font-size: 12px; margin-top: 2px; }

/* the toast: one hairline band, docked above whatever is lowest; in the reader it takes the info line's place */
body.t .ttoast {
  position: fixed; left: 0; right: 0; z-index: 30; display: flex; align-items: center; justify-content: space-between; gap: 16px;
  min-height: 44px; padding: 0 var(--pr) 0 var(--pl); background: var(--bg); border-top: 1px solid var(--line);
  font: 400 14px var(--ko); color: var(--fg); opacity: 0; transform: translateY(6px); transition: opacity 120ms, transform 120ms; pointer-events: none;
}
body.t .ttoast.in { opacity: 1; transform: none; pointer-events: auto; }
body.t .ttoast.err { color: var(--red); }
body.t .ttoast.inline { border-top: 0; min-height: 0; background: transparent; padding: 0; } /* left/right = its slot's */
/* the info-line slot is 28 px: the 44 px 되돌리기 target grows up into the stage, never down onto the bar */
body.t .ttoast.inline:not(.tline) .c { align-self: flex-end; padding-top: 16px; }
body.t .ttoast.topband { border-top: 0; border-bottom: 1px solid var(--line); }
body.t .ttoast .c { flex: none; min-height: 44px; padding-left: 16px; font: 700 14px var(--ui); color: var(--fg); }
body.t .ttoast span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------------- landscape phones: a layout of their own, not the portrait one squeezed (§8) */
@media (orientation: landscape) and (max-height: 500px) {
  body.t { grid-template: "tabs main" minmax(0, 1fr) / auto minmax(0, 1fr); }
  body.t .tabbar {
    grid-template-columns: none; grid-template-rows: repeat(4, 64px); align-content: center;
    width: calc(76px + var(--sl)); height: auto; padding: var(--st) 0 var(--sb) var(--sl);
    border-top: 0; border-right: 1px solid var(--line);
  }
  body.t .ttab { min-height: 64px; }
  body.t:not(.view-reader) .tmain { --pl: var(--gut); } /* the rail already clears the left notch */
  body.t header.head { padding-top: calc(var(--st) + 10px); padding-bottom: 6px; justify-content: flex-start; gap: 16px; }
  body.t .ttl { font-size: 22px; }
  body.t header.head.lib { justify-content: space-between; padding-top: var(--st); }
  body.t .rtop { height: calc(var(--st) + 44px); }
  body.t .chb { flex-direction: row; gap: 8px; min-height: 44px; }
  body.t .chl { flex: 0 1 auto; min-width: 0; } /* a long chapter name ends in '…' and the row stays inside the band */
  body.t .chb .bt { flex: 0 1000 auto; font-size: 13px; } /* the book title gives way first */
  body.t .chb .bt::before { content: "· "; }
  body.t .chb .lx { display: inline-flex; align-items: center; gap: 5px; flex: none; font-size: 13px; color: var(--fg2); white-space: nowrap; font-variant-numeric: tabular-nums; }
  body.t .chb .lx .ic { color: var(--fg); }
  body.t .tinfo { display: none; }
  body.t .tl { height: 44px; margin: 0 12px; }
  body.t .tl .track { top: 21px; }
  body.t .tl .dot { top: 22px; }
  body.t .knob { top: 15px; }
  body.t .tl.drag .knob { top: 8px; }
  body.t .sentence { max-height: 1.5em; top: min(calc(var(--ay) + var(--half) + 22px), calc(100% - 1.5em - 4px)); } /* never below the short stage */
  body.t .endbox p { display: none; }
  body.t .readout { font-size: 28px; }
  body.t .stage.hw { --half: calc(var(--size) * .78 + 6px); }
  body.t .readout .rch { display: inline; margin: 0 .7em 0 0; } /* one line: the stage is short */
  body.t .stage.ro.sc .g1 { height: max(0px, calc(var(--ay) - var(--half) - 72px)); }
  body.t .meter { top: 10%; bottom: 10%; }
  body.t .sheet.fromtop { max-height: calc(100% - var(--tp, 0px) - 24px); }
  body.t .sheet.fromtop .rlist { display: block; columns: 2; column-gap: 24px; } /* down the first column, then the second */
  body.t .sheet.fromtop .rlist li { break-inside: avoid; }
  body.t .sheet:not(.page):not(.fromtop) {
    left: auto; top: 0; width: min(440px, 52%); max-height: none; height: auto;
    padding: var(--st) var(--pr) var(--sb) var(--gut); border-top: 0; border-left: 1px solid var(--line); transform: translateX(32px);
  }
  body.t .sheet:not(.page):not(.fromtop).in { transform: none; }
  body.t .sheet:not(.page):not(.fromtop).out { transform: translateX(32px); }
  body.t .sheet:not(.page) .sh-head { padding: 10px 0 6px; }
  body.t .sheet .rowbtn { min-height: 44px; padding: 6px 0; }
  body.t :is(.sh-foot button, .cbtns button) { min-height: 48px; }
  body.t .guide .zones { margin-top: 6px; }
  body.t .guide .zones > div { display: flex; justify-content: center; align-items: baseline; gap: 8px; padding: 4px 6px 8px; } /* kicker and text on one line */
  body.t .gcall { flex-direction: row; gap: 10px; justify-content: center; align-items: baseline; }
  body.t .gcall.up { padding-top: 12px; }
  body.t .gcall.down { padding-bottom: 12px; }
  body.t .grows { display: grid; grid-template-columns: 1fr 1fr; column-gap: 28px; row-gap: 6px; align-content: center; }
  body.t .grows div { grid-template-columns: 9em 1fr; }
  body.t .gok { min-height: 44px; margin-top: 4px; margin-bottom: 4px; }
  body.t .guide .gt { font-size: 15px; }
}
/* iPad and other big touch screens (not phone landscape): the same layout, centred columns */
@media (min-width: 700px) and (min-height: 501px) {
  body.t .sheet:not(.page):not(.fromtop) { left: 50%; right: auto; width: 560px; transform: translate(-50%, 28px); border-left: 1px solid var(--line); border-right: 1px solid var(--line); }
  body.t .sheet:not(.page):not(.fromtop).in { transform: translate(-50%, 0); }
  body.t .sheet:not(.page):not(.fromtop).out { transform: translate(-50%, 28px); }
  body.t .sheet.fromtop { left: 50%; right: auto; width: 560px; transform: translate(-50%, -16px); border-left: 1px solid var(--line); border-right: 1px solid var(--line); }
  body.t .sheet.fromtop.in { transform: translate(-50%, 0); }
  body.t .sheet.fromtop.out { transform: translate(-50%, -16px); }
  body.t .sheet.page { padding-left: max(var(--pl), calc((100% - 560px) / 2)); padding-right: max(var(--pr), calc((100% - 560px) / 2)); }
  body.t .tabbar { padding-left: calc((100% - 560px) / 2); padding-right: calc((100% - 560px) / 2); }
  body.t .rdock > :not(.sr) { max-width: 640px; margin-left: auto; margin-right: auto; }
  body.t .scroll { padding-left: max(var(--pl), calc((100% - 720px) / 2)); padding-right: max(var(--pr), calc((100% - 720px) / 2)); }
  body.t .tbooks.tgrid { grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); }
}
@media (prefers-reduced-motion: reduce) {
  body.t *, body.t *::before, body.t *::after { transition: none !important; animation: none !important; }
}
