/* 学习记录本 — 样式（手机优先，电脑端居中） */
:root {
  --primary: #5b8def;
  --primary-dark: #3f6fd8;
  --bg: #f5f7fb;
  --card: #ffffff;
  --text: #2b3240;
  --muted: #8a94a6;
  --border: #e6e9f0;
  --danger: #e5534b;
  --warn: #e8a33d;
  --ok: #3fb864;
  --radius: 14px;
  --shadow: 0 2px 10px rgba(43, 50, 64, 0.06);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
}
.app {
  max-width: 640px;
  margin: 0 auto;
  min-height: 100vh;
  background: var(--bg);
  position: relative;
  padding-bottom: 74px;
  box-shadow: 0 0 20px rgba(0, 0, 0, 0.06);
}

/* -------- 头部 -------- */
.header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  background: var(--primary);
  color: #fff;
}
.header h1 { margin: 0; font-size: 18px; font-weight: 700; }
.header-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 20px;
  padding: 5px 12px;
  font-size: 12px;
  cursor: pointer;
}
.header-badge b { font-size: 16px; }

/* -------- 页面 -------- */
.main { padding: 12px; }
.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-weight: 700;
  font-size: 15px;
  margin: 18px 2px 10px;
}
.section-hint { font-weight: 400; color: var(--muted); font-size: 12px; }

/* -------- 按钮 -------- */
.btn {
  border: none;
  border-radius: 10px;
  padding: 9px 14px;
  font-size: 14px;
  cursor: pointer;
  transition: opacity 0.15s;
}
.btn:active { opacity: 0.75; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-outline { background: #fff; color: var(--primary); border: 1px solid var(--primary); }
.btn-danger { background: #fff; color: var(--danger); border: 1px solid var(--danger); }
.btn-plain { background: transparent; color: var(--muted); }
.btn-block { width: 100%; display: block; margin-top: 8px; }
.btn-small { padding: 5px 10px; font-size: 13px; border-radius: 8px; }
.btn-remember { background: #e7f6ec; color: var(--ok); border: 1px solid var(--ok); }
.btn-fuzzy { background: #fdf3e1; color: #b4770a; border: 1px solid var(--warn); }
.btn-forgot { background: #fdecea; color: var(--danger); border: 1px solid var(--danger); }
.icon-btn {
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 50%;
  background: #fff;
  color: var(--primary);
  font-size: 20px;
  cursor: pointer;
  box-shadow: var(--shadow);
}
.btn-plain:active, .icon-btn:active { opacity: 0.7; }

/* -------- 输入 -------- */
.input, .textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 15px;
  font-family: inherit;
  background: #fff;
  outline: none;
}
.input:focus, .textarea:focus { border-color: var(--primary); }
.textarea { resize: vertical; min-height: 72px; }

/* -------- 锁屏 -------- */
.lock-screen {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.lock-screen.hidden { display: none; }
.lock-card {
  width: 100%;
  max-width: 340px;
  background: #fff;
  border-radius: 18px;
  padding: 28px 22px;
  text-align: center;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.18);
}
.lock-logo { font-size: 44px; }
.lock-card h2 { margin: 12px 0 4px; font-size: 18px; }
.lock-sub { margin: 0 0 16px; color: var(--muted); font-size: 13px; }
.lock-error { color: var(--danger); font-size: 13px; min-height: 18px; margin: 6px 0 0; }
.lock-card .input { text-align: center; letter-spacing: 6px; font-size: 18px; }

/* -------- 今日页 -------- */
.date-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin: 4px 0 6px;
}
.date-label {
  border: none;
  background: #fff;
  border-radius: 10px;
  padding: 8px 14px;
  font-size: 15px;
  font-weight: 600;
  box-shadow: var(--shadow);
  cursor: pointer;
}
.btn-small.btn-outline { padding: 6px 12px; }

/* -------- 记录卡片 -------- */
.entry-card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 12px 14px;
  margin-bottom: 10px;
}
.entry-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}
.subj {
  background: #eef3ff;
  color: var(--primary-dark);
  border-radius: 8px;
  padding: 2px 9px;
  font-size: 12px;
  font-weight: 600;
}
.entry-date { color: var(--muted); font-size: 12px; }
.entry-content { font-size: 15px; white-space: pre-wrap; word-break: break-word; }
.entry-bottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}
.review-info { color: var(--muted); font-size: 12px; }
.entry-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.empty-tip {
  text-align: center;
  color: var(--muted);
  padding: 24px 10px;
  font-size: 14px;
}

/* -------- 记录页 -------- */
.add-card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 14px;
}
.add-row { display: flex; gap: 8px; margin-bottom: 10px; }
.input-date { flex: 0 0 140px; }
.input-subject { flex: 1; }
.add-actions {
  display: flex;
  gap: 8px;
  margin-top: 10px;
  flex-wrap: wrap;
}
.add-actions .btn { flex: 1; min-width: 110px; }
.filter-chips {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
  margin-bottom: 10px;
}
.chip {
  white-space: nowrap;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--muted);
  border-radius: 16px;
  padding: 5px 12px;
  font-size: 13px;
  cursor: pointer;
}
.chip.active { background: var(--primary); color: #fff; border-color: var(--primary); }

/* OCR 进度 */
.ocr-progress {
  margin-top: 10px;
  padding: 10px 12px;
  background: #fffbea;
  border: 1px solid var(--warn);
  border-radius: 10px;
}
.ocr-progress.hidden { display: none; }
.ocr-bar {
  background: #f0e6c8;
  border-radius: 8px;
  height: 8px;
  overflow: hidden;
}
.ocr-bar-fill, #ocr-bar-fill {
  background: var(--warn);
  height: 100%;
  width: 0;
  transition: width 0.2s;
}
#ocr-status { font-size: 12px; color: #9a7219; margin-top: 6px; display: block; }

