/* ============ 小福口语 师生版 样式 ============ */
:root {
  --bg: #f4f5fb;
  --card: #ffffff;
  --text: #1c2333;
  --muted: #7a8199;
  --line: #e6e8f2;
  --primary: #4f6ef7;
  --primary-weak: #e9edff;
  --again: #f25555;
  --again-weak: #ffe9e9;
  --hard: #f59e3d;
  --hard-weak: #fff1e0;
  --good: #2fa96e;
  --good-weak: #e2f6ec;
  --easy: #3a7bfd;
  --easy-weak: #e7efff;
  --shadow: 0 6px 24px rgba(28, 35, 51, 0.08);
  --radius: 18px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #12141c;
    --card: #1d2130;
    --text: #e8eaf2;
    --muted: #8d94ab;
    --line: #2c3145;
    --primary: #7b93ff;
    --primary-weak: #26305a;
    --again: #ff7b7b;
    --again-weak: #4a2626;
    --hard: #ffb066;
    --hard-weak: #48351e;
    --good: #5fd39a;
    --good-weak: #1d3c2e;
    --easy: #7fabff;
    --easy-weak: #1f2e52;
    --shadow: 0 6px 24px rgba(0, 0, 0, 0.35);
  }
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100dvh;
}

#app { max-width: 560px; margin: 0 auto; }

