@font-face{font-family:zz-serif;src:local("Noto Serif SC"),local("Songti SC"),local("SimSun")}
*{box-sizing:border-box}
html{height:100%;-webkit-text-size-adjust:100%;text-size-adjust:100%}
body{margin:0;color:#263b35;background:#f5f5ef;font:15px/1.65 -apple-system,BlinkMacSystemFont,"Segoe UI","PingFang SC","Microsoft YaHei",sans-serif;min-height:100vh;min-height:100dvh}
button,input,select,textarea{font:inherit}
button,a,input,select,textarea{-webkit-tap-highlight-color:transparent}
button{cursor:pointer;background:#fff;border:1px solid #d9e0d8;border-radius:9px;padding:8px 14px;color:#264d42;min-height:40px;touch-action:manipulation}
button:hover{background:#eaf0e8}
button:disabled{opacity:.45;cursor:default}
button.active{background:#e0eadf;border-color:#b8cbb5;color:#143e2c}
button:focus-visible,a:focus-visible,input:focus-visible,select:focus-visible,textarea:focus-visible{outline:3px solid #bd9c58;outline-offset:2px}
a{color:#226347;text-underline-offset:3px}
input,select,textarea{border:1px solid #d8dfd4;background:#fff;color:#263b35;border-radius:9px;padding:10px 12px;width:100%;min-width:0}
textarea{resize:vertical;line-height:1.7}
label{display:block;font-size:13px;color:#62746a;margin:14px 0 6px}
h1,h2,h3,p{margin-top:0}
h2{font-size:20px;letter-spacing:-.3px}
.muted{color:#768279;font-size:13px}
.eyebrow{font-size:10px;letter-spacing:2px;font-weight:650;color:#788475;text-transform:uppercase}
.primary{background:#204f3e;border-color:#204f3e;color:#fff;font-weight:600}
.primary:hover{background:#163e2f}
.danger{color:#a33d34;border-color:#e4c7c4}
.danger:hover{background:#f8ecea}
.text-btn{background:transparent;border:0}
.error{color:#a33d34;font-size:13px;min-height:1.5em;margin:8px 0 4px}
.check{display:flex;align-items:center;gap:8px;font-size:14px;color:#3b4f46}
.check input{width:18px;height:18px}
.paired{display:grid;grid-template-columns:1fr 1fr;gap:10px}
.spacer{flex:1}
[hidden]{display:none!important}
.sr-only{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0,0,0,0)}

/* 品牌 */
.wordmark{display:flex;align-items:center;gap:10px;color:inherit;text-decoration:none;font-weight:650;letter-spacing:1px;line-height:1.3}
.brand-symbol{display:grid;place-items:center;width:38px;height:42px;background:#214938;color:#fbf7e9;font-family:zz-serif,serif;font-size:23px;border-radius:10px 2px;flex-shrink:0}
.wordmark small{display:block;font-size:10px;letter-spacing:2px;color:#89938a;margin-top:5px;font-weight:500}

/* 登录 */
.login-screen{min-height:100vh;min-height:100dvh;display:grid;grid-template-columns:1.04fr 1fr;padding:24px;gap:24px}
.login-story{background:#1d4236;color:#f3f0de;border-radius:20px;padding:48px 54px;display:flex;flex-direction:column;justify-content:space-between;position:relative;overflow:hidden}
.login-story:after{content:"";position:absolute;width:440px;height:440px;right:-280px;top:80px;border:1px solid #6e8a59;border-radius:50%;box-shadow:0 0 0 38px #ffffff03,0 0 0 80px #ffffff03,0 0 0 120px #ffffff03;pointer-events:none}
.login-story .eyebrow{color:#aebe9d}
.login-story .brand-symbol{border:1px solid #d0d6b550}
.login-story h1{font-family:zz-serif,"Songti SC",serif;font-size:clamp(34px,4vw,58px);font-weight:400;line-height:1.55;margin:20px 0 28px;letter-spacing:3px}
.intro{color:#b9cbbb;font-size:16px;line-height:2}
.login-foot{display:flex;justify-content:space-between;gap:16px;color:#a6bda8;font-size:12px;padding-top:55px;border-top:1px solid #ffffff16}
.login-form-wrap{display:flex;align-items:center;justify-content:center;padding:50px 30px}
.login-form{width:min(100%,370px)}
.login-form h2{font-size:29px;font-weight:550;margin:15px 0 10px}
.login-form input{min-height:50px;background:#fdfdf9;font-size:16px}
.login-form label{margin-top:24px}
.password-wrap{position:relative}
.password-wrap input{padding-right:60px}
.password-wrap button{position:absolute;right:6px;top:5px}
.login-form .primary{width:100%;display:flex;justify-content:space-between;padding:13px 18px;margin-top:8px}
.login-hint{text-align:center;font-size:12px;color:#869181;margin:24px 0}
.remember-login{margin-top:18px}

/* 顶栏与页面 */
.topbar{height:72px;display:flex;align-items:center;justify-content:space-between;gap:16px;padding:0 24px;background:#fcfcf8;border-bottom:1px solid #dfe5da;position:sticky;top:0;z-index:10}
.main-tabs{display:flex;padding:4px;background:#eef0e8;border-radius:10px;gap:2px}
.main-tabs a{text-decoration:none;color:#56695f;padding:8px 16px;border-radius:8px;font-size:14px;min-width:72px;text-align:center}
.main-tabs a.active{background:#fff;color:#143e2c;box-shadow:0 2px 7px #2646290c;font-weight:600}
.top-actions{display:flex;align-items:center;gap:10px}
.sync-pill{font-size:11px;color:#708671;padding:4px 10px;border:1px solid #dfe5da;border-radius:999px;background:#fff;white-space:nowrap}
.sync-pill.warn{color:#8a5a12;border-color:#ead7a9;background:#fbf4e4}
.sync-pill.bad{color:#a33d34;border-color:#e4c7c4;background:#f8ecea}
.banner{background:#fbf4e4;color:#6d4b0e;border-bottom:1px solid #ead7a9;padding:10px 24px;font-size:13px;display:flex;gap:12px;align-items:center;flex-wrap:wrap}
.banner button{min-height:32px;padding:4px 12px;font-size:12px}
.view{max-width:820px;margin:0 auto;padding:28px 22px calc(40px + env(safe-area-inset-bottom))}
.card-panel{background:#fffef9;border:1px solid #e3e8dd;border-radius:16px;padding:22px 24px;margin-bottom:18px;box-shadow:0 1px 0 #ffffff inset}
.section-heading{display:flex;justify-content:space-between;align-items:center;gap:8px;margin-bottom:12px}
.section-heading h2{margin:0;font-size:17px;color:#2c4a3a}
.row{display:flex;gap:10px;align-items:center;flex-wrap:wrap}
.row.right{justify-content:flex-end}
.pill{display:inline-block;font-size:11px;padding:2px 8px;border-radius:999px;background:#eef0e8;color:#52685b;margin-right:6px}
.pill.new{background:#e5eefb;color:#2d5088}.pill.learning{background:#fbf0d9;color:#7b5312}.pill.review{background:#e3efe4;color:#2a5f3c}.pill.relearning{background:#f8e5e2;color:#8a3a31}.pill.suspended{background:#eee;color:#777}
.pill.kind-cloze{background:#efe7f6;color:#5d3f7c}.pill.kind-qa{background:#e3efe4;color:#2a5f3c}
.pill.role{background:#fff1d6;color:#7a4b00}
.pill.imp-3{background:#fde3e0;color:#9b2b2b;font-weight:600}.pill.imp-2{background:#fff1d6;color:#7a4b00}.pill.imp-1{background:#eef0e8;color:#6b7c73}
.login-game{margin:14px 0 0;font-size:13px}.login-game a{color:#cfe3d4;text-decoration:none;border-bottom:1px dotted #9fbfa8}.login-game a:hover{color:#fff}
.game-panel{display:flex;justify-content:space-between;align-items:center;gap:12px;flex-wrap:wrap}.game-panel a{text-decoration:none}
.topic-line{font-size:13px;color:#7a4b00;background:#fff8ea;border-left:3px solid #e9b949;padding:6px 10px;border-radius:6px;margin:8px 0 4px}

/* 今日 */
.hero{display:grid;grid-template-columns:1.2fr 1fr;gap:18px;align-items:stretch}
.hero .big{background:#1d4236;color:#f3f0de;border-radius:18px;padding:26px 28px;display:flex;flex-direction:column;justify-content:space-between;gap:18px;min-height:220px;position:relative;overflow:hidden}
.hero .big .eyebrow{color:#aebe9d}
.hero .big h2{color:#fff;font-family:zz-serif,"Songti SC",serif;font-weight:400;font-size:30px;margin:8px 0 4px;letter-spacing:1px}
.hero .big .primary{background:#f3f0de;color:#1d4236;border-color:#f3f0de;font-size:16px;padding:12px 18px;align-self:flex-start}
.hero .big .primary:hover{background:#fff}
.counts{display:flex;gap:18px;flex-wrap:wrap}
.counts div{min-width:70px}
.counts strong{display:block;font-size:30px;font-weight:500;line-height:1.2}
.counts span{font-size:11px;letter-spacing:1px;color:#b9cbbb}
.stat-grid{display:grid;grid-template-columns:repeat(2,1fr);gap:12px}
.stat-grid .card-panel{margin:0;padding:16px 18px}
.stat-grid strong{display:block;font-size:26px;font-weight:500;color:#28523c;line-height:1.3}
.stat-grid span{font-size:12px;color:#69816b}
.history{display:flex;gap:4px;align-items:flex-end;height:46px;margin-top:10px}
.history i{flex:1;background:#cfdccb;border-radius:3px 3px 0 0;min-height:3px;display:block}
.history i.today{background:#204f3e}
.subject-row{display:grid;grid-template-columns:1fr auto;gap:12px;align-items:center;padding:12px 0;border-top:1px solid #edf0e8}
.subject-row:first-of-type{border-top:0}
.subject-row .name{font-weight:600;color:#2c4a3a}
.subject-row .bar{height:6px;background:#eef0e8;border-radius:3px;margin-top:8px;overflow:hidden;display:flex}
.subject-row .bar i{display:block;height:100%}
.subject-row .bar .b-review{background:#4c8a62}.subject-row .bar .b-learning{background:#d9a441}.subject-row .bar .b-new{background:#c9d7e8}
.subject-row .meta{font-size:12px;color:#7a8a7e;margin-top:6px}
.subject-row button{font-size:12px;min-height:36px;white-space:nowrap}

/* 复习 */
.review-top{display:flex;justify-content:space-between;align-items:center;gap:10px;margin-bottom:14px;font-size:12px;color:#7a8a7e}
.review-top .progress{flex:1;height:5px;background:#e4e9df;border-radius:3px;overflow:hidden}
.review-top .progress i{display:block;height:100%;background:#4c8a62}
.flashcard{background:#fffef9;border:1px solid #e3e8dd;border-radius:20px;padding:30px clamp(20px,4vw,40px) 26px;min-height:300px;display:flex;flex-direction:column;gap:18px;box-shadow:0 10px 40px #1f3a2e0d}
.flashcard .meta{display:flex;justify-content:space-between;gap:10px;align-items:center;flex-wrap:wrap}
.flashcard .meta .eyebrow{letter-spacing:1.5px}
.flashcard .front{font-size:20px;line-height:1.85;color:#22372e}
.flashcard .front.cloze{font-size:19px}
.flashcard .back{border-top:1px dashed #d9e1d4;padding-top:18px;font-size:17px;line-height:1.9;color:#3f493c}
.flashcard .note{font-size:12px;color:#86927f;border-top:1px solid #edf0e8;padding-top:12px}
.blank{display:inline-block;min-width:3.2em;padding:0 .4em;border-bottom:2px solid #b89350;color:#b89350;text-align:center;font-weight:600;letter-spacing:1px}
mark.answer{background:#fff0bf;color:#3c2e05;border-radius:3px;padding:0 3px;font-weight:600}
mark.other{background:transparent;color:inherit;text-decoration:underline dotted #b8c6b4}
.text p{margin:0 0 .6em}.text p:last-child{margin-bottom:0}.text ul,.text ol{margin:.2em 0 .6em;padding-left:1.5em}.text li{margin:.2em 0}
.actions{display:grid;grid-template-columns:repeat(4,1fr);gap:10px;margin-top:18px}
.actions button{min-height:58px;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:2px;border-width:1px}
.actions button small{font-size:11px;color:#7a8a7e;font-weight:400}
.actions .again{border-color:#e4c7c4;color:#a33d34}.actions .hard{border-color:#ead7a9;color:#8a5a12}.actions .good{border-color:#bcd5c2;color:#2a5f3c}.actions .easy{border-color:#c6d6ea;color:#2d5088}
.actions .again:hover{background:#f8ecea}.actions .hard:hover{background:#fbf4e4}.actions .good:hover{background:#e3efe4}.actions .easy:hover{background:#e5eefb}
.show-answer{width:100%;min-height:58px;font-size:16px;margin-top:18px}
.review-tools{display:flex;justify-content:space-between;gap:8px;margin-top:14px;flex-wrap:wrap}
.review-tools button{font-size:12px;min-height:34px;border:0;background:transparent;color:#6c8170}
.kbd{font-size:10px;color:#9aa596;margin-top:10px;text-align:center}
.kbd kbd{border:1px solid #d9e0d8;border-radius:4px;padding:0 5px;background:#fff;font-family:inherit}
.session-done{text-align:center;padding:40px 20px}
.session-done h2{font-family:zz-serif,"Songti SC",serif;font-weight:400;font-size:28px;color:#28432f}
.picker{display:grid;grid-template-columns:1fr 1fr;gap:10px}

/* 卡片库 */
.filters{display:grid;grid-template-columns:1fr 1fr 1fr 1.4fr;gap:10px;margin-bottom:14px}
.filters label{margin:0 0 4px;font-size:11px}
.filters select,.filters input{padding:8px 10px;font-size:13px}
.list-meta{display:flex;justify-content:space-between;align-items:center;font-size:12px;color:#7a8a7e;margin:6px 0 10px}
.note-row{display:block;width:100%;text-align:left;background:#fffef9;border:1px solid #e3e8dd;border-radius:12px;padding:14px 16px;margin-bottom:8px;min-height:0}
.note-row:hover{background:#fbfcf6}
.note-row .excerpt{display:block;color:#2c4a3a;font-size:15px;line-height:1.7;margin-top:6px;overflow-wrap:anywhere}
.note-row .tail{display:flex;gap:8px;flex-wrap:wrap;font-size:11px;color:#86927f;margin-top:8px}
.more{width:100%;margin-top:6px}

/* 导入 */
.import-grid{display:grid;grid-template-columns:1fr;gap:14px}
.import-grid textarea{font-family:Consolas,"SFMono-Regular",Menlo,monospace;font-size:13px;min-height:220px}
.format-help{font-size:13px;color:#52685b;background:#f3f5ec;border-radius:12px;padding:16px 18px}
.format-help pre{margin:10px 0 0;white-space:pre-wrap;font-family:Consolas,"SFMono-Regular",Menlo,monospace;font-size:12px;line-height:1.7;color:#3b4f46}
.preview-table{width:100%;border-collapse:collapse;font-size:13px;margin-top:10px}
.preview-table th,.preview-table td{border-bottom:1px solid #e3e8dd;padding:8px 6px;text-align:left;vertical-align:top}
.preview-table th{font-size:11px;color:#788475;letter-spacing:1px}
.errors{background:#f8ecea;border-radius:10px;padding:12px 14px;font-size:13px;color:#8a3a31;margin-top:10px}
.starter-list button{display:flex;justify-content:space-between;width:100%;text-align:left;margin-bottom:8px;gap:12px}
.starter-list small{color:#7a8a7e}

/* 设置 */
.settings-grid{display:grid;grid-template-columns:1fr 1fr;gap:10px 16px}
.settings-grid label{margin-top:8px}
.settings-actions{display:flex;gap:10px;flex-wrap:wrap;margin-top:16px}

/* 对话框与提示 */
dialog{border:1px solid #d9e1d1;border-radius:15px;padding:25px;width:min(640px,calc(100vw - 28px));max-height:88vh;max-height:88dvh;overflow:auto;background:#fffef9;color:#304c36;box-shadow:0 20px 100px #132e2833}
dialog::backdrop{background:#17382b66;backdrop-filter:blur(3px)}
.dialog-heading{display:flex;align-items:center;justify-content:space-between;gap:12px;margin-bottom:10px}
.dialog-heading h2{margin:0;font-size:20px}
.dialog-heading button{border:0;background:transparent;font-size:20px}
.dialog-actions{display:flex;gap:10px;align-items:center;margin-top:20px}
#toast{position:fixed;bottom:calc(25px + env(safe-area-inset-bottom));left:50%;transform:translateX(-50%);z-index:1000;padding:12px 20px;border-radius:10px;background:#244735;color:#fff;box-shadow:0 4px 30px #12342530;max-width:calc(100vw - 30px);width:max-content;font-size:13px}

@media(max-width:900px){.topbar{padding:0 16px}.main-tabs a{padding:8px 10px;min-width:0;font-size:13px}.topbar .wordmark small{display:none}}
@media(max-width:640px){
 input,textarea,select{font-size:16px!important}
 .login-screen{display:block;padding:0}
 .login-story{border-radius:0;padding:28px 26px 24px;min-height:280px;gap:25px}
 .login-story h1{font-size:30px;line-height:1.45;margin:12px 0}
 .login-story .intro{font-size:13px;margin:0}
 .login-foot{display:none}
 .login-form-wrap{padding:34px 28px calc(35px + env(safe-area-inset-bottom))}
 .topbar{height:auto;padding:10px 12px 0;flex-wrap:wrap;gap:6px}
 .topbar .wordmark{font-size:14px}
 .brand-symbol{width:30px;height:33px;font-size:19px}
 .topbar .main-tabs{order:3;flex-basis:100%;background:transparent;padding:0;justify-content:space-between;border-top:1px solid #e8ecdf;border-radius:0;margin-top:6px}
 .main-tabs a{flex:1;font-size:13px;padding:10px 4px;border-radius:0}
 .main-tabs a.active{background:transparent;box-shadow:inset 0 -2px #446842}
 .view{padding:18px 14px calc(40px + env(safe-area-inset-bottom))}
 .hero{grid-template-columns:1fr}
 .hero .big{padding:22px 20px;min-height:0}
 .hero .big h2{font-size:25px}
 .stat-grid{grid-template-columns:1fr 1fr}
 .flashcard{padding:22px 18px 20px;min-height:240px;border-radius:16px}
 .flashcard .front{font-size:18px}
 .actions{gap:7px}
 .actions button{min-height:54px;padding:6px 4px;font-size:14px}
 .filters{grid-template-columns:1fr 1fr}
 .settings-grid{grid-template-columns:1fr}
 .picker{grid-template-columns:1fr}
 .card-panel{padding:16px 16px;border-radius:14px}
 dialog{padding:18px;max-height:92dvh}
 .kbd{display:none}
}
/* 公式（KaTeX，数学品牌才加载）：独立公式可横向滚动，不撑破卡片 */
.text .katex{font-size:1.08em}
.text .katex-display{overflow-x:auto;overflow-y:hidden;padding:6px 2px;margin:.4em 0}
.text .katex-display>.katex{white-space:nowrap}
.flashcard .front .katex-display{font-size:1.1em}
.note-row .excerpt .katex{font-size:1em}
@media(prefers-reduced-motion:reduce){*{scroll-behavior:auto!important;transition:none!important}}
