/* ============================================
   学习工作台 - 绿色清新风格
   ============================================ */
:root {
  --g: #3e9b6b;            /* 主绿 */
  --g-dark: #2f7f56;
  --g-deep: #256645;
  --g-light: #e7f4ed;      /* 浅绿底 */
  --g-bg: #f2f8f4;         /* 页面背景 */
  --card: #ffffff;
  --text: #26352c;
  --muted: #7d9186;
  --line: #dcebe2;
  --danger: #e05d4b;
  --warn: #e8a23c;
  --radius: 16px;
  --shadow: 0 2px 10px rgba(47, 127, 86, 0.08);
  --shadow-lg: 0 8px 30px rgba(47, 127, 86, 0.16);
  --c-yu: #4a7de0;   /* 语文 */
  --c-shu: #ef9f3f;  /* 数学 */
  --c-ying: #9a63d6; /* 英语 */
  --c-other: #8a9a90;/* 其他 */
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  font-family: "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
  background: var(--g-bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

button { font-family: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; font-size: 14px; color: var(--text); }

/* ---------------- 启动画面 ---------------- */
#boot {
  position: fixed; inset: 0; z-index: 999;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(160deg, #eaf6ef, #f6fbf8);
}
.boot-card { text-align: center; padding: 40px; }
.boot-icon { font-size: 56px; animation: bounce 1.6s ease-in-out infinite; }
.boot-title { font-size: 26px; font-weight: 700; color: var(--g-deep); margin: 14px 0 8px; }
.boot-sub { font-size: 14px; color: var(--muted); line-height: 1.8; }
@keyframes bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}

/* ---------------- 布局 ---------------- */
#app { display: flex; min-height: 100vh; }

#sidebar {
  width: 210px; flex-shrink: 0;
  background: var(--card);
  border-right: 1px solid var(--line);
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh;
}
.logo {
  padding: 22px 18px 16px;
  font-size: 18px; font-weight: 700; color: var(--g-deep);
  letter-spacing: 1px;
}
.logo-ico { margin-right: 6px; }
#nav { flex: 1; padding: 6px 10px; overflow-y: auto; }
.nav-item {
  display: flex; align-items: center; gap: 10px;
  width: 100%;
  border: none; background: none;
  padding: 11px 14px; margin: 3px 0;
  border-radius: 12px;
  font-size: 15px; color: var(--text);
  transition: background .15s, color .15s;
  text-align: left;
}
.nav-item:hover { background: var(--g-light); }
.nav-item.active { background: var(--g); color: #fff; font-weight: 600; }
.nav-ico { font-size: 17px; }
.side-foot { padding: 10px; border-top: 1px solid var(--line); }

#main { flex: 1; min-width: 0; padding: 26px 30px 60px; }
#topbar {
  display: flex; align-items: baseline; justify-content: space-between;
  margin-bottom: 20px; flex-wrap: wrap; gap: 8px;
}
#viewTitle { font-size: 24px; color: var(--g-deep); }
#topDate { font-size: 14px; color: var(--muted); }
#topRight { display: inline-flex; align-items: center; gap: 10px; }
#btnSync {
  border: none; background: #eaf6ee; color: var(--g-deep);
  width: 32px; height: 32px; border-radius: 50%;
  font-size: 16px; cursor: pointer; line-height: 1;
  display: inline-flex; align-items: center; justify-content: center;
  transition: transform .3s, background .2s;
}
#btnSync:hover { background: #d7ecdf; }
#btnSync.spinning { animation: btn-spin .8s linear infinite; }
@keyframes btn-spin { to { transform: rotate(360deg); } }
#btnSync:disabled { opacity: .5; cursor: wait; }
#view { max-width: 1020px; }

/* ---------------- 卡片 ---------------- */
.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px 22px;
  margin-bottom: 18px;
}
.card-title {
  font-size: 16px; font-weight: 700; color: var(--g-deep);
  margin-bottom: 14px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
}
.card-title .sub { font-size: 12px; color: var(--muted); font-weight: 400; }
.error { color: var(--danger); }

/* ---------------- 按钮 ---------------- */
.btn {
  border: none; border-radius: 10px;
  background: var(--g); color: #fff;
  padding: 9px 18px; font-size: 14px; font-weight: 600;
  transition: background .15s, transform .1s;
}
.btn:hover { background: var(--g-dark); }
.btn:active { transform: scale(.97); }
.btn-ghost {
  border: 1px solid var(--g); background: #fff; color: var(--g-dark);
}
.btn-ghost:hover { background: var(--g-light); }
.btn-sm { padding: 5px 12px; font-size: 13px; border-radius: 8px; }
.btn-danger { background: var(--danger); }
.btn-danger:hover { background: #c74a39; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.icon-btn {
  border: none; background: none; color: var(--muted);
  font-size: 14px; padding: 4px 6px; border-radius: 6px;
}
.icon-btn:hover { background: var(--g-light); color: var(--g-dark); }

