
:root {
  --bg: #121314;
  --bg-2: #18191b;
  --bg-3: #232427;
  --ink: #f1efe9;
  --ink-2: #b3b1ab;
  --ink-3: #8a8983;
  --rule: #f1efe9;
  --hair: #2c2d30;
  --hair-2: #3d3e42;
  --hover: #1d1e21;
  --acc: #a9df54;              
  --acc-rgb: 169, 223, 84;
  --acc-ink: #142006;          
  --acc-text: #a9df54;         
  --up: #8fcf7c;
  --warn: #e5857a;
  --sans: "Noto Sans TC", "Microsoft JhengHei UI", "Microsoft JhengHei", sans-serif;
  --serif: "Noto Serif TC", "Source Han Serif TC", "PMingLiU", serif;
  --mono: "Cascadia Mono", "Consolas", monospace;
  color-scheme: dark;
}
body.light {
  --bg: #ffffff;
  --bg-2: #f7f6f3;
  --bg-3: #ecebe6;
  --ink: #121314;
  --ink-2: #4f4e4a;
  --ink-3: #6e6d68;
  --rule: #121314;
  --hair: #e3e2dd;
  --hair-2: #c9c8c2;
  --hover: #f3f2ee;
  --acc-text: #3f6a0b;
  --up: #2c7d41;
  --warn: #b3402e;
  color-scheme: light;
}
* { box-sizing: border-box; }
html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 14px;
  overflow: hidden;
  user-select: none;
  -webkit-font-smoothing: antialiased;
}
::selection { background: rgba(var(--acc-rgb), .45); color: var(--ink); }
[hidden] { display: none !important; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
button:focus-visible, input:focus-visible { outline: 2px solid var(--acc); outline-offset: 2px; }
button:disabled { cursor: default; opacity: .45; }
svg { width: 16px; height: 16px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.muted { color: var(--ink-3); }
.grow { flex: 1; }
kbd {
  display: inline-block;
  min-width: 18px;
  padding: 0 5px;
  border: 1px solid var(--hair-2);
  font-family: var(--mono);
  font-size: 11px;
  line-height: 17px;
  color: var(--ink-2);
  text-align: center;
}
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--hair-2); border: 3px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background: var(--ink-3); }
.obtn {
  height: 34px;
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 0 12px;
  border: 1.5px solid var(--ink);
  font-weight: 700;
  white-space: nowrap;
  transition: background-color .12s, color .12s;
}
.obtn:hover { background: var(--ink); color: var(--bg); }
.obtn.sq { width: 36px; padding: 0; }
.obtn.small { height: 28px; padding: 0 9px; font-size: 13px; }
.obtn.sq.small { width: 28px; padding: 0; }
.obtn.small svg { width: 14px; height: 14px; }
.obtn.full { width: 100%; }
.obtn.ghost { border-color: transparent; color: var(--ink-2); }
.obtn.ghost:hover { background: var(--hover); color: var(--ink); }
.obtn.solid { background: var(--ink); color: var(--bg); }
.obtn.solid:hover { background: var(--ink-2); border-color: var(--ink-2); }
.obtn.acc { background: var(--acc); border-color: var(--acc); color: var(--acc-ink); }
.obtn.acc:hover { background: var(--ink); border-color: var(--ink); color: var(--bg); }
.obtn.busy { cursor: progress; background: var(--bg-3); }
.obtn:disabled:hover { background: none; color: inherit; }
.utabs { display: flex; gap: 16px; justify-content: flex-end; }
.utabs button { padding: 3px 0; color: var(--ink-2); font-size: 14px; border-bottom: 2.5px solid transparent; }
.utabs button:hover { color: var(--ink); }
.utabs button.on { color: var(--ink); font-weight: 700; border-bottom-color: var(--ink); }
.sect { border-top: 2px solid var(--rule); padding-top: 11px; }
.sect > h2 {
  margin: 0 0 8px;
  display: flex; align-items: baseline; justify-content: space-between; gap: 10px;
  font-size: 19px; font-weight: 900; line-height: 1.3;
}
.sect > h2 small { font-size: 12.5px; font-weight: 500; color: var(--ink-2); white-space: nowrap; }
.lbl { color: var(--ink-2); font-size: 12.5px; white-space: nowrap; }
.app {
  display: grid;
  grid-template-rows: 64px 50px minmax(0, 1fr);
  height: 100vh;
  padding: 0 24px;
}
.mast { display: flex; align-items: center; gap: 12px; border-bottom: 2px solid var(--rule); }
.brand { display: flex; align-items: center; gap: 11px; }
.brand .logo { width: 30px; height: 31px; color: var(--ink); }
.brand b { font-size: 25px; font-weight: 900; letter-spacing: -.01em; }
.mstat { color: var(--ink-2); font-size: 13px; margin-right: 6px; white-space: nowrap; }
.mstat b { color: var(--ink); font-weight: 800; font-size: 15px; margin-left: 5px; }
.clock { height: 34px; display: inline-flex; align-items: center; padding: 0 10px; border: 1.5px solid var(--hair-2); font-size: 14px; font-weight: 500; }
.tabs { display: flex; align-items: stretch; gap: 30px; border-bottom: 1px solid var(--hair); }
.tab { position: relative; font-size: 17px; font-weight: 700; color: var(--ink-2); }
.tab:hover { color: var(--ink); }
.tab.on { color: var(--ink); font-weight: 900; }
.tab.on::after { content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 3px; background: var(--ink); }
.tabs-r { margin-left: auto; display: flex; align-items: center; gap: 22px; color: var(--ink-2); font-size: 13.5px; min-width: 0; }
.tabs-r .chap { color: var(--ink); font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 420px; }
.tabs-r .hint { white-space: nowrap; }
body[data-view="library"] .tabs-r, body[data-view="settings"] .tabs-r { display: none; }
.views { position: relative; min-height: 0; }
.view { position: absolute; inset: 0; }
.library { display: grid; grid-template-rows: auto auto minmax(0, 1fr); }
.find { display: flex; align-items: center; gap: 22px; padding: 16px 0; border-bottom: 1px solid var(--hair); }
.search { width: min(540px, 44vw); height: 38px; display: flex; align-items: center; gap: 10px; border-bottom: 1.5px solid var(--ink); color: var(--ink-3); }
.search svg { width: 18px; height: 18px; }
.search input { flex: 1; min-width: 0; background: none; border: 0; outline: 0; color: var(--ink); font: inherit; font-size: 17px; }
.search input::placeholder { color: var(--ink-3); }
.find .utabs { margin-left: auto; }
.find .utabs button { font-size: 16px; }
#lib-folder span { max-width: 220px; overflow: hidden; text-overflow: ellipsis; }
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); padding: 10px 0 16px; border-bottom: 1px solid var(--hair); }
.stats > div { display: flex; align-items: baseline; gap: 12px; padding: 6px 22px; border-left: 1px solid var(--hair); white-space: nowrap; overflow: hidden; }
.stats > div:first-child { border-left: 0; padding-left: 0; }
.stats .lbl { font-size: 14px; font-weight: 800; }
.stats b { font-size: 30px; font-weight: 900; letter-spacing: -.01em; }
.lib-body { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 40px; padding-top: 24px; min-height: 0; }
.lib-main { display: flex; flex-direction: column; min-height: 0; }
.wall {
  flex: 1; min-height: 0;
  overflow-y: auto;
  margin-right: -12px; padding: 12px 12px 28px 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 26px 20px;
  align-content: start;
}
.card { display: flex; flex-direction: column; gap: 0; text-align: left; min-width: 0; }
.cover { position: relative; aspect-ratio: 2 / 3; background: var(--bg-3); overflow: hidden; outline-offset: 3px; transition: outline-color .12s; outline: 3px solid transparent; }
.card:hover .cover { outline-color: var(--hair-2); }
.card.current .cover { outline-color: var(--ink); }
.cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.cover .ph-title { position: absolute; inset: 0; padding: 14px 12px; font-family: var(--serif); font-size: 16px; line-height: 1.4; color: var(--ink-2); border: 1px solid var(--hair-2); }
.cover .bar { position: absolute; left: 0; right: 0; bottom: 0; height: 4px; background: rgba(0, 0, 0, .55); }
.cover .bar i { display: block; height: 100%; background: var(--acc); }
.card .t {
  margin-top: 10px;
  font-size: 14px; font-weight: 800; line-height: 1.4;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
  min-height: 2.8em;
}
.card .row { display: flex; justify-content: space-between; gap: 8px; margin-top: 5px; font-size: 12.5px; color: var(--ink-3); white-space: nowrap; }
.card .row > span:first-child { overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.card .row .p { color: var(--ink); }
.card .row .d { color: var(--up); }
.card.broken .t { color: var(--ink-3); }
.lib-aside { display: flex; flex-direction: column; gap: 26px; min-height: 0; overflow-y: auto; }
.cont { display: grid; grid-template-columns: 96px minmax(0, 1fr); gap: 16px; margin-top: 6px; }
.cont .cover { aspect-ratio: auto; height: 139px; outline: 0; }
.cont b { font-size: 18px; font-weight: 900; line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.cont .lbl { display: block; margin: 6px 0 12px; white-space: normal; }
.cont .now { height: 50px; }
.cont .now-r { font-size: 19px; }
.cont-empty { grid-column: 1 / -1; color: var(--ink-3); line-height: 1.7; margin: 4px 0 0; }
.bars { display: flex; align-items: flex-end; gap: 3px; height: 88px; margin-top: 12px; border-bottom: 1px solid var(--hair-2); }
.bars i { flex: 1; display: block; background: var(--bg-3); min-height: 2px; }
.bars i.t { background: var(--acc); }
.bx { display: flex; justify-content: space-between; font-size: 11.5px; color: var(--ink-3); margin-top: 6px; }
.empty { flex: 1; display: flex; flex-direction: column; align-items: flex-start; justify-content: center; gap: 10px; max-width: 520px; }
.empty h3 { margin: 0; font-size: 22px; font-weight: 900; }
.empty p { margin: 0 0 8px; color: var(--ink-2); line-height: 1.7; }
.reader {
  display: grid;
  grid-template-columns: 236px minmax(0, 1fr) 316px;
  gap: 30px;
  padding: 18px 0 16px;
}
.reader.no-watch { grid-template-columns: 0 minmax(0, 1fr) 316px; }
.reader.no-watch .watch { visibility: hidden; }
.reader.no-side { grid-template-columns: 236px minmax(0, 1fr) 36px; }
.reader.no-watch.no-side { grid-template-columns: 0 minmax(0, 1fr) 36px; }
.watch { min-height: 0; overflow: hidden; }
.watch-sect { height: 100%; display: flex; flex-direction: column; }
.watch-scroll { overflow-y: auto; flex: 1; margin-right: -8px; padding-right: 8px; }
.watch-table { width: 100%; border-collapse: collapse; table-layout: fixed; }
.watch-table th {
  position: sticky; top: 0; background: var(--bg);
  font-weight: 500; color: var(--ink-3); font-size: 12px;
  text-align: right; padding: 8px 0 6px;
  border-bottom: 1px solid var(--hair);
}
.watch-table th:first-child { text-align: left; }
.watch-table th:nth-child(2) { width: 58px; }
.watch-table th:nth-child(3) { width: 46px; }
.watch-table td {
  height: 35px; padding: 0;
  border-bottom: 1px solid var(--hair);
  text-align: right; white-space: nowrap;
  font-family: var(--mono); font-size: 12.5px;
  color: var(--ink-2);
  cursor: pointer;
}
.watch-table td:first-child { text-align: left; font-family: var(--sans); font-size: 13.5px; color: var(--ink); overflow: hidden; text-overflow: ellipsis; padding-right: 6px; }
.watch-table tr:hover td { background: var(--hover); }
.watch-table tr.sel td:first-child { font-weight: 900; text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 4px; }
.watch-table tr.sel td { color: var(--ink); }
.watch-table .up { color: var(--up); }
.watch-table .flat { color: var(--ink-3); }
.center { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.quote { display: flex; align-items: flex-end; padding-bottom: 14px; border-bottom: 1px solid var(--hair); min-height: 64px; }
#toggle-watch { align-self: center; margin-right: 14px; }
.qt { flex: 1; min-width: 0; padding-right: 18px; }
.qt h1 { margin: 0; font-size: 26px; font-weight: 900; line-height: 1.25; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.qt .by { color: var(--ink-2); font-size: 13px; margin-top: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cell { padding: 0 18px; border-left: 1px solid var(--hair); white-space: nowrap; flex: none; }
.cell .lbl { display: block; margin-bottom: 3px; }
.cell .big { font-size: 25px; font-weight: 900; letter-spacing: -.01em; line-height: 1.15; }
.cell .delta { font-size: 13px; margin-left: 6px; color: var(--up); }
.fs { display: flex; align-items: center; gap: 8px; }
.fs .big { min-width: 30px; text-align: center; }
.boxseg { display: flex; border: 1.5px solid var(--ink); height: 32px; }
.boxseg button { padding: 0 12px; font-weight: 700; font-size: 14px; color: var(--ink-2); }
.boxseg button + button { border-left: 1.5px solid var(--ink); }
.boxseg button:hover { color: var(--ink); background: var(--hover); }
.boxseg button.on { background: var(--acc); color: var(--acc-ink); font-weight: 900; }
.textpane { position: relative; flex: 1; min-height: 0; background: var(--page-bg); transition: background-color .2s; margin-top: 18px; }
.page-viewport { position: absolute; inset: 26px 40px 24px; overflow: hidden; cursor: default; }
.page-content {
  height: 100%;
  column-fill: auto;
  column-rule: 1px solid var(--page-rule);
  font-family: var(--reader-font, var(--serif));
  font-size: var(--font-size, 20px);
  line-height: var(--line-height, 1.9);
  color: var(--page-ink);
  text-align: justify;
  word-break: break-word;
  overflow-wrap: break-word;
  user-select: text;
}
.page-content.animate { transition: transform .18s ease-out; }
.page-content p { margin: 0 0 .55em; text-indent: 2em; }
.page-content h1, .page-content h2, .page-content h3, .page-content h4, .page-content h5, .page-content h6, .page-content .rd-heading {
  margin: .9em 0 .7em; line-height: 1.4; text-align: left; text-indent: 0;
  font-family: var(--sans); font-weight: 900; color: var(--page-head);
  break-after: avoid; break-inside: avoid;
}
.page-content h1 { font-size: 1.4em; margin-top: .2em; }
.page-content h2 { font-size: 1.25em; }
.page-content h3 { font-size: 1.12em; }
.page-content h4, .page-content h5, .page-content h6, .page-content .rd-heading { font-size: 1.05em; }
.page-content img, .page-content svg { display: block; max-width: 100%; max-height: var(--page-h, 700px); margin: .6em auto; object-fit: contain; break-inside: avoid; }
.page-content img { height: auto; }
.page-content blockquote { margin: .8em 2em; color: var(--page-ink2); }
.page-content hr { border: 0; border-top: 1px solid var(--page-rule); margin: 1.2em 3em; }
.page-content a { color: inherit; text-decoration: none; }
.page-content table { border-collapse: collapse; max-width: 100%; font-size: .85em; }
.page-content td, .page-content th { border: 1px solid var(--page-rule); padding: .2em .5em; }
.page-content pre { white-space: pre-wrap; font-size: .8em; }
.page-content .end-marker { height: 0; margin: 0; padding: 0; }
.page-content ruby rt { font-size: .5em; }
::highlight(tr-speak) { background-color: rgba(169, 223, 84, .3); }
.theme-ink   { --page-bg: #121314; --page-ink: #e6e3dc; --page-ink2: #9a9892; --page-head: #f1efe9; --page-rule: #2c2d30; }
.theme-black { --page-bg: #000;    --page-ink: #d9d6cf; --page-ink2: #8d8a83; --page-head: #f1efe9; --page-rule: #222326; }
.theme-navy  { --page-bg: #0b1424; --page-ink: #d8dee8; --page-ink2: #8390a5; --page-head: #eef1f6; --page-rule: #1b2840; }
.theme-dim   { --page-bg: #18191b; --page-ink: #d9d6cf; --page-ink2: #8d8a83; --page-head: #f1efe9; --page-rule: #2c2d30; }
.theme-sepia { --page-bg: #efe9da; --page-ink: #2f2a20; --page-ink2: #6c6353; --page-head: #121314; --page-rule: #d5ccb6; }
.theme-paper { --page-bg: #ffffff; --page-ink: #1d1c19; --page-ink2: #5e5d58; --page-head: #121314; --page-rule: #e3e2dd; }
.page-light ::highlight(tr-speak) { background-color: rgba(169, 223, 84, .55); }
.reader-loading { position: absolute; inset: 0; display: grid; place-items: center; color: var(--page-ink2); background: var(--page-bg); }
.reader-loading > div { display: flex; flex-direction: column; align-items: center; font-weight: 700; }
.reader-loading .bar2 { width: 220px; height: 6px; background: var(--hair); margin-top: 12px; }
.reader-loading .bar2 i { display: block; height: 100%; background: var(--acc); transform-origin: left; transform: scaleX(0); transition: transform .2s; }
.pager { display: flex; align-items: center; gap: 14px; height: 46px; margin-top: 14px; border-top: 2px solid var(--rule); padding-top: 4px; }
.pg-pct { color: var(--ink-2); font-size: 13px; white-space: nowrap; }
.pg-pct b { color: var(--ink); font-weight: 700; }
.ticks { flex: 1; height: 12px; display: flex; gap: 2px; cursor: pointer; }
.ticks i { flex: 1; background: var(--bg-3); transition: background-color .12s; }
.ticks i.r { background: rgba(var(--acc-rgb), .55); }
.ticks i.c { background: var(--acc); }
.ticks i:hover { background: var(--ink-2); }
.side { position: relative; min-height: 0; }
.side-panel { height: 100%; display: flex; flex-direction: column; gap: 18px; overflow-y: auto; margin-right: -8px; padding-right: 8px; }
.side-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 28px; flex: none; }
.side-top .muted { font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side .sect { flex: none; }
.now {
  width: 100%; height: 64px;
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 0 18px;
  background: var(--acc); color: var(--acc-ink);
  transition: background-color .12s;
}
.now:hover { background: #b9ea6a; }
.now-l { font-size: 12.5px; font-weight: 600; text-align: left; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.now-r { display: flex; align-items: center; gap: 9px; font-size: 23px; font-weight: 900; white-space: nowrap; }
.now-r svg { width: 19px; height: 19px; }
.now.paused { background: transparent; color: var(--acc-text); box-shadow: inset 0 0 0 2px var(--acc); }
.rates { display: flex; justify-content: space-between; border-top: 1px solid var(--hair-2); margin-top: 16px; }
.rates button { position: relative; padding: 8px 0 0; font-family: var(--mono); font-size: 13px; color: var(--ink-2); }
.rates button:hover { color: var(--ink); }
.rates button.on { color: var(--acc-text); font-weight: 700; }
.rates button.on::before { content: ""; position: absolute; left: -5px; right: -5px; top: -2px; height: 3px; background: var(--acc); }
.voices { display: grid; grid-template-columns: repeat(5, 1fr); border: 1.5px solid var(--ink); margin-top: 14px; }
.voices button { height: 46px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; line-height: 1.15; font-weight: 800; font-size: 14px; }
.voices button + button { border-left: 1px solid var(--hair-2); }
.voices button small { font-size: 11px; font-weight: 500; color: var(--ink-3); }
.voices button:hover { background: var(--hover); }
.voices button.on { background: var(--ink); color: var(--bg); }
.voices button.on small { color: var(--bg-3); }
body.light .voices button.on small { color: var(--hair-2); }
.kv { display: grid; grid-template-columns: 50px 1fr; align-items: center; min-height: 40px; padding: 6px 0; border-bottom: 1px solid var(--hair); }
.kv > span:first-child { color: var(--ink-2); font-size: 13px; }
.speak-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 12px; }
.speak-row .mono { color: var(--acc-text); font-size: 13px; }
.swatches { display: flex; gap: 8px; justify-content: flex-end; }
.swatches button { width: 32px; height: 22px; background: var(--sw); border: 1px solid var(--hair-2); }
.swatches button.on, .swatches .sw-custom.on { outline: 2px solid var(--ink); outline-offset: 2px; }
.sw-custom { position: relative; width: 32px; height: 22px; border: 1px solid var(--hair-2); cursor: pointer;
  background: var(--sw, conic-gradient(#f87171, #fbbf24, #a9df54, #60a5fa, #c084fc, #f87171)); }
.sw-custom input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; border: 0; padding: 0; }
#export { margin-top: 14px; }
.note { margin-top: 7px; font-size: 12px; line-height: 1.55; }
.toc-sect { flex: 1 0 auto !important; display: flex; flex-direction: column; min-height: 180px; }
.toc { flex: 1; overflow-y: auto; min-height: 120px; max-height: 60vh; position: relative; }
.toc button {
  display: grid; grid-template-columns: 1fr auto; gap: 8px;
  width: 100%; min-height: 33px; padding: 6px 0;
  border-bottom: 1px solid var(--hair);
  text-align: left; font-size: 13.5px; color: var(--ink-2);
}
.toc button span:first-child { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.toc button span:last-child { font-family: var(--mono); font-size: 12px; color: var(--ink-3); }
.toc button:hover { color: var(--ink); background: var(--hover); }
.toc button.cur { color: var(--ink); font-weight: 900; }
.toc button.cur span:last-child { color: var(--acc-text); }
.rail { display: none; }
.reader.no-side .side-panel { display: none; }
.reader.no-side .rail { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.rail-state { writing-mode: vertical-rl; font-size: 13px; font-weight: 700; color: var(--ink-2); letter-spacing: .25em; margin-top: 6px; }
.rail .obtn.acc svg { width: 15px; height: 15px; }
.settings { overflow-y: auto; padding: 24px 0 40px; }
.set-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 30px 40px; max-width: 1200px; }
.set-body { display: flex; flex-direction: column; align-items: flex-start; gap: 12px; padding-top: 4px; }
.set-body p { margin: 0; line-height: 1.75; }
.path { color: var(--ink); word-break: break-all; }
code { font-family: var(--mono); color: var(--ink); }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--ink-3); margin-right: 8px; vertical-align: 1px; }
.dot.ok { background: var(--acc); }
.key-form { display: grid; gap: 10px; width: 100%; }
.key-form label { display: grid; grid-template-columns: 40px 1fr; align-items: center; gap: 10px; color: var(--ink-2); }
.key-form input { height: 36px; min-width: 0; padding: 0 2px; background: none; border: 0; border-bottom: 1.5px solid var(--ink); color: var(--ink); font: inherit; font-size: 15px; outline: 0; }
.key-form input:focus { border-bottom-color: var(--acc); }
.key-form input::placeholder { color: var(--ink-3); }
.k-row { display: flex; align-items: center; gap: 10px; margin-left: 50px; }
.k-msg { font-size: 12.5px; color: var(--ink-3); }
.k-msg.ok { color: var(--acc-text); font-weight: 700; }
.k-msg.err { color: var(--warn); font-weight: 700; }
.link { background: none; border: 0; padding: 0 0 0 6px; color: var(--ink); font: inherit; font-weight: 700; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.link:hover { color: var(--acc-text); }
.set-note { margin: 26px 0 0; }
.keys { width: 100%; border-collapse: collapse; }
.keys td { padding: 9px 0; border-bottom: 1px solid var(--hair); color: var(--ink-2); }
.keys td:first-child { width: 46%; white-space: nowrap; }
.keys kbd { margin-right: 2px; }
.toast {
  position: fixed; left: 50%; bottom: 36px;
  transform: translateX(-50%);
  max-width: 640px;
  padding: 11px 18px;
  background: var(--ink); color: var(--bg);
  font-size: 14px; font-weight: 700;
  box-shadow: 0 10px 28px rgba(0, 0, 0, .35);
  z-index: 50;
}
@media (max-width: 1320px) {
  .reader, .reader.no-watch { grid-template-columns: 0 minmax(0, 1fr) 300px; gap: 24px; }
  .reader .watch { visibility: hidden; }
  .reader.show-watch { grid-template-columns: 220px minmax(0, 1fr) 300px; }
  .reader.show-watch .watch { visibility: visible; }
  .reader.no-side, .reader.no-watch.no-side { grid-template-columns: 0 minmax(0, 1fr) 36px; }
  .reader.show-watch.no-side { grid-template-columns: 220px minmax(0, 1fr) 36px; }
  .tabs-r .hint { display: none; }
  .lib-body { grid-template-columns: minmax(0, 1fr) 280px; gap: 28px; }
}
@media (max-width: 1100px) {
  .cell.hide-narrow { display: none; }
  .mstat:nth-of-type(2) { display: none; }
  .lib-body { grid-template-columns: minmax(0, 1fr); }
  .lib-aside { display: none; }
  .stats b { font-size: 24px; }
}
@media (max-width: 1100px) {
  .reader, .reader.no-watch { grid-template-columns: 0 minmax(0, 1fr) 272px; gap: 18px; }
  .qt { min-width: 110px; }
  .cell { padding: 0 12px; }
}
@media (max-height: 700px) {
  .app { grid-template-rows: 52px 42px minmax(0, 1fr); }
  .brand b { font-size: 21px; }
  .tab { font-size: 15.5px; }
  .reader { padding: 10px 0 10px; }
  .quote { min-height: 50px; padding-bottom: 8px; }
  .qt h1 { font-size: 20px; }
  .cell .big { font-size: 20px; }
  .cell .lbl { margin-bottom: 1px; }
  .textpane { margin-top: 10px; }
}
.page-content[data-lang="zh"] .lang-en,
.page-content[data-lang="en"] .lang-zh { display: none; }
.page-content .rd-figure { background: #fff; margin: .6em 0; line-height: 0; }
.page-content .rd-figure img { margin: 0 auto; }
.center.guide-on .textpane, .center.guide-on .pager { display: none; }
.guide-view { flex: 1; min-height: 0; display: flex; flex-direction: column; margin-top: 18px; }
.guide-head { display: flex; align-items: flex-end; gap: 10px; padding-bottom: 12px; border-bottom: 2px solid var(--rule); }
.guide-head h2 { margin: 0; font-size: 22px; font-weight: 900; }
.guide-head p { margin: 4px 0 0; font-size: 12.5px; }
.guide-body { flex: 1; min-height: 0; overflow-y: auto; padding: 22px 12px 40px 0; margin-right: -12px; user-select: text; }
.guide-body .g-one { font-size: 24px; font-weight: 900; line-height: 1.5; margin: 0 0 18px; max-width: 58em; }
.guide-body .g-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 26px 40px; margin-bottom: 30px; }
.guide-body .sect > h2 { font-size: 17px; }
.guide-body p, .guide-body li { line-height: 1.8; font-size: 14.5px; color: var(--ink); }
.guide-body p { margin: 0 0 8px; }
.guide-body ul { margin: 0; padding-left: 1.2em; }
.guide-body li + li { margin-top: 4px; }
.guide-body .g-block { margin-bottom: 30px; }
.g-map { width: 100%; border-collapse: collapse; }
.g-map td { padding: 12px 10px 12px 0; border-bottom: 1px solid var(--hair); vertical-align: top; font-size: 14px; line-height: 1.7; }
.g-map td:first-child { width: 78px; }
.g-map td:nth-child(2) { width: 30%; }
.g-map .jump { font-weight: 800; text-align: left; }
.g-map .jump:hover { text-decoration: underline; text-underline-offset: 3px; }
.g-map .why { display: block; color: var(--ink-3); font-size: 12.5px; margin-top: 2px; }
.tag { display: inline-block; padding: 1px 8px; font-size: 12.5px; font-weight: 800; border: 1.5px solid var(--ink); white-space: nowrap; }
.tag.must { background: var(--acc); border-color: var(--acc); color: var(--acc-ink); }
.tag.skip { border-color: var(--hair-2); color: var(--ink-3); font-weight: 500; }
.g-concepts { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 0 30px; }
.g-concepts div { padding: 10px 0; border-bottom: 1px solid var(--hair); }
.g-concepts b { display: block; font-weight: 800; margin-bottom: 2px; }
.g-concepts span { color: var(--ink-2); font-size: 14px; line-height: 1.7; }
.g-progress { padding: 60px 0; max-width: 520px; }
.g-progress b { display: block; font-size: 18px; font-weight: 900; margin-bottom: 14px; }
.g-progress .bar2 { height: 6px; background: var(--hair); }
.g-progress .bar2 i { display: block; height: 100%; background: var(--acc); transform-origin: left; transform: scaleX(0); transition: transform .3s; }
.g-progress p { margin-top: 12px; color: var(--ink-2); }
#guide-open.busy { background: var(--bg-3); }
@media (max-width: 1100px) { .guide-body .g-grid { grid-template-columns: minmax(0, 1fr); } }
.g-cost { border-collapse: collapse; margin: 6px 0 14px; min-width: 360px; }
.g-cost td { padding: 8px 18px 8px 0; border-bottom: 1px solid var(--hair); font-size: 14px; }
.g-cost td:first-child { color: var(--ink-2); }
.k-row0 { display: flex; gap: 10px; margin-top: 14px; }
.limit-row { display: flex; align-items: center; gap: 16px; }
.limit-row label { display: flex; align-items: center; gap: 8px; color: var(--ink-2); }
.limit-row input { width: 80px; height: 32px; background: none; border: 0; border-bottom: 1.5px solid var(--ink); color: var(--ink); font-size: 15px; outline: 0; padding: 0 2px; }
.limit-row input:focus { border-bottom-color: var(--acc); }
::highlight(hl-green)  { background-color: rgba(169, 223, 84, .34); }
::highlight(hl-yellow) { background-color: rgba(240, 200, 60, .36); }
::highlight(hl-blue)   { background-color: rgba(96, 165, 250, .34); }
::highlight(hl-pink)   { background-color: rgba(244, 114, 182, .34); }
::highlight(hl-note)   { text-decoration: underline dotted; text-decoration-thickness: 2px; text-underline-offset: 4px; }
.page-light ::highlight(hl-green) { background-color: rgba(169, 223, 84, .6); }
.page-light ::highlight(hl-yellow) { background-color: rgba(250, 210, 60, .55); }
.page-light ::highlight(hl-blue) { background-color: rgba(96, 165, 250, .4); }
.page-light ::highlight(hl-pink) { background-color: rgba(244, 114, 182, .4); }
.page-viewport { cursor: text; }
.edge { position: absolute; top: 0; bottom: 0; width: clamp(70px, 18%, 200px); z-index: 3; display: flex; align-items: center; color: var(--page-ink2); opacity: 0; pointer-events: none; transition: opacity .15s; }
.edge-l { left: 0; justify-content: flex-start; padding-left: 10px; background: linear-gradient(to right, color-mix(in srgb, var(--page-ink) 7%, transparent), transparent); }
.edge-r { right: 0; justify-content: flex-end; padding-right: 10px; background: linear-gradient(to left, color-mix(in srgb, var(--page-ink) 7%, transparent), transparent); }
.edge svg { width: 26px; height: 26px; }
.textpane.hover-prev .edge-l, .textpane.hover-next .edge-r { opacity: 1; }
.textpane.hover-prev, .textpane.hover-next { cursor: pointer; }
.textpane.hover-prev .page-viewport, .textpane.hover-next .page-viewport { cursor: pointer; }
.hl-bar, .hl-edit { position: fixed; z-index: 60; background: var(--bg); border: 1.5px solid var(--ink); box-shadow: 0 12px 30px rgba(0, 0, 0, .45); }
.hl-row { display: flex; align-items: center; gap: 2px; padding: 5px; }
.hl-row button { height: 32px; min-width: 32px; padding: 0 8px; display: flex; align-items: center; justify-content: center; gap: 6px; font-size: 13px; font-weight: 700; color: var(--ink); }
.hl-row button:hover { background: var(--hover); }
.hl-row button svg { width: 17px; height: 17px; }
.hl-c i { width: 12px; height: 12px; border-radius: 50%; display: block; }
.hl-green i { background: #a9df54; } .hl-yellow i { background: #f0c83c; } .hl-blue i { background: #60a5fa; } .hl-pink i { background: #f472b6; }
.hl-c.on { box-shadow: inset 0 -2.5px 0 var(--ink); }
.hl-sep { width: 1px; height: 22px; background: var(--hair-2); margin: 0 4px; }
.hl-bar:not(.existing) .hl-del { display: none; }
.hl-bar-note { margin: 0; padding: 8px 12px 10px; border-top: 1px solid var(--hair); max-width: 420px; font-size: 13.5px; line-height: 1.6; color: var(--ink-2); white-space: pre-wrap; }
.hl-edit { width: 380px; padding: 14px; }
.hl-edit-quote { margin: 0 0 10px; font-size: 13px; color: var(--ink-2); line-height: 1.6; border-left: 1px solid var(--hair-2); padding-left: 10px; }
.hl-edit textarea { width: 100%; resize: vertical; background: var(--bg-2); color: var(--ink); border: 1px solid var(--hair-2); padding: 8px 10px; font: inherit; font-size: 14px; line-height: 1.6; outline: 0; }
.hl-edit textarea:focus { border-color: var(--ink); }
.hl-list { max-height: 36vh; overflow-y: auto; }
.hl-item { display: grid; grid-template-columns: 12px 1fr; gap: 3px 9px; width: 100%; padding: 9px 0; border-bottom: 1px solid var(--hair); text-align: left; }
.hl-item:hover { background: var(--hover); }
.hl-item .sw { grid-row: span 3; width: 8px; height: 8px; border-radius: 50%; margin-top: 7px; }
.hl-item .sw.hl-green { background: #a9df54; } .hl-item .sw.hl-yellow { background: #f0c83c; } .hl-item .sw.hl-blue { background: #60a5fa; } .hl-item .sw.hl-pink { background: #f472b6; }
.hl-item .q { font-size: 13.5px; line-height: 1.55; color: var(--ink); }
.hl-item .n { font-size: 12.5px; line-height: 1.5; color: var(--ink-2); }
.hl-item .n::before { content: "筆記　"; color: var(--ink-3); }
.hl-item .c { font-size: 11.5px; color: var(--ink-3); }
.hl-empty { font-size: 12.5px; line-height: 1.6; margin: 4px 0 0; }
.hl-ai-card { display: flex; align-items: center; gap: 10px; width: 100%; margin-top: 10px; padding: 10px 12px; border: 1.5px solid var(--ink); text-align: left; }
.hl-ai-card:hover { background: var(--hover); }
.hl-ai-card[hidden] { display: none; }
.hl-ai-card svg { width: 18px; height: 18px; flex: none; }
.hl-ai-card .t { flex: 1; font-size: 13.5px; font-weight: 800; color: var(--ink); }
.hl-ai-card .t small { display: block; font-size: 11.5px; font-weight: 500; color: var(--ink-3); margin-top: 2px; }
.hl-ai-card .tag { font-size: 11px; padding: 0 6px; border-color: var(--acc); }
.hl-actions { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.hl-actions .obtn { flex: 1; }
@media (max-width: 720px) {
  .app { grid-template-rows: 48px 40px minmax(0, 1fr); height: 100vh; height: 100dvh; padding: env(safe-area-inset-top) max(12px, env(safe-area-inset-right)) 0 max(12px, env(safe-area-inset-left)); }
  .brand { gap: 8px; }
  .brand .logo { width: 24px; height: 25px; }
  .brand b { font-size: 19px; }
  .mstat, .clock, #fullscreen { display: none; }
  .tabs { gap: 22px; }
  .tab { font-size: 15px; }
  .tabs-r .hint { display: none; }
  .tabs-r .chap { max-width: 46vw; font-size: 12.5px; }
  .library { display: block; overflow-y: auto; -webkit-overflow-scrolling: touch; }
  .find { flex-wrap: wrap; gap: 8px 14px; padding: 10px 0; }
  .search { width: 100%; order: -1; }
  .search input { font-size: 16px; }   
  .find .utabs { margin-left: 0; }
  .find .utabs button { font-size: 14px; }
  #lib-folder { margin-left: auto; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); padding: 6px 0 10px; }
  .stats > div { padding: 6px 0; border-left: 0; gap: 8px; }
  .stats .lbl { font-size: 12.5px; }
  .stats b { font-size: 20px; }
  .lib-body { display: block; padding-top: 12px; }
  .lib-aside { display: none; }
  .wall { overflow: visible; margin-right: 0; padding: 8px 0 28px; grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); gap: 18px 14px; }
  .card .t { font-size: 13px; margin-top: 7px; }
  .card .row { font-size: 11.5px; }
  .reader, .reader.no-watch, .reader.no-side, .reader.no-watch.no-side, .reader.show-watch, .reader.show-watch.no-side {
    grid-template-columns: minmax(0, 1fr); gap: 0;
    padding: 6px 0 calc(58px + env(safe-area-inset-bottom));
  }
  .reader .watch { display: none; }
  .quote { min-height: 0; padding-bottom: 6px; align-items: center; }
  #toggle-watch { display: none; }
  .qt { padding-right: 8px; }
  .qt h1 { font-size: 16px; }
  .qt .by { display: none; }
  .cell { padding: 0 0 0 8px; border-left: 0; }
  .cell .lbl { display: none; }
  .cell:not(#lang-cell):not(:has(.fs)) { display: none; }
  .fs { gap: 4px; }
  .fs .big { font-size: 16px; min-width: 22px; }
  .boxseg { height: 30px; }
  .boxseg button { padding: 0 8px; font-size: 13px; }
  .textpane { margin-top: 4px; }
  .page-viewport { inset: 20px 18px 16px; }
  .pager { height: 40px; margin-top: 6px; gap: 8px; }
  .ticks { display: none; }
  .pager .pg-pct { flex: 1; text-align: center; font-size: 12.5px; }
  .edge { display: none; }
  .side { display: contents; }   
  .side-panel, .reader.no-side .side-panel {
    display: flex;
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
    height: 72vh; height: 72dvh; margin: 0;
    padding: 14px 16px calc(72px + env(safe-area-inset-bottom));
    background: var(--bg); border-top: 2px solid var(--rule);
    box-shadow: 0 -18px 40px rgba(0, 0, 0, .45);
    transition: transform .22s ease-out;
    overscroll-behavior: contain;
  }
  .reader.no-side .side-panel { transform: translateY(105%); box-shadow: none; }
  .reader .rail, .reader.no-side .rail {
    display: flex; flex-direction: row; justify-content: space-around; align-items: center; gap: 0;
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 41;
    height: calc(58px + env(safe-area-inset-bottom)); padding: 0 8px env(safe-area-inset-bottom);
    background: var(--bg); border-top: 1px solid var(--hair);
  }
  .rail .obtn.sq { width: 44px; height: 40px; }
  .rail-state { display: none; }
  #side-show svg { transform: rotate(90deg); }
  .reader:not(.no-side) #side-show svg { transform: rotate(-90deg); }
  .settings { padding: 14px 0 40px; }
  .set-grid { grid-template-columns: minmax(0, 1fr); gap: 26px; }
  .guide-head { flex-wrap: wrap; gap: 8px; }
  .guide-body { margin-right: 0; padding-right: 0; }
  .hl-bar, .hl-edit { max-width: calc(100vw - 24px); }
  .hl-row button { min-width: 40px; height: 40px; padding: 0 6px; }
  .hl-row .hl-c { font-size: 0; gap: 0; }            
  .hl-row .hl-c i { width: 16px; height: 16px; }
  #sec-layout > h2 small { display: none; }          
}
