:root {
  --bg: #f5f7fb;
  --panel: #ffffff;
  --text: #172033;
  --muted: #718096;
  --line: #e7ecf3;
  --blue: #2563eb;
  --blue-dark: #1748b8;
  --blue-soft: #eaf1ff;
  --green: #0ea875;
  --orange: #f59e0b;
  --purple: #7c4dff;
  --shadow: 0 12px 30px rgba(36, 67, 120, 0.08);
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
  color: var(--text);
  background: var(--bg);
}
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }

.app-shell { min-height: 100vh; display: flex; }
.sidebar {
  width: 248px;
  padding: 28px 20px 22px;
  background: #fff;
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  position: fixed;
  inset: 0 auto 0 0;
}
.brand { display: flex; align-items: center; gap: 11px; margin-bottom: 36px; }
.brand-mark {
  width: 42px; height: 42px; border-radius: 13px; display: grid; place-items: center;
  color: #fff; font-size: 21px; font-weight: 800;
  background: linear-gradient(145deg, #3485ff, #1e52cf);
  box-shadow: 0 7px 18px rgba(37, 99, 235, .25);
}
.brand strong, .brand span, .user-card strong, .user-card span { display: block; }
.brand strong { font-size: 17px; letter-spacing: .04em; }
.brand span, .user-card span { color: var(--muted); font-size: 11px; margin-top: 3px; }
.nav-list { display: grid; gap: 7px; }
.nav-item {
  border: 0; background: transparent; color: #5e6b82; border-radius: 11px;
  padding: 12px 14px; text-align: left; display: flex; align-items: center; gap: 12px;
  transition: .18s ease;
}
.nav-item:hover { background: #f5f8ff; color: var(--blue); }
.nav-item.active { background: var(--blue-soft); color: var(--blue); font-weight: 700; }
.nav-icon { width: 22px; text-align: center; font-weight: 800; }
.sidebar-card {
  margin-top: auto; background: #f7f9fe; border: 1px solid var(--line); border-radius: 14px;
  padding: 15px; display: grid; gap: 8px;
}
.sidebar-card strong { font-size: 13px; }
.sidebar-card small { color: var(--muted); font-size: 11px; }
.progress { height: 6px; border-radius: 99px; background: #e4eaf5; overflow: hidden; }
.progress span { display: block; height: 100%; border-radius: inherit; background: var(--blue); }
.user-card { display: flex; gap: 10px; align-items: center; margin-top: 18px; padding: 8px 4px; }
.avatar { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: #e8f0ff; color: var(--blue); font-weight: 700; }

.main { margin-left: 248px; width: calc(100% - 248px); padding: 30px 38px 50px; }
.topbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 25px; }
.topbar h1 { margin: 4px 0 0; font-size: 25px; }
.eyebrow { margin: 0; color: #8b97aa; font-size: 11px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; }
.eyebrow.light { color: rgba(255,255,255,.7); }
.top-actions { display: flex; gap: 10px; align-items: center; }
.icon-button {
  width: 38px; height: 38px; border: 1px solid var(--line); border-radius: 10px;
  background: #fff; color: #64748b; position: relative;
}
.dot { position: absolute; width: 6px; height: 6px; background: #f43f5e; border: 1px solid #fff; border-radius: 50%; top: 8px; right: 9px; }
.primary-button, .secondary-button, .hero-button {
  border-radius: 10px; padding: 10px 16px; font-weight: 700; border: 0;
}
.primary-button { background: var(--blue); color: #fff; box-shadow: 0 5px 13px rgba(37,99,235,.18); }
.primary-button:hover { background: var(--blue-dark); }
.secondary-button { background: #fff; color: var(--blue); border: 1px solid #cfe0ff; }
.hero-button { margin-top: 13px; background: #fff; color: var(--blue); }
.page { display: none; }
.page.active { display: block; }

.hero-card {
  min-height: 190px; border-radius: 20px; color: #fff; overflow: hidden; position: relative;
  padding: 32px 38px; display: flex; justify-content: space-between;
  background: linear-gradient(120deg, #1e56d9, #3b82f6 70%, #61a6ff);
  box-shadow: 0 18px 35px rgba(37,99,235,.2);
}
.hero-card h2 { margin: 10px 0 8px; font-size: 27px; }
.hero-card p:not(.eyebrow) { margin: 0; color: rgba(255,255,255,.82); font-size: 14px; }
.hero-visual { width: 260px; position: relative; }
.book-shape {
  position: absolute; right: 55px; top: 23px; width: 112px; height: 130px;
  border-radius: 13px 20px 20px 13px; background: rgba(255,255,255,.92); color: var(--blue);
  display: grid; place-items: center; text-align: center; font-size: 22px; font-weight: 800;
  transform: rotate(6deg); box-shadow: 0 14px 25px rgba(0,0,0,.12);
}
.book-shape::before { content: ""; position: absolute; left: 10px; top: 0; bottom: 0; width: 2px; background: #d6e5ff; }
.orbit { position: absolute; border: 1px solid rgba(255,255,255,.22); border-radius: 50%; }
.orbit-one { width: 220px; height: 220px; right: 0; top: -30px; }
.orbit-two { width: 155px; height: 155px; right: 32px; top: 2px; }

.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 15px; margin: 20px 0; }
.stat-card, .panel {
  background: var(--panel); border: 1px solid var(--line); border-radius: 15px; box-shadow: var(--shadow);
}
.stat-card { padding: 17px; display: flex; align-items: center; gap: 13px; }
.stat-icon {
  width: 42px; height: 42px; flex: 0 0 42px; border-radius: 12px; display: grid; place-items: center; font-weight: 800;
}
.stat-icon.blue { color: var(--blue); background: var(--blue-soft); }
.stat-icon.orange { color: var(--orange); background: #fff6df; }
.stat-icon.green { color: var(--green); background: #e7f8f2; }
.stat-icon.purple { color: var(--purple); background: #f0ebff; }
.stat-card span, .stat-card strong, .stat-card small { display: block; }
.stat-card span { color: var(--muted); font-size: 12px; }
.stat-card strong { font-size: 23px; margin: 2px 0; }
.stat-card small { color: #a0aabd; font-size: 10px; }

.content-grid { display: grid; grid-template-columns: 1.35fr 1fr; gap: 20px; }
.panel { padding: 20px; }
.panel-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 18px; }
.panel h3 { font-size: 17px; margin: 5px 0 0; }
.text-button { border: 0; background: transparent; color: var(--blue); font-size: 12px; }
.soft-tag { color: #8290a6; background: #f5f7fb; padding: 5px 8px; border-radius: 7px; font-size: 11px; }
.task-list { display: grid; gap: 9px; }
.task-item { display: grid; grid-template-columns: 37px 1fr auto; align-items: center; gap: 11px; padding: 9px 0; border-bottom: 1px solid #f0f3f8; }
.task-item:last-child { border-bottom: 0; }
.subject-badge { width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center; background: #edf3ff; color: var(--blue); font-size: 11px; font-weight: 700; }
.task-item strong, .task-item span { display: block; }
.task-item strong { font-size: 13px; }
.task-item span { color: var(--muted); font-size: 11px; margin-top: 3px; }
.status { font-size: 11px; border-radius: 99px; padding: 4px 7px; }
.status.due { color: #d97706; background: #fff7e7; }
.status.done { color: var(--green); background: #e8f8f2; }
.subject-chart { display: grid; gap: 13px; }
.chart-row { display: grid; grid-template-columns: 34px 1fr 25px; align-items: center; gap: 9px; color: #69778d; font-size: 12px; }
.bar { height: 7px; background: #eef2f7; border-radius: 99px; overflow: hidden; }
.bar span { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #4b8dff, #7cb4ff); }
.recent-panel { margin-top: 20px; }
.mistake-row { display: grid; grid-template-columns: 70px 1.5fr 1fr 1fr 80px; gap: 12px; align-items: center; padding: 12px 8px; border-top: 1px solid #f0f3f7; font-size: 12px; }
.mistake-row.header { color: #9aa5b6; border-top: 0; padding-top: 0; }
.mistake-row strong { font-size: 12px; }
.mastery { color: var(--green); }
.learning { color: #d97706; }

.section-tools { display: flex; justify-content: space-between; align-items: center; margin-bottom: 18px; }
.filter-row { display: flex; gap: 7px; flex-wrap: wrap; }
.filter { border: 1px solid var(--line); background: #fff; color: #718096; border-radius: 9px; padding: 7px 13px; }
.filter.active { color: var(--blue); border-color: #bfd5ff; background: var(--blue-soft); }
.mistake-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.mistake-card { background: #fff; border: 1px solid var(--line); border-radius: 15px; padding: 17px; box-shadow: var(--shadow); }
.mistake-card-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.mistake-card h3 { font-size: 14px; line-height: 1.65; margin: 0 0 12px; min-height: 46px; }
.mistake-meta { display: flex; gap: 6px; flex-wrap: wrap; }
.meta-tag { font-size: 10px; color: #758297; background: #f5f7fa; padding: 4px 6px; border-radius: 6px; }
.review-date { display: block; color: #9aa5b6; margin-top: 14px; font-size: 11px; }
.empty-state { grid-column: 1 / -1; padding: 50px; text-align: center; color: var(--muted); background: #fff; border: 1px dashed #ccd6e5; border-radius: 15px; }

.review-layout { display: grid; grid-template-columns: 1.4fr .65fr; gap: 20px; }
.review-card { min-height: 430px; }
.review-question { font-size: 19px; line-height: 1.8; margin: 25px 0; }
.answer-box { background: #f7f9fd; border: 1px solid var(--line); border-radius: 12px; padding: 15px; margin: 15px 0; }
.answer-box p { color: #65748a; line-height: 1.7; font-size: 13px; }
.review-actions { display: flex; gap: 10px; margin-top: 25px; }
.review-actions button { flex: 1; }
.review-ring {
  --percent: 0deg; width: 130px; height: 130px; margin: 30px auto 15px; border-radius: 50%;
  background: conic-gradient(var(--blue) var(--percent), #edf1f7 0);
  display: grid; place-items: center; position: relative;
}
.review-ring::before { content: ""; position: absolute; width: 96px; height: 96px; border-radius: 50%; background: #fff; }
.review-ring span { position: relative; font-size: 23px; font-weight: 800; color: var(--blue); }
.muted { color: var(--muted); font-size: 12px; text-align: center; }
.tip-box { margin-top: 28px; border-radius: 12px; padding: 13px; background: #f5f8ff; color: #63718a; font-size: 12px; line-height: 1.65; }
.tip-box strong { color: var(--blue); }

.module-placeholder {
  min-height: 410px; border-radius: 21px; padding: 50px; color: #fff; display: flex; align-items: center; justify-content: space-between;
  overflow: hidden;
}
.module-placeholder h2 { font-size: 29px; margin: 12px 0; }
.module-placeholder p:not(.eyebrow) { max-width: 520px; color: rgba(255,255,255,.78); line-height: 1.8; }
.word-module { background: linear-gradient(120deg, #5536c9, #896bff); }
.classic-module { background: linear-gradient(120deg, #087e82, #27a9a1); }
.flash-card, .classic-card {
  width: 245px; height: 160px; border-radius: 17px; background: rgba(255,255,255,.95); color: #302873;
  display: flex; flex-direction: column; justify-content: center; padding: 25px; transform: rotate(4deg); box-shadow: 0 18px 28px rgba(0,0,0,.15);
}
.classic-card { color: #176f70; transform: rotate(-3deg); }
.flash-card strong, .classic-card strong { font-size: 24px; margin: 10px 0; }
.flash-card span, .classic-card span { font-size: 12px; line-height: 1.6; }

dialog { border: 0; padding: 0; border-radius: 18px; box-shadow: 0 25px 70px rgba(28,46,80,.25); width: min(610px, calc(100% - 32px)); }
dialog::backdrop { background: rgba(16,27,48,.38); backdrop-filter: blur(2px); }
.dialog-card { padding: 24px; }
.dialog-head { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 16px; }
.dialog-head h2 { margin: 5px 0 0; font-size: 21px; }
.close-button { border: 0; background: #f3f5f8; width: 30px; height: 30px; border-radius: 8px; color: #7b8799; font-size: 20px; }
.upload-zone {
  height: 165px; border: 1px dashed #b8cae8; border-radius: 13px; background: #f8faff; display: grid; place-items: center;
  margin-bottom: 15px; overflow: hidden; cursor: pointer; text-align: center;
}
.upload-zone input { display: none; }
.upload-zone img { width: 100%; height: 100%; object-fit: contain; }
#upload-prompt { display: grid; gap: 6px; color: #62728a; }
#upload-prompt small { color: #9aa7ba; font-size: 11px; }
.camera-icon { font-size: 25px; color: var(--blue); }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.dialog-card label { display: grid; gap: 6px; color: #5e6c82; font-size: 12px; margin-bottom: 12px; }
.dialog-card input, .dialog-card select, .dialog-card textarea {
  width: 100%; border: 1px solid #dfe6f0; border-radius: 9px; padding: 9px 10px; color: var(--text); background: #fff; outline: none;
}
.dialog-card input:focus, .dialog-card select:focus, .dialog-card textarea:focus { border-color: #91b5ff; box-shadow: 0 0 0 3px #edf3ff; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 9px; margin-top: 17px; }
.auth-note { color: var(--muted); background: #f6f8fc; border-radius: 10px; padding: 11px 12px; font-size: 12px; line-height: 1.7; margin: 0 0 15px; }
.auth-actions button { min-width: 120px; }
.toast {
  position: fixed; left: 50%; bottom: 28px; transform: translate(-50%, 20px); background: #172033; color: #fff;
  border-radius: 10px; padding: 10px 15px; font-size: 12px; opacity: 0; pointer-events: none; transition: .2s;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 980px) {
  .sidebar { width: 78px; padding: 24px 12px; }
  .brand > div:not(.brand-mark), .nav-item:not(.active) .nav-icon + *, .sidebar-card, .user-card > div:not(.avatar) { display: none; }
  .brand { justify-content: center; }
  .nav-item { justify-content: center; padding: 12px; font-size: 0; }
  .nav-icon { font-size: 14px; }
  .main { margin-left: 78px; width: calc(100% - 78px); padding: 24px; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .mistake-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 720px) {
  .sidebar { position: fixed; z-index: 10; top: auto; width: 100%; height: 64px; padding: 7px 12px; border-top: 1px solid var(--line); border-right: 0; }
  .brand, .sidebar-card, .user-card { display: none; }
  .nav-list { grid-template-columns: repeat(5, 1fr); gap: 2px; }
  .nav-item, .nav-item:not(.active) { font-size: 0; display: grid; place-items: center; padding: 9px; }
  .nav-icon { font-size: 15px; }
  .main { margin-left: 0; width: 100%; padding: 18px 14px 85px; }
  .topbar { align-items: flex-start; }
  .topbar h1 { font-size: 21px; }
  .icon-button { display: none; }
  .primary-button { padding: 9px 12px; }
  .hero-card { padding: 25px; min-height: 190px; }
  .hero-card h2 { font-size: 22px; max-width: 230px; }
  .hero-visual { display: none; }
  .stats-grid, .content-grid, .mistake-grid, .review-layout { grid-template-columns: 1fr; }
  .stat-card { padding: 14px; }
  .mistake-row { grid-template-columns: 55px 1fr 80px; }
  .mistake-row > *:nth-child(3), .mistake-row > *:nth-child(4) { display: none; }
  .module-placeholder { padding: 30px; min-height: 420px; display: block; }
  .flash-card, .classic-card { margin: 40px auto 0; }
  .form-grid { grid-template-columns: 1fr; gap: 0; }
}
