:root{font-family:Inter,ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif;color:#111827;background:#f4f5f7;--surface:#fff;--surface2:#f8fafc;--text:#111827;--muted:#687386;--line:#e5e7eb;--accent:#111827;--accentText:#fff;--shadow:0 16px 45px rgba(15,23,42,.08);--readerScale:1;--readerLineHeight:1.9}
*{box-sizing:border-box}body{margin:0;min-height:100vh;background:radial-gradient(circle at top,#fff 0,#f4f5f7 42%,#edf0f4 100%);color:var(--text)}button,input,textarea,select{font:inherit}.hidden{display:none!important}.app-shell{max-width:1120px;margin:auto;min-height:100vh}.topbar{position:sticky;top:0;z-index:20;display:flex;align-items:center;justify-content:space-between;gap:12px;padding:16px 22px;background:rgba(244,245,247,.84);backdrop-filter:blur(20px);border-bottom:1px solid rgba(229,231,235,.7)}.brand-block{display:flex;align-items:center;gap:10px;min-width:0}.brand-block>div:last-child{display:flex;flex-direction:column;min-width:0}.brand-block strong{font-size:15px}.brand-block span{font-size:11px;color:var(--muted);margin-top:1px}.brand-mark{width:34px;height:34px;border-radius:11px;display:grid;place-items:center;background:#111827;color:#fff;font-weight:900;box-shadow:0 6px 18px rgba(17,24,39,.18)}.icon-button{width:38px;height:38px;border:1px solid var(--line);background:var(--surface);border-radius:12px;cursor:pointer;color:var(--text);font-size:18px}.screen{display:none;padding:24px 22px 90px}.screen.active{display:block}.hero-card{padding:34px;border-radius:28px;background:#111827;color:#fff;box-shadow:var(--shadow);overflow:hidden;position:relative}.hero-card:after{content:"H";position:absolute;right:-16px;bottom:-72px;font-size:240px;font-weight:900;opacity:.04}.eyebrow{font-size:11px;letter-spacing:.14em;font-weight:800;color:#4b5563;margin:0 0 8px}.hero-card .eyebrow{color:#aeb7c7}.hero-card h1{font-size:clamp(30px,5vw,52px);line-height:1.02;margin:0 0 16px;max-width:720px;letter-spacing:-.04em}.hero-card p:not(.eyebrow){font-size:16px;line-height:1.65;max-width:640px;color:#cbd5e1}.hero-actions{display:flex;gap:10px;flex-wrap:wrap;margin-top:24px}.primary-button,.secondary-button,.small-button{border:0;border-radius:13px;padding:12px 16px;font-weight:750;cursor:pointer}.primary-button{background:#fff;color:#111827}.secondary-button{background:#eef1f5;color:#111827}.hero-card .secondary-button{background:#263244;color:#fff}.file-label input{display:none}.section-heading{display:flex;justify-content:space-between;align-items:end;margin:32px 2px 14px}.section-heading h2,.settings-card h2{margin:0;font-size:24px;letter-spacing:-.03em}.pill{padding:7px 10px;border-radius:999px;background:#e8ebef;color:#5f6979;font-size:12px;font-weight:750}.library-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(240px,1fr));gap:14px}.article-card-wrap{position:relative;min-height:210px}.article-card{appearance:none;width:100%;height:100%;text-align:left;border:1px solid var(--line);background:var(--surface);border-radius:20px;padding:20px 52px 20px 20px;min-height:210px;cursor:pointer;box-shadow:0 5px 18px rgba(15,23,42,.035);transition:.18s transform,.18s box-shadow}.article-card:hover{transform:translateY(-2px);box-shadow:var(--shadow)}.card-delete-button{position:absolute;top:12px;right:12px;width:32px;height:32px;border:1px solid var(--line);border-radius:10px;background:rgba(255,255,255,.92);color:#8b95a5;font-size:20px;line-height:1;cursor:pointer;z-index:2}.card-delete-button:hover,.card-delete-button:focus{background:#fff0f1;color:#a51d25;outline:none;border-color:#ffd8dc}.article-card h3{margin:8px 0 10px;font-size:19px;line-height:1.25}.article-card p{font-size:13px;line-height:1.55;color:var(--muted)}.article-card footer{display:flex;justify-content:space-between;align-items:center;margin-top:18px;font-size:11px;color:#8a94a6}.mini-progress{height:4px;background:#edf0f3;border-radius:99px;overflow:hidden;margin-top:12px}.mini-progress span{display:block;height:100%;background:#111827}.empty-state{text-align:center;padding:50px 20px;color:var(--muted)}.empty-icon{font-size:42px;color:#aab2bf}.reader-toolbar{display:flex;gap:16px;align-items:flex-start;justify-content:space-between;margin:4px auto 14px;max-width:820px}.reader-toolbar h1{font-size:clamp(28px,5vw,42px);margin:0;line-height:1.08;letter-spacing:-.04em}.reader-actions{display:flex;gap:8px;flex-wrap:wrap;justify-content:flex-end}.small-button{padding:9px 12px;background:#e9edf2;color:#111827;font-size:12px}.small-button.danger{color:#a51d25;background:#fff0f1}.runtime-notice{max-width:820px;margin:0 auto 16px;padding:10px 13px;border:1px solid var(--line);border-radius:13px;background:var(--surface);font-size:12px;color:var(--muted);display:flex;align-items:center;gap:9px}.pulse{width:8px;height:8px;border-radius:50%;background:#f59e0b;box-shadow:0 0 0 4px rgba(245,158,11,.12)}.runtime-notice.ready .pulse{background:#16a34a;box-shadow:0 0 0 4px rgba(22,163,74,.12)}.runtime-notice.degraded .pulse{background:#64748b}.reader-body{max-width:820px;margin:0 auto;background:var(--surface);border:1px solid var(--line);border-radius:24px;padding:clamp(24px,5vw,56px);box-shadow:var(--shadow);font-family:Georgia,"Noto Serif TC",serif;font-size:calc(20px * var(--readerScale));line-height:var(--readerLineHeight,1.9);white-space:pre-wrap;overflow-wrap:anywhere;min-height:58vh}.halo-token{position:relative;display:inline;border-radius:5px;padding:0 1px;cursor:pointer;text-decoration-thickness:2px;text-underline-offset:4px;transition:.12s background}.halo-token:hover,.halo-token:focus,.halo-lookup-token:hover,.halo-lookup-token:focus{background:#f1f5f9;outline:none}.halo-lookup-token{border-radius:5px;padding:0 1px;cursor:pointer;text-decoration:underline dotted #c4cbd5;text-decoration-thickness:1px;text-underline-offset:4px}.halo-token[data-pos="n"]{text-decoration:underline #3b82f6}.halo-token[data-pos="v"]{text-decoration:underline #ef4444}.halo-token[data-pos="adj"]{text-decoration:underline #8b5cf6}.halo-token[data-pos="adv"]{text-decoration:underline #f59e0b}.halo-token[data-pos="prep"],.halo-token[data-pos="conj"]{text-decoration:underline #14b8a6}.halo-token[data-pos="pron"],.halo-token[data-pos="det"]{text-decoration:underline #ec4899}.halo-token[data-pos="aux"],.halo-token[data-pos="modal"]{text-decoration:underline #64748b}.halo-pos-label{font-family:Inter,ui-sans-serif,system-ui;font-size:.48em;line-height:1;vertical-align:super;margin-left:1px;color:#6b7280;font-weight:800;letter-spacing:.02em}.progress-track{position:fixed;left:0;right:0;bottom:0;height:4px;background:rgba(229,231,235,.8);z-index:50}.progress-bar{height:100%;width:0;background:#111827;transition:width .2s}.settings-screen{max-width:760px;margin:auto}.settings-card{background:var(--surface);border:1px solid var(--line);border-radius:22px;padding:24px;margin-bottom:14px;box-shadow:0 6px 20px rgba(15,23,42,.035)}.settings-card>label{display:grid;gap:8px;font-weight:700;font-size:13px;margin:18px 0}.settings-card input[type=range]{width:100%}.settings-card select,.modal input,.modal textarea{width:100%;padding:12px 13px;border:1px solid var(--line);border-radius:12px;background:var(--surface2);color:var(--text);outline:none}.toggle-grid{display:grid;grid-template-columns:1fr 1fr;gap:8px}.toggle-row{display:flex!important;align-items:center;justify-content:space-between;padding:11px 12px;margin:0!important;background:var(--surface2);border-radius:12px}.muted{color:var(--muted);line-height:1.6}.modal{width:min(680px,calc(100vw - 24px));border:0;border-radius:24px;padding:0;background:var(--surface);color:var(--text);box-shadow:0 30px 90px rgba(15,23,42,.25)}.modal::backdrop{background:rgba(15,23,42,.5);backdrop-filter:blur(5px)}.modal form{padding:24px}.modal-header,.modal-actions{display:flex;align-items:center;justify-content:space-between;gap:12px}.modal h2{margin:0}.modal label{display:grid;gap:8px;margin:18px 0;font-size:13px;font-weight:750}.modal textarea{resize:vertical;line-height:1.6}.word-sheet{position:fixed;inset:0;z-index:80;pointer-events:none;opacity:0;transition:opacity .18s}.word-sheet.open{pointer-events:auto;opacity:1}.sheet-scrim{position:absolute;inset:0;border:0;background:rgba(15,23,42,.38)}.sheet-card{position:absolute;left:50%;bottom:0;transform:translate(-50%,100%);width:min(760px,100%);max-height:70vh;overflow:auto;background:var(--surface);border-radius:24px 24px 0 0;padding:14px 22px calc(24px + env(safe-area-inset-bottom));transition:transform .22s ease}.word-sheet.open .sheet-card{transform:translate(-50%,0)}.sheet-grabber{width:44px;height:5px;background:#d6dbe2;border-radius:99px;margin:0 auto 16px}.word-heading{display:flex;align-items:flex-start;justify-content:space-between}.word-heading h2{font-size:32px;margin:4px 0 0}.pos-chip{font-size:11px;font-weight:800;background:#eef2f7;border-radius:999px;padding:5px 8px}.word-details{display:grid;grid-template-columns:100px 1fr;gap:12px 14px;margin:20px 0 0}.word-details dt{font-size:11px;font-weight:800;color:#8b95a5;text-transform:uppercase}.word-details dd{margin:0;line-height:1.5}.toast{position:fixed;left:50%;bottom:24px;z-index:100;transform:translate(-50%,18px);background:#111827;color:#fff;padding:11px 15px;border-radius:12px;font-size:12px;opacity:0;pointer-events:none;transition:.2s}.toast.show{opacity:1;transform:translate(-50%,0)}
@media(max-width:640px){.topbar{padding:12px 14px}.screen{padding:16px 14px 78px}.hero-card{padding:25px 20px;border-radius:22px}.hero-card h1{font-size:34px}.hero-actions>*{flex:1;text-align:center}.library-grid{grid-template-columns:1fr}.reader-toolbar{display:block}.reader-actions{justify-content:flex-start;margin-top:14px}.reader-body{border-radius:18px;padding:25px 18px;font-size:calc(19px * var(--readerScale))}.toggle-grid{grid-template-columns:1fr}.settings-card{padding:20px}.word-details{grid-template-columns:78px 1fr}}
@media(prefers-color-scheme:dark){:root[data-theme="system"]{--surface:#151922;--surface2:#1b202b;--text:#eef2f7;--muted:#9aa5b5;--line:#2a3240;--accent:#f8fafc;--accentText:#111827;background:#0f1218;color-scheme:dark}body{background:radial-gradient(circle at top,#171b24 0,#10141b 45%,#0c0f14 100%)}}
:root[data-theme="dark"]{--surface:#151922;--surface2:#1b202b;--text:#eef2f7;--muted:#9aa5b5;--line:#2a3240;--accent:#f8fafc;--accentText:#111827;background:#0f1218;color-scheme:dark}html[data-theme="dark"] body{background:#0f1218}:root[data-theme="dark"] .halo-token:hover{background:#252c39}:root[data-theme="light"]{color-scheme:light}

/* v0.6.1 — offline dictionary foundation */
.dictionary-card{margin:18px 0 0;padding:20px 22px;border:1px solid var(--line);border-radius:20px;background:var(--surface);box-shadow:0 5px 18px rgba(15,23,42,.035)}
.dictionary-row,.dictionary-footer{display:flex;align-items:center;justify-content:space-between;gap:14px}.dictionary-row h2{margin:2px 0 0;font-size:20px;letter-spacing:-.03em}.dictionary-status{margin:12px 0 10px;font-size:13px;color:var(--muted)}
.dictionary-progress{height:6px;overflow:hidden;border-radius:99px;background:#edf0f3}.dictionary-progress span{display:block;height:100%;width:0;background:#111827;transition:width .18s ease}.dictionary-footer{margin-top:10px;font-size:11px;color:#8a94a6}.dictionary-card[data-state="ready"] .dictionary-progress span{background:#16a34a}.dictionary-card[data-state="error"] .dictionary-progress span{background:#dc2626}.dictionary-card[data-state="error"]{border-color:#fecaca}.dictionary-card[data-state="installing"] .pill{background:#fff7ed;color:#9a3412}
@media(max-width:640px){.dictionary-footer{align-items:flex-start;flex-direction:column}.dictionary-footer .small-button{align-self:flex-start}}

/* v0.7 convergence — learner memory, bilingual lookup, data portability */
.learning-card{margin:14px 0 0;padding:18px 20px;border:1px solid var(--line);border-radius:20px;background:linear-gradient(135deg,var(--surface),var(--surface2));display:flex;align-items:center;justify-content:space-between;gap:16px}.learning-card h2{margin:2px 0 4px;font-size:20px}.learning-card p{margin:0;color:var(--muted);font-size:13px}.library-controls{display:grid;grid-template-columns:1fr auto;gap:10px;margin:0 0 14px}.library-controls input,.library-controls select,.inline-field input{width:100%;padding:11px 12px;border:1px solid var(--line);border-radius:12px;background:var(--surface);color:var(--text);outline:none}.learning-screen{max-width:900px;margin:auto}.learning-hero{margin:4px 0 18px}.learning-hero h1{font-size:clamp(30px,5vw,46px);margin:2px 0 8px;letter-spacing:-.04em}.learning-hero p{margin:0;color:var(--muted)}.learning-stats{display:grid;grid-template-columns:repeat(4,1fr);gap:10px;margin:16px 0}.learning-stats>div{border:1px solid var(--line);background:var(--surface);border-radius:16px;padding:15px}.learning-stats strong{display:block;font-size:25px}.learning-stats span{font-size:11px;color:var(--muted);font-weight:750}.learning-list{display:grid;gap:9px}.learning-row{display:grid;grid-template-columns:minmax(130px,1fr) minmax(180px,2fr) minmax(130px,1fr);gap:12px;align-items:center;padding:14px 15px;border:1px solid var(--line);background:var(--surface);border-radius:15px}.learning-term strong{display:block;font-size:17px}.learning-term span{display:block;font-size:11px;color:var(--muted);margin-top:3px}.learning-hint{font-size:13px;line-height:1.45;color:var(--text)}.learning-meta{font-size:11px;color:var(--muted)}.learning-row-actions{grid-column:1/-1;display:flex;gap:6px;flex-wrap:wrap}.learning-row-actions button,.mastery-buttons button{border:1px solid var(--line);background:var(--surface2);color:var(--muted);border-radius:999px;padding:6px 9px;font-size:11px;font-weight:750;cursor:pointer}.learning-row-actions button.active,.mastery-buttons button.active{background:#111827;color:#fff;border-color:#111827}.learning-row-actions .remove-learning{margin-left:auto;color:#a51d25;background:#fff0f1}.mastery-box{margin-top:22px;padding-top:16px;border-top:1px solid var(--line)}.mastery-row{display:flex;align-items:center;justify-content:space-between;gap:12px;margin-top:8px}.mastery-row>strong{font-size:16px}.mastery-buttons{display:flex;gap:6px;flex-wrap:wrap;justify-content:flex-end}.source-note{font-size:11px;color:var(--muted);line-height:1.55;margin:16px 0 0}.settings-actions{display:flex;gap:8px;flex-wrap:wrap;margin-top:14px}.inline-field{display:grid;grid-template-columns:1fr auto;gap:8px}.modal small{color:var(--muted);font-weight:500;line-height:1.5}.learner-mastered{text-decoration-color:#d6dbe2!important}.learner-familiar{opacity:.88}.halo-lookup-token.learner-mastered{text-decoration-color:#e5e7eb}.article-card footer{gap:8px}.settings-actions .file-label{display:inline-flex;align-items:center}.settings-actions .file-label input{display:none}
@media(max-width:720px){.learning-stats{grid-template-columns:1fr 1fr}.learning-row{grid-template-columns:1fr}.learning-row-actions{grid-column:auto}.mastery-row{display:block}.mastery-buttons{justify-content:flex-start;margin-top:10px}.library-controls{grid-template-columns:1fr}.inline-field{grid-template-columns:1fr}.learning-card{align-items:flex-start;flex-direction:column}}

/* v0.7 Dev02 — daily reader, onboarding, accessibility */
.skip-link{position:fixed;left:12px;top:8px;z-index:200;transform:translateY(-150%);background:#111827;color:#fff;padding:10px 14px;border-radius:10px;text-decoration:none;font-weight:800}.skip-link:focus{transform:translateY(0)}
:where(button,[role="button"],a,input,select,textarea):focus-visible{outline:3px solid #2563eb;outline-offset:3px}.icon-button,.small-button,.primary-button,.secondary-button{min-height:44px}.icon-button{min-width:44px;width:44px;height:44px}.card-delete-button{width:44px;height:44px;top:8px;right:8px}.article-card{padding-right:62px}.continue-card{margin:14px 0 0;padding:18px 20px;border:1px solid var(--line);border-radius:20px;background:var(--surface);display:flex;align-items:center;justify-content:space-between;gap:18px;box-shadow:0 5px 18px rgba(15,23,42,.035)}.continue-card>div{min-width:0;flex:1}.continue-card h2{margin:2px 0 4px;font-size:20px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.continue-card p{margin:0;color:var(--muted);font-size:12px}.continue-card .mini-progress{max-width:360px;margin-top:9px}.reader-progress-text{display:inline-flex;align-items:center;justify-content:center;min-height:44px;padding:0 8px;color:var(--muted);font-size:12px;font-weight:800}.storage-status{padding:11px 12px;border-radius:12px;background:var(--surface2);color:var(--muted);font-size:12px;line-height:1.5}.onboarding-modal{width:min(760px,calc(100vw - 24px))}.onboarding-content{padding:28px}.onboarding-content h2{font-size:clamp(28px,5vw,42px);letter-spacing:-.04em;margin:2px 0 10px}.onboarding-steps{display:grid;grid-template-columns:repeat(3,1fr);gap:10px;margin:22px 0}.onboarding-steps>div{display:flex;gap:11px;padding:15px;border:1px solid var(--line);border-radius:16px;background:var(--surface2);line-height:1.5}.onboarding-steps strong{display:grid;place-items:center;width:28px;height:28px;min-width:28px;border-radius:999px;background:#111827;color:#fff;font-size:12px}.onboarding-steps span{font-size:12px;color:var(--muted)}.onboarding-steps b{display:block;color:var(--text);font-size:13px;margin-bottom:4px}.word-sheet[aria-hidden="true"]{visibility:hidden}.word-sheet[aria-hidden="false"]{visibility:visible}.halo-token[role="button"],.halo-lookup-token[role="button"]{min-height:24px}.reader-body{scroll-margin-top:80px}.progress-track{height:5px}.settings-actions .small-button,.settings-actions .file-label{min-height:44px}.modal-actions button{min-height:44px}
@media(max-width:720px){.continue-card{align-items:flex-start;flex-direction:column}.continue-card .small-button{width:100%}.onboarding-steps{grid-template-columns:1fr}.reader-progress-text{order:-1}.reader-actions{justify-content:flex-start}.reader-actions .small-button{min-width:44px}.topbar{padding-left:max(14px,env(safe-area-inset-left));padding-right:max(14px,env(safe-area-inset-right))}}
@media(prefers-reduced-motion:reduce){*,*::before,*::after{scroll-behavior:auto!important;animation-duration:.01ms!important;animation-iteration-count:1!important;transition-duration:.01ms!important}}
@media(forced-colors:active){.halo-token,.halo-lookup-token{text-decoration:underline}.pulse{border:1px solid CanvasText}.article-card,.settings-card,.dictionary-card,.learning-card,.continue-card{border:1px solid CanvasText}}


/* v0.7 Dev04: event-sourced learner/gap/story surface */
.gap-plan-card{margin:18px 0;padding:18px;border:1px solid var(--line,#d8dee8);border-radius:18px;background:var(--card,#fff)}
.gap-plan-heading{display:flex;align-items:flex-start;justify-content:space-between;gap:16px}
.gap-plan-heading h2{margin:4px 0 6px}
.gap-list{display:grid;gap:8px;margin-top:14px}
.gap-row{display:flex;align-items:center;justify-content:space-between;gap:12px;padding:10px 12px;border-radius:12px;background:rgba(127,127,127,.07)}
.gap-row strong{font-size:.98rem}.gap-row span{font-size:.82rem;opacity:.72;text-align:right}
@media(max-width:640px){.gap-plan-heading{display:block}.gap-plan-heading button{margin-top:12px;width:100%}.gap-row{align-items:flex-start;flex-direction:column}.gap-row span{text-align:left}}

/* v0.7 Dev05-09: adaptive probe, story review, optional AI */
.story-session-panel{max-width:820px;margin:0 auto 16px;padding:18px;border:1px solid var(--line);border-radius:18px;background:var(--surface)}
.story-session-head h2{margin:4px 0 6px}.story-target-chips{display:flex;gap:7px;flex-wrap:wrap;margin:12px 0}.story-target-chips span{padding:6px 9px;border-radius:999px;background:var(--surface2);font-size:12px;font-weight:700}.story-review,.story-choice,.story-probe{display:grid;gap:9px;margin-top:14px}.story-probe .muted{margin:0;font-size:12px}.review-queue-card{margin:0 0 14px;padding:16px 18px;border:1px solid var(--line);border-radius:18px;background:var(--surface)}.review-queue-heading{display:flex;align-items:center;justify-content:space-between;gap:12px}.review-queue-heading h2{margin:4px 0 6px;font-size:18px}.story-review-buttons,.story-choice-buttons{display:flex;gap:8px;flex-wrap:wrap}.story-review-buttons button,.story-choice-buttons button{min-height:44px;padding:9px 12px;border:1px solid var(--line);background:var(--surface2);border-radius:12px;cursor:pointer}.word-explanation{display:flex;align-items:flex-start;gap:12px;flex-wrap:wrap;margin-top:16px}.word-explanation p{flex:1;min-width:220px;margin:8px 0}.probe-active{border-color:#7c3aed!important;background:#f5f3ff!important;color:#5b21b6!important}@media(max-width:640px){.story-review-buttons button,.story-choice-buttons button{flex:1}.word-explanation{display:block}}

/* v0.7 Review Build — reader/product polish */
.reader-title-block{min-width:0;flex:1}.reader-progress-text{display:inline-flex;align-items:center;justify-content:center;min-width:48px;height:34px;padding:0 10px;border:1px solid var(--line);border-radius:999px;background:var(--surface);font-size:12px;font-weight:800;color:var(--muted)}.reader-action-divider{width:1px;height:28px;background:var(--line);align-self:center;margin:0 2px}.reader-actions .small-button[aria-pressed="true"]{background:#111827;color:#fff}.word-primary{margin:18px 0 6px;padding:18px 20px;border-radius:18px;background:linear-gradient(135deg,#111827,#273244);color:#fff;box-shadow:0 12px 30px rgba(15,23,42,.14)}.word-primary span{display:block;margin-bottom:7px;font-size:10px;font-weight:850;letter-spacing:.13em;text-transform:uppercase;color:#b7c0cf}.word-primary strong{display:block;font-size:clamp(20px,4vw,30px);line-height:1.35;letter-spacing:-.02em}.word-details:empty{display:none}.word-explanation{margin-top:18px}.word-explanation p{padding:13px 15px;border-radius:14px;background:var(--surface2);line-height:1.7}.reader-body{letter-spacing:.003em;text-wrap:pretty}.reader-body::selection{background:rgba(99,102,241,.18)}.halo-token,.halo-lookup-token{scroll-margin-top:100px}.continue-card,.dictionary-card,.learning-card{transition:transform .16s ease,box-shadow .16s ease}.continue-card:hover,.dictionary-card:hover,.learning-card:hover{transform:translateY(-1px)}
body.reader-focus{background:var(--surface2)}body.reader-focus .topbar{display:none}body.reader-focus #readerScreen{padding-top:0}body.reader-focus .reader-toolbar{position:sticky;top:0;z-index:35;max-width:none;margin:0 -22px 18px;padding:12px max(22px,calc((100vw - 820px)/2));background:color-mix(in srgb,var(--surface2) 88%,transparent);backdrop-filter:blur(18px);border-bottom:1px solid var(--line)}body.reader-focus .reader-toolbar .eyebrow{display:none}body.reader-focus .reader-advanced,body.reader-focus .reader-action-divider{display:none}body.reader-focus .runtime-notice{opacity:.72}body.reader-focus .reader-body{border-color:transparent;box-shadow:none;border-radius:12px;background:var(--surface);min-height:78vh}body.reader-focus .progress-track{height:5px}
@media(max-width:760px){.reader-action-divider{display:none}.reader-actions{gap:6px}.reader-actions .small-button{padding:9px 10px}.reader-progress-text{height:32px}.word-primary{padding:16px 17px}.sheet-card{max-height:82vh}.word-heading h2{font-size:28px}body.reader-focus .reader-toolbar{margin:0 -14px 14px;padding:10px 14px}.reader-title-block h1{font-size:27px}.reader-title-block{flex-basis:100%;width:100%}.reader-toolbar{gap:8px}.reader-toolbar .reader-actions{width:100%;overflow-x:auto;flex-wrap:nowrap;padding-bottom:2px;justify-content:flex-start;scrollbar-width:none}.reader-toolbar .reader-actions::-webkit-scrollbar{display:none}.reader-toolbar .reader-actions>*{flex:0 0 auto}}
@media(prefers-reduced-motion:reduce){.continue-card,.dictionary-card,.learning-card,.word-primary{transition:none}}
:root[data-theme="dark"] .word-primary{background:linear-gradient(135deg,#eef2f7,#cbd5e1);color:#111827}:root[data-theme="dark"] .word-primary span{color:#475569}:root[data-theme="dark"] .reader-actions .small-button[aria-pressed="true"]{background:#f8fafc;color:#111827}:root[data-theme="dark"] .reader-body::selection{background:rgba(129,140,248,.32)}

/* v0.8.0 runtime touch / narrow-viewport hardening */
html{touch-action:manipulation;-webkit-text-size-adjust:100%}
body{padding-bottom:env(safe-area-inset-bottom)}
.progress-track{padding-bottom:env(safe-area-inset-bottom)}
@media(max-width:420px){.hero-card{padding:22px 16px}.hero-actions{gap:8px}.hero-actions .primary-button,.hero-actions .secondary-button,.hero-actions .file-label{min-height:48px;width:100%}.reader-body{padding:20px 14px;font-size:calc(18px * var(--readerScale))}.sheet-card{padding:12px 16px calc(20px + env(safe-area-inset-bottom))}.learning-stats{grid-template-columns:1fr 1fr}}
@media(pointer:coarse){.halo-token[role="button"],.halo-lookup-token[role="button"]{padding:0 2px;min-height:28px}.reader-actions .small-button{min-height:44px}}

/* ========== v1.0.1 market polish ========== */
.continue-card--featured{border:2px solid var(--accent);box-shadow:0 10px 28px rgba(15,23,42,.08);background:linear-gradient(135deg,var(--surface),color-mix(in srgb,var(--surface2) 70%,#dbeafe))}
.continue-card--featured .eyebrow{color:#2563eb}
.continue-card--featured .primary-button{background:#111827;color:#fff;min-width:132px}
:root[data-theme="dark"] .continue-card--featured,:root[data-theme="system"] .continue-card--featured{background:linear-gradient(135deg,var(--surface),#1e293b)}
@media(prefers-color-scheme:light){:root[data-theme="system"] .continue-card--featured{background:linear-gradient(135deg,var(--surface),color-mix(in srgb,var(--surface2) 70%,#dbeafe))}}

.empty-state{max-width:420px;margin:24px auto;padding:36px 22px;border:1px dashed var(--line);border-radius:22px;background:var(--surface);box-shadow:0 4px 16px rgba(15,23,42,.03)}
.empty-state h3{margin:8px 0 8px;color:var(--text);font-size:18px;letter-spacing:-.02em}
.empty-state p{margin:0 auto 18px;max-width:34ch;line-height:1.6}
.empty-state--compact{margin-top:16px;padding:22px 16px}
.empty-actions{display:flex;gap:10px;flex-wrap:wrap;justify-content:center}
.empty-actions .primary-button,.empty-actions .secondary-button,.empty-actions .file-label{min-height:44px}

.learning-hero-actions{display:flex;gap:8px;flex-wrap:wrap;margin-top:14px}
.learning-hero-actions .small-button{min-height:44px}

.word-heading-meta{display:flex;align-items:center;gap:8px;flex-wrap:wrap}
.source-badge{display:inline-flex;align-items:center;min-height:24px;padding:3px 8px;border-radius:999px;font-size:10px;font-weight:850;letter-spacing:.06em;text-transform:uppercase}
.source-badge.direct{background:#dcfce7;color:#166534}
.source-badge.fallback{background:#ffedd5;color:#9a3412}
.source-badge.cedict{background:#e0e7ff;color:#3730a3}
.source-badge.none{background:var(--surface2);color:var(--muted)}
.word-phonetic{margin:6px 0 0;font-size:14px;color:var(--muted);font-weight:600;letter-spacing:.02em}
.word-primary[data-kind="fallback"]{background:linear-gradient(135deg,#9a3412,#c2410c)}
.word-primary[data-kind="fallback"] span{color:#ffedd5}
:root[data-theme="dark"] .word-primary[data-kind="fallback"]{background:linear-gradient(135deg,#fdba74,#fb923c);color:#111827}
:root[data-theme="dark"] .source-badge.direct{background:#14532d;color:#bbf7d0}
:root[data-theme="dark"] .source-badge.fallback{background:#7c2d12;color:#ffedd5}
:root[data-theme="dark"] .source-badge.cedict{background:#312e81;color:#c7d2fe}

.legal-actions{margin-top:12px}
.legal-foot{margin:12px 0 0;font-size:12px}
.app-footer{display:flex;align-items:center;gap:12px;flex-wrap:wrap;margin:8px 0 28px;padding:14px 4px;border-top:1px solid var(--line);color:var(--muted);font-size:12px}
.footer-link{appearance:none;border:0;background:transparent;color:var(--text);font-weight:750;text-decoration:underline;text-underline-offset:3px;cursor:pointer;min-height:44px;padding:0 4px}
.footer-meta{margin-left:auto;font-weight:650}
.legal-modal{width:min(720px,calc(100vw - 24px))}
.legal-content{padding:22px 24px 20px}
.legal-body{max-height:min(55vh,420px);overflow:auto;padding:12px 14px;border-radius:14px;background:var(--surface2);line-height:1.65;white-space:pre-wrap;font-size:13px;color:var(--text)}

.hero-card{border:1px solid transparent}
.dictionary-card h2,.learning-card h2,.continue-card h2{letter-spacing:-.03em}
.settings-card h2{font-size:22px}

/* ~390px phone reader / word-sheet */
@media(max-width:390px){
  .screen{padding:14px 12px 84px}
  .hero-card{padding:20px 14px;border-radius:20px}
  .hero-card h1{font-size:28px}
  .continue-card{padding:14px}
  .sheet-card{width:100%;max-height:min(88vh,640px);border-radius:20px 20px 0 0;padding:12px 14px calc(18px + env(safe-area-inset-bottom))}
  .word-heading h2{font-size:24px;line-height:1.15;overflow-wrap:anywhere}
  .word-primary{padding:14px;margin-top:12px}
  .word-primary strong{font-size:clamp(18px,5.2vw,24px)}
  .word-details{grid-template-columns:72px 1fr;gap:10px 10px}
  .mastery-buttons button{min-height:44px;padding:8px 10px}
  .reader-body{padding:18px 12px;border-radius:16px}
  .empty-actions{flex-direction:column}
  .empty-actions>*{width:100%}
}

@media(max-width:420px){
  .continue-card--featured .primary-button{width:100%}
  .app-footer{gap:8px}
  .footer-meta{width:100%;margin-left:0}
}

/* Focus / reduced motion polish */
:where(.footer-link,.empty-actions button,.learning-hero-actions button):focus-visible{outline:3px solid #2563eb;outline-offset:3px}
@media(prefers-reduced-motion:reduce){
  .word-sheet,.sheet-card,.toast,.continue-card--featured,.article-card{transition:none!important}
  .word-sheet.open .sheet-card{transform:translate(-50%,0)}
}

/* Dark-mode card polish */
:root[data-theme="dark"] .empty-state,:root[data-theme="dark"] .dictionary-card,:root[data-theme="dark"] .learning-card,:root[data-theme="dark"] .continue-card{box-shadow:none}
:root[data-theme="dark"] .topbar{background:rgba(15,18,24,.88)}
:root[data-theme="dark"] .hero-card{background:#0b1220}
:root[data-theme="dark"] .primary-button{background:#f8fafc;color:#0f172a}
:root[data-theme="dark"] .continue-card--featured .primary-button{background:#f8fafc;color:#0f172a}
:root[data-theme="dark"] .learning-row-actions button.active,:root[data-theme="dark"] .mastery-buttons button.active{background:#f8fafc;color:#0f172a;border-color:#f8fafc}

/* ========== v1.0.2 — import / rhythm / memory / discovery ========== */
.learning-card-actions{display:flex;gap:8px;flex-wrap:wrap;align-items:center;justify-content:flex-end}
.home-review-button{display:inline-flex;align-items:center;gap:6px}
.count-badge{display:inline-flex;align-items:center;justify-content:center;min-width:20px;height:20px;padding:0 6px;border-radius:999px;background:#111827;color:#fff;font-size:11px;font-weight:850}
:root[data-theme="dark"] .count-badge{background:#f8fafc;color:#0f172a}
.empty-note{margin:12px 0 0;font-size:12px}
.import-error{margin:0 0 8px;padding:10px 12px;border-radius:12px;background:#fff0f1;color:#a51d25;font-size:12px;font-weight:650;line-height:1.5}
.import-hint{margin:0 0 8px;font-size:12px}
.reader-estimate-chip{display:inline-flex;align-items:center;min-height:34px;padding:0 10px;border:1px dashed var(--line);border-radius:999px;font-size:11px;font-weight:750;color:var(--muted);white-space:nowrap}
.reader-estimate-chip[hidden]{display:none!important}
.discovery-chips{position:fixed;left:50%;bottom:calc(18px + env(safe-area-inset-bottom));transform:translateX(-50%);z-index:60;display:flex;align-items:center;gap:8px;flex-wrap:wrap;max-width:min(820px,calc(100vw - 24px));padding:10px 12px;border:1px solid var(--line);border-radius:16px;background:color-mix(in srgb,var(--surface) 92%,transparent);backdrop-filter:blur(14px);box-shadow:0 12px 36px rgba(15,23,42,.14)}
.discovery-chips.hidden{display:none!important}
.discovery-label{font-size:12px;font-weight:800;color:var(--muted);margin-right:2px}
.discovery-chip{min-height:40px;padding:8px 12px;border:1px solid var(--line);border-radius:999px;background:var(--surface2);color:var(--text);font-size:12px;font-weight:750;cursor:pointer}
.discovery-chip:hover,.discovery-chip:focus-visible{background:#111827;color:#fff;outline:none}
.discovery-dismiss{width:36px;height:36px;border:0;border-radius:10px;background:transparent;color:var(--muted);font-size:18px;cursor:pointer}
/* smoother word-sheet */
.word-sheet{transition:opacity .22s ease}
.word-sheet .sheet-card{transition:transform .28s cubic-bezier(.22,.61,.36,1)}
@media(prefers-reduced-motion:reduce){
  .discovery-chips,.word-sheet,.word-sheet .sheet-card{transition:none!important}
}
@media(max-width:640px){
  .learning-card-actions{width:100%;justify-content:stretch}
  .learning-card-actions .small-button{flex:1}
  .discovery-chips{bottom:calc(14px + env(safe-area-inset-bottom));padding:8px 10px}
  .reader-estimate-chip{display:none}
}


/* ========== v1.0.3 — market bar visual / a11y polish ========== */
:root{
  --shadow:0 14px 40px rgba(15,23,42,.07);
  --shadow-sm:0 4px 14px rgba(15,23,42,.045);
  --focus:3px solid #2563eb;
}
.article-card,.settings-card,.dictionary-card,.learning-card,.continue-card,.review-queue-card,.gap-plan-card,.story-session-panel{
  box-shadow:var(--shadow-sm);
}
.article-card:hover,.continue-card:hover,.dictionary-card:hover,.learning-card:hover{
  box-shadow:var(--shadow);
}
.reader-body{
  max-width:min(720px,100%);
  line-height:1.95;
  padding:clamp(28px,5.5vw,56px) clamp(22px,5vw,48px);
}
body.reader-focus .reader-body{max-width:min(680px,100%);line-height:2.05}
.word-sheet .sheet-card{box-shadow:0 -12px 40px rgba(15,23,42,.18)}
:where(button,[role="button"],a,input,select,textarea,.halo-token,.halo-lookup-token,.discovery-chip,.footer-link):focus-visible{
  outline:var(--focus);outline-offset:3px;
}
.discovery-chip:focus-visible{outline-offset:2px}
@media (prefers-reduced-motion:reduce){
  .article-card:hover,.continue-card:hover,.dictionary-card:hover,.learning-card:hover{transform:none}
  .progress-bar{transition:none!important}
}
:root[data-theme="dark"],:root[data-theme="system"]{
  /* system dark handled below */
}
@media(prefers-color-scheme:dark){
  :root[data-theme="system"] .article-card,
  :root[data-theme="system"] .settings-card,
  :root[data-theme="system"] .dictionary-card,
  :root[data-theme="system"] .learning-card,
  :root[data-theme="system"] .continue-card,
  :root[data-theme="system"] .review-queue-card{
    box-shadow:0 8px 24px rgba(0,0,0,.28);
  }
  :root[data-theme="system"] .reader-body{box-shadow:0 10px 36px rgba(0,0,0,.32)}
  :root[data-theme="system"] .topbar{background:rgba(15,18,24,.88)}
  :root[data-theme="system"] .hero-card{background:#0b1220}
  :root[data-theme="system"] .primary-button{background:#f8fafc;color:#0f172a}
  :root[data-theme="system"] .count-badge{background:#f8fafc;color:#0f172a}
  :root[data-theme="system"] .word-primary{background:linear-gradient(135deg,#eef2f7,#cbd5e1);color:#111827}
  :root[data-theme="system"] .word-primary span{color:#475569}
  :root[data-theme="system"] .halo-token:hover,:root[data-theme="system"] .halo-lookup-token:hover{background:#252c39}
}
:root[data-theme="dark"] .article-card,
:root[data-theme="dark"] .settings-card,
:root[data-theme="dark"] .dictionary-card,
:root[data-theme="dark"] .learning-card,
:root[data-theme="dark"] .continue-card,
:root[data-theme="dark"] .review-queue-card{
  box-shadow:0 8px 24px rgba(0,0,0,.28);
}
:root[data-theme="dark"] .reader-body{box-shadow:0 10px 36px rgba(0,0,0,.32)}
:root[data-theme="dark"] .discovery-chip:hover,:root[data-theme="dark"] .discovery-chip:focus-visible{background:#f8fafc;color:#0f172a}
.learning-stats>div,.learning-row{box-shadow:var(--shadow-sm)}
.empty-state{box-shadow:var(--shadow-sm)}


/* ========== v1.0.4 — product feel (Du/Pleco trust bar) ========== */
.dictionary-ready-row{display:flex;align-items:center;gap:10px;margin:10px 0 4px;font-size:13px;font-weight:700;color:var(--ink,#111827)}
.dictionary-ready-row .dict-check{display:inline-flex;align-items:center;justify-content:center;width:22px;height:22px;border-radius:999px;background:#edf0f3;font-size:12px}
.dictionary-ready-row[data-ready="yes"] .dict-check{background:#dcfce7;color:#166534}
.dictionary-ready-row[data-ready="yes"]{color:#166534}
.dictionary-ready-row[data-ready="partial"] .dict-check{background:#ffedd5;color:#9a3412}
.dictionary-ready-row[data-ready="no"] .dict-check{background:#fee2e2;color:#b91c1c}
.dictionary-ready-row[data-ready="no"]{color:#b91c1c}
.dictionary-card--compact{padding:16px 18px}
.dictionary-card--ready .dictionary-progress{display:none}
.text-button{appearance:none;border:0;background:transparent;color:#4b5563;font:inherit;font-size:12px;font-weight:700;padding:4px 0;cursor:pointer;text-decoration:underline;text-underline-offset:3px}
.text-button:hover{color:#111827}
.dictionary-tech{margin-top:10px;padding:12px 14px;border-radius:14px;background:var(--surface2,#f4f5f7);font-size:12px;line-height:1.55}
.dictionary-tech.hidden,[hidden].dictionary-tech{display:none!important}
.about-local-first{margin:12px 0 0;padding-left:1.2em;color:var(--muted,#6b7280);font-size:14px;line-height:1.65}
.about-local-first li{margin:0 0 4px}
.extension-bridge-note{font-size:13px;line-height:1.6}
.settings-advanced{padding:0}
.settings-advanced>summary{list-style:none;cursor:pointer;padding:18px 20px;display:grid;gap:4px}
.settings-advanced>summary::-webkit-details-marker{display:none}
.settings-advanced>summary .advanced-hint{font-size:12px}
.settings-advanced[open]>summary{border-bottom:1px solid var(--line,#e5e7eb)}
.advanced-body{padding:8px 20px 18px}
.advanced-block{padding:14px 0;border-top:1px solid var(--line,#e5e7eb)}
.advanced-block:first-child{border-top:0}
.advanced-block h3{margin:0 0 6px;font-size:15px}
.feedback-honest{margin:0 0 12px;padding:12px 14px;border-radius:12px;background:#fff7ed;color:#9a3412;font-size:13px;line-height:1.55}
.feedback-include{margin:12px 0}
.feedback-form label{display:block;margin:10px 0}
.feedback-form textarea{width:100%;min-height:120px;resize:vertical}
:root[data-theme="dark"] .feedback-honest,:root[data-theme="system"] .feedback-honest{background:#3b2410;color:#fdba74}
@media(prefers-color-scheme:dark){
  :root[data-theme="system"] .feedback-honest{background:#3b2410;color:#fdba74}
  :root[data-theme="system"] .dictionary-ready-row[data-ready="yes"]{color:#86efac}
  :root[data-theme="system"] .dictionary-ready-row[data-ready="yes"] .dict-check{background:#14532d;color:#bbf7d0}
}
:root[data-theme="dark"] .dictionary-ready-row[data-ready="yes"]{color:#86efac}
:root[data-theme="dark"] .dictionary-ready-row[data-ready="yes"] .dict-check{background:#14532d;color:#bbf7d0}
.dictionary-card--ready:hover{transform:none}


/* ========== v1.0.6 — PWA soft install banner ========== */
.install-banner{display:flex;align-items:center;justify-content:space-between;gap:14px;flex-wrap:wrap;margin:16px 0 0;padding:14px 16px;border:1px solid var(--line);border-radius:18px;background:color-mix(in srgb,var(--surface) 94%,#dbeafe);box-shadow:var(--shadow-sm,0 4px 14px rgba(15,23,42,.045))}
.install-banner.hidden{display:none!important}
.install-banner-copy{min-width:0;flex:1}
.install-banner-copy strong{display:block;font-size:14px;letter-spacing:-.01em}
.install-banner-copy p{margin:4px 0 0;font-size:12px;line-height:1.55;color:var(--muted)}
.install-banner-actions{display:flex;align-items:center;gap:12px;flex-wrap:wrap}
.install-banner-actions .primary-button{padding:10px 14px;font-size:13px}
@media(prefers-reduced-motion:reduce){.install-banner{transition:none}}
@media(max-width:640px){.install-banner{padding:12px 13px}.install-banner-actions{width:100%}.install-banner-actions .primary-button{flex:1}}
.install-banner--ios{background:color-mix(in srgb,var(--surface) 92%,#fef3c7);border-color:color-mix(in srgb,var(--line) 70%,#f59e0b)}


/* ========== v1.0.7 — flashcards / device TTS / soft streak ========== */
.word-tts-row{display:flex;align-items:center;gap:10px;flex-wrap:wrap;margin-top:10px}
.word-tts-row.hidden{display:none!important}
.tts-rate-label,.tts-settings-label{display:flex;align-items:center;gap:8px;font-size:12px;font-weight:700;color:var(--muted)}
.tts-rate-label input,.tts-settings-label input{width:120px}
.tts-note{font-size:11px;font-weight:600}
.settings-soft-note{margin:8px 0 0;font-size:12px;line-height:1.5}
.streak-status{margin:6px 0 0;font-size:12px;font-weight:700}
.streak-status.hidden{display:none!important}
.streak-chip{display:inline-flex;align-items:center;min-height:32px;padding:0 10px;border-radius:999px;background:var(--surface2);font-size:12px;font-weight:700}
.streak-chip.hidden{display:none!important}
.review-queue-actions{display:flex;gap:8px;flex-wrap:wrap;align-items:center}
.flashcard-panel{margin-top:14px;padding:14px;border:1px solid var(--line);border-radius:16px;background:var(--surface2)}
.flashcard-panel.hidden{display:none!important}
.flashcard-toolbar{display:flex;align-items:center;justify-content:space-between;gap:10px;flex-wrap:wrap;margin-bottom:10px}
.flashcard-progress{font-size:12px;font-weight:800;color:var(--muted)}
.flashcard-face{width:100%;min-height:168px;padding:22px 18px;border:1px solid var(--line);border-radius:18px;background:var(--surface);text-align:left;cursor:pointer;display:grid;gap:8px;align-content:center;transform-style:preserve-3d;transition:transform .38s ease,box-shadow .2s ease;perspective:900px}
.flashcard-face.is-flipped{box-shadow:0 10px 28px rgba(15,23,42,.08)}
.flashcard-face.is-flipping{transform:rotateY(180deg)}
.flashcard-inner{display:grid;gap:8px;align-content:center;backface-visibility:hidden}
.flashcard-face:focus-visible{outline:2px solid #2563eb;outline-offset:2px}
.flashcard-side-label{font-size:11px;font-weight:800;letter-spacing:.04em;text-transform:uppercase;color:var(--muted)}
.flashcard-front{font-size:clamp(22px,4vw,34px);letter-spacing:-.03em;line-height:1.25}
.flashcard-context{margin:0;font-size:14px;line-height:1.55}
.flashcard-back{margin:0;font-size:clamp(18px,3vw,26px);font-weight:800;color:var(--ink,#111827)}
.flashcard-actions{display:flex;gap:10px;flex-wrap:wrap;margin-top:14px}
.flashcard-actions button{min-height:48px;min-width:48px;flex:1;border-radius:14px;border:1px solid var(--line);cursor:pointer;font-weight:800;font-size:15px;padding:10px 12px}
.flashcard-again{background:#fff7ed;color:#9a3412}
.flashcard-know{background:#ecfdf5;color:#166534}
.flashcard-actions kbd{font-size:10px;font-weight:700;opacity:.7;margin-left:4px;padding:1px 5px;border:1px solid currentColor;border-radius:4px}
.flashcard-hint{margin:10px 0 0;font-size:12px;line-height:1.5}
.flashcard-active.hidden,.flashcard-complete.hidden{display:none!important}
.flashcard-complete{margin-top:4px;padding:18px 14px;border:1px dashed var(--line);border-radius:16px;background:var(--surface);text-align:center;display:grid;gap:8px;justify-items:center}
.flashcard-complete h3{margin:0;font-size:18px;letter-spacing:-.02em}
.flashcard-complete-actions{display:flex;flex-wrap:wrap;gap:8px;justify-content:center;margin-top:8px}
.flashcard-complete-actions button{min-height:48px}
:root[data-theme="dark"] .flashcard-again,:root[data-theme="system"] .flashcard-again{background:#3b2410;color:#fdba74}
:root[data-theme="dark"] .flashcard-know,:root[data-theme="system"] .flashcard-know{background:#14532d;color:#bbf7d0}
@media(prefers-color-scheme:dark){
  :root[data-theme="system"] .flashcard-again{background:#3b2410;color:#fdba74}
  :root[data-theme="system"] .flashcard-know{background:#14532d;color:#bbf7d0}
}
@media(prefers-reduced-motion:reduce){
  .flashcard-face,.flashcard-face.is-flipping{transition:none!important;transform:none!important;animation:none!important}
}

/* v1.0.9 — mini library picker + honest activity stats */
.sample-picker-list{display:grid;gap:10px;margin:14px 0;max-height:min(55vh,420px);overflow:auto}
.sample-picker-item{display:grid;gap:4px;text-align:left;padding:14px 16px;border:1px solid var(--line);border-radius:14px;background:var(--surface);color:var(--text);cursor:pointer;min-height:44px}
.sample-picker-item:hover,.sample-picker-item:focus-visible{border-color:#2563eb;outline:2px solid #2563eb;outline-offset:2px}
.sample-picker-item strong{font-size:15px}
.sample-picker-note{font-size:12px;line-height:1.45}
.sample-picker-meta{font-size:11px}
.activity-stats-card{margin:8px 0 18px;padding:16px 18px;border:1px solid var(--line);border-radius:18px;background:var(--surface)}
.activity-stats-heading h2{margin:2px 0 6px;font-size:18px}
.activity-stats-grid{display:grid;grid-template-columns:repeat(3,1fr);gap:10px;margin-top:12px}
.activity-stat{border:1px solid var(--line);border-radius:14px;padding:12px 14px;background:var(--surface2)}
.activity-stat strong{display:block;font-size:18px;line-height:1.2}
.activity-stat span{display:block;margin-top:4px;font-size:11px;color:var(--muted);font-weight:700}
@media (max-width:640px){
  .activity-stats-grid{grid-template-columns:repeat(2,1fr)}
}

/* ========== v1.0.11 — bookmarks / in-article search / BYOK AI story ========== */
.highlight-color-select{min-height:44px;border:1px solid var(--line);border-radius:12px;background:var(--surface);padding:0 8px;font-size:12px;font-weight:700;color:var(--text)}
.reader-find-bar{display:flex;align-items:center;gap:8px;flex-wrap:wrap;max-width:820px;margin:0 auto 12px;padding:10px 12px;border:1px solid var(--line);border-radius:14px;background:var(--surface)}
.reader-find-bar.hidden{display:none!important}
.reader-find-bar input{flex:1;min-width:140px;padding:10px 12px;border:1px solid var(--line);border-radius:12px;background:var(--surface2);color:var(--text)}
.reader-find-count{font-size:12px;font-weight:800;color:var(--muted);min-width:4.5em;text-align:center}
.reader-highlights-panel{max-width:820px;margin:0 auto 14px;padding:14px 16px;border:1px solid var(--line);border-radius:16px;background:var(--surface)}
.reader-highlights-panel.hidden{display:none!important}
.reader-highlights-list{display:grid;gap:8px;margin-top:10px}
.reader-highlight-row{display:flex;align-items:flex-start;justify-content:space-between;gap:10px;padding:10px 12px;border-radius:12px;background:var(--surface2);font-size:13px;line-height:1.45}
.reader-highlight-row button{flex-shrink:0}
mark.halo-highlight{border-radius:3px;padding:0 1px;box-decoration-break:clone;-webkit-box-decoration-break:clone}
mark.halo-highlight--yellow{background:rgba(250,204,21,.42);color:inherit}
mark.halo-highlight--green{background:rgba(74,222,128,.38);color:inherit}
mark.halo-highlight--blue{background:rgba(96,165,250,.38);color:inherit}
mark.halo-highlight--pink{background:rgba(244,114,182,.38);color:inherit}
mark.halo-find-hit{background:rgba(251,191,36,.35);border-radius:2px;color:inherit}
mark.halo-find-hit--active{background:rgba(245,158,11,.72);outline:2px solid #f59e0b;color:inherit}
.bookmarks-card{margin:16px 0 0;padding:16px 18px;border:1px solid var(--line);border-radius:18px;background:var(--surface)}
.bookmarks-card-head{display:flex;align-items:flex-start;justify-content:space-between;gap:12px;flex-wrap:wrap}
.bookmarks-card-head h2{margin:2px 0 6px;font-size:18px}
.home-bookmarks-list,.bookmarks-dialog-list{display:grid;gap:8px;margin-top:12px}
.bookmark-row{display:flex;align-items:center;justify-content:space-between;gap:10px;padding:12px 14px;border:1px solid var(--line);border-radius:14px;background:var(--surface2);text-align:left;cursor:pointer;min-height:44px;width:100%;color:var(--text);font:inherit}
.bookmark-row strong{display:block;font-size:14px}
.bookmark-row span{display:block;font-size:11px;color:var(--muted);margin-top:2px}
.gap-plan-actions{display:flex;flex-wrap:wrap;gap:8px;align-items:center}
:root[data-theme="dark"] mark.halo-highlight--yellow,:root[data-theme="system"] mark.halo-highlight--yellow{background:rgba(202,138,4,.45)}
@media(prefers-color-scheme:dark){
  :root[data-theme="system"] mark.halo-highlight--yellow{background:rgba(202,138,4,.45)}
}


/* v1.0.12 immersion / parallel draft */
body.reader-immerse .halo-token{text-decoration:none!important;background:transparent}
body.reader-immerse .halo-pos-label{display:none!important}
body.reader-immerse .halo-lookup-token{text-decoration:underline dotted transparent;text-underline-offset:4px}
body.reader-immerse .halo-lookup-token:hover,body.reader-immerse .halo-lookup-token:focus{text-decoration-color:#c4cbd5;background:#f1f5f9}
.parallel-draft-host{max-width:820px;margin:12px auto 24px}
.parallel-draft-host.hidden,[hidden].parallel-draft-host{display:none!important}
.parallel-draft{border:1px solid var(--line);border-radius:18px;padding:16px 18px;background:var(--surface2)}
.parallel-draft-note{margin:0 0 12px;font-size:12px;color:var(--muted);line-height:1.5}
.parallel-pair{padding:12px 0;border-top:1px dashed var(--line)}
.parallel-pair:first-of-type{border-top:0;padding-top:0}
.parallel-en{margin:0 0 6px;font-family:Georgia,"Noto Serif TC",serif;font-size:calc(17px * var(--readerScale));line-height:var(--readerLineHeight,1.9);color:var(--text)}
.parallel-zh{margin:0;font-size:calc(15px * var(--readerScale));line-height:1.7;color:var(--muted)}
#readerModeButton[data-reader-mode="immerse"],#readerModeButton[data-reader-mode="parallel"]{background:#111827;color:#fff}
@media(max-width:760px){
  .settings-card>label{margin:14px 0}
  .settings-card input[type=range]{min-height:28px}
  .parallel-draft{padding:14px}
}

/* ========== v1.0.14 — a11y contrast / reduced motion / legal links ========== */
.visually-hidden{
  position:absolute!important;width:1px!important;height:1px!important;padding:0!important;margin:-1px!important;
  overflow:hidden!important;clip:rect(0,0,0,0)!important;white-space:nowrap!important;border:0!important;
}
.about-legal-links{margin:14px 0 0;font-size:13px;line-height:1.6}
.about-legal-links a{color:var(--text);font-weight:750;text-underline-offset:3px}
.about-legal-links a:focus-visible{outline:3px solid #2563eb;outline-offset:3px}

/* Improve muted text contrast on light surfaces (approx AA for body-adjacent copy) */
:root{--muted:#556274}
@media(prefers-color-scheme:dark){
  :root[data-theme="system"]{--muted:#a8b4c4}
}
:root[data-theme="dark"]{--muted:#a8b4c4}

@media(prefers-contrast:more){
  :root{
    --text:#000;--muted:#111;--line:#000;--surface:#fff;--surface2:#f3f3f3;--accent:#000;--accentText:#fff;
  }
  body{background:#fff;color:#000}
  .hero-card{background:#000;color:#fff;box-shadow:none}
  .hero-card p:not(.eyebrow),.hero-card .eyebrow{color:#fff}
  .primary-button{background:#fff;color:#000;border:2px solid #000}
  .secondary-button,.small-button{border:2px solid #000;background:#fff;color:#000}
  .article-card,.settings-card,.dictionary-card,.learning-card,.continue-card,.flashcard-panel,.install-banner{
    border:2px solid #000;box-shadow:none;
  }
  .muted{color:#111}
  .skip-link{outline:3px solid #fff}
  :where(button,[role="button"],a,input,select,textarea):focus-visible{
    outline:3px solid #000;outline-offset:3px;
  }
  .progress-bar,.mini-progress span{background:#000}
  .halo-token,.halo-lookup-token{text-decoration:underline;text-decoration-thickness:2px}
}
@media(prefers-contrast:more) and (prefers-color-scheme:dark){
  :root[data-theme="system"],:root[data-theme="dark"]{
    --text:#fff;--muted:#fff;--line:#fff;--surface:#000;--surface2:#111;--accent:#fff;--accentText:#000;
  }
  body{background:#000;color:#fff}
  .hero-card{background:#000;border:2px solid #fff}
  .primary-button{background:#fff;color:#000;border:2px solid #fff}
  .secondary-button,.small-button{border:2px solid #fff;background:#000;color:#fff}
}

@media(prefers-reduced-motion:reduce){
  .install-banner,.flashcard-face,.discovery-chips,.toast.show,.word-sheet,.sheet-card,.article-card{
    transition:none!important;animation:none!important;
  }
  .word-sheet{opacity:1}
  .word-sheet:not(.open){opacity:0}
  .word-sheet .sheet-card{transform:translate(-50%,100%)}
  .word-sheet.open .sheet-card{transform:translate(-50%,0)}
  html{scroll-behavior:auto}
}

@media(forced-colors:active){
  .install-banner,.flashcard-panel,.flashcard-face,.onboarding-steps>div,.mastery-buttons button{
    border:1px solid CanvasText;
  }
  .flashcard-again,.flashcard-know{forced-color-adjust:none}
  .about-legal-links a{color:LinkText}
}


/* v1.0.15 keyboard cheatsheet */
.cheatsheet-modal{max-width:min(560px,94vw)}
.cheatsheet-content{display:flex;flex-direction:column;gap:8px;max-height:min(80vh,720px)}
.cheatsheet-body{overflow:auto;padding:4px 2px 12px;display:grid;gap:14px}
.cheatsheet-note{margin:0;font-size:13px;line-height:1.5}
.cheatsheet-section h3{margin:0 0 8px;font-size:14px;letter-spacing:.02em}
.cheatsheet-table{width:100%;border-collapse:collapse;font-size:13px}
.cheatsheet-table th,.cheatsheet-table td{padding:8px 10px;border-top:1px solid var(--line);text-align:left;vertical-align:top}
.cheatsheet-table th{width:38%;font-weight:600;white-space:nowrap}
.cheatsheet-table kbd{display:inline-block;padding:2px 7px;border:1px solid var(--line);border-radius:6px;background:var(--surface2);font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;font-size:12px}
@media(prefers-reduced-motion:reduce){
  .cheatsheet-modal,.toast{transition:none!important}
}


/* v1.0.14 — eyebrow / meta contrast AA fix */
.eyebrow{color:#4b5563}
.hero-card .eyebrow{color:#c5cedb}
.article-card footer,.dictionary-footer,.learning-term span,.learning-meta,.pos-chip,.word-details dt{color:#4b5563}
.pill{color:#374151}
:root[data-theme="dark"] .eyebrow,:root[data-theme="dark"] .article-card footer{color:#a8b4c4}
@media(prefers-color-scheme:dark){
  :root[data-theme="system"] .eyebrow,:root[data-theme="system"] .article-card footer{color:#a8b4c4}
}

/* Wave15 — offline banner + evidence integrity */
.offline-banner{display:flex;align-items:flex-start;gap:10px;flex-wrap:wrap;margin:0 0 12px;padding:10px 14px;border:1px solid #f59e0b55;border-radius:14px;background:color-mix(in srgb,var(--surface) 88%,#fef3c7);color:#92400e;font-size:12px;line-height:1.5}
.offline-banner.hidden{display:none!important}
.offline-banner strong{font-size:13px;letter-spacing:-.01em}
.offline-banner span{flex:1;min-width:180px;color:#78350f}
.evidence-integrity-card{background:var(--surface);border:1px solid var(--line);border-radius:20px;padding:18px 18px 14px;margin:14px 0 18px;box-shadow:0 4px 14px rgba(15,23,42,.035)}
.evidence-integrity-heading .eyebrow{color:#64748b}
.evidence-integrity-heading h2{margin:0 0 6px;font-size:20px;letter-spacing:-.02em}
.evidence-integrity-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(140px,1fr));gap:10px;margin-top:12px}
.evidence-integrity-cell{background:var(--surface2);border-radius:14px;padding:12px 14px;border:1px solid var(--line)}
.evidence-integrity-cell strong{display:block;font-size:22px;letter-spacing:-.03em;margin:4px 0}
.evidence-integrity-cell span{font-size:11px;font-weight:800;color:#64748b;letter-spacing:.04em}
.evidence-integrity-cell small{display:block;margin-top:4px;font-size:11px;color:var(--muted);line-height:1.4}
.learning-virtual-host{position:relative;overflow:auto;max-height:min(70vh,720px);border-radius:16px}
.learning-virtual-spacer{width:100%;pointer-events:none}
.learning-virtual-window{position:absolute;left:0;right:0;will-change:transform}

/* Wave16 v1.0.17 — reading experience polish */
:root{
  --readerMaxWidth:720px;
  --readerPadding:clamp(24px,5vw,56px);
  --theme-ease:background-color .28s ease,color .28s ease,border-color .28s ease,box-shadow .28s ease;
}
html[data-theme-transition="smooth"] body,
html[data-theme-transition="smooth"] .reader-body,
html[data-theme-transition="smooth"] .topbar,
html[data-theme-transition="smooth"] .settings-card,
html[data-theme-transition="smooth"] .article-card,
html[data-theme-transition="smooth"] .word-sheet .sheet-card{
  transition:var(--theme-ease);
}
.reader-body{
  max-width:var(--readerMaxWidth);
  padding:var(--readerPadding);
}
.reader-toolbar{max-width:var(--readerMaxWidth)}
.parallel-draft-host{max-width:var(--readerMaxWidth)}
body.reader-focus .reader-toolbar{
  padding-left:max(22px,calc((100vw - var(--readerMaxWidth)) / 2));
  padding-right:max(22px,calc((100vw - var(--readerMaxWidth)) / 2));
}
body.reader-focus .reader-body{max-width:min(var(--readerMaxWidth),100%)}

/* Sepia / day / night aliases */
:root[data-theme="day"],:root[data-theme="light"]{
  color-scheme:light;
  --surface:#fff;--surface2:#f8fafc;--text:#111827;--muted:#687386;--line:#e5e7eb;
  background:#f4f5f7;
}
:root[data-theme="sepia"]{
  color-scheme:light;
  --surface:#f4ead5;--surface2:#ebe0c8;--text:#3f2e1c;--muted:#7a654c;--line:#d9c8a8;
  --accent:#3f2e1c;--accentText:#f4ead5;
  background:#e8dcc4;
}
html[data-theme="sepia"] body{
  background:radial-gradient(circle at top,#f7eedc 0,#e8dcc4 45%,#ddd0b4 100%);
  color:var(--text);
}
:root[data-theme="sepia"] .reader-body{
  background:#f7eedc;border-color:#d9c8a8;box-shadow:0 10px 30px rgba(92,64,32,.08);
}
:root[data-theme="sepia"] .topbar{background:rgba(232,220,196,.88)}
:root[data-theme="sepia"] .hero-card{background:#4a3724}
:root[data-theme="sepia"] .primary-button{background:#4a3724;color:#f7eedc}
:root[data-theme="sepia"] .small-button{background:#ebe0c8;color:#3f2e1c}
:root[data-theme="sepia"] .reader-actions .small-button[aria-pressed="true"],
:root[data-theme="sepia"] .mode-chip[aria-pressed="true"]{background:#4a3724;color:#f7eedc}
:root[data-theme="night"],:root[data-theme="dark"]{
  color-scheme:dark;
  --surface:#151922;--surface2:#1b202b;--text:#eef2f7;--muted:#9aa5b5;--line:#2a3240;
  --accent:#f8fafc;--accentText:#111827;background:#0f1218;
}

.reader-mode-segment{
  display:inline-flex;align-items:center;gap:2px;padding:3px;border:1px solid var(--line);
  border-radius:12px;background:var(--surface2);min-height:44px;
}
.mode-chip{
  appearance:none;border:0;background:transparent;color:var(--muted);font:inherit;font-size:12px;
  font-weight:750;padding:8px 10px;border-radius:9px;cursor:pointer;min-height:38px;
}
.mode-chip[aria-pressed="true"]{background:#111827;color:#fff}
.mode-chip:disabled,.mode-chip[aria-disabled="true"]{opacity:.45;cursor:not-allowed}
.parallel-draft--empty{text-align:left}
.parallel-empty-title{margin:0 0 6px;font-weight:800;font-size:15px}
.parallel-empty-actions{display:flex;gap:8px;flex-wrap:wrap;margin-top:12px}
.word-empty-state{
  margin:16px 0 8px;padding:16px 18px;border-radius:16px;border:1px dashed var(--line);
  background:var(--surface2);
}
.word-empty-title{margin:0 0 6px;font-weight:800;font-size:15px}
.word-empty-actions{display:flex;gap:8px;flex-wrap:wrap;margin-top:12px}
.source-badge.builtin-hf{background:#1e3a5f;color:#bfdbfe}
:root[data-theme="sepia"] .source-badge.builtin-hf{background:#5b4630;color:#f7eedc}
:root[data-theme="night"] .source-badge.builtin-hf,:root[data-theme="dark"] .source-badge.builtin-hf{background:#1e3a5f;color:#bfdbfe}

@media(prefers-reduced-motion:reduce){
  html[data-theme-transition="smooth"] body,
  html[data-theme-transition="smooth"] .reader-body,
  html[data-theme-transition="smooth"] .topbar,
  html[data-theme-transition="smooth"] .settings-card,
  html[data-theme-transition="smooth"] .article-card,
  html[data-theme-transition="smooth"] .word-sheet .sheet-card{
    transition:none!important;
  }
  .mode-chip,.reader-mode-segment{transition:none!important}
}
@media(max-width:640px){
  .reader-mode-segment{width:100%;justify-content:space-between}
  .mode-chip{flex:1}
}


/* ========== v1.0.18 — review closed loop / share ========== */
/* ========== v1.0.19 — store readiness / PWA shortcuts / iOS tip ========== */
.home-review-button.is-due-zero{opacity:.78;font-weight:650}
.home-review-button.is-due-zero .count-badge{background:#e8ebef;color:#6b7280}
.review-due-empty{margin-top:12px}
.share-sheet-note,.settings-soft-note{font-size:12px;line-height:1.55}
.evidence-integrity-cell small{display:block;margin-top:4px;color:var(--muted);font-weight:500}


/* ========== v1.0.20 — first-week path / recovery / sample themes ========== */
.first-week-path-card{
  margin:14px 0 0;padding:18px 20px;border:1px solid var(--line);border-radius:20px;
  background:linear-gradient(135deg,var(--surface),color-mix(in srgb,var(--surface2) 75%,#dbeafe));
  box-shadow:0 5px 18px rgba(15,23,42,.035);
}
.first-week-path-head{display:flex;align-items:flex-start;justify-content:space-between;gap:16px;flex-wrap:wrap}
.first-week-path-progress{margin:6px 0 0;font-size:13px;font-weight:800;color:var(--text)}
.first-week-path-actions{display:flex;gap:8px;flex-wrap:wrap}
.first-week-path-list{list-style:none;margin:16px 0 0;padding:0;display:grid;gap:8px}
.first-week-path-list li{
  display:grid;grid-template-columns:28px 1fr;gap:10px;align-items:start;
  padding:12px 14px;border:1px solid var(--line);border-radius:14px;background:var(--surface2);
}
.first-week-path-list li[data-done="true"]{opacity:.72}
.first-week-path-list li[data-current="true"]{border-color:#2563eb;box-shadow:0 0 0 3px rgba(37,99,235,.12)}
.first-week-path-list .step-mark{
  display:grid;place-items:center;width:28px;height:28px;border-radius:999px;
  background:#111827;color:#fff;font-size:12px;font-weight:800;
}
.first-week-path-list li[data-done="true"] .step-mark{background:#16a34a}
.first-week-path-list b{display:block;font-size:13px;margin-bottom:2px}
.first-week-path-list span{font-size:12px;color:var(--muted);line-height:1.5}
.import-recovery-hint{margin:8px 0 0;font-size:12px}
.flashcard-empty,.reader-empty{margin-top:12px}
.sample-picker-item{
  position:relative;overflow:hidden;border:1px solid var(--line);border-radius:16px;
  padding:14px 16px 14px 18px;background:var(--surface2);text-align:left;cursor:pointer;
  transition:background .15s,border-color .15s,transform .12s;
}
.sample-picker-item::before{
  content:"";position:absolute;left:0;top:0;bottom:0;width:6px;background:#94a3b8;
}
.sample-picker-item[data-accent="sun"]::before{background:#f59e0b}
.sample-picker-item[data-accent="grape"]::before{background:#8b5cf6}
.sample-picker-item[data-accent="path"]::before{background:#16a34a}
.sample-picker-item[data-accent="amber"]::before{background:#d97706}
.sample-picker-item[data-accent="sky"]::before{background:#0ea5e9}
.sample-picker-item:hover,.sample-picker-item:focus-visible{
  border-color:#2563eb;outline:none;background:var(--surface);
}
.sample-picker-meta{display:block;margin-top:6px;font-size:11px}
:root[data-theme="sepia"] .first-week-path-card{
  background:linear-gradient(135deg,#f3e6c8,#e8d7b0);
}
:root[data-theme="sepia"] .sample-picker-item{background:#efe2c4}
:root[data-theme="sepia"] .first-week-path-list li{background:#efe2c4}
:root[data-theme="night"] .first-week-path-card,
:root[data-theme="dark"] .first-week-path-card{
  background:linear-gradient(135deg,var(--surface),#1e293b);box-shadow:none;
}
:root[data-theme="night"] .sample-picker-item,
:root[data-theme="dark"] .sample-picker-item{background:#1b202b}
:root[data-theme="night"] .first-week-path-list .step-mark,
:root[data-theme="dark"] .first-week-path-list .step-mark{background:#f8fafc;color:#0f172a}
:root[data-theme="day"] .sample-picker-item{background:#f8fafc}
@media(max-width:720px){
  .first-week-path-actions{width:100%}
  .first-week-path-actions .primary-button,.first-week-path-actions .secondary-button{flex:1}
}
@media(prefers-reduced-motion:reduce){
  .sample-picker-item{transition:none}
}

/* Wave20 — Transfer Probe / Story remediation UX */
.transfer-probe-home-card{margin:14px 0 18px;padding:18px;border:1px solid var(--line,#d8dee8);border-radius:18px;background:linear-gradient(135deg,rgba(124,58,237,.06),var(--surface,#fff))}
.transfer-probe-home-heading{display:flex;align-items:flex-start;justify-content:space-between;gap:16px;flex-wrap:wrap}
.transfer-probe-home-heading h2{margin:4px 0 6px;font-size:18px}
.transfer-probe-disclaimer{font-size:12px;margin:8px 0 0}
.probe-status-banner{max-width:820px;margin:0 auto 14px;padding:14px 16px;border:1px solid #c4b5fd;border-radius:16px;background:#f5f3ff;color:#5b21b6}
.probe-status-banner h2{margin:4px 0 6px;font-size:17px}
.probe-status-list{margin:8px 0 0;padding-left:1.1em;font-size:13px;line-height:1.45}
.probe-status-list .probe-outcome-success{color:#166534}
.probe-status-list .probe-outcome-supportNeeded{color:#9a3412}
.probe-status-list .probe-outcome-unobserved{color:#64748b}
.story-stage-legend{display:flex;flex-wrap:wrap;gap:6px;margin:8px 0 4px}
.story-stage-chip{font-size:11px;font-weight:700;padding:4px 8px;border-radius:999px;background:var(--surface2,#f1f5f9);border:1px solid var(--line)}
.story-stage-chip.stage-planned{border-color:#94a3b8}
.story-stage-chip.stage-validated{border-color:#38bdf8;background:#e0f2fe}
.story-stage-chip.stage-observed{border-color:#4ade80;background:#dcfce7}
.story-target-chips .story-target-chip,.story-target-chips span.stage-planned,.story-target-chips span.stage-validated,.story-target-chips span.stage-observed{padding:6px 9px;border-radius:999px;background:var(--surface2);font-size:12px;font-weight:700}
.story-target-chips span.stage-validated{background:#e0f2fe;border:1px solid #7dd3fc}
.story-target-chips span.stage-observed{background:#dcfce7;border:1px solid #86efac}
.story-matcher-note{font-size:12px;margin:4px 0 0}
.evidence-events-eyebrow{margin:14px 0 0;display:block}
.evidence-event-grid{margin-top:8px}
.gap-plan-actions .primary-button{min-height:44px}
@media(max-width:640px){
  .transfer-probe-home-heading{display:block}
  .transfer-probe-home-heading .primary-button{width:100%;margin-top:12px}
  .gap-plan-actions{display:grid}
  .gap-plan-actions button{width:100%}
}


/* Wave20 v1.0.21 — library IA / font family / lexicon / backup preview */
.library-controls{display:flex;flex-wrap:wrap;gap:8px;margin:0 0 14px;align-items:center}
.library-controls input[type=search]{flex:1 1 160px;min-width:140px;padding:10px 12px;border:1px solid var(--line);border-radius:12px;background:var(--surface);color:var(--text)}
.library-controls select{flex:0 1 auto;min-width:110px;padding:10px 12px;border:1px solid var(--line);border-radius:12px;background:var(--surface);color:var(--text)}
.reader-body{font-family:var(--readerFontFamily,Georgia,"Noto Serif TC",serif)}
html[data-reader-font="system"] .reader-body{font-family:var(--readerFontFamily)}
html[data-reader-font="serif"] .reader-body{font-family:var(--readerFontFamily)}
html[data-reader-font="sans"] .reader-body{font-family:var(--readerFontFamily);letter-spacing:.01em}
html[data-reader-font="dyslexia"] .reader-body{font-family:var(--readerFontFamily);letter-spacing:.04em;word-spacing:.08em}
.article-lexicon-panel{max-width:820px;margin:0 auto 16px;padding:16px 18px;border:1px solid var(--line);border-radius:18px;background:var(--surface);box-shadow:0 6px 20px rgba(15,23,42,.04)}
.article-lexicon-head{display:flex;justify-content:space-between;gap:12px;align-items:flex-start}
.article-lexicon-head h2{margin:4px 0 6px;font-size:18px}
.article-lexicon-list{display:grid;gap:8px;margin:14px 0}
.article-lexicon-row{display:grid;grid-template-columns:1fr auto;gap:8px;padding:10px 12px;border-radius:12px;background:var(--surface2);border:1px solid var(--line)}
.article-lexicon-row strong{font-size:15px}
.article-lexicon-row span{font-size:12px;color:var(--muted)}
.article-lexicon-freq{margin-top:12px}
.article-lexicon-freq h3{margin:0 0 8px;font-size:13px}
.article-lexicon-freq ul{margin:0;padding-left:18px;color:var(--muted);font-size:13px}
.article-lexicon-actions{display:flex;flex-wrap:wrap;gap:8px;margin-top:12px}
.backup-preview-summary{display:grid;grid-template-columns:140px 1fr;gap:8px 12px;margin:16px 0;padding:14px;border-radius:14px;background:var(--surface2);border:1px solid var(--line)}
.backup-preview-summary dt{font-size:11px;font-weight:800;color:var(--muted);text-transform:uppercase;letter-spacing:.06em}
.backup-preview-summary dd{margin:0;font-weight:650}

/* ========== v1.0.22 — commercial micro-polish (Home / Reader / Memory) ========== */
:root{
  --space-1:6px;--space-2:10px;--space-3:14px;--space-4:18px;--space-5:24px;--space-6:32px;
  --type-xs:11px;--type-sm:13px;--type-md:15px;--type-lg:19px;--type-xl:clamp(28px,4.5vw,42px);
  --card-radius:20px;
  --elev-1:0 4px 14px rgba(15,23,42,.04);
  --elev-2:0 10px 28px rgba(15,23,42,.07);
  --motion-soft:160ms ease;
}
#homeScreen .section-heading{margin:var(--space-6) 2px var(--space-3)}
#homeScreen .continue-card,
#homeScreen .dictionary-card,
#homeScreen .learning-card,
#homeScreen .first-week-path-card,
#homeScreen .transfer-probe-home-card,
#homeScreen .bookmarks-card{
  border-radius:var(--card-radius);
  box-shadow:var(--elev-1);
  margin-top:var(--space-4);
}
#homeScreen .article-card{
  border-radius:var(--card-radius);
  box-shadow:var(--elev-1);
}
#homeScreen .hero-card{margin-bottom:var(--space-2)}
#homeScreen .library-grid{gap:var(--space-3)}

#readerScreen .reader-toolbar{margin-bottom:var(--space-3)}
#readerScreen .runtime-notice{
  border-radius:14px;box-shadow:var(--elev-1);
  transition:opacity var(--motion-soft),border-color var(--motion-soft);
}
#readerScreen .runtime-notice.ready{border-color:color-mix(in srgb,#16a34a 35%,var(--line))}
#readerScreen .reader-body{
  border-radius:22px;box-shadow:var(--elev-2);
}
#readerScreen .reader-mode-segment .mode-chip{
  transition:background var(--motion-soft),border-color var(--motion-soft),transform 120ms ease;
}

#learningScreen .learning-hero{margin-bottom:var(--space-4)}
#learningScreen .learning-stats>div,
#learningScreen .gap-plan-card,
#learningScreen .review-queue-card,
#learningScreen .evidence-integrity-card,
#learningScreen .activity-stats-card{
  border-radius:var(--card-radius);
  box-shadow:var(--elev-1);
}
#learningScreen .learning-row{
  border-radius:16px;box-shadow:none;
  transition:border-color var(--motion-soft),background var(--motion-soft);
}
#learningScreen .learning-stats strong{font-size:clamp(22px,4vw,28px);letter-spacing:-.03em}

.settings-card.trust-card{
  border:1px solid color-mix(in srgb,#2563eb 22%,var(--line));
  background:linear-gradient(160deg,var(--surface),color-mix(in srgb,var(--surface2) 70%,#eff6ff));
  box-shadow:var(--elev-2);
}
.trust-promise{
  margin:10px 0 0;padding:12px 14px;border-radius:14px;
  background:var(--surface2);color:var(--text);font-size:var(--type-sm);line-height:1.6;
}
.trust-promise strong{font-weight:850}
.about-version-meta{margin:12px 0 0;font-size:12px}
.about-local-first{margin-top:14px}

/* Soft screen fade (honors reduced-motion via global rule below) */
.screen.active{
  animation:haloScreenIn var(--motion-soft) both;
}
@keyframes haloScreenIn{
  from{opacity:.72;transform:translateY(4px)}
  to{opacity:1;transform:none}
}

/* Hide leftover lab-facing pulse flash once ready; keep calm ready state */
.runtime-notice.ready .pulse{animation:none;opacity:.85}
.runtime-notice:not(.ready):not(.degraded) .pulse{animation:haloPulse 1.4s ease-in-out infinite}
@keyframes haloPulse{
  0%,100%{transform:scale(1);opacity:1}
  50%{transform:scale(1.15);opacity:.7}
}

@media(prefers-reduced-motion:reduce){
  .screen.active{animation:none!important}
  .runtime-notice .pulse{animation:none!important}
  #readerScreen .reader-mode-segment .mode-chip,
  #learningScreen .learning-row,
  #readerScreen .runtime-notice{transition:none!important}
  #homeScreen .article-card:hover,
  #homeScreen .continue-card:hover,
  #homeScreen .learning-card:hover{transform:none}
}

:root[data-theme="dark"] .settings-card.trust-card,
:root[data-theme="night"] .settings-card.trust-card{
  background:linear-gradient(160deg,var(--surface),#1e293b);box-shadow:none;
}
:root[data-theme="sepia"] .settings-card.trust-card{
  background:linear-gradient(160deg,#f7ecd4,#efe0c0);
}


/* ========== v1.0.23 — flashcard commercial UX / import caps ========== */
.import-caps-note{margin:8px 0 0;font-size:12px;line-height:1.55}
.flashcard-progress{font-variant-numeric:tabular-nums;letter-spacing:.02em}
.flashcard-face.is-showing-back{background:color-mix(in srgb,var(--surface) 88%,#dbeafe)}
:root[data-theme="dark"] .flashcard-face.is-showing-back,
:root[data-theme="night"] .flashcard-face.is-showing-back{
  background:color-mix(in srgb,var(--surface) 85%,#1e3a5f)
}
@media(prefers-reduced-motion:reduce){
  .flashcard-face.is-flipping{transform:none!important}
}


/* ========== v1.0.24 — bookmarks / find / reading rhythm commercial ========== */
.highlight-color-swatches{display:inline-flex;align-items:center;gap:6px;margin-left:2px}
.hl-swatch{width:28px;height:28px;min-width:28px;border-radius:999px;border:2px solid var(--line);padding:0;cursor:pointer;box-shadow:inset 0 0 0 1px rgba(0,0,0,.06)}
.hl-swatch.is-active,.hl-swatch[aria-pressed="true"]{outline:2px solid var(--text);outline-offset:2px}
.hl-swatch--yellow{background:#facc15}
.hl-swatch--green{background:#4ade80}
.hl-swatch--blue{background:#60a5fa}
.hl-swatch--pink{background:#f472b6}
.hl-dot{flex-shrink:0;width:12px;height:12px;border-radius:999px;margin-top:6px;border:1px solid rgba(0,0,0,.12)}
.hl-dot--yellow{background:#facc15}
.hl-dot--green{background:#4ade80}
.hl-dot--blue{background:#60a5fa}
.hl-dot--pink{background:#f472b6}
.reader-highlight-row{align-items:flex-start}
.reader-highlights-empty,.bookmarks-empty{margin:8px 0 0;line-height:1.55}
.halo-resume-marker{display:flex;align-items:center;justify-content:space-between;gap:12px;max-width:820px;margin:0 auto 12px;padding:10px 14px;border-radius:14px;border:1px dashed color-mix(in srgb,var(--text) 22%,transparent);background:color-mix(in srgb,var(--surface) 70%,#fef3c7);color:var(--text);font-size:13px;font-weight:600}
.halo-resume-marker.hidden{display:none!important}
.halo-resume-marker .small-button{flex-shrink:0}
/* Theme-safe highlight contrast: day / sepia / night */
:root[data-theme="day"] mark.halo-highlight--yellow,:root[data-theme="light"] mark.halo-highlight--yellow{background:rgba(250,204,21,.5)}
:root[data-theme="day"] mark.halo-highlight--green,:root[data-theme="light"] mark.halo-highlight--green{background:rgba(34,197,94,.4)}
:root[data-theme="day"] mark.halo-highlight--blue,:root[data-theme="light"] mark.halo-highlight--blue{background:rgba(59,130,246,.4)}
:root[data-theme="day"] mark.halo-highlight--pink,:root[data-theme="light"] mark.halo-highlight--pink{background:rgba(236,72,153,.4)}
:root[data-theme="sepia"] mark.halo-highlight--yellow{background:rgba(202,138,4,.5)}
:root[data-theme="sepia"] mark.halo-highlight--green{background:rgba(22,163,74,.42)}
:root[data-theme="sepia"] mark.halo-highlight--blue{background:rgba(37,99,235,.4)}
:root[data-theme="sepia"] mark.halo-highlight--pink{background:rgba(219,39,119,.4)}
:root[data-theme="night"] mark.halo-highlight--yellow,:root[data-theme="dark"] mark.halo-highlight--yellow{background:rgba(234,179,8,.45)}
:root[data-theme="night"] mark.halo-highlight--green,:root[data-theme="dark"] mark.halo-highlight--green{background:rgba(74,222,128,.35)}
:root[data-theme="night"] mark.halo-highlight--blue,:root[data-theme="dark"] mark.halo-highlight--blue{background:rgba(96,165,250,.38)}
:root[data-theme="night"] mark.halo-highlight--pink,:root[data-theme="dark"] mark.halo-highlight--pink{background:rgba(244,114,182,.38)}
:root[data-theme="sepia"] .halo-resume-marker{background:color-mix(in srgb,#efe2c4 80%,#fde68a)}
:root[data-theme="night"] .halo-resume-marker,:root[data-theme="dark"] .halo-resume-marker{background:color-mix(in srgb,var(--surface) 75%,#713f12);border-color:rgba(253,224,71,.35)}
/* Find bar + resume marker stay usable in immerse / parallel / focus */
body.reader-immerse .reader-find-bar:not(.hidden),
body.reader-parallel .reader-find-bar:not(.hidden),
body.reader-focus .reader-find-bar:not(.hidden){display:flex!important;position:sticky;top:0;z-index:40}
body.reader-immerse .halo-resume-marker:not(.hidden),
body.reader-parallel .halo-resume-marker:not(.hidden),
body.reader-focus .halo-resume-marker:not(.hidden){display:flex!important}
body.reader-immerse mark.halo-highlight,
body.reader-parallel mark.halo-highlight,
body.reader-focus mark.halo-highlight{/* keep highlight visibility in all modes */}
body.reader-immerse mark.halo-find-hit,
body.reader-parallel mark.halo-find-hit{background:rgba(251,191,36,.4)}
@media(prefers-reduced-motion:reduce){
  mark.halo-find-hit--active{transition:none}
  .halo-resume-marker{transition:none}
}

/* ========== v1.0.25 — activity stats / review dash / offline / storage pressure ========== */
.home-activity-strip,.home-review-dash{margin:14px 0 0;padding:16px 18px;border:1px solid var(--line);border-radius:18px;background:var(--surface)}
.home-activity-strip-grid,.home-review-dash-grid,.review-dash-grid{display:grid;grid-template-columns:repeat(4,1fr);gap:10px;margin-top:12px}
.home-review-dash-grid,.review-dash-grid{grid-template-columns:repeat(3,1fr)}
.home-activity-cell,.home-review-dash-cell,.review-dash-cell,.activity-stat{border:1px solid var(--line);border-radius:14px;padding:12px 14px;background:var(--surface2)}
.home-activity-cell strong,.home-review-dash-cell strong,.review-dash-cell strong,.activity-stat strong{display:block;font-size:22px;letter-spacing:-.03em}
.home-activity-cell span,.home-review-dash-cell span,.review-dash-cell span,.activity-stat span{display:block;margin-top:4px;font-size:11px;color:var(--muted);font-weight:750}
.home-review-dash-head{display:flex;align-items:flex-start;justify-content:space-between;gap:14px}
.home-review-dash-head h2{margin:2px 0 4px;font-size:18px}
.activity-stats-empty{margin-top:12px}
.activity-stats-grid.hidden,.home-activity-strip-grid.hidden{display:none!important}
.offline-banner-surfaces{display:block;width:100%;font-size:11px;opacity:.9}
.sw-update-banner,.storage-pressure-banner{display:flex;align-items:center;justify-content:space-between;gap:12px;flex-wrap:wrap;margin:0 0 12px;padding:12px 14px;border-radius:14px;border:1px solid var(--line);background:var(--surface)}
.sw-update-banner.hidden,.storage-pressure-banner.hidden,.home-activity-strip.hidden,.home-review-dash.hidden{display:none!important}
.sw-update-banner{border-color:#3b82f655;background:color-mix(in srgb,var(--surface) 88%,#dbeafe)}
.storage-pressure-banner{border-color:#f59e0b66;background:color-mix(in srgb,var(--surface) 86%,#fef3c7)}
.storage-pressure-banner[data-level="critical"]{border-color:#dc262688;background:color-mix(in srgb,var(--surface) 82%,#fee2e2)}
.storage-pressure-copy{flex:1;min-width:200px}.storage-pressure-copy p{margin:4px 0 0;font-size:12px;line-height:1.5}
.storage-pressure-actions{display:flex;gap:8px;flex-wrap:wrap}
.storage-status--pressure{border:1px solid #f59e0b66;color:#92400e}
body.is-offline .import-url-hint,body.is-offline #fetchUrlButton{opacity:.72}
@media(max-width:720px){
  .home-activity-strip-grid,.home-review-dash-grid,.review-dash-grid{grid-template-columns:1fr 1fr}
  .home-review-dash-head{flex-direction:column}
}

/* v1.0.26 — Wave23-complete Memory IA / continue snippet / EPUB chapters / bookmark notes */
.continue-snippet{margin:4px 0 6px;font-size:13px;line-height:1.45;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden;max-width:42rem}
.continue-soft-note{margin:8px 0 0;font-size:11px}
.memory-ia-controls{display:flex;flex-wrap:wrap;gap:8px;align-items:center}
.memory-ia-label{display:inline-flex;align-items:center;gap:6px;font-size:12px;color:var(--muted)}
.memory-ia-label select{min-height:40px}
.memory-ia-disclaimer{margin:6px 0 10px;font-size:12px;line-height:1.45}
.epub-chapter-nav{margin:0 0 12px;padding:10px 12px;border:1px solid var(--line);border-radius:14px;background:var(--surface2)}
.epub-chapter-nav.hidden{display:none!important}
.epub-chapter-nav-head{display:flex;align-items:center;justify-content:space-between;gap:10px}
.epub-chapter-list{margin:10px 0 0;padding:0;list-style:none;display:grid;gap:6px;max-height:220px;overflow:auto}
.epub-chapter-list[hidden]{display:none!important}
.epub-chapter-item{width:100%;text-align:left;min-height:40px;padding:8px 10px;border:1px solid var(--line);border-radius:10px;background:var(--surface);font-size:13px}
.epub-chapter-item.is-current{border-color:#2563eb;background:color-mix(in srgb,var(--surface) 70%,#dbeafe)}
.bookmark-row--article{display:flex;align-items:flex-start;justify-content:space-between;gap:10px;width:100%}
.bookmark-row-main{flex:1;min-width:0}
.bookmark-row-main .bookmark-jump{width:100%;text-align:left;background:transparent;border:0;padding:0;cursor:pointer}
.bookmark-row-tools{display:flex;flex-wrap:wrap;gap:6px}
.danger-quiet{color:#b91c1c}
.offline-banner-surfaces{display:block;width:100%;margin-top:2px;font-size:11px}
@media(prefers-reduced-motion:reduce){.continue-snippet,.epub-chapter-item{transition:none}}


/* ========== v1.0.26 — EPUB chapter nav + Memory IA hierarchy ========== */
.epub-chapter-nav-actions{display:flex;align-items:center;justify-content:space-between;gap:8px;margin-top:8px}
.epub-chapter-pos{flex:1;text-align:center;font-size:12px;font-weight:650;line-height:1.35}
.epub-chapter-nav-actions .small-button{min-width:72px}
.memory-section-label{margin:18px 0 8px;font-size:11px;font-weight:800;letter-spacing:.04em;text-transform:uppercase}
.memory-lab-details{margin:14px 0 18px;padding:14px 16px;border:1px solid var(--line);border-radius:18px;background:var(--surface2)}
.memory-lab-details>summary{cursor:pointer;list-style:none;display:flex;flex-wrap:wrap;align-items:baseline;gap:8px 12px}
.memory-lab-details>summary::-webkit-details-marker{display:none}
.memory-lab-details>summary strong{font-size:15px}
.memory-lab-hint{font-size:12px}
.memory-lab-body{margin-top:12px}
.memory-lab-body .evidence-integrity-card,
.memory-lab-body .gap-plan-card{margin:0 0 12px;box-shadow:none}
#learningScreen .review-queue-card{order:1}
#learningScreen .memory-ia-controls{margin-top:4px}
@media(prefers-reduced-motion:reduce){.epub-chapter-nav-actions .small-button{transition:none}}

/* ========== v1.0.27–1.0.28 — Wave26 word sheet + Wave27 a11y/sideload ========== */
.word-quick-actions{display:flex;flex-wrap:wrap;gap:8px;margin:14px 0 4px}
.word-quick-actions .small-button{min-height:40px;padding:8px 12px;font-weight:750}
.word-action-know{background:#ecfdf5;color:#166534}
.word-action-again{background:#fff7ed;color:#9a3412}
.word-secondary-senses{margin:10px 0 0;padding:12px 14px;border:1px solid var(--line);border-radius:14px;background:var(--surface2)}
.word-secondary-label{margin:0 0 8px;font-size:11px;font-weight:800;letter-spacing:.08em;text-transform:uppercase;color:var(--muted)}
.word-secondary-list{margin:0;padding-left:1.2em;display:grid;gap:6px}
.word-secondary-list li{font-size:14px;line-height:1.45;color:var(--text)}
.word-sheet[data-lookup-state="direct"] .word-primary{background:linear-gradient(135deg,#111827,#273244)}
.word-sheet[data-lookup-state="builtin-hf"] .word-primary{background:linear-gradient(135deg,#1e3a5f,#334155)}
.word-sheet[data-lookup-state="fallback"] .word-primary,
.word-primary[data-kind="fallback"]{background:linear-gradient(135deg,#9a3412,#c2410c)}
.word-sheet[data-lookup-state="miss"] .sheet-card{box-shadow:0 -12px 40px rgba(154,52,18,.12)}
.word-sheet[data-lookup-state="builtin-hf"] .source-badge,
.source-badge.builtin-hf{background:#1e3a5f;color:#bfdbfe}
:root[data-theme="dark"] .word-action-know,:root[data-theme="system"] .word-action-know{background:#14532d;color:#bbf7d0}
:root[data-theme="dark"] .word-action-again,:root[data-theme="system"] .word-action-again{background:#3b2410;color:#fdba74}
@media(max-width:420px){
  .word-quick-actions{gap:6px}
  .word-quick-actions .small-button{flex:1 1 calc(50% - 6px)}
}


/* ========== v1.0.29 — Wave27 find / finished / settings search / touch / large ========== */
.reader-find-bar { display: flex; flex-wrap: wrap; gap: 0.4rem; align-items: center; padding: 0.45rem 0.75rem; background: color-mix(in srgb, var(--surface, #fff) 92%, var(--accent, #3b82f6)); border-bottom: 1px solid var(--border, #e5e7eb); position: sticky; top: 0; z-index: 5; }
.reader-find-bar.hidden { display: none; }
.reader-find-bar input[type="search"] { flex: 1 1 10rem; min-width: 8rem; }
.reader-find-count { font-variant-numeric: tabular-nums; font-size: 0.85rem; color: var(--muted, #6b7280); min-width: 3.5rem; }
mark.halo-find-hit { background: color-mix(in srgb, #fbbf24 55%, transparent); border-radius: 2px; }
mark.halo-find-hit--active { background: color-mix(in srgb, #f59e0b 80%, transparent); outline: 2px solid #d97706; }
.settings-search-bar { margin: 0 0 0.75rem; }
.settings-search-bar input[type="search"] { width: 100%; }
.settings-card--filtered-out, .settings-card[hidden] { display: none !important; }
.settings-search-empty { margin: 0.35rem 0 0; font-size: 0.9rem; }
.article-card--finished { position: relative; }
.article-finished-badge { position: absolute; top: 0.55rem; right: 0.65rem; font-size: 0.7rem; padding: 0.1rem 0.4rem; border-radius: 999px; background: color-mix(in srgb, #10b981 22%, transparent); color: #047857; font-weight: 600; }
[data-theme="night"] .article-finished-badge { color: #6ee7b7; background: color-mix(in srgb, #10b981 28%, transparent); }
button#markFinishedButton[aria-pressed="true"] { background: color-mix(in srgb, #10b981 18%, transparent); }
@media (prefers-reduced-motion: reduce) {
  mark.halo-find-hit--active { transition: none; }
}


/* ========== v1.0.30 — distraction-free focus + polish ========== */
body.reader-focus-deep .topbar { display: none !important; }
body.reader-focus-deep .reader-toolbar .reader-actions > *:not(#focusModeButton):not(#readerProgressText) { display: none !important; }
body.reader-focus-deep .reader-toolbar .reader-title-block .eyebrow { display: none; }
body.reader-focus-deep .reader-toolbar {
  position: sticky; top: 0; z-index: 36;
  justify-content: space-between;
  max-width: none;
  margin: 0 -22px 12px;
  padding: 10px max(22px, calc((100vw - 820px) / 2));
  background: color-mix(in srgb, var(--surface2) 90%, transparent);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--line);
}
body.reader-focus-deep .reader-toolbar .reader-actions {
  flex-wrap: nowrap;
  gap: 8px;
}
body.reader-focus-deep .runtime-notice,
body.reader-focus-deep .reader-mode-segment,
body.reader-focus-deep .reader-advanced,
body.reader-focus-deep .reader-action-divider,
body.reader-focus-deep #readerHighlightsPanel,
body.reader-focus-deep #articleLexiconPanel,
body.reader-focus-deep #epubChapterNav,
body.reader-focus-deep #parallelDraftHost { display: none !important; }
body.reader-focus-deep .reader-body {
  border-color: transparent;
  box-shadow: none;
  border-radius: 12px;
  min-height: 82vh;
  max-width: min(var(--readerMaxWidth, 680px), 100%);
  line-height: 2.08;
}
body.reader-focus-deep .progress-track { height: 3px; opacity: 0.85; }
/* Find bar still usable when opened in focus */
body.reader-focus-deep .reader-find-bar:not(.hidden) { display: flex !important; position: sticky; top: 0; z-index: 40; }
.focus-exit-chip {
  position: fixed;
  top: max(10px, env(safe-area-inset-top));
  right: max(12px, env(safe-area-inset-right));
  z-index: 60;
  border: 1px solid var(--line);
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: blur(12px);
  color: var(--text);
  border-radius: 999px;
  padding: 8px 14px;
  font-size: 12px;
  font-weight: 750;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.12);
}
.focus-exit-chip.hidden,
.focus-exit-chip[hidden] { display: none !important; }
body.reader-focus-deep .focus-exit-chip:not(.hidden) { display: inline-flex; align-items: center; gap: 6px; }
@media (max-width: 760px) {
  body.reader-focus-deep .reader-toolbar { margin: 0 -14px 10px; padding: 8px 14px; }
  body.reader-focus-deep .reader-toolbar .reader-title-block h1 { font-size: 22px; }
}
@media (prefers-reduced-motion: reduce) {
  .focus-exit-chip { transition: none; }
}


/* ========== v1.0.33 — Wave31 library org: bulk tag/export, article notes, filter empty ========== */
.library-bulk-bar{display:flex;flex-wrap:wrap;align-items:center;gap:8px;margin:0 0 12px;padding:10px 12px;border:1px solid var(--line);border-radius:14px;background:var(--surface2)}
.library-bulk-bar.hidden{display:none!important}
.library-controls #librarySelectModeButton[aria-pressed="true"]{background:#111827;color:#fff;border-color:#111827}
.article-card-wrap.select-mode{position:relative}
.article-card-wrap.select-mode .article-select-check{position:absolute;top:10px;left:10px;z-index:2;width:22px;height:22px;accent-color:#2563eb}
.article-card-wrap.is-selected .article-card{outline:2px solid #2563eb;outline-offset:2px}
.article-card .article-tag-chips{display:flex;flex-wrap:wrap;gap:4px;margin:6px 0 0}
.article-card .article-tag-chip{font-size:10px;font-weight:700;padding:2px 7px;border-radius:999px;background:var(--surface2);border:1px solid var(--line);color:var(--muted)}
.tag-chip-list{display:flex;flex-wrap:wrap;gap:8px;margin:10px 0 14px;min-height:28px}
.tag-chip{display:inline-flex;align-items:center;gap:6px;padding:5px 10px;border-radius:999px;border:1px solid var(--line);background:var(--surface);font-size:12px;font-weight:700}
.tag-chip button{border:0;background:transparent;color:#a51d25;cursor:pointer;font-size:14px;line-height:1;padding:0 2px}
.probe-summary-card{margin:12px 0;padding:14px 16px;border-radius:16px;border:1px solid #93c5fd;background:color-mix(in srgb,var(--surface) 90%,#dbeafe)}
.probe-summary-card.hidden{display:none!important}
.probe-summary-head{display:flex;align-items:center;justify-content:space-between;gap:10px}
.probe-summary-head h2{margin:0;font-size:17px}
.probe-summary-body{margin:8px 0;font-size:14px;line-height:1.5}
.probe-summary-honesty{margin:0 0 8px;font-size:12px}
.probe-summary-actions{display:flex;gap:8px;flex-wrap:wrap;margin-top:10px}
.sw-update-banner strong{font-size:13px}

/* ========== v1.0.31 — word sheet secondary collapse / copy / flash deep-link ========== */
.word-secondary-senses{margin:10px 0 0;padding:0;border:1px solid var(--line);border-radius:14px;background:var(--surface2);overflow:hidden}
.word-secondary-toggle{width:100%;display:flex;align-items:center;gap:8px;padding:10px 14px;border:0;background:transparent;cursor:pointer;text-align:left;color:inherit;font:inherit}
.word-secondary-toggle:focus-visible{outline:2px solid #2563eb;outline-offset:-2px}
.word-secondary-label{margin:0;font-size:11px;font-weight:800;letter-spacing:.08em;text-transform:uppercase;color:var(--muted)}
.word-secondary-count{font-size:12px;font-weight:700;color:var(--muted);margin-left:auto}
.word-secondary-chevron{font-size:10px;color:var(--muted);transition:transform .15s ease}
.word-secondary-senses:not(.is-collapsed) .word-secondary-chevron{transform:rotate(180deg)}
.word-secondary-list{margin:0;padding:0 14px 12px 1.8em;display:grid;gap:6px}
.word-secondary-list[hidden]{display:none!important}
.word-secondary-list li{font-size:14px;line-height:1.45;color:var(--text)}
.word-sheet[data-lookup-cached="1"] .source-note{opacity:.92}


/* ========== v1.0.33 — Wave30 recent lookups / Story UX / daily goal / parallel editor / miss follow-ups ========== */
.recent-lookups-panel{margin:0 0 16px;padding:12px 14px;border:1px solid var(--line);border-radius:16px;background:var(--surface)}
.recent-lookups-panel .section-heading.compact{display:flex;align-items:flex-start;justify-content:space-between;gap:12px;margin-bottom:8px}
.recent-lookups-list{list-style:none;margin:0;padding:0;display:flex;flex-direction:column;gap:6px}
.recent-lookup-button{width:100%;text-align:left;display:flex;flex-direction:column;gap:2px;padding:10px 12px;border:1px solid var(--line);border-radius:12px;background:var(--surface2);cursor:pointer}
.recent-lookup-button:focus-visible{outline:2px solid var(--accent,#5b8cff);outline-offset:2px}
.recent-lookup-button strong{font-size:1rem}
.recent-lookups-empty.hidden{display:none!important}
.reading-goal-chip{display:inline-flex;align-items:center;padding:4px 10px;border-radius:999px;border:1px solid var(--line);background:var(--surface2);font-size:.85rem}
.reading-goal-chip.hidden{display:none!important}
.reading-goal-chip.is-met{border-color:color-mix(in srgb, var(--accent,#5b8cff) 45%, var(--line))}
.story-completion-banner{margin:10px 0 12px;padding:12px 14px;border-radius:14px;border:1px solid var(--line);background:color-mix(in srgb, var(--surface2) 88%, var(--accent,#5b8cff) 12%)}
.story-completion-banner.hidden{display:none!important}
.story-completion-honesty{margin:.35rem 0 0}
.parallel-pairs-editor{display:flex;flex-direction:column;gap:10px;max-height:min(50vh,360px);overflow:auto;margin:8px 0}
.parallel-pair-edit-row{display:grid;grid-template-columns:1fr 1fr auto;gap:8px;align-items:start}
.parallel-pair-edit-row textarea{width:100%;min-height:3.2em;resize:vertical;border-radius:10px;border:1px solid var(--line);padding:8px;font:inherit;background:var(--surface)}
.word-empty-actions{display:flex;flex-wrap:wrap;gap:8px;margin-top:8px}
@media (max-width:640px){
  .parallel-pair-edit-row{grid-template-columns:1fr; }
}

.library-filter-empty-card{margin:8px 0 14px;padding:18px 16px;border:1px dashed var(--line);border-radius:16px;background:var(--surface2);text-align:center}
.library-filter-empty-card.hidden{display:none!important}
.library-filter-empty-card h3{margin:6px 0 4px;font-size:16px}
.library-filter-empty-card .empty-actions{justify-content:center;margin-top:10px}
.field-label{display:block;margin:12px 0 6px;font-size:13px;font-weight:700}
.tiny-note{font-size:12px;margin:6px 0 0}
#articleNotesInput,#bulkTagInput{width:100%;box-sizing:border-box}
#articleNotesInput{min-height:72px;resize:vertical;border:1px solid var(--line);border-radius:12px;padding:10px 12px;background:var(--surface);color:inherit;font:inherit}
.library-bulk-bar .small-button:disabled{opacity:.45;cursor:not-allowed}
