:root {
  --bg1: #fff5fb;
  --bg2: #f3ecff;
  --card: #ffffff;
  --primary: #ff8fc0;
  --primary2: #b892ff;
  --primary-grad: linear-gradient(135deg, #ff9ec4 0%, #c89bff 100%);
  --primary-grad-soft: linear-gradient(135deg, #ffe3f1 0%, #efe6ff 100%);
  --primary-d: #e96fae;
  --text: #5a4f6a;
  --text-strong: #463c5a;
  --muted: #ab9fbb;
  --line: #f1e7f6;
  --danger: #ff6b8a;
  --ok: #4cc38a;
  --shadow: 0 10px 30px rgba(196, 140, 240, .14);
  --shadow-sm: 0 4px 14px rgba(196, 140, 240, .10);
  --radius: 20px;
  --font-cute: 'ZCOOL KuaiLe', 'PingFang SC', 'Microsoft YaHei', sans-serif;
  --font-body: 'Quicksand', -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Microsoft YaHei', sans-serif;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font-body);
  background:
    radial-gradient(circle at 12% 8%, rgba(255, 158, 196, .18), transparent 42%),
    radial-gradient(circle at 88% 18%, rgba(184, 146, 255, .18), transparent 40%),
    radial-gradient(circle at 50% 100%, rgba(255, 200, 230, .16), transparent 50%),
    linear-gradient(160deg, var(--bg1), var(--bg2));
  background-attachment: fixed;
  color: var(--text);
  padding-bottom: 78px;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

h1, h2, h3, .login-title, .topbar-title, .subject-card .name, .stat .num,
.panel .ph, .modal h3, .quiz-score, .kpi .kpt { font-family: var(--font-cute); font-weight: 400; letter-spacing: .3px; }

/* 登录 */
.login-body {
  display: flex; align-items: center; justify-content: center; min-height: 100vh;
  background:
    radial-gradient(circle at 15% 12%, rgba(255, 158, 196, .30), transparent 45%),
    radial-gradient(circle at 85% 22%, rgba(184, 146, 255, .30), transparent 42%),
    radial-gradient(circle at 50% 95%, rgba(255, 205, 235, .28), transparent 52%),
    linear-gradient(160deg, #ffe9f4, #efe4ff);
  position: relative; overflow: hidden;
}
.login-body::before, .login-body::after {
  content: ''; position: absolute; border-radius: 50%; filter: blur(2px); opacity: .55;
  background: var(--primary-grad); animation: float 7s ease-in-out infinite;
}
.login-body::before { width: 120px; height: 120px; top: 12%; left: -30px; }
.login-body::after { width: 90px; height: 90px; bottom: 14%; right: -24px; animation-delay: -3.5s; }
@keyframes float { 0%,100% { transform: translateY(0) } 50% { transform: translateY(-22px) } }

.login-card {
  background: rgba(255,255,255,.86); backdrop-filter: blur(14px);
  width: 90%; max-width: 360px; border-radius: 28px; padding: 36px 28px 30px;
  box-shadow: 0 24px 60px rgba(196, 120, 200, .28); text-align: center;
  border: 1px solid rgba(255,255,255,.6); position: relative; z-index: 2;
}
.login-logo { font-size: 52px; filter: drop-shadow(0 6px 10px rgba(255,143,192,.35)); animation: bob 3s ease-in-out infinite; }
@keyframes bob { 0%,100% { transform: translateY(0) rotate(-3deg) } 50% { transform: translateY(-8px) rotate(3deg) } }
.login-title { margin: 12px 0 6px; font-size: 27px; color: var(--text-strong); }
.login-sub { color: var(--muted); font-size: 13px; margin: 0 0 24px; }
.login-form input {
  width: 100%; padding: 15px 18px; border: 1.5px solid var(--line);
  border-radius: 16px; font-size: 16px; margin-bottom: 16px; background: #fff;
  transition: border-color .2s, box-shadow .2s; font-family: inherit;
}
.login-form input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 4px rgba(255,143,192,.16); }
.login-form button {
  width: 100%; padding: 15px; border: 0; border-radius: 16px; color: #fff;
  font-size: 17px; font-weight: 700; letter-spacing: 2px; cursor: pointer;
  background: var(--primary-grad); box-shadow: 0 10px 22px rgba(255,143,192,.4);
  transition: transform .12s, box-shadow .2s;
}
.login-form button:active { transform: scale(.97); }
.login-form button:disabled { opacity: .6; box-shadow: none; }
.login-err { color: var(--danger); font-size: 13px; min-height: 18px; margin: 8px 0 0; }
.login-foot { color: var(--muted); font-size: 12px; margin-top: 20px; }

/* 顶栏 */
.topbar {
  position: sticky; top: 0; z-index: 20;
  background: rgba(255,255,255,.82); backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
  display: flex; align-items: center; justify-content: space-between; padding: 14px 18px;
}
.topbar-title { font-size: 21px; color: var(--text-strong); }
.topbar-user {
  border: 1.5px solid var(--line); background: #fff; color: var(--primary-d);
  border-radius: 14px; padding: 7px 14px; font-size: 13px; cursor: pointer; font-family: inherit;
}

/* 视图 */
.view { padding: 18px 16px; max-width: 760px; margin: 0 auto; }
.view h2 { font-size: 21px; margin: 4px 0 16px; color: var(--text-strong); }
.muted { color: var(--muted); font-size: 13px; }

/* 卡片网格 */
.grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; }
.subject-card {
  background: var(--card); border-radius: var(--radius); padding: 18px 16px;
  box-shadow: var(--shadow-sm); cursor: pointer; position: relative; overflow: hidden;
  border: 1px solid rgba(255,255,255,.7); transition: transform .14s, box-shadow .2s;
}
.subject-card::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 6px;
  background: var(--sc, var(--primary-grad));
}
.subject-card:active { transform: scale(.97); }
.subject-card .name { font-size: 19px; margin-top: 4px; }
.subject-card .meta { font-size: 12px; color: var(--muted); margin-top: 10px; }

.stat-row { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; margin-bottom: 20px; }
.stat {
  background: var(--card); border-radius: var(--radius); padding: 18px;
  box-shadow: var(--shadow-sm); border: 1px solid rgba(255,255,255,.7);
  position: relative; overflow: hidden;
}
.stat::after {
  content: ''; position: absolute; right: -16px; bottom: -16px; width: 60px; height: 60px;
  border-radius: 50%; background: var(--primary-grad-soft); opacity: .7;
}
.stat .num { font-size: 30px; font-weight: 400; background: var(--primary-grad); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
.stat .lab { font-size: 12px; color: var(--muted); margin-top: 6px; }

.panel {
  background: var(--card); border-radius: var(--radius); padding: 18px;
  box-shadow: var(--shadow-sm); margin-bottom: 16px; border: 1px solid rgba(255,255,255,.7);
}
.panel .ph { font-size: 16px; margin: 0 0 12px; display: flex; justify-content: space-between; align-items: center; color: var(--text-strong); }

/* 按钮 */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 0; border-radius: 16px; padding: 13px 18px; font-size: 15px; font-weight: 700;
  background: var(--primary-grad); color: #fff; cursor: pointer; font-family: inherit;
  box-shadow: 0 8px 18px rgba(255,143,192,.32); transition: transform .12s, box-shadow .2s;
}
.btn:active { transform: scale(.97); }
.btn.ghost { background: #fff; color: var(--primary-d); border: 1.5px solid var(--line); box-shadow: none; }
.btn.danger { background: #fff0f3; color: var(--danger); border: 1.5px solid #ffd9e2; box-shadow: none; }
.btn.block { width: 100%; }
.btn.sm { padding: 9px 14px; font-size: 13px; border-radius: 13px; }
.btn[disabled] { opacity: .55; box-shadow: none; }

/* 章节列表 */
.chapter-item, .book-item, .row-item {
  display: flex; align-items: center; justify-content: space-between;
  padding: 15px 4px; border-bottom: 1px solid var(--line); cursor: pointer;
}
.chapter-item:last-child, .book-item:last-child { border-bottom: 0; }
.row-item .name { font-weight: 600; }
.row-item .sub { font-size: 12px; color: var(--muted); }
.tag {
  font-size: 11px; background: var(--primary-grad-soft); color: var(--primary-d);
  border-radius: 20px; padding: 4px 11px; font-weight: 600;
}

/* 文件列表 */
.file-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.file-cell {
  background: var(--card); border-radius: 16px; overflow: hidden;
  box-shadow: var(--shadow-sm); position: relative; border: 1px solid rgba(255,255,255,.7);
}
.file-cell img { width: 100%; height: 96px; object-fit: cover; display: block; cursor: pointer; }
.file-cell .pdf { height: 96px; display: flex; align-items: center; justify-content: center; font-size: 30px; background: #faf5ff; cursor: pointer; }
.file-cell .cap { font-size: 11px; padding: 7px 9px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.file-cell .del {
  position: absolute; top: 5px; right: 5px; background: rgba(255,107,138,.9); color: #fff;
  border: 0; border-radius: 50%; width: 23px; height: 23px; font-size: 12px; cursor: pointer;
}

/* 笔记：文字 / 语音 / 图片 统一列表 */
.note-list { display: flex; flex-direction: column; gap: 8px; }
.note-text-card {
  display: flex; gap: 10px; align-items: flex-start; background: #fff7fb;
  border: 1px solid rgba(233,180,220,.5); border-radius: 14px; padding: 10px 12px; position: relative;
}
.note-text-icon { font-size: 18px; line-height: 1.4; }
.note-text-body { flex: 1; min-width: 0; }
.note-text-content { font-size: 14px; line-height: 1.6; color: #4a3a4a; white-space: pre-wrap; word-break: break-word; margin-top: 2px; }
.note-img-card { position: relative; border-radius: 14px; overflow: hidden; box-shadow: var(--shadow-sm); border: 1px solid rgba(255,255,255,.7); background: var(--card); }
.note-img-card img { width: 100%; height: 150px; object-fit: cover; display: block; cursor: pointer; }
.note-img-card .cap { font-size: 11px; padding: 7px 9px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.note-img-card .del, .note-text-card .del, .note-voice-card .del {
  position: absolute; top: 5px; right: 5px; background: rgba(255,107,138,.9); color: #fff;
  border: 0; border-radius: 50%; width: 23px; height: 23px; font-size: 12px; cursor: pointer; z-index: 2;
}
.note-voice-card {
  display: flex; gap: 10px; align-items: center; background: #fff7fb;
  border: 1px solid rgba(233,180,220,.5); border-radius: 14px; padding: 10px 12px; position: relative;
}
.note-voice-icon { font-size: 18px; }
.note-voice-body { flex: 1; min-width: 0; }
.note-voice-body audio { width: 100%; height: 36px; margin-top: 2px; }
.btn.rec { background: linear-gradient(135deg,#ff6b8a,#ff3d6e); color:#fff; animation: pulse 1.2s infinite; }
@keyframes pulse { 0%{opacity:1} 50%{opacity:.6} 100%{opacity:1} }

/* 底部导航 */
.bottomnav {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 30;
  background: rgba(255,255,255,.9); backdrop-filter: blur(12px);
  border-top: 1px solid var(--line); display: flex; padding: 4px 0;
}
.bottomnav button {
  flex: 1; border: 0; background: none; padding: 8px 0 10px; font-size: 21px;
  color: var(--muted); display: flex; flex-direction: column; align-items: center; gap: 2px;
}
.bottomnav button span { font-size: 11px; font-family: var(--font-body); }
.bottomnav button.active { color: var(--primary-d); position: relative; }
.bottomnav button.active::before {
  content: ''; position: absolute; top: 0; width: 26px; height: 3px; border-radius: 0 0 6px 6px;
  background: var(--primary-grad);
}

/* 弹窗 */
.modal-mask {
  position: fixed; inset: 0; background: rgba(90, 60, 110, .38); z-index: 50;
  display: flex; align-items: flex-end; justify-content: center;
}
.modal {
  background: #fff; width: 100%; max-width: 560px; border-radius: 26px 26px 0 0;
  padding: 22px 18px 26px; max-height: 90vh; overflow: auto;
}
.modal h3 { margin: 0 0 16px; font-size: 20px; color: var(--text-strong); }
.modal label { display: block; font-size: 13px; color: var(--muted); margin: 14px 0 6px; }
.modal input, .modal select, .modal textarea {
  width: 100%; padding: 13px 15px; border: 1.5px solid var(--line); border-radius: 14px;
  font-size: 15px; font-family: inherit; background: #fff;
}
.modal input:focus, .modal textarea:focus, .modal select:focus { outline: none; border-color: var(--primary); }
.modal textarea { min-height: 84px; resize: vertical; }
.seg { display: flex; gap: 8px; }
.seg button {
  flex: 1; padding: 11px; border: 1.5px solid var(--line); background: #fff;
  border-radius: 12px; font-size: 14px; color: var(--muted); font-family: inherit;
}
.seg button.on { background: var(--primary-grad-soft); color: var(--primary-d); border-color: #f3d6ea; font-weight: 700; }

/* 上传文件预览 */
.up-list { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 12px; }
.up-thumb { width: 66px; height: 66px; border-radius: 12px; object-fit: cover; position: relative; border: 2px solid #fff; box-shadow: var(--shadow-sm); }
.up-thumb .x {
  position: absolute; top: -5px; right: -5px; background: var(--danger); color: #fff;
  border: 0; border-radius: 50%; width: 19px; height: 19px; font-size: 11px;
}

/* 分析内容 */
.analysis-box {
  background: #fdf8ff; border: 1.5px solid var(--line); border-radius: 16px; padding: 16px;
  white-space: pre-wrap; line-height: 1.8; font-size: 14px; max-height: 60vh; overflow: auto; color: var(--text);
}
.analysis-box h1, .analysis-box h2, .analysis-box h3 { margin: 16px 0 8px; font-size: 17px; color: var(--text-strong); font-family: var(--font-cute); }
.analysis-box b, .analysis-box strong { color: var(--primary-d); }
.analysis-item {
  background: var(--card); border-radius: var(--radius); padding: 16px;
  box-shadow: var(--shadow-sm); margin-bottom: 14px; cursor: pointer; border: 1px solid rgba(255,255,255,.7);
}
.analysis-item .t { font-weight: 700; color: var(--text-strong); }
.analysis-item .m { font-size: 12px; color: var(--muted); margin-top: 5px; }

.toast {
  position: fixed; left: 50%; bottom: 92px; transform: translateX(-50%);
  background: rgba(90, 60, 110, .92); color: #fff; padding: 11px 20px; border-radius: 22px;
  font-size: 14px; z-index: 99; opacity: 0; transition: opacity .25s; pointer-events: none;
  max-width: 80%; text-align: center; box-shadow: 0 8px 20px rgba(150, 90, 180, .35);
}
.toast.show { opacity: 1; }

.empty { text-align: center; color: var(--muted); padding: 44px 20px; font-size: 14px; }
.loading { text-align: center; color: var(--muted); padding: 30px; }

/* 章节内容与知识点 */
.guide { border-left: 4px solid transparent; border-image: var(--primary-grad) 1; }
.guide .content { font-size: 14px; line-height: 1.85; color: var(--text); margin: 8px 0 16px; }
.kpi { background: #fdf8ff; border: 1.5px solid var(--line); border-radius: 14px; padding: 13px 15px; margin-bottom: 12px; }
.kpi .kpt { font-weight: 400; font-size: 15px; color: var(--primary-d); margin-bottom: 5px; }
.kpi .kpd { font-size: 13.5px; line-height: 1.8; color: var(--text); margin-bottom: 9px; }
.ex { background: #fff; border: 1.5px dashed #f0d6ea; border-radius: 12px; padding: 9px 12px; margin-top: 7px; }
.exq { font-size: 13px; line-height: 1.7; color: var(--text); }
.exa { font-size: 13px; line-height: 1.7; color: var(--ok); margin-top: 5px; }

@media (min-width: 600px) {
  .grid { grid-template-columns: repeat(3, 1fr); }
  .file-grid { grid-template-columns: repeat(5, 1fr); }
  .modal-mask { align-items: center; }
  .modal { border-radius: 26px; }
}

/* 教学视频 */
.vid-list { display: flex; flex-direction: column; gap: 10px; }
.vid-item {
  display: flex; align-items: center; gap: 12px; padding: 12px 14px;
  border: 1.5px solid var(--line); border-radius: 16px; text-decoration: none;
  color: var(--text); background: #fdf8ff; transition: background .15s, transform .12s;
}
.vid-item:active { background: var(--primary-grad-soft); transform: scale(.98); }
.vid-ico { font-size: 22px; }
.vid-t { font-size: 14px; font-weight: 600; line-height: 1.4; }
.vid-p { font-size: 11px; color: var(--muted); }
.vid-go { margin-left: auto; color: var(--primary-d); font-size: 19px; }

/* 小测验 */
.quiz-q { background: #fdf8ff; border: 1.5px solid var(--line); border-radius: 16px; padding: 14px 16px; margin-bottom: 14px; }
.quiz-qt { font-size: 15px; line-height: 1.7; margin-bottom: 12px; font-weight: 500; color: var(--text-strong); }
.quiz-qt b { color: var(--primary-d); }
.quiz-opts { display: flex; flex-direction: column; gap: 8px; }
.quiz-opt {
  display: flex; align-items: center; gap: 10px; padding: 10px 14px;
  border: 1.5px solid var(--line); border-radius: 13px; font-size: 14px; cursor: pointer; background: #fff;
}
.quiz-opt input { width: auto; margin: 0; accent-color: var(--primary); }
.quiz-opt.correct { border-color: var(--ok); background: #e7f8f0; }
.quiz-opt.wrong { border-color: var(--danger); background: #ffeef2; }
.quiz-opt:has(input:checked) { border-color: var(--primary); background: var(--primary-grad-soft); }
.quiz-fill { width: 100%; padding: 11px 15px; border: 1.5px solid var(--line); border-radius: 13px; font-size: 14px; }
.quiz-fill:focus { outline: none; border-color: var(--primary); }
.quiz-result { font-size: 14px; font-weight: 600; margin-top: 9px; padding: 9px 12px; border-radius: 11px; }
.quiz-result.ok { color: var(--ok); background: #e7f8f0; }
.quiz-result.no { color: var(--danger); background: #ffeef2; }
.quiz-explain { font-weight: 400; font-size: 13px; line-height: 1.7; color: var(--text); margin-top: 5px; }
.quiz-score { text-align: center; font-size: 24px; font-weight: 400; background: var(--primary-grad); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; margin: 14px 0 6px; }

/* 章节概述 + 小节卡片 */
.chap-overview { font-size: 14px; line-height: 1.85; color: var(--text); background: var(--primary-grad-soft); border-radius: 14px; padding: 12px 15px; margin-bottom: 14px; }
.sec-grid { display: grid; grid-template-columns: 1fr; gap: 11px; }
.section-card { background: #fff; border: 1.5px solid var(--line); border-radius: 16px; padding: 13px 15px; cursor: pointer; transition: transform .15s, box-shadow .15s, border-color .15s; }
.section-card:hover { transform: translateY(-2px); box-shadow: 0 8px 22px rgba(255,143,192,.16); border-color: var(--primary); }
.section-card:active { transform: scale(.985); }
.sc-head { display: flex; justify-content: space-between; align-items: center; }
.sc-name { font-family: var(--font-cute); font-size: 16px; color: var(--text-strong); }
.sc-go { color: var(--primary); font-size: 18px; }
.sc-sum { font-size: 13px; line-height: 1.7; color: var(--muted); margin: 7px 0 9px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.sc-foot { display: flex; justify-content: space-between; align-items: center; }
.sc-acts { display: flex; gap: 6px; }
.badge { font-size: 12px; color: var(--primary-d); background: var(--primary-grad-soft); border-radius: 20px; padding: 3px 11px; }
@media (min-width: 600px) { .sec-grid { grid-template-columns: 1fr 1fr; } }