.view { display: none; padding: 18px 16px calc(86px + env(safe-area-inset-bottom)); }
.view.active { display: block; animation: fadein 0.18s ease; }
@keyframes fadein { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

.view-title { font-size: 22px; margin: 6px 0 4px; }
.view-sub { color: var(--muted); margin: 0 0 16px; font-size: 14px; }
.muted { color: var(--muted); }
.small { font-size: 12px; line-height: 1.6; }
.hidden { display: none !important; }

/* ---------- 通用按钮 / 输入 ---------- */
.btn {
  appearance: none; border: 1px solid var(--line); background: var(--card); color: var(--text);
  border-radius: 14px; padding: 12px 18px; font-size: 15px; font-weight: 600;
  cursor: pointer; transition: transform 0.06s ease, opacity 0.15s;
}
.btn:active { transform: scale(0.97); }
.btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn.ghost { background: transparent; }
.btn.danger { background: var(--again-weak); border-color: transparent; color: var(--again); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn-row { display: flex; gap: 10px; margin: 14px 0; flex-wrap: wrap; }
.btn-row .btn { flex: 1; min-width: 130px; }

.input {
  width: 100%; border: 1px solid var(--line); background: var(--card); color: var(--text);
  border-radius: 12px; padding: 11px 13px; font-size: 15px; margin: 8px 0;
}
.input:focus { outline: 2px solid var(--primary); outline-offset: 1px; border-color: transparent; }
textarea.input { resize: vertical; min-height: 60px; font-family: inherit; }

.panel {
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 22px 18px; margin: 14px 0; text-align: center;
}
.panel h2 { margin: 8px 0 6px; font-size: 20px; }
.panel h3 { margin: 0 0 4px; font-size: 16px; text-align: left; }
.panel p { color: var(--muted); font-size: 14px; line-height: 1.7; margin: 6px 0; }
.panel-big-emoji { font-size: 46px; }
.panel.text-left { text-align: left; }

/* ---------- 学习页 ---------- */
.study-header { display: flex; gap: 12px; margin: 4px 0 14px; }
.stat {
  flex: 1; background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 14px; display: flex; flex-direction: column; align-items: center;
}
.stat-num { font-size: 28px; font-weight: 800; color: var(--primary); }
.stat-label { font-size: 12px; color: var(--muted); margin-top: 2px; }

.card {
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 24px 20px 18px; margin: 6px 0 10px;
}
.card-tags { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 10px; }
.chip {
  font-size: 11px; padding: 3px 10px; border-radius: 999px;
  background: var(--primary-weak); color: var(--primary); font-weight: 600;
}
.card-en { font-size: 24px; font-weight: 700; line-height: 1.45; word-break: break-word; }
.card-zh { font-size: 15px; color: var(--muted); margin-top: 10px; line-height: 1.6; }
.card-meta { font-size: 12px; color: var(--muted); margin-top: 8px; }

.card-actions { display: flex; gap: 10px; margin-top: 18px; }
.act-btn {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px;
  border: 1px solid var(--line); background: var(--bg); color: var(--text);
  border-radius: 14px; padding: 10px 6px; font-size: 12px; font-weight: 600; cursor: pointer;
}
.act-btn .act-icon { font-size: 22px; }
.act-btn:disabled { opacity: 0.4; }
.act-btn.record { border-color: var(--again); }
.act-btn.record.recording { background: var(--again); border-color: var(--again); color: #fff; animation: pulse 1.2s infinite; }
@keyframes pulse { 0%,100% { box-shadow: 0 0 0 0 rgba(242,85,85,0.35); } 50% { box-shadow: 0 0 0 10px rgba(242,85,85,0); } }
.record-hint { font-size: 12px; color: var(--muted); text-align: center; min-height: 16px; margin-top: 8px; }

.card-progress { text-align: center; font-size: 12px; color: var(--muted); margin-bottom: 12px; }

.feedback { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px; }
.feedback-title { font-size: 13px; color: var(--muted); text-align: center; margin-bottom: 10px; }
.feedback-btns { display: flex; gap: 8px; }
.fb {
  flex: 1; border: none; border-radius: 12px; padding: 10px 4px 8px; cursor: pointer;
  font-size: 14px; font-weight: 700; display: flex; flex-direction: column; align-items: center; gap: 2px;
}
.fb small { font-size: 10px; font-weight: 500; opacity: 0.75; }
.fb-again { background: var(--again-weak); color: var(--again); }
.fb-hard  { background: var(--hard-weak);  color: var(--hard); }
.fb-good  { background: var(--good-weak);  color: var(--good); }
.fb-easy  { background: var(--easy-weak);  color: var(--easy); }
.fb:active { transform: scale(0.96); }

/* ---------- 拍照入库页 ---------- */
#ocr-preview-wrap { text-align: center; }
#ocr-preview {
  max-width: 100%; max-height: 260px; border-radius: 14px; border: 1px solid var(--line);
  box-shadow: var(--shadow); object-fit: contain; background: #fff;
}
.ocr-status { margin: 14px 0; }
.ocr-status-bar { height: 8px; border-radius: 999px; background: var(--line); overflow: hidden; }
.ocr-status-fill {
  height: 100%; width: 0%; border-radius: 999px; background: var(--primary);
  transition: width 0.2s ease;
}
.ocr-status-text { font-size: 13px; color: var(--muted); margin-top: 8px; }

.ocr-item {
  background: var(--card); border-radius: 14px; border: 1px solid var(--line);
  padding: 10px 12px; margin: 10px 0; box-shadow: var(--shadow);
}
.ocr-item-head { display: flex; align-items: center; gap: 8px; }
.ocr-item-head input[type="checkbox"] { width: 20px; height: 20px; flex: none; }
.ocr-item-en { font-size: 15px; font-weight: 600; word-break: break-word; }

/* ---------- 题库页 ---------- */
.lib-actions { display: flex; gap: 8px; margin: 12px 0; flex-wrap: wrap; }
.lib-actions .btn { flex: 1; min-width: 104px; font-size: 13px; padding: 10px 8px; }
.lib-summary { font-size: 13px; color: var(--muted); margin: 10px 2px; }
.lib-list { list-style: none; margin: 0; padding: 0; }
.lib-item {
  background: var(--card); border-radius: 14px; border: 1px solid var(--line);
  padding: 12px 14px; margin: 10px 0; box-shadow: var(--shadow);
  display: flex; gap: 10px; align-items: flex-start;
}
.lib-item-body { flex: 1; min-width: 0; }
.lib-item-en { font-weight: 700; font-size: 15px; word-break: break-word; line-height: 1.4; }
.lib-item-sub { font-size: 12px; color: var(--muted); margin-top: 4px; line-height: 1.6; }
.lib-del {
  border: none; background: var(--again-weak); color: var(--again);
  border-radius: 10px; width: 34px; height: 34px; flex: none; font-size: 15px; cursor: pointer;
}

/* ---------- 底部标签栏 ---------- */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 50;
  display: flex; justify-content: center; gap: 0;
  background: var(--card); border-top: 1px solid var(--line);
  padding: 6px 0 calc(6px + env(safe-area-inset-bottom));
}
.tabbar .tab {
  flex: 1; max-width: 150px; border: none; background: transparent; color: var(--muted);
  display: flex; flex-direction: column; align-items: center; gap: 1px;
  font-size: 11px; font-weight: 600; padding: 4px 0; cursor: pointer; position: relative;
}
.tabbar .tab .tab-icon { font-size: 22px; }
.tabbar .tab.active { color: var(--primary); }
.tab-badge {
  position: absolute; top: 0; right: calc(50% - 26px);
  min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px;
  background: var(--again); color: #fff; font-size: 11px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}

/* ---------- Toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: calc(96px + env(safe-area-inset-bottom)); transform: translateX(-50%);
  background: rgba(28, 35, 51, 0.92); color: #fff; font-size: 14px; font-weight: 500;
  border-radius: 999px; padding: 10px 20px; z-index: 200; max-width: 86vw; text-align: center;
  animation: toast-in 0.2s ease; box-shadow: 0 4px 16px rgba(0,0,0,0.25);
}
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, 8px); } to { opacity: 1; transform: translate(-50%, 0); } }

/* ============================================================
 * 师生版新增样式
 * ============================================================ */
.tutor-banner {
  display: flex; align-items: center; gap: 8px;
  background: var(--primary-weak); color: var(--primary);
  border-radius: 12px; padding: 10px 14px; font-size: 13px; font-weight: 600;
  margin: 10px 0; cursor: pointer;
}
.tutor-banner.warn { background: var(--hard-weak); color: var(--hard); }

.tutor-section-title { font-size: 15px; font-weight: 700; margin: 18px 2px 8px; }

.role-toggle { display: flex; gap: 8px; margin: 12px 0; }
.role-toggle button {
  flex: 1; border: 1px solid var(--line); background: var(--card); color: var(--muted);
  border-radius: 12px; padding: 12px 0; font-size: 15px; font-weight: 700; cursor: pointer;
}
.role-toggle button.active { background: var(--primary); border-color: var(--primary); color: #fff; }

.code-box {
  display: flex; align-items: center; justify-content: center; gap: 12px;
  background: var(--bg); border-radius: 14px; padding: 14px; margin: 10px 0;
}
.code-value { font-size: 30px; font-weight: 800; letter-spacing: 8px; color: var(--primary); font-family: monospace; }

.tutor-row {
  background: var(--card); border-radius: 14px; border: 1px solid var(--line);
  box-shadow: var(--shadow); padding: 12px 14px; margin: 10px 0; cursor: pointer;
}
.tutor-row:active { transform: scale(0.99); }
.tutor-row-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.tutor-row-title { font-weight: 700; font-size: 15px; }
.tutor-row-sub { font-size: 12px; color: var(--muted); margin-top: 4px; line-height: 1.6; }

.status-chip {
  font-size: 11px; font-weight: 700; padding: 3px 10px; border-radius: 999px; white-space: nowrap;
}
.status-submitted { background: var(--hard-weak); color: var(--hard); }
.status-graded   { background: var(--again-weak); color: var(--again); }
.status-read     { background: var(--good-weak); color: var(--good); }

.rating-chip { font-size: 11px; font-weight: 600; padding: 2px 9px; border-radius: 999px; }
.rating-again { background: var(--again-weak); color: var(--again); }
.rating-hard  { background: var(--hard-weak); color: var(--hard); }
.rating-good  { background: var(--good-weak); color: var(--good); }
.rating-easy  { background: var(--easy-weak); color: var(--easy); }

/* 批改/详情浮层 */
.tutor-overlay {
  position: fixed; inset: 0; z-index: 100; background: var(--bg);
  overflow-y: auto; -webkit-overflow-scrolling: touch;
}
.tutor-overlay-inner { max-width: 560px; margin: 0 auto; padding: 16px 16px 120px; }
.overlay-head {
  position: sticky; top: 0; z-index: 10; background: var(--bg);
  display: flex; align-items: center; gap: 10px; padding: 10px 0 12px;
}
.overlay-head h2 { font-size: 18px; margin: 0; flex: 1; }
.overlay-close {
  border: none; background: var(--card); color: var(--text); border-radius: 10px;
  width: 36px; height: 36px; font-size: 16px; cursor: pointer; box-shadow: var(--shadow);
}

.grade-item {
  background: var(--card); border-radius: 14px; border: 1px solid var(--line);
  box-shadow: var(--shadow); padding: 14px; margin: 12px 0;
}
.grade-item-en { font-size: 16px; font-weight: 700; line-height: 1.45; word-break: break-word; }
.grade-item-zh { font-size: 13px; color: var(--muted); margin-top: 4px; }
.grade-item-meta { display: flex; align-items: center; gap: 8px; margin-top: 8px; flex-wrap: wrap; }

.grade-label { font-size: 12px; color: var(--muted); font-weight: 600; margin: 12px 0 6px; }

.stars { display: flex; gap: 6px; }
.star {
  border: none; background: var(--bg); font-size: 26px; line-height: 1;
  padding: 4px 6px; border-radius: 8px; cursor: pointer; color: var(--muted);
}
.star.on { color: #f5b02d; background: var(--easy-weak); }
.score-text { font-size: 14px; font-weight: 800; color: #f5b02d; }

audio { width: 100%; height: 40px; margin: 6px 0; }

.grade-audio-row { display: flex; align-items: center; gap: 8px; margin-top: 6px; }
.grade-audio-row audio { flex: 1; margin: 0; }
.rec-mini {
  border: 1px solid var(--again); background: var(--card); color: var(--again);
  border-radius: 10px; padding: 8px 12px; font-size: 13px; font-weight: 700; cursor: pointer;
  white-space: nowrap;
}
.rec-mini.recording { background: var(--again); color: #fff; animation: pulse 1.2s infinite; }

.grade-foot {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 110;
  background: var(--card); border-top: 1px solid var(--line);
  padding: 10px 16px calc(10px + env(safe-area-inset-bottom));
  display: flex; justify-content: center;
}
.grade-foot .btn { min-width: 240px; }

.comment-view {
  background: var(--bg); border-radius: 10px; padding: 10px 12px;
  font-size: 14px; line-height: 1.6; margin-top: 6px; white-space: pre-wrap;
}
.compare-row { display: flex; flex-direction: column; gap: 2px; }
.compare-label { font-size: 11px; color: var(--muted); font-weight: 600; }

/* ---------- 示例题库选择器 ---------- */
.lp-overlay {
  position: fixed; inset: 0; z-index: 150; background: rgba(10, 12, 20, 0.55);
  display: flex; align-items: flex-end; justify-content: center;
}
.lp-card {
  background: var(--card); width: 100%; max-width: 560px;
  border-radius: 22px 22px 0 0; padding: 18px 18px calc(20px + env(safe-area-inset-bottom));
  max-height: 82dvh; overflow-y: auto; animation: lp-in 0.2s ease;
}
@keyframes lp-in { from { transform: translateY(30px); opacity: 0.6; } to { transform: none; opacity: 1; } }
.lp-head { display: flex; align-items: center; justify-content: space-between; }
.lp-head h2 { font-size: 19px; margin: 0 0 8px; }
.lp-cat {
  display: flex; align-items: center; gap: 12px;
  background: var(--bg); border-radius: 14px; padding: 12px 14px; margin: 8px 0; cursor: pointer;
}
.lp-cat:active { transform: scale(0.99); }
.lp-cat input[type="checkbox"] { width: 21px; height: 21px; flex: none; }
.lp-cat-icon { font-size: 24px; }
.lp-cat-name { font-weight: 700; font-size: 15px; display: block; }
.lp-cat-sub { font-size: 12px; color: var(--muted); display: block; margin-top: 2px; }

