:root{
  --bg:#f4f6fb;--card:#fff;--card-2:#f8fafc;--text:#18202f;--muted:#6a778f;--line:#e3e8f0;
  --primary:#2f6bff;--primary-weak:#eaf0ff;--ok:#12a150;--ok-weak:#e7f7ee;--warn:#d97706;--warn-weak:#fff5e6;
  --err:#dc2626;--err-weak:#fdecec;--radius:14px;--shadow:0 6px 24px rgba(24,32,47,.07)
}
*{box-sizing:border-box;margin:0;padding:0}
html,body{height:100%}
body{background:var(--bg);color:var(--text);font-family:"Microsoft YaHei","PingFang SC",-apple-system,"Segoe UI",sans-serif;font-size:14px;line-height:1.6;-webkit-font-smoothing:antialiased}
a{color:var(--primary);text-decoration:none}
button,input,select,textarea{font-family:inherit;font-size:inherit;color:inherit}
::-webkit-scrollbar{width:9px;height:9px}
::-webkit-scrollbar-thumb{background:#c9d2e0;border-radius:6px}
::-webkit-scrollbar-track{background:transparent}

/* ---------------- 布局 ---------------- */
.layout{display:flex;min-height:100vh}
.sidebar{width:232px;flex:0 0 232px;background:#0f1626;color:#c6d2e8;padding:18px 14px;display:flex;flex-direction:column;gap:6px;position:sticky;top:0;height:100vh;overflow:auto}
.brand{display:flex;align-items:center;gap:10px;padding:6px 8px 18px}
.brand .logo{width:34px;height:34px;border-radius:10px;background:linear-gradient(135deg,#2f6bff,#34d399);display:flex;align-items:center;justify-content:center;font-weight:800;color:#fff;font-size:15px}
.brand h1{font-size:15px;color:#fff;font-weight:700;letter-spacing:.5px}
.brand small{display:block;font-size:11px;color:#6d7c9c;font-weight:400;letter-spacing:0}
.nav-item{display:flex;align-items:center;gap:10px;padding:10px 12px;border-radius:10px;cursor:pointer;color:#b9c6de;font-size:14px;transition:.15s;user-select:none}
.nav-item:hover{background:rgba(255,255,255,.06);color:#fff}
.nav-item.active{background:linear-gradient(90deg,rgba(47,107,255,.28),rgba(47,107,255,.05));color:#fff;box-shadow:inset 2px 0 0 var(--primary)}
.nav-item .ic{width:20px;text-align:center;opacity:.9}
.nav-group{margin:14px 0 4px;padding:0 12px;font-size:11px;color:#5d6b8a;letter-spacing:.14em}
.sidebar .foot{margin-top:auto;padding:12px;border-top:1px solid rgba(255,255,255,.08);font-size:12px;color:#6d7c9c}
.main{flex:1;min-width:0;display:flex;flex-direction:column}
.topbar{height:62px;background:#fff;border-bottom:1px solid var(--line);display:flex;align-items:center;justify-content:space-between;padding:0 26px;position:sticky;top:0;z-index:20}
.topbar h2{font-size:17px;font-weight:700}
.topbar .sub{font-size:12px;color:var(--muted);font-weight:400}
.topbar-title{display:flex;align-items:center;gap:10px;min-width:0}
.content{padding:22px 26px 60px;flex:1}

/* 手机端抽屉导航开关与遮罩（桌面隐藏） */
.nav-toggle{display:none;width:40px;height:40px;border:1px solid var(--line);border-radius:10px;background:#fff;cursor:pointer;font-size:17px;line-height:1;color:var(--text);flex:0 0 40px;align-items:center;justify-content:center}
.nav-toggle:active{background:#f1f4fa}
.nav-backdrop{display:none;position:fixed;inset:0;background:rgba(15,22,38,.45);z-index:80}

/* ---------------- 组件 ---------------- */
.card{background:var(--card);border:1px solid var(--line);border-radius:var(--radius);box-shadow:var(--shadow);padding:20px;margin-bottom:18px;min-width:0}
.card h3{font-size:15px;font-weight:700;margin-bottom:4px;display:flex;align-items:center;gap:8px}
.card .desc{font-size:12.5px;color:var(--muted);margin-bottom:16px}
.row{display:flex;gap:12px;flex-wrap:wrap}
.row.between{justify-content:space-between;align-items:center}
.grow{flex:1;min-width:0}
.grid{display:grid;gap:16px}
.grid.c2{grid-template-columns:repeat(auto-fit,minmax(320px,1fr))}
.grid.c3{grid-template-columns:repeat(auto-fit,minmax(240px,1fr))}
.grid.c4{grid-template-columns:repeat(auto-fit,minmax(180px,1fr))}

.btn{display:inline-flex;align-items:center;justify-content:center;gap:6px;padding:8px 15px;border-radius:9px;border:1px solid var(--line);background:#fff;color:var(--text);cursor:pointer;font-size:13.5px;transition:.15s;white-space:nowrap}
.btn:hover{border-color:#c3cede;background:#fbfcfe}
.btn.primary{background:var(--primary);border-color:var(--primary);color:#fff}
.btn.primary:hover{background:#2559db}
.btn.ghost{background:transparent}
.btn.danger{color:var(--err);border-color:#f3c9c9}
.btn.danger:hover{background:var(--err-weak)}
.btn.ok{background:var(--ok);border-color:var(--ok);color:#fff}
.btn.sm{padding:5px 10px;font-size:12.5px;border-radius:7px}
.btn:disabled{opacity:.5;cursor:not-allowed}

label.field{display:block;margin-bottom:14px}
label.field>span{display:block;font-size:12.5px;color:var(--muted);margin-bottom:6px}
input[type=text],input[type=password],input[type=number],select,textarea{
  width:100%;padding:9px 12px;border:1px solid var(--line);border-radius:9px;background:#fff;outline:none;transition:.15s}
input:focus,select:focus,textarea:focus{border-color:var(--primary);box-shadow:0 0 0 3px rgba(47,107,255,.12)}
textarea{resize:vertical;min-height:96px;line-height:1.7}
textarea.code{font-family:Consolas,Monaco,monospace;font-size:13px;line-height:1.6}

table{width:100%;border-collapse:collapse;font-size:13.5px}
th,td{padding:10px 12px;text-align:left;border-bottom:1px solid var(--line);vertical-align:middle}
th{font-size:12.5px;color:var(--muted);font-weight:600;background:var(--card-2)}
tbody tr:hover{background:#fbfcff}
td.num{text-align:right;font-variant-numeric:tabular-nums}

.badge{display:inline-flex;align-items:center;gap:4px;padding:2px 9px;border-radius:20px;font-size:12px;font-weight:600;white-space:nowrap}
.badge.blue{background:var(--primary-weak);color:var(--primary)}
.badge.green{background:var(--ok-weak);color:var(--ok)}
.badge.orange{background:var(--warn-weak);color:var(--warn)}
.badge.red{background:var(--err-weak);color:var(--err)}
.badge.gray{background:#eef1f6;color:var(--muted)}

.stat{background:var(--card);border:1px solid var(--line);border-radius:var(--radius);padding:16px 18px}
.stat .k{font-size:12.5px;color:var(--muted)}
.stat .v{font-size:26px;font-weight:800;margin-top:4px;font-variant-numeric:tabular-nums}
.stat .u{font-size:12px;color:var(--muted);font-weight:400;margin-left:4px}

.tabs{display:flex;gap:6px;border-bottom:1px solid var(--line);margin-bottom:18px;flex-wrap:wrap}
.tabs .tab{padding:9px 15px;cursor:pointer;font-size:14px;color:var(--muted);border-bottom:2px solid transparent;margin-bottom:-1px}
.tabs .tab.active{color:var(--primary);border-bottom-color:var(--primary);font-weight:600}

.empty{text-align:center;padding:46px 20px;color:var(--muted)}
.empty .big{font-size:34px;margin-bottom:10px;opacity:.5}
.empty .btn{margin-top:14px}

.filters{display:flex;gap:10px;flex-wrap:wrap;align-items:flex-end;margin-bottom:16px}
.filters>select,.filters>input{width:auto;min-width:120px}
.filters>input[type=text]{flex:1 1 220px;min-width:180px}
.filters label.field{margin-bottom:0}
.pager{display:flex;justify-content:space-between;align-items:center;margin-top:14px;font-size:12.5px;color:var(--muted)}
.pager .btn{margin-left:8px}

.bar{height:8px;background:#edf0f6;border-radius:6px;overflow:hidden}
.bar>i{display:block;height:100%;background:linear-gradient(90deg,var(--primary),#34d399);border-radius:6px}
.bar.warn>i{background:linear-gradient(90deg,#f59e0b,#f97316)}
.bar.err>i{background:linear-gradient(90deg,#ef4444,#f97316)}

.hbar{display:flex;align-items:center;gap:10px;margin-bottom:9px;font-size:13px}
.hbar .name{width:150px;flex:0 0 150px;color:var(--text);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.hbar .bar{flex:1}
.hbar .val{width:62px;text-align:right;color:var(--muted);font-variant-numeric:tabular-nums}

.modal-mask{position:fixed;inset:0;background:rgba(15,22,38,.5);display:none;align-items:center;justify-content:center;z-index:100;padding:20px}
.modal-mask.on{display:flex}
.modal{background:#fff;border-radius:16px;width:min(760px,100%);max-height:90vh;display:flex;flex-direction:column;box-shadow:0 24px 70px rgba(10,16,30,.28)}
.modal.wide{width:min(1080px,100%)}
.modal header{padding:16px 20px;border-bottom:1px solid var(--line);display:flex;justify-content:space-between;align-items:center}
.modal header h3{font-size:16px}
.modal .body{padding:20px;overflow:auto;flex:1}
.modal footer{padding:14px 20px;border-top:1px solid var(--line);display:flex;justify-content:flex-end;gap:10px}
.x{width:30px;height:30px;border-radius:8px;border:0;background:transparent;cursor:pointer;font-size:18px;color:var(--muted)}
.x:hover{background:#f1f3f8;color:var(--text)}

#toast{position:fixed;top:18px;left:50%;transform:translateX(-50%);z-index:200;display:flex;flex-direction:column;gap:8px;align-items:center}
.toast{background:#18202f;color:#fff;padding:10px 18px;border-radius:10px;font-size:13.5px;box-shadow:0 10px 30px rgba(0,0,0,.25);animation:tin .2s ease}
.toast.ok{background:#0f9d58}
.toast.err{background:#d93025}
@keyframes tin{from{opacity:0;transform:translateY(-8px)}to{opacity:1}}

/* ---------------- 登录页 ---------------- */
.login-wrap{min-height:100vh;display:flex;align-items:center;justify-content:center;background:radial-gradient(1200px 600px at 20% -10%,#2f6bff22,transparent),radial-gradient(900px 500px at 110% 20%,#34d39922,transparent),var(--bg);padding:20px}
.login-card{width:min(400px,100%);background:#fff;border-radius:18px;padding:32px;box-shadow:0 20px 60px rgba(24,32,47,.13);border:1px solid var(--line)}
.login-card .logo{width:52px;height:52px;border-radius:15px;background:linear-gradient(135deg,#2f6bff,#34d399);display:flex;align-items:center;justify-content:center;color:#fff;font-weight:800;font-size:20px;margin-bottom:16px}
.login-card h1{font-size:21px;margin-bottom:6px}
.login-card p.tip{color:var(--muted);font-size:13px;margin-bottom:22px}
.login-card .btn{width:100%;padding:11px;font-size:15px}

/* ---------------- 检测作答 ---------------- */
.quiz-wrap{max-width:880px;margin:0 auto}
.q-card{background:#fff;border:1px solid var(--line);border-radius:var(--radius);padding:20px 22px;margin-bottom:14px;box-shadow:var(--shadow)}
.q-head{display:flex;justify-content:space-between;gap:14px;margin-bottom:10px}
.q-title{font-size:15.5px;font-weight:600;line-height:1.6}
.q-meta{font-size:12px;color:var(--muted);white-space:nowrap}
.opts{display:flex;flex-direction:column;gap:8px;margin-top:12px}
.opt{display:flex;align-items:flex-start;gap:10px;padding:9px 13px;border:1px solid var(--line);border-radius:10px;cursor:pointer;transition:.15s;background:#fff}
.opt:hover{border-color:#b9c8e6;background:#fbfcff}
.opt.sel{border-color:var(--primary);background:var(--primary-weak)}
.opt .mark{width:22px;height:22px;border-radius:50%;border:1.5px solid #c4cede;display:flex;align-items:center;justify-content:center;font-size:12px;flex:0 0 22px;margin-top:1px}
.opt.sel .mark{background:var(--primary);border-color:var(--primary);color:#fff}
.opt.sel .txt{color:var(--primary);font-weight:600}
.opt input{display:none}
.blank-input{width:100%;margin-top:10px}
.result-line{padding:14px 16px;border-radius:10px;font-size:13.5px;margin-top:10px}
.result-line.ok{background:var(--ok-weak);color:#0b6b38}
.result-line.no{background:var(--err-weak);color:#a01b1b}
.sticky-bar{position:sticky;bottom:0;background:rgba(255,255,255,.94);backdrop-filter:blur(8px);border-top:1px solid var(--line);padding:12px 0;margin-top:16px;display:flex;justify-content:space-between;align-items:center;z-index:10}

.paper-img{border:1px solid var(--line);border-radius:10px;max-width:100%;display:block}

/* ---------------- 学情轨迹 ---------------- */
.tl{position:relative;padding-left:6px}
.tl::before{content:"";position:absolute;left:11px;top:8px;bottom:8px;width:2px;background:var(--line)}
.tl-item{display:flex;gap:14px;position:relative;padding:0 0 16px 0}
.tl-dot{width:14px;height:14px;border-radius:50%;flex:0 0 14px;margin-top:16px;background:#c9d2e0;box-shadow:0 0 0 3px #fff;z-index:1}
.tl-dot.green{background:var(--ok)}
.tl-dot.orange{background:var(--warn)}
.tl-dot.red{background:var(--err)}
.tl-body{flex:1;min-width:0;border:1px solid var(--line);border-radius:12px;padding:12px 14px;background:#fbfcff}
.heat td.hm{text-align:center;font-size:12.5px;font-weight:600;min-width:56px}
.heat td.hm.none{background:#f6f8fc}
.heat td.pn{white-space:nowrap;font-size:13px;max-width:220px;overflow:hidden;text-overflow:ellipsis}
.weak-cell{font-size:12.5px}

/* ---------------- 课堂快问（大屏） ---------------- */
.cls-wrap{display:grid;grid-template-columns:minmax(0,1.35fr) minmax(360px,1fr);gap:18px;align-items:start}
.cls-stage{background:linear-gradient(160deg,#151c2c,#0e1320);border-color:#223050;color:#eef2ff;min-height:340px;display:flex;align-items:center;justify-content:center}
.cls-stage .empty{color:#9aa7c7}
.cls-kicker{font-size:13px;letter-spacing:.24em;color:#5b8cff;text-transform:uppercase;margin-bottom:14px}
.cls-q h2{font-size:32px;line-height:1.45;font-weight:700;color:#fff}
.cls-opts{display:grid;grid-template-columns:1fr 1fr;gap:12px;margin-top:26px}
.cls-opt{background:rgba(255,255,255,.05);border:1px solid rgba(255,255,255,.12);border-radius:12px;padding:14px 16px;font-size:19px;color:#dbe4ff;display:flex;align-items:center;gap:10px}
.cls-opt b{width:30px;height:30px;border-radius:8px;background:rgba(91,140,255,.22);color:#9dbaff;display:flex;align-items:center;justify-content:center;font-size:16px;flex:0 0 30px}
.cls-cnt{margin-left:auto;font-size:15px;color:#34d399;font-weight:700}
.cls-panel{min-height:340px}
.cls-tabs{display:flex;gap:6px;border-bottom:1px solid var(--line);margin-bottom:14px}
.cls-tab{padding:9px 15px;cursor:pointer;font-size:14px;color:var(--muted);border-bottom:2px solid transparent;margin-bottom:-1px}
.cls-tab.active{color:var(--primary);border-bottom-color:var(--primary);font-weight:600}
.cls-dist-row{display:flex;align-items:center;gap:10px;margin-bottom:8px}
.cls-dist-l{width:28px;height:28px;border-radius:8px;background:var(--primary-weak);color:var(--primary);display:flex;align-items:center;justify-content:center;font-weight:700;flex:0 0 28px}
.cls-dist-t{flex:1;font-size:14px}
.cls-dist-in{width:88px}
.cls-roster{display:flex;flex-wrap:wrap;gap:8px;max-height:280px;overflow:auto}
.cls-name{padding:9px 14px;border-radius:20px;border:1px solid var(--line);background:#fff;cursor:pointer;font-size:14px;transition:.12s}
.cls-name:hover{border-color:#b9c8e6;background:#fbfcff}
.cls-name.st-good{background:var(--ok-weak);border-color:#b7e6cb;color:#0b6b38;font-weight:600}
.cls-name.st-half{background:var(--warn-weak);border-color:#f3d9a8;color:#a35b00;font-weight:600}
.cls-name.st-poor{background:var(--err-weak);border-color:#f3c9c9;color:#a01b1b;font-weight:600}
@media (max-width:1100px){ .cls-wrap{grid-template-columns:1fr} }
@media print { .cls-panel,.cls-tabs{break-inside:avoid} }

/* ---------------- 学案内容块 ---------------- */
.sg-block{background:#fff;border:1px solid var(--line);border-radius:var(--radius);padding:18px 20px;margin-bottom:14px;box-shadow:var(--shadow)}
.sg-h{font-size:14.5px;font-weight:700;margin-bottom:8px;padding-left:9px;border-left:4px solid var(--primary)}
.sg-b{font-size:14px;line-height:1.9;color:#26304a;white-space:normal}
.sg-mt{font-weight:700;margin:12px 0 4px;color:#18202f}
.sg-b>div:first-child{margin-top:0}
.sec-h{font-size:15px;font-weight:700;margin:20px 0 10px;padding-left:10px;border-left:4px solid #34d399;color:#18202f}
.kv{display:flex;gap:8px;font-size:13px;margin-bottom:6px}
.kv .k{color:var(--muted);flex:0 0 84px}
.pill-list{display:flex;flex-wrap:wrap;gap:6px}
.spin{display:inline-block;width:14px;height:14px;border:2px solid rgba(255,255,255,.4);border-top-color:#fff;border-radius:50%;animation:sp .7s linear infinite}
.spin.dark{border-color:#c8d3e6;border-top-color:var(--primary)}
@keyframes sp{to{transform:rotate(360deg)}}
.help-kbd{font-size:12px;color:var(--muted)}
/* ---------------- 手机端（<=820px） ---------------- */
@media (max-width:820px){
  /* 侧边栏 → 左侧滑出抽屉 */
  .sidebar{position:fixed;left:0;top:0;bottom:0;width:252px;flex:0 0 252px;padding:16px 12px;height:100vh;height:100dvh;transform:translateX(-105%);transition:transform .25s ease;z-index:90;box-shadow:0 0 40px rgba(0,0,0,.3)}
  body.nav-open .sidebar{transform:none}
  body.nav-open .nav-backdrop{display:block}
  body.nav-open{overflow:hidden}
  .nav-toggle{display:inline-flex;position:fixed;left:14px;top:8px;z-index:95}
  .nav-item{padding:13px 14px;font-size:15px}
  .nav-item .ic{font-size:17px}

  /* 布局与间距 */
  .topbar{height:auto;min-height:56px;padding:10px 14px 10px 64px}
  #pageSub{display:none}
  .content{padding:14px 12px 60px}
  .card{padding:16px;margin-bottom:14px}

  /* 网格收窄，避免横向溢出（minmax(0,1fr) 防止 1fr 按内容 min-content 撑宽轨道） */
  .grid{gap:12px}
  .grid.c2{grid-template-columns:minmax(0,1fr)}
  .grid.c3{grid-template-columns:repeat(auto-fit,minmax(150px,1fr))}
  .grid.c4{grid-template-columns:repeat(auto-fit,minmax(140px,1fr))}

  /* 触控目标放大 */
  .btn{padding:10px 16px;min-height:40px}
  .btn.sm{min-height:34px;padding:7px 12px}
  .opt{padding:12px 14px}
  .cls-name{padding:11px 15px}
  .tab{padding:11px 14px}

  /* 输入框字号 16px，防止 iOS 聚焦时页面自动放大 */
  input[type=text],input[type=password],input[type=number],select,textarea{font-size:16px;padding:11px 12px}

  /* 表格横向滚动，不撑破页面 */
  table{display:block;width:100%;overflow-x:auto;-webkit-overflow-scrolling:touch;white-space:nowrap}
  th,td{padding:10px}
  .heat td.hm{min-width:48px}

  /* 条形图名称列收窄 */
  .hbar .name{width:92px;flex:0 0 92px;font-size:12.5px}
  .hbar .val{width:52px}

  /* 课堂快问：大屏元素按手机缩放（教师用手机盯堂） */
  .cls-q h2{font-size:21px}
  .cls-opts{grid-template-columns:1fr;gap:10px;margin-top:18px}
  .cls-opt{font-size:15px;padding:12px 14px}
  .cls-opt b{width:26px;height:26px;flex:0 0 26px;font-size:14px}
  .cls-stage{min-height:220px}
  .cls-panel{min-height:0}
  .cls-dist-in{width:64px}

  /* 弹窗 → 底部抽屉，适配 safe-area */
  .modal-mask{padding:0;align-items:flex-end}
  .modal,.modal.wide{width:100%;max-width:none;max-height:92vh;max-height:92dvh;border-radius:16px 16px 0 0}
  .modal header{padding:14px 16px}
  .modal .body{padding:16px}
  .modal footer{padding:12px 16px;padding-bottom:calc(12px + env(safe-area-inset-bottom))}
  .modal footer .btn{flex:1;min-height:44px}

  /* 登录页 */
  .login-card{padding:22px 18px;border-radius:14px}

  /* 学生端顶部 tabs 横向滑动，不换行堆叠 */
  .tabs{min-width:0;max-width:100%;flex-wrap:nowrap;overflow-x:auto;-webkit-overflow-scrolling:touch;scrollbar-width:none}
  .tabs::-webkit-scrollbar{display:none}
  .tabs .tab{flex:0 0 auto;white-space:nowrap}
}
