:root {
  --bg: #f6f7fb;
  --card: #ffffff;
  --text: #172033;
  --muted: #6b7280;
  --primary: #3b82f6;
  --primary-dark: #1d4ed8;
  --green: #16a34a;
  --orange: #f97316;
  --red: #ef4444;
  --purple: #8b5cf6;
  --border: #e5e7eb;
  --shadow: 0 10px 30px rgba(15, 23, 42, 0.08);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
}

button, input, textarea { font: inherit; }

.app-shell {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  background: linear-gradient(180deg, #eaf3ff 0%, #f6f7fb 220px);
  padding-bottom: 86px;
}

.header {
  padding: 20px 16px 14px;
}

.topline {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  color: var(--muted);
  font-size: 13px;
}

.brand {
  font-weight: 800;
  color: var(--primary-dark);
  letter-spacing: 0.5px;
}

h1 {
  margin: 12px 0 6px;
  font-size: 24px;
  line-height: 1.25;
}

.subtitle {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
}

.progress-card {
  margin: 16px;
  padding: 16px;
  border-radius: 22px;
  background: var(--card);
  box-shadow: var(--shadow);
}

.progress-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.progress-number {
  font-size: 28px;
  font-weight: 900;
  color: var(--primary-dark);
}

.progress-bar {
  height: 10px;
  background: #e8eef8;
  border-radius: 999px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, #60a5fa, #2563eb);
  border-radius: inherit;
  transition: width .25s ease;
}

.quick-filters {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 0 16px 8px;
  scrollbar-width: none;
}

.quick-filters::-webkit-scrollbar { display: none; }

.filter-btn {
  white-space: nowrap;
  border: 1px solid var(--border);
  background: #fff;
  border-radius: 999px;
  padding: 9px 12px;
  color: #374151;
}

.filter-btn.active {
  color: #fff;
  border-color: var(--primary);
  background: var(--primary);
}

.section-title {
  margin: 16px 16px 10px;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}

.section-title h2 {
  margin: 0;
  font-size: 18px;
}

.section-title small { color: var(--muted); }

.task-list {
  display: grid;
  gap: 10px;
  padding: 0 16px;
}

.task-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 14px;
  box-shadow: 0 4px 14px rgba(15,23,42,.04);
}

.task-card.done { opacity: .72; }

.task-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
}

.task-main {
  min-width: 0;
}

.task-kicker {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  margin-bottom: 7px;
  color: var(--muted);
  font-size: 12px;
}

.category-pill {
  border-radius: 999px;
  padding: 3px 7px;
  color: #1d4ed8;
  background: #eff6ff;
  font-weight: 800;
}

.task-title {
  margin: 0;
  font-size: 16px;
  line-height: 1.35;
}

.badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 8px 0 9px;
}

.badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 4px 8px;
  font-size: 12px;
  background: #eef2ff;
  color: #3730a3;
}