/* ---------------- 表单 ---------------- */
.input, select.input, textarea.input {
  border: 1px solid var(--line); border-radius: 10px;
  padding: 9px 12px; font-size: 14px; background: #fff;
  outline: none; transition: border .15s, box-shadow .15s;
  width: 100%;
}
.input:focus { border-color: var(--g); box-shadow: 0 0 0 3px rgba(62,155,107,.15); }
textarea.input { resize: vertical; min-height: 80px; line-height: 1.7; }
.form-row { display: flex; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; }
.form-row > * { flex-shrink: 0; }
.form-row label { width: 70px; color: var(--muted); font-size: 14px; line-height: 38px; }
.form-row .input { flex: 1; min-width: 0; width: auto; }
.form-item { margin-bottom: 12px; }
.form-item label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 6px; }

/* ---------------- 科目徽章 ---------------- */
.tag {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 30px; height: 22px; padding: 0 8px;
  border-radius: 6px; font-size: 12px; font-weight: 700; color: #fff;
}
.tag-yu { background: var(--c-yu); }
.tag-shu { background: var(--c-shu); }
.tag-ying { background: var(--c-ying); }
.tag-other { background: var(--c-other); }
.tag-point {
  background: var(--g-light); color: var(--g-dark);
  font-weight: 500; border-radius: 999px; padding: 0 10px; height: 22px;
}

/* ---------------- 列表条目（作业/错题） ---------------- */
.item {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 10px 4px;
  border-bottom: 1px dashed var(--line);
}
.item:last-child { border-bottom: none; }
.item-text { flex: 1; min-width: 0; line-height: 1.65; word-break: break-all; }
.item.done .item-text { color: var(--muted); text-decoration: line-through; }
.item-meta { font-size: 12px; color: var(--muted); margin-top: 2px; }
.item-ops { display: flex; gap: 2px; flex-shrink: 0; }

/* 自定义大号复选框 */
.chk {
  width: 22px; height: 22px; flex-shrink: 0; margin-top: 2px;
  border: 2px solid var(--g); border-radius: 7px;
  background: #fff; display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 13px; font-weight: 700;
  transition: background .15s;
}
.chk:hover { background: var(--g-light); }
.chk.on { background: var(--g); }
.chk.on::after { content: "✓"; }

/* ---------------- 进度条 ---------------- */
.progress-wrap {
  background: var(--g-light); border-radius: 999px; height: 10px;
  overflow: hidden; flex: 1; min-width: 120px;
}
.progress-bar {
  height: 100%; background: linear-gradient(90deg, var(--g), #6cc598);
  border-radius: 999px; transition: width .4s ease;
}
.progress-line {
  display: flex; align-items: center; gap: 14px; margin-bottom: 4px;
  font-size: 13px; color: var(--muted);
}

/* ---------------- 课表 ---------------- */
.schedule-table { width: 100%; border-collapse: separate; border-spacing: 4px; table-layout: fixed; }
.schedule-table th {
  font-size: 13px; color: var(--g-deep); padding: 6px 2px; font-weight: 700;
}
.schedule-table th.today-h { color: #fff; background: var(--g); border-radius: 8px; }
.cell {
  background: var(--g-bg); border: 1px solid transparent;
  border-radius: 8px; text-align: center;
  padding: 7px 2px; font-size: 13px;
  cursor: pointer; user-select: none;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  transition: background .12s;
}
.cell:hover { border-color: var(--g); background: var(--g-light); }
.cell.has { background: var(--g-light); color: var(--g-deep); font-weight: 600; }
.cell.today-c { box-shadow: inset 0 0 0 2px var(--g); }
.period-cell { font-size: 12px; color: var(--muted); white-space: nowrap; }
.period-cell .pc-main { color: var(--g-deep); font-weight: 600; display: block; font-size: 13px; }

/* ---------------- 打卡录音 ---------------- */
.rec-btn {
  width: 110px; height: 110px; border-radius: 50%;
  border: none; background: var(--g); color: #fff;
  font-size: 15px; font-weight: 700;
  box-shadow: 0 6px 18px rgba(62,155,107,.35);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  transition: transform .15s, background .15s;
}
.rec-btn:hover { transform: scale(1.04); }
.rec-btn.recording { background: var(--danger); animation: pulse 1.2s infinite; }
@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(224,93,75,.4); }
  50% { box-shadow: 0 0 0 14px rgba(224,93,75,0); }
}
.rec-timer { font-size: 26px; font-weight: 700; color: var(--danger); font-variant-numeric: tabular-nums; }
.audio-item { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px dashed var(--line); flex-wrap: wrap; }
.audio-item:last-child { border-bottom: none; }
.audio-item audio { height: 32px; flex: 1; min-width: 200px; }
.date-group-title {
  font-size: 13px; font-weight: 700; color: var(--g-deep);
  margin: 14px 0 4px; display: flex; align-items: center; gap: 6px;
}
.date-group-title:first-child { margin-top: 0; }
.empty-tip { text-align: center; color: var(--muted); font-size: 13px; padding: 26px 0; }

