:root{
  --bg:#f4f6f8;--card:#fff;--text:#172033;--muted:#68758b;--line:#dfe4ea;
  --brand:#2563eb;--brand-soft:#eff6ff;--good:#16803c;--good-bg:#ecfdf3;
  --bad:#c9362b;--bad-bg:#fff1f0;--shadow:0 8px 30px rgba(23,32,51,.06);--radius:18px
}
*{box-sizing:border-box}
html{font-family:Inter,"PingFang SC","Microsoft YaHei",system-ui,-apple-system,sans-serif;color:var(--text);background:var(--bg)}
body{margin:0;min-height:100vh}button,input{font:inherit}button{cursor:pointer}
.topbar{height:70px;padding:0 30px;display:flex;align-items:center;justify-content:space-between;background:#fff;border-bottom:1px solid var(--line);position:sticky;top:0;z-index:20}
.brand{display:flex;align-items:center;gap:11px}.brand-mark{width:40px;height:40px;border-radius:12px;background:var(--brand);color:#fff;display:grid;place-items:center;font-size:24px;font-weight:700}.brand strong{display:block;font-size:17px}.brand small{display:block;color:var(--muted);font-size:12px;margin-top:2px}.topbar nav a{color:var(--brand);text-decoration:none;font-size:15px;font-weight:650}
.layout{max-width:1600px;margin:0 auto;padding:22px;display:grid;grid-template-columns:470px minmax(0,1fr);gap:22px;align-items:start}
.panel{background:var(--card);border:1px solid var(--line);border-radius:var(--radius);box-shadow:var(--shadow)}
.setup-panel{padding:22px;position:sticky;top:92px;max-height:calc(100vh - 114px);display:flex;flex-direction:column}
.section-head{display:flex;align-items:flex-start;justify-content:space-between;gap:12px}.section-head h2{margin:0;font-size:23px}.section-head p{margin:6px 0 0;color:var(--muted);font-size:14px}.section-head.compact{align-items:center}
.search-wrap{margin-top:17px}.search-wrap input,.count-row input,.answer-row input{width:100%;border:1.5px solid #d3d9e2;border-radius:13px;background:#fff;color:var(--text);outline:none;transition:.15s}
.search-wrap input{padding:14px 15px;font-size:17px}.search-wrap input:focus,.count-row input:focus{border-color:#8cb2ff;box-shadow:0 0 0 3px rgba(37,99,235,.1)}
.quick-actions{display:flex;gap:9px;margin-top:12px;flex-wrap:wrap}.ghost-btn,.icon-btn{border:1px solid var(--line);background:#fff;color:#44506a;border-radius:11px;padding:10px 14px;font-size:15px}.ghost-btn:hover{background:#f8fafc}.ghost-btn:disabled{opacity:.45;cursor:not-allowed}.icon-btn{padding:6px 10px;font-size:22px}.danger-text{color:var(--bad)}
.category-tabs{display:flex;gap:10px;overflow-x:auto;overflow-y:hidden;padding:16px 2px 13px;scrollbar-width:none;-webkit-overflow-scrolling:touch;scroll-snap-type:x proximity;overscroll-behavior-x:contain}.category-tabs::-webkit-scrollbar{display:none}.category-tabs button{flex:0 0 auto;white-space:nowrap;border:1.5px solid var(--line);background:#fff;border-radius:999px;min-height:50px;min-width:86px;padding:11px 18px;font-size:clamp(18px,1.45vw,20px);line-height:1.15;color:#596579;scroll-snap-align:start;touch-action:manipulation}.category-tabs button.active{background:var(--brand-soft);border-color:#9fc2ff;color:var(--brand);font-weight:750;box-shadow:0 0 0 2px rgba(37,99,235,.04)}
.type-list{overflow:auto;min-height:230px;padding-right:7px;border-top:1px solid var(--line);border-bottom:1px solid var(--line);scrollbar-width:thin}
.type-item{display:flex;align-items:center;gap:12px;padding:12px 7px;border-bottom:1px dashed #e9edf2;font-size:16px;line-height:1.5;min-height:49px}.type-item:last-child{border-bottom:0}.type-item input{width:20px;height:20px;margin:0;flex:0 0 auto;accent-color:var(--brand)}.type-item label{cursor:pointer;flex:1}.type-item.hidden-type{display:none}
.setup-bottom{padding-top:16px}.field-label{display:block;font-size:16px;font-weight:700;margin-bottom:9px}.count-row{display:flex;align-items:center;gap:15px}.count-row input{width:130px;padding:12px;font-size:17px}.switch-line{font-size:16px;color:#4d586d;display:flex;gap:8px;align-items:center}.switch-line input{width:18px;height:18px}.field-help{font-size:13px;line-height:1.55;color:var(--muted);margin:8px 0 13px}
.primary-btn{border:0;background:var(--brand);color:#fff;border-radius:13px;padding:13px 20px;font-size:16px;font-weight:700;box-shadow:0 5px 14px rgba(37,99,235,.18)}.primary-btn:hover{filter:brightness(.97)}.start-btn{width:100%;font-size:18px;padding:14px}
.practice-shell{min-width:0}.practice-toolbar{min-height:46px;display:flex;align-items:center;justify-content:space-between;gap:10px;margin-bottom:12px}.progress-text{font-size:15px;color:#58647a}.toolbar-actions{display:flex;gap:8px}
.question-card{min-height:560px;padding:36px;display:flex;align-items:center;justify-content:center}.welcome{text-align:center;max-width:620px}.welcome-icon{font-size:46px}.welcome h1{font-size:30px;margin:12px 0 8px}.welcome p{color:var(--muted);font-size:16px;line-height:1.7;margin:0 0 24px}.question-view{width:min(920px,100%)}
.question-meta{display:flex;align-items:center;justify-content:space-between;gap:12px;color:var(--muted);font-size:14px}.type-badge{padding:6px 10px;border-radius:999px;background:var(--brand-soft);color:var(--brand);max-width:72%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.question-text{font-size:clamp(30px,4.5vw,54px);font-weight:700;line-height:1.55;text-align:center;margin:46px auto 34px;min-height:90px;overflow-wrap:anywhere}.question-text.data-question{font-size:clamp(21px,2.8vw,33px);line-height:1.7;text-align:left;max-width:850px;margin-top:34px;margin-bottom:28px;font-weight:650}
.answer-row{max-width:620px;margin:0 auto}.answer-row input{font-size:26px;padding:15px 18px;text-align:center;background:#f9fbfd;caret-color:transparent;user-select:none}.answer-row input:focus{border-color:#9ebcff;box-shadow:0 0 0 3px rgba(37,99,235,.08)}
.keypad-toolbar{max-width:620px;margin:14px auto 0;display:flex;align-items:center;justify-content:space-between;gap:12px}.keypad-toolbar-label{font-size:15px;font-weight:700;color:#68758b}.keypad-mode{display:inline-flex;padding:3px;border:1px solid #dce2e9;border-radius:12px;background:#f7f9fc;gap:2px}.keypad-mode-btn{border:0;background:transparent;color:#667085;border-radius:9px;min-height:36px;padding:7px 15px;font-size:15px;font-weight:700;touch-action:manipulation}.keypad-mode-btn.active{background:#fff;color:var(--brand);box-shadow:0 1px 4px rgba(23,32,51,.12)}
.keypad{max-width:620px;margin:10px auto 0;display:grid;gap:10px}.keypad-specials{display:flex;gap:8px;overflow-x:auto;scrollbar-width:none;padding:1px}.keypad-specials::-webkit-scrollbar{display:none}.keypad-digits{display:grid;grid-template-columns:repeat(3,1fr);gap:9px}.keypad-actions{display:grid;grid-template-columns:repeat(3,1fr);gap:9px}.keypad button{min-height:56px;border:1px solid #dce2e9;background:#fff;border-radius:12px;font-size:22px;font-weight:700;color:#303c53;touch-action:manipulation}.keypad button:hover,.keypad button:active{background:#f0f5ff;border-color:#b9d2ff}.keypad .special-key{flex:1 0 64px;min-height:46px;background:#f8fafc;font-size:19px}.keypad .clear-key{color:#a33}.keypad .confirm-key{background:var(--brand);border-color:var(--brand);color:#fff}.keypad .confirm-key:hover,.keypad .confirm-key:active{background:#1e55cf}.keypad-placeholder{min-height:56px;visibility:hidden}
.choice-area{max-width:800px;margin:8px auto 0;display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:13px}.choice-btn{border:1.5px solid #dce2e9;background:#fff;border-radius:14px;min-height:68px;padding:13px 17px;text-align:left;font-size:18px;line-height:1.45;color:#273248;display:flex;align-items:center;gap:13px;touch-action:manipulation}.choice-btn:hover{border-color:#9db9ef;background:#f8fbff}.choice-letter{width:32px;height:32px;border-radius:50%;display:grid;place-items:center;flex:0 0 auto;background:#eef3fb;color:#315eaf;font-weight:800}.choice-btn.wrong-choice{border-color:#efaaa5;background:var(--bad-bg);color:var(--bad)}.choice-btn.correct-choice{border-color:#9ed9b2;background:var(--good-bg);color:var(--good)}.choice-btn:disabled{cursor:default}
.feedback{min-height:34px;text-align:center;margin-top:15px;font-size:17px;font-weight:700}.feedback.good{color:var(--good)}.feedback.bad{color:var(--bad)}.feedback.answer{color:#715c18}.assist-actions{display:flex;justify-content:center;gap:9px;margin-top:8px}
.stats-grid{display:grid;grid-template-columns:repeat(4,1fr);gap:12px;margin-top:12px}.stat-card{padding:17px}.stat-card span{display:block;color:var(--muted);font-size:13px}.stat-card strong{display:block;margin-top:4px;font-size:28px}.wrong-panel{margin-top:12px;padding:20px}.wrong-list{margin-top:12px;display:grid;gap:8px}.wrong-list.empty{color:var(--muted);font-size:14px;padding:12px 0}.wrong-item{display:grid;grid-template-columns:minmax(0,1fr) auto;gap:12px;padding:13px 0;border-top:1px solid var(--line)}.wrong-item:first-child{border-top:0}.wrong-q{font-size:16px;line-height:1.8}.wrong-meta{font-size:12px;color:var(--muted);margin-top:3px}.wrong-a{text-align:right;font-size:14px;color:var(--good)}
.fraction{display:inline-grid;grid-template-rows:auto 1px auto;vertical-align:middle;text-align:center;line-height:1.05;margin:0 .08em;min-width:1.25em}.fraction-line{background:currentColor;width:100%;height:1.5px}.fraction-numerator,.fraction-denominator{padding:0 .12em;font-size:.78em}.remainder-dots{letter-spacing:1px;margin:0 .15em}.blank-wrap{display:inline-flex;align-items:center}.blank-slot{display:inline-block;min-width:1.7em;border-bottom:2px solid currentColor;height:1em}.negative{color:inherit}.operator{padding:0 .14em}.decimal-compare-slot{display:inline-block;min-width:1.3em;border-bottom:2px solid currentColor}
.hidden{display:none!important}.mobile-only,.mobile-close{display:none}.overlay{position:fixed;inset:0;background:rgba(15,23,42,.38);z-index:39}.toast{position:fixed;left:50%;bottom:28px;transform:translateX(-50%);background:#172033;color:#fff;border-radius:12px;padding:11px 16px;font-size:14px;z-index:60;box-shadow:var(--shadow)}
@media(max-width:980px){
  .topbar{height:62px;padding:0 14px}.brand small{display:none}.layout{display:block;padding:12px}.setup-panel{position:fixed;z-index:40;left:0;right:0;top:62px;bottom:0;max-height:none;border-radius:18px 18px 0 0;padding:18px 16px 14px;transform:translateY(105%);transition:.2s}.setup-panel.open{transform:translateY(0)}.mobile-only,.mobile-close{display:inline-block}.section-head h2{font-size:24px}.section-head p{font-size:15px}.search-wrap input{font-size:18px;padding:14px}.quick-actions .ghost-btn{font-size:15px;padding:10px 13px}.category-tabs{gap:10px;padding:15px 0 12px}.category-tabs button{min-width:92px;min-height:52px;font-size:18px;padding:12px 18px}.type-list{min-height:180px;flex:1}.type-item{font-size:17px;padding:13px 6px;min-height:52px}.type-item input{width:22px;height:22px}.setup-bottom{background:#fff;padding-top:13px}.field-label,.switch-line{font-size:16px}.count-row input{font-size:18px;padding:12px}.practice-toolbar{margin-top:0}.question-card{padding:25px 16px;min-height:520px}.question-text{margin:35px 0 28px}.question-text.data-question{margin-top:28px}.stats-grid{grid-template-columns:repeat(2,1fr)}.toolbar-actions .ghost-btn{padding:8px 9px;font-size:13px}.wrong-item{grid-template-columns:1fr}.wrong-a{text-align:left}.keypad{gap:9px}.keypad-digits,.keypad-actions{gap:8px}.keypad button{min-height:58px;font-size:22px}.keypad-toolbar{margin-top:12px}.keypad-mode-btn{min-height:38px;padding:7px 14px;font-size:15px}.choice-area{grid-template-columns:1fr}.choice-btn{min-height:64px;font-size:17px}
}
@media(max-width:520px){
  .topbar nav a{font-size:12px}.brand strong{font-size:16px}.question-card{min-height:500px}.welcome h1{font-size:23px}.answer-row input{font-size:24px;padding:14px 9px}.question-text{font-size:34px}.question-text.data-question{font-size:21px}.keypad{max-width:none}.keypad-toolbar{max-width:none}.keypad button{min-height:57px;font-size:22px}.keypad-mode-btn{font-size:15px;padding:7px 13px}.keypad-toolbar-label{font-size:15px}.choice-btn{font-size:16px;padding:12px}.stats-grid{gap:8px}.stat-card{padding:13px}.stat-card strong{font-size:23px}.assist-actions .ghost-btn{padding:9px 11px;font-size:14px}
}

@media(max-width:380px){.category-tabs button{min-width:90px;min-height:52px;font-size:18px;padding:11px 16px}.category-tabs{gap:9px}.quick-actions{gap:7px}.quick-actions .ghost-btn{font-size:15px;padding:10px 11px}.keypad-mode-btn{padding:7px 11px}}
