/* 周任务板 - 样式 */
* { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  --primary: #2563eb; --primary-dark: #1d4ed8; --green: #10b981; --green-dark: #059669;
  --bg: #f5f7fb; --card: #ffffff; --border: #e5e7eb; --text: #1f2937; --muted: #6b7280;
  --danger: #dc2626; --radius: 12px; --shadow: 0 1px 3px rgba(0,0,0,.08), 0 4px 12px rgba(0,0,0,.05);
}
html, body { height: 100%; }
body {
  font-family: "Microsoft YaHei", "PingFang SC", "Helvetica Neue", Arial, sans-serif;
  background: var(--bg); color: var(--text); font-size: 14px;
}
.hidden { display: none !important; }
button { font-family: inherit; cursor: pointer; }

.btn-primary { background: var(--primary); color: #fff; border: none; border-radius: 8px; padding: 10px 18px; font-size: 14px; font-weight: 600; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-primary:disabled { background: #c7d2fe; cursor: not-allowed; }
.btn-secondary { background: #eef2ff; color: var(--primary); border: 1px solid #c7d2fe; border-radius: 8px; padding: 8px 16px; }
.btn-secondary:hover { background: #e0e7ff; }
.btn-ghost { background: transparent; border: 1px solid var(--border); border-radius: 8px; padding: 6px 12px; color: var(--text); }
.btn-ghost:hover { background: #f3f4f6; }
.btn-danger { background: #fef2f2; color: var(--danger); border: 1px solid #fecaca; border-radius: 8px; padding: 8px 16px; }
.btn-danger:hover { background: #fee2e2; }
.icon-btn { background: #fff; border: 1px solid var(--border); border-radius: 8px; width: 30px; height: 30px; font-size: 18px; line-height: 1; color: var(--muted); }
.icon-btn:hover { color: var(--primary); border-color: var(--primary); }
.hint { color: var(--muted); font-size: 12px; margin-top: 6px; }

/* ---------- 模式切换（任务板 / 背单词） ---------- */
.mode-bar { display: flex; gap: 8px; padding: 12px 20px 0; max-width: 1200px; margin: 0 auto; }
.mode-tab { padding: 8px 20px; border: 1px solid var(--border); background: #fff; border-radius: 999px; font-size: 14px; font-weight: 600; color: var(--muted); }
.mode-tab.active { background: var(--primary); border-color: var(--primary); color: #fff; }
.mode-tab:hover { border-color: var(--primary); color: var(--primary); }
.mode-tab.active:hover { color: #fff; }
#view-vocab { padding: 12px 20px 20px; }
.vocab-frame { width: 100%; height: calc(100vh - 170px); min-height: 520px; border: 1px solid var(--border); border-radius: var(--radius); background: #fff; }

/* ---------- 登录 ---------- */
.auth-view { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: linear-gradient(160deg, #eff6ff, #ecfdf5 60%, #f5f7fb); padding: 20px; }
.auth-card { background: var(--card); border-radius: 18px; box-shadow: var(--shadow); padding: 32px 34px; width: 100%; max-width: 380px; }
.auth-logo { text-align: center; margin-bottom: 22px; }
.auth-logo h1 { font-size: 24px; margin-top: 8px; }
.auth-logo p { color: var(--muted); font-size: 13px; margin-top: 4px; }
.auth-tabs { display: flex; background: #f3f4f6; border-radius: 10px; overflow: hidden; margin-bottom: 18px; }
.auth-tab { flex: 1; padding: 9px 0; border: none; background: transparent; font-weight: 600; color: var(--muted); }
.auth-tab.active { background: var(--card); color: var(--primary); box-shadow: var(--shadow); border-radius: 8px; }
.auth-form label { display: block; font-size: 13px; color: var(--muted); margin: 12px 0 6px; }
.auth-form input, .modal-card input, .modal-card select, .modal-card textarea, #answer-text {
  width: 100%; padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px; font-size: 14px; font-family: inherit; background: #fff;
}
.auth-form input:focus, .modal-card input:focus, .modal-card select:focus, .modal-card textarea:focus, #answer-text:focus { outline: none; border-color: var(--primary); }
.auth-form .btn-primary { width: 100%; margin-top: 16px; }
.auth-tip { color: var(--danger); font-size: 13px; min-height: 18px; margin-top: 8px; }
.auth-note { color: var(--muted); font-size: 12px; margin-top: 16px; line-height: 1.6; }

/* ---------- 使用说明 ---------- */
.modal-mask { position: fixed; inset: 0; background: rgba(17,24,39,.45); display: flex; align-items: center; justify-content: center; z-index: 100; }
.guide-card { background: var(--card); border-radius: 16px; width: 92%; max-width: 520px; max-height: 88vh; display: flex; flex-direction: column; padding: 20px 24px; box-shadow: var(--shadow); }
.guide-card h2 { text-align: center; margin-bottom: 12px; }
.guide-body { overflow-y: auto; flex: 1; padding-right: 6px; }
.guide-item { display: flex; gap: 12px; margin-bottom: 16px; }
.guide-num { flex-shrink: 0; width: 26px; height: 26px; border-radius: 50%; background: #eef2ff; color: var(--primary); font-weight: 700; display: flex; align-items: center; justify-content: center; font-size: 13px; }
.guide-item b { font-size: 14px; }
.guide-item p { color: var(--muted); font-size: 13px; margin-top: 3px; line-height: 1.6; }
.guide-confirm { margin-top: 14px; }
.guide-hint { text-align: center; color: var(--muted); font-size: 12px; margin-top: 8px; }

/* ---------- 顶栏 ---------- */
.topbar { display: flex; align-items: center; gap: 16px; padding: 12px 22px; background: var(--card); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 50; }
.brand { display: flex; align-items: center; gap: 8px; }
.brand-name { font-size: 17px; font-weight: 700; }
.guest-badge { background: #fef3c7; color: #b45309; font-size: 12px; padding: 2px 8px; border-radius: 10px; font-weight: 600; }
.week-nav { display: flex; align-items: center; gap: 8px; margin: 0 auto; }
.week-label { font-weight: 600; display: flex; flex-direction: column; align-items: center; min-width: 130px; }
.week-now { color: var(--primary); font-size: 11px; background: #eef2ff; padding: 1px 8px; border-radius: 8px; margin-top: 2px; }
.account-menu { position: relative; }
.account-btn { display: flex; align-items: center; gap: 8px; background: transparent; border: none; padding: 6px 10px; border-radius: 8px; }
.account-btn:hover { background: #f3f4f6; }
.avatar { width: 30px; height: 30px; border-radius: 50%; background: var(--primary); color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 700; }
.avatar.guest { background: #d97706; }
.account-name { font-weight: 600; max-width: 100px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dropdown { position: absolute; right: 0; top: 44px; background: var(--card); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow); min-width: 200px; z-index: 60; padding: 6px; }
.dropdown-user { padding: 8px 10px; color: var(--muted); font-size: 12px; border-bottom: 1px solid var(--border); margin-bottom: 4px; }
.dropdown button { display: block; width: 100%; text-align: left; padding: 9px 10px; border: none; background: transparent; border-radius: 8px; font-size: 14px; }
.dropdown button:hover { background: #f3f4f6; }

/* ---------- 统计 ---------- */
.main { max-width: 1280px; margin: 0 auto; padding: 18px 22px 40px; }
.stats { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.stat-card { background: var(--card); border-radius: var(--radius); padding: 12px 18px; box-shadow: var(--shadow); min-width: 110px; }
.stat-card.done .stat-num { color: var(--green-dark); }
.stat-card.todo .stat-num { color: var(--primary); }
.stat-num { font-size: 26px; font-weight: 700; }
.stat-label { color: var(--muted); font-size: 12px; }
.stat-progress { flex: 1; min-width: 220px; background: var(--card); border-radius: var(--radius); padding: 14px 18px; box-shadow: var(--shadow); display: flex; align-items: center; gap: 12px; }
.progress-track { flex: 1; height: 12px; background: #e5e7eb; border-radius: 8px; overflow: hidden; }
.progress-bar { height: 100%; width: 0; background: linear-gradient(90deg, var(--primary), var(--green)); border-radius: 8px; transition: width .3s; }
.progress-text { font-weight: 700; font-size: 13px; color: var(--muted); }

/* ---------- 页签 ---------- */
.tabs { display: flex; gap: 8px; margin-bottom: 14px; }
.tab { border: none; background: transparent; padding: 8px 16px; font-size: 14px; font-weight: 600; color: var(--muted); border-radius: 8px; }
.tab.active { background: var(--card); color: var(--primary); box-shadow: var(--shadow); }

/* ---------- 周任务板 ---------- */
.week-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 10px; }
.day-col { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 12px; min-height: 220px; display: flex; flex-direction: column; }
.day-head { text-align: center; margin-bottom: 10px; padding-bottom: 8px; border-bottom: 2px solid var(--border); }
.day-head.today { border-color: var(--primary); background: linear-gradient(180deg, #eff6ff, transparent); border-radius: 8px 8px 0 0; }
.day-name { font-weight: 700; font-size: 14px; }
.day-date { color: var(--muted); font-size: 12px; }
.day-count { font-size: 11px; color: var(--muted); margin-top: 2px; }
.task-list { flex: 1; display: flex; flex-direction: column; gap: 8px; }
.task-card { border: 1px solid var(--border); border-left: 4px solid var(--primary); border-radius: 8px; padding: 8px 10px; display: flex; align-items: flex-start; gap: 8px; background: #fff; transition: background .15s; }
.task-card.done { background: #f9fafb; }
.task-card.done .task-title { text-decoration: line-through; color: var(--muted); }
.task-check { width: 18px; height: 18px; flex-shrink: 0; margin-top: 1px; accent-color: var(--green); cursor: pointer; }
.task-title { flex: 1; font-size: 13px; line-height: 1.4; cursor: pointer; word-break: break-all; }
.task-title:hover { color: var(--primary); }
.task-subject { font-size: 11px; padding: 1px 8px; border-radius: 10px; flex-shrink: 0; }
.task-note-mini { font-size: 11px; color: var(--muted); margin-top: 2px; word-break: break-all; }
.add-task-btn { border: 1px dashed #c7d2fe; background: #f5f8ff; color: var(--primary); border-radius: 8px; padding: 10px 0; font-size: 13px; width: 100%; margin-top: 8px; }
.add-task-btn:hover { background: #eef2ff; }

/* ---------- 已完成清单 ---------- */
.panel { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px 20px; margin-top: 4px; }
.panel h3 { margin-bottom: 12px; }
.completed-item { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-bottom: 1px solid var(--border); }
.completed-item:last-child { border-bottom: none; }
.completed-item .task-title { text-decoration: line-through; color: var(--muted); }
.completed-time { margin-left: auto; color: var(--muted); font-size: 12px; flex-shrink: 0; }
.empty-tip { color: var(--muted); text-align: center; padding: 30px 0; }
.stat-blocks { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin-bottom: 14px; }
.block-title { font-size: 13px; color: var(--muted); margin-bottom: 8px; }
.subj-stats { display: flex; flex-direction: column; gap: 6px; }
.subj-stat { display: flex; align-items: center; gap: 8px; font-size: 12px; }
.subj-name { width: 48px; flex-shrink: 0; color: var(--text); }
.subj-bar { flex: 1; height: 8px; background: #f3f4f6; border-radius: 6px; overflow: hidden; }
.subj-bar i { display: block; height: 100%; background: var(--c); border-radius: 6px; }
.subj-num { width: 40px; text-align: right; color: var(--muted); flex-shrink: 0; }
.day-stats { display: flex; flex-wrap: wrap; gap: 6px; }
.day-stat { background: #f8fafc; border: 1px solid var(--border); border-radius: 8px; padding: 4px 10px; font-size: 12px; color: var(--muted); }
.day-stat b { color: var(--text); }

/* ---------- 任务详情 ---------- */
#view-detail .btn-ghost { margin-bottom: 12px; }
.detail-panel { margin-top: 0; }
.detail-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 6px; }
.detail-head h2 { font-size: 20px; }
.chip { padding: 3px 12px; border-radius: 12px; color: #fff; font-size: 12px; font-weight: 600; }
.detail-day { color: var(--muted); font-size: 13px; }
.detail-note { color: var(--muted); margin-bottom: 12px; }
.check-label { display: flex; align-items: center; gap: 8px; font-size: 14px; margin-bottom: 16px; cursor: pointer; }
.check-label input { width: 17px; height: 17px; accent-color: var(--green); }
.submit-tabs { display: flex; gap: 6px; margin-bottom: 12px; }
.submit-tab { border: 1px solid var(--border); background: #fff; padding: 6px 14px; border-radius: 8px; font-size: 13px; color: var(--muted); }
.submit-tab.active { border-color: var(--primary); color: var(--primary); background: #eef2ff; font-weight: 600; }
.submit-area { margin-bottom: 12px; }
.image-preview { margin-top: 10px; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; max-width: 320px; }
.image-preview img { display: block; width: 100%; max-height: 260px; object-fit: cover; }
#answer-text { resize: vertical; }
.grade-btn { margin-top: 4px; }
.grade-loading { color: var(--primary); font-weight: 600; margin-top: 12px; }
.grade-result { margin-top: 12px; background: #f8fafc; border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px; }
.grade-result h4 { margin-bottom: 8px; }
.grade-item { border-bottom: 1px dashed var(--border); padding: 8px 0; }
.grade-item:last-child { border-bottom: none; }
.grade-q { font-weight: 600; font-size: 13px; }
.grade-verdict { font-size: 12px; padding: 1px 8px; border-radius: 10px; margin-left: 6px; font-weight: 600; }
.verdict-right { background: #d1fae5; color: #065f46; }
.verdict-wrong { background: #fee2e2; color: #991b1b; }
.grade-mine, .grade-right, .grade-comment { font-size: 13px; margin-top: 4px; color: var(--muted); }
.grade-comment { color: var(--text); }
.correction-list { display: flex; flex-direction: column; gap: 10px; }
.correction-item { border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; }
.correction-head { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); flex-wrap: wrap; }
.correction-head .chip { margin-left: auto; }
.corr-toggle { font-size: 12px; padding: 2px 10px; }
.correction-detail { margin-top: 8px; padding: 8px 10px; background: #f8fafc; border: 1px solid var(--border); border-radius: 8px; }
.corr-img { display: block; max-width: 100%; max-height: 420px; border-radius: 6px; margin-bottom: 8px; }
.corr-answer { font-size: 13px; color: var(--text); white-space: pre-wrap; word-break: break-all; margin-bottom: 8px; }
.correction-detail .grade-item:first-of-type { margin-top: 4px; }
.empty-day { color: #cbd5e1; text-align: center; font-size: 12px; padding: 16px 0 4px; }
.correction-body { margin-top: 6px; }
.withdraw-btn { margin-top: 6px; font-size: 12px; }
.danger-zone { margin-top: 20px; border-top: 1px solid var(--border); padding-top: 14px; text-align: right; }

/* ---------- 弹窗 ---------- */
.modal-card { background: var(--card); border-radius: 16px; width: 92%; max-width: 420px; padding: 20px 24px; box-shadow: var(--shadow); }
.modal-card.small { max-width: 340px; }
.modal-card h3 { margin-bottom: 14px; }
.modal-card label { display: block; font-size: 13px; color: var(--muted); margin: 12px 0 6px; }
.modal-card select { appearance: auto; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; }
.subject-row { display: flex; flex-wrap: wrap; gap: 8px; }
.subject-chip { border: 1px solid var(--border); background: #fff; border-radius: 16px; padding: 6px 14px; font-size: 13px; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.subject-chip .dot { width: 8px; height: 8px; border-radius: 50%; }
.subject-chip.selected { color: #fff; border-color: transparent; font-weight: 600; box-shadow: var(--shadow); }

/* ---------- Toast ---------- */
.toast { position: fixed; bottom: 30px; left: 50%; transform: translateX(-50%); background: #111827; color: #fff; padding: 10px 20px; border-radius: 10px; font-size: 14px; z-index: 200; box-shadow: var(--shadow); }
.toast.error { background: var(--danger); }

/* ---------- 响应式 ---------- */
@media (max-width: 1100px) {
  .week-grid { grid-template-columns: repeat(4, 1fr); }
}
@media (max-width: 700px) {
  .week-grid { grid-template-columns: repeat(2, 1fr); }
  .topbar { flex-wrap: wrap; }
  .week-nav { order: 3; width: 100%; justify-content: center; }
}