/* -------- 日历 -------- */
.cal-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin: 6px 0 12px;
}
.cal-month-label { font-weight: 700; font-size: 16px; }
.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
  background: #fff;
  border-radius: var(--radius);
  padding: 10px;
  box-shadow: var(--shadow);
}
.cal-cell {
  aspect-ratio: 1;
  min-height: 42px;
  border-radius: 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 13px;
  position: relative;
}
.cal-cell.blank { cursor: default; }
.cal-cell.today { background: #eef3ff; color: var(--primary-dark); font-weight: 700; }
.cal-cell.selected { outline: 2px solid var(--primary); }
.cal-day-num { line-height: 1.2; }
.cal-dots { display: flex; gap: 3px; min-height: 6px; }
.dot { width: 6px; height: 6px; border-radius: 50%; display: inline-block; }
.dot-entry { background: var(--primary); }
.dot-due { background: var(--warn); }
.cal-legend {
  display: flex;
  gap: 16px;
  margin: 12px 4px;
  font-size: 12px;
  color: var(--muted);
}
.cal-legend .dot { margin-right: 4px; vertical-align: middle; }
.cal-tip { color: var(--muted); font-size: 13px; margin: 0 2px 24px; }

/* -------- 设置 -------- */
.settings-group {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 14px;
  margin-bottom: 12px;
}
.settings-group h3 { margin: 0 0 10px; font-size: 14px; color: var(--muted); }
.settings-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  font-size: 15px;
  border-bottom: 1px solid var(--border);
}
.settings-row:last-child { border-bottom: none; }
.settings-tip { color: var(--muted); font-size: 13px; margin: 6px 0 0; }

/* -------- 底部导航 -------- */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 640px;
  background: #fff;
  border-top: 1px solid var(--border);
  display: flex;
  padding-bottom: env(safe-area-inset-bottom);
  z-index: 30;
}
.nav-btn {
  flex: 1;
  border: none;
  background: none;
  padding: 8px 0 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  font-size: 11px;
  color: var(--muted);
  cursor: pointer;
}
.nav-icon { font-size: 20px; }
.nav-btn.active { color: var(--primary); font-weight: 700; }

/* -------- Toast -------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: 88px;
  transform: translate(-50%, 20px);
  background: rgba(43, 50, 64, 0.92);
  color: #fff;
  padding: 10px 18px;
  border-radius: 20px;
  font-size: 14px;
  max-width: 86%;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s, transform 0.25s;
  z-index: 200;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* -------- 电脑端适配 -------- */
@media (min-width: 768px) {
  body { padding-top: 20px; }
  .main { padding: 16px; }
}