@charset "UTF-8";

:root {
  color-scheme: dark;
  --app-height: 100dvh;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  --paper: #0d0d0d;
  --surface: #191919;
  --ink: #f3f2ef;
  --muted: #aaa9a6;
  --rule: #363636;
  --accent: #ef4444;
  --accent-dark: #ff6863;
  --accent-light: #361b1b;
  --secondary: #ef4444;
  --body-ink: #deddd7;
  --faint: #8f8f88;
  --rule-strong: #5b5b56;
  --surface-hover: #242424;
  --surface-soft: #191919;
  --control-bg: rgba(35, 35, 35, .88);
  --control-hover: rgba(60, 60, 60, .94);
  --control-border: rgba(255, 255, 255, .16);
  --nav-bg: rgba(27, 27, 30, .18);
  --nav-border: rgba(255, 255, 255, .22);
  --nav-selected: rgba(10, 10, 10, .3);
  --nav-pressed: rgba(0, 0, 0, .5);
  --selection: #642828;
  --word-hover: #2d2d2a;
  --word-selected: #512522;
  --danger-bg: #3a1c1c;
  --backdrop: rgba(0, 0, 0, .65);
  --shadow: rgba(0, 0, 0, .24);
  --toast-bg: #353535;
  --toast-ink: #f3f2ef;
  --toast-hover: rgba(255, 255, 255, .09);
  --reading-font-size: 22px;
  --dictionary-font-size: 21px;
  --dictionary-headword-size: 38px;
  --dictionary-meta-size: 16px;
  --dictionary-example-size: 15px;
  --saved-meaning-size: 20px;
  --reading-font-family: "Lumen Shoujin Chinese", Georgia, "Times New Roman", "Songti SC", "STSong", serif;
  --handwritten-font: "Lumen Shoujin Chinese", "Hannotate SC", "Hannotate TC", "Noteworthy", "Bradley Hand", cursive;
  --ui-font: "Lumen Shoujin Chinese", -apple-system, BlinkMacSystemFont, "Helvetica Neue", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --editorial-font: "Lumen Shoujin Chinese", Georgia, "Times New Roman", "Songti SC", "STSong", serif;
  font: 14px "Lumen Shoujin Chinese", var(--ui-font);
  color: var(--ink);
  background: var(--paper);
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}
/* The app resolves system/light/dark onto data-theme before rendering content. */
:root[data-theme="dark"] { color-scheme: dark; }
:root[data-theme="light"] {
  color-scheme: light;
  --paper: #fff;
  --surface: #fff;
  --ink: #171717;
  --body-ink: #282826;
  --muted: #65655f;
  --faint: #81817b;
  --rule: #deded8;
  --rule-strong: #b4b4ac;
  --surface-hover: #f2f2ee;
  --surface-soft: #f7f7f3;
  --accent: #e3120b;
  --accent-dark: #ba100a;
  --accent-light: #fff0ed;
  --secondary: #ca1d17;
  --control-bg: rgba(255, 255, 255, .9);
  --control-hover: rgba(241, 241, 236, .98);
  --control-border: rgba(0, 0, 0, .14);
  --nav-bg: rgba(255, 255, 255, .2);
  --nav-border: rgba(0, 0, 0, .15);
  --nav-selected: rgba(0, 0, 0, .045);
  --nav-pressed: rgba(0, 0, 0, .09);
  --selection: #ffd7cb;
  --word-hover: #f1eee5;
  --word-selected: #fbe0d7;
  --danger-bg: #fff0ed;
  --backdrop: rgba(0, 0, 0, .28);
  --shadow: rgba(0, 0, 0, .14);
  --toast-bg: #242424;
  --toast-ink: #fff;
  --toast-hover: rgba(255, 255, 255, .1);
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
html { height: 100%; overflow: hidden; }
body { min-width: 320px; min-height: 0; height: var(--app-height, 100vh); overflow: hidden; background: var(--paper); }
button, input, textarea, select { font: inherit; }
button, a, input, textarea, label[for] { -webkit-tap-highlight-color: transparent; }
button { color: inherit; cursor: pointer; touch-action: manipulation; }
button, input, textarea { outline: none; }
button:disabled { cursor: default; opacity: .42; }
button, label.button, a { transition: color .15s ease, background .15s ease, border-color .15s ease; }
button:focus-visible, a:focus-visible, label.button:focus-within, input:focus-visible, textarea:focus-visible, [tabindex]:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }
a { color: var(--ink); text-underline-offset: 3px; }
a:hover { color: var(--accent-dark); }
svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; flex: 0 0 auto; }
::selection { background: var(--selection); color: var(--ink); }
input::placeholder, textarea::placeholder { color: var(--muted); opacity: 1; }
.svg-definitions { position: absolute; width: 0; height: 0; overflow: hidden; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.skip-link { position: fixed; z-index: 100; top: 12px; left: 12px; padding: 12px 20px; transform: translateY(-200%); background: var(--ink); color: var(--paper); }
.skip-link:focus { transform: translateY(0); }

/* A dark masthead and red section indicator echo the reference app. */
.app-shell { display: flex; flex-direction: column; max-width: 1580px; height: 100%; min-height: 0; margin: auto; padding: 0 44px 18px; }
.app-header { display: flex; align-items: center; gap: 25px; min-height: 95px; flex: 0 0 auto; }
.brand { display: flex; gap: 17px; align-items: center; flex-shrink: 0; }
.brand-name { display: inline-flex; align-items: center; color: var(--ink); font: 400 39px/1 "Lumen Shoujin Chinese", var(--editorial-font); letter-spacing: -1.4px; }
:root[data-theme="light"] .brand-name { color: var(--accent); }
.brand-dot { color: var(--ink); }
.brand-copy { display: flex; flex-direction: column; gap: 5px; }
.brand-caption, .brand-subtitle { color: var(--muted); font: 500 8px/1.4 "Lumen Shoujin Chinese", var(--ui-font); letter-spacing: 1.4px; }
.brand-subtitle { font-weight: 400; letter-spacing: 1px; }
.import-actions { display: flex; gap: 2px; align-items: center; margin-left: auto; }
.button { display: inline-flex; justify-content: center; align-items: center; gap: 8px; min-height: 40px; padding: 10px 14px; border: 1px solid transparent; border-radius: 3px; font-size: 12px; line-height: 1.5; font-weight: 500; text-decoration: none; white-space: nowrap; cursor: pointer; }
.button svg { width: 16px; height: 16px; }
.button-glass { background: transparent; color: var(--body-ink); }
.button-glass:hover { background: var(--surface-hover); color: var(--ink); }
.header-end { display: flex; align-items: center; gap: 16px; margin-left: 12px; }
.icon-button.header-appearance { color: var(--secondary); }
.icon-button.header-appearance:hover { color: var(--accent-dark); }
.reader-badge { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--rule-strong); border-radius: 20px; padding: 5px 9px; color: var(--ink); white-space: nowrap; font-size: 12px; line-height: 1.2; }
.reader-badge > span { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); }
.private-indicator { font-size: 10px; color: var(--muted); white-space: nowrap; }
.button-notes { border-color: var(--rule-strong); color: var(--ink); background: transparent; }
.notes-open:not(.notes-hidden) .button-notes { border-color: var(--muted); background: var(--surface-hover); }
.button-notes:hover { color: var(--ink); background: var(--surface-hover); border-color: var(--muted); }
.app-header .menu-toggle { display: grid; place-items: center; width: 44px !important; height: 44px !important; padding: 9px !important; border: 0; border-radius: 0; background: transparent; color: var(--ink); box-shadow: none; appearance: none; -webkit-appearance: none; }
.app-header .menu-toggle:hover, .app-header .menu-toggle:active { border-color: transparent; background: transparent; color: var(--ink); box-shadow: none; }
.menu-toggle svg { width: 25px !important; height: 25px !important; stroke-width: 1.5; }
.mobile-navigation { display: none; }
.workspace { display: grid; grid-template-columns: minmax(0, 1fr) 350px; gap: 36px; min-height: 0; flex: 1; padding-top: 27px; }
.glass-panel { border: 0; border-radius: 0; box-shadow: none; background: transparent; }
.reader-panel { display: flex; min-width: 0; min-height: 0; flex-direction: column; overflow: hidden; }
.article-header { width: 100%; max-width: 900px; margin: 0 auto; padding: 24px 28px 0; border-radius: 0; background: transparent; }
.article-topline { display: flex; align-items: center; justify-content: space-between; gap: 15px; min-height: 28px; margin-bottom: 16px; }
.eyebrow { display: inline-flex; gap: 9px; align-items: center; color: var(--accent); font-size: 13px; font-weight: 500; letter-spacing: .1px; }
.article-date { display: block; margin: 0 0 12px; color: var(--muted); font-size: 11px; font-weight: 400; line-height: 1.5; letter-spacing: .2px; }
.tiny-dot { width: 20px; height: 3px; background: var(--accent); }
.icon-button { display: inline-flex; align-items: center; justify-content: center; width: 34px; height: 34px; flex-shrink: 0; border: 1px solid transparent; border-radius: 0; padding: 7px; background: transparent; color: var(--muted); }
.icon-button svg { width: 17px; height: 17px; }
.icon-button:hover { background: var(--surface-hover); color: var(--ink); border-color: var(--rule); }
.clear-article { color: var(--faint); }
.clear-article:hover { color: var(--accent-dark); border-color: var(--accent); background: var(--accent-light); }
#articleTitle { max-width: 760px; margin: 0 0 15px; font: 400 clamp(34px, 3.8vw, 57px)/1.06 var(--editorial-font); letter-spacing: -1.8px; color: var(--ink); overflow-wrap: anywhere; }
.article-subtitle { max-width: 760px; font: 22px/1.45 "Lumen Shoujin Chinese", var(--editorial-font); color: var(--body-ink); margin: 0 0 18px; }
.reader-toolbar { display: flex; justify-content: space-between; align-items: center; gap: 15px; border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule); margin-top: 23px; min-height: 58px; }
.reading-hint { display: inline-flex; align-items: center; gap: 7px; white-space: nowrap; color: var(--muted); font-size: 11px; }
.reading-hint svg { width: 14px; height: 14px; color: var(--accent-dark); }
.reading-controls { display: flex; gap: 14px; align-items: center; }
.reader-action.button { min-height: 38px; padding: 7px 9px; border-color: transparent; border-radius: 0; background: transparent; color: var(--body-ink); }
.reader-action.button:hover { background: var(--surface-hover); }
.reader-action > svg { width: 20px; height: 20px; }
.appearance-button { min-height: 36px; padding: 5px 9px; gap: 7px; border-color: var(--rule-strong); background: transparent; color: var(--body-ink); font-size: 11px; }
.appearance-button:hover { background: var(--surface-hover); color: var(--ink); }
.appearance-symbol { font-family: "Lumen Shoujin Chinese", var(--editorial-font); font-size: 19px; letter-spacing: -.7px; }
.lookup-form { display: flex; align-items: center; gap: 8px; width: 162px; min-height: 34px; padding: 4px 0 4px 8px; border-bottom: 1px solid var(--rule-strong); }
.lookup-form > svg { width: 15px; height: 15px; color: var(--muted); }
.lookup-form:focus-within { border-color: var(--accent); }
.lookup-form input { width: 100%; min-width: 0; border: 0; background: transparent; color: var(--ink); font-size: 12px; padding: 0; }
.lookup-form input:focus-visible { outline: none; }
.lookup-submit { display: grid; place-items: center; width: 30px; height: 28px; flex-shrink: 0; padding: 5px; border: 0; background: transparent; color: var(--ink); }
.lookup-submit svg { width: 15px; height: 15px; }
.lookup-submit:hover { background: var(--surface-hover); color: var(--accent-dark); }
.article-scroller { min-height: 0; flex: 1; overflow-y: auto; overflow-x: hidden; overscroll-behavior: contain; scrollbar-gutter: stable; }
.article-content { max-width: 850px; padding: 27px 26px 52px 16px; margin: 0 auto; font-family: "Lumen Shoujin Chinese", var(--reading-font-family); font-size: var(--reading-font-size); line-height: 1.8; color: var(--body-ink); overflow-wrap: break-word; }
.read-paragraph { margin: 0 0 29px; }
.paragraph-label { display: block; font: 500 9px/1.5 "Lumen Shoujin Chinese", var(--ui-font); text-transform: uppercase; letter-spacing: 1.3px; color: var(--muted); margin: 0 0 9px; user-select: none; }
.read-sentence { display: inline; }
.sentence-label { display: inline-block; vertical-align: .15em; margin: 0 6px 0 0; padding: 1px 0; color: var(--faint); font: 500 8px/1.5 "Lumen Shoujin Chinese", var(--ui-font); white-space: nowrap; user-select: none; }
.word { cursor: pointer; -webkit-touch-callout: none; transition: color .12s ease, background .12s ease; }
.word:hover { background: var(--word-hover); }
.word.selected-word, .word[data-selected="true"] { color: var(--accent-dark); background: var(--word-selected); box-shadow: 0 2px 0 var(--accent); }
.article-content h2, .article-content h3 { color: var(--ink); line-height: 1.3; }
.article-content img { max-width: 100%; height: auto; }
.article-content blockquote { padding-left: 20px; margin-left: 0; border-left: 3px solid var(--accent); color: var(--muted); }
.article-loading { display: grid; place-items: center; min-height: 200px; color: var(--muted); font: 13px "Lumen Shoujin Chinese", var(--ui-font); }
.reading-footer { display: flex; gap: 15px; align-items: center; min-height: 49px; padding: 13px 26px 13px 16px; border-top: 1px solid var(--rule); }
.progress-copy { display: inline-flex; flex-shrink: 0; font-size: 10px; }
#progressText { color: var(--muted); font-size: 10px; font-variant-numeric: tabular-nums; }
.progress-track { height: 2px; min-width: 35px; flex: 1; overflow: hidden; background: var(--rule); }
.progress-bar { height: 100%; background: var(--accent); transition: width .15s ease; }
.progress-note { display: inline-flex; align-items: center; gap: 6px; font-size: 10px; color: var(--muted); white-space: nowrap; }
.saved-dot { width: 4px; height: 4px; background: var(--muted); }

/* The notebook reads like a marginal column, with related content kept together. */
.notes-panel { display: flex; flex-direction: column; min-height: 0; min-width: 0; overflow: hidden; border-left: 1px solid var(--rule); padding-left: 27px; }
.notes-header { padding: 2px 0 21px; border-top: 2px solid var(--rule-strong); flex-shrink: 0; }
.section-kicker { margin: 13px 0 15px; color: var(--accent-dark); font-size: 9px; font-weight: 600; letter-spacing: 1.9px; }
.notes-heading-row { display: flex; align-items: center; gap: 10px; justify-content: space-between; }
.notes-heading { display: flex; align-items: center; gap: 8px; min-width: 0; }
.notes-heading h2 { margin: 0; color: var(--ink); font: 600 25px/1.3 "Lumen Shoujin Chinese", var(--editorial-font); letter-spacing: .3px; white-space: nowrap; }
.backup-actions { display: inline-flex; gap: 2px; }
.backup-actions .icon-button { width: 30px; height: 32px; padding: 6px; }
.notes-meta { display: flex; flex-wrap: wrap; gap: 6px 15px; align-items: baseline; margin: 12px 0 18px; }
.notes-description { font-size: 11px; color: var(--muted); line-height: 1.7; margin: 0; }
.count-badge { display: inline-block; color: var(--muted); font-size: 10px; line-height: 1.6; white-space: nowrap; }
.notes-search { display: flex; align-items: center; gap: 8px; padding: 9px 0; min-height: 38px; border-bottom: 1px solid var(--rule-strong); }
.notes-search svg { width: 15px; height: 15px; color: var(--muted); }
.notes-search input { width: 100%; border: 0; background: transparent; color: var(--ink); font-size: 12px; min-width: 0; }
.notes-search:focus-within { border-color: var(--accent); }
.notes-search input:focus-visible { outline: none; }
.notes-list { flex: 1; min-height: 0; overflow-y: auto; padding: 0 8px 22px 0; overscroll-behavior: contain; scrollbar-gutter: stable; }
.notes-back { display: none; align-items: center; align-self: flex-start; gap: 7px; min-height: 40px; padding: 6px 3px; margin: 0 0 12px; border: 0; color: var(--muted); background: transparent; font-size: 12px; flex-shrink: 0; }
.notes-back svg { width: 16px; height: 16px; transform: rotate(180deg); }
.notes-back:hover { color: var(--ink); }
.notes-focused .app-header, .notes-focused .section-tabs, .notes-focused .reader-panel, .notes-focused .notes-header, .notes-focused .mobile-navigation, .notes-focused .skip-link { display: none; }
.notes-focused .app-shell { max-width: none; padding: max(12px, var(--safe-top)) clamp(16px, 3vw, 40px) max(12px, var(--safe-bottom)); }
.notes-focused .workspace { display: flex; padding-top: 0; gap: 0; }
.notes-focused .notes-panel { display: flex; width: 100%; max-width: 900px; margin: 0 auto; padding: 0; border: 0; }
.notes-focused .notes-back { display: inline-flex; }
.notes-focused .notes-list { padding: 0 4px 16px 0; }
.notes-focused .toast-container { bottom: calc(20px + var(--safe-bottom)); }
.notes-hidden .workspace { grid-template-columns: minmax(0, 1fr); }
.notes-hidden .notes-panel { display: none; }
.notes-hidden .article-content { max-width: 900px; padding-left: 40px; padding-right: 40px; }
.notes-hidden .article-header { width: 100%; max-width: 900px; margin: 0 auto; padding-left: 40px; padding-right: 40px; }
.notes-hidden .reading-footer { width: 100%; max-width: 900px; margin: auto; padding-left: 40px; padding-right: 40px; }
.empty-notes, .empty-article { display: flex; align-items: flex-start; flex-direction: column; min-height: 260px; padding: 30px 3px; white-space: pre-line; color: var(--muted); font: 12px/2 "Lumen Shoujin Chinese", var(--ui-font); }
.empty-notes::before { content: "“"; display: block; height: 76px; margin-bottom: 12px; color: var(--accent); font: 100px/1 "Lumen Shoujin Chinese", var(--editorial-font); }
.empty-article { align-items: center; min-height: 200px; }
.note-group { margin: 0 0 20px; }
.note-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; margin: 0 0 11px; }
.note-head h3, .note-head h4, .note-head .note-word { margin: 0; font: 400 var(--dictionary-headword-size)/1.2 var(--editorial-font); color: var(--ink); overflow-wrap: anywhere; }
.saved-metadata { min-width: 0; color: var(--muted); font-size: var(--dictionary-meta-size); line-height: 1.75; overflow-wrap: anywhere; }
.saved-metadata .Head { display: block; }
.saved-metadata .Head:has(.HYPHENATION) .HWD { display: none; }
.saved-metadata .Head:not(:has(.HYPHENATION)) .HWD, .saved-metadata .HYPHENATION, .saved-metadata .headword { font: 400 var(--dictionary-headword-size)/1.3 var(--editorial-font); color: var(--ink); letter-spacing: -.5px; }
.saved-metadata .POS { color: var(--muted); font-style: italic; font-size: var(--dictionary-meta-size); }
.saved-metadata .PRON, .saved-metadata .PronCodes, .saved-metadata .GRAM { color: var(--muted); font-size: 15px; }
.saved-metadata .Head .HYPHENATION + .PronCodes { margin-left: 6px; }
.source-pill { flex-shrink: 0; padding: 2px 0 2px 7px; border-left: 2px solid var(--accent); color: var(--muted); font-size: 14px; line-height: 1.6; }
.note-card { background: transparent; border: 0; border-bottom: 1px solid var(--rule); padding: 17px 0 22px; margin-bottom: 15px; color: var(--body-ink); font-size: var(--saved-meaning-size); line-height: 1.75; overflow-wrap: anywhere; }
.note-controls { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 0 0 12px; }
.note-controls button { display: inline-flex; border: 0; padding: 3px; background: transparent; color: var(--muted); }
.note-controls .note-delete { width: 28px; height: 28px; display: grid; place-items: center; font: 23px/1 "Lumen Shoujin Chinese", var(--editorial-font); }
.note-controls .note-delete:hover { background: var(--danger-bg); color: var(--accent-dark); }
.sense-badge { color: var(--accent-dark); font-size: 14px; font-weight: 500; }
.saved-sense > .Sense { margin-top: 0; }
.note-source { display: inline-block; color: var(--muted); font-size: 14px; line-height: 1.7; text-decoration-color: var(--rule-strong); }
.note-source:hover { color: var(--accent-dark); }
.sentence-note { margin-bottom: 26px; padding-bottom: 23px; border-bottom: 1px solid var(--rule); }
.sentence-note:last-child { border-bottom: 0; }
.sentence-note-header { margin-bottom: 14px; }
.sentence-note-label { color: var(--accent-dark); font-size: 9px; font-weight: 600; line-height: 1.6; letter-spacing: .7px; }
.note-sentence { margin: 9px 0; font: var(--reading-font-size)/1.55 var(--reading-font-family); color: var(--ink); overflow-wrap: anywhere; }
.sentence-article-title { margin: 7px 0 0; color: var(--muted); font: 10px/1.6 "Lumen Shoujin Chinese", var(--ui-font); }
.standalone-label { margin-bottom: 13px; }
.sentence-vocabulary > .note-group { margin-bottom: 18px; }
.sentence-analysis { margin: 0 0 20px; padding: 11px 0 12px; border-top: 1px solid var(--rule-strong); border-bottom: 1px solid var(--rule); color: var(--body-ink); }
.analysis-heading { cursor: pointer; color: var(--ink); font-size: 10px; font-weight: 600; }
.analysis-simple-line { margin: 10px 0 0; line-height: 1.9; }
.analysis-piece { display: inline; }
.simple-text { font: 14px/1.8 "Lumen Shoujin Chinese", var(--editorial-font); color: var(--ink); }
.simple-label { margin-left: 3px; font: 8px/1.5 "Lumen Shoujin Chinese", var(--ui-font); color: var(--muted); white-space: nowrap; }
.simple-plus { margin: 0 5px; color: var(--faint); font-size: 10px; }
.simple-prefix { color: var(--muted); font-size: 10px; }
.analysis-piece[data-role="predicate"] .simple-text { color: var(--accent-dark); }
.analysis-additions { margin: 7px 0 0; color: var(--muted); font: 12px/1.8 "Lumen Shoujin Chinese", var(--editorial-font); }
.analysis-details { margin-top: 11px; padding-top: 9px; border-top: 1px solid var(--rule); }
.analysis-details > summary { cursor: pointer; font-size: 10px; color: var(--muted); }
.analysis-summary { margin: 10px 0; font-size: 11px; line-height: 1.8; color: var(--muted); }
.analysis-clause { margin-top: 10px; }
.clause-heading { display: flex; flex-wrap: wrap; gap: 5px 8px; align-items: baseline; margin: 9px 0 5px; font-size: 10px; color: var(--ink); }
.clause-pattern { color: var(--muted); font-size: 10px; }
.analysis-role { display: grid; grid-template-columns: 68px minmax(0, 1fr); gap: 7px; padding: 6px 0; border-top: 1px solid var(--rule); align-items: baseline; }
.role-label { font: 9px/1.6 "Lumen Shoujin Chinese", var(--ui-font); color: var(--muted); }
.role-text { color: var(--ink); font: 13px/1.65 "Lumen Shoujin Chinese", var(--editorial-font); overflow-wrap: anywhere; }
.analysis-role[data-role="predicate"] .role-text { color: var(--accent-dark); }
.analysis-tokens { margin-top: 11px; border-top: 1px solid var(--rule); padding-top: 9px; }
.analysis-tokens summary { font-size: 10px; color: var(--muted); cursor: pointer; }
.analysis-token { display: flex; gap: 9px; justify-content: space-between; padding-top: 8px; align-items: baseline; }
.token-text { font: 13px/1.5 "Lumen Shoujin Chinese", var(--editorial-font); color: var(--ink); }
.token-role { font-size: 9px; color: var(--muted); text-align: right; }
.analysis-note { margin: 9px 0 0; font-size: 10px; line-height: 1.8; color: var(--muted); }
.analysis-retry { margin-top: 9px; border: 1px solid var(--rule); color: var(--ink); background: transparent; font-size: 11px; padding: 7px 10px; }
.analysis-retry:hover { background: var(--surface-hover); }