/* ---------------- 日期导航 ---------------- */
.nav-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; }
.nav-row .date-display {
  font-size: 17px; font-weight: 700; color: var(--g-deep); min-width: 150px; text-align: center;
}
.nav-row input[type="date"] { border: 1px solid var(--line); border-radius: 10px; padding: 7px 10px; color: var(--text); background: #fff; }

/* ---------------- 知识点统计 ---------------- */
.stat-row { display: flex; gap: 14px; flex-wrap: wrap; margin-bottom: 18px; }
.stat-card {
  flex: 1; min-width: 120px; background: var(--card);
  border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 16px; text-align: center;
}
.stat-num { font-size: 30px; font-weight: 800; color: var(--g-deep); }
.stat-label { font-size: 13px; color: var(--muted); margin-top: 2px; }
.point-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.point-chips .tag-point { height: 26px; font-size: 13px; }

/* tabs */
.tabs { display: flex; gap: 8px; margin-bottom: 14px; flex-wrap: wrap; }
.tab-btn {
  border: 1px solid var(--line); background: #fff; color: var(--text);
  border-radius: 999px; padding: 6px 18px; font-size: 14px;
}
.tab-btn.active { background: var(--g); border-color: var(--g); color: #fff; font-weight: 600; }

/* 错题卡片 */
.mistake-card { padding: 14px 16px; margin-bottom: 12px; }
.mistake-q { line-height: 1.7; margin: 8px 0; word-break: break-all; }
.mistake-points { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.mistake-reason { font-size: 13px; color: var(--warn); margin-top: 6px; }
.mistake-head { display: flex; align-items: center; gap: 8px; }
.mistake-date { font-size: 12px; color: var(--muted); margin-left: auto; }

/* ---------------- Toast ---------------- */
#toastWrap {
  position: fixed; bottom: 30px; left: 50%; transform: translateX(-50%);
  z-index: 1001; display: flex; flex-direction: column; gap: 8px; align-items: center;
}
.toast {
  background: rgba(38, 53, 44, .92); color: #fff;
  padding: 11px 22px; border-radius: 12px; font-size: 14px;
  opacity: 0; transform: translateY(10px); transition: all .3s;
  max-width: 80vw; text-align: center;
}
.toast.show { opacity: 1; transform: translateY(0); }
.toast-error { background: rgba(200, 70, 55, .95); }

/* ---------------- Modal ---------------- */
#modalMask[hidden] { display: none !important; }
#modalMask {
  position: fixed; inset: 0; z-index: 1000;
  background: rgba(30, 46, 37, .45);
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
}
#modalBox {
  background: #fff; border-radius: var(--radius);
  max-width: 92vw; width: 520px; max-height: 86vh;
  display: flex; flex-direction: column;
  box-shadow: var(--shadow-lg);
  animation: modalIn .18s ease;
}
@keyframes modalIn { from { transform: translateY(16px); opacity: 0; } }
#modalTitle {
  padding: 18px 22px 12px; font-size: 17px; font-weight: 700; color: var(--g-deep);
  border-bottom: 1px solid var(--line);
}
#modalBody { padding: 18px 22px; overflow-y: auto; }
#modalFoot {
  padding: 14px 22px; border-top: 1px solid var(--line);
  display: flex; justify-content: flex-end; gap: 10px;
}

