:root{--ink:#172b2a;--muted:#6e7e7b;--paper:#fffefa;--line:#e2e9e5;--blue:#176b62;--orange:#e58252;--green:#1d8b70;--soft:#eef7f3;--shadow:0 16px 50px rgba(27,67,58,.09)}
[hidden],.completion-panel[hidden],.empty[hidden]{display:none!important}
html{scroll-behavior:smooth}body{min-height:100vh;background:radial-gradient(circle at 8% 0,#e4f3ec 0,transparent 32%),radial-gradient(circle at 92% 10%,#fff0df 0,transparent 27%),#f7f8f5;color:var(--ink)}
body:before{content:"";position:fixed;inset:0;pointer-events:none;opacity:.22;background-image:radial-gradient(#7c9c91 .55px,transparent .55px);background-size:18px 18px;z-index:-1}.app{max-width:880px;padding-top:28px}
header{align-items:center;border:1px solid rgba(255,255,255,.75);border-radius:22px;padding:20px 22px;background:rgba(255,255,255,.72);box-shadow:0 10px 35px rgba(41,73,64,.07);backdrop-filter:blur(15px);-webkit-backdrop-filter:blur(15px)}
.brand h1{font-size:31px;letter-spacing:-.6px}.brand-subtitle{margin:7px 0 0;color:var(--muted);font-size:13px}.eyebrow{color:#d96e3d;letter-spacing:2px}.header-actions{flex-wrap:wrap;justify-content:flex-end}.quiet,.file-label{background:#eef3f1;color:#38544e;border:1px solid transparent;transition:transform .16s ease,background .16s ease,box-shadow .16s ease}.quiet:hover,.file-label:hover{background:#e3eee9;transform:translateY(-1px)}
.mode-tabs{width:max-content;background:#edf3f0;border:1px solid #e2ebe7;border-radius:14px;padding:4px;margin:18px 0 13px;gap:2px}.mode-tabs .tab{display:flex;align-items:center;gap:7px;border:0!important;border-radius:10px;margin:0;padding:10px 17px;color:#667b75}.mode-tabs .tab.active{background:#fff;color:var(--green);box-shadow:0 4px 16px rgba(30,84,69,.1)}.mode-tabs .tab span{font-size:13px}
.course-tabs{display:grid;grid-template-columns:1fr 1fr;gap:10px;margin:3px 0 13px}.course-tab{min-height:50px;border:1px solid #dce7e2;background:rgba(255,255,255,.72);color:#667b75;border-radius:15px;font-size:16px;box-shadow:0 5px 18px rgba(36,68,59,.035);transition:.16s}.course-tab:hover{transform:translateY(-1px);border-color:#bcd8cd}.course-tab.active{color:#fff;border-color:transparent;background:linear-gradient(135deg,#217f6b,#3ca087);box-shadow:0 10px 25px rgba(32,126,105,.2)}
.toolbar{background:rgba(255,255,255,.68);border:1px solid rgba(223,232,227,.9);border-radius:16px;padding:13px 15px;margin-bottom:13px}.toolbar label{font-weight:600}.toolbar select,.library-toolbar select{border-color:#dae5df;background:#fffefa;border-radius:10px;outline:none}.toolbar select:focus,.library-toolbar select:focus{border-color:#69a995;box-shadow:0 0 0 3px #dff2eb}
.chapter-field{position:relative;display:grid;gap:7px;min-width:220px;font-size:13px;color:var(--muted);font-weight:600}.field-label{display:block}.chapter-picker-toggle{display:flex;align-items:center;justify-content:space-between;gap:16px;min-height:38px;padding:8px 12px;border:1px solid #dae5df;border-radius:10px;background:#fffefa;color:var(--ink);font-weight:600;text-align:left}.chapter-picker-toggle:after{content:'⌄';color:#71877d;font-size:16px}.chapter-picker-menu{position:absolute;top:calc(100% + 7px);left:0;z-index:20;width:min(380px,calc(100vw - 44px));max-height:min(66vh,430px);overflow:auto;padding:12px;border:1px solid #d6e4dc;border-radius:14px;background:#fffffdf7;box-shadow:0 14px 34px rgba(31,73,58,.16);backdrop-filter:blur(12px)}.chapter-menu-head{display:flex;align-items:center;justify-content:space-between;gap:10px;padding-bottom:9px;border-bottom:1px solid #e7efeb;color:#28584b}.chapter-menu-head button{padding:6px 9px;font-size:12px}.chapter-options{display:grid;gap:3px;padding:8px 0}.chapter-options label{display:flex;align-items:flex-start;gap:9px;padding:8px 6px;border-radius:9px;color:#31473f;font-size:13px;font-weight:500;cursor:pointer}.chapter-options label:hover{background:#edf7f2}.chapter-options input{width:17px;height:17px;margin:0;accent-color:#318464;flex:0 0 auto}.chapter-menu-hint{margin:4px 0 0;padding-top:9px;border-top:1px solid #e7efeb;color:#718078;font-size:11px;line-height:1.55}
.today-dashboard{gap:12px}.today-dashboard div{position:relative;overflow:hidden;border-color:#e4ebe7;border-radius:16px;padding:16px 17px;background:rgba(255,255,255,.86);box-shadow:0 8px 24px rgba(34,72,62,.045)}.today-dashboard div:after{content:"";position:absolute;width:54px;height:54px;border-radius:50%;right:-20px;top:-22px;background:#dff2ea}.today-dashboard div:nth-child(2):after{background:#ffeadc}.today-dashboard div:nth-child(3):after{background:#f7e3dd}.today-dashboard div:nth-child(4):after{background:#e5eaf7}.today-dashboard div:nth-child(5):after{background:#ede6f5}.today-dashboard strong{font-size:22px;color:#24433d}.today-dashboard span{font-weight:600;letter-spacing:.15px}
.progress-panel{border:1px solid #dce9e3;background:linear-gradient(110deg,#edf7f2,#f8fbf9);border-radius:16px;padding:15px 17px;margin-bottom:18px}.bar{height:8px;background:#d9e8e1}.bar i{background:linear-gradient(90deg,#27a17f,#57b895);box-shadow:0 0 10px #43aa8b55}
.card{position:relative;min-height:300px;border:1px solid rgba(224,230,224,.9);border-radius:22px;background:linear-gradient(145deg,#fffefa,#fff);box-shadow:var(--shadow);padding:34px 36px;overflow:hidden}.card:before{content:"";position:absolute;width:190px;height:190px;border-radius:50%;right:-95px;bottom:-110px;background:linear-gradient(145deg,#e6f5ef,#fff3e7);opacity:.85}.card:hover{border-color:#c9ded5;box-shadow:0 20px 60px rgba(27,67,58,.13);transform:translateY(-2px)}.card-side{display:inline-flex;background:#fff0e6;color:#d46d3f;border-radius:99px;padding:6px 10px;letter-spacing:.7px}.card-content{font-size:27px;letter-spacing:-.2px;position:relative}.tap{display:flex;align-items:center;gap:6px;color:#82908c}.tap:before{content:"↻";font-size:16px}
.answer{border:1px solid #d9e8e2;background:linear-gradient(145deg,#f2faf7,#f7fbfa);border-radius:20px;padding:25px 26px;box-shadow:0 10px 30px rgba(38,85,70,.055)}.answer-title{color:#d96e3d}.grade-row{gap:10px}.grade-row button{border-radius:12px;min-height:46px;box-shadow:0 7px 18px rgba(37,66,58,.1);transition:transform .14s ease,filter .14s ease}.grade-row button:hover{transform:translateY(-2px);filter:brightness(1.03)}.grade-row button:active{transform:scale(.97)}.again{background:#df7650}.fuzzy{background:#dba12d}.good{background:linear-gradient(135deg,#218d71,#3fa889)}
.nav{padding:2px 3px}.nav #position{font-variant-numeric:tabular-nums;font-weight:700;color:#7b8a86}.memory-aid{border:1px solid #eadfce!important;border-radius:17px!important;background:#fffaf2!important;box-shadow:0 8px 25px rgba(96,70,35,.05)}
.library-head{background:rgba(255,255,255,.7);border:1px solid #e2eae6;border-radius:20px;padding:22px 24px;margin-top:13px}.pie:after{background:#fff}.library-toolbar{border:0;background:#f0f5f2;border-radius:14px;padding:12px 14px;margin:13px 0}.library-card{border-color:#e2e9e5;border-radius:15px;background:rgba(255,255,255,.88);padding:17px 16px;box-shadow:0 5px 18px rgba(36,68,59,.04);transition:transform .15s ease,border-color .15s ease,box-shadow .15s ease}.library-card:hover{transform:translateY(-1px);border-color:#bfd8cd;box-shadow:0 10px 28px rgba(36,68,59,.08)}
.sync-dialog{border:1px solid #dce7e2;background:linear-gradient(145deg,#fff,#f8fbfa)}.empty{border:1px solid #f1dfbd;background:#fff8e9}.help{border-top:1px solid #e2e9e5;padding-top:18px}
button:focus-visible,select:focus-visible,input:focus-visible,summary:focus-visible{outline:3px solid #86cbb6;outline-offset:2px}@media(prefers-reduced-motion:reduce){*{scroll-behavior:auto!important;transition:none!important;animation:none!important}}
@media(max-width:600px){.course-tabs{gap:7px}.course-tab{min-height:46px;font-size:15px}}
@media(max-width:600px){body{background:linear-gradient(180deg,#edf7f2 0,#f7f8f5 260px)}body:before{display:none}.app{padding:12px 11px calc(90px + env(safe-area-inset-bottom))}header{border-radius:18px;padding:17px 16px;gap:14px}.brand h1{font-size:25px}.brand-subtitle{margin-top:4px}.header-actions{display:grid;grid-template-columns:1fr 1fr;width:100%}.header-actions button{min-height:43px}.mode-tabs{position:sticky;top:7px;z-index:4;width:100%;margin:11px 0;padding:4px;background:rgba(237,243,240,.92);box-shadow:0 8px 25px rgba(34,67,58,.08)}.mode-tabs .tab{justify-content:center;padding:10px 8px}.toolbar{padding:11px;border-radius:14px}.today-dashboard{gap:8px}.today-dashboard div{padding:13px 14px;border-radius:14px}.progress-panel{border-radius:14px}.card{min-height:46vh;border-radius:19px;padding:25px 21px}.card-content{font-size:24px;line-height:1.58}.answer{border-radius:17px;padding:20px 16px}.grade-row button{min-height:50px}.library-head{padding:18px 16px;border-radius:17px}.library-card{border-radius:14px}.sync-dialog{border-radius:20px 20px 0 0;width:100%;max-width:none;margin:auto 0 0;padding-bottom:calc(18px + env(safe-area-inset-bottom))}}
.chapter-field{grid-column:1/-1}.chapter-picker-toggle{min-height:42px}.chapter-picker-menu{width:min(420px,calc(100vw - 42px))}

/* 深色主题：保持阅读层次和公式、图片的对比度，不改变学习数据。 */
html[data-theme="dark"]{color-scheme:dark}
html[data-theme="dark"] body{--ink:#e7f1ee;--muted:#9cafaa;--paper:#1b2927;--line:#344a45;--blue:#79d0bb;--orange:#f0a171;--green:#5bc6a0;--soft:#1c302b;--shadow:0 18px 55px rgba(0,0,0,.28);background:radial-gradient(circle at 8% 0,#173b34 0,transparent 34%),radial-gradient(circle at 92% 10%,#3d2a21 0,transparent 28%),#101817;color:var(--ink)}
html[data-theme="dark"] body:before{opacity:.12;background-image:radial-gradient(#8db3a7 .55px,transparent .55px)}
html[data-theme="dark"] header{border-color:#31453f;background:rgba(24,38,35,.88);box-shadow:0 12px 38px rgba(0,0,0,.2)}
html[data-theme="dark"] .eyebrow{color:#f0a171}html[data-theme="dark"] .brand-subtitle{color:#9cafaa!important}
html[data-theme="dark"] .mode-tabs{background:#182824;border-color:#2c423c}html[data-theme="dark"] .mode-tabs .tab{color:#92aaa2}html[data-theme="dark"] .mode-tabs .tab.active{background:#29443c;color:#70d2b1;box-shadow:0 4px 16px rgba(0,0,0,.2)}
html[data-theme="dark"] .course-tab{border-color:#304840;background:rgba(29,47,43,.78);color:#a7bcb5}html[data-theme="dark"] .course-tab.active{color:#09221b;background:linear-gradient(135deg,#53c09e,#77d2b4)}
html[data-theme="dark"] .toolbar{border-color:#30463f;background:rgba(25,42,38,.84)}html[data-theme="dark"] .toolbar label,html[data-theme="dark"] .field-label{color:#a6b9b2}html[data-theme="dark"] select,html[data-theme="dark"] .chapter-picker-toggle{border-color:#3b554d;background:#1c302c;color:#e7f1ee}html[data-theme="dark"] select:focus,html[data-theme="dark"] .chapter-picker-toggle:focus{border-color:#65c6a7;box-shadow:0 0 0 3px rgba(70,177,143,.2)}
html[data-theme="dark"] .quiet,html[data-theme="dark"] .file-label{background:#253a35;border-color:#39534a;color:#c4d8d1}html[data-theme="dark"] .quiet:hover,html[data-theme="dark"] .file-label:hover{background:#2f4941}
html[data-theme="dark"] .chapter-picker-menu{border-color:#3b554d;background:rgba(24,42,37,.98);box-shadow:0 16px 38px rgba(0,0,0,.38)}html[data-theme="dark"] .chapter-menu-head{border-color:#344a43;color:#9fe0c7}html[data-theme="dark"] .chapter-options label{color:#d1e2dc}html[data-theme="dark"] .chapter-options label:hover{background:#29453d}html[data-theme="dark"] .chapter-menu-hint{border-color:#344a43;color:#91aaa1}
html[data-theme="dark"] .today-dashboard div{border-color:#304840;background:#1b2d29;box-shadow:0 8px 24px rgba(0,0,0,.18)}html[data-theme="dark"] .today-dashboard strong{color:#d8eee7}html[data-theme="dark"] .today-dashboard span{color:#9cafaa}html[data-theme="dark"] .today-dashboard div:after{background:#254a3f}html[data-theme="dark"] .today-dashboard div:nth-child(2):after{background:#51362a}html[data-theme="dark"] .today-dashboard div:nth-child(3):after{background:#493236}html[data-theme="dark"] .today-dashboard div:nth-child(4):after{background:#303c58}html[data-theme="dark"] .today-dashboard div:nth-child(5):after{background:#3d3648}
html[data-theme="dark"] .progress-panel{border-color:#335148;background:linear-gradient(110deg,#1a332d,#20312e)}html[data-theme="dark"] .progress-copy span{color:#9cafaa}html[data-theme="dark"] .bar{background:#30483f}
html[data-theme="dark"] .card{border-color:#344d46;background:linear-gradient(145deg,#1c2c29,#172522);box-shadow:var(--shadow)}html[data-theme="dark"] .card:before{background:linear-gradient(145deg,#21483d,#483529);opacity:.7}html[data-theme="dark"] .card:hover{border-color:#4f8b76;box-shadow:0 20px 60px rgba(0,0,0,.35)}html[data-theme="dark"] .card-side{background:#493228;color:#ffc09a}html[data-theme="dark"] .tap{color:#9cafaa}
html[data-theme="dark"] .answer{border-color:#35554b;background:linear-gradient(145deg,#1c3830,#20312e);box-shadow:0 10px 30px rgba(0,0,0,.2)}html[data-theme="dark"] .answer-content,html[data-theme="dark"] .answer-content p,html[data-theme="dark"] .answer-content li{color:#e1eee9}html[data-theme="dark"] .self-check{color:#9cafaa}html[data-theme="dark"] .memory-aid{border-color:#5a4b35!important;background:#342d22!important;color:#eee1c9!important}
html[data-theme="dark"] .nav,html[data-theme="dark"] .nav #position{color:#9cafaa}html[data-theme="dark"] .empty{border-color:#725431;background:#392d1d;color:#f2d09b}html[data-theme="dark"] .help{border-color:#344a43;color:#a5b8b1}html[data-theme="dark"] .help summary{color:#80d1ba}html[data-theme="dark"] pre{background:#0c1213;color:#cce9e0}
html[data-theme="dark"] .library-head{border-color:#304840;background:rgba(25,42,38,.86)}html[data-theme="dark"] .library-head p,html[data-theme="dark"] .library-toolbar label{color:#9cafaa}html[data-theme="dark"] .library-toolbar{background:#1b302b}html[data-theme="dark"] .library-card{border-color:#304840;background:rgba(27,45,41,.9);box-shadow:0 5px 18px rgba(0,0,0,.2)}html[data-theme="dark"] .library-card:hover{border-color:#4b806d;box-shadow:0 10px 28px rgba(0,0,0,.3)}html[data-theme="dark"] .library-a{color:#b0c5bd}html[data-theme="dark"] .pie:after{background:#172622}
html[data-theme="dark"] dialog,html[data-theme="dark"] .sync-dialog,html[data-theme="dark"] .ai-dialog{border-color:#3b554d;background:linear-gradient(145deg,#1b302c,#172622);color:#e7f1ee;box-shadow:0 22px 70px rgba(0,0,0,.5)}html[data-theme="dark"] dialog::backdrop{background:rgba(0,0,0,.68)}html[data-theme="dark"] .sync-explain,html[data-theme="dark"] .sync-status,html[data-theme="dark"] .ai-question-label{color:#a9bdb5}html[data-theme="dark"] .sync-dialog input,html[data-theme="dark"] .ai-dialog textarea,html[data-theme="dark"] .sync-code-label input{border-color:#3b554d;background:#14231f;color:#e7f1ee}html[data-theme="dark"] .ai-user{background:#25483d!important;color:#e2f1eb!important}html[data-theme="dark"] .ai-answer{background:#1d302c!important;color:#e1eee9!important;border-color:#38534a!important}html[data-theme="dark"] .ai-history{border-color:#38534a!important}
html[data-theme="dark"] .source-modal{background:#07100fe8}html[data-theme="dark"] .image-zoom-modal{background:#050a0aeF}html[data-theme="dark"] .image-zoom-modal button,html[data-theme="dark"] .source-modal button{background:#dcece6;color:#10231e}html[data-theme="dark"] .table-scroll table,html[data-theme="dark"] .table-scroll th,html[data-theme="dark"] .table-scroll td{border-color:#476158}html[data-theme="dark"] .table-scroll th{background:#29473e;color:#d8eee7}html[data-theme="dark"] .table-scroll td{background:#1c302c;color:#d6e8e1}
@media(max-width:600px){html[data-theme="dark"] .mode-tabs{background:rgba(24,40,36,.94)}html[data-theme="dark"] .grade-row{background:rgba(24,46,40,.95)}}
html[data-theme="dark"] .ai-dialog .sync-head{background:#1b302cf2;border-color:#38534a}html[data-theme="dark"] .ai-dialog .sync-head button{background:#dcece6;color:#16352c;border-color:#9acdbb}html[data-theme="dark"] .ai-dialog blockquote{background:#e4edf3;color:#2d5068;border-left-color:#66a9d5}html[data-theme="dark"] .ai-turn{border-color:#38534a;background:#1a2d29}html[data-theme="dark"] .ai-user{background:#2b5145!important;color:#e5f4ee!important}html[data-theme="dark"] .ai-user p{color:#d8eee7!important}html[data-theme="dark"] .ai-role{background:#d8ebe5;color:#1c5548}html[data-theme="dark"] .ai-role-answer{background:#cbead9;color:#17614e}html[data-theme="dark"] .ai-answer{background:#1d3630!important;color:#e1eee9!important}html[data-theme="dark"] .ai-markdown{color:#e1eee9!important}html[data-theme="dark"] .ai-markdown h2,html[data-theme="dark"] .ai-markdown h3,html[data-theme="dark"] .ai-markdown h4{color:#a9e6d0!important}html[data-theme="dark"] .ai-markdown h2{border-color:#416358}html[data-theme="dark"] .ai-markdown h3{border-left-color:#62c5a5}html[data-theme="dark"] .ai-markdown strong{color:#b8f0d8!important}html[data-theme="dark"] .ai-markdown code{background:#29483f;color:#c9f0df}html[data-theme="dark"] .ai-markdown pre{background:#0e1b18;color:#d8f2e9}html[data-theme="dark"] .ai-markdown hr{border-top-color:#416358}html[data-theme="dark"] .ai-markdown .katex-display{background:#243d36;color:#e7f4ee}html[data-theme="dark"] .ai-turn time{color:#92aaa1}html[data-theme="dark"] .ai-dialog-actions>button{border:1px solid #416358;background:#29483f;color:#e2f3ec}html[data-theme="dark"] .ai-dialog-actions>.danger-text{background:transparent;color:#ffad99!important;border-color:#794b42}html[data-theme="dark"] .ai-quick-actions button{background:#29483f!important;border-color:#5b9f88!important;color:#d8f3e8!important}html[data-theme="dark"] .ai-history .empty{background:#243b34;color:#cde4db;border-color:#416358}
html[data-theme="dark"] .ai-dialog .ai-markdown p,html[data-theme="dark"] .ai-dialog .ai-markdown li{color:#e1eee9!important}html[data-theme="dark"] .ai-dialog .ai-markdown h2,html[data-theme="dark"] .ai-dialog .ai-markdown h3,html[data-theme="dark"] .ai-dialog .ai-markdown h4{color:#b9ead7!important}html[data-theme="dark"] .ai-dialog .ai-markdown strong{color:#9de2c3!important}html[data-theme="dark"] .ai-dialog .ai-markdown .katex{color:#e7f4ee!important}
html[data-theme="dark"] .group-card,html[data-theme="dark"] .point-card,html[data-theme="dark"] .overview-children,html[data-theme="dark"] .mechanism-point .point-answer{background:#1b2d29;color:#d8e9e3;border-color:#355048}html[data-theme="dark"] .group-card[open]>summary{background:#243e36;border-color:#355048}html[data-theme="dark"] .point-card[open]>summary{background:#223a33;border-color:#355048}html[data-theme="dark"] .group-card>summary small,html[data-theme="dark"] .group-card>summary span{color:#9db5ac}html[data-theme="dark"] .group-card>summary b,html[data-theme="dark"] .point-card>summary b{color:#83d2b8}html[data-theme="dark"] .point-answer,html[data-theme="dark"] .answer-rich,html[data-theme="dark"] .answer-rich p,html[data-theme="dark"] .answer-rich li{color:#d8e9e3}html[data-theme="dark"] .answer-heading,html[data-theme="dark"] .answer-label,html[data-theme="dark"] .answer-key,html[data-theme="dark"] .answer-rich strong{color:#a9e3cb!important}html[data-theme="dark"] .answer-key{background:linear-gradient(transparent 68%,#285447 0)}html[data-theme="dark"] .answer-rich .katex{color:#e1f1ea}html[data-theme="dark"] .answer-rich .katex-display{background:#243d36;border-color:#45665b;box-shadow:none}
html[data-theme="dark"] .highlight-tools{background:#3a3320;border-color:#9d8540}html[data-theme="dark"] .highlight-tools button{background:#514522;color:#ffe29a;border-color:#b39a4a}html[data-theme="dark"] .highlight-tools small{color:#e2cf93}html[data-theme="dark"] .card-memory-status span{background:#243b34;color:#b6cec4;border-color:#416358}html[data-theme="dark"] .undo-btn{background:#40351f!important;color:#f0d896!important;border-color:#9c8140!important}html[data-theme="dark"] .ask-ai-btn{background:#29483f!important;color:#bcebd8!important;border-color:#5b9f88!important}
html[data-theme="dark"] .source-sheet{background:#1b2926;border:1px solid #3b554d}html[data-theme="dark"] .source-sheet p{color:#bdd5cb}html[data-theme="dark"] .source-pages .source-sheet+.source-sheet{border-top-color:#46665a}
.ai-annotation{background:transparent!important;text-decoration:underline 1.5px #347db8;text-decoration-skip-ink:none;text-underline-offset:4px}.user-highlight .ai-annotation,.ai-annotation .user-highlight,.user-highlight.ai-annotation{background:#ffe36e!important;text-decoration:underline 2px #2678b5;text-decoration-skip-ink:none}
html[data-theme="dark"] .ai-annotation{background:transparent!important;text-decoration-color:#7ed9bf}.user-highlight .ai-annotation,html[data-theme="dark"] .ai-annotation .user-highlight,html[data-theme="dark"] .user-highlight.ai-annotation{background:#8a7628!important;text-decoration-color:#9ee7cf}
.ai-dialog .katex{font-size:1.04em;line-height:1.25;white-space:normal}.ai-dialog .katex-display{display:block;max-width:100%;overflow-x:auto;overflow-y:hidden;-webkit-overflow-scrolling:touch;margin:.8em 0;padding:11px 10px;border-radius:10px;background:#f5f8f6;border:1px solid #e1ebe6;text-align:center}.ai-dialog .katex-display>.katex{display:inline-block;min-width:max-content;white-space:nowrap}.ai-dialog blockquote .katex{font-size:1em}.ai-dialog .ai-markdown .katex{color:#243f38}.ai-dialog .ai-markdown .katex .mord,.ai-dialog .ai-markdown .katex .mrel,.ai-dialog .ai-markdown .katex .mbin,.ai-dialog .ai-markdown .katex .mop,.ai-dialog .ai-markdown .katex .mopen,.ai-dialog .ai-markdown .katex .mclose{color:inherit}@media(max-width:600px){.ai-dialog .katex{font-size:.98em}.ai-dialog .katex-display{padding:10px 7px;margin:.7em 0;text-align:left}.ai-dialog .ai-quote .katex-display{padding:8px 5px}}
 .ai-dialog .ai-math-block{max-width:100%;overflow-x:auto;overflow-y:hidden;-webkit-overflow-scrolling:touch}
html[data-theme="dark"] .ai-dialog .katex,html[data-theme="dark"] .ai-dialog .ai-markdown .katex,html[data-theme="dark"] .ai-dialog blockquote .katex{color:#e7f4ee!important}html[data-theme="dark"] .ai-dialog .katex-display{background:#243d36;border-color:#45665b}html[data-theme="dark"] .ai-dialog blockquote .katex-display{background:#d5e5ed;border-color:#8eb6cb;color:#29495d!important}

/* 中性灰黑深色主题：减少绿色蒙层，移动端评价条与按钮保持深色。 */
html[data-theme="dark"] body{--ink:#e6e8ea;--muted:#a4a9ad;--paper:#24272a;--line:#3d4246;--blue:#9bbcf2;--orange:#efaa82;--green:#a8c0b7;--soft:#2b2e31;--shadow:0 18px 55px rgba(0,0,0,.42);background:radial-gradient(circle at 8% 0,#30343a 0,transparent 34%),radial-gradient(circle at 92% 10%,#393532 0,transparent 28%),#17191b}
html[data-theme="dark"] body:before{background-image:radial-gradient(#a5adb3 .55px,transparent .55px);opacity:.09}
html[data-theme="dark"] header{border-color:#454a4e;background:rgba(34,37,40,.92)}
html[data-theme="dark"] .mode-tabs{background:#232629;border-color:#3a3f43}html[data-theme="dark"] .mode-tabs .tab{color:#aeb4b9}html[data-theme="dark"] .mode-tabs .tab.active{background:#373c41;color:#c6d7f2}
html[data-theme="dark"] .course-tab{border-color:#41464a;background:rgba(42,45,48,.9);color:#b8bdc2}html[data-theme="dark"] .course-tab.active{color:#202326;background:linear-gradient(135deg,#8d969f,#b3bbc2)}
html[data-theme="dark"] .toolbar{border-color:#3d4246;background:rgba(36,39,42,.92)}html[data-theme="dark"] select,html[data-theme="dark"] .chapter-picker-toggle{border-color:#4a5055;background:#2a2d30;color:#e6e8ea}
html[data-theme="dark"] .quiet,html[data-theme="dark"] .file-label{background:#303438;border-color:#484e53;color:#d0d4d7}html[data-theme="dark"] .quiet:hover,html[data-theme="dark"] .file-label:hover{background:#3a3f44}
html[data-theme="dark"] .today-dashboard div{border-color:#3e4448;background:#282b2e;box-shadow:0 8px 24px rgba(0,0,0,.23)}html[data-theme="dark"] .today-dashboard div:after{background:#3a3e43}html[data-theme="dark"] .today-dashboard div:nth-child(2):after{background:#4a3e39}html[data-theme="dark"] .today-dashboard div:nth-child(3):after{background:#443c42}html[data-theme="dark"] .today-dashboard div:nth-child(4):after{background:#3c414b}html[data-theme="dark"] .today-dashboard div:nth-child(5):after{background:#3f3b47}html[data-theme="dark"] .today-dashboard strong{color:#e4e7e9}
html[data-theme="dark"] .progress-panel{border-color:#454b50;background:linear-gradient(110deg,#292d30,#24272a)}html[data-theme="dark"] .bar{background:#444a4f}html[data-theme="dark"] .bar i{background:linear-gradient(90deg,#89939b,#b1bac1);box-shadow:0 0 10px #aeb8c055}
html[data-theme="dark"] .card{border-color:#454b50;background:linear-gradient(145deg,#25292c,#1e2123)}html[data-theme="dark"] .card:before{background:linear-gradient(145deg,#3a3e43,#433b36)}html[data-theme="dark"] .card:hover{border-color:#68727a}
html[data-theme="dark"] .answer{border-color:#464d52;background:linear-gradient(145deg,#2b2f32,#25282b)}html[data-theme="dark"] .memory-aid{border-color:#5b5143!important;background:#35302a!important}
html[data-theme="dark"] .library-head,html[data-theme="dark"] .library-card{border-color:#40464b;background:rgba(38,42,45,.94)}html[data-theme="dark"] .library-toolbar{background:#292d30}
html[data-theme="dark"] dialog,html[data-theme="dark"] .sync-dialog,html[data-theme="dark"] .ai-dialog{border-color:#4a5055;background:linear-gradient(145deg,#292d30,#222528)}
html[data-theme="dark"] .group-card,html[data-theme="dark"] .point-card,html[data-theme="dark"] .overview-children,html[data-theme="dark"] .mechanism-point .point-answer{background:#282c2f;color:#dce0e3;border-color:#42484d}html[data-theme="dark"] .group-card[open]>summary,html[data-theme="dark"] .point-card[open]>summary{background:#34393e;border-color:#464d52}
@media(max-width:600px){html[data-theme="dark"] #answerArea:not([hidden]) .grade-row{background:#182523!important;border-top:1px solid #354b45!important;border-left:none!important;border-right:none!important;border-bottom:none!important;box-shadow:0 -4px 24px rgba(0,0,0,.58)!important}html[data-theme="dark"] #answerArea:not([hidden]) .grade-row button{color:#f1f3f4!important;border:1px solid rgba(255,255,255,.14)}html[data-theme="dark"] #answerArea:not([hidden]) .grade-row .again{background:#774c42!important}html[data-theme="dark"] #answerArea:not([hidden]) .grade-row .fuzzy{background:#756337!important}html[data-theme="dark"] #answerArea:not([hidden]) .grade-row .good{background:#46665b!important}}

/* 翻面后的答案、公式和 AI 面板也使用同一套中性灰阶。 */
html[data-theme="dark"] .answer-rich,html[data-theme="dark"] .answer-rich p,html[data-theme="dark"] .answer-rich li,html[data-theme="dark"] .point-answer{color:#dfe3e6}
html[data-theme="dark"] .answer-heading{color:#d9dee2!important;border-left-color:#8a969f}html[data-theme="dark"] .answer-label{color:#e0c29e!important}html[data-theme="dark"] .answer-key{color:#e5e8ea!important;background:linear-gradient(transparent 68%,#4a5056 0)}html[data-theme="dark"] .answer-rich strong{color:#e4e7e9!important}
html[data-theme="dark"] .answer-rich .katex{color:#e5e8eb!important}html[data-theme="dark"] .answer-rich .katex-display{background:#33383d;border-color:#555d63;box-shadow:none}
html[data-theme="dark"] .ai-turn{border-color:#464d52;background:#292d30}html[data-theme="dark"] .ai-user{background:#353a3f!important;color:#e5e8eb!important}html[data-theme="dark"] .ai-user p{color:#d8dde1!important}html[data-theme="dark"] .ai-answer{background:#292d30!important;color:#e3e6e8!important;border-color:#4a5156!important}html[data-theme="dark"] .ai-markdown{color:#e1e4e7!important}html[data-theme="dark"] .ai-markdown h2,html[data-theme="dark"] .ai-markdown h3,html[data-theme="dark"] .ai-markdown h4{color:#d3d9de!important}html[data-theme="dark"] .ai-markdown h2{border-color:#535b61}html[data-theme="dark"] .ai-markdown h3{border-left-color:#89949d}html[data-theme="dark"] .ai-markdown strong{color:#edf0f2!important}html[data-theme="dark"] .ai-markdown code{background:#3b4146;color:#e2e6e9}html[data-theme="dark"] .ai-markdown pre{background:#171a1d;color:#e0e5e8}html[data-theme="dark"] .ai-markdown hr{border-top-color:#535b61}html[data-theme="dark"] .ai-markdown .katex-display{background:#33383d;color:#e7eaed;border-color:#555d63}
html[data-theme="dark"] .ai-dialog .sync-head{background:#292d30f2;border-color:#4a5156}html[data-theme="dark"] .ai-dialog .sync-head button{background:#d8dde1;color:#25282b;border-color:#929ba2}html[data-theme="dark"] .ai-dialog-actions>button,html[data-theme="dark"] .ai-quick-actions button{background:#3b4146!important;border-color:#5b646b!important;color:#e3e7ea!important}html[data-theme="dark"] .source-sheet{background:#292d30;border-color:#4a5156}html[data-theme="dark"] .source-sheet p{color:#d0d6da}

/* 移动端交互安全区：固定评价条不遮挡答案，长弹窗的关闭按钮始终可见。 */
@media(max-width:600px){
  #answerArea:not([hidden]){padding-bottom:92px}
  #answerArea:not([hidden]) .answer-content{padding-bottom:8px}
  .sync-dialog .sync-head{position:sticky;top:-18px;z-index:4;margin:-18px -14px 12px;padding:18px 14px 11px;background:#fffffff2;backdrop-filter:blur(10px);border-bottom:1px solid #edf1ef}
  html[data-theme="dark"] .sync-dialog .sync-head{background:#292d30f2;border-bottom-color:#4a5156}
  .sync-dialog .sync-head button{min-width:64px;min-height:40px}
  html[data-theme="dark"] .sync-dialog .sync-head button{background:#d8dde1;color:#25282b;border-color:#929ba2}
  .sync-dialog,.ai-dialog{overscroll-behavior:contain;scrollbar-gutter:stable}
  /* 全部闪卡长列表：筛选条件始终可见，避免在章节之间来回滚动。 */
  #libraryView .library-toolbar{position:sticky;top:58px;z-index:3;margin:0 -1px 10px;padding:10px 9px;background:rgba(247,248,245,.96);border:1px solid #e1e8e4;border-radius:13px;box-shadow:0 8px 22px rgba(34,72,62,.10);backdrop-filter:blur(10px)}
  html[data-theme="dark"] #libraryView .library-toolbar{background:rgba(40,44,47,.97);border-color:#4a5156;box-shadow:0 8px 22px rgba(0,0,0,.32)}
  #libraryView .library-toolbar select{min-height:40px}
}

/* 深色界面的主动高亮：保留记忆标记，但避免亮黄色在黑底上刺眼。 */
html[data-theme="dark"] .user-highlight{background:#63572d!important;color:#f0e8c8!important;border:1px solid #887743;border-radius:4px;padding:.03em .08em;box-shadow:inset 0 -1px #a28e4e}
html[data-theme="dark"] .user-highlight .ai-annotation,html[data-theme="dark"] .ai-annotation .user-highlight,html[data-theme="dark"] .user-highlight.ai-annotation{background:#63572d!important;color:#f0e8c8!important;text-decoration-color:#b8e0d1}
html[data-theme="dark"] .highlight-tools{background:#302d25;border-color:#756942}
html[data-theme="dark"] .highlight-tools button{background:#47412d;color:#e9dfb8;border-color:#857847}
html[data-theme="dark"] .highlight-tools small{color:#c8bd96}

/* 深色主题收尾：弹出菜单、空状态和资料层统一为中性灰黑，避免局部偏绿/偏棕。 */
html[data-theme="dark"] .chapter-picker-menu{background:#25292d;border-color:#454c52;box-shadow:0 16px 38px rgba(0,0,0,.46)}
html[data-theme="dark"] .chapter-menu-head{border-color:#454c52;color:#d5d9dd}
html[data-theme="dark"] .chapter-options label{color:#d1d5d8}
html[data-theme="dark"] .chapter-options label:hover{background:#363c42}
html[data-theme="dark"] .chapter-menu-hint{border-color:#454c52;color:#a8afb5}
html[data-theme="dark"] .empty{background:#2b2f33;border-color:#4b5258;color:#d4d9dd}
html[data-theme="dark"] .help{background:#292d31;border-color:#454c52;color:#b9c0c5}
html[data-theme="dark"] .help summary{color:#d2d7db}
html[data-theme="dark"] .source-modal{background:rgba(12,14,16,.94)}
html[data-theme="dark"] .image-zoom-modal{background:rgba(12,14,16,.96)}
html[data-theme="dark"] .source-modal button,html[data-theme="dark"] .image-zoom-modal button{background:#d7dce0;color:#24282c;border-color:#8d969d}
html[data-theme="dark"] .table-scroll th{background:#373d42;color:#e0e4e7}
html[data-theme="dark"] .table-scroll td{background:#292d31;color:#d7dce0}
html[data-theme="dark"] .table-scroll table,html[data-theme="dark"] .table-scroll th,html[data-theme="dark"] .table-scroll td{border-color:#4b5359}
html[data-theme="dark"] .memory-aid{background:#303337!important;border-color:#575c61!important;color:#d6dadd!important}
html[data-theme="dark"]{color-scheme:dark}
html[data-theme="light"]{color-scheme:light}
html[data-theme="dark"] button:focus-visible,html[data-theme="dark"] select:focus-visible,html[data-theme="dark"] input:focus-visible,html[data-theme="dark"] summary:focus-visible{outline-color:#aeb9c2;box-shadow:0 0 0 3px rgba(174,185,194,.2)}
@media(max-width:360px){.header-actions .quiet{font-size:13px;padding-left:6px;padding-right:6px;white-space:nowrap;min-width:0}}

/* v42：完成页、常驻同步状态、备份预览与收藏标签。 */
.header-side{display:grid;gap:8px;justify-items:end}.sync-pill{display:inline-flex;align-items:center;gap:7px;min-height:30px;padding:5px 10px;border:1px solid #dce6e1;border-radius:999px;background:#f8faf9;color:#68766f;font-size:12px;font-weight:650;box-shadow:none}.sync-pill i{width:8px;height:8px;border-radius:50%;background:#9da8a3;box-shadow:0 0 0 3px #9da8a31c}.sync-pill.synced i{background:#418d75}.sync-pill.pending i,.sync-pill.syncing i{background:#c78c32}.sync-pill.syncing i{animation:syncPulse 1.15s ease-in-out infinite}.sync-pill.offline i{background:#b15d4e}.sync-pill:hover{background:#f1f6f3}@keyframes syncPulse{50%{transform:scale(1.45);opacity:.55}}
.completion-panel{display:grid;gap:16px;padding:25px;border:1px solid #dbe8e2;border-radius:22px;background:linear-gradient(145deg,#fffefa,#f3faf7);box-shadow:0 16px 42px rgba(31,79,63,.09)}.completion-hero{display:flex;align-items:center;gap:16px}.completion-hero h2{margin:3px 0 5px;font-size:25px}.completion-hero p{margin:0;color:#65756e}.completion-check{display:grid;place-items:center;flex:0 0 52px;width:52px;height:52px;border-radius:50%;background:linear-gradient(145deg,#2c9375,#55b99a);color:#fff;font-size:27px;font-weight:800;box-shadow:0 9px 24px #2e8e7040}.completion-stats{display:grid;grid-template-columns:repeat(5,minmax(0,1fr));gap:9px}.completion-stats div{display:grid;gap:4px;padding:13px 10px;border:1px solid #e2ebe6;border-radius:14px;background:#fff}.completion-stats strong{font-size:21px;color:#244c40}.completion-stats span{font-size:12px;color:#77867f}.completion-next{display:flex;justify-content:space-between;gap:10px;padding:13px 15px;border-radius:14px;background:#edf6f2;color:#2d5f50}.completion-next span{color:#6f8179;font-size:13px}.completion-hard{display:grid;gap:7px}.completion-hard>strong{margin-bottom:2px}.completion-hard button{min-height:42px;text-align:left;border:1px solid #eadccf;background:#fff9f1;color:#5d5148;font-weight:600}.completion-encourage{margin:0;color:#687970}.completion-actions{display:flex;gap:9px}.completion-actions button{min-height:43px}.completion-actions button:first-child{background:#2d8d72;color:#fff}
.card-organize{display:flex;align-items:center;flex-wrap:wrap;gap:8px;margin-top:-6px}.card-organize>button{min-height:38px}.favorite-btn.active,#tagFavoriteBtn.active{background:#fff2c8;color:#7a5b00;border:1px solid #e5c661}.card-tags{display:flex;flex-wrap:wrap;gap:6px}.card-tags span,.tag-chip{display:inline-flex;align-items:center;min-height:24px;padding:3px 8px;border:1px solid #d9e4df;border-radius:999px;background:#f6f9f7;color:#60716a;font-size:11px;font-style:normal;font-weight:650}.meta-badges{display:flex;flex-wrap:wrap;align-items:center;gap:5px;margin-top:7px}.favorite-mark{color:#c58e20;font-size:15px;font-style:normal}.tag-chip{min-height:21px;padding:2px 7px}.tag-chip.more{color:#7c8883}.point-title{min-width:0;line-height:1.48}.scan-kind{font-weight:750}.sync-kind{background:#edf3f1;border-color:#cddbd7;color:#55716a}.supplement-kind{background:#fff4df;border-color:#ecd29c;color:#8b641c}
.import-preview-dialog,.tag-dialog{width:min(620px,calc(100vw - 22px))}.import-preview-stats{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:9px;margin:15px 0}.import-preview-stats div{display:grid;gap:5px;padding:12px;border:1px solid #e0e9e4;border-radius:12px;background:#f8faf9;min-width:0}.import-preview-stats span{font-size:12px;color:#738079}.import-preview-stats strong{overflow-wrap:anywhere}.import-preview-warning{padding:11px 13px;border-radius:11px;background:#fff7e6;color:#795d27;font-size:13px}.import-preview-actions{display:flex;flex-wrap:wrap;gap:8px;margin-top:14px}.import-preview-actions button{min-height:43px}.tag-card-title{margin:0 0 13px;padding:11px 13px;border-left:4px solid #609c89;border-radius:0 10px 10px 0;background:#f3f7f5;color:#41544d;line-height:1.55}.tag-options{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:7px;margin-bottom:14px}.tag-options label{display:flex;align-items:center;gap:8px;padding:9px 10px;border:1px solid #e0e8e4;border-radius:10px;background:#fafbf9;cursor:pointer}.tag-options input{width:17px;height:17px;accent-color:#448d75}.tag-hint{margin:7px 0;color:#78847f;font-size:12px}
html[data-theme="dark"] .sync-pill{background:#292d31;border-color:#4a5156;color:#bdc3c7}html[data-theme="dark"] .sync-pill:hover{background:#34393e}html[data-theme="dark"] .completion-panel{background:linear-gradient(145deg,#292d30,#222528);border-color:#4a5156;box-shadow:0 16px 42px rgba(0,0,0,.3)}html[data-theme="dark"] .completion-hero p,html[data-theme="dark"] .completion-encourage{color:#afb6bb}html[data-theme="dark"] .completion-stats div{background:#303438;border-color:#484f54}html[data-theme="dark"] .completion-stats strong{color:#e4e7e9}html[data-theme="dark"] .completion-stats span{color:#aeb5ba}html[data-theme="dark"] .completion-next{background:#34393e;color:#e3e7e9}html[data-theme="dark"] .completion-next span{color:#b2b9bd}html[data-theme="dark"] .completion-hard button{background:#34312d;border-color:#5b5146;color:#ded7cf}html[data-theme="dark"] .card-tags span,html[data-theme="dark"] .tag-chip{background:#34393d;border-color:#50575c;color:#cbd0d3}html[data-theme="dark"] .favorite-btn.active,html[data-theme="dark"] #tagFavoriteBtn.active{background:#4b432c;color:#ead99f;border-color:#786b40}html[data-theme="dark"] .import-preview-stats div,html[data-theme="dark"] .tag-options label{background:#303438;border-color:#4a5156}html[data-theme="dark"] .import-preview-stats span,html[data-theme="dark"] .tag-hint{color:#aeb5b9}html[data-theme="dark"] .import-preview-warning{background:#3b3428;color:#d7c69c}html[data-theme="dark"] .tag-card-title{background:#34393d;border-left-color:#8e9aa3;color:#d4d9dc}
@media(max-width:600px){.header-side{width:100%;justify-items:stretch}.sync-pill{justify-self:end}.completion-panel{padding:19px 15px;border-radius:18px}.completion-hero{align-items:flex-start}.completion-hero h2{font-size:22px}.completion-check{flex-basis:44px;width:44px;height:44px;font-size:23px}.completion-stats{grid-template-columns:repeat(2,minmax(0,1fr))}.completion-next{display:grid}.completion-actions{display:grid;grid-template-columns:1fr 1fr}.import-preview-stats{grid-template-columns:1fr}.import-preview-actions{display:grid;grid-template-columns:1fr 1fr}.tag-options{grid-template-columns:1fr}.library-toolbar label:last-child{grid-column:1/-1}}
@media(max-width:360px){.sync-pill{font-size:11px}.completion-actions,.import-preview-actions{grid-template-columns:1fr}.header-actions{grid-template-columns:1fr 1fr}}

/* Final neutral-dark pass for every dialog control and status surface. */
html[data-theme="dark"] .sync-dialog input,
html[data-theme="dark"] .sync-dialog textarea,
html[data-theme="dark"] .sync-dialog select,
html[data-theme="dark"] .tag-dialog input,
html[data-theme="dark"] .tag-dialog textarea,
html[data-theme="dark"] .tag-dialog select,
html[data-theme="dark"] .import-preview-dialog input,
html[data-theme="dark"] .import-preview-dialog textarea,
html[data-theme="dark"] .import-preview-dialog select{background:#303438!important;border-color:#50575c!important;color:#e5e8ea!important}
html[data-theme="dark"] .sync-status{background:#303438!important;color:#cbd0d3!important;border:1px solid #484f54}
html[data-theme="dark"] .sync-status.error{background:#432f31!important;color:#f0c2c6!important;border-color:#70464b}
html[data-theme="dark"] .sync-dialog .sync-actions button:not(.quiet),
html[data-theme="dark"] .import-preview-actions button:not(.quiet),
html[data-theme="dark"] .tag-dialog .sync-actions button:not(.quiet){background:#59636c;color:#fff;border-color:#707b84}
@media(max-width:600px){.completion-stats div:last-child:nth-child(odd){grid-column:1/-1}}

.card-memory-status .revision-note{background:#fff1d6;border-color:#d5a55d;color:#795221}
html[data-theme="dark"] .card-memory-status .revision-note{background:#4a3c2c;border-color:#80643c;color:#f0d39d}
.scan-library-tools{display:flex;justify-content:space-between;align-items:center;gap:14px;padding:14px 16px;margin:10px 0 2px;background:#eef3f2;border:1px solid #dbe5e3;border-radius:12px;color:#42545a}.scan-library-tools div{display:grid;gap:3px}.scan-library-tools span{font-size:12px;color:#718087}.scan-point .point-answer{background:#fbfcfa}.scan-figure{max-height:280px;object-fit:contain;object-position:center;margin:10px 0;border-radius:8px}.scan-reader-modal{position:fixed;inset:0;z-index:20;background:#111a1dcc;padding:24px;display:grid;place-items:center;overflow:auto}.scan-reader-panel{width:min(100%,1100px);max-height:calc(100vh - 48px);overflow:auto;background:#fffdf8;border-radius:16px;padding:20px;box-shadow:0 20px 70px #0008}.scan-reader-close{position:fixed;top:16px;right:18px;background:#fff;color:#26333a;z-index:2}.scan-reader-head{display:flex;justify-content:space-between;align-items:center;gap:16px;border-bottom:1px solid #e6e1d8;padding-bottom:12px}.scan-reader-head h2{margin:0;font-size:22px}.scan-reader-head label{display:flex;align-items:center;gap:8px;color:#64727a;font-size:13px}.scan-reader-select{max-width:min(52vw,420px)}.scan-reader-body{padding-top:16px}.scan-reader-page{display:block;width:min(100%,900px);margin:0 auto;border:1px solid #e2ded5;box-shadow:0 5px 20px #17262b16}.scan-reader-caption{display:flex;justify-content:space-between;gap:12px;padding:10px 2px;color:#64727a;font-size:13px}.scan-reader-figures{display:flex;flex-wrap:wrap;gap:10px;margin:2px 0 14px}.scan-reader-figure{width:150px;max-height:130px;object-fit:contain;border:1px solid #e0e4e2;border-radius:8px;background:#fff;cursor:zoom-in}.scan-reader-text{font-size:15px;line-height:1.8;margin-top:10px}.scan-reader-text table{width:100%;border-collapse:collapse}.scan-reader-text td,.scan-reader-text th{border:1px solid #ccd8d5;padding:6px;text-align:left}.scan-reader-nav{display:flex;justify-content:space-between;align-items:center;gap:10px;margin-top:16px;color:#66757d;font-size:13px}@media(max-width:560px){.scan-library-tools{align-items:flex-start;flex-direction:column}.scan-reader-modal{padding:8px}.scan-reader-panel{max-height:calc(100vh - 16px);padding:14px}.scan-reader-head{align-items:flex-start;flex-direction:column}.scan-reader-select{max-width:100%;width:100%}.scan-reader-page{width:100%}.scan-reader-figure{width:calc(50% - 5px)}} 
html[data-theme="dark"] .scan-library-tools{background:#263437;border-color:#3d5154;color:#eef4f3}html[data-theme="dark"] .scan-library-tools span,html[data-theme="dark"] .scan-reader-caption{color:#afc0c2}html[data-theme="dark"] .scan-reader-panel{background:#202a2d;color:#edf3f2}.scan-reader-text details{background:transparent}.scan-reader-text td,.scan-reader-text th{border-color:#53686b}
.course-tabs{grid-template-columns:repeat(4,minmax(0,1fr))}@media(max-width:600px){.course-tabs{grid-template-columns:1fr 1fr}}

.figure-with-caption{display:block;width:min(100%,760px);margin:14px auto 4px;text-align:center}.figure-with-caption figcaption{margin:6px auto 0;color:#74827d;font-size:12px;line-height:1.45;overflow-wrap:anywhere}.figure-with-caption .library-figure,.figure-with-caption .answer-source{margin:0 auto}.figure-with-caption figcaption:empty{display:none}html[data-theme="dark"] .figure-with-caption figcaption{color:#aebbb7}@media(max-width:600px){.figure-with-caption figcaption{font-size:11px;margin-top:5px}}
html[data-theme="dark"] .scan-point .point-answer{background:#1b2d29!important;color:#d8e9e3!important;border-color:#355048!important}
html[data-theme="dark"] .scan-point .point-answer .answer-rich,html[data-theme="dark"] .scan-point .point-answer .answer-rich p,html[data-theme="dark"] .scan-point .point-answer .answer-rich li{color:#d8e9e3!important;background:transparent}
html[data-theme="dark"] .scan-point .point-answer .answer-rich .katex-display{background:#243d36;border-color:#45665b;color:#e1f1ea}

/* Unified neutral gray / blue-gray visual system. */
:root{--ink:#273138;--muted:#6b767d;--paper:#fbfcfd;--line:#dce2e5;--blue:#657781;--orange:#7d8990;--green:#71858b;--shadow:0 18px 55px rgba(49,61,68,.11)}
body{background:linear-gradient(135deg,#eef1f2 0%,#f8f8f7 68%,#f1f0ef 100%)}
body:before{background-image:radial-gradient(#9aa7ad .55px,transparent .55px)}
.eyebrow{color:#7a878e}
.mode-tabs .tab.active{color:#5f7078}
.course-tab.active{background:linear-gradient(135deg,#687981,#96a1a6);box-shadow:0 10px 25px rgba(83,99,108,.18)}
.progress-panel{background:linear-gradient(110deg,#eef2f3,#f8f9f9);border-color:#d9e0e3}
.bar i{background:linear-gradient(90deg,#71838b,#9aa6ab);box-shadow:0 0 10px #87979d55}
.today-dashboard div:after,.today-dashboard div:nth-child(2):after,.today-dashboard div:nth-child(3):after,.today-dashboard div:nth-child(4):after,.today-dashboard div:nth-child(5):after{background:#dfe5e7!important}
.today-dashboard strong{color:#36434a}
.answer{background:#f1f4f5;border-color:#dce3e6}
.answer-rich .answer-key{color:#40535d;background:linear-gradient(transparent 68%,#dce3e6 0)}
.answer-heading{border-left-color:#829199;color:#40515a}
.answer-label{color:#50616a}
.again{background:#887b7b}.fuzzy{background:#817f73}.good{background:#71858b}
.highlight-tools{background:#f1f4f5;border-color:#b8c4c9}
.highlight-tools button{background:#e5eaec;color:#4f636d;border-color:#b8c4c9}
.highlight-tools small{color:#6e7b81}
.user-highlight{background:#d8e0e3;color:#27363d;border-color:#aebbc1;box-shadow:inset 0 -1px #87979f}
.ai-annotation{background:#edf2f4;color:inherit}
.scan-library-tools{background:#eef1f3;border-color:#d6dfe3;color:#4c5b63}
.scan-point .point-answer{background:#f5f7f8}
.scan-kind,.tag-chip{background:#edf1f3;border-color:#d2dce0;color:#5b6b73}
.supplement-kind,.sync-kind{background:#e8edef;border-color:#c2cdd2;color:#53656d}
.figure-with-caption figcaption{color:#6f7d84}
.good-dot{background:#71858b}.again-dot{background:#9a8f83}.new-dot{background:#c4cbd0}
.scan-reader-panel{background:#f5f6f6;border-color:#d6dde0}
.scan-reader-caption,.scan-reader-nav{color:#65737a}
.source-inline,.source-btn{background:#e7ecee;color:#4f616a;border-color:#ccd6da}

html[data-theme="dark"] body{background:radial-gradient(circle at 8% 0,#2a2e32 0,transparent 34%),radial-gradient(circle at 92% 10%,#303236 0,transparent 28%),#171a1d!important}
html[data-theme="dark"] body:before{background-image:radial-gradient(#98a3a8 .55px,transparent .55px);opacity:.09}
html[data-theme="dark"] .eyebrow{color:#aeb8bd!important}
html[data-theme="dark"] .course-tab.active{background:linear-gradient(135deg,#89959b,#b5bec2)!important;color:#242a2e!important;box-shadow:0 10px 25px rgba(115,128,136,.22)}
html[data-theme="dark"] .mode-tabs .tab.active{color:#e0e5e8;background:#343a3f}
html[data-theme="dark"] .progress-panel{background:linear-gradient(110deg,#252a2e,#202428);border-color:#454d53}
html[data-theme="dark"] .bar i{background:linear-gradient(90deg,#89979e,#b3bdc2);box-shadow:0 0 10px #aeb8bd55}
html[data-theme="dark"] .today-dashboard div:after,html[data-theme="dark"] .today-dashboard div:nth-child(2):after,html[data-theme="dark"] .today-dashboard div:nth-child(3):after,html[data-theme="dark"] .today-dashboard div:nth-child(4):after,html[data-theme="dark"] .today-dashboard div:nth-child(5):after{background:#3a4045!important}
html[data-theme="dark"] .answer{background:linear-gradient(145deg,#292e33,#24282c);border-color:#454e54}
html[data-theme="dark"] .answer-rich .answer-key{color:#d8e0e4!important;background:linear-gradient(transparent 68%,#4a5359 0)}
html[data-theme="dark"] .answer-heading{border-left-color:#8b989f;color:#d5dde1!important}
html[data-theme="dark"] .answer-label{color:#cbd5da!important}
html[data-theme="dark"] .again{background:#655b5c!important}html[data-theme="dark"] .fuzzy{background:#626158!important}html[data-theme="dark"] .good{background:#687c82!important}
html[data-theme="dark"] .highlight-tools{background:#2b3035;border-color:#59636a}
html[data-theme="dark"] .highlight-tools button{background:#3a4147;color:#e0e6e9;border-color:#606b72}
html[data-theme="dark"] .highlight-tools small{color:#b8c1c5}
html[data-theme="dark"] .user-highlight{background:#56636a!important;color:#f1f4f5!important;border-color:#7b8a92;box-shadow:inset 0 -1px #aeb9bf}
html[data-theme="dark"] .ai-annotation{background:#303a40;color:#e2e8eb}
html[data-theme="dark"] .scan-library-tools{background:#252b30;border-color:#454f56;color:#d5dde1}
html[data-theme="dark"] .scan-point .point-answer{background:#252b30!important;color:#d8e0e4!important}
html[data-theme="dark"] .scan-kind,html[data-theme="dark"] .tag-chip{background:#343b40;border-color:#505b62;color:#d0d8dc}
html[data-theme="dark"] .supplement-kind,html[data-theme="dark"] .sync-kind{background:#3a4247;border-color:#5a666d;color:#d8e0e4}
html[data-theme="dark"] .figure-with-caption figcaption{color:#aeb9be}
html[data-theme="dark"] .good-dot{background:#a5b2b7}html[data-theme="dark"] .again-dot{background:#9f968c}html[data-theme="dark"] .new-dot{background:#707a80}
html[data-theme="dark"] .scan-reader-panel{background:#252b30;border-color:#454f56}
html[data-theme="dark"] .scan-reader-caption,html[data-theme="dark"] .scan-reader-nav{color:#b5c0c5}
html[data-theme="dark"] .source-inline,html[data-theme="dark"] .source-btn{background:#3a4247;color:#dce3e6;border-color:#5a666d}

/* 学习量柱状图与完成时间预测面板样式 */
.forecast-panel{border:1px solid #dce9e3;background:linear-gradient(145deg,#ffffff,#f8fbf9);border-radius:18px;margin-bottom:18px;box-shadow:0 6px 20px rgba(36,68,59,.04);overflow:hidden;transition:all .2s ease}
.forecast-summary{display:flex;align-items:center;justify-content:space-between;padding:14px 18px;cursor:pointer;user-select:none;list-style:none}
.forecast-summary::-webkit-details-marker{display:none}
.forecast-summary-head{display:flex;align-items:center;flex-wrap:wrap;gap:10px}
.forecast-badge{display:inline-flex;align-items:center;font-size:13px;font-weight:700;color:#176b62;background:#e6f5ef;padding:4px 10px;border-radius:99px}
.forecast-header-summary{font-size:13px;color:var(--muted)}
.forecast-header-summary strong{color:#d96e3d;font-size:15px;margin:0 2px}
.forecast-toggle-icon{font-size:15px;color:var(--muted);transition:transform .2s ease}
.forecast-panel[open] .forecast-toggle-icon{transform:rotate(180deg)}
.forecast-body{padding:4px 18px 18px;border-top:1px solid rgba(220,233,227,.6)}
.forecast-metrics{display:grid;grid-template-columns:repeat(4,1fr);gap:10px;margin:12px 0 16px}
.f-metric-card{display:flex;flex-direction:column;gap:4px;padding:12px 14px;border-radius:12px;background:rgba(245,250,248,.85);border:1px solid #e3ede8;transition:transform .15s ease}
.f-metric-card.highlight-finish{background:linear-gradient(135deg,#eef9f5,#f3faf8);border-color:#cce7dd}
.f-label{font-size:11px;color:var(--muted);font-weight:600}
.f-metric-card strong{font-size:17px;color:var(--ink);font-weight:700}
.highlight-finish strong{color:#176b62}
.f-sub{font-size:11px;color:#d96e3d;font-weight:600}
.forecast-chart-box{border:1px solid #e3ebe6;background:#fff;border-radius:14px;padding:14px 16px}
.forecast-chart-top{display:flex;align-items:center;justify-content:space-between;flex-wrap:wrap;gap:10px;margin-bottom:10px}
.forecast-chart-title strong{font-size:14px;color:var(--ink)}
.forecast-chart-desc{font-size:12px;color:var(--muted);margin-left:8px}
.forecast-range-toggle{display:inline-flex;background:#eef3f0;padding:3px;border-radius:8px;gap:2px}
.forecast-range-toggle button{border:0;padding:4px 9px;font-size:11px;border-radius:6px;background:transparent;color:var(--muted);cursor:pointer;transition:background .15s ease,color .15s ease}
.forecast-range-toggle button.active{background:#fff;color:#176b62;font-weight:700;box-shadow:0 2px 6px rgba(0,0,0,.08)}
.forecast-legend{display:flex;flex-wrap:wrap;align-items:center;gap:14px;font-size:11px;color:var(--muted);margin-bottom:12px}
.l-item{display:flex;align-items:center;gap:6px}
.l-bar{width:12px;height:12px;border-radius:3px}
.color-past-new{background:#176b62}
.color-past-rev{background:#e58252}
.color-fut-new{background:repeating-linear-gradient(45deg,#176b62,#176b62 2px,#36a596 2px,#36a596 5px)}
.color-fut-rev{background:repeating-linear-gradient(45deg,#e58252,#e58252 2px,#f2a67e 2px,#f2a67e 5px)}
.forecast-chart-scroll{overflow-x:auto;padding-bottom:6px;-webkit-overflow-scrolling:touch}
.forecast-bars-wrap{display:flex;align-items:flex-end;justify-content:space-between;gap:6px;min-width:580px;height:160px;padding-top:14px}
.f-bar-col{flex:1;display:flex;flex-direction:column;align-items:center;height:100%;cursor:pointer;border-radius:8px;padding:4px 2px;transition:background .15s ease}
.f-bar-col:hover,.f-bar-col.selected{background:rgba(23,107,98,.08)}
.f-bar-col.is-today{background:rgba(23,107,98,.05);border:1.5px solid #218d71;box-shadow:0 0 10px rgba(33,141,113,.15)}
.f-bar-total{font-size:11px;font-weight:700;color:var(--ink);margin-bottom:4px;line-height:1}
.f-bar-track{display:flex;flex-direction:column-reverse;width:100%;max-width:28px;flex:1;border-radius:6px;background:rgba(0,0,0,.03);overflow:hidden}
.f-bar-seg{width:100%;transition:height .25s ease-out}
.seg-new.past{background:#176b62}
.seg-rev.past{background:#e58252}
.seg-new.future{background:repeating-linear-gradient(45deg,#176b62,#176b62 3px,#27a17f 3px,#27a17f 6px);opacity:.85}
.seg-rev.future{background:repeating-linear-gradient(45deg,#e58252,#e58252 3px,#f2a67e 3px,#f2a67e 6px);opacity:.85}
.f-bar-label{display:flex;flex-direction:column;align-items:center;margin-top:6px;gap:2px;line-height:1.1}
.f-date{font-size:11px;font-weight:600;color:var(--ink);white-space:nowrap}
.is-today .f-date{color:#176b62;font-weight:800}
.f-weekday{font-size:10px;color:var(--muted)}
.forecast-detail-box{margin-top:10px;padding:8px 12px;border-radius:8px;background:#f4f8f6;font-size:12px;color:#2e4a42;border-left:3px solid #218d71;line-height:1.45;overflow-wrap:anywhere}
.forecast-detail-box strong{color:#176b62;margin:0 2px}
.f-detail-hint{color:var(--muted)}

/* 深色模式适配 */
html[data-theme="dark"] .forecast-panel{border-color:#3a4246;background:linear-gradient(145deg,#23272a,#1d2022);box-shadow:0 6px 20px rgba(0,0,0,.25)}
html[data-theme="dark"] .forecast-badge{background:#2a443c;color:#77d2b4}
html[data-theme="dark"] .forecast-header-summary strong{color:#f0a171}
html[data-theme="dark"] .forecast-body{border-top-color:#32383c}
html[data-theme="dark"] .f-metric-card{background:#282c2f;border-color:#3b4247}
html[data-theme="dark"] .f-metric-card.highlight-finish{background:linear-gradient(135deg,#263832,#202b28);border-color:#3f6055}
html[data-theme="dark"] .highlight-finish strong{color:#77d2b4}
html[data-theme="dark"] .f-sub{color:#f0a171}
html[data-theme="dark"] .forecast-chart-box{background:#25282b;border-color:#383e42}
html[data-theme="dark"] .forecast-range-toggle{background:#1b1e20}
html[data-theme="dark"] .forecast-range-toggle button.active{background:#33383d;color:#8ddcc2}
html[data-theme="dark"] .f-bar-track{background:rgba(255,255,255,.05)}
html[data-theme="dark"] .f-bar-col:hover,html[data-theme="dark"] .f-bar-col.selected{background:rgba(141,220,194,.1)}
html[data-theme="dark"] .f-bar-col.is-today{border-color:#5bc6a0;background:rgba(91,198,160,.08)}
html[data-theme="dark"] .is-today .f-date{color:#5bc6a0}
html[data-theme="dark"] .forecast-detail-box{background:#1f2825;color:#c4ded5;border-left-color:#5bc6a0}
html[data-theme="dark"] .forecast-detail-box strong{color:#77d2b4}

/* 移动端与 iPhone SE 3 (<=480px) 响应式适配 */
@media(max-width:600px){
  .course-tabs{grid-template-columns:1fr 1fr;gap:6px;margin:4px 0 10px}
  .course-tab{min-height:40px;font-size:13.5px;padding:6px 2px;border-radius:12px;white-space:nowrap}
  .toolbar{padding:9px 11px}
  .today-dashboard{display:grid;grid-template-columns:repeat(6,1fr);gap:6px;margin-bottom:10px}
  .today-dashboard div{grid-column:span 2;padding:9px 8px;border-radius:11px}
  .today-dashboard div:nth-child(4),
  .today-dashboard div:nth-child(5){grid-column:span 3}
  .today-dashboard strong{font-size:16px}
  .today-dashboard span{font-size:10.5px}
  .progress-panel{padding:10px 12px;margin-bottom:12px}
  .forecast-panel{border-radius:14px;margin-bottom:12px}
  .forecast-summary{padding:10px 12px}
  .forecast-summary-head{flex-direction:row;align-items:center;gap:6px;flex:1;min-width:0}
  .forecast-badge{font-size:11px;padding:3px 7px}
  .forecast-header-summary{margin-left:0;font-size:11.5px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
  .forecast-header-summary strong{font-size:13px}
  .forecast-body{padding:4px 10px 12px}
  .forecast-metrics{grid-template-columns:1fr 1fr;gap:6px;margin:0 0 10px}
  .f-metric-card{padding:8px 9px;border-radius:10px;min-height:64px;justify-content:center;gap:2px}
  .f-label{font-size:10px}
  .f-metric-card strong{font-size:14.5px;line-height:1.2}
  .f-sub{font-size:10px;line-height:1.2}
  .forecast-chart-box{padding:10px 9px;border-radius:12px}
  .forecast-chart-top{flex-direction:column;align-items:stretch;gap:6px;margin-bottom:8px}
  .forecast-chart-title{display:flex;flex-direction:column;gap:1px}
  .forecast-chart-title strong{font-size:12.5px}
  .forecast-chart-desc{margin-left:0;font-size:10.5px}
  .forecast-chart-controls{display:flex;align-items:center;justify-content:space-between;gap:6px;width:100%}
  .smoothing-btn{flex:1;font-size:10px;padding:4px 6px;text-align:center;white-space:nowrap}
  .forecast-range-toggle button{padding:4px 7px;font-size:10px}
  .forecast-legend{gap:6px 10px;font-size:10px;margin-bottom:8px}
  .l-bar{width:10px;height:10px}
  .forecast-bars-wrap{height:120px;gap:4px;min-width:460px;padding-top:10px}
  .f-bar-col{padding:2px 1px}
  .f-bar-track{max-width:22px}
  .f-bar-total{font-size:9px;margin-bottom:2px}
  .f-bar-label{margin-top:4px;gap:1px}
  .f-date{font-size:9.5px}
  .f-weekday{font-size:8.5px}
  .forecast-detail-box{margin-top:8px;padding:7px 10px;font-size:11px;border-radius:7px;line-height:1.4}
  .goal-dialog{width:calc(100vw - 20px)!important;max-width:350px!important;padding:14px 12px!important}
  #answerArea:not([hidden]){padding-bottom:calc(70px + env(safe-area-inset-bottom))!important}
}

/* 目标倒计时条与削峰填谷样式 */
.forecast-goal-bar{display:flex;align-items:center;justify-content:space-between;flex-wrap:wrap;gap:10px;padding:11px 14px;background:linear-gradient(135deg,#f0f7f4,#eef5f2);border:1px solid #d3e5dc;border-radius:12px;margin:10px 0 12px}
.goal-info{display:flex;align-items:center;flex-wrap:wrap;gap:8px}
.goal-tag{font-size:11px;font-weight:700;color:#176b62;background:#e1f0e9;padding:3px 8px;border-radius:6px;white-space:nowrap}
.goal-desc{display:flex;flex-direction:column;gap:2px;font-size:12px;color:var(--ink)}
.goal-desc strong{color:#d96e3d}
.goal-advice{font-size:11px;color:var(--muted)}
.goal-advice strong{color:#176b62;font-size:12px}
.goal-actions{display:flex;align-items:center;gap:6px}
.goal-apply-btn{padding:5px 11px;font-size:12px;font-weight:700;color:#fff!important;background:#176b62!important;border-radius:8px;border:0;cursor:pointer;transition:background .15s ease}
.goal-apply-btn:hover{background:#1e8075!important}
.goal-edit-btn{padding:5px 10px;font-size:12px;border-radius:8px}
.smoothing-btn{font-size:11px;padding:4px 9px;border-radius:8px;border:1px solid #d3e3db;color:var(--muted);transition:all .15s ease;cursor:pointer}
.smoothing-btn.active{background:#e8f4ef;color:#176b62;font-weight:700;border-color:#b0d7c7}
.goal-quick-presets{display:flex;flex-wrap:wrap;gap:6px;margin:12px 0}
.preset-btn{padding:6px 12px;font-size:12px;border-radius:8px;border:1px solid #d3e3db;background:#f5f8f6;cursor:pointer}
.preset-btn:hover{background:#e7f0ec;border-color:#b4d1c4}

@media(max-width:480px){
  header{padding:10px 12px!important;gap:6px!important}
  .brand h1{font-size:18px!important}
  .brand-subtitle{font-size:10.5px!important;margin-top:1px!important}
  .header-actions{gap:4px!important}
  .header-actions button,.header-actions label{min-height:30px!important;padding:3px 6px!important;font-size:11px!important}
  .sync-pill{min-height:26px!important;padding:3px 8px!important;font-size:10.5px!important}
  .mode-tabs{margin:8px 0!important;padding:3px!important}
  .mode-tabs .tab{padding:7px 6px!important;font-size:12px!important}
  .course-tabs{grid-template-columns:1fr 1fr!important;gap:5px!important;margin:3px 0 8px!important}
  .course-tab{min-height:36px!important;font-size:12.5px!important;padding:4px 1px!important;border-radius:10px!important;white-space:nowrap!important}
  .course-tab:last-child{grid-column:auto!important}
  .toolbar{display:grid!important;grid-template-columns:1fr 1fr!important;gap:6px!important;padding:8px 9px!important}
  .chapter-field{grid-column:1/-1!important;min-width:0!important}
  .chapter-picker-toggle{min-height:34px!important;padding:5px 8px!important;font-size:12px!important}
  .toolbar label{display:flex!important;flex-direction:column!important;gap:2px!important;font-size:11px!important}
  .toolbar select{min-height:30px!important;padding:3px 4px!important;font-size:11.5px!important}
  #resetBtn{grid-column:1/-1!important;min-height:28px!important;padding:3px!important;font-size:11px!important}
  .card{padding:20px 16px!important;border-radius:16px!important;min-height:36vh!important}
  .card-content{font-size:20px!important;line-height:1.5!important}
  .answer{padding:15px 13px!important;border-radius:15px!important}
  .grade-row button{min-height:44px!important;font-size:14.5px!important}
  .forecast-goal-bar{padding:8px 10px;gap:6px;border-radius:10px;margin:6px 0 10px}
  .goal-info{gap:6px}
  .goal-tag{font-size:10px;padding:2px 6px}
  .goal-desc{font-size:11px;line-height:1.3}
  .goal-advice{font-size:10px;line-height:1.3}
  .goal-actions{width:100%;display:flex;gap:6px;margin-top:2px}
  .goal-apply-btn{flex:1;padding:5px 6px;font-size:11px;text-align:center}
  .goal-edit-btn{padding:5px 8px;font-size:11px}
  #answerArea:not([hidden]){padding-bottom:calc(75px + env(safe-area-inset-bottom))!important}
}

/* 深色模式适配 */
html[data-theme="dark"] .forecast-goal-bar{background:linear-gradient(135deg,#242f2b,#1d2623);border-color:#384d44}
html[data-theme="dark"] .goal-tag{background:#1f3930;color:#7ad3b7}
html[data-theme="dark"] .goal-advice strong{color:#7ad3b7}
html[data-theme="dark"] .goal-desc strong{color:#f0a171}
html[data-theme="dark"] .goal-apply-btn{background:#23826e!important;color:#fff!important}
html[data-theme="dark"] .goal-apply-btn:hover{background:#2ca28a!important}
html[data-theme="dark"] .smoothing-btn{border-color:#434e54;color:#a0abb0}
html[data-theme="dark"] .smoothing-btn.active{background:#233932;color:#7ad3b7;border-color:#365e51}
html[data-theme="dark"] .preset-btn{background:#2a3135;border-color:#434e54;color:#d5dee2}
html[data-theme="dark"] .preset-btn:hover{background:#364046;border-color:#5c6b73}

/* AI 问答笔记展示区与高亮样式优化 */
.ai-annotation{background:rgba(52,125,184,.12)!important;text-decoration:underline 2px #347db8!important;text-decoration-skip-ink:none;text-underline-offset:4px;cursor:pointer;border-radius:3px;padding:0 2px}
html[data-theme="dark"] .ai-annotation{background:rgba(126,217,191,.16)!important;text-decoration:underline 2px #7ed9bf!important;text-underline-offset:4px;color:inherit}
.card-ai-notes-section{margin-top:18px;padding:14px 16px;border-radius:12px;background:var(--soft,#f4f6f8);border:1px solid var(--line,#e2e6ea);text-align:left}
html[data-theme="dark"] .card-ai-notes-section{background:#24292d;border-color:#3b4247}
.card-ai-notes-header{display:flex;align-items:center;justify-content:space-between;gap:8px;margin-bottom:12px}
.card-ai-notes-badge{font-size:.92rem;font-weight:700;color:#1d6fa5;display:flex;align-items:center;gap:6px}
html[data-theme="dark"] .card-ai-notes-badge{color:#79c0ff}
.card-ai-ask-direct-btn{font-size:.8rem;padding:4px 10px;border-radius:6px;border:1px solid var(--line,#ccd4d9);background:var(--paper,#fff);color:var(--ink,#333);cursor:pointer}
html[data-theme="dark"] .card-ai-ask-direct-btn{background:#33393e;border-color:#4b5359;color:#e2e8eb}
.card-ai-thread{padding:11px 13px;border-radius:8px;background:var(--paper,#fff);border:1px solid var(--line,#eaeff2);margin-bottom:10px}
html[data-theme="dark"] .card-ai-thread{background:#2b3035;border-color:#3f474d}
.card-ai-quote{font-size:.85rem;color:var(--muted,#666);padding:5px 10px;background:rgba(0,0,0,.03);border-left:3px solid #347db8;border-radius:0 4px 4px 0;margin-bottom:10px}
html[data-theme="dark"] .card-ai-quote{background:rgba(255,255,255,.05);border-left-color:#7ed9bf;color:#abb3b7}
.thread-turn{margin-bottom:10px;padding-bottom:10px;border-bottom:1px dashed var(--line,#eaeff2)}
html[data-theme="dark"] .thread-turn{border-bottom-color:#3f474d}
.thread-turn:last-child{border-bottom:none;margin-bottom:0;padding-bottom:0}
.thread-q{font-size:.9rem;font-weight:600;color:var(--ink,#222);margin-bottom:6px;display:flex;align-items:baseline;gap:8px}
.thread-q p{margin:0}
.role-tag{display:inline-block;font-size:.72rem;padding:2px 6px;border-radius:4px;background:#e2e8f0;color:#475569;font-weight:700;flex-shrink:0}
.role-ai{background:#dbeafe;color:#1e40af}
html[data-theme="dark"] .role-tag{background:#39424a;color:#cbd5e1}
html[data-theme="dark"] .role-ai{background:#1e3a5f;color:#93c5fd}
.thread-a{font-size:.9rem;line-height:1.65;color:var(--ink,#333);margin-top:4px}
.thread-time{display:block;font-size:.75rem;color:var(--muted,#888);margin-top:6px;text-align:right}
.card-ai-thread-actions{display:flex;justify-content:flex-end;gap:8px;margin-top:10px;padding-top:8px;border-top:1px solid var(--line,#eaeff2)}
html[data-theme="dark"] .card-ai-thread-actions{border-top-color:#3f474d}
.card-ai-thread-actions button{font-size:.78rem;padding:3px 8px}
.ai-chip{background:#e0f2fe!important;color:#0369a1!important;border-color:#bae6fd!important}
html[data-theme="dark"] .ai-chip{background:#172554!important;color:#93c5fd!important;border-color:#1e3a8a!important}

/* AI 思考过程折叠框 (DeepSeek-R1 / Reasoning models) */
.ai-reasoning-box{margin:6px 0 10px;padding:9px 12px;border-radius:10px;background:rgba(0,0,0,.025);border:1px dashed #cedbd5;font-size:.84rem;line-height:1.55}
html[data-theme="dark"] .ai-reasoning-box{background:rgba(255,255,255,.03);border-color:#485258}
.ai-reasoning-summary{cursor:pointer;color:var(--muted);font-weight:600;user-select:none;display:flex;align-items:center;gap:6px}
.ai-reasoning-summary:hover{color:var(--ink)}
.ai-reasoning-content{margin-top:7px;color:var(--muted);white-space:pre-wrap;word-break:break-word;font-size:.82rem;border-top:1px solid #e2ebe6;padding-top:7px}
html[data-theme="dark"] .ai-reasoning-content{border-top-color:#3c4348}

/* 打字机光标与实时渲染态 */
.ai-typing-cursor{position:relative;display:inline-block;color:var(--muted);font-style:italic}
.ai-typing-cursor:after{content:"▋";display:inline-block;margin-left:4px;color:#1d8b70;animation:aiBlink .8s infinite alternate}
@keyframes aiBlink{0%{opacity:1}100%{opacity:.15}}
html[data-theme="dark"] .ai-typing-cursor:after{color:#5bc6a0}

/* 对话弹窗头部“关闭”按钮对比度增强 */
.sync-head button.quiet{background:#eef3f1;color:#183630;border:1px solid #b8cfc6;font-weight:600;border-radius:20px;padding:5px 14px;box-shadow:0 1px 4px rgba(0,0,0,.04)}
.sync-head button.quiet:hover{background:#dfeae4;border-color:#9ebdcd}
html[data-theme="dark"] .sync-head button.quiet{background:#353b40;color:#e8edf0;border:1px solid #576168}
html[data-theme="dark"] .sync-head button.quiet:hover{background:#424950;border-color:#6f7b84}

/* 保证数学公式块在各种屏幕上横向滚动、居中、清晰 */
.ai-dialog .ai-math-block{display:block;max-width:100%;overflow-x:auto;overflow-y:hidden;-webkit-overflow-scrolling:touch;margin:.6em 0;padding:8px 6px;text-align:center}
.ai-dialog .ai-math-block .katex-display{margin:0}

/* ==========================================================================
   移动端与公式防横向溢出全局防护 (Mobile Horizontal Overflow & KaTeX Protection)
   彻底防止长公式、表格撑破卡片宽度导致右侧内容或按钮被视口截断
   ========================================================================== */
.study, #studyArea {
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) !important;
  width: 100% !important;
  max-width: 100% !important;
  box-sizing: border-box !important;
}

.card, #card, .answer, #answerArea {
  width: 100% !important;
  max-width: 100% !important;
  min-width: 0 !important;
  box-sizing: border-box !important;
  overflow-x: hidden !important;
}

.card-content, #front, .card-side, .answer-title, .self-check {
  max-width: 100% !important;
  min-width: 0 !important;
  box-sizing: border-box !important;
  overflow-wrap: anywhere !important;
  word-break: break-word !important;
}

.answer-content, #back, .point-answer, .answer-rich {
  max-width: 100% !important;
  min-width: 0 !important;
  box-sizing: border-box !important;
  overflow-wrap: anywhere !important;
  word-break: break-word !important;
}

/* 块级公式在手机屏幕上自适应横向滚动，公式居中，不挤压外层 */
.katex-display {
  max-width: 100% !important;
  overflow-x: auto !important;
  overflow-y: hidden !important;
  -webkit-overflow-scrolling: touch !important;
  box-sizing: border-box !important;
  margin: .65em 0 !important;
  padding: 8px 6px !important;
}

/* 行内公式最大宽度受限，包含超长行内公式的段落支持内部滚动，不把外层容器撑开 */
.answer-content p, .point-answer p, .answer-rich p {
  max-width: 100% !important;
  overflow-x: auto !important;
  -webkit-overflow-scrolling: touch !important;
}

.grade-row {
  width: 100% !important;
  max-width: 100% !important;
  box-sizing: border-box !important;
}

.table-scroll {
  width: 100% !important;
  max-width: 100% !important;
  overflow-x: auto !important;
  -webkit-overflow-scrolling: touch !important;
  margin: 10px 0 !important;
}

@media(max-width:600px){
  .card, #card{
    padding: 20px 16px !important;
    box-sizing: border-box !important;
  }
  .answer, #answerArea{
    padding: 16px 14px !important;
    box-sizing: border-box !important;
  }
  .card-content, #front{
    font-size: 20px !important;
    line-height: 1.48 !important;
  }
  .answer-content, #back{
    font-size: 15.5px !important;
    line-height: 1.68 !important;
  }
}
