/* ===== 基础与主题（暖橙） ===== */
:root {
  --bg: #fff7f0;
  --card: #ffffff;
  --primary: #e8833a;
  --primary-dark: #cf6f28;
  --accent: #f4b942;
  --green: #2ecc71;
  --green-dark: #27ae60;
  --red: #ff6b6b;
  --purple: #a55eea;
  --blue: #5b8def;
  --text: #4a3b2d;
  --text-soft: #a08b76;
  --line: #f0e2d3;
  --shadow: 0 6px 20px rgba(232, 131, 58, 0.15);
  --radius: 20px;
  font-size: 18px;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body {
  margin: 0; padding: 0; height: 100%;
  background: var(--bg); color: var(--text);
  font-family: "PingFang SC", "Microsoft YaHei", "Segoe UI", system-ui, -apple-system, sans-serif;
  overscroll-behavior: none;
}
#app { display: flex; flex-direction: column; height: 100vh; height: 100svh; height: 100dvh; max-width: 900px; margin: 0 auto; background: var(--bg); overflow: hidden; }

/* ===== 顶栏 ===== */
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 12px 16px; padding-top: calc(12px + env(safe-area-inset-top, 0px));
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: #fff; box-shadow: var(--shadow); z-index: 5; flex-shrink: 0;
}
.brand { display: flex; align-items: center; gap: 8px; min-width: 0; }
.brand-emoji { font-size: 1.5rem; flex-shrink: 0; }
.brand-title { font-size: 1.2rem; font-weight: 800; letter-spacing: 0.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-right { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
.score-chip { display: flex; align-items: center; gap: 4px; background: rgba(255,255,255,0.25); padding: 5px 10px; border-radius: 999px; font-weight: 800; font-size: 1rem; white-space: nowrap; }
.score-star { font-size: 1.05rem; }
.icon-btn { background: rgba(255,255,255,0.2); border: none; color: #fff; width: 40px; height: 40px; border-radius: 50%; font-size: 1.25rem; cursor: pointer; flex-shrink: 0; display: flex; align-items: center; justify-content: center; }
.icon-btn:active { transform: scale(0.92); }
a.brand { text-decoration: none; color: inherit; cursor: pointer; }
a.icon-btn { text-decoration: none; }
@media (max-width: 430px) {
  .brand-title { font-size: 1.02rem; }
  .topbar { padding-left: 12px; padding-right: 12px; }
  .icon-btn { width: 34px; height: 34px; font-size: 1.05rem; }
}

/* ===== 模块切换 ===== */
.module-switch { display: flex; gap: 8px; padding: 10px 14px; background: var(--card); border-bottom: 2px solid var(--line); flex-shrink: 0; }
.mod-btn { flex: 1; border: 2px solid var(--line); background: #fff; border-radius: 14px; padding: 9px; font-size: 1rem; font-weight: 800; cursor: pointer; font-family: inherit; color: var(--text-soft); display: flex; align-items: center; justify-content: center; gap: 6px; }
.mod-btn span { font-size: 1.2rem; }
.mod-btn.active { border-color: var(--primary); background: #fff7ee; color: var(--primary-dark); }
.mod-btn:active { transform: scale(0.97); }

/* ===== 主内容 ===== */
.view { flex: 1 1 auto; min-height: 0; overflow-y: auto; padding: 18px; -webkit-overflow-scrolling: touch; }

/* ===== 底部导航 ===== */
.tabbar { display: flex; background: var(--card); border-top: 2px solid var(--line); padding: 6px 4px calc(6px + env(safe-area-inset-bottom, 0px)); flex-shrink: 0; }
.tab-btn { flex: 1; background: none; border: none; cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 4px; border-radius: 14px; color: var(--text-soft); font-size: 0.8rem; font-weight: 700; position: relative; }
.tab-emoji { font-size: 1.5rem; filter: grayscale(0.4); }
.tab-btn.active { color: var(--primary); background: #fdf0e3; }
.tab-btn.active .tab-emoji { filter: none; transform: translateY(-2px); }
.tab-btn:active { transform: scale(0.95); }
.tab-badge { position: absolute; top: 2px; right: 22%; background: var(--red); color: #fff; min-width: 20px; height: 20px; border-radius: 999px; font-size: 0.72rem; font-weight: 800; display: flex; align-items: center; justify-content: center; padding: 0 5px; }

/* ===== 通用卡片/按钮 ===== */
.card { background: var(--card); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); margin-bottom: 16px; }
.btn { border: none; border-radius: 999px; padding: 14px 22px; font-size: 1.05rem; font-weight: 800; cursor: pointer; transition: transform .08s; font-family: inherit; }
.btn:active { transform: scale(0.96); }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-green { background: var(--green); color: #fff; }
.btn-ghost { background: #fbeee0; color: var(--text); }
.btn-danger { background: var(--red); color: #fff; }
.btn-block { width: 100%; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.section-title { font-size: 1.15rem; font-weight: 800; margin: 4px 0 14px; display: flex; align-items: center; gap: 8px; }
.empty { text-align: center; color: var(--text-soft); padding: 40px 20px; font-size: 1.05rem; line-height: 1.7; }
.empty-emoji { font-size: 3rem; display: block; margin-bottom: 10px; }
.empty-mini { color: var(--text-soft); text-align: center; padding: 16px; font-size: 0.95rem; }
.spinner { width: 40px; height: 40px; border: 4px solid var(--line); border-top-color: var(--primary); border-radius: 50%; animation: spin 0.8s linear infinite; margin: 0 auto 14px; }
@keyframes spin { to { transform: rotate(360deg); } }
.mini-tag { font-size: 0.72rem; color: var(--text-soft); }

/* ===================================================================
   作文模块
   =================================================================== */
/* 起点：选类型 / 继续未完成 */
.essay-hero { text-align: center; padding: 10px 0 4px; }
.essay-hero-emoji { font-size: 3rem; }
.essay-hero-title { font-size: 1.3rem; font-weight: 900; color: var(--primary-dark); margin: 6px 0; }
.essay-hero-sub { color: var(--text-soft); font-size: 0.95rem; line-height: 1.6; }

.type-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 16px 0; }
.type-card { border: 3px solid var(--line); background: #fff; border-radius: 18px; padding: 18px 12px; text-align: center; cursor: pointer; font-family: inherit; }
.type-card:active { transform: scale(0.97); }
.type-card .tc-emoji { font-size: 2.2rem; }
.type-card .tc-name { font-weight: 800; font-size: 1.05rem; color: var(--text); margin-top: 6px; }
.type-card .tc-desc { font-size: 0.78rem; color: var(--text-soft); margin-top: 3px; }

/* 阶段进度条 */
.phase-bar { display: flex; gap: 6px; margin-bottom: 16px; }
.phase-step { flex: 1; text-align: center; font-size: 0.72rem; font-weight: 800; color: var(--text-soft); padding: 8px 2px; border-radius: 12px; background: #f7efe6; }
.phase-step.active { background: var(--primary); color: #fff; }
.phase-step.done { background: #ffe6c4; color: var(--primary-dark); }

/* 选文体 */
.genre-grid { display: flex; flex-direction: column; gap: 10px; margin: 12px 0; }
.genre-option { text-align: left; border: 3px solid var(--line); background: #fff; border-radius: 16px; padding: 14px 16px; cursor: pointer; font-family: inherit; }
.genre-option:active { transform: scale(0.98); }
.go-label { font-size: 1.15rem; font-weight: 800; color: var(--primary-dark); }
.go-desc { font-size: 0.85rem; color: var(--text-soft); margin-top: 3px; }

/* 换文体建议条 */
.switch-banner { background: #fff0d6; border: 2px solid #ffe0a3; border-radius: 16px; padding: 14px; margin: 12px 0; }
.sb-text { font-size: 1rem; line-height: 1.6; color: var(--text); margin-bottom: 10px; }
.sb-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.sb-actions .btn { flex: 1; min-width: 130px; padding: 10px 12px; font-size: 0.95rem; }

/* 写作小地图 */
.writing-map { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; background: #fff7ee; border-radius: 16px; padding: 12px; }
.map-step { display: flex; flex-direction: column; gap: 2px; padding: 8px 10px; border-radius: 10px; border-left: 4px solid transparent; }
.map-step .map-label { font-size: 0.95rem; font-weight: 800; color: var(--text-soft); }
.map-step .map-content { font-size: 0.85rem; color: var(--text); }
.map-step.done { border-left-color: var(--green); background: #eafbef; }
.map-step.done .map-label { color: var(--green-dark); }
.map-step.active { border-left-color: var(--primary); background: #fff; box-shadow: var(--shadow); }
.map-step.active .map-label { color: var(--primary-dark); }

/* 聊一聊：问题卡 + 可编辑框 */
.chat-title { font-size: 1.25rem; font-weight: 800; margin-bottom: 4px; }
.chat-progress { font-size: 0.85rem; color: var(--text-soft); margin-bottom: 14px; }
.q-bubble { background: #fff7ee; border-radius: 16px 16px 16px 4px; padding: 14px 16px; font-size: 1.15rem; line-height: 1.6; color: var(--text); margin-bottom: 10px; border-left: 4px solid var(--primary); }
.q-followup { background: #fdeede; border-radius: 12px; padding: 10px 14px; font-size: 1rem; color: var(--primary-dark); margin-bottom: 10px; }
.answer-box { width: 100%; border: 3px solid var(--line); border-radius: 16px; padding: 14px 16px; font-size: 1.15rem; line-height: 1.8; font-family: inherit; color: var(--text); outline: none; min-height: 120px; resize: vertical; background: #fff; }
.answer-box:focus { border-color: var(--primary); }
.answer-hint { font-size: 0.82rem; color: var(--text-soft); margin: 8px 0; }
.voice-tip { display: inline-flex; align-items: center; gap: 4px; background: #eef4ff; color: var(--blue); border-radius: 999px; padding: 4px 12px; font-size: 0.8rem; font-weight: 700; }

/* 素材参考清单 */
.material-list { background: #f7efe6; border-radius: 16px; padding: 12px 16px; margin-bottom: 14px; }
.material-list h4 { margin: 0 0 8px; font-size: 0.85rem; color: var(--primary-dark); text-transform: none; }
.material-item { font-size: 0.95rem; line-height: 1.6; padding: 4px 0; border-bottom: 1px dashed var(--line); color: var(--text); }
.material-item:last-child { border-bottom: none; }
.material-item .mi-q { color: var(--text-soft); font-size: 0.8rem; }

/* 写初稿：大框 + 字数统计 */
.draft-box { width: 100%; border: 3px solid var(--line); border-radius: 18px; padding: 16px; font-size: 1.2rem; line-height: 2; font-family: inherit; color: var(--text); outline: none; min-height: 300px; resize: vertical; background: #fff; }
.draft-box:focus { border-color: var(--primary); }
.wordcount-bar { display: flex; align-items: center; justify-content: space-between; margin: 10px 0 4px; font-size: 0.95rem; }
.wordcount-num { font-weight: 900; font-size: 1.3rem; }
.wordcount-num.ok { color: var(--green-dark); }
.wordcount-num.low { color: var(--text-soft); }
.wordcount-num.over { color: var(--accent); }
.wordcount-target { color: var(--text-soft); font-size: 0.88rem; }
.wordcount-track { height: 10px; background: var(--line); border-radius: 999px; overflow: hidden; margin-bottom: 12px; }
.wordcount-fill { height: 100%; background: linear-gradient(90deg, var(--accent), var(--green)); transition: width .3s; }

/* AI 指导卡 */
.guide-card { background: #fffaf3; border-radius: 16px; padding: 16px; border-left: 5px solid var(--purple); margin-bottom: 12px; }
.guide-card h4 { margin: 0 0 8px; font-size: 0.95rem; color: var(--purple); }
.guide-point { font-size: 1rem; line-height: 1.7; padding: 8px 0; border-bottom: 1px dashed var(--line); }
.guide-point:last-child { border-bottom: none; }
.guide-point .gp-icon { margin-right: 6px; }
.draft-readonly { background: #fbf6ef; border-radius: 14px; padding: 14px 16px; font-size: 1.1rem; line-height: 1.9; white-space: pre-wrap; margin-bottom: 12px; }

/* 聊一聊：对话气泡 */
.chat-log { display: flex; flex-direction: column; gap: 10px; margin-bottom: 14px; }
.me-bubble { align-self: flex-end; background: var(--primary); color: #fff; border-radius: 16px 16px 4px 16px; padding: 12px 15px; font-size: 1.08rem; line-height: 1.6; max-width: 85%; word-break: break-word; }

/* 逐段指导 */
.structure-card { border-left-color: var(--blue); }
.para-block { background: #fffaf3; border-radius: 16px; padding: 14px 16px; margin-bottom: 14px; border-left: 5px solid var(--accent); }
.para-head { font-weight: 800; color: var(--primary-dark); font-size: 0.92rem; margin-bottom: 6px; }
.para-text { font-size: 1.1rem; line-height: 1.9; white-space: pre-wrap; word-break: break-word; margin-bottom: 8px; }
.typo-mark { background: #ffe0e0; color: var(--red); border-radius: 4px; padding: 0 2px; text-decoration: underline wavy var(--red); }
.typo-wrap { margin: 6px 0; }
.typo-item { font-size: 0.95rem; color: var(--text); background: #fff0f0; border-radius: 10px; padding: 6px 10px; margin: 4px 0; }
.typo-item b { color: var(--green-dark); }
.para-tip { font-size: 0.98rem; line-height: 1.6; color: var(--text); padding: 5px 0; }
.para-tip.good { color: var(--green-dark); }
.para-edit { margin-top: 8px; padding: 9px; font-size: 0.9rem; }

/* 朗读控制 */
.read-controls { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.read-controls .speak-btn-inline { flex: 1; min-width: 60px; padding: 9px 6px; font-size: 0.92rem; }

/* 列表行 + 删除 */
.essay-row { display: flex; align-items: stretch; gap: 8px; }
.essay-row .essay-item { flex: 1; margin: 0; }
.row-del { flex-shrink: 0; width: 46px; border: none; background: #fff0f0; color: var(--red); border-radius: 14px; font-size: 1.2rem; cursor: pointer; }
.row-del:active { transform: scale(0.94); }

/* 作文列表 */
.essay-list { display: flex; flex-direction: column; gap: 12px; }
.essay-item { background: var(--card); border-radius: 16px; padding: 14px 16px; box-shadow: var(--shadow); display: flex; align-items: center; gap: 12px; cursor: pointer; text-align: left; border: none; font-family: inherit; width: 100%; }
.essay-item:active { transform: scale(0.99); }
.essay-emoji { font-size: 1.7rem; }
.essay-main { flex: 1; min-width: 0; }
.essay-title { font-size: 1.15rem; font-weight: 800; color: var(--primary-dark); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.essay-sub { font-size: 0.82rem; color: var(--text-soft); margin-top: 2px; }
.essay-status { font-size: 0.72rem; font-weight: 800; padding: 3px 9px; border-radius: 999px; background: #fff0d6; color: var(--primary-dark); flex-shrink: 0; }

/* ===================================================================
   背诵模块（沿用 recite）
   =================================================================== */
.big-photo-btn { width: 100%; border: 3px dashed var(--primary); background: #fff7ee; border-radius: 22px; padding: 34px 20px; text-align: center; cursor: pointer; color: var(--primary-dark); font-family: inherit; margin-bottom: 16px; }
.big-photo-btn:active { transform: scale(0.98); }
.big-photo-emoji { font-size: 3.4rem; display: block; margin-bottom: 8px; }
.big-photo-label { font-size: 1.3rem; font-weight: 900; }
.big-photo-sub { font-size: 0.92rem; color: var(--text-soft); margin-top: 6px; }
.type-toggle { display: flex; gap: 10px; margin-bottom: 14px; }
.type-toggle .tbtn { flex: 1; border: 3px solid var(--line); background: #fff; border-radius: 16px; padding: 12px; font-size: 1.05rem; font-weight: 800; cursor: pointer; font-family: inherit; color: var(--text-soft); }
.type-toggle .tbtn.active { border-color: var(--primary); background: #fff7ee; color: var(--primary-dark); }
.title-input { width: 100%; border: 3px solid var(--line); border-radius: 16px; padding: 14px 16px; font-size: 1.1rem; font-family: inherit; color: var(--text); outline: none; background: #fff; }
.title-input:focus { border-color: var(--primary); }
.review-textarea { width: 100%; border: 3px solid var(--line); border-radius: 16px; padding: 14px 16px; font-size: 1.15rem; font-family: inherit; color: var(--text); outline: none; background: #fff; min-height: 220px; line-height: 1.9; resize: vertical; }
.review-textarea:focus { border-color: var(--primary); }
.field-label { font-weight: 800; font-size: 1rem; margin: 14px 0 8px; }

.piece-list { display: flex; flex-direction: column; gap: 12px; }
.piece-item { background: var(--card); border-radius: 16px; padding: 14px 16px; box-shadow: var(--shadow); display: flex; align-items: center; gap: 12px; cursor: pointer; text-align: left; border: none; font-family: inherit; width: 100%; }
.piece-item:active { transform: scale(0.99); }
.piece-emoji { font-size: 1.8rem; flex-shrink: 0; }
.piece-main { flex: 1; min-width: 0; }
.piece-title { font-size: 1.2rem; font-weight: 800; color: var(--primary-dark); }
.piece-sub { font-size: 0.85rem; color: var(--text-soft); margin-top: 2px; }
.piece-right { display: flex; flex-direction: column; align-items: flex-end; gap: 5px; flex-shrink: 0; }
.piece-badge { font-size: 0.72rem; font-weight: 800; padding: 3px 9px; border-radius: 999px; }
.badge-poem { background: #f0eaff; color: var(--purple); }
.badge-prose { background: #e6f2ff; color: var(--blue); }
.badge-review { background: #ffe3e3; color: var(--red); }

/* 我的背诵：搜索框 + 分类分组 */
.lib-search { margin-bottom: 14px; }
.lib-search .title-input { width: 100%; }
.lib-group-title { font-size: 0.9rem; font-weight: 800; color: var(--text-soft); margin: 14px 2px 8px; }
.piece-progress-mini { font-size: 0.72rem; color: var(--text-soft); }
.type-tag { display: inline-block; font-weight: 800; font-size: 0.85rem; padding: 4px 12px; border-radius: 999px; }
.detail-title { font-size: 1.6rem; font-weight: 900; color: var(--primary-dark); margin: 4px 0 6px; }
.back-link { display: inline-flex; align-items: center; gap: 4px; background: #fbeee0; border: none; border-radius: 999px; padding: 8px 16px; font-size: 0.95rem; font-weight: 700; color: var(--text); cursor: pointer; font-family: inherit; margin-bottom: 12px; }
.back-link:active { transform: scale(0.96); }
.full-text { font-size: 1.35rem; line-height: 2.1; white-space: pre-wrap; word-break: break-word; background: #fffaf3; border-radius: 16px; padding: 16px 18px; border-left: 5px solid var(--accent); }
.full-text.poem { text-align: center; font-size: 1.5rem; letter-spacing: 2px; }
.gloss-line { background: #fffaf3; border-radius: 16px; padding: 14px 16px; margin-bottom: 12px; border-left: 5px solid var(--purple); }
.gloss-original { font-size: 1.35rem; font-weight: 800; color: var(--text); margin-bottom: 10px; }
.gloss-original.poem { letter-spacing: 2px; }
.gloss-meaning { font-size: 1.02rem; color: var(--text); line-height: 1.6; margin-top: 8px; background: #fff; border-radius: 10px; padding: 8px 10px; }

/* 逐字对应格 */
.char-grid { display: flex; flex-wrap: wrap; gap: 6px; }
.char-cell { background: #fff; border: 2px solid #efe3d3; border-radius: 12px; padding: 6px 8px; text-align: center; min-width: 44px; }
.char-z { font-size: 1.15rem; font-weight: 900; color: var(--primary-dark); }
.char-arrow { font-size: 0.7rem; color: var(--text-soft); line-height: 1; }
.char-m { font-size: 0.88rem; color: var(--text); }

/* 背景 / 记忆联想 分区 */
.gloss-section { border-radius: 16px; padding: 14px 16px; margin-bottom: 12px; }
.gloss-section.bg-section { background: #eef4ff; border-left: 5px solid var(--blue); }
.gloss-section.mem-section { background: #eafbef; border-left: 5px solid var(--green); }
.gloss-section.word-section { background: #f7f0ff; border-left: 5px solid var(--purple); }
.gloss-section.logic-section { background: #fff7ee; border-left: 5px solid var(--primary); }
.gloss-keys { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.gloss-key { background: #fff; color: var(--text); border-radius: 10px; padding: 5px 10px; font-size: 0.9rem; }
.gloss-key b { color: var(--purple); }
.gloss-label { font-weight: 800; font-size: 0.95rem; margin-bottom: 6px; }
.gloss-body { font-size: 1.02rem; line-height: 1.7; color: var(--text); }

/* 挖字难度 */
.diff-row { display: flex; gap: 8px; margin-top: 12px; }
.diff-chip { flex: 1; border: 2px solid var(--line); background: #fff; border-radius: 12px; padding: 8px; font-size: 0.9rem; font-weight: 800; cursor: pointer; font-family: inherit; color: var(--text-soft); }
.diff-chip.active { border-color: var(--primary); background: #fff7ee; color: var(--primary-dark); }

/* 分类选择 chips */
.cat-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.cat-chip { border: 2px solid var(--line); background: #fff; border-radius: 999px; padding: 5px 12px; font-size: 0.85rem; font-weight: 700; cursor: pointer; font-family: inherit; color: var(--text-soft); }
.cat-chip.active { border-color: var(--primary); background: #fff7ee; color: var(--primary-dark); }

/* 多条核对卡 */
.confirm-card { background: #fffaf3; border-radius: 16px; padding: 14px; margin-bottom: 14px; border: 2px solid var(--line); }
.confirm-card.confirm-incomplete { border-color: var(--red); background: #fff5f2; }
.incomplete-warn { background: #ffecec; color: var(--red); border-radius: 10px; padding: 8px 10px; font-size: 0.85rem; line-height: 1.5; margin-bottom: 8px; }
.confirm-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.confirm-idx { font-weight: 800; color: var(--primary-dark); }
.confirm-meta { display: flex; gap: 8px; margin-bottom: 8px; }
.confirm-meta .title-input { flex: 1; min-width: 0; padding: 10px 12px; font-size: 0.98rem; }
.confirm-card .review-textarea { min-height: 130px; }

/* 分隔"或者" */
.or-divider { text-align: center; color: var(--text-soft); font-size: 0.9rem; margin: 18px 0 12px; position: relative; }
.or-divider::before, .or-divider::after { content: ""; position: absolute; top: 50%; width: 38%; height: 1px; background: var(--line); }
.or-divider::before { left: 0; } .or-divider::after { right: 0; }
.struct-intro { font-size: 0.95rem; color: var(--text-soft); margin-bottom: 12px; line-height: 1.6; }

/* 现代文"跟我走"关卡 */
.skeleton-box { background: #eef4ff; border-left: 5px solid var(--blue); border-radius: 16px; padding: 14px 16px; margin-bottom: 14px; }
.skeleton-item { font-size: 0.95rem; line-height: 1.7; color: var(--text); }
.level-box { background: #fffaf3; border-radius: 16px; padding: 14px 16px; margin-bottom: 12px; border-left: 5px solid var(--accent); }
.level-head { font-weight: 800; color: var(--primary-dark); font-size: 1.05rem; margin-bottom: 6px; }
.level-visual { font-size: 0.95rem; color: var(--text); background: #fff; border-radius: 10px; padding: 8px 10px; margin-bottom: 8px; line-height: 1.6; }
.level-q { font-size: 1.05rem; font-weight: 700; color: var(--text); margin-bottom: 10px; line-height: 1.6; }
.level-show { padding: 9px; font-size: 0.92rem; }
.level-answer { font-size: 1.1rem; line-height: 1.9; color: var(--text); background: #fff; border-radius: 10px; padding: 10px 12px; margin-top: 8px; white-space: pre-wrap; }
.level-kws { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.level-kw { background: #fff0d6; color: var(--primary-dark); border-radius: 999px; padding: 4px 12px; font-size: 0.85rem; font-weight: 700; }
.struct-block { background: #f7faff; border-radius: 16px; padding: 14px 16px; margin-bottom: 12px; border-left: 5px solid var(--blue); }
.struct-clue { display: inline-block; background: var(--blue); color: #fff; font-size: 0.8rem; font-weight: 800; padding: 3px 12px; border-radius: 999px; margin-bottom: 8px; }
.struct-text { font-size: 1.15rem; line-height: 1.8; white-space: pre-wrap; }
.step-tabs { display: flex; gap: 6px; margin-bottom: 16px; flex-wrap: wrap; }
.step-chip { flex: 1; min-width: 66px; border: 2px solid var(--line); background: #fff; border-radius: 14px; padding: 8px 4px; font-size: 0.8rem; font-weight: 800; cursor: pointer; font-family: inherit; color: var(--text-soft); text-align: center; position: relative; }
.step-chip .step-num { display: block; font-size: 1.1rem; }
.step-chip.active { border-color: var(--primary); background: #fff7ee; color: var(--primary-dark); }
.step-chip.done { border-color: var(--green); color: var(--green-dark); }
.step-chip.done::after { content: "✓"; position: absolute; top: 2px; right: 6px; font-size: 0.7rem; }
.recite-question { font-size: 1.3rem; font-weight: 800; margin-bottom: 6px; line-height: 1.5; }
.recite-sub { color: var(--text-soft); font-size: 1rem; margin-bottom: 16px; line-height: 1.5; }
.cloze-text { font-size: 1.4rem; line-height: 2.2; white-space: pre-wrap; word-break: break-word; background: #fffaf3; border-radius: 16px; padding: 18px; text-align: center; letter-spacing: 1px; }
.cloze-text.prose { text-align: left; font-size: 1.3rem; letter-spacing: 0; }
.cloze-blank { display: inline-block; min-width: 1.2em; border-bottom: 3px solid var(--primary); color: transparent; margin: 0 1px; user-select: none; cursor: pointer; }
.cloze-blank.revealed { color: var(--primary-dark); border-bottom-color: var(--green); }
.firsthint-text { font-size: 1.4rem; line-height: 2.2; white-space: pre-wrap; text-align: center; letter-spacing: 2px; background: #fffaf3; border-radius: 16px; padding: 18px; }
.firsthint-text.prose { text-align: left; letter-spacing: 0; font-size: 1.3rem; }
.fh-first { color: var(--primary-dark); font-weight: 900; }
.fh-rest { color: #d8c7b4; }
.recite-actions { margin-top: 20px; display: flex; flex-direction: column; gap: 10px; }
.feedback { text-align: center; font-size: 1.2rem; font-weight: 800; margin: 14px 0; min-height: 30px; }
.feedback.good { color: var(--green-dark); }
.feedback.bad { color: var(--red); }
.speak-btn-inline { background: #fff7ee; border: 2px solid var(--primary); border-radius: 999px; padding: 10px 18px; font-size: 1rem; font-weight: 800; color: var(--primary-dark); cursor: pointer; font-family: inherit; }
.speak-btn-inline:active { transform: scale(0.96); }
.self-check { display: flex; gap: 10px; }
.self-check .btn { flex: 1; }
.review-card { background: var(--card); border-radius: 16px; padding: 16px; box-shadow: var(--shadow); margin-bottom: 12px; display: flex; align-items: center; gap: 12px; }
.review-card .rc-emoji { font-size: 1.8rem; }
.review-card .rc-main { flex: 1; }
.review-card .rc-title { font-size: 1.15rem; font-weight: 800; color: var(--primary-dark); }
.review-card .rc-sub { font-size: 0.82rem; color: var(--text-soft); }
.review-card .rc-stage { font-size: 0.72rem; font-weight: 800; padding: 3px 9px; border-radius: 999px; background: #fff0d6; color: var(--primary-dark); }

/* 复习节奏编辑器 / 作文字数设置 */
.stages-editor { display: flex; flex-direction: column; gap: 8px; margin-top: 6px; }
.stage-row { display: flex; align-items: center; gap: 8px; }
.stage-row .stage-label { font-size: 0.9rem; color: var(--text-soft); min-width: 40px; }
.stage-row input { width: 70px; border: 2px solid var(--line); border-radius: 10px; padding: 8px 10px; font-size: 1rem; font-family: inherit; text-align: center; color: var(--text); outline: none; }
.stage-row input:focus { border-color: var(--primary); }
.stage-del { background: #ffecec; color: var(--red); border: none; border-radius: 10px; width: 34px; height: 34px; font-size: 1rem; cursor: pointer; }
.stage-add { background: #fbeee0; color: var(--text); border: none; border-radius: 12px; padding: 10px; font-weight: 800; cursor: pointer; font-family: inherit; margin-top: 4px; }

/* ===== 弹窗 ===== */
.modal { position: fixed; inset: 0; background: rgba(74,59,45,0.5); display: flex; align-items: center; justify-content: center; z-index: 50; padding: 18px; }
.modal[hidden] { display: none; }
.modal-card { background: var(--card); border-radius: 24px; padding: 24px; width: 100%; max-width: 460px; max-height: 90vh; overflow-y: auto; position: relative; }
.modal-card h2 { margin: 0 0 6px; }
.modal-close { position: absolute; top: 16px; right: 16px; background: #fbeee0; border: none; width: 36px; height: 36px; border-radius: 50%; font-size: 1rem; cursor: pointer; color: var(--text-soft); }
.settings-hint { color: var(--text-soft); font-size: 0.92rem; line-height: 1.6; margin: 6px 0 16px; }
.test-banner { background: #fff0d6; color: var(--primary-dark); border-radius: 12px; padding: 10px 12px; font-size: 0.88rem; font-weight: 700; margin-bottom: 12px; }
.app-version { font-size: 0.8rem; font-weight: 700; color: var(--text-soft); background: #f7efe6; border-radius: 999px; padding: 3px 10px; vertical-align: middle; }
.field { display: block; margin-bottom: 14px; }
.field span { display: block; font-weight: 700; margin-bottom: 6px; font-size: 0.95rem; }
.field input { width: 100%; border: 2px solid var(--line); border-radius: 12px; padding: 12px 14px; font-size: 1rem; outline: none; font-family: inherit; color: var(--text); }
.field input:focus { border-color: var(--primary); }
.settings-actions { display: flex; gap: 10px; margin-top: 8px; }
.settings-actions .btn { flex: 1; }
.settings-status { margin-top: 12px; font-size: 0.95rem; font-weight: 700; min-height: 22px; }
.settings-status.ok { color: var(--green-dark); }
.settings-status.err { color: var(--red); }
.settings-divider { border: none; border-top: 1px solid var(--line); margin: 20px 0; }
.settings-danger summary, .settings-config summary { font-weight: 700; cursor: pointer; color: var(--text-soft); }
.danger-row { display: flex; gap: 10px; margin: 12px 0; }
.danger-row .btn { flex: 1; }
.field-hint { display: block; color: var(--text-soft); font-size: 0.78rem; margin-top: 4px; line-height: 1.4; }
.preset-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.preset-chip { border: 2px solid var(--line); background: #fff; color: var(--primary-dark); border-radius: 999px; padding: 5px 12px; font-size: 0.82rem; font-weight: 700; cursor: pointer; font-family: inherit; }
.preset-chip:active { transform: scale(0.95); }
.wish-input { display: block; width: 100%; border: 2px solid var(--line); border-radius: 12px; padding: 10px 12px; font-size: 1rem; font-family: inherit; color: var(--text); outline: none; margin-bottom: 4px; }
.wish-input:focus { border-color: var(--primary); }

/* ===== busy overlay ===== */
.busy-overlay { position: fixed; inset: 0; background: rgba(74,59,45,0.55); display: flex; align-items: center; justify-content: center; z-index: 70; }
.busy-overlay[hidden] { display: none; }
.busy-card { background: #fff; border-radius: 22px; padding: 28px 34px; text-align: center; box-shadow: 0 12px 40px rgba(0,0,0,0.2); }
.busy-text { font-weight: 800; color: var(--text); margin-top: 6px; }

/* ===== toast & celebrate ===== */
.toast { position: fixed; bottom: 100px; left: 50%; transform: translateX(-50%); background: var(--text); color: #fff; padding: 12px 22px; border-radius: 999px; font-weight: 700; font-size: 1rem; z-index: 60; box-shadow: var(--shadow); animation: toastIn .25s; max-width: 90%; text-align: center; }
.toast[hidden] { display: none; }
.toast.score { background: var(--green-dark); }
@keyframes toastIn { from { opacity: 0; transform: translate(-50%, 12px); } }
.celebrate { position: fixed; inset: 0; z-index: 55; pointer-events: none; display: flex; align-items: center; justify-content: center; }
.celebrate[hidden] { display: none; }
.celebrate-card { background: #fff; border-radius: 24px; padding: 30px 36px; text-align: center; box-shadow: 0 12px 40px rgba(0,0,0,0.2); pointer-events: auto; animation: pop .4s; max-width: 90%; }
.celebrate-emoji { font-size: 4rem; }
.celebrate-title { font-size: 1.6rem; font-weight: 900; margin: 8px 0; color: var(--primary-dark); }
.celebrate-sub { color: var(--text-soft); font-size: 1.1rem; }
@keyframes pop { from { transform: scale(0.6); opacity: 0; } }
.confetti { position: fixed; width: 12px; height: 12px; top: -20px; z-index: 54; animation: fall linear forwards; }
@keyframes fall { to { transform: translateY(110vh) rotate(720deg); opacity: 0.9; } }
.parent-star-bar { display: flex; align-items: center; gap: 8px; background: #fff7ee; border-radius: 14px; padding: 12px 14px; margin-top: 8px; flex-wrap: wrap; }
.parent-star-bar .psb-label { font-size: 0.88rem; color: var(--text-soft); flex-basis: 100%; }