/* Full-window dictionary, arranged as one editorial reading column. */
.dictionary, .note-group { --ui-font: "Lumen Shoujin Chinese", var(--reading-font-family); --editorial-font: "Lumen Shoujin Chinese", var(--reading-font-family); --dictionary-phrase-color: #79b8ff; font-family: "Lumen Shoujin Chinese", var(--reading-font-family); }
:root[data-theme="light"] .dictionary, :root[data-theme="light"] .note-group { --dictionary-phrase-color: #2369b5; }
.dictionary { position: fixed; inset: 0 0 auto; z-index: 60; display: flex; width: 100%; height: var(--app-height, 100dvh); min-width: 0; min-height: 0; max-width: none; max-height: none; margin: 0; padding: 0; border: 0; color: var(--ink); overflow: hidden; background: var(--paper); }
.dictionary::backdrop { background: var(--paper); }
.dictionary:not([open]) { display: none; }
.dictionary-card { display: flex; flex: 1; flex-direction: column; width: 100%; height: 100%; min-width: 0; min-height: 0; max-width: none; max-height: none; overflow: hidden; border-top: 2px solid var(--accent); border-radius: 0; background: var(--paper); }
.dictionary-header { flex: 0 0 auto; min-width: 0; padding: max(24px, var(--safe-top)) max(28px, calc((100% - 860px) / 2), var(--safe-right)) 0 max(28px, calc((100% - 860px) / 2), var(--safe-left)); border-bottom: 1px solid var(--rule); background: var(--paper); }
.dictionary-topline { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.dictionary-brand { display: flex; align-items: center; gap: 10px; font-weight: 500; font-size: 11px; letter-spacing: 2px; color: var(--body-ink); line-height: 1.5; }
.longman-mark { display: grid; place-items: center; width: 25px; height: 29px; color: var(--accent-dark); font: italic 27px/1 "Lumen Shoujin Chinese", var(--editorial-font); background: transparent; letter-spacing: -.3px; }
.dictionary-brand-name { font-size: 14px; letter-spacing: .5px; }
.close-dictionary { width: 44px; height: 44px; margin: -5px -8px 0 0; }
.dictionary-title-row { display: flex; align-items: baseline; flex-wrap: wrap; gap: 9px 18px; margin: 22px 0 4px; }
.dictionary-title-row h2 { margin: 0; color: var(--ink); font: 400 var(--dictionary-headword-size)/1.1 var(--editorial-font); letter-spacing: -.9px; overflow-wrap: anywhere; }
.dictionary-source-label { font-size: 13px; color: var(--faint); }
.dictionary-source-label:empty { display: none; }
.dictionary-pos-tabs { display: flex; align-items: stretch; gap: 25px; width: 100%; max-width: 100%; min-width: 0; margin-top: 18px; overflow-x: auto; overscroll-behavior-x: contain; scrollbar-width: thin; }
.dictionary-pos-tab { display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto; min-height: 47px; padding: 10px 0 13px; border: 0; border-bottom: 2px solid transparent; background: transparent; color: var(--muted); font-size: 16px; line-height: 1.5; white-space: nowrap; }
.dictionary-pos-tab:hover { background: transparent; color: var(--ink); }
.dictionary-pos-tab:focus-visible { outline: 1px solid var(--muted); outline-offset: -5px; }
.dictionary-pos-tab[aria-selected="true"] { border-bottom-color: var(--accent); color: var(--ink); background: transparent; }
.lookup-status { font-size: 15px; color: var(--muted); line-height: 1.8; margin: 16px 0; }
.lookup-status:empty { display: none; }
.dictionary-entries { flex: 1 1 0; min-height: 0; min-width: 0; overflow-y: auto; overflow-x: hidden; padding: 23px max(28px, calc((100% - 860px) / 2), var(--safe-right)) 35px max(28px, calc((100% - 860px) / 2), var(--safe-left)); overscroll-behavior: contain; scrollbar-gutter: stable; scroll-padding-block: 24px; }
.dictionary-footer { display: flex; align-items: center; justify-content: space-between; gap: 20px; flex: 0 0 auto; min-width: 0; padding: 14px max(28px, calc((100% - 860px) / 2), var(--safe-right)) max(14px, var(--safe-bottom)) max(28px, calc((100% - 860px) / 2), var(--safe-left)); border-top: 1px solid var(--rule); background: var(--paper); }
.selection-summary { flex: 1; min-width: 0; margin: 0; color: var(--muted); font-size: 14px; line-height: 1.8; }
.selection-summary strong { color: var(--ink); font-weight: 600; }
.selection-summary > span { display: block; font-size: 12px; color: var(--faint); }
.button-primary { color: white; border-color: #e3120b; background: #e3120b; }
.button-primary:hover:not(:disabled) { background: #ff322b; border-color: #ff322b; }
.dictionary-footer .button-primary { flex: 0 0 auto; min-height: 44px; font-size: 14px; padding: 10px 20px; border-radius: 2px; }
.dictcontent, .note-card { text-align: left; }
.dictcontent { font-size: var(--dictionary-font-size); line-height: 1.7; }
.saved-sense { font-size: var(--saved-meaning-size); }
.dictcontent .ldoceEntry { color: var(--body-ink); font-family: "Lumen Shoujin Chinese", var(--ui-font); font-size: var(--dictionary-font-size); line-height: 1.7; }
.dictcontent .Head { display: block; margin-bottom: 0; color: var(--muted); line-height: 1.7; }
.dictcontent .entry-metadata-row { display: flex; align-items: center; flex-wrap: wrap; gap: 7px 13px; margin: 0 0 8px; font-size: var(--dictionary-meta-size); color: var(--muted); }
.dictcontent .entry-headword-redundant, .dictcontent .sense-number-redundant, .dictcontent .sense-signpost-redundant { display: none !important; }
.dictcontent .HWD, .dictcontent .HYPHENATION { font: 400 var(--dictionary-headword-size)/1.3 var(--editorial-font); color: var(--ink); letter-spacing: -.5px; }
.dictcontent .Head:has(.HYPHENATION) .HWD, .note-card .Head:has(.HYPHENATION) .HWD { display: none; }
.dictcontent .POS, .note-card .POS { color: var(--muted); font-size: var(--dictionary-meta-size); font-style: italic; margin: 0 4px; }
.dictcontent .GRAM, .note-card .GRAM { color: var(--muted); font-size: var(--dictionary-meta-size); margin-right: 5px; }
.dictcontent .PRON, .dictcontent .PronCodes, .note-card .PRON, .note-card .PronCodes { color: var(--muted); font-family: "Lumen Shoujin Chinese", var(--ui-font); font-size: 15px; }
.dictcontent .Sense, .note-card .Sense { display: block; margin-top: 15px; }
.dictcontent .Sense .Sense, .note-card .Sense .Sense { margin: 10px 0 0 8px; padding-left: 12px; border-left: 1px solid var(--rule-strong); }
.dictcontent .Sense:first-child, .note-card .Sense:first-child { margin-top: 0; }
.dictcontent .DEF, .note-card .DEF { color: var(--body-ink); font-weight: 400; line-height: 1.65; }
.dictcontent .DEF { font-size: var(--dictionary-font-size); }
.note-card .DEF { font-size: var(--saved-meaning-size); }
.dictcontent .EXAMPLE, .note-card .EXAMPLE { display: block; margin: 13px 0; padding: 0; border: 0; background: transparent; color: var(--muted); font-family: "Lumen Shoujin Chinese", var(--editorial-font); font-size: var(--dictionary-example-size); font-style: italic; line-height: 1.9; }
.dictcontent .EXAMPLE .COLLOINEXA, .note-card .EXAMPLE .COLLOINEXA { color: var(--body-ink); font-weight: 600; }
.dictcontent .SIGNPOST, .note-card .SIGNPOST { display: inline-block; color: var(--accent-dark); font-size: 15px; font-weight: 600; letter-spacing: .5px; margin-right: 7px; }
.dictcontent .ACTIV, .note-card .ACTIV { color: var(--accent-dark); font-weight: 500; }
.dictcontent .ACTIV::after, .note-card .ACTIV::after,
.dictcontent .F2NBox > .heading::after, .note-card .F2NBox > .heading::after { content: "  "; white-space: pre; }
.dictcontent .synopp, .dictcontent .SYN, .dictcontent .OPP, .note-card .synopp, .note-card .SYN, .note-card .OPP { font-size: 16px; color: var(--muted); }
.dictcontent .REFHWD, .dictcontent .Ref, .note-card .REFHWD, .note-card .Ref { color: inherit; }
.dictcontent .Sense .sensenum, .dictcontent .Sense > .SenseNum, .note-card .sensenum, .note-card .SenseNum { display: inline-block; color: var(--accent-dark); font-weight: 600; margin-right: 6px; }
.dictcontent .REGISTERLAB, .dictcontent .GEO, .dictcontent .STYLE, .note-card .REGISTERLAB, .note-card .GEO, .note-card .STYLE { color: var(--muted); font-size: 15px; font-style: italic; }
.dictcontent .COLLO, .dictcontent .PROPFORM, .dictcontent .LEXUNIT, .dictcontent .LEXVAR, .note-card .COLLO, .note-card .PROPFORM, .note-card .LEXUNIT, .note-card .LEXVAR { color: var(--dictionary-phrase-color); font-size: 16px; font-weight: 500; line-height: 1.65; }
.dictcontent .Collocate, .dictcontent .Collobox, .dictcontent .ThesBox, .dictcontent .UsageBox, .dictcontent .GramBox, .note-card .Collocate, .note-card .Collobox, .note-card .ThesBox, .note-card .UsageBox, .note-card .GramBox { display: block; margin: 22px 0; padding: 15px 0 0; border: 0; border-top: 1px solid var(--rule); background: transparent; font-size: inherit; }
.dictcontent .ColloBox, .dictcontent .Collocation, .dictcontent .Thesaurus, .dictcontent .Exponent, .dictcontent .RunOn, .dictcontent .PhrVbEntry, .dictcontent .Tail, .note-card .ColloBox, .note-card .Collocation, .note-card .Thesaurus, .note-card .Exponent, .note-card .RunOn, .note-card .PhrVbEntry, .note-card .Tail { display: block; margin-top: 12px; }
.dictcontent .COLLOHEADING, .dictcontent .HEADING, .dictcontent .SECHEADING, .note-card .COLLOHEADING, .note-card .HEADING, .note-card .SECHEADING { display: block; font-size: 16px; font-weight: 600; color: var(--ink); letter-spacing: .5px; margin-bottom: 7px; }
.dictcontent img, .note-card img { max-width: 100%; height: auto; }
.dictcontent audio, .note-card audio { max-width: 100%; height: 32px; }
.dictcontent table, .note-card table { width: 100%; border-collapse: collapse; font-size: inherit; }
.dictcontent td, .dictcontent th, .note-card td, .note-card th { padding: 7px; border-bottom: 1px solid var(--rule); text-align: left; }
.dictcontent ul, .dictcontent ol, .note-card ul, .note-card ol { padding-left: 20px; }
.entry-section { margin-bottom: 28px; padding-bottom: 0; border: 0; }
.entry-section:last-child { margin-bottom: 0; border-bottom: 0; padding-bottom: 0; }
.dictcontent .FIELD { display: none; }
.dictcontent .topics_container { display: block; margin: 0 0 12px; font-size: 15px; color: var(--muted); }
.sense-item { position: relative; padding: 24px 0 28px; margin: 0; border: 0; border-bottom: 1px solid var(--rule); background: transparent; transition: border-color .15s ease; }
.sense-item:hover { background: transparent; border-bottom-color: var(--rule-strong); }
.sense-item:has(.sense-checkbox:checked), .sense-item.selected { background: transparent; }
.sense-item:has(.sense-checkbox:checked)::before, .sense-item.selected::before { content: ""; position: absolute; left: -16px; top: 26px; width: 2px; height: 24px; background: var(--accent); }
.sense-heading { display: flex; align-items: center; gap: 8px; min-width: 0; min-height: 26px; margin-bottom: 13px; }
.sense-index, .sense-signpost { color: var(--accent-dark); font: 500 16px/1.5 "Lumen Shoujin Chinese", var(--ui-font); letter-spacing: 0; }
.sense-index { order: 1; flex: 0 0 auto; font-variant-numeric: tabular-nums; }
.sense-signpost { order: 2; min-width: 0; overflow-wrap: anywhere; }
.sense-select { order: 3; display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; flex: 0 0 auto; margin: -9px -11px -9px auto; cursor: pointer; }
.sense-heading:has(.sense-signpost) + .sense-content > .Sense > .SIGNPOST { display: none; }
.sense-checkbox { accent-color: var(--accent); width: 18px; height: 18px; margin: 0; cursor: pointer; }
.sense-select > span:not(.visually-hidden) { font-size: 0; }
.sense-content { min-width: 0; overflow-wrap: anywhere; }
.sense-content > .Sense { margin-top: 0; }
.audio-button { position: relative; display: inline-flex; align-items: center; justify-content: center; vertical-align: middle; width: 36px; height: 36px; min-width: 36px; min-height: 36px; margin: 0 3px; padding: 8px; border: 0; border-radius: 50%; background: var(--surface-soft); color: var(--muted); line-height: 1; cursor: pointer; transition: color .15s ease, background .15s ease, transform .15s ease; }
.audio-button::before { content: ""; position: absolute; left: 50%; top: 50%; width: 44px; height: 44px; transform: translate(-50%, -50%); border-radius: 50%; }
.audio-button svg { width: 18px; height: 18px; stroke-width: 1.6; pointer-events: none; }
.audio-button:hover { background: var(--accent-light); color: var(--accent-dark); }
.audio-button:active { transform: scale(.94); }
.audio-button:focus-visible { outline: 2px solid var(--accent-dark); outline-offset: 3px; }
.dictionary-source { display: inline-block; font-size: 13px; margin: 21px 0 0; color: var(--muted); text-decoration-color: var(--rule-strong); }
.dictionary-source:hover { color: var(--accent-dark); }
.subtle-button { display: inline-flex; padding: 8px 11px; margin: 5px 8px 2px 0; border: 1px solid var(--rule); background: transparent; color: var(--ink); font-size: 11px; text-decoration: none; }
.subtle-button:hover { background: var(--surface-hover); }

.input-dialog { width: min(560px, calc(100vw - 32px)); max-height: calc(var(--app-height) - 40px); padding: 33px; border: 0; border-top: 5px solid var(--accent); border-radius: 0; color: var(--ink); background: var(--surface); box-shadow: 0 20px 65px var(--shadow); overflow-y: auto; }
.input-dialog::backdrop { background: var(--backdrop); }
.dialog-eyebrow { font-size: 9px; font-weight: 600; letter-spacing: 1.8px; color: var(--accent-dark); margin-bottom: 17px; }
.input-dialog h2 { margin: 0 0 12px; color: var(--ink); font: 500 30px/1.2 "Lumen Shoujin Chinese", var(--editorial-font); letter-spacing: -.3px; }
.dialog-description { color: var(--muted); line-height: 1.8; font-size: 12px; margin: 0 0 26px; }
.field-label { display: flex; align-items: center; gap: 8px; font-size: 12px; font-weight: 500; color: var(--body-ink); margin: 20px 0 9px; }
.field-label > span { color: var(--muted); font-size: 10px; font-weight: 400; }
.text-input { width: 100%; padding: 12px; color: var(--ink); background: var(--paper); border: 1px solid var(--rule-strong); border-radius: 0; font-size: 14px; line-height: 1.7; }
.text-input:focus { border-color: var(--muted); background: var(--surface-hover); }
.paste-text { min-height: 230px; max-height: calc(var(--app-height) * .4); resize: vertical; font-family: "Lumen Shoujin Chinese", var(--editorial-font); font-size: 16px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 9px; margin-top: 25px; }
.appearance-dialog { width: min(470px, calc(100vw - 32px)); padding: 26px; }
.appearance-heading { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 10px; }
.appearance-heading h2 { margin: 0; font: 700 25px/1.3 "Lumen Shoujin Chinese", var(--ui-font); letter-spacing: 0; }
.appearance-dialog .dialog-description { margin-bottom: 18px; font-size: 11px; }
.appearance-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.appearance-label { font-size: 12px; font-weight: 600; color: var(--ink); }
.font-size-stepper { display: flex; align-items: center; gap: 5px; }
.font-size-stepper button { display: grid; place-items: center; width: 40px; height: 38px; border: 1px solid var(--rule-strong); border-radius: 4px; background: var(--surface-hover); color: var(--ink); font: 19px "Lumen Shoujin Chinese", var(--editorial-font); }
.font-size-stepper button:hover:not(:disabled) { border-color: var(--muted); background: var(--rule); }
.font-size-stepper output { min-width: 54px; color: var(--ink); font-size: 13px; text-align: center; font-variant-numeric: tabular-nums; }
.font-size-slider { display: block; width: 100%; height: 32px; margin: 6px 0 0; accent-color: var(--accent); cursor: pointer; }
.font-size-endpoints { display: flex; justify-content: space-between; margin-top: -3px; color: var(--muted); font-size: 10px; }
.font-options { display: grid; gap: 7px; min-width: 0; padding: 0; margin: 20px 0 17px; border: 0; }
.font-options legend { padding: 0; margin-bottom: 11px; }
.font-choice { display: grid; grid-template-columns: 18px minmax(0, 1fr) 40px; align-items: center; gap: 12px; min-height: 59px; padding: 9px 13px; border: 1px solid var(--rule); border-radius: 4px; background: var(--surface-soft); cursor: pointer; }
.font-choice:hover { border-color: var(--faint); }
.font-choice:has(input:checked) { border-color: var(--accent); background: var(--accent-light); }
.font-choice:focus-within { outline: 2px solid var(--accent); outline-offset: 3px; }
.font-choice input { width: 17px; height: 17px; margin: 0; accent-color: var(--accent); }
.font-choice > span:not(.font-choice-sample) { display: flex; flex-direction: column; gap: 4px; }
.font-choice strong { font-size: 13px; font-weight: 500; }
.font-choice small { color: var(--muted); font-size: 10px; }
.font-choice-sample { font-size: 26px; line-height: 1.2; text-align: right; }
.font-sample-serif { font-family: "Lumen Shoujin Chinese", var(--editorial-font); }
.font-sample-sans { font-family: "Lumen Shoujin Chinese", var(--ui-font); }
.font-sample-handwritten { font-family: "Lumen Shoujin Chinese", var(--handwritten-font); }
.appearance-theme-options { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; min-width: 0; padding: 0; margin: 20px 0; border: 0; }
.appearance-theme-options > legend { grid-column: 1 / -1; padding: 0; margin-bottom: 10px; color: var(--ink); font-size: 12px; font-weight: 600; }
.appearance-theme-options label, .appearance-theme-options button { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; min-width: 0; min-height: 70px; padding: 10px 5px; border: 1px solid var(--rule); border-radius: 3px; background: var(--paper); color: var(--ink); font-size: 12px; line-height: 1.5; cursor: pointer; }
.appearance-theme-options input { width: 16px; height: 16px; margin: 0; accent-color: var(--accent); }
.appearance-theme-options label:has(input:checked), .appearance-theme-options button[aria-pressed="true"] { border-color: var(--accent); color: var(--accent-dark); background: var(--accent-light); }
.appearance-theme-options svg { width: 20px; height: 20px; }
.appearance-preview { height: 127px; padding: 13px; border-radius: 4px; background: var(--surface-soft); overflow: auto; overscroll-behavior: contain; }
.appearance-preview-label { display: block; margin-bottom: 10px; color: var(--muted); font-size: 10px; }
.appearance-preview p { margin: 7px 0; font: var(--reading-font-size)/1.55 var(--reading-font-family); color: var(--ink); overflow-wrap: anywhere; }
.appearance-actions { position: sticky; bottom: -26px; justify-content: space-between; padding: 15px 0 2px; margin-top: 14px; border-top: 1px solid var(--rule); background: var(--surface); }
.button-quiet { background: transparent; color: var(--muted); }
.button-quiet:hover { background: var(--surface-hover); color: var(--ink); }
.web-dialog { width: min(500px, calc(100vw - 32px)); }
.pair-code { text-align: center; letter-spacing: 9px; font-size: 26px; }
.pair-error { min-height: 20px; margin: 12px 0 0; color: var(--accent-dark); font-size: 12px; line-height: 1.7; }
.toast-container { display: flex; flex-direction: column; align-items: center; gap: 9px; position: fixed; left: 20px; right: 20px; bottom: calc(25px + var(--safe-bottom)); z-index: 100; pointer-events: none; }
.toast { display: flex; align-items: center; gap: 12px; width: min(520px, 100%); min-height: 52px; padding: 11px 13px 11px 16px; border: 0; border-radius: 5px; color: var(--toast-ink); background: var(--toast-bg); box-shadow: 0 5px 20px var(--shadow); font-size: 13px; line-height: 1.6; pointer-events: auto; animation: panel-enter .16s ease both; }
.toast-message { min-width: 0; flex: 1; overflow-wrap: anywhere; }
.toast button { color: white; background: transparent; border: 0; padding: 4px 6px; font-weight: 600; white-space: nowrap; }
.toast .toast-close { display: grid; place-items: center; flex-shrink: 0; width: 30px; height: 30px; padding: 4px; border-radius: 3px; font-size: 23px; font-weight: 400; line-height: 1; }
.toast .toast-close:hover { background: var(--toast-hover); }
.toast-close svg { width: 20px; height: 20px; }
.noscript-message { position: fixed; bottom: 20px; left: 20px; right: 20px; padding: 20px; background: var(--surface); border-top: 3px solid var(--accent); color: var(--ink); text-align: center; z-index: 100; }
::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--rule-strong); }
::-webkit-scrollbar-thumb:hover { background: var(--faint); }
@keyframes panel-enter { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }

/* Import choices and the launch screen are part of the same app shell. */
.import-menu-head { display: flex; justify-content: space-between; align-items: center; gap: 20px; margin-bottom: 12px; }
.import-menu-head h2 { margin: 0; }
.import-options { display: grid; gap: 0; margin-top: 24px; border-top: 1px solid var(--rule); }
.import-option { display: flex; align-items: center; gap: 16px; min-height: 86px; padding: 16px 2px; border: 0; border-bottom: 1px solid var(--rule); background: transparent; color: var(--ink); text-align: left; }
.import-option > svg:first-child { width: 25px; height: 25px; color: var(--body-ink); }
.import-option > svg:last-child { width: 18px; height: 18px; margin-left: auto; color: var(--muted); }
.import-option > span { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.import-option strong { font-weight: 500; font-size: 15px; }
.import-option small { font-size: 11px; line-height: 1.5; color: var(--muted); }
.import-option:hover { background: var(--surface-hover); }
.notebook-menu { padding-top: 18px; }
.notebook-menu > p { margin: 0 0 11px; color: var(--muted); font-size: 11px; }
.notebook-menu > div { display: flex; flex-wrap: wrap; gap: 8px; }
.notebook-menu button { display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 40px; padding: 9px 11px; border: 1px solid var(--rule-strong); border-radius: 3px; background: transparent; color: var(--ink); font-size: 11px; }
.notebook-menu button svg { width: 15px; height: 15px; }
.notebook-menu button:hover { background: var(--surface-hover); border-color: var(--faint); }
.launch-screen { position: fixed; inset: 0; z-index: 200; display: flex; flex-direction: column; align-items: center; justify-content: center; background: #e3120b; opacity: 1; transition: opacity .18s ease; }
.launch-wordmark { display: flex; flex-direction: column; align-items: center; justify-content: center; min-width: 150px; min-height: 82px; padding: 12px 20px; background: #fff; color: #d50e08; }
.launch-wordmark > span { font: 400 36px/1 "Lumen Shoujin Chinese", var(--editorial-font); letter-spacing: -1px; }
.launch-wordmark small { margin-top: 6px; font-size: 10px; letter-spacing: 3px; }
.launch-spinner { position: absolute; left: calc(50% - 12px); top: calc(50% + 145px); width: 24px; height: 24px; border: 3px solid #ffffff42; border-top-color: #fff; border-radius: 50%; animation: launch-spin .8s linear infinite; }
.launch-screen.is-finished { opacity: 0; pointer-events: none; }
@keyframes launch-spin { to { transform: rotate(360deg); } }

@media (min-width: 1500px) {
  .app-shell { padding-left: 56px; padding-right: 56px; }
  .workspace { grid-template-columns: minmax(0, 1fr) 380px; gap: 44px; }
  .article-header, .article-content { padding-left: 28px; padding-right: 42px; }
  .notes-panel { padding-left: 31px; }
}
@media (max-width: 1190px) {
  .app-shell { padding-left: 30px; padding-right: 30px; }
  .app-header { gap: 18px; min-height: 88px; }
  .brand { gap: 12px; }
  .brand-name { font-size: 35px; }
  .brand-copy { display: none; }
  .import-actions .button { padding-left: 10px; padding-right: 10px; }
  .header-end { gap: 11px; margin-left: 0; }
  .reader-badge { display: none; }
  .workspace { grid-template-columns: minmax(0, 1fr) 310px; gap: 25px; padding-top: 24px; }
  .article-header { padding-left: 20px; padding-right: 20px; }
  .article-content { padding-left: 5px; padding-right: 10px; }
  .notes-panel { padding-left: 23px; }
  #articleTitle { font-size: 46px; }
  .reading-hint { font-size: 10px; }
  .lookup-form { width: 145px; }
  .reading-controls { gap: 9px; }
  .progress-note { display: none; }
  .reading-footer { padding-left: 5px; padding-right: 10px; }
}
@media (max-width: 970px) and (min-width: 761px) {
  .app-shell { padding-left: 22px; padding-right: 22px; }
  .app-header { gap: 12px; }
  .brand-name { font-size: 32px; }
  .button { font-size: 11px; gap: 6px; }
  .workspace { grid-template-columns: minmax(0, 1fr) 285px; gap: 20px; }
  .notes-panel { padding-left: 19px; }
  #articleTitle { font-size: 41px; }
  .reader-toolbar { flex-wrap: wrap; gap: 3px; padding: 9px 0; }
  .reading-hint { flex: 1 0 100%; }
  .reading-controls { width: 100%; justify-content: space-between; }
  .notes-heading h2 { font-size: 23px; }
}
@media (max-width: 760px) {
  :root { --dictionary-font-size: 20px; --dictionary-headword-size: 34px; --dictionary-meta-size: 15px; --dictionary-example-size: 15px; }
  .app-shell { padding: var(--safe-top) 16px 0; }
  .app-header { display: grid; grid-template-columns: 65px minmax(0, 1fr) 65px; align-items: center; gap: 6px; min-height: 75px; padding: 12px 0; }
  .menu-toggle { justify-self: start; margin-left: -6px; }
  .brand { justify-content: center; min-width: 0; }
  .brand-name { font-size: 31px; letter-spacing: -.9px; line-height: 1.1; }
  .brand-copy, .import-actions { display: none; }
  .header-end { justify-self: end; margin: 0; }
  .header-end .button-notes { display: none; }
  .reader-badge { display: inline-flex; font-size: 11px; gap: 5px; padding: 5px 7px; }
  .reader-badge > span { width: 7px; height: 7px; }
  .workspace, .notes-hidden .workspace { display: flex; min-height: 0; padding-top: 24px; }
  .reader-panel { width: 100%; }
  .notes-panel { display: none; width: 100%; padding-left: 0; border-left: 0; }
  .notes-open:not(.notes-hidden) .reader-panel { display: none; }
  .notes-open:not(.notes-hidden) .notes-panel { display: flex; }
  .notes-hidden .reader-panel { display: flex; }
  .notes-hidden .notes-panel { display: none; }
  .article-header, .notes-hidden .article-header { padding: 17px 16px 0; max-width: none; }
  .article-topline { margin-bottom: 12px; min-height: 27px; }
  .article-date { margin-bottom: 10px; font-size: 10px; letter-spacing: .4px; }
  .eyebrow { font-size: 14px; letter-spacing: .1px; font-weight: 400; }
  .clear-article { width: 30px; height: 30px; }
  #articleTitle { max-width: 550px; font-size: 36px; line-height: 1.09; letter-spacing: -.9px; margin-bottom: 13px; }
  .article-subtitle { font: 20px/1.45 "Lumen Shoujin Chinese", var(--editorial-font); color: var(--body-ink); }
  .reader-toolbar { display: block; margin-top: 22px; min-height: 0; padding: 0; border-top: 0; border-bottom: 0; }
  .reading-hint { display: none; }
  .reading-hint svg { width: 11px; height: 11px; }
  .reading-controls { width: 100%; flex-direction: column; align-items: stretch; gap: 0; }
  .reader-action.button, .reader-action.lookup-form { width: 100%; min-height: 48px; justify-content: flex-start; gap: 12px; padding: 10px 0; border: 0; border-bottom: 1px solid var(--rule); border-radius: 0; background: transparent; font-size: 14px; }
  .reader-action:last-child { border-bottom: 0; }
  .reader-action.button:hover { background: var(--surface-hover); }
  .reader-action.lookup-form:focus-within { border-bottom-color: var(--secondary); }
  .reader-action > svg { width: 21px; height: 21px; color: var(--body-ink); }
  .reader-action .appearance-symbol { width: 21px; color: var(--body-ink); font-size: 19px; }
  .lookup-form { gap: 12px; }
  .lookup-form input { font-size: 16px; }
  .article-content, .notes-hidden .article-content { padding: 26px 2px 30px 0; line-height: 1.78; max-width: 550px; }
  .read-paragraph { margin-bottom: 28px; }
  .paragraph-label { font-size: 8px; margin-bottom: 8px; }
  .sentence-label { font-size: 7px; margin-right: 5px; }
  .reading-footer, .notes-hidden .reading-footer { min-height: 39px; padding: 11px 0 7px; }
  #progressText { font-size: 9px; }
  .progress-note { display: none; }
  .section-kicker { margin-top: 12px; margin-bottom: 14px; }
  .notes-header { padding-bottom: 20px; }
  .notes-heading h2 { font-size: 27px; }
  .notes-list { padding-right: 4px; }
  .notes-search input { font-size: 16px; }
  .note-card { padding: 17px 0 22px; }
  .empty-notes { padding-top: 25px; }
  .mobile-navigation { position: fixed; left: 16px; right: 16px; bottom: calc(12px + var(--safe-bottom)); z-index: 30; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 3px; height: 62px; max-width: 500px; margin: 0 auto; padding: 4px; border: 1px solid var(--nav-border); border-radius: 40px; background: var(--nav-bg); box-shadow: inset 0 1px 1px var(--control-border); backdrop-filter: blur(18px) saturate(130%); -webkit-backdrop-filter: blur(18px) saturate(130%); }
  .mobile-navigation button { display: flex; align-items: center; justify-content: center; flex-direction: column; gap: 3px; min-width: 0; min-height: 44px; padding: 4px 3px; border: 0; border-radius: 30px; color: var(--ink); background: transparent; font-size: 10px; line-height: 1.1; font-weight: 500; }
  .mobile-navigation button svg { width: 21px; height: 21px; stroke-width: 1.7; }
  .mobile-navigation button[aria-pressed="true"] { color: var(--accent); background: var(--nav-selected); }
  .mobile-navigation button:active { background: var(--nav-pressed); }
  .dictionary-header { padding: max(17px, var(--safe-top)) max(21px, var(--safe-right)) 0 max(21px, var(--safe-left)); }
  .dictionary-title-row { margin-top: 19px; }
  .dictionary-pos-tabs { gap: 23px; margin-top: 15px; }
  .dictionary-pos-tab { padding-left: 0; padding-right: 0; font-size: 15px; }
  .dictionary-entries { padding: 22px max(21px, var(--safe-right)) 30px max(21px, var(--safe-left)); }
  .sense-item { padding: 23px 0 26px; }
  .sense-select { margin-right: -10px; }
  .sense-item:has(.sense-checkbox:checked)::before, .sense-item.selected::before { left: -12px; top: 25px; }
  .dictionary-footer { padding: 13px max(21px, var(--safe-right)) max(13px, var(--safe-bottom)) max(21px, var(--safe-left)); gap: 13px; }
  .dictionary-footer .button-primary { font-size: 14px; padding: 10px 13px; min-height: 44px; }
  .input-dialog { padding: 27px 23px; }
  .input-dialog h2 { font-size: 27px; }
  .appearance-dialog { padding: 22px; max-height: calc(var(--app-height) - 24px - var(--safe-top)); }
  .appearance-heading h2 { font-size: 24px; }
  .appearance-actions { bottom: -22px; }
  .text-input { font-size: 16px; }
  .paste-text { min-height: 180px; }
  .import-dialog { width: min(460px, calc(100vw - 24px)); }
  .import-option { min-height: 82px; }
  .toast-container { bottom: calc(100px + var(--safe-bottom)); }
}
@media (max-width: 370px) {
  .app-shell { padding-left: 14px; padding-right: 14px; }
  .brand-name { font-size: 29px; }
  #articleTitle { font-size: 33px; }
  .reader-toolbar { padding: 0; }
  .reading-hint { flex: 1 0 100%; }
  .reading-controls { width: 100%; }
  .dictionary-footer { align-items: center; flex-direction: row; }
  .selection-summary > span { display: block; margin-left: 0; }
  .dictionary-footer .button-primary { width: auto; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
/* A compact editorial feed: headlines lead, real thumbnails support them. */
.library-panel { display: flex; flex-direction: column; min-height: 0; height: 100%; width: 100%; max-width: 1080px; margin: 0 auto; }
.article-list { display: block; flex: 1; min-height: 0; overflow-y: auto; padding: 0 5px 24px 0; overscroll-behavior: contain; }
.library-item { min-width: 0; border-bottom: 1px solid var(--rule); }
.article-card { display: grid; grid-template-columns: minmax(0, 1fr) minmax(140px, 28%); align-items: start; column-gap: 30px; row-gap: 16px; width: 100%; min-height: 0; padding: 25px 0 27px; border: 0; background: transparent; text-align: left; color: var(--ink); }
.article-card:not(:has(.article-card-cover)) { grid-template-columns: minmax(0, 1fr); }
.card-copy { display: flex; flex-direction: column; align-items: flex-start; min-width: 0; }
.article-card:hover .card-title { color: var(--ink); text-decoration: underline; text-decoration-color: var(--accent); text-underline-offset: 4px; text-decoration-thickness: 1px; }
.article-card-cover { grid-column: 2; grid-row: 1; display: block; width: 100%; aspect-ratio: 16 / 9; max-height: 220px; object-fit: cover; margin: 3px 0 0; background: var(--surface-soft); }
.card-category { display: block; color: var(--accent); font-size: 12px; line-height: 1.4; margin: 0 0 8px; }
.card-title { display: block; max-width: 720px; font: 400 32px/1.16 "Lumen Shoujin Chinese", var(--editorial-font); letter-spacing: -.65px; overflow-wrap: anywhere; }
.card-excerpt { display: none; }
.card-meta { grid-column: 1 / -1; grid-row: 2; display: flex; align-items: center; flex-wrap: wrap; gap: 6px 12px; margin-top: 0; font: 12px/1.6 "Lumen Shoujin Chinese", var(--ui-font); color: var(--muted); }
.card-audio-badge { display: inline-flex; align-items: center; gap: 4px; margin-left: auto; color: var(--muted); }
.card-audio-badge svg { width: 20px; height: 20px; }
.library-empty { margin: 24px 0; color: var(--muted); font-size: 14px; line-height: 1.8; }
.library-view .workspace { display: flex; padding-top: 7px; }
.focus-controls { display: none; }
.article-focused .app-header, .article-focused .section-tabs, .article-focused .mobile-navigation, .article-focused .notes-panel, .article-focused .reader-toolbar, .article-focused .reading-footer, .article-focused .skip-link,
.notes-focused .app-header, .notes-focused .section-tabs, .notes-focused .mobile-navigation, .notes-focused .notes-header, .notes-focused .reader-panel, .notes-focused .skip-link { display: none; }
.article-focused .app-shell { padding: var(--safe-top) var(--safe-right) var(--safe-bottom) var(--safe-left); width: 100%; max-width: none; }
.article-focused .workspace { display: flex; padding: 68px 0 0; gap: 0; width: 100%; }
.article-focused .reader-panel { display: flex; flex: 1; width: 100%; max-width: none; border: 0; }
.article-focused .article-scroller { width: 100%; padding: 0; touch-action: pan-y pinch-zoom; }
.article-focused .article-header { width: 100%; max-width: 900px; margin: 0 auto; padding: 20px 30px 28px; background: transparent; border: 0; border-radius: 0; }
.article-focused .article-topline { min-height: 0; margin-bottom: 18px; }
.article-focused .clear-article { display: none; }
.article-focused #articleTitle { max-width: 840px; margin-bottom: 17px; font-size: clamp(36px, 5.2vw, 63px); line-height: 1.08; letter-spacing: -1.5px; }
.article-focused .article-subtitle { max-width: 780px; font: 23px/1.45 "Lumen Shoujin Chinese", var(--editorial-font); color: var(--body-ink); margin-bottom: 20px; }
.article-cover { display: block; max-width: 100%; width: 100%; height: auto; max-height: none; object-fit: contain; margin: 0; background: var(--surface-soft); }
.article-focused .article-content { max-width: 780px; margin: 0 auto; padding: 0 30px 50px; line-height: 1.8; }
/* Real article media belongs to the story, with its caption and source intact. */
.article-byline { margin: 0 0 10px; color: var(--ink); font: 500 12px/1.6 "Lumen Shoujin Chinese", var(--ui-font); }
.article-cover-figure { display: block; margin: 25px 0 18px; }
.article-cover-figure figcaption { padding-top: 8px; color: var(--muted); font: 11px/1.6 "Lumen Shoujin Chinese", var(--ui-font); }
.article-cover-figure figcaption > span { display: block; }
.article-source-row { display: flex; align-items: center; gap: 8px; margin: 14px 0 5px; font: 12px/1.6 "Lumen Shoujin Chinese", var(--ui-font); overflow-wrap: anywhere; }
.article-source-row a { color: var(--muted); text-decoration-color: var(--rule-strong); }
.article-source-row a:hover { color: var(--accent-dark); }
#refreshArticleButton { min-height: 28px; padding: 0; border: 0; background: transparent; color: var(--muted); font: 12px/1.6 "Lumen Shoujin Chinese", var(--ui-font); text-decoration: underline; text-decoration-color: var(--rule-strong); text-underline-offset: 3px; }
#refreshArticleButton:hover:not(:disabled) { color: var(--accent-dark); text-decoration-color: currentColor; }
.article-lead-audio { display: flex; flex-direction: column; gap: 10px; margin: 23px 0 0; padding: 18px 0; border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule); color: var(--ink); font: 14px/1.5 "Lumen Shoujin Chinese", var(--ui-font); }
.article-lead-audio strong, .article-lead-audio p { margin: 0; font-size: 14px; font-weight: 500; }
.article-lead-audio audio { display: block; width: 100%; height: 42px; }
.article-lead-audio .article-media { margin: 0; }
.article-content .article-section-heading { margin: 1.6em 0 .8em; color: var(--ink); font: 600 1.18em/1.3 "Lumen Shoujin Chinese", var(--editorial-font); letter-spacing: -.3px; }
.article-media { display: block; min-width: 0; margin: 1.6em 0 1.9em; padding: 0; border: 0; color: var(--body-ink); font: 14px/1.6 "Lumen Shoujin Chinese", var(--ui-font); }
.article-media-title { margin: 0 0 8px; font: 500 14px/1.5 "Lumen Shoujin Chinese", var(--ui-font); color: var(--ink); }
.article-media-fallback { display: inline-block; margin: 10px 0 0; color: var(--muted); font: 12px/1.6 "Lumen Shoujin Chinese", var(--ui-font); text-underline-offset: 3px; }
.article-media img { display: block; width: 100%; max-width: 100%; height: auto; margin: 0; background: var(--surface-soft); }
.article-media audio { display: block; width: 100%; height: 44px; }
.article-media video { display: block; width: 100%; max-height: 560px; margin: 0; background: #000; }
.article-media iframe { display: block; width: 100%; aspect-ratio: 16 / 9; height: auto; border: 0; background: var(--surface-soft); }
.article-media figcaption { display: block; margin-top: 9px; color: var(--muted); font: 11px/1.6 "Lumen Shoujin Chinese", var(--ui-font); }
.article-media-caption { display: block; color: var(--body-ink); }
.article-media-credit { display: block; margin-top: 3px; color: var(--muted); }
.article-media figcaption a { color: var(--muted); text-decoration-color: var(--rule-strong); }
.article-media-play { display: flex; align-items: center; justify-content: center; gap: 10px; width: 100%; min-height: 160px; aspect-ratio: 16 / 9; padding: 24px; border: 1px solid var(--rule); background: var(--surface-soft); color: var(--ink); font: 14px/1.6 "Lumen Shoujin Chinese", var(--ui-font); cursor: pointer; }
.article-media-play svg { width: 34px; height: 34px; color: var(--accent); }
.article-media-play:hover { background: var(--surface-hover); border-color: var(--rule-strong); }
.read-paragraph { margin: 0 0 1.8em; }
.read-paragraph:last-child { margin-bottom: 0; }
.sentence-label { margin-right: 8px; padding: 0; font: 500 10px/1.5 "Lumen Shoujin Chinese", ui-monospace, SFMono-Regular, Menlo, monospace; color: var(--faint); vertical-align: .15em; }
.article-focused .focus-controls { position: fixed; top: calc(12px + var(--safe-top)); left: max(18px, var(--safe-left)); right: max(18px, var(--safe-right)); z-index: 25; display: flex; justify-content: space-between; align-items: center; gap: 12px; pointer-events: none; }
.focus-controls > div { display: flex; align-items: center; gap: 7px; }
.focus-button { display: grid; place-items: center; width: 44px; height: 44px; border: 1px solid var(--control-border); border-radius: 50%; color: var(--secondary); background: var(--control-bg); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); pointer-events: auto; }
.focus-button:hover { background: var(--control-hover); }
.focus-button svg { width: 20px; height: 20px; }
#articleBackButton { color: var(--ink); }
#articleBackButton svg { transform: rotate(180deg); }
.article-focused .toast-container { bottom: calc(20px + var(--safe-bottom)); }
.notes-focused .app-shell { padding: max(10px, var(--safe-top)) max(clamp(16px, 3vw, 40px), var(--safe-right)) max(12px, var(--safe-bottom)) max(clamp(16px, 3vw, 40px), var(--safe-left)); }
.notes-focused .workspace { display: flex; padding: 0; gap: 0; }
.notes-focused .notes-panel { display: flex; width: 100%; max-width: 900px; margin: 0 auto; padding: 0; border: 0; }
.notes-focused .notes-list { padding: 0 4px 20px 0; touch-action: pan-y pinch-zoom; }
.notes-focused .notes-back { display: inline-flex; }
@media (max-width: 760px) {
  .library-view .workspace { padding-top: 8px; }
  .article-list { padding: 0 0 calc(90px + var(--safe-bottom)); scroll-padding-bottom: calc(90px + var(--safe-bottom)); }
  .article-card { grid-template-columns: minmax(0, 1fr) 31%; column-gap: 17px; padding: 21px 0 23px; }
  .article-card-cover { width: 100%; aspect-ratio: 16 / 9; max-height: none; margin-top: 3px; }
  .card-category { font-size: 13px; margin-bottom: 7px; }
  .card-title { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 4; overflow: hidden; font-size: 22px; line-height: 1.2; letter-spacing: -.25px; }
  .card-meta { gap: 4px 9px; margin-top: 0; font-size: 12px; }
  .article-focused .article-header { padding: 18px 20px 24px; }
  .article-focused #articleTitle { font-size: 37px; line-height: 1.08; letter-spacing: -.8px; }
  .article-focused .article-subtitle { font-size: 21px; line-height: 1.42; }
  .article-cover-figure { width: calc(100% + 40px); max-width: none; margin: 23px -20px 18px; }
  .article-cover-figure figcaption { padding-left: 20px; padding-right: 20px; font-size: 10px; }
  .article-byline { font-size: 11px; }
  .article-source-row { font-size: 11px; }
  .article-focused .article-content { padding-left: 20px; padding-right: 20px; }
  .article-media { margin-top: 1.5em; margin-bottom: 1.8em; }
  .article-media figcaption { font-size: 10px; }
  .article-focused .focus-controls { left: max(16px, var(--safe-left)); right: max(16px, var(--safe-right)); }
  .focus-controls > div { gap: 6px; }
  .sentence-label { font-size: 9px; }
}
@media (max-width: 370px) {
  .article-card { column-gap: 14px; }
  .card-title { font-size: 22px; }
  .article-focused #articleTitle { font-size: 34px; }
  .article-focused .article-subtitle { font-size: 20px; }
}
@media print {
  :root { color-scheme: light; }
  html { height: auto; overflow: visible; }
  body { height: auto; overflow: visible; background: #fff; color: #111; }
  .app-header, .section-tabs, .mobile-navigation, .focus-controls, .launch-screen, .notes-panel, .reading-footer, .reader-toolbar, .article-topline, .dictionary, .toast-container { display: none !important; }
  .app-shell, .workspace, .reader-panel, .article-scroller { display: block; height: auto; overflow: visible; padding: 0; }
  .article-header, .article-content { max-width: none; padding: 20px 0; color: #111; background: transparent; }
  .article-date, .article-byline, .article-media figcaption { color: #444; }
  #articleTitle, .article-subtitle { color: #111; }
  .article-content { font-size: 14pt; }
  .article-cover-figure { width: 100%; margin: 20px 0; }
  .article-media, .article-cover-figure { break-inside: avoid; }
  .article-lead-audio, .article-media audio, .article-media video, .article-media-play { display: none; }
  .sentence-label { display: none; }
}

/* Allow an italic face when the chosen handwritten font has no native italic. */
.dictionary .de-example, .note-group .de-example { font-style: italic; font-synthesis: style; }

/* Register guidance is secondary to the main definition. */
.dictcontent .F2NBox, .note-card .F2NBox { display: block; margin-top: 18px; font-size: 16px; line-height: 1.75; }
.dictcontent .F2NBox > .heading, .note-card .F2NBox > .heading { color: #bb926c; font-size: inherit; font-weight: 500; }
:root[data-theme="light"] .dictcontent .F2NBox > .heading, :root[data-theme="light"] .note-card .F2NBox > .heading { color: #8b5e3c; }

.note-word-row { display: flex; align-items: baseline; flex-wrap: wrap; gap: 8px 12px; }
.note-pronunciation-row { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.note-pronunciation-row:empty { display: none; }
.analysis-phrase-group { margin-top: 12px; font-family: "Lumen Shoujin Chinese", var(--reading-font-family); }
.analysis-phrase-title { color: var(--muted); font: 12px/1.6 "Lumen Shoujin Chinese", var(--ui-font); margin-bottom: 5px; }
.analysis-phrase-group .analysis-role { grid-template-columns: 62px minmax(0, 1fr); }
.analysis-phrase-group .role-text { overflow-wrap: anywhere; }

.dictcontent .PROPFORMPREP, .dictcontent .COLLOC, .note-card .PROPFORMPREP, .note-card .COLLOC { color: var(--dictionary-phrase-color); font-size: 16px; font-weight: 500; line-height: 1.65; }
.dictionary-title-row { align-items: center; }
.dictionary-title-row .audio-button { flex: 0 0 auto; }

.dictionary-title-row .audio-button, .note-word-row > .audio-button { position: relative; top: 5px; }
.sense-related { order: 2; color: #61b985 !important; font-size: 14px !important; font-weight: 400; }
.sense-related * { color: inherit !important; font-size: inherit !important; }
:root[data-theme="light"] .sense-related { color: #287346 !important; }
.dictionary-enhanced .example-headword { color: var(--ink); font-weight: 700; }
.phrase-reference-note { display: block; margin-top: 8px; color: var(--muted); font-size: 13px; }

/* Omit standalone corpus supplements while keeping sense examples. */
.dictionary-extra:empty, .de-corpus-header:empty { display: none; }

.dictionary .de-example, .note-group .de-example { color: var(--body-ink); font-size: 15px; line-height: 1.85; }

.sentence-analysis, .sentence-analysis .role-text, .sentence-analysis .role-label, .sentence-analysis .analysis-phrase-title, .sentence-analysis .analysis-heading { font-family: "Lumen Shoujin Chinese", var(--reading-font-family); }
.sentence-analysis .role-text { font-size: calc(var(--reading-font-size) * .8); line-height: 1.7; }
.sentence-analysis .role-label, .sentence-analysis .analysis-phrase-title, .sentence-analysis .analysis-heading { font-size: calc(var(--reading-font-size) * .65); }
.sentence-note-label, .sentence-article-title { font-style: italic; font-synthesis: style; }

.sentence-note-label, .sentence-article-title, .sentence-analysis, .sentence-analysis * { font-family: "Lumen Shoujin Chinese", var(--reading-font-family); }
.sentence-article-title { color: var(--accent-dark); font-size: 16px; font-weight: 600; line-height: 1.65; margin-top: 12px; }

/* Reading hierarchy: definition 20–21px > phrase 18px > example 15px. */
:is(.dictcontent, .note-card) :is(.COLLO, .PROPFORM, .PROPFORMPREP, .LEXUNIT, .LEXVAR, .COLLOC) { font-size: 18px; }
:is(.dictionary, .note-group) .de-example,
:is(.dictionary, .note-group) .de-example :is(.COLLO, .PROPFORM, .PROPFORMPREP, .LEXUNIT, .LEXVAR, .COLLOC, .COLLOINEXA, .NodeW, .example-headword) { font-size: 15px; }

:is(.dictcontent, .note-card) :is(.GramBox, .GRAMBOX, .grammar, .GrammarBox) > :is(.heading, .HEADING, .title, .asset_intro),
:is(.dictcontent, .note-card) .grammar-heading { color: #d99750; display: block; margin-bottom: 10px; }
:root[data-theme="light"] :is(.dictcontent, .note-card) .grammar-heading { color: #b65f12; }
.grammar-pattern { display: block; margin-top: 10px; }

.sense-heading { align-items: baseline; flex-wrap: wrap; padding-right: 32px; }
.sense-heading .sense-select { position: absolute; right: 0; top: 24px; margin: -9px -11px 0 0; }
.sense-opening { order: 2; flex: 1; min-width: 0; color: var(--body-ink); font-size: var(--dictionary-font-size); line-height: 1.65; }
.sense-heading .sense-index { align-self: baseline; }
.sentence-note-label { font-size: 16px; }
.sentence-article-title { font-size: 9px; color: #79b8ff; }
:root[data-theme="light"] .sentence-article-title { color: #2369b5; }
.sentence-analysis .analysis-heading, .sentence-analysis .role-label, .sentence-analysis .analysis-phrase-title { font-family: "Lumen Shoujin Chinese", var(--reading-font-family); font-weight: 700; font-synthesis: weight style; }

.note-word-row > :is(.HWD,.HYPHENATION,.headword) { font-family: "Lumen Shoujin Chinese", var(--reading-font-family); font-size: var(--reading-font-size); font-weight: 700; font-synthesis: weight style; line-height: 1.55; }
.note-word-row > .POS { font-size: var(--saved-meaning-size); }
.saved-sense :is(.SenseNum,.sensenum) { display: none !important; }
.sentence-role-mark { border-radius: 4px; padding: 2px 3px; box-decoration-break: clone; -webkit-box-decoration-break: clone; background: #244b3c; }
.sentence-role-mark[data-role="predicate"] { background: #583030; }
.sentence-role-mark[data-role="object"], .sentence-role-mark[data-role="indirectObject"] { background: #263f60; }
.sentence-role-mark[data-role="adverbial"], .sentence-role-mark[data-role="agent"] { background: #544720; }
.sentence-role-mark[data-role="complement"] { background: #493253; }
:root[data-theme="light"] .sentence-role-mark { background: #dceee2; }
:root[data-theme="light"] .sentence-role-mark[data-role="predicate"] { background: #f8dddd; }
:root[data-theme="light"] .sentence-role-mark:is([data-role="object"],[data-role="indirectObject"]) { background: #dce8f8; }
:root[data-theme="light"] .sentence-role-mark:is([data-role="adverbial"],[data-role="agent"]) { background: #f5edcf; }
:root[data-theme="light"] .sentence-role-mark[data-role="complement"] { background: #ecdef3; }
.sentence-role-caption { margin-left: 4px; font-family: "Lumen Shoujin Chinese", var(--reading-font-family); font-size: .55em; font-weight: 700; font-synthesis: weight style; white-space: nowrap; color: var(--muted); }

.sentence-note-header + .sentence-vocabulary { margin-top: calc(var(--reading-font-size) * 1.55); }

.sentence-role-mark { position: relative; padding: 0; border-radius: 3px; }

/* Clause backgrounds and internal role underlines keep glyphs unobscured. */
.sentence-role-mark { padding: 0; box-shadow: none; color: inherit; }
.sentence-inner-role { text-decoration-line: underline; text-decoration-thickness: 1px; text-underline-offset: .23em; text-decoration-skip-ink: auto; text-decoration-color: #55a978; }
.sentence-inner-role[data-role="predicate"] { text-decoration-color: #db7777; }
.sentence-inner-role:is([data-role="object"],[data-role="indirectObject"]) { text-decoration-color: #6c9bd8; }
.sentence-inner-role:is([data-role="adverbial"],[data-role="agent"]) { text-decoration-color: #be9a44; }
.sentence-inner-role[data-role="complement"] { text-decoration-color: #af83c3; }
.note-sentence { line-height: 1.85; }

.sentence-article-title { text-align: right; }

.sentence-inner-role { text-decoration: none; }

.dictionary .sense-heading { background: var(--surface-soft); padding: 10px 38px 10px 10px; border-radius: 5px; }
.dictionary .sense-heading .sense-select { top: 28px; right: 8px; }
.article-content .word.saved-word { background: #494321; border-radius: 2px; box-decoration-break: clone; -webkit-box-decoration-break: clone; }
:root[data-theme="light"] .article-content .word.saved-word { background: #f7e8a4; }

#dictionaryTitle:has(.dictionary-word-tab) { display: flex; align-items: baseline; gap: 24px; flex-wrap: wrap; }
.dictionary-word-tab { padding: 0 0 5px; border: 0; border-bottom: 2px solid transparent; background: transparent; font: inherit; color: var(--muted); }
.dictionary-word-tab[aria-pressed="true"] { color: var(--ink); border-bottom-color: var(--accent); }

.note-head { background: var(--surface-soft); padding: 12px; border-radius: 5px; align-items: center; }

#dictionaryTitle:has(.dictionary-word-tab) { display: grid; grid-template-columns: auto auto; column-gap: 22px; }
.dictionary-word-tab { white-space: nowrap; font-size: .85em; }

.swipe-article-row { position: relative; overflow: hidden; }
.swipe-article-row .article-card { position: relative; z-index: 1; background: var(--paper); transform: translateX(0); transition: transform .18s ease; touch-action: pan-y; }
.swipe-article-row.delete-revealed .article-card { transform: translateX(-82px); }
.article-delete-button { position: absolute; inset: 0 0 0 auto; width: 82px; border: 0; background: #d92323; color: white; font-size: 16px; visibility: hidden; }
.delete-revealed .article-delete-button { visibility: visible; }

/* Sentence structure is presented below the unchanged original sentence. */
.sentence-analysis { background: #eaf3fc; border: 0; border-radius: 6px; padding: 14px; margin: 16px 0 28px; }
:root[data-theme="dark"] .sentence-analysis { background: #203346; }
.sentence-analysis .analysis-heading, .sentence-analysis .role-label, .sentence-analysis .role-text { font-family: "Lumen Shoujin Chinese", var(--reading-font-family); font-size: var(--saved-meaning-size); line-height: 1.75; color: var(--body-ink); }
.sentence-analysis .analysis-role { border: 0; padding: 5px 0; grid-template-columns: 4.5em minmax(0, 1fr); gap: 10px; }
.sentence-analysis .role-label { font-weight: 700; }
.sentence-analysis .analysis-phrase-group { margin-top: 8px; }

.sentence-analysis .role-label { font-family: inherit; font-weight: 400; font-synthesis: style; }
.note-edit-dialog { width: min(90vw, 600px); padding: 20px; border: 1px solid var(--rule); border-radius: 12px; background: var(--paper); color: var(--ink); }
.note-edit-dialog::backdrop { background: #0007; }
.note-edit-input { width: 100%; min-height: 180px; box-sizing: border-box; font: var(--saved-meaning-size)/1.7 var(--reading-font-family); color: var(--ink); background: var(--surface-soft); border: 1px solid var(--rule); padding: 12px; }
.note-edit-actions { display: flex; justify-content: flex-end; gap: 20px; margin-top: 15px; }
.note-edit-actions button { padding: 10px 18px; color: var(--ink); background: var(--surface-soft); border: 1px solid var(--rule); }

@font-face { font-family: "Lumen Chinese Hand"; src: url("./fonts/Lumen-Structure-Hand.ttf") format("truetype"); font-display: swap; unicode-range: U+2E80-9FFF,U+F900-FAFF,U+3000-303F,U+FF00-FFEF; }
.note-editable { touch-action: manipulation; }

.sentence-note-header { background: #fcecec; border-radius: 6px; padding: 14px; }
:root[data-theme="dark"] .sentence-note-header { background: #402b2e; }

/* Prevent iOS native text selection from competing with long-press lookup. */
.article-content, .article-content *, .dictionary, .dictionary * { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
.dictionary input, .dictionary textarea, .note-edit-input { -webkit-user-select: text; user-select: text; -webkit-touch-callout: default; }

@font-face { font-family: "Lumen Shoujin Title"; src: url("./fonts/Lumen-Shoujin-Title.ttf") format("truetype"); font-display: swap; }
.dictionary-brand-name { font-family: "Lumen Shoujin Chinese", "Lumen Shoujin Title", serif; font-weight: 400; font-synthesis: none; font-size: 18px; }

/* Keep top navigation crisp and fully inside the visible viewport. */
.article-focused .focus-controls { top: calc(18px + var(--safe-top)); }
.article-focused .workspace { padding-top: 78px; }
.focus-button { backdrop-filter: none; -webkit-backdrop-filter: none; background: var(--paper); }
.focus-button:hover { background: var(--surface-soft); }
.notes-focused .app-shell { padding-top: calc(16px + var(--safe-top)); }
.notes-focused .notes-back { color: var(--body-ink); margin-bottom: 16px; -webkit-tap-highlight-color: transparent; }

.dictionary-topline { align-items: center; }
.dictionary-brand { align-items: center; }
.dictionary-brand-name { display: flex; align-items: center; min-height: 29px; font-size: 21px; line-height: 1; transform: translateY(2px); }

.edit-lookup-button { order: 10; margin-left: auto; flex: 0 0 auto; padding: 8px 0 8px 12px; border: 0; background: transparent; color: var(--muted); font: 14px/1.5 "Lumen Shoujin Chinese", var(--reading-font-family); }
.edit-lookup-button:hover { color: var(--accent); }

.notes-scroll-controls { display: none; }
.notes-focused .notes-scroll-controls { position: fixed; right: max(14px, var(--safe-right)); bottom: calc(20px + var(--safe-bottom)); z-index: 26; display: flex; flex-direction: column; gap: 8px; }
.notes-scroll-controls button { width: 42px; height: 42px; display: grid; place-items: center; border: 1px solid var(--control-border); border-radius: 50%; background: var(--surface); color: var(--body-ink); font: 24px/1 "Lumen Shoujin Chinese", var(--ui-font); box-shadow: 0 2px 8px #0002; -webkit-tap-highlight-color: transparent; }
.notes-focused .notes-list { padding-bottom: 120px; }
@media print { .notes-scroll-controls { display: none !important; } }

.notes-collapse-button { display: none; }
.notes-focused .notes-collapse-button { display: grid; place-items: center; position: fixed; left: max(14px, var(--safe-left)); bottom: calc(20px + var(--safe-bottom)); z-index: 26; width: 42px; height: 42px; border: 1px solid var(--control-border); border-radius: 50%; background: var(--surface); color: var(--body-ink); font: 26px/1 "Lumen Shoujin Chinese", var(--ui-font); }
.sentence-note-header[role="button"], .sentence-analysis[role="button"], .note-head[role="button"] { cursor: pointer; touch-action: manipulation; }
.sentence-note > [hidden], .note-group > .note-card[hidden] { display: none !important; }
@media print { .notes-collapse-button { display: none !important; } }

.notes-expand-button { display: none; }
.notes-focused .notes-collapse-button { bottom: calc(70px + var(--safe-bottom)); }
.notes-focused .notes-expand-button { display: grid; place-items: center; position: fixed; left: max(14px, var(--safe-left)); bottom: calc(20px + var(--safe-bottom)); z-index: 26; width: 42px; height: 42px; border: 1px solid var(--control-border); border-radius: 50%; background: var(--surface); color: var(--body-ink); font: 26px/1 "Lumen Shoujin Chinese", var(--ui-font); }
@media print { .notes-expand-button { display: none !important; } }

/* Paired, quiet controls: hierarchy on the left, page position on the right. */
.notes-fold-controls { display: none; }
.notes-focused :is(.notes-fold-controls, .notes-scroll-controls) { position: fixed; bottom: calc(18px + var(--safe-bottom)); z-index: 26; display: flex; flex-direction: column; gap: 0; padding: 3px; border: 1px solid var(--control-border); border-radius: 25px; background: var(--paper); box-shadow: 0 3px 14px #00000012; }
.notes-focused .notes-fold-controls { left: max(14px, var(--safe-left)); }
.notes-focused .notes-scroll-controls { right: max(14px, var(--safe-right)); }
.notes-focused :is(.notes-fold-controls, .notes-scroll-controls) button { position: static; display: grid; place-items: center; width: 42px; height: 42px; padding: 0; margin: 0; border: 0; border-radius: 21px; background: transparent; color: var(--muted); box-shadow: none; touch-action: manipulation; -webkit-tap-highlight-color: transparent; transition: color .15s, background .15s; }
.notes-focused :is(.notes-fold-controls, .notes-scroll-controls) button + button::before { content: ""; position: absolute; width: 18px; height: 1px; background: var(--rule); transform: translateY(-21px); pointer-events: none; }
.notes-focused :is(.notes-fold-controls, .notes-scroll-controls) button svg { width: 22px; height: 22px; }
@media (hover: hover) { .notes-focused :is(.notes-fold-controls, .notes-scroll-controls) button:hover { color: var(--ink); background: var(--surface-soft); } }
.notes-focused :is(.notes-fold-controls, .notes-scroll-controls) button:active { color: var(--accent); background: var(--surface-soft); }
@media print { .notes-fold-controls { display: none !important; } }

.notes-focused .notes-scroll-controls button + button::before { right: 3px; left: auto; }

/* Reserve a complete top navigation row instead of floating over the story. */
.article-focused .focus-controls { top: var(--safe-top); left: var(--safe-left); right: var(--safe-right); min-height: 76px; box-sizing: border-box; padding: 14px 18px 18px; background: var(--paper); }
.article-focused .workspace { padding-top: 76px; }
.notes-focused .app-shell { padding-top: calc(76px + var(--safe-top)); }
.notes-focused .notes-back { position: fixed; top: var(--safe-top); left: var(--safe-left); right: var(--safe-right); z-index: 25; box-sizing: border-box; height: 76px; min-height: 76px; margin: 0; padding: 14px max(20px, var(--safe-left)) 18px; background: var(--paper); color: var(--ink); align-items: center; font-size: 14px; }

/* Meaning-specific Gemini translation practice. */
.sense-exercises { margin-top: 22px; padding-top: 16px; border-top: 1px solid var(--rule); font-family: "Lumen Shoujin Chinese", var(--reading-font-family); }
.exercise-section-heading { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.exercise-launch { display: inline-flex; align-items: center; padding: 9px 14px; min-height: 42px; border: 1px solid var(--rule-strong); border-radius: 6px; background: var(--surface-soft); color: var(--ink); font: 16px/1.5 "Lumen Shoujin Chinese", var(--reading-font-family); }
.dictionary-exercise-launch { margin: 18px 0 2px; }
.exercise-section-hint, .exercise-date, .exercise-topic { color: var(--muted); font-size: 12px; }
.saved-exercise { padding: 18px 0; border-bottom: 1px solid var(--rule); }
.exercise-prompt { display: block; margin: 8px 0; font: 15px/1.65 "Lumen Shoujin Chinese", var(--reading-font-family); color: var(--body-ink); }
.exercise-expression { display: block; margin: 5px 0 10px; color: var(--dictionary-phrase-color, #538ac7); font: 15px/1.6 "Lumen Shoujin Chinese", var(--reading-font-family); }
.exercise-answer { width: 100%; box-sizing: border-box; min-height: 95px; padding: 12px; border: 1px solid var(--rule); border-radius: 6px; color: var(--ink); background: var(--surface-soft); font: 17px/1.7 "Lumen Shoujin Chinese", var(--reading-font-family); resize: vertical; -webkit-user-select: text; user-select: text; }
.exercise-answer-actions { display: flex; align-items: center; gap: 12px; margin-top: 8px; }
.exercise-answer-status { color: var(--muted); font-size: 12px; }
.exercise-save-answer, .exercise-refresh { min-height: 40px; padding: 7px 12px; border: 1px solid var(--rule); border-radius: 5px; background: var(--surface-soft); color: var(--ink); font: 14px/1.5 "Lumen Shoujin Chinese", var(--reading-font-family); }
.exercise-dialog { box-sizing: border-box; width: min(100%, 760px); height: var(--app-height, 100vh); max-width: 100%; max-height: var(--app-height, 100vh); margin: auto; padding: max(18px, var(--safe-top)) 20px max(14px, var(--safe-bottom)); border: 0; background: var(--paper); color: var(--ink); font-family: "Lumen Shoujin Chinese", var(--reading-font-family); overflow: hidden; }
.exercise-dialog[open] { display: flex; flex-direction: column; }
.exercise-dialog::backdrop { background: #0009; }
.exercise-dialog-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-shrink: 0; }
.exercise-dialog-heading h2 { margin: 0; font: 600 20px/1.4 "Lumen Shoujin Chinese", var(--reading-font-family); }
.exercise-close { border: 0; padding: 0; width: 44px; height: 44px; color: var(--muted); background: transparent; font: 28px/1 "Lumen Shoujin Chinese", sans-serif; }
.exercise-meaning { font: 16px/1.6 "Lumen Shoujin Chinese", var(--reading-font-family); margin: 8px 0 14px; max-height: 4.8em; overflow: auto; }
.exercise-picker-tools { display: flex; align-items: center; justify-content: space-between; gap: 12px; font-size: 12px; color: var(--muted); flex-shrink: 0; }
.exercise-status { margin: 10px 0; font: 13px/1.6 "Lumen Shoujin Chinese", var(--reading-font-family); color: var(--muted); flex-shrink: 0; }
.exercise-candidates { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; margin: 0; padding: 0; list-style: none; counter-reset: practice; }
.exercise-candidate { counter-increment: practice; border-top: 1px solid var(--rule); padding: 10px 0; }
.exercise-candidate label { display: flex; align-items: flex-start; gap: 12px; cursor: pointer; }
.exercise-candidate input { width: 18px; height: 18px; margin-top: 9px; flex: 0 0 auto; accent-color: var(--accent); }
.exercise-candidate-content { min-width: 0; }
.exercise-candidate .exercise-prompt::before { content: counter(practice) ".  "; color: var(--muted); font-size: 13px; }
.exercise-picker-footer { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-top: 12px; border-top: 1px solid var(--rule); flex-shrink: 0; font-size: 14px; }
.exercise-save-selection { padding: 12px 18px; min-height: 44px; background: var(--accent-dark); color: #fff; border: 0; border-radius: 5px; font: 16px/1.4 "Lumen Shoujin Chinese", var(--reading-font-family); }
@media print { .exercise-launch, .exercise-answer-actions, .exercise-dialog { display: none !important; } }

.exercise-title-zh { font: 400 23px/1.4 "Lumen Shoujin Chinese", "Lumen Shoujin Title", serif; font-synthesis: none; }
.exercise-translation { display: block; margin: 6px 0 0; color: var(--muted); font: 14px/1.7 "Lumen Shoujin Chinese", var(--reading-font-family); }
.exercise-picker-tools { justify-content: flex-end; }
@font-face { font-family: "Lumen Chinese Hand Full"; src: url("./fonts/Lumen-Chinese-Hand.ttf") format("truetype"); font-display: swap; unicode-range: U+2E80-9FFF,U+F900-FAFF,U+3000-303F,U+FF00-FFEF; }

.exercise-day-group { margin-top: 20px; }
.exercise-day-group > .exercise-date { display: block; padding: 0 0 8px; border-bottom: 1px solid var(--rule); font: 14px/1.6 "Lumen Shoujin Chinese", var(--reading-font-family); color: var(--muted); }
.exercise-day-group .saved-exercise { padding: 12px 0 16px; }

.exercise-delete { margin-left: auto; min-height: 40px; padding: 7px 12px; border: 0; border-radius: 5px; color: var(--muted); background: transparent; font: 14px/1.5 "Lumen Shoujin Chinese", var(--reading-font-family); }
.exercise-delete:hover, .exercise-delete:active { color: var(--accent-dark); background: var(--surface-soft); }

.exercise-day-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 44px; padding: 6px 0; border-bottom: 1px solid var(--rule); cursor: pointer; list-style: none; touch-action: manipulation; }
.exercise-day-heading::-webkit-details-marker { display: none; }
.exercise-day-heading .exercise-date { font: 14px/1.6 "Lumen Shoujin Chinese", var(--reading-font-family); color: var(--muted); }
.exercise-day-heading::after { content: ""; width: 7px; height: 7px; margin-right: 6px; border-right: 1.5px solid var(--muted); border-bottom: 1.5px solid var(--muted); transform: rotate(45deg); }
.exercise-day-group[open] > .exercise-day-heading::after { transform: rotate(225deg); }

.exercise-picker-tools { justify-content: space-between; align-items: center; gap: 12px; margin: 4px 0 12px; }
.exercise-picker-tools .exercise-status { flex: 1; min-width: 0; margin: 0; }
.exercise-picker-tools .exercise-refresh { flex: 0 0 auto; }

/* A dedicated, visible-viewport writing surface prevents keyboard clipping. */
.exercise-answer[readonly] { cursor: text; }
.exercise-writing-dialog { position: fixed; inset: 0; width: min(100%,760px); height: var(--app-height,100vh); max-width: 100%; max-height: var(--app-height,100vh); margin: 0 auto; padding: 12px 18px; box-sizing: border-box; border: 0; background: var(--paper); color: var(--ink); overflow: hidden; font-family: "Lumen Shoujin Chinese", var(--reading-font-family); }
.exercise-writing-dialog[open] { display: flex; flex-direction: column; gap: 10px; }
.exercise-writing-dialog::backdrop { background: var(--paper); }
.exercise-writing-heading { display: flex; flex: 0 0 auto; align-items: center; justify-content: space-between; min-height: 40px; gap: 12px; }
.exercise-writing-heading h2 { margin: 0; font: 600 19px/1.4 "Lumen Shoujin Chinese", var(--reading-font-family); }
.exercise-writing-done { min-width: 58px; min-height: 40px; padding: 6px 12px; border: 0; border-radius: 6px; color: var(--accent-dark); background: var(--surface-soft); font: 16px/1.5 "Lumen Shoujin Chinese", var(--reading-font-family); }
.exercise-writing-prompt { flex: 0 1 auto; max-height: 130px; overflow-y: auto; margin: 0; color: var(--body-ink); font: 16px/1.65 "Lumen Shoujin Chinese", var(--reading-font-family); }
.exercise-writing-reference { flex: 0 0 auto; max-height: 110px; overflow-y: auto; color: var(--muted); font: 14px/1.5 "Lumen Shoujin Chinese", var(--reading-font-family); }
.exercise-writing-reference summary { cursor: pointer; min-height: 26px; }
.exercise-writing-input { display: block; flex: 1 1 0; min-height: 65px; min-width: 0; width: 100%; box-sizing: border-box; padding: 14px; margin: 0; border: 1px solid var(--rule); border-radius: 8px; background: var(--surface-soft); color: var(--ink); font: 18px/1.7 "Lumen Shoujin Chinese", var(--reading-font-family); resize: none; overflow-y: auto; -webkit-user-select: text; user-select: text; touch-action: pan-y; }
.exercise-writing-status { flex: 0 0 auto; min-height: 20px; margin: 0; color: var(--muted); font: 12px/1.6 "Lumen Shoujin Chinese", var(--reading-font-family); }
@media(max-height:500px){ .exercise-writing-dialog[open] { gap: 7px; padding: 8px 14px; } .exercise-writing-prompt { max-height: 72px; font-size: 15px; } .exercise-writing-reference { max-height: 60px; } }
@media print { .exercise-writing-dialog { display: none !important; } }

.exercise-day-heading .exercise-date { color: #b88c65; font-weight: 700; font-synthesis: weight style; }
:root[data-theme="light"] .exercise-day-heading .exercise-date { color: #885b36; }

.exercise-translation-trigger { cursor: pointer; touch-action: manipulation; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
.exercise-translation[hidden], .exercise-writing-reference[hidden] { display: none !important; }

/* Give the prompt, reference, and answer their own readable spacing. */
.exercise-day-group .saved-exercise { display: grid; grid-template-columns: minmax(0,1fr); row-gap: 16px; padding: 20px 0 24px; }
.saved-exercise > .exercise-prompt { margin: 0; line-height: 1.85; }
.exercise-translation { font-weight: 700; font-synthesis: weight style; line-height: 1.8; }
.saved-exercise > .exercise-translation { margin: 0; }
.saved-exercise > .exercise-answer { display: block; margin: 2px 0 0; min-height: 116px; padding: 14px 16px; line-height: 1.8; }
.saved-exercise > .exercise-answer-actions { margin-top: 0; }
.exercise-candidate .exercise-translation { margin-top: 10px; }
.exercise-writing-reference .exercise-translation { margin: 0; }
.exercise-writing-dialog[open] { gap: 12px; }
@media(max-height:500px){ .exercise-writing-dialog[open] { gap: 7px; } }

.exercise-prompt-row { display: flex; align-items: flex-start; gap: 8px; }
.exercise-prompt-row > .exercise-prompt { flex: 1; min-width: 0; margin: 0; line-height: 1.85; }
.exercise-prompt-row > .exercise-delete { position: relative; flex: 0 0 28px; width: 28px; min-height: 28px; height: 28px; margin: 0; padding: 0; border: 0; background: transparent; color: var(--muted); font: 22px/28px "Lumen Shoujin Chinese", -apple-system, sans-serif; }
.exercise-prompt-row > .exercise-delete::before { content: ""; position: absolute; inset: -8px -6px; }
.exercise-prompt-row > .exercise-delete:hover { color: var(--accent-dark); }

.exercise-prompt { font-size: 16px; }
.exercise-translation { font-size: 15px; }
.exercise-writing-prompt { font-size: 17px; }
@media(max-height:500px){ .exercise-writing-prompt { font-size: 16px; } }

.saved-exercise > .exercise-answer { display: flex; align-items: center; justify-content: center; text-align: center; white-space: pre-wrap; overflow-wrap: anywhere; min-height: 116px; height: auto; font-size: 16px; font-weight: 400; cursor: text; }
.exercise-answer.is-empty { color: var(--muted); }
.exercise-writing-input { font-size: 17px; }

.saved-exercise > .exercise-answer.is-empty { min-height: 58px; padding-top: 10px; padding-bottom: 10px; }

.saved-exercise > .exercise-answer { overflow: visible; max-height: none; resize: none; }
.exercise-writing-body { position: relative; display: flex; flex-direction: column; gap: 14px; flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding-bottom: 8px; }
.exercise-writing-body .exercise-writing-prompt, .exercise-writing-body .exercise-writing-reference { flex: 0 0 auto; max-height: none; overflow: visible; }
.exercise-writing-body .exercise-writing-input { flex: 0 0 auto; min-height: 140px; height: auto; max-height: none; overflow: hidden; resize: none; }

.brand-name { font-family: "Lumen Shoujin Chinese", "Lumen Shoujin Title", serif; font-weight: 400; font-synthesis: none; letter-spacing: 3px; white-space: nowrap; }
.exercise-day-group .saved-exercise { row-gap: 12px; }
.saved-exercise > .exercise-translation { padding-left: 36px; box-sizing: border-box; }
.saved-exercise > .exercise-answer:not(.is-empty) { min-height: 0; padding: 8px 12px; }
.saved-exercise > .exercise-answer { margin-top: -6px; }

/* Draw the complete focus ring inside the field, where scroll containers cannot clip it. */
.exercise-writing-input:focus, .saved-exercise > .exercise-answer:focus { outline: none; outline-offset: 0; border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }

.saved-exercise > .exercise-answer:not(.is-empty) { width: fit-content; max-width: 100%; justify-self: center; min-height: 0; padding: 4px 8px; line-height: 1.55; }

.saved-exercise > .exercise-translation:not([hidden]) + .exercise-answer { margin-top: 2px; }

/* Center each exercise; reveal its delete action only with a horizontal swipe. */
.exercise-swipe-row { position: relative; overflow: hidden; }
.exercise-swipe-row > .saved-exercise { position: relative; z-index: 1; background: var(--paper); transition: transform .18s ease; touch-action: pan-y; text-align: center; }
.exercise-swipe-row.delete-revealed > .saved-exercise { transform: translateX(-82px); }
.exercise-swipe-row > .exercise-delete { position: absolute; inset: 0 0 0 auto; transform: none; width: 82px; height: 100%; min-height: 48px; margin: 0; padding: 0; border: 0; border-radius: 0; color: white; background: #d92323; font: 16px/1.5 "Lumen Shoujin Chinese", -apple-system, BlinkMacSystemFont, sans-serif; display: flex; align-items: center; justify-content: center; visibility: hidden; }
.exercise-swipe-row.delete-revealed > .exercise-delete { visibility: visible; }
.exercise-swipe-row .exercise-prompt-row { display: block; text-align: center; }
.exercise-swipe-row .exercise-translation { padding-left: 0; text-align: center; }
.exercise-swipe-row .exercise-answer { justify-self: center; text-align: center; }
@media(prefers-reduced-motion:reduce){ .exercise-swipe-row > .saved-exercise { transition: none; } }
.exercise-swipe-row.delete-revealed > .exercise-delete { z-index: 2; }

.sense-exercises .exercise-launch { touch-action: manipulation; -webkit-touch-callout: none; -webkit-user-select: none; user-select: none; }
.exercise-day-group[hidden] { display: none !important; }

.exercise-swipe-row > .exercise-delete:hover, .exercise-swipe-row > .exercise-delete:active { color: white; background: #d92323; }

.notes-back { font-family: "Lumen Shoujin Chinese", "Lumen Shoujin Title", serif; font-weight: 400; font-style: normal; font-synthesis: none; }

/* Compact the original sentence, structure analysis, and saved entry headers by two sizes. */
.note-sentence, .note-word-row > :is(.HWD,.HYPHENATION,.headword) { font-size: calc(var(--reading-font-size) - 2px); }
.sentence-analysis .analysis-heading, .sentence-analysis .role-label, .sentence-analysis .role-text, .note-word-row > .POS { font-size: calc(var(--saved-meaning-size) - 2px); }

.note-card .DEF { font-size: calc(var(--saved-meaning-size) - 2px); }

.exercise-section-heading + .exercise-day-group { margin-top: 8px; }
.exercise-section-heading + .exercise-day-group > .exercise-swipe-row:first-child > .saved-exercise { padding-top: 8px; }

.sentence-vocabulary { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); column-gap: 12px; align-items: start; }
.sentence-vocabulary > .note-group { min-width: 0; }
.sentence-vocabulary > .note-group[data-expanded="true"] { grid-column: 1 / -1; }
.note-sense-title { display: flex; align-items: center; gap: 8px; min-width: 0; }
.note-word-row { flex-wrap: wrap; }

.swipe-article-row.delete-revealed .article-card { transform: translateX(-164px); }
.article-edit-button { position: absolute; inset: 0 82px 0 auto; width: 82px; border: 0; border-radius: 0; background: #777; color: white; font-size: 16px; visibility: hidden; }
.delete-revealed .article-edit-button { visibility: visible; }
.article-edit-dialog { max-height: calc(var(--app-height,100dvh) - 32px); box-sizing: border-box; overflow-y: auto; }
.article-edit-dialog label { display: block; margin: 14px 0; }
.article-edit-title,.article-edit-body { display: block; box-sizing: border-box; width: 100%; margin-top: 6px; border: 1px solid var(--rule); border-radius: 6px; padding: 10px; font: 16px/1.65 "Lumen Shoujin Chinese", var(--reading-font-family); color: var(--ink); background: var(--surface-soft); }
.article-edit-body { min-height: 260px; height: 45dvh; resize: vertical; user-select: text; -webkit-user-select: text; }
.article-edit-actions { display: flex; justify-content: flex-end; gap: 16px; }
.article-edit-actions button { min-height: 44px; padding: 8px 18px; }

@font-face { font-family: "Lumen Shoujin Full"; src: url("./fonts/Lumen-Shoujin-Full.ttf") format("truetype"); font-display: swap; }
.font-sample-shoujin { font-family: "Lumen Shoujin Chinese", "Lumen Shoujin Full", serif; font-weight: 400; }

@font-face { font-family: "Lumen Shoujin Chinese"; src: url("./fonts/Lumen-Shoujin-Full.ttf") format("truetype"); font-display: swap; unicode-range: U+2E80-9FFF, U+F900-FAFF, U+20000-3134F; }

/* Practice prompts and reference translations. */
.exercise-prompt { font-size: 18px; }
.exercise-writing-prompt { font-size: 19px; }
.exercise-translation { font-size: 16px; font-weight: 400; }
@media(max-height:500px){ .exercise-writing-prompt { font-size: 18px; } }

.exercise-prompt, .exercise-writing-prompt { font-weight: 400; font-synthesis: style; }
.exercise-candidate .exercise-prompt { margin: 0; line-height: 1.8; }
.exercise-candidate input[type="checkbox"] { margin: 7.2px 0 0; }
.exercise-candidate .exercise-prompt::before { font-weight: 400; }

/* Practice follows the selected font, including Chinese, instead of the global Chinese override. */
:is(.sense-exercises,.exercise-dialog,.exercise-writing-dialog),
:is(.sense-exercises,.exercise-dialog,.exercise-writing-dialog) * { font-family: var(--selected-reading-font-family, Georgia, serif) !important; }

/* The bundled Chinese handwriting has heavy native strokes even at weight 400. */
:is(.sense-exercises,.exercise-dialog,.exercise-writing-dialog) :is(.exercise-prompt,.exercise-writing-prompt) { font-weight: 400 !important; font-synthesis: none; -webkit-text-stroke: .22px var(--paper); }
.exercise-candidate .exercise-prompt::before { -webkit-text-stroke: 0; }
.exercise-candidate input[type="checkbox"] { margin-top: 10px; }
@media(forced-colors:active){ :is(.exercise-prompt,.exercise-writing-prompt) { -webkit-text-stroke: 0 !important; } }

.note-word-row > :is(.HWD,.HYPHENATION,.headword) { font-size: calc(var(--reading-font-size) - 4px); }
.note-word-row > .POS { font-size: calc(var(--saved-meaning-size) - 4px); }