.badge.submit { background: #fff1f2; color: #be123c; }
.badge.daily { background: #ecfdf5; color: #047857; }
.badge.time { background: #fff7ed; color: #c2410c; }
.badge.material { background: #eff6ff; color: #1d4ed8; }

.task-route {
  display: grid;
  gap: 8px;
  margin: 12px 0 10px;
  padding: 10px;
  border-radius: 12px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
}

.route-row {
  display: grid;
  grid-template-columns: 42px 1fr;
  gap: 8px;
  align-items: start;
  color: #334155;
  font-size: 14px;
  line-height: 1.45;
}

.route-label,
.modal-label {
  color: #64748b;
  font-size: 12px;
  font-weight: 800;
}

.material-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.material-chip {
  display: inline-flex;
  max-width: 100%;
  align-items: center;
  border-radius: 8px;
  padding: 4px 7px;
  color: #075985;
  background: #e0f2fe;
  font-size: 13px;
  line-height: 1.35;
  word-break: break-word;
}

.submit-text {
  font-weight: 800;
}

.submit-text.required {
  color: #be123c;
}

.submit-text.optional {
  color: #c2410c;
}

.submit-text.none {
  color: #047857;
}

.task-desc {
  color: #4b5563;
  font-size: 14px;
  line-height: 1.55;
  margin: 0 0 10px;
}

.task-actions {
  display: flex;
  gap: 8px;
}

.primary-btn, .ghost-btn, .complete-btn {
  border: none;
  border-radius: 12px;
  padding: 10px 11px;
  cursor: pointer;
}

.primary-btn { background: var(--primary); color: #fff; }
.ghost-btn { background: #f3f4f6; color: #374151; }
.complete-btn { background: #ecfdf5; color: #047857; margin-left: auto; }
.task-card.done .complete-btn { background: #dcfce7; color: #166534; }

.checkbox {
  flex: 0 0 auto;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2px solid #cbd5e1;
  display: grid;
  place-items: center;
  color: #fff;
  background: #fff;
  padding: 0;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
  font-size: 15px;
  transition: transform .1s;
}

.checkbox:active { transform: scale(.88); }

.task-card.done .checkbox {
  background: var(--green);
  border-color: var(--green);
}

.panel {
  margin: 16px;
  padding: 16px;
  border-radius: 20px;
  background: var(--card);
  border: 1px solid var(--border);
}

.panel h2 { margin: 0 0 10px; font-size: 18px; }
.panel p { margin: 0; color: #4b5563; line-height: 1.65; }
.panel ul { margin: 8px 0 0; padding-left: 20px; color: #4b5563; line-height: 1.7; }
.index-note { background: #f8fafc; }

.bottom-nav {
  position: fixed;
  left: 50%;
  bottom: 0;
  transform: translateX(-50%);
  width: min(480px, 100%);
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
  background: rgba(255,255,255,.92);
  backdrop-filter: blur(16px);
  border-top: 1px solid var(--border);
}

.nav-btn {
  border: none;
  background: transparent;
  color: var(--muted);
  border-radius: 14px;
  padding: 9px 4px;
}

.nav-btn.active {
  color: var(--primary-dark);
  background: #eff6ff;
  font-weight: 800;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15,23,42,.42);
  display: none;
  align-items: flex-end;
  justify-content: center;
  z-index: 20;
}

.modal-backdrop.show { display: flex; }

.modal {
  width: min(480px, 100%);
  max-height: 82vh;
  overflow-y: auto;
  background: #fff;
  border-radius: 24px 24px 0 0;
  padding: 18px 16px 24px;
}

.modal h2 { margin: 0 0 8px; }
.modal h3 { margin: 18px 0 8px; font-size: 15px; }
.modal p, .modal li { color: #4b5563; line-height: 1.65; }

.modal-summary {
  display: grid;
  gap: 10px;
  margin: 12px 0;
  padding: 12px;
  border-radius: 14px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
}

.modal-summary > div {
  display: grid;
  gap: 5px;
}

.close-btn {
  width: 100%;
  margin-top: 14px;
  border: none;
  border-radius: 14px;
  padding: 12px;
  color: #fff;
  background: var(--primary);
}

.empty {
  margin: 20px 16px;
  padding: 24px;
  border-radius: 18px;
  text-align: center;
  color: var(--muted);
  background: #fff;
}

/* ===== 今日日期胶囊 ===== */
.date-chip {
  display: inline-block;
  background: #e0f2fe;
  color: #075985;
  font-weight: 800;
  border-radius: 999px;
  padding: 2px 10px;
  margin-right: 4px;
}

/* ===== 主行动按钮（开始陪学） ===== */
.cta {
  width: 100%;
  margin-top: 14px;
  border: none;
  border-radius: 16px;
  padding: 15px;
  font-size: 17px;
  font-weight: 800;
  color: #fff;
  background: linear-gradient(90deg, #3b82f6, #1d4ed8);
  box-shadow: 0 8px 20px rgba(37, 99, 235, .28);
  cursor: pointer;
  transition: transform .1s;
}
.cta:active { transform: scale(.98); }
.cta-done {
  background: linear-gradient(90deg, #34d399, #059669);
  box-shadow: 0 8px 20px rgba(5, 150, 105, .25);
}

/* ===== 陪学专注模式 ===== */
.focus {
  position: fixed;
  top: 0;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: min(480px, 100%);
  background: linear-gradient(180deg, #eaf3ff 0%, #f6f7fb 240px);
  display: flex;
  flex-direction: column;
  z-index: 30;
}

.focus-top {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: calc(14px + env(safe-area-inset-top)) 16px 10px;
}
.focus-exit {
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, .85);
  color: #475569;
  font-size: 16px;
  cursor: pointer;
}
.focus-dots {
  flex: 1;
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  align-items: center;
}
.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #cbd5e1;
  transition: all .2s;
}
.dot.ok { background: var(--green); }
.dot.now { width: 22px; border-radius: 999px; background: var(--primary); }
.focus-count {
  flex: 0 0 auto;
  color: #475569;
  font-weight: 800;
  font-size: 14px;
}

.focus-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 4px 18px 16px;
}
.focus-kicker {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  align-items: center;
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 8px;
}
.focus-title {
  margin: 0 0 16px;
  font-size: 23px;
  line-height: 1.3;
}
.focus-material {
  display: grid;
  gap: 8px;
  padding: 14px;
  border-radius: 16px;
  background: #fff;
  box-shadow: var(--shadow);
  margin-bottom: 14px;
}

.focus-block {
  border-radius: 16px;
  padding: 14px 16px;
  margin-bottom: 12px;
}
.focus-block h3 { margin: 0 0 10px; font-size: 15px; }
.focus-block ul { margin: 0; padding-left: 22px; }
.focus-block.child {
  background: #fffbeb;
  border: 1px solid #fde68a;
}
.focus-block.child li {
  font-size: 17px;
  line-height: 1.7;
  font-weight: 600;
  color: #1f2937;
}
.focus-block.parent {
  background: #fff;
  border: 1px solid var(--border);
}
.focus-block.parent li {
  font-size: 14.5px;
  line-height: 1.65;
  color: #4b5563;
}

.focus-tip {
  background: #eef2ff;
  color: #3730a3;
  border-radius: 14px;
  padding: 12px 14px;
  font-size: 14px;
  line-height: 1.6;
  margin-bottom: 12px;
}

.focus-submit {
  border-radius: 14px;
  padding: 13px 15px;
  font-size: 15px;
  font-weight: 800;
}
.focus-submit.need { background: #fff1f2; color: #be123c; }
.focus-submit.opt { background: #fff7ed; color: #c2410c; }
.focus-submit.no { background: #ecfdf5; color: #047857; }

.focus-actions {
  display: flex;
  gap: 10px;
  padding: 12px 16px calc(14px + env(safe-area-inset-bottom));
  background: rgba(255, 255, 255, .92);
  backdrop-filter: blur(16px);
  border-top: 1px solid var(--border);
}
.focus-prev,
.focus-skip {
  flex: 0 0 auto;
  border: 1px solid var(--border);
  background: #fff;
  color: #475569;
  border-radius: 14px;
  padding: 14px 16px;
  font-weight: 700;
  cursor: pointer;
}
.focus-done {
  flex: 1;
  border: none;
  border-radius: 14px;
  padding: 14px;
  font-size: 17px;
  font-weight: 800;
  color: #fff;
  background: linear-gradient(90deg, #34d399, #059669);
  box-shadow: 0 8px 20px rgba(5, 150, 105, .25);
  cursor: pointer;
  transition: transform .1s;
}
.focus-done:active { transform: scale(.98); }

/* 庆祝页 */
.celebrate {
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 24px;
}
.celebrate h2 { margin: 8px 0; font-size: 24px; }
.celebrate p { color: var(--muted); line-height: 1.7; }
.cele-emoji { font-size: 72px; animation: pop .5s ease; }
.celebrate .focus-actions {
  margin-top: 24px;
  width: 100%;
  max-width: 320px;
  background: none;
  border: none;
  backdrop-filter: none;
}

/* 完成鼓励浮层 */
.praise-toast {
  position: fixed;
  top: 38%;
  left: 50%;
  transform: translate(-50%, -50%) scale(.6);
  background: rgba(15, 23, 42, .9);
  color: #fff;
  font-size: 22px;
  font-weight: 800;
  padding: 16px 28px;
  border-radius: 999px;
  z-index: 50;
  opacity: 0;
  transition: transform .3s cubic-bezier(.34, 1.56, .64, 1), opacity .3s;
  pointer-events: none;
}
.praise-toast.show {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}

@keyframes pop {
  0% { transform: scale(0); }
  70% { transform: scale(1.15); }
  100% { transform: scale(1); }
}

/* ===== 素材 chip 可点（有链接打开 / 无链接提示去哪找） ===== */
button.material-chip,
a.material-chip {
  border: none;
  cursor: pointer;
  font-family: inherit;
  text-decoration: none;
  transition: transform .1s;
}
.material-chip.link { background: #dbeafe; color: #1d4ed8; font-weight: 700; }
.material-chip.hint { background: #e0f2fe; color: #075985; }
.material-chip:active { transform: scale(.96); }

/* ===== 今日分组标题 ===== */
.group-title { align-items: flex-start; }
.group-hint {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-weight: 500;
  font-size: 12px;
}
.group-count { color: var(--muted); font-weight: 700; }

/* ===== 资料页清单 ===== */
.res-list { list-style: none; padding-left: 0; }
.res-list li {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px dashed #e5e7eb;
}
.res-list li:last-child { border-bottom: none; }
.res-name { font-weight: 600; color: #334155; }
.res-where { color: var(--muted); font-size: 12.5px; text-align: right; }
.res-go { color: var(--primary-dark); font-weight: 700; text-decoration: none; white-space: nowrap; }

/* ===== 信息提示 toast（素材去哪找） ===== */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(92px + env(safe-area-inset-bottom));
  transform: translateX(-50%) translateY(10px);
  max-width: calc(100% - 40px);
  width: max-content;
  background: rgba(15, 23, 42, .92);
  color: #fff;
  font-size: 14px;
  line-height: 1.5;
  padding: 12px 18px;
  border-radius: 14px;
  z-index: 60;
  opacity: 0;
  transition: opacity .25s, transform .25s;
  pointer-events: none;
  text-align: center;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ===== 周计划表 ===== */
.plan-list { padding: 0 16px; display: grid; gap: 10px; }
.plan-day {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 12px 14px;
}
.plan-day.today {
  border: 2px solid var(--primary);
  background: #f5f9ff;
  box-shadow: 0 6px 18px rgba(37, 99, 235, .12);
}
.plan-day-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}
.plan-date { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.plan-week { font-size: 16px; font-weight: 800; }
.plan-day.today .plan-week { color: var(--primary-dark); }
.plan-md { font-size: 13px; color: var(--muted); }
.today-badge {
  background: var(--primary);
  color: #fff;
  font-size: 11px;
  font-weight: 800;
  padding: 2px 9px;
  border-radius: 999px;
}
.plan-meta { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.plan-count { font-size: 12px; color: var(--muted); white-space: nowrap; }
.plan-go {
  border: none;
  background: #eff6ff;
  color: var(--primary-dark);
  font-weight: 800;
  font-size: 12px;
  border-radius: 999px;
  padding: 6px 11px;
  cursor: pointer;
  white-space: nowrap;
}
.plan-pills { display: flex; flex-wrap: wrap; gap: 6px; }
.plan-pill {
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 5px 10px;
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: transform .1s;
}
.plan-pill:active { transform: scale(.95); }
.plan-pill.required { background: #fff1f2; color: #be123c; border-color: #fecdd3; }
.plan-pill.optional { background: #fff7ed; color: #c2410c; border-color: #fed7aa; }
.plan-pill.none { background: #f1f5f9; color: #475569; border-color: #e2e8f0; }
.pill-mark {
  font-size: 10px;
  font-weight: 800;
  padding: 1px 5px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .7);
}
.plan-weekly h2 { display: flex; align-items: center; gap: 6px; }
.plan-weekly-hint { margin-top: 10px !important; font-size: 13px; }
.dot-legend {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  margin: 0 3px;
  vertical-align: middle;
}
.dot-legend.required { background: #f43f5e; }
.dot-legend.optional { background: #fb923c; }

/* 周计划 pill 完成态 */
.plan-pill.done { opacity: .55; }
.plan-pill.done .pill-mark { display: none; }
.pill-check { color: #16a34a; font-weight: 900; margin-right: 2px; }

/* ===== 班级切换 & 选班页 ===== */
.class-switch {
  border: none;
  background: #eff6ff;
  color: var(--primary-dark);
  font-weight: 700;
  font-size: 12px;
  border-radius: 999px;
  padding: 4px 10px;
  cursor: pointer;
  max-width: 55%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.picker-search { padding: 0 16px 10px; }
.picker-search input {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 14px;
  font-size: 15px;
  background: #fff;
}
.picker-list { display: grid; gap: 8px; padding: 0 16px 40px; }
.picker-item {
  text-align: left;
  border: 1px solid var(--border);
  background: #fff;
  border-radius: 14px;
  padding: 15px 16px;
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
  transition: transform .1s;
}
.picker-item:active { transform: scale(.99); }