/* ---------------- 导入器 ---------------- */
.thumb-wall { display: flex; flex-wrap: wrap; gap: 10px; margin: 12px 0; }
.thumb {
  width: 84px; height: 84px; border-radius: 10px; overflow: hidden;
  position: relative; border: 1px solid var(--line);
}
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb .th-status {
  position: absolute; inset: 0; background: rgba(38,53,44,.55);
  color: #fff; font-size: 11px; display: flex; align-items: center; justify-content: center;
  text-align: center; padding: 4px;
}
.thumb .th-del {
  position: absolute; top: 2px; right: 2px;
  width: 20px; height: 20px; border-radius: 50%; border: none;
  background: rgba(224,93,75,.9); color: #fff; font-size: 12px; line-height: 1;
}
.thumb .th-retry {
  position: absolute; bottom: 2px; right: 2px;
  width: 24px; height: 24px; border-radius: 50%; border: none;
  background: rgba(63,143,95,.9); color: #fff; font-size: 13px; line-height: 1;
  cursor: pointer;
}
.th-status-err {
  background: rgba(217,83,79,.85) !important;
  font-size: 10px;
}
.th-status-err small { display: block; margin-top: 2px; opacity: .9; }
.imp-item { display: flex; gap: 8px; margin-bottom: 8px; align-items: center; }
.imp-item select { width: 76px; flex-shrink: 0; }
.imp-step { margin-top: 16px; padding-top: 14px; border-top: 1px dashed var(--line); }
.imp-hint { font-size: 12px; color: var(--muted); line-height: 1.7; margin: 6px 0; }
.loading-line { text-align: center; color: var(--g-dark); font-size: 14px; padding: 18px 0; }

/* ---------------- 报告 ---------------- */
.report-body { line-height: 1.9; font-size: 14px; }
.report-body h3 { color: var(--g-deep); margin: 12px 0 6px; font-size: 15px; }
.report-body ul { padding-left: 20px; }
.report-body li { margin: 4px 0; }
.report-body strong { color: var(--g-dark); }

/* ---------------- 默写听写 ---------------- */
.chip-wall { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0; }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  background: #eaf6ee; border: 1px solid #cfe8d8; border-radius: 16px;
  padding: 5px 12px; font-size: 15px; color: var(--g-deep);
}
.chip button {
  border: none; background: none; cursor: pointer; color: #8a9a90;
  font-size: 15px; padding: 0; line-height: 1;
}
.chip .chip-del:hover { color: #d9534f; }
.chip .chip-edit { font-size: 13px; color: #8a9a90; padding: 0 2px; }
.chip .chip-edit:hover { color: #3c6ba8; }
.chip .chip-txt { line-height: 1.4; }
.chip .chip-kind {
  font-size: 12px; font-weight: 700; line-height: 1;
  padding: 3px 7px; border-radius: 9px;
  background: #d7ecdf; color: #3d7a58; cursor: pointer;
  flex-shrink: 0;
}
.chip .chip-kind:hover { filter: brightness(.95); }
.chip-phrase { background: #eef4fb; border-color: #d3e2f3; }
.chip-phrase .chip-kind { background: #dae8f8; color: #3c6ba8; }
.chip-sentence { background: #fbf3e8; border-color: #f2e0c4; }
.chip-sentence .chip-kind { background: #f7e6ca; color: #a4741f; }
.dic-speak-box { text-align: center; padding: 26px 10px 18px; }
.dic-count { font-size: 14px; color: var(--muted); margin-bottom: 8px; }
.dic-current {
  font-size: 46px; font-weight: 700; color: var(--g-deep);
  min-height: 66px; display: flex; align-items: center; justify-content: center;
}
.dic-status { margin: 10px 0 18px; color: #5b6f64; font-size: 15px; }
.dic-timer { font-size: 20px; font-weight: 700; color: #e8963f; }
.dic-result-row {
  display: flex; align-items: center; gap: 12px;
  padding: 8px 6px; border-bottom: 1px dashed var(--line); font-size: 15px;
}
.dic-result-row .dic-word { min-width: 96px; font-weight: 600; color: var(--g-deep); }

/* ---------------- 通用表格 ---------------- */
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th, .table td { padding: 9px 8px; text-align: left; border-bottom: 1px solid var(--line); }
.table th { color: var(--muted); font-weight: 600; font-size: 13px; }



/* ---------------- 工具行 ---------------- */
.tool-row { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; }

/* ---------------- 打印（每周作业） ---------------- */
@media print {
  #sidebar, #topbar, .no-print, #toastWrap { display: none !important; }
  #main { padding: 0; }
  .card { box-shadow: none; border: 1px solid #ccc; }
  body { background: #fff; }
  .print-spacer { display: block !important; }
}
.print-spacer { display: none; }

/* ---------------- 响应式 ---------------- */
@media (max-width: 860px) {
  #app { flex-direction: column; }
  #sidebar {
    width: 100%; height: auto; position: static;
    flex-direction: row; align-items: center; flex-wrap: wrap;
    border-right: none; border-bottom: 1px solid var(--line);
  }
  .logo { padding: 12px 14px; font-size: 16px; }
  #nav { display: flex; padding: 4px 8px; overflow-x: auto; }
  .nav-item { padding: 8px 10px; font-size: 13px; white-space: nowrap; }
  .side-foot { border-top: none; padding: 4px 8px; }
  #main { padding: 16px 14px 40px; }
  .schedule-table { font-size: 12px; }
  .schedule-table .cell { font-size: 11px; padding: 5px 1px; }
}
