:root {
  --bg: #f4f6ff;
  --card: #ffffff;
  --ink: #23263a;
  --muted: #8a90a8;
  --line: #eef0fa;
  --primary: #5b6cff;
  --primary-2: #9a5bff;
  --success: #22c55e;
  --danger: #ef4444;
  --warn: #f59e0b;
  --radius: 18px;
  --shadow: 0 6px 24px rgba(43, 55, 150, 0.08);
  --topbar-h: 60px;
  --tabbar-h: calc(62px + env(safe-area-inset-bottom));
  --safe-b: env(safe-area-inset-bottom);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Segoe UI", Roboto, sans-serif;
  font-size: 15px;
  line-height: 1.55;
}

body { padding-bottom: var(--tabbar-h); }
button { font-family: inherit; cursor: pointer; border: none; background: none; }
input, select, textarea { font-family: inherit; font-size: 1rem; }
.hidden { display: none !important; }

/* ===== 顶栏 ===== */
.topbar {
  position: sticky; top: 0; z-index: 30;
  height: calc(var(--topbar-h) + env(safe-area-inset-top));
  padding: env(safe-area-inset-top) 18px 0;
  display: flex; align-items: center; justify-content: space-between;
  background: rgba(244, 246, 255, 0.85);
  backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; }
.brand-mark { font-size: 26px; }
.brand strong { font-size: 1.05rem; display: block; }
.brand small { color: var(--muted); font-size: 0.75rem; }
.icon-btn { font-size: 22px; width: 40px; height: 40px; border-radius: 50%; background: #eef0ff; }

/* ===== 右上角头像下拉菜单 ===== */
.profile-menu {
  position: fixed; top: calc(var(--topbar-h) + env(safe-area-inset-top) + 10px); right: 12px;
  z-index: 60; min-width: 160px; overflow: hidden;
  background: #fff; border: 1px solid var(--line); border-radius: 14px;
  box-shadow: 0 12px 32px rgba(43, 55, 150, 0.14);
  animation: fadeDown .18s ease;
}
@keyframes fadeDown { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }
.profile-menu button {
  display: block; width: 100%; text-align: left; padding: 13px 16px;
  font-size: .95rem; color: var(--ink); background: none;
}
.profile-menu button + button { border-top: 1px solid var(--line); }
.profile-menu button:hover { background: #f4f6ff; }
.profile-menu #profileLogout { color: var(--danger); }

/* ===== 底部导航 ===== */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
  height: var(--tabbar-h);
  padding-bottom: var(--safe-b);
  display: flex;
  background: #fff;
  border-top: 1px solid var(--line);
  box-shadow: 0 -4px 20px rgba(43, 55, 150, 0.05);
}
.tab {
  flex: 1; display: flex; flex-direction: column; align-items: center;
  justify-content: center; gap: 3px; color: var(--muted); font-size: 0.72rem;
}
.tab span { font-size: 21px; }
.tab.active { color: var(--primary); font-weight: 700; }
.tab.active span { transform: translateY(-1px); }

/* 底部导航 / 首页 的"新批改"红点 */
.nav-dot {
  position: absolute; top: 6px; right: calc(50% - 18px);
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--danger); border: 2px solid #fff;
}
.tab { position: relative; }
.hw-new {
  display: inline-block; min-width: 18px; height: 18px; padding: 0 5px;
  margin-left: 6px; border-radius: 10px; background: var(--danger); color: #fff;
  font-size: .72rem; font-weight: 700; line-height: 18px; text-align: center;
  vertical-align: 2px;
}

/* ===== 视图容器 ===== */
.view { max-width: 560px; margin: 0 auto; padding: 16px; animation: fade .25s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; } }

/* ===== 卡片 ===== */
.card {
  background: var(--card); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 18px; margin-bottom: 14px;
  border: 1px solid var(--line);
}
.section-title { font-size: 1.05rem; font-weight: 700; margin: 8px 0 12px; display: flex; align-items: center; gap: 8px; }
.muted { color: var(--muted); font-size: 0.85rem; }

