/* 星阶学习 — 设计系统（移动优先，零依赖） */
:root {
  --brand: #5b6cff;
  --brand-2: #8a5bff;
  --brand-soft: #eef0ff;
  --ok: #16a34a;
  --ok-soft: #e8f7ee;
  --warn: #f59e0b;
  --warn-soft: #fff5e6;
  --danger: #ef4444;
  --danger-soft: #fdecec;
  --ink: #1a1d29;
  --ink-2: #4b5163;
  --ink-3: #8b90a0;
  --line: #e8eaf2;
  --bg: #f6f7fb;
  --card: #ffffff;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 2px 10px rgba(26, 29, 41, .06);
  --shadow-lg: 0 12px 30px rgba(26, 29, 41, .12);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
  background: var(--bg); color: var(--ink); font-size: 15px; line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--brand); text-decoration: none; }
button { font-family: inherit; }
.hidden { display: none !important; }
.boot { padding: 80px 20px; text-align: center; color: var(--ink-3); }

/* ---------- 布局 ---------- */
.shell { max-width: 1080px; margin: 0 auto; padding: 0 16px 96px; }
.topbar {
  position: sticky; top: 0; z-index: 30;
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  color: #fff; padding: 14px 16px 16px;
  border-radius: 0 0 22px 22px; box-shadow: var(--shadow);
}
.topbar .row { display: flex; align-items: center; justify-content: space-between; gap: 12px; max-width: 1080px; margin: 0 auto; }
.brand { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 17px; letter-spacing: .4px; }
.brand small { font-weight: 400; opacity: .8; font-size: 12px; }
.user-chip { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.avatar {
  width: 34px; height: 34px; border-radius: 50%; background: rgba(255,255,255,.25);
  display: grid; place-items: center; font-size: 15px; font-weight: 600;
}
.avatar.lg { width: 52px; height: 52px; font-size: 20px; }
.pill { display: inline-flex; align-items: center; gap: 4px; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.pill.on-dark { background: rgba(255,255,255,.2); color: #fff; }
.pill.brand { background: var(--brand-soft); color: var(--brand); }
.pill.ok { background: var(--ok-soft); color: var(--ok); }
.pill.warn { background: var(--warn-soft); color: #b45309; }
.pill.danger { background: var(--danger-soft); color: var(--danger); }
.pill.gray { background: #f1f2f7; color: var(--ink-2); }

.card {
  background: var(--card); border-radius: var(--radius); padding: 16px;
  box-shadow: var(--shadow); margin-bottom: 14px;
}
.card.tight { padding: 12px 14px; }
.card-title { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-weight: 700; font-size: 15.5px; margin-bottom: 10px; }
.card-title .sub { font-weight: 400; color: var(--ink-3); font-size: 12.5px; }
.section { margin: 18px 0 8px; font-weight: 700; font-size: 15px; display: flex; align-items: center; justify-content: space-between; }
.muted { color: var(--ink-3); font-size: 13px; }
.grid { display: grid; gap: 12px; }
.grid.c2 { grid-template-columns: 1fr 1fr; }
.grid.c3 { grid-template-columns: repeat(3, 1fr); }
.grid.c4 { grid-template-columns: repeat(4, 1fr); }
.row { display: flex; gap: 10px; align-items: center; }
.row.between { justify-content: space-between; }
.row.wrap { flex-wrap: wrap; }
.spacer { flex: 1; }

/* ---------- 游戏化 ---------- */
.hero {
  background: linear-gradient(135deg, #5b6cff 0%, #8a5bff 55%, #b45bff 100%);
  color: #fff; border-radius: var(--radius); padding: 18px; margin-bottom: 14px;
  box-shadow: 0 10px 24px rgba(91,108,255,.28); position: relative; overflow: hidden;
}
.hero::after {
  content: ""; position: absolute; right: -40px; top: -50px; width: 170px; height: 170px;
  background: radial-gradient(circle, rgba(255,255,255,.28), transparent 65%); border-radius: 50%;
}
.hero h2 { margin: 0 0 4px; font-size: 19px; }
.hero .lvl { display: flex; align-items: center; gap: 8px; margin-top: 10px; }
.hero .lvl .icon { font-size: 30px; filter: drop-shadow(0 2px 4px rgba(0,0,0,.2)); }
.hero .lvl .name { font-weight: 700; font-size: 15px; }
.progress { height: 8px; border-radius: 999px; background: rgba(255,255,255,.28); overflow: hidden; margin-top: 8px; }
.progress > i { display: block; height: 100%; border-radius: 999px; background: #fff; transition: width .5s ease; }
.progress.small { height: 6px; background: #eef0f7; }
.progress.small > i { background: linear-gradient(90deg, var(--brand), var(--brand-2)); }
.stat { text-align: center; }
.stat b { display: block; font-size: 20px; line-height: 1.2; }
.stat span { font-size: 12px; color: var(--ink-3); }
.hero .stat b { color: #fff; }
.hero .stat span { color: rgba(255,255,255,.8); }
.badge-chip {
  display: inline-flex; align-items: center; gap: 5px; padding: 5px 10px; border-radius: 999px;
  background: #fff7e6; color: #9a5b00; font-size: 12px; font-weight: 600; border: 1px solid #ffe1a8;
}
.badge-chip.locked { background: #f4f5f9; color: var(--ink-3); border-color: var(--line); }

/* ---------- 列表 / 表单 ---------- */
.list-item {
  display: flex; gap: 12px; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--line);
}
.list-item:last-child { border-bottom: 0; }
.list-item .grow { flex: 1; min-width: 0; }
.list-item .t { font-weight: 600; font-size: 14.5px; margin-bottom: 2px; overflow: hidden; text-overflow: ellipsis; }
.list-item .d { font-size: 12.5px; color: var(--ink-3); }
.thumb {
  width: 44px; height: 44px; border-radius: 12px; background: var(--brand-soft); color: var(--brand);
  display: grid; place-items: center; font-size: 18px; flex: none;
}
label.field { display: block; margin-bottom: 12px; }
label.field > span { display: block; font-size: 13px; color: var(--ink-2); margin-bottom: 6px; font-weight: 500; }
input[type=text], input[type=password], input[type=tel], input[type=number], input[type=date], select, textarea {
  width: 100%; padding: 11px 12px; border: 1px solid var(--line); border-radius: var(--radius-sm);
  font-size: 15px; background: #fbfbfe; color: var(--ink); outline: none; transition: border .2s, box-shadow .2s;
  font-family: inherit;
}
input:focus, select:focus, textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(91,108,255,.12); background: #fff; }
textarea { min-height: 88px; resize: vertical; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 11px 18px; border-radius: 12px; border: 1px solid transparent; cursor: pointer;
  font-size: 14.5px; font-weight: 600; transition: transform .08s, box-shadow .2s, background .2s;
  background: var(--brand); color: #fff;
}
.btn:active { transform: scale(.975); }
.btn.block { width: 100%; }
.btn.ghost { background: #fff; color: var(--brand); border-color: #dfe2ff; }
.btn.gray { background: #f1f2f7; color: var(--ink-2); }
.btn.ok { background: var(--ok); }
.btn.danger { background: var(--danger); }
.btn.sm { padding: 7px 12px; font-size: 13px; border-radius: 9px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* ---------- 题目 ---------- */
.q-card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; margin-bottom: 12px; }
.q-head { display: flex; justify-content: space-between; gap: 8px; font-size: 12.5px; color: var(--ink-3); margin-bottom: 8px; }
.q-stem { font-size: 15px; line-height: 1.7; }
.q-stem b { color: var(--brand); }
.opt {
  display: flex; gap: 10px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px;
  margin-top: 8px; cursor: pointer; background: #fbfbfe; transition: all .15s;
}
.opt:hover { border-color: #c9cfff; }
.opt.sel { border-color: var(--brand); background: var(--brand-soft); }
.opt.correct { border-color: var(--ok); background: var(--ok-soft); }
.opt.wrong { border-color: var(--danger); background: var(--danger-soft); }
.opt .k {
  width: 22px; height: 22px; border-radius: 50%; background: #eef0f7; color: var(--ink-2);
  display: grid; place-items: center; font-size: 12px; font-weight: 700; flex: none;
}
.opt.sel .k { background: var(--brand); color: #fff; }
.opt.correct .k { background: var(--ok); color: #fff; }
.opt.wrong .k { background: var(--danger); color: #fff; }
.analysis { margin-top: 10px; padding: 10px 12px; background: #f7f8fd; border-left: 3px solid var(--brand); border-radius: 8px; font-size: 13px; color: var(--ink-2); }
.answer-line { margin-top: 8px; font-size: 13px; color: var(--ok); font-weight: 600; }

/* ---------- 表格 ---------- */
.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.table th, .table td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table th { color: var(--ink-3); font-weight: 600; font-size: 12.5px; }
.table td.wrap { white-space: normal; }
.table tbody tr:hover { background: #fafbff; }

/* ---------- 底部导航 ---------- */
.site-footer {
  text-align: center; color: var(--ink-3); font-size: 11.5px; line-height: 1.9;
  padding: 4px 16px 0; max-width: 1080px; margin: 0 auto;
}
.site-footer a { color: var(--ink-3); text-decoration: none; }
.site-footer a:hover { text-decoration: underline; }

.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
  background: rgba(255,255,255,.96); backdrop-filter: blur(12px);
  border-top: 1px solid var(--line); padding: 6px 4px calc(6px + var(--safe-bottom));
  display: flex; justify-content: space-around; max-width: 1080px; margin: 0 auto;
}
.tabbar a {
  flex: 1; text-align: center; color: var(--ink-3); font-size: 11px; padding: 4px 0;
  display: flex; flex-direction: column; align-items: center; gap: 2px;
}
.tabbar a .i { font-size: 19px; line-height: 1; }
.tabbar a.active { color: var(--brand); font-weight: 600; }

/* ---------- Toast / Modal ---------- */
.toast-wrap { position: fixed; top: 18px; left: 0; right: 0; z-index: 100; display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; }
.toast {
  background: rgba(26,29,41,.92); color: #fff; padding: 10px 18px; border-radius: 999px; font-size: 13.5px;
  box-shadow: var(--shadow-lg); animation: pop .25s ease; max-width: 86vw;
}
.toast.ok { background: rgba(22,163,74,.95); }
.toast.err { background: rgba(239,68,68,.95); }
@keyframes pop { from { transform: translateY(-8px); opacity: 0; } to { transform: none; opacity: 1; } }
.modal-wrap { position: fixed; inset: 0; background: rgba(15,17,26,.45); z-index: 90; display: grid; place-items: center; padding: 18px; }
.modal-card { background: #fff; border-radius: 18px; padding: 18px; width: 100%; max-width: 460px; box-shadow: var(--shadow-lg); max-height: 86vh; overflow: auto; }

/* ---------- 登录页 ---------- */
.auth-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px;
  background: radial-gradient(1200px 600px at 10% -10%, #e7e9ff, transparent), radial-gradient(900px 500px at 110% 10%, #f3e8ff, transparent), var(--bg); }
.auth-card { width: 100%; max-width: 420px; background: #fff; border-radius: 22px; padding: 26px 22px; box-shadow: var(--shadow-lg); }
.auth-card h1 { margin: 0 0 4px; font-size: 23px; }
.auth-card .slogan { color: var(--ink-3); font-size: 13px; margin-bottom: 18px; }
.role-tabs { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; background: #f3f4fa; padding: 5px; border-radius: 12px; margin-bottom: 16px; }
.role-tabs button { border: 0; background: transparent; padding: 8px 4px; border-radius: 9px; font-size: 12.5px; color: var(--ink-2); cursor: pointer; font-weight: 600; }
.role-tabs button.on { background: #fff; color: var(--brand); box-shadow: var(--shadow); }
.divider { display: flex; align-items: center; gap: 10px; color: var(--ink-3); font-size: 12px; margin: 16px 0; }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.demo-accounts { font-size: 12px; color: var(--ink-3); background: #fafbff; border: 1px dashed var(--line); border-radius: 10px; padding: 10px 12px; line-height: 1.9; }
.demo-accounts b { color: var(--ink-2); }

/* ---------- 空状态 ---------- */
.empty { text-align: center; padding: 34px 12px; color: var(--ink-3); font-size: 13.5px; }
.empty .i { font-size: 34px; display: block; margin-bottom: 8px; opacity: .7; }

@media (min-width: 720px) {
  .grid.c2 { grid-template-columns: 1fr 1fr; }
  .hero { padding: 22px; }
}
@media (max-width: 420px) {
  .grid.c3 { grid-template-columns: 1fr 1fr; }
  .grid.c4 { grid-template-columns: 1fr 1fr; }
}
@media print {
  .topbar, .tabbar, .btn { display: none !important; }
}

/* ---------- 多模态上传 ---------- */
.up-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.up-btn {
  display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 12px 6px;
  border: 1px dashed #cfd4ff; border-radius: 12px; background: #fafbff;
  font-size: 12px; color: var(--brand); cursor: pointer; font-weight: 600; text-align: center;
}
.up-btn:active { background: var(--brand-soft); }
.up-btn .i { font-size: 21px; }
.up-list { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.up-item {
  position: relative; width: 78px; height: 78px; border-radius: 10px; overflow: hidden;
  background: #f1f2f7; display: grid; place-items: center; font-size: 24px; color: var(--ink-2);
  border: 1px solid var(--line);
}
.up-item img { width: 100%; height: 100%; object-fit: cover; }
.up-item .del {
  position: absolute; top: 2px; right: 2px; width: 18px; height: 18px; border-radius: 50%;
  background: rgba(0, 0, 0, .55); color: #fff; font-size: 12px; display: grid; place-items: center;
  cursor: pointer; line-height: 1;
}
.up-item .tag { position: absolute; bottom: 0; left: 0; right: 0; font-size: 10px; text-align: center; background: rgba(0,0,0,.45); color: #fff; }

/* ---------- 附件预览（教师批改 / 学生回看） ---------- */
.attach { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 10px; }
.attach img { width: 112px; height: 112px; object-fit: cover; border-radius: 10px; border: 1px solid var(--line); }
.attach audio { width: 100%; }
.attach video { width: 100%; max-height: 240px; border-radius: 10px; background: #000; }
.attach .file-chip { display: inline-flex; align-items: center; gap: 6px; padding: 8px 12px; background: #f4f5fb; border-radius: 10px; font-size: 13px; }

/* ---------- 五维诊断卡片 ---------- */
.dim-card { border-left: 4px solid var(--brand); border-radius: 10px; padding: 11px 13px; background: #fafbff; margin-bottom: 10px; }
.dim-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-weight: 700; font-size: 14px; margin-bottom: 4px; }
.dim-lv { display: flex; gap: 3px; flex: none; }
.dim-lv i { width: 13px; height: 6px; border-radius: 3px; background: #e6e8f2; display: block; }
.dim-lv i.on { background: currentColor; }
.dim-card .t { font-weight: 600; font-size: 13.5px; margin: 2px 0 3px; }
.dim-card .p { font-size: 13px; color: var(--ink-2); line-height: 1.65; }
.dim-card .a { font-size: 12.5px; color: var(--brand); margin-top: 5px; }
.dim-mini { display: inline-flex; align-items: center; gap: 4px; font-size: 11.5px; padding: 3px 8px; border-radius: 999px; background: #f1f2f9; color: var(--ink-2); margin: 2px 4px 0 0; }

/* ---------- 知识讲解 ---------- */
.kpis { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.kpi { background: var(--brand-soft, #eef3ff); border-radius: 12px; padding: 12px; text-align: center; }
.kpi b { display: block; font-size: 22px; line-height: 1.2; color: var(--brand); }
.kpi span { font-size: 12px; color: var(--ink-3, #8a95a8); }

.topic-card { transition: transform .12s ease, box-shadow .12s ease; }
.topic-card:active { transform: scale(.995); }

.entry-card { border-left: 4px solid var(--brand); }

.topic-hero {
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  color: #fff; border-radius: 16px; padding: 18px 18px 16px; margin-bottom: 14px;
  box-shadow: var(--shadow);
}
.essence-card {
  background: linear-gradient(135deg, #1f2937, #374151);
  color: #fff; border: none;
}
.essence-card .pill { border: none; }

.step-row { display: flex; gap: 10px; padding: 10px 0; border-bottom: 1px dashed var(--line); }
.step-row:last-child { border-bottom: none; }
.step-no {
  flex: 0 0 22px; height: 22px; border-radius: 50%; background: var(--brand); color: #fff;
  font-size: 12px; display: flex; align-items: center; justify-content: center; margin-top: 2px;
}
.formula {
  display: inline-block; margin: 6px 0 2px; padding: 6px 10px; border-radius: 8px;
  background: #f4f6fa; font-family: "SF Mono", Menlo, Consolas, monospace;
  font-size: 13.5px; color: #1f2937;
}

.pitfall { padding: 10px 0; border-bottom: 1px dashed var(--line); }
.pitfall:last-child { border-bottom: none; }

.ask {
  margin-top: 10px; padding: 10px 12px; border-radius: 10px;
  background: var(--warn-soft, #fff7ed); border-left: 3px solid var(--warn, #f59e0b);
  font-size: 14px;
}
.history-card { background: #fbf7ee; border: 1px solid #efe4cf; }

/* ---------- 班级热力图 ---------- */
.heat-row {
  display: grid; grid-template-columns: 92px 1fr 56px 72px 80px;
  gap: 8px; align-items: center; padding: 9px 0; border-bottom: 1px dashed var(--line);
}
.heat-row:last-child { border-bottom: none; }
.heat-name { font-size: 13.5px; font-weight: 600; }
.heat-bar { height: 10px; background: #eef1f6; border-radius: 6px; overflow: hidden; }
.heat-fill { height: 100%; border-radius: 6px; transition: width .3s ease; }
.heat-val { font-size: 13px; font-weight: 700; text-align: right; line-height: 1.2; }
.heat-meta { font-size: 11.5px; line-height: 1.3; }
@media (max-width: 560px) {
  .heat-row {
    grid-template-columns: 1fr auto;
    grid-template-areas: "name val" "bar bar" "meta btn";
    gap: 6px 8px;
  }
  .heat-name { grid-area: name; }
  .heat-val { grid-area: val; text-align: right; }
  .heat-bar { grid-area: bar; }
  .heat-meta { grid-area: meta; }
  .heat-row .btn { grid-area: btn; }
}

/* ---------- 课堂模式（投影） ---------- */
.classroom {
  min-height: 100vh; background: #0f172a; color: #f8fafc;
  padding: 3vh 4vw; box-sizing: border-box; display: flex; flex-direction: column; gap: 3vh;
}
.cr-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; }
.cr-class { font-size: clamp(22px, 3.2vw, 40px); font-weight: 700; letter-spacing: .5px; }
.cr-sub { font-size: clamp(13px, 1.3vw, 18px); color: #94a3b8; margin-top: 6px; }
.cr-actions { display: flex; gap: 10px; }
.cr-btn {
  background: rgba(255,255,255,.1); color: #e2e8f0; border: 1px solid rgba(255,255,255,.2);
  padding: 10px 18px; border-radius: 10px; font-size: clamp(13px, 1.2vw, 16px);
  text-decoration: none; cursor: pointer;
}
.cr-btn:hover { background: rgba(255,255,255,.18); }
.cr-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 2.4vw; flex: 1; align-content: start; }
.cr-card {
  background: rgba(255,255,255,.05); border: 2px solid #334155; border-radius: 20px;
  padding: 3vh 2vw; display: flex; flex-direction: column; gap: 1.4vh;
}
.cr-name { font-size: clamp(20px, 2.4vw, 34px); font-weight: 700; }
.cr-rate { font-size: clamp(44px, 7vw, 96px); font-weight: 800; line-height: 1.05; letter-spacing: -2px; }
.cr-bar { height: 10px; background: rgba(255,255,255,.12); border-radius: 6px; overflow: hidden; }
.cr-fill { height: 100%; border-radius: 6px; }
.cr-meta { font-size: clamp(13px, 1.3vw, 19px); color: #cbd5e1; line-height: 1.6; }
.cr-meta b { color: #fca5a5; }
.cr-foot {
  display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap;
  font-size: clamp(13px, 1.4vw, 20px); color: #cbd5e1; border-top: 1px solid rgba(255,255,255,.1); padding-top: 2vh;
}
.cr-tip { color: #64748b; font-size: 12px; }
.cr-empty { flex: 1; display: flex; align-items: center; justify-content: center; color: #94a3b8; font-size: 18px; }
@media (max-width: 860px) {
  .cr-grid { grid-template-columns: 1fr; }
  .cr-rate { font-size: 54px; }
}