/* ===== 按钮 ===== */
.btn-primary {
  display: block; width: 100%; padding: 14px; border-radius: 14px;
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  color: #fff; font-size: 1rem; font-weight: 700;
  box-shadow: 0 6px 18px rgba(91, 108, 255, 0.35);
}
.btn-primary:disabled { opacity: .5; }
.btn-ghost { display: block; width: 100%; padding: 12px; color: var(--primary); font-size: .92rem; margin-top: 8px; }
.btn-soft { background: #eef0ff; color: var(--primary); border-radius: 12px; padding: 10px 14px; font-weight: 600; }
.btn-soft.danger { background: #ffe8e8; color: var(--danger); }
.btn-danger { background: var(--danger); color: #fff; border-radius: 12px; padding: 10px 14px; font-weight: 600; }
.btn-danger:hover { background: #dc2626; }

/* ===== 首页 ===== */
.hero {
  background: linear-gradient(135deg, #5b6cff, #9a5bff);
  color: #fff; border-radius: 22px; padding: 22px; margin-bottom: 16px;
  box-shadow: 0 10px 26px rgba(91, 108, 255, 0.3);
  position: relative; overflow: hidden; min-height: 128px;
}
.hero h1 { margin: 0 0 4px; font-size: 1.5rem; }
.hero p { margin: 6px 0 0; opacity: .95; font-size: .9rem; text-shadow: 0 1px 3px rgba(0,0,0,.25); }
.hero .goal-badge {
  display: inline-block; margin-top: 8px; background: rgba(0,0,0,.28);
  padding: 5px 12px; border-radius: 18px; font-size: .8rem; font-weight: 700;
  backdrop-filter: blur(4px);
}
.hero .level-pill {
  display: inline-block; margin-top: 12px; background: rgba(255,255,255,.2);
  padding: 6px 14px; border-radius: 20px; font-size: .85rem;
}
/* 订阅徽章（首页「你好」旁） */
.vip-badge {
  display: inline-flex; align-items: center; gap: 4px; vertical-align: middle;
  margin-left: 6px; padding: 3px 10px; border-radius: 999px;
  font-size: 12px; font-weight: 700; letter-spacing: .3px; color: #fff;
  background: linear-gradient(135deg, #f7cf5a, #e8912d);
  box-shadow: 0 1px 5px rgba(232,145,45,.4), inset 0 1px 0 rgba(255,255,255,.35);
}
.vip-badge svg { width: 13px; height: 13px; flex: none; }
.vip-badge.teacher { background: linear-gradient(135deg, #7ec8e3, #2f7fb8); box-shadow: 0 1px 5px rgba(47,127,184,.4), inset 0 1px 0 rgba(255,255,255,.35); }
.vip-badge.org { background: linear-gradient(135deg, #a78bfa, #7c3aed); box-shadow: 0 1px 5px rgba(124,58,237,.4), inset 0 1px 0 rgba(255,255,255,.35); }
.vip-badge.exam { background: linear-gradient(135deg, #ff9d9d, #e8555b); box-shadow: 0 1px 5px rgba(232,85,91,.4), inset 0 1px 0 rgba(255,255,255,.35); }
.stat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.stat { text-align: center; padding: 14px 6px; }
.stat b { font-size: 1.4rem; display: block; color: var(--primary); }
.stat span { color: var(--muted); font-size: .72rem; }

.module-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.module {
  background: var(--card); border: 1px solid var(--line); border-radius: 18px;
  padding: 18px; text-align: left; box-shadow: var(--shadow);
}
.module .ico { font-size: 30px; }
.module h3 { margin: 8px 0 2px; font-size: 1rem; }
.module p { margin: 0; color: var(--muted); font-size: .8rem; }
.module .go { display: block; margin-top: 10px; font-size: .8rem; color: var(--primary); font-weight: 700; }

/* 艺考考点入口横幅 */
.exam-banner {
  display: flex; align-items: center; gap: 12px; text-align: left; width: 100%;
  background: linear-gradient(135deg, #fff7ed, #ffedd5); border: 1px solid #fed7aa;
  border-radius: 18px; padding: 14px; margin-top: 14px; box-shadow: var(--shadow);
}
.exam-banner .ico { font-size: 26px; }
.exam-banner h3 { margin: 0; font-size: .98rem; color: #9a3412; }
.exam-banner p { margin: 2px 0 0; color: #c2410c; font-size: .78rem; }
.exam-banner .chevron { margin-left: auto; color: #c2410c; font-weight: 700; }

/* 艺考考点详情页 */
.exam-sections { display: flex; flex-direction: column; gap: 12px; margin-top: 6px; }
.exam-sec h3 { margin: 0 0 8px; font-size: 1.02rem; display: flex; align-items: center; gap: 8px; }
.exam-sec h3 .ico { font-size: 22px; }
.exam-sec ul { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 6px; }
.exam-sec li { font-size: .92rem; color: #3a3f55; line-height: 1.5; }

/* 考点编辑 */
.exam-edit-sec { padding: 12px; }
.exam-edit-head { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.exam-edit-name { flex: 1; padding: 8px; border: 1.5px solid var(--line); border-radius: 10px; font-size: .95rem; }
.exam-edit-icon { padding: 8px 4px; border: 1.5px solid var(--line); border-radius: 10px; font-size: 1rem; }
.exam-edit-points { width: 100%; box-sizing: border-box; padding: 10px; border: 1.5px solid var(--line); border-radius: 10px; font-size: .9rem; line-height: 1.6; resize: vertical; font-family: inherit; }

/* ===== 听音 / 视唱问卷 ===== */
.q-card { text-align: center; }
.q-prompt { font-size: 1.1rem; font-weight: 600; margin-bottom: 16px; }
.q-prompt-canvas { margin-bottom: 16px; }
.q-prompt-canvas canvas { display: block; max-width: 100%; }
.exam-timer { font-family: monospace; font-weight: 600; font-size: .95rem; letter-spacing: 1px; }
.play-btn {
  width: 84px; height: 84px; border-radius: 50%; margin: 8px auto 16px;
  background: linear-gradient(135deg, var(--primary), var(--primary-2)); color: #fff;
  font-size: 34px; box-shadow: 0 8px 20px rgba(91, 108, 255, .35);
  display: flex; align-items: center; justify-content: center;
}
.option-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
/* 听音选项：竖排 + 大写字母序号 */
.option-grid.vertical { grid-template-columns: 1fr; }
.option-grid.vertical .opt { display: flex; align-items: center; gap: 12px; text-align: left; }
.opt-letter {
  flex: 0 0 auto; width: 30px; height: 30px; display: inline-flex; align-items: center; justify-content: center;
  border-radius: 50%; background: #ffffff; border: 1.5px solid var(--line);
  font-weight: 700; font-size: .95rem; color: var(--text-2); box-shadow: 0 1px 2px rgba(0,0,0,.04);
}
.opt.right .opt-letter { background: #dcfce7; border-color: var(--success); color: #166534; }
.opt.wrong .opt-letter { background: #fee2e2; border-color: var(--danger); color: #991b1b; }
.opt {
  padding: 14px; border-radius: 14px; background: #f6f7ff; border: 1.5px solid transparent;
  font-weight: 600; font-size: .95rem;
}
.opt:active { transform: scale(.97); }
.opt.right { background: #dcfce7 !important; color: #166534; border-color: var(--success); }
.opt.wrong { background: #fee2e2 !important; color: #991b1b; border-color: var(--danger); }

.answer-feedback { font-size: 1rem; font-weight: 700; margin: 14px 0 4px; }
.answer-feedback.ok { color: var(--success); }
.answer-feedback.no { color: var(--danger); }
.explanation { color: var(--muted); font-size: .85rem; }

.score-bar { display: flex; align-items: center; justify-content: space-between; font-size: .85rem; color: var(--muted); margin-bottom: 14px; }
.q-bar { gap: 8px; }
.q-bar-btns { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.q-bar-btns .btn-soft { padding: 4px 10px; font-size: .78rem; font-weight: 600; white-space: nowrap; border-radius: 10px; }
.phase-tag { display: inline-block; font-size: .72rem; font-weight: 700; color: var(--primary); background: var(--surface-2, #eef0ff); border-radius: 8px; padding: 2px 7px; vertical-align: 1px; }
.dots { display: flex; gap: 6px; }
.dots i { width: 9px; height: 9px; border-radius: 50%; background: var(--line); }
.dots i.ok { background: var(--success); }
.dots i.no { background: var(--danger); }
.dots i.cur { box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--primary); }

/* ===== 视唱 - 仪表 ===== */
.tuner-wrap { text-align: center; }
.tuner-note { font-size: 3.4rem; font-weight: 800; color: var(--primary); }
.tuner-note.silent { color: var(--muted); }
.cents-meter { height: 26px; background: var(--line); border-radius: 14px; overflow: hidden; position: relative; margin: 14px 0 6px; }
.cents-meter .fill { position: absolute; top: 0; bottom: 0; left: 50%; width: 10px; min-width: 4px; border-radius: 14px; transform: translateX(-50%); }
.cents-labels { display: flex; justify-content: space-between; color: var(--muted); font-size: .72rem; }
.s-curve { display: block; width: 100%; height: 110px; margin-top: 14px; background: #0b1220; border-radius: 12px; }
.pitch-badge { display: inline-block; margin-top: 6px; padding: 6px 16px; border-radius: 16px; font-weight: 700; }
.pitch-badge.in { background: #dcfce7; color: #166534; }
.pitch-badge.flat { background: #fef9c3; color: #854d0e; }
.pitch-badge.sharp { background: #fde68a; color: #78350f; }
.pitch-badge.none { background: #e5e7eb; color: #4b5563; }

.sight-targets { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.target {
  padding: 6px 14px; border-radius: 20px; background: var(--line); font-weight: 700; font-size: .9rem;
}
.target.done { background: #dcfce7; color: #166534; }
.target.cur { box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--primary); }

.mic-btn {
  width: 92px; height: 92px; border-radius: 50%; margin: 10px auto;
  background: linear-gradient(135deg, var(--primary), var(--primary-2)); color: #fff;
  font-size: 38px; box-shadow: 0 8px 22px rgba(91,108,255,.35);
  display: flex; align-items: center; justify-content: center;
}
.mic-btn.on { background: linear-gradient(135deg, #ef4444, #f97316); animation: pulse 1.6s infinite; }
.mic-btn.disabled {
  background: #cbd5e1; color: #94a3b8; box-shadow: none; cursor: not-allowed;
  opacity: .6;
}
.mic-warn {
  text-align: center; padding: 10px 14px; margin: 8px auto 4px;
  background: #fef3c7; color: #92400e; border-radius: 10px;
  font-size: .82rem; line-height: 1.5; max-width: 320px;
}
@keyframes pulse { 0%,100%{ box-shadow: 0 0 0 0 rgba(239,68,68,.4);} 50%{ box-shadow: 0 0 0 14px rgba(239,68,68,0);} }

/* 返回链接（视唱/细分） */
.back-link {
  background: none; color: var(--primary); font-size: .92rem; font-weight: 700;
  padding: 8px 4px; margin-bottom: 4px; text-align: left;
}

/* 五线谱 */
.staff-box {
  background: #fffdf8; border: 1px solid var(--line); border-radius: 14px;
  margin: 6px 0 4px; overflow-x: auto;
}
.s-staff { display: block; width: 100%; }

/* 视唱题库真题图片 */
.sight-bank-img {
  background: #fffdf8; border: 1px solid var(--line); border-radius: 14px;
  margin: 6px 0 4px; overflow-x: auto; padding: 8px;
}
.sight-bank-img img { display: block; max-width: 100%; height: auto; margin: 0 auto; }

/* 简谱标记 */
.staff-mark-wrap { margin: 10px 0 6px; }
.jianpu-grid { display: flex; gap: 6px; justify-content: center; flex-wrap: wrap; }
.jp-cell { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 8px; border: 1px solid var(--line); border-radius: 12px; background: #fafbff; }
.jp-cell .jp-target { font-size: 1.2rem; font-weight: 800; color: var(--muted); min-height: 20px; }
.jp-select { width: 58px; padding: 6px; border: 1.5px solid var(--line); border-radius: 8px; background: #fff; text-align: center; font-size: 1rem; }
.jp-select.ok { border-color: var(--success); background: #dcfce7; color: #166534; font-weight: 800; }
.jp-cell.ok { border-color: var(--success); background: #f0fdf4; }
.jp-cell.ok .jp-target { color: var(--success); }

/* ===== 视唱改版：单音大目标 / 唱错 / 放大录音 ===== */
.pitch-badge.no { background: #fee2e2; color: #b91c1c; }
.sight-targets.one { gap: 12px; }
.sight-targets.one .target { padding: 12px 22px; font-size: 1.25rem; }
.sight-targets.one .target i { font-style: normal; color: var(--muted); font-size: .8rem; }
.sight-bank-img { position: relative; cursor: zoom-in; border-radius: 12px; overflow: hidden; }
.sight-bank-img .zoom-hint {
  position: absolute; right: 8px; bottom: 8px; padding: 3px 8px; border-radius: 12px;
  background: rgba(35,38,58,.72); color: #fff; font-size: .72rem; pointer-events: none;
}
.zoom-overlay {
  position: fixed; inset: 0; z-index: 1000; background: rgba(8,10,25,.82);
  display: flex; align-items: center; justify-content: center; padding: 16px;
}
.zoom-body {
  background: #fff; border-radius: 16px; max-width: 920px; width: 94%;
  max-height: 92vh; display: flex; flex-direction: column; overflow: hidden; box-shadow: 0 20px 60px rgba(0,0,0,.4);
}
.zoom-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.zoom-head b { font-size: .95rem; }
.zoom-head button { border: none; background: none; font-size: 1.1rem; color: var(--muted); cursor: pointer; padding: 4px 8px; }
.zoom-scroll { overflow: auto; padding: 14px 16px 4px; background: #f5f7ff; }
.zoom-img { display: block; width: 100%; max-width: 100%; height: auto; margin: 0 auto; }
.zoom-actions { display: flex; gap: 8px; padding: 12px 16px; flex-wrap: wrap; }
.zoom-actions .btn-soft { flex: 1; white-space: nowrap; }
/* 放大后的大录音键：点击开始、再点一次停止并提交 */
.z-rec {
  flex: 0 0 auto; align-self: center; width: 96px; height: 96px; margin: 14px auto 4px;
  border: none; border-radius: 50%; cursor: pointer; font-size: 40px;
  background: linear-gradient(145deg, #f43f5e, #be123c); color: #fff;
  box-shadow: 0 10px 24px rgba(190, 18, 60, .35); transition: transform .12s ease;
  display: flex; align-items: center; justify-content: center;
}
.z-rec:active { transform: scale(.94); }
.z-rec.on { background: linear-gradient(145deg, #f59e0b, #b45309); animation: zPulse 1.1s infinite; box-shadow: 0 10px 24px rgba(245,158,11,.4); }
@keyframes zPulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(245,158,11,.55); } 60% { box-shadow: 0 0 0 18px rgba(245,158,11,0); } }

/* ===== 乐理 ===== */
.course-list { display: flex; flex-direction: column; gap: 10px; }
.course {
  display: flex; align-items: center; gap: 12px; text-align: left;
  background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 14px;
  box-shadow: var(--shadow);
}
.course .ico { font-size: 26px; }
.course h3 { margin: 0; font-size: .98rem; }
.course p { margin: 2px 0 0; color: var(--muted); font-size: .78rem; }
.course .chevron { margin-left: auto; color: var(--muted); }
.lesson-body { white-space: pre-wrap; color: #3a3f55; font-size: .95rem; margin-top: 10px; padding-top: 10px; border-top: 1px dashed #e5e7eb; }
.knowledge-toggle {
  width: 100%; display: flex; align-items: center; justify-content: space-between;
  padding: 10px 12px; margin-top: 8px;
  background: #f0f4ff; border: 1px solid #dbe4ff; border-radius: 10px;
  font-size: .9rem; color: var(--primary); cursor: pointer;
}
.knowledge-toggle:hover { background: #e6efff; }
.knowledge-toggle .chevron { font-size: .8rem; }
.quiz-btn { margin-top: 14px; }

/* ===== 我的 / 统计 ===== */
.avatar {
  width: 62px; height: 62px; border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  color: #fff; font-size: 1.6rem; font-weight: 800;
  display: flex; align-items: center; justify-content: center;
}
.profile-head { display: flex; align-items: center; gap: 14px; }
.xp-track { height: 10px; background: var(--line); border-radius: 8px; overflow: hidden; margin-top: 10px; }
.xp-track i { display: block; height: 100%; background: linear-gradient(90deg, var(--primary), var(--primary-2)); }

.bar-chart { display: flex; align-items: flex-end; gap: 6px; height: 120px; padding-top: 8px; }
.bar-chart .bar { flex: 1; background: linear-gradient(180deg, var(--primary), var(--primary-2)); border-radius: 6px 6px 2px 2px; opacity: .85; position: relative; }
.bar-chart .day { font-size: .62rem; color: var(--muted); text-align: center; margin-top: 4px; }
.bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; }
.bar-col .bar-wrap { width: 100%; height: 110px; display: flex; align-items: flex-end; }

.module-stat { display: flex; justify-content: space-between; padding: 10px 0; border-bottom: 1px solid var(--line); font-size: .9rem; }
.module-stat:last-child { border-bottom: none; }
.module-stat .acc { font-weight: 700; }

.record-item { display: flex; justify-content: space-between; padding: 8px 0; border-bottom: 1px dashed var(--line); font-size: .85rem; }
.record-item:last-child { border-bottom: none; }
.tag { font-size: .7rem; padding: 2px 8px; border-radius: 10px; background: #eef0ff; color: var(--primary); font-weight: 700; }
.tag.ok { background: #dcfce7; color: #166534; }
.tag.no { background: #fee2e2; color: #991b1b; }
.tag.warn { background: #fef3c7; color: #92400e; }
.course:disabled, .course.locked { opacity: .55; filter: grayscale(.4); cursor: pointer; }
.course:disabled .chevron, .course.locked .chevron { display: none; }

/* ===== 弹窗 / toast ===== */
.modal {
  position: fixed; inset: 0; z-index: 60; background: rgba(20,24,50,.4);
  display: flex; align-items: flex-end; justify-content: center;
  backdrop-filter: blur(4px); animation: fade .2s;
}
.sheet {
  background: #fff; width: 100%; max-width: 560px;
  max-height: 92vh; overflow-y: auto; -webkit-overflow-scrolling: touch;
  border-radius: 24px 24px 0 0; padding: 24px 22px calc(26px + var(--safe-b));
  animation: slideUp .28s ease;
}
@keyframes slideUp { from { transform: translateY(40px); opacity: 0; } to { transform: none; opacity: 1; } }
.sheet h2 { margin: 0 0 16px; }
.sheet label { display: block; margin-bottom: 12px; font-size: .85rem; color: var(--muted); }
.sheet input {
  width: 100%; margin-top: 6px; padding: 12px; border: 1.5px solid var(--line);
  border-radius: 12px; background: #fafbff; outline: none;
}
.sheet input:focus { border-color: var(--primary); }
.sheet select, .sheet textarea {
  width: 100%; margin-top: 6px; padding: 12px; border: 1.5px solid var(--line);
  border-radius: 12px; background: #fafbff; outline: none; resize: none;
}
.sheet textarea:focus, .sheet select:focus { border-color: var(--primary); }

/* 机构资料引导：省份 + 城市 两级下拉并排，弹窗整体高度压缩 */
.city-two-level { display: flex; gap: 8px; }
.city-two-level select { flex: 1; min-width: 0; }
#onboardModal .sheet { max-height: 86vh; padding: 18px 18px 14px; }
#onboardModal .obAvatar-row { gap: 6px; }
#onboardModal label { margin-bottom: 9px; }

/* ===== 注册分步：角色卡片 / 协议勾选 ===== */
.role-cards { display: flex; flex-direction: column; gap: 8px; margin: 4px 0 14px; }
.role-card {
  display: flex; align-items: center; gap: 10px; padding: 12px 14px; cursor: pointer;
  border: 1.5px solid var(--line); border-radius: 14px; background: #fafbff; margin: 0;
}
.role-card:has(input:checked) { border-color: var(--primary); background: #eef0ff; }
.role-card input { width: 18px; height: 18px; margin: 0; flex: none; accent-color: var(--primary); }
.role-card .role-emoji { font-size: 1.4rem; }
.role-card .role-name { font-weight: 700; color: var(--ink); font-size: .92rem; }
.role-card small { display: block; color: var(--muted); font-size: .74rem; margin-top: 2px; }
.agree-line a { color: var(--primary); text-decoration: underline; }

/* ===== 新手引导滑动页 ===== */
.intro-sheet {
  background: var(--card); width: 100%; max-width: 440px; margin: 0 20px;
  border-radius: 24px; padding: 28px 22px 18px; box-shadow: 0 20px 60px rgba(0,0,0,.35);
  animation: fade .25s;
}
.intro-slides { position: relative; overflow: hidden; border-radius: 16px; }
.intro-track { display: flex; transition: transform .32s ease; }
.intro-slide { flex: 0 0 100%; min-width: 100%; padding: 6px 2px 16px; text-align: center; }
.intro-slide .intro-emoji { font-size: 3.2rem; display: block; margin-bottom: 10px; }
.intro-slide h2 { margin: 0 0 8px; font-size: 1.25rem; color: var(--ink); }
.intro-slide p { margin: 0 auto; max-width: 320px; color: var(--muted); font-size: .9rem; line-height: 1.6; }
.intro-dots { display: flex; justify-content: center; gap: 6px; margin: 10px 0 6px; }
.intro-dots i { width: 7px; height: 7px; border-radius: 50%; background: var(--line); transition: all .25s; }
.intro-dots i.on { width: 20px; border-radius: 4px; background: var(--primary); }
.intro-actions { display: flex; gap: 10px; margin-top: 6px; }
.intro-actions .btn-primary, .intro-actions .btn-ghost { flex: 1; margin-top: 0; }

/* ===== 班级排名表 ===== */
.rank-tbl { width: 100%; border-collapse: collapse; font-size: .78rem; }
.rank-tbl th {
  text-align: left; padding: 8px 6px; color: var(--muted);
  font-weight: 700; border-bottom: 1.5px solid var(--line); white-space: nowrap;
}
.rank-tbl td { padding: 8px 6px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.rank-tbl .rk-no { color: var(--muted); font-weight: 700; }
.rank-tbl tr:nth-child(-n+3) .rk-no { color: var(--primary); }

/* 头像 */
.avatar-circle {
  width: 62px; height: 62px; border-radius: 50%; overflow: hidden;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  font-size: 1.9rem; color: #fff; flex: none;
}
.avatar-circle img { width: 100%; height: 100%; object-fit: cover; }
.avatar-sm {
  width: 40px; height: 40px; border-radius: 50%; overflow: hidden;
  display: inline-flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  font-size: 1.2rem; color: #fff; flex: none;
}
.avatar-sm img { width: 100%; height: 100%; object-fit: cover; }

/* 子模式菜单 */
.mode-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.mode-card {
  background: var(--card); border: 1px solid var(--line); border-radius: 16px;
  padding: 16px; text-align: center; box-shadow: var(--shadow);
}
.mode-card .ico { font-size: 30px; }
.mode-card h3 { margin: 8px 0 2px; font-size: 1rem; }
.mode-card p { margin: 0; color: var(--muted); font-size: .78rem; }
.mode-card.featured {
  background: linear-gradient(135deg, #5b6cff, #9a5bff); color: #fff; border: none;
}
.mode-card.featured p { color: rgba(255,255,255,.85); }

/* 分组小标题 */
.subhead { font-size: .82rem; color: var(--muted); margin: 16px 0 8px; font-weight: 700; }
.inline-actions { display: flex; gap: 10px; margin-top: 12px; }
.inline-actions .btn-soft { flex: 1; }

.role-badge {
  font-size: .72rem; padding: 3px 10px; border-radius: 12px; font-weight: 700;
  background: #eef0ff; color: var(--primary);
}
.role-badge.teacher { background: #fef3c7; color: #92400e; }
.code-chip { font-size: 1.5rem; font-weight: 800; letter-spacing: .35em; color: var(--primary); text-align: center; margin: 8px 0; }

.student-row { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.student-row:last-child { border-bottom: none; }
.badge-dot { font-size: .72rem; font-weight: 700; color: var(--muted); }

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

/* 单元测试卷在线作答 */
.pt-q { padding: 14px 0; border-bottom: 1px dashed var(--line); }
.pt-q:last-child { border-bottom: none; }
.pt-opts { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
.pt-opt {
  display: flex; align-items: center; gap: 8px; padding: 11px 13px;
  border: 1px solid var(--line); border-radius: 12px; background: #fff; font-size: .92rem;
}
.pt-opt:active { background: #f6f7ff; }
.pt-opt input { accent-color: var(--primary); flex: none; }

/* 老师布置作业：学生勾选 */
.aw-stu {
  display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px;
  border: 1px solid var(--line); border-radius: 999px; background: #fff; font-size: .82rem; cursor: pointer;
}
.aw-stu:active { background: #f6f7ff; }
.aw-stu input { accent-color: var(--primary); margin: 0; }
.aw-stu:has(input:checked) { border-color: var(--primary); background: #eef0ff; color: var(--primary); font-weight: 700; }

/* 批改输入 */
.grade-box { background: #fafbff; border: 1px solid var(--line); border-radius: 12px; padding: 12px; margin-top: 8px; }
.err { color: var(--danger); font-size: .82rem; margin: 4px 0; }
.toast {
  position: fixed; left: 50%; bottom: calc(var(--tabbar-h) + 18px); transform: translateX(-50%) translateY(20px);
  background: rgba(35,38,58,.92); color: #fff; padding: 12px 20px; border-radius: 16px;
  font-size: .85rem; opacity: 0; pointer-events: none; transition: all .25s; z-index: 70;
  max-width: 86%; text-align: center; line-height: 1.5; white-space: pre-line;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.empty { text-align: center; color: var(--muted); padding: 40px 0; }
.spinner { text-align: center; padding: 40px; color: var(--muted); }

/* ===== 我的-首页背景选择 ===== */
.bg-picker { display: flex; gap: 10px; flex-wrap: wrap; }
.bg-swatch {
  width: 56px; height: 56px; border-radius: 14px; border: 3px solid var(--line);
  background-size: cover; background-position: center;
}
.bg-swatch.active { border-color: var(--primary); box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--primary); }

/* ===== 作业附件 / 拖拽上传 ===== */
.dropzone {
  margin-top: 10px; padding: 20px 14px; text-align: center; color: var(--muted);
  border: 2px dashed var(--primary); border-radius: 14px; background: #f6f7ff;
  font-size: .9rem; cursor: pointer; transition: all .15s;
}
.dropzone.over { background: #eef0ff; border-color: #9a5bff; color: var(--primary); }
.upload-list { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.att-chip {
  display: inline-flex; align-items: center; gap: 6px; background: #eef0ff; color: var(--primary);
  padding: 6px 10px; border-radius: 12px; font-size: .8rem; font-weight: 600;
}
.att-chip .att-rm { color: var(--danger); font-size: .8rem; line-height: 1; }
.att-links { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 4px; }
.att-link {
  display: inline-block; color: var(--primary); background: #f0f2ff; font-size: .78rem;
  padding: 5px 10px; border-radius: 10px; text-decoration: none; font-weight: 600;
}
.att-count { color: var(--primary); text-decoration: none; font-size: .78rem; font-weight: 700; }

/* ===== 布置作业-勾选学生 ===== */
.stu-pick { display: flex; flex-direction: column; gap: 6px; margin-top: 6px; }
.stu-pick-item {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px;
  border: 1px solid var(--line); border-radius: 12px; background: #fafbff; cursor: pointer;
}
.stu-pick-item input { width: 18px; height: 18px; accent-color: var(--primary); }
.stu-pick-item span { font-weight: 600; }

/* ===== 头像选择（下拉收起） ===== */
.avatar-pick { border: 1px solid var(--line); border-radius: 14px; padding: 10px; margin-top: 6px; }
.avatar-pick-head { display: flex; align-items: center; gap: 10px; }
.avatar-pick-head .avatar-circle { width: 44px; height: 44px; font-size: 24px; }
.avatar-pick-body { margin-top: 10px; }
.emoji-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; }
.emoji-opt {
  aspect-ratio: 1; border: 1px solid var(--line); border-radius: 12px; background: #fafbff;
  font-size: 26px; display: flex; align-items: center; justify-content: center; cursor: pointer;
  transition: transform .12s, border-color .12s, background .12s;
}
.emoji-opt:hover { transform: scale(1.06); border-color: var(--primary); }
.emoji-opt.active { border-color: var(--primary); background: #eef0ff; box-shadow: 0 0 0 2px rgba(91,108,255,.25); }
/* ===== 后台管理 ===== */
.admin-nav { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin: 10px 0 14px; }
.admin-nav-item {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  padding: 10px 4px; border: 1px solid var(--line); border-radius: 14px;
  background: #fafbff; font-weight: 600; font-size: .74rem; color: inherit; cursor: pointer; text-align: center;
  transition: border-color .12s, background .12s, color .12s;
}
.anv-ico {
  width: 46px; height: 46px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  font-size: 22px; background: linear-gradient(135deg, #eef0ff, #e3ecff);
}
.admin-nav-item.active { border-color: var(--primary); background: #eef0ff; color: var(--primary); }
.admin-nav-item.active .anv-ico { background: linear-gradient(135deg, #dbe1ff, #cdd6ff); }
#adminExam { width: auto; flex-direction: row; gap: 8px; padding: 8px 18px; }

/* 后台 · 班级机构总览（机构卡片可展开） */
.inst-card { border: 1px solid var(--line); border-radius: 14px; margin-bottom: 10px; overflow: hidden; background: var(--card, #fff); }
.inst-head { width: 100%; display: flex; align-items: center; gap: 10px; padding: 12px 12px; background: #f8f9ff; border: none; cursor: pointer; text-align: left; }
.inst-ico { font-size: 22px; }
.inst-main { flex: 1; display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.inst-main b { font-size: .9rem; }
.inst-main span { font-size: .73rem; }
.inst-arrow { color: var(--muted); font-size: 1.15rem; transition: transform .15s; }
.inst-body { display: none; padding: 8px 12px 12px; border-top: 1px solid var(--line); }
.inst-card.open .inst-body { display: block; }
.exam-tag { background: #eef0ff; color: var(--primary, #5b6cff); border: 1px solid var(--primary, #5b6cff); }
.bank-type-row { display: flex; gap: 10px; margin-bottom: 12px; }
.bank-type {
  flex: 1; padding: 10px; border: 1px solid var(--line); border-radius: 12px;
  background: #fafbff; font-weight: 600; font-size: .9rem; cursor: pointer;
  transition: border-color .12s, background .12s;
}
.bank-type.active { border-color: var(--primary); background: #eef0ff; color: var(--primary); }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
#bankForm label, #bankForm label { display: block; font-size: .82rem; font-weight: 600; margin: 10px 0 4px; color: var(--muted); }
#bankForm input, #bankForm select, #bankForm textarea {
  width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px;
  font-size: .92rem; background: #fafbff; box-sizing: border-box;
}
#bankForm textarea { resize: vertical; }
#bankForm input:focus, #bankForm select:focus, #bankForm textarea:focus { outline: none; border-color: var(--primary); }
.ok-text { color: #166534; font-size: .85rem; font-weight: 600; margin-top: 10px; }
.err-text { color: #b91c1c; font-size: .85rem; font-weight: 600; margin-top: 10px; }
.drop-zone {
  border: 2px dashed var(--line); border-radius: 16px; padding: 28px 16px; text-align: center;
  background: #fafbff; cursor: pointer; transition: border-color .15s, background .15s;
}
.drop-zone.drag, .drop-zone:hover { border-color: var(--primary); background: #eef0ff; }
.drop-inner { font-size: .95rem; color: var(--muted); line-height: 1.7; }
.img-compare { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 12px; }
.img-compare div { border: 1px solid var(--line); border-radius: 12px; padding: 6px; background: #fff; }
.img-compare span { display: block; font-size: .75rem; color: var(--muted); margin-bottom: 4px; }
.img-compare img { width: 100%; border-radius: 8px; display: block; }
.ocr-box { margin-top: 12px; border: 1px solid var(--line); border-radius: 14px; padding: 12px; background: #fafbff; }
.ocr-box textarea { width: 100%; padding: 10px; border: 1px solid var(--line); border-radius: 10px; font-size: .9rem; box-sizing: border-box; resize: vertical; }

/* ===== 后台题库增强 ===== */
.mini-drop {
  display: inline-block; margin: 4px 0 6px; padding: 8px 12px;
  border: 1.5px dashed var(--line); border-radius: 10px;
  background: #fafbff; color: var(--muted); font-size: .82rem; font-weight: 600;
  cursor: pointer; transition: border-color .15s, background .15s;
}
.mini-drop.drag, .mini-drop:hover { border-color: var(--primary); background: #eef0ff; }
.chip-list { display: inline-flex; flex-wrap: wrap; gap: 6px; margin-left: 8px; }
.chip {
  display: inline-flex; align-items: center; gap: 4px; padding: 3px 8px;
  background: #eef0ff; color: var(--primary); border-radius: 8px; font-size: .75rem; font-weight: 700;
}
.chip-x {
  border: none; background: transparent; color: var(--primary); font-size: 1rem;
  line-height: 1; cursor: pointer; padding: 0 2px;
}
.thumb-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; }
.opt-thumb { position: relative; width: 56px; height: 56px; border-radius: 10px; overflow: hidden; border: 1px solid var(--line); }
.opt-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.opt-thumb .chip-x { position: absolute; top: 2px; right: 2px; background: rgba(0,0,0,.6); color: #fff; border-radius: 50%; width: 16px; height: 16px; }
.distract-row { display: flex; gap: 8px; margin-top: 4px; }
.distract-row input { flex: 1; }
.distract-row .btn-soft { white-space: nowrap; }
.hint { font-size: .8rem; color: var(--muted); }
/* 批量上传 */
.batch-list { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 12px; }
.batch-item { position: relative; border-radius: 10px; overflow: hidden; border: 1px solid var(--line); }
.batch-item img { width: 100%; aspect-ratio: 1; object-fit: cover; display: block; }
.batch-item span { position: absolute; left: 6px; bottom: 6px; background: rgba(0,0,0,.55); color: #fff; font-size: .7rem; padding: 2px 6px; border-radius: 6px; }
.batch-item .chip-x { position: absolute; top: 4px; right: 4px; background: rgba(0,0,0,.6); color: #fff; border-radius: 50%; width: 18px; height: 18px; }
.custom-subcat{width:100%;box-sizing:border-box;margin-top:6px;}

/* ===== 用户管理（后台） ===== */
.stat-strip { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; margin: 6px 0 14px; }
.stat-cell { text-align: center; background: #fafbff; border: 1px solid var(--line); border-radius: 12px; padding: 10px 4px; }
.stat-cell b { display: block; font-size: 1.15rem; color: var(--primary); }
.stat-cell span { font-size: .68rem; color: var(--muted); }
.user-filter { display: flex; gap: 10px; margin-bottom: 10px; }
.user-filter input { flex: 1; padding: 9px 12px; border: 1px solid var(--line); border-radius: 10px; font-size: .9rem; background: #fafbff; }
.user-filter select { padding: 9px 10px; border: 1px solid var(--line); border-radius: 10px; font-size: .9rem; background: #fafbff; }
.user-list { display: flex; flex-direction: column; gap: 8px; }
.user-row {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; background: #fafbff;
}
.user-row.off { opacity: .6; background: #f4f4f8; }
.user-info { min-width: 0; }
.user-top { display: flex; align-items: center; gap: 6px; }
.user-top b { font-size: .95rem; }
.user-meta { display: block; margin-top: 3px; font-size: .74rem; color: var(--muted); }
.user-ops { display: flex; gap: 6px; flex: none; }
.btn-sm { padding: 6px 10px; font-size: .78rem; border-radius: 10px; }
.btn-sm:disabled { opacity: .45; cursor: default; }
.btn-danger-soft { background: #fee2e2; color: #b91c1c; border-radius: 10px; padding: 6px 10px; font-size: .78rem; font-weight: 600; }
.pager { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 12px; }
.pager-info { font-size: .78rem; color: var(--muted); }

/* ===== Apple Sign In 按钮 ===== */
.apple-signin-wrap { margin-top: 12px; }
.auth-divider { text-align: center; color: var(--muted); font-size: .8rem; margin: 10px 0; position: relative; }
.auth-divider::before, .auth-divider::after { content: ""; position: absolute; top: 50%; width: 35%; height: 1px; background: var(--line); }
.auth-divider::before { left: 0; } .auth-divider::after { right: 0; }
.apple-signin-btn {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%; height: 44px; border-radius: 12px; border: none;
  background: #000; color: #fff; font-size: 1rem; font-weight: 500; cursor: pointer;
  transition: opacity .15s;
}
.apple-signin-btn:active { opacity: 0.85; }
.apple-signin-btn:hover { opacity: 0.9; }

/* ===== 语言切换按钮 active 状态 ===== */
.btn-soft.active { background: var(--primary); color: #fff; font-weight: 700; }

/* ===== 乐理细分知识点流程式布局 ===== */
.lesson-flow {
  display: flex; flex-direction: column; gap: 6px; margin-top: 8px;
  position: relative; padding-left: 0;
}
.lesson-step {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border-radius: 12px;
  background: #fff; border: 1px solid var(--line);
  text-align: left; cursor: pointer;
  transition: transform .15s, border-color .15s;
  position: relative;
}
.lesson-step:hover { transform: translateX(2px); border-color: var(--primary); }
.lesson-step:not(:last-child)::after {
  content: ""; position: absolute; left: 22px; bottom: -6px;
  width: 2px; height: 6px; background: var(--line);
}
.step-dot {
  width: 26px; height: 26px; border-radius: 50%; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  color: #fff; font-size: .75rem; font-weight: 700;
}
.step-body { flex: 1; min-width: 0; }
.step-body h4 { margin: 0 0 1px; font-size: .9rem; font-weight: 600; }
.step-body span { font-size: .72rem; color: var(--muted); }

/* ===== 乐理综合练习选项列表 ===== */
.opt-list { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
.opt {
  display: block; width: 100%; text-align: left;
  padding: 12px 14px; border-radius: 10px;
  border: 1.5px solid var(--line); background: #fff;
  font-size: .9rem; cursor: pointer;
  transition: border-color .15s, background .15s;
}
.opt:hover { border-color: var(--primary); }
.opt.ok { border-color: var(--success); background: #f0fdf4; }
.opt.err { border-color: var(--danger); background: #fef2f2; }

/* ===== 通知铃铛 ===== */
.notif-badge {
  position: absolute; top: 4px; right: 4px;
  min-width: 16px; height: 16px; padding: 0 4px;
  border-radius: 10px; background: var(--danger); color: #fff;
  font-size: .65rem; font-weight: 700; line-height: 16px; text-align: center;
  border: 2px solid #fff;
}
.notif-panel {
  position: fixed; top: calc(var(--topbar-h) + env(safe-area-inset-top) + 10px); right: 12px;
  z-index: 60; width: 320px; max-height: 400px; overflow-y: auto;
  background: #fff; border: 1px solid var(--line); border-radius: 14px;
  box-shadow: 0 12px 32px rgba(43, 55, 150, 0.14);
  animation: fadeDown .18s ease;
}
.notif-panel .notif-item {
  padding: 12px 14px; border-bottom: 1px solid var(--line);
  cursor: pointer; transition: background .15s;
}
.notif-panel .notif-item:hover { background: #f4f6ff; }
.notif-panel .notif-item.unread { background: #f5f0ff; }
.notif-panel .notif-item h4 { margin: 0 0 2px; font-size: .85rem; }
.notif-panel .notif-item p { margin: 0; font-size: .78rem; color: var(--muted); line-height: 1.4; }
.notif-panel .notif-item time { font-size: .7rem; color: var(--muted); }
.notif-panel .notif-empty { padding: 24px; text-align: center; color: var(--muted); font-size: .85rem; }
.notif-panel .notif-head {
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 14px; border-bottom: 1px solid var(--line);
}
.notif-panel .notif-head strong { font-size: .9rem; }
.notif-panel .notif-head button { font-size: .75rem; color: var(--primary); background: none; border: none; cursor: pointer; }

/* ===== 平板 / 大屏适配 ===== */
@media (min-width: 768px) {
  html { font-size: 16px; }
  .view { max-width: 760px; padding: 22px 24px; }
  .topbar { padding-left: 26px; padding-right: 26px; }
  .card { padding: 20px; }
  .sheet { border-radius: 24px; margin: auto; max-height: 88vh; overflow: auto; }
  .modal { align-items: center; }
  .toast { font-size: .95rem; bottom: calc(var(--tabbar-h) + 26px); }
  /* 课程 / 模块列表双列 */
  .course-list { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
  .course { padding: 16px; }
  .course .ico { font-size: 30px; }
  .course h3 { font-size: 1.02rem; }
  .course p { font-size: .8rem; }
  .module-grid { grid-template-columns: repeat(3, 1fr); }
  .mode-row { grid-template-columns: repeat(3, 1fr); }
  .stat-grid { gap: 12px; }
  .option-grid { gap: 12px; }
  .q-prompt { font-size: 1.15rem; }
  .emoji-grid { grid-template-columns: repeat(8, 1fr); }
  .batch-list { grid-template-columns: repeat(6, 1fr); }
  .form-grid { grid-template-columns: repeat(3, 1fr); }
  /* 底部导航更舒展 */
  .tab { font-size: .78rem; gap: 4px; }
  .tab span { font-size: 24px; }
  .pt-opts { flex-direction: row; flex-wrap: wrap; }
  .pt-opt { flex: 1 1 calc(50% - 8px); }
}

@media (min-width: 1024px) {
  .view { max-width: 1000px; padding: 26px 32px; }
  .course-list { grid-template-columns: repeat(3, 1fr); }
  .module-grid { grid-template-columns: repeat(4, 1fr); }
  .mode-row { grid-template-columns: repeat(4, 1fr); }
  .option-grid { grid-template-columns: repeat(2, 1fr); }
  .tab { font-size: .8rem; }
  .tab span { font-size: 26px; }
  .stat-strip { grid-template-columns: repeat(5, 1fr); }
  .form-grid { grid-template-columns: repeat(4, 1fr); }
  .batch-list { grid-template-columns: repeat(8, 1fr); }
}

/* ===== 去做题额度卡片 ===== */
.quota-grid { display: flex; flex-direction: column; gap: 8px; }
.quota-cell {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px; border-radius: 14px; text-align: left;
  background: #f8f9ff; border: 1px solid var(--line); cursor: pointer;
  transition: background .15s, border-color .15s;
}
.quota-cell:hover { background: #eef0ff; border-color: var(--primary); }
.quota-cell.exhausted { opacity: .5; }
.quota-icon { font-size: 22px; flex-shrink: 0; }
.quota-info { flex: 1; display: flex; flex-direction: column; gap: 1px; }
.quota-info b { font-size: .95rem; }
.quota-info span { font-size: .75rem; color: var(--muted); }
.quota-status { font-size: .75rem; color: var(--primary); white-space: nowrap; }
.quota-cell.exhausted .quota-status { color: var(--danger); }

/* ===== 管理员工作台消息卡片（正方形图标排布） ===== */
.workbench-list { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 6px; }
.wb-row {
  position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 5px;
  padding: 14px 6px; border-radius: 16px; text-align: center;
  background: var(--card, #fff); border: 1px solid var(--line); cursor: pointer;
  transition: background .15s, border-color .15s, transform .12s;
}
.wb-row:hover { background: #eef0ff; border-color: var(--primary); transform: translateY(-2px); }
.wb-icon { width: 52px; height: 52px; border-radius: 14px; display: flex; align-items: center; justify-content: center; font-size: 26px; background: linear-gradient(135deg, #eef0ff, #e3ecff); }
.wb-main { flex: none; display: flex; flex-direction: column; gap: 1px; }
.wb-main b { font-size: .78rem; }
.wb-main span { font-size: .68rem; }
.wb-dot {
  position: absolute; top: 6px; right: 6px; width: 8px; height: 8px; border-radius: 50%;
  background: var(--danger); box-shadow: 0 0 0 3px rgba(250, 82, 82, .18);
}

/* ===== 机构工作台首页·概览卡 ===== */
.ov-stats { display: flex; gap: 8px; flex-wrap: wrap; }
.ov-stat {
  flex: 1 1 100px; min-width: 100px;
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 10px 8px; border-radius: 12px;
  background: #f8f9ff; border: 1px solid var(--line); text-align: center;
}
.ov-stat b { font-size: 1.15rem; line-height: 1.2; }
.ov-stat small { font-size: .72rem; color: var(--muted); }
.ov-ico { font-size: 1.35rem; line-height: 1.2; }

/* ===== 听音首页两列甬道布局 ===== */
.top-row { display: flex; gap: 10px; margin-bottom: 16px; }
.top-card {
  flex: 1; display: flex; align-items: center; gap: 12px;
  padding: 14px; border-radius: 16px; background: #fff;
  border: 1px solid var(--line); text-align: left; cursor: pointer;
  transition: transform .15s, border-color .15s;
}
.top-card:hover { transform: translateY(-1px); border-color: var(--primary); }
.top-card.highlight {
  background: linear-gradient(135deg, #eef0ff 0%, #f5ecff 100%);
  border-color: #d4c8ff;
}
.top-ico { font-size: 28px; flex-shrink: 0; }
.top-info { flex: 1; min-width: 0; }
.top-info h3 { margin: 0 0 2px; font-size: .95rem; }
.top-info p { margin: 0; font-size: .78rem; color: var(--muted); }
.top-info .free-badge {
  display: inline-block; margin-top: 2px; padding: 2px 8px;
  background: var(--primary); color: #fff; border-radius: 10px;
  font-size: .7rem; font-weight: 600;
}

.lane-wrapper { display: flex; gap: 12px; }
.lane { flex: 1; display: flex; flex-direction: column; gap: 8px; }
.lane-title {
  display: flex; align-items: center; gap: 8px;
  font-size: .85rem; font-weight: 600; color: var(--muted);
  padding: 4px 2px;
}
.lane-dot {
  width: 8px; height: 8px; border-radius: 50%;
}
.lane-dot.melody { background: var(--primary); }
.lane-dot.rhythm { background: var(--primary-2); }

.lane-list {
  position: relative;
  display: flex; flex-direction: column; gap: 8px;
  padding-left: 14px;
}
.lane-list::before {
  content: ""; position: absolute;
  left: 4px; top: 0; bottom: 0; width: 2px;
  background: linear-gradient(to bottom, var(--primary), transparent);
  border-radius: 2px;
}
.lane:nth-child(2) .lane-list::before {
  background: linear-gradient(to bottom, var(--primary-2), transparent);
}

.lane-unit {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border-radius: 12px;
  background: #fff; border: 1px solid var(--line);
  text-align: left; cursor: pointer;
  transition: transform .15s, border-color .15s, opacity .15s;
}
.lane-unit:hover { transform: translateX(2px); border-color: var(--primary); }
.lane-unit.locked { opacity: .55; }
.lane-unit.locked:hover { transform: none; border-color: var(--line); }
.lane-ico { font-size: 20px; flex-shrink: 0; }
.lane-body { flex: 1; min-width: 0; }
.lane-body h4 { margin: 0 0 1px; font-size: .88rem; font-weight: 600; }
.lane-body span { font-size: .72rem; color: var(--muted); line-height: 1.3; }
.lane-right { flex-shrink: 0; display: flex; flex-direction: column; align-items: flex-end; gap: 2px; }
.lane-right .tag { font-size: .68rem; }
.lane-right .chevron { font-size: .8rem; }

@media (min-width: 520px) {
  .lane-body h4 { font-size: .95rem; }
  .lane-body span { font-size: .78rem; }
}

/* 教学分析：预警行 / 学生趋势链接 */
.alert-line {
  margin-top: 5px; padding: 6px 10px; border-radius: 8px;
  font-size: .78rem; line-height: 1.45;
  border: 1px solid transparent;
}
.alert-warn { background: #fef3c7; border-color: #fcd34d; color: #78350f; }
.alert-danger { background: #fee2e2; border-color: #fca5a5; color: #991b1b; }
button.btn-link {
  background: none; border: none; color: var(--primary);
  font-size: .85rem; cursor: pointer;
}
button.btn-link:hover { text-decoration: underline; }

/* 教学分析：功能图标桌面（app 网格，点开跳转） */
.app-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(84px, 1fr));
  gap: 10px;
}
.app-tile {
  position: relative;
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: 12px 6px 10px;
  border: 1px solid var(--line); border-radius: 14px;
  background: var(--card, #fff); cursor: pointer;
  transition: transform .12s ease, box-shadow .12s ease;
}
.app-tile:hover { transform: translateY(-2px); box-shadow: 0 6px 16px rgba(0,0,0,.10); }
.app-tile b { font-size: .78rem; font-weight: 600; color: var(--text, #1c1c1e); }
.app-ico {
  width: 46px; height: 46px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 24px;
  background: linear-gradient(135deg, #eef0ff, #e3ecff);
}
.app-tile:nth-child(3n) .app-ico { background: linear-gradient(135deg, #ffeef0, #ffe3e8); }
.app-tile:nth-child(3n+1) .app-ico { background: linear-gradient(135deg, #eafaf1, #ddf5e6); }
.app-badge {
  position: absolute; top: -4px; right: -4px;
  min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px;
  background: #9aa0b5; color: #fff; font-size: .7rem; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}
.app-badge.red { background: #e5484d; }

/* 机构首页核心按钮放大 */
.app-tile-big { grid-column: span 2; padding: 16px 8px 14px; border-radius: 16px; border-color: var(--primary, #5b6cff); }
.app-tile-big .app-ico { width: 60px; height: 60px; border-radius: 16px; font-size: 30px; }
.app-tile-big b { font-size: .88rem; }

/* 功能图标分组（机构/教师工作台）：分组标题 + 组内容 */
.app-group { margin-top: 14px; }
.app-group:first-child { margin-top: 0; }
.app-group-title {
  font-size: .72rem; font-weight: 700; color: var(--muted, #8a8a8e);
  margin-bottom: 8px; padding-left: 2px; letter-spacing: .5px;
}

/* 今日待办：横向圆块概览（放在功能图标上面，横向滚动） */
.todo-round-row {
  display: flex; gap: 12px; overflow-x: auto; margin-top: 10px;
  padding: 4px 2px 8px; -webkit-overflow-scrolling: touch;
}
.todo-round {
  flex: 0 0 auto; width: 88px; height: 88px; border-radius: 50%;
  border: 1px solid var(--line); background: var(--card, #fff);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px;
  cursor: pointer; box-shadow: 0 2px 8px rgba(0,0,0,.05);
  transition: transform .12s ease, box-shadow .12s ease;
}
.todo-round:active { transform: scale(.96); }
.todo-round-ico { font-size: 1.05rem; line-height: 1.2; }
.todo-round-num { font-size: 1.15rem; font-weight: 800; line-height: 1.15; color: var(--muted, #8a8a8e); }
.todo-round.hot .todo-round-num { color: #e5484d; }
.todo-round small { font-size: .6rem; color: var(--muted, #8a8a8e); line-height: 1.2; }

/* 今日待办：两排 × 每排4个，不使用滑动 */
.todo-round-grid {
  display: grid; grid-template-columns: repeat(4, 1fr);
  gap: 12px; margin-top: 10px; padding: 4px 2px 8px;
}
.todo-round-grid .todo-round { width: 100%; height: 72px; }
.todo-round-grid .todo-round-ico { font-size: .95rem; }
.todo-round-grid .todo-round-num { font-size: 1.05rem; }
.todo-round-grid .todo-round small { white-space: nowrap; }

/* 今日待办「查看详情」跳转时高亮目标子块 */
.flash { animation: flashHi 1.2s ease; border-radius: 8px; }
@keyframes flashHi { 0% { background: rgba(91,108,255,.28); } 100% { background: transparent; } }

/* 统考卷（机构版）：四档阶梯价 + 发放开关 */
.oe-tiers { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.oe-tier {
  flex: 1 1 96px; min-width: 96px; padding: 8px 10px; border-radius: 10px;
  border: 1px solid var(--line); background: var(--card, #fff);
  display: flex; flex-direction: column; gap: 2px;
}
.oe-tier b { font-size: .82rem; }
.oe-tier span { font-size: .72rem; color: var(--muted, #8a8a8e); }
.oe-tier.hit { border-color: var(--primary, #5b5bd6); background: #eef0ff; }
.oe-grant {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; margin-top: 6px;
}
.oe-grant b { font-size: .85rem; }
.oe-grant .muted { font-size: .72rem; }
.oe-sw {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: .74rem; color: var(--muted, #8a8a8e); cursor: pointer;
  padding: 3px 8px; border: 1px solid var(--line); border-radius: 8px; background: var(--card, #fff);
}
.oe-sw input { accent-color: var(--primary, #5b5bd6); }

/* ===== 暗黑模式 ===== */
body.dark {
  --bg: #111320;
  --card: #1a1d2e;
  --ink: #e8eafc;
  --muted: #9aa0bb;
  --line: #2a2e47;
  --primary: #7b8bff;
  --primary-2: #a86bff;
  --success: #34d399;
  --danger: #f87171;
  --warn: #fbbf24;
  --shadow: 0 6px 24px rgba(0, 0, 0, .45);
}
body.dark { background: var(--bg); color: var(--ink); }
body.dark .topbar { background: rgba(17, 19, 32, .92); border-bottom-color: var(--line); }
body.dark .tabbar { background: rgba(17, 19, 32, .96); border-top-color: var(--line); }
body.dark .profile-menu { background: var(--card); border-color: var(--line); }
body.dark .sheet { background: var(--card); }
body.dark .sheet input, body.dark .sheet select, body.dark .sheet textarea { background: #141627; border-color: var(--line); color: var(--ink); }
body.dark .btn-soft { background: #262a45; color: #aab4ff; }
body.dark .btn-ghost { color: #aab4ff; }
body.dark .role-card { background: #141627; }
body.dark .role-card:has(input:checked) { background: #262a45; border-color: var(--primary); }
body.dark .role-card .role-name { color: var(--ink); }
body.dark .zoom-scroll { background: #141627; }
body.dark .emoji-opt { background: #141627; border-color: var(--line); }
body.dark .emoji-opt.active { background: #262a45; border-color: var(--primary); }
body.dark .bg-swatch { box-shadow: inset 0 0 0 2px var(--line); }
body.dark .oe-tier.hit { background: #262a45; }
body.dark .oe-sw { background: var(--card); }
body.dark .intro-sheet { background: var(--card); }
body.dark .intro-slide h2 { color: var(--ink); }
body.dark input, body.dark select, body.dark textarea { color-scheme: dark; }
body.dark .card { background: var(--card); border-color: var(--line); }
body.dark .q-card { background: var(--card); }
body.dark .score-bar { color: var(--muted); }
body.dark .section-title { color: var(--ink); }
body.dark .app-tile { background: var(--card); border-color: var(--line); }
body.dark .app-tile b { color: var(--ink); }
body.dark .app-tile .app-ico { filter: brightness(.85) saturate(.9); }
body.dark .muted { color: var(--muted); }
body.dark .module-grid .card { background: var(--card); }
body.dark .course-card { background: var(--card); border-color: var(--line); }
body.dark .unit-card { background: var(--card); border-color: var(--line); }
body.dark .empty { color: var(--muted); }
body.dark .hw-card { background: var(--card); border-color: var(--line); }
body.dark .todo-item { background: var(--card); border-color: var(--line); }
body.dark .workbench-list .card { background: var(--card); border-color: var(--line); }
body.dark .grade-box { background: #141627; color: var(--success); border-color: var(--line); }
body.dark .option-grid .opt { background: var(--card); border-color: var(--line); color: var(--ink); }
body.dark .option-grid .opt.right { background: #1a3a2a; border-color: var(--success); color: #86efac; }
body.dark .option-grid .opt.wrong { background: #3a1a1a; border-color: var(--danger); color: #fca5a5; }
body.dark .answer-feedback.ok { color: var(--success); }
body.dark .answer-feedback.no { color: var(--danger); }
body.dark .explanation { color: var(--muted); }
body.dark .back-link { color: var(--primary); }
body.dark .play-btn { background: #262a45; color: var(--ink); }
body.dark .listen-grid .opt { background: var(--card); border-color: var(--line); color: var(--ink); }
body.dark .listen-grid .opt.right { background: #1a3a2a; border-color: var(--success); }
body.dark .listen-grid .opt.wrong { background: #3a1a1a; border-color: var(--danger); }
body.dark .tag { background: #262a45; color: #aab4ff; }
body.dark .tag.ok { background: #1a3a2a; color: #86efac; }
body.dark .tag.warn { background: #3a2a10; color: #fcd34d; }
body.dark .progress-bar { background: #262a45; }
body.dark .progress-fill { background: var(--primary); }
body.dark .pill { background: #262a45; color: #aab4ff; }
body.dark .stat-card { background: var(--card); border-color: var(--line); }
body.dark .stat-card .num { color: var(--ink); }
body.dark .stat-card .label { color: var(--muted); }
body.dark .list-item { border-color: var(--line); }
body.dark .list-item:hover { background: #262a45; }
body.dark .modal-mask { background: rgba(0,0,0,.6); }
body.dark .modal { background: var(--card); }
body.dark .tab-btn { color: var(--muted); }
body.dark .tab-btn.active { color: var(--primary); border-color: var(--primary); }
body.dark .watermark { color: rgba(255,255,255,.06); }
body.dark .exam-timer { color: var(--ink); }
body.dark .phase-tag { background: #262a45; color: #aab4ff; }
body.dark .q-prompt-canvas canvas { background: #141627; border-radius: 8px; }
