body { margin:0; 
  background: linear-gradient(135deg, #FFF5E6 0%, #FFE8E8 40%, #FFF0E0 70%, #FFE4F0 100%);
  min-height: 100vh;
  min-height: 100dvh; /* 移动端动态视口：地址栏伸缩时跟随真实可见高度 */
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding-bottom: calc(108px + env(safe-area-inset-bottom, 0px));
}
/* 横屏沉浸模式 */
.page.landscape {
  padding-bottom: 0;
  background: #FFFBF5;
}
.page.landscape .main-area {
  padding: 4px 16px 0;
  justify-content: flex-start;
}
.page.landscape .sentence-card {
  padding: 8px 12px;
  background: rgba(255,255,255,0.85);
  box-shadow: 0 2px 8px rgba(200,150,120,0.06);
}
.page.landscape .char-item {
  font-size: 60px;
}
.page.landscape .pinyin-label {
  font-size: 17px;
}
.page.landscape .char-row {
  min-height: 90px;
  gap: 10px;
}
.page.landscape .trans-line {
  font-size: 14px;
  margin-top: 6px;
}

/* Top Bar */
.top-bar { padding: 10px 16px 6px; background: rgba(255,255,255,0.55); border-bottom: 1px solid rgba(255,200,150,0.3); flex-shrink: 0; }
.top-title { display: block; font-size: 16px; font-weight: 700; color: #5A4030; text-align: center; margin-bottom: 4px; letter-spacing: 2px; }
.progress-wrap { display: flex; align-items: center; gap: 8px; padding: 2px 0; }
.progress-text { font-size: 12px; color: #B8957A; white-space: nowrap; min-width: 40px; text-align: right; font-weight: 600; flex-shrink: 0; }
.progress-slider { flex: 1; margin: 0; }
.category-scroll { white-space: nowrap; padding: 4px 0; display: flex; }
.cat-btn { display: inline-block; padding: 4px 14px; margin-right: 6px; border-radius: 49.5px; font-size: 12px; font-weight: 600; background: rgba(255,255,255,0.5); color: #A08070; flex-shrink: 0; }
.cat-btn.active { background: linear-gradient(135deg, #FF9A9E, #FAD0C4); color: #fff; }

/* Main */
.main-area { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 24px 20px 16px; width: 100%; overflow: hidden; box-sizing: border-box; }
.sentence-card { width: 100%; background: rgba(255,255,255,0.55); border-radius: 32px; padding: 18px 18px 18px; box-shadow: 0 8px 32px rgba(200,150,120,0.12); text-align: center; position: relative; border: 1px solid rgba(255,255,255,0.6); }
/* 每个字的田字格 */
.char-box.mizige-bg {
  border: 1px solid rgba(180,150,120,0.35);
  background-image:
    linear-gradient(to right, rgba(180,150,120,0.35), rgba(180,150,120,0.35)),
    linear-gradient(to bottom, rgba(180,150,120,0.35), rgba(180,150,120,0.35));
  background-size: 1px 100%, 100% 1px;
  background-position: center 0, 0 center;
  background-repeat: no-repeat;
  padding: 3px 5px;
  border-radius: 2px;
}
/* 正在朗读的字：田字格线条更深 */
.char-box.mizige-active {
  border-color: rgba(180,150,120,0.6) !important;
  background-image:
    linear-gradient(to right, rgba(180,150,120,0.6), rgba(180,150,120,0.6)),
    linear-gradient(to bottom, rgba(180,150,120,0.6), rgba(180,150,120,0.6)) !important;
  background-size: 1px 100%, 100% 1px !important;
  background-position: center 0, 0 center !important;
  background-repeat: no-repeat !important;
}
.sentence-card.game-mode { background: rgba(255,248,240,0.7); }
.sentence-card.paragraph-mode { background: none; box-shadow: none; border: none; padding: 0; }
.char-row { display: flex; justify-content: center; gap: 12px; flex-wrap: wrap; min-height: 70px; align-items: center; }
/* 智能排版：每行固定 N 字（标点不计数）——nowrap 块内不拆行，块间由 char-row 换行 */
.phrase-block { display: inline-flex; align-items: center; gap: 12px; flex-wrap: nowrap; }
/* 标点：紧贴前一个字（负边距抵消 gap），不再单独占格/出现在行首 */
.char-punct { font-size: 0.92em; color: #B8957A; margin-left: -10px; flex-shrink: 0; line-height: 1; }
.char-punct.lead { margin-left: 0; }
.char-item { font-size: 55px; font-weight: 900; line-height: 1.2; }
.char-item.blanked { color: #E8837A !important; }

/* Translation line */
.trans-line {
  font-size: 15px;
  color: #8B7355;
  margin-top: 14px;
  padding: 7px 16px;
  background: rgba(255,235,210,0.5);
  border-radius: 12px;
  display: inline-block;
  font-weight: 600;
  letter-spacing: 3px;
}

.fav-btn { position: absolute; top: 8px; left: 12px; font-size: 24px; z-index: 20; padding: 4px; }
.char-box { display: inline-flex; flex-direction: column; align-items: center; }

/* Pinyin */
.pinyin-label { font-size: 16px; color: #B8957A; line-height: 1.3; margin-bottom: 2px; white-space: nowrap; display: block; }

/* Multi-sentence */
.sentence-scroll { flex: 1; width: 100%; box-sizing: border-box; }
.sentence-scroll .sentence-card { align-items: flex-start; }
.sentence-row { background: rgba(255,255,255,0.45); border-radius: 20px; padding: 16px 20px; margin-bottom: 10px; border: 1px solid rgba(255,255,255,0.5); position: relative; }
/* Auto-play compressed levels */
/* Level 1 - 轻度压缩 */
.main-area.compress-1 { padding: 16px 20px 20px; }
.main-area.compress-1 .para-trans { padding: 10px 16px 0; }
.main-area.compress-1 .sentence-row { padding: 12px 16px; margin-bottom: 6px; }
.main-area.compress-1 .sentence-row .char-item { font-size: 36px !important; }
.main-area.compress-1 .pinyin-label { font-size: 14px; }
.main-area.compress-1 .char-row { min-height: 70px; gap: 9px; }
.main-area.compress-1 .trans-line { margin-top: 8px; padding: 6px 12px; font-size: 13px; }
.compress-1 .char-item { font-size: 60px !important; }
.compress-1 .sentence-row .char-item { font-size: 36px !important; }
.compress-1 .pinyin-label { font-size: 14px; }
.compress-1 .sentence-row { padding: 12px 16px; margin-bottom: 6px; }
.compress-1 .trans-line { margin-top: 8px; padding: 6px 12px; font-size: 13px; }
.compress-1.sentence-card { padding: 24px 20px 24px; }
.compress-1 .char-row { min-height: 70px; gap: 9px; }

/* Level 2 - 中度压缩 */
.main-area.compress-2 { padding: 12px 16px 16px; }
.main-area.compress-2 .para-trans { padding: 7px 12px 0; }
.main-area.compress-2 .sentence-row { padding: 9px 14px; margin-bottom: 4px; }
.main-area.compress-2 .sentence-row .char-item { font-size: 30px !important; }
.main-area.compress-2 .pinyin-label { font-size: 12px; }
.main-area.compress-2 .char-row { min-height: 50px; gap: 7px; }
.main-area.compress-2 .trans-line { margin-top: 6px; padding: 4px 10px; font-size: 12px; }
.compress-2 .char-item { font-size: 45px !important; }
.compress-2 .sentence-row .char-item { font-size: 30px !important; }
.compress-2 .pinyin-label { font-size: 12px; }
.compress-2 .sentence-row { padding: 9px 14px; margin-bottom: 4px; }
.compress-2 .trans-line { margin-top: 6px; padding: 4px 10px; font-size: 12px; }
.compress-2.sentence-card { padding: 14px 16px 18px; }
.compress-2 .char-row { min-height: 50px; gap: 7px; }

/* Level 3 - 高度压缩 */
.main-area.compress-3 { padding: 8px 12px 12px; }
.main-area.compress-3 .para-trans { padding: 5px 8px 0; }
.main-area.compress-3 .sentence-row { padding: 6px 10px; margin-bottom: 3px; }
.main-area.compress-3 .sentence-row .char-item { font-size: 24px !important; }
.main-area.compress-3 .pinyin-label { font-size: 10px; }
.main-area.compress-3 .char-row { min-height: 40px; gap: 5px; }
.main-area.compress-3 .trans-line { margin-top: 4px; padding: 3px 8px; font-size: 11px; }
.compress-3 .char-item { font-size: 36px !important; }
.compress-3 .sentence-row .char-item { font-size: 24px !important; }
.compress-3 .pinyin-label { font-size: 10px; }
.compress-3 .sentence-row { padding: 6px 10px; margin-bottom: 3px; }
.compress-3 .trans-line { margin-top: 4px; padding: 3px 8px; font-size: 11px; }
.compress-3.sentence-card { padding: 10px 12px 14px; }
.compress-3 .char-row { min-height: 40px; gap: 5px; }
.sentence-row.active-row { background: #FFF0E0 !important; border-left: 5px solid #FF6B6B !important; margin: 4px 0; border-radius: 8px; box-shadow: 0 0 10px rgba(255,107,107,0.2); }
.sentence-row .char-row { min-height: auto; }
.sentence-row .char-item { font-size: 40px; }

/* Game */
.game-options { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-top: 20px; padding-top: 16px; border-top: 2px dashed rgba(200,160,120,0.2); }
.game-opt-btn { padding: 10px 22px; border-radius: 16px; border: 2.5px solid #E8D5C0; font-size: 36px; font-weight: 700; background: rgba(255,255,255,0.7); min-width: 60px; text-align: center; }
.game-opt-btn.correct { border-color: #4CAF50; background: #E8F5E9; color: #2E7D32; }
.game-opt-btn.wrong { border-color: #F44336; background: #FFEBEE; color: #C62828; }
.game-feedback { font-size: 16px; font-weight: 600; margin-top: 12px; min-height: 24px; }

/* Bottom Controls - 两层结构 */
.bottom-section { position: fixed; bottom: 0; left: 0; right: 0; z-index: 10; padding-bottom: env(safe-area-inset-bottom, 0px); }
.bottom-scroll { width: 100%; white-space: nowrap; background: linear-gradient(135deg, #FFF5E6 0%, #FFE8E8 40%, #FFF0E0 70%, #FFE4F0 100%); }
.bottom-controls { display: inline-flex; flex-direction: row; align-items: center; gap: 8px; padding: 7px 10px 18px; }
/* 扩展栏（展开时在常用按钮上方） */
.more-scroll { width: 100%; white-space: nowrap; background: rgba(255,245,235,0.92); }
.more-controls { display: inline-flex; flex-direction: row; align-items: center; gap: 7px; padding: 5px 10px; border-bottom: 1px solid rgba(200,160,120,0.15); }
.ctrl-btn { width: 48px; height: 48px; min-width: 48px; border-radius: 50%; display: inline-flex; flex-direction: column; align-items: center; justify-content: center; box-shadow: 0 3px 12px rgba(0,0,0,0.08); color: #fff; gap: 1px; flex-shrink: 0; vertical-align: middle; border: 1.5px solid transparent; transition: all 0.2s ease; }
.ctrl-btn.active { border-color: rgba(255,255,255,0.6); box-shadow: 0 3px 14px rgba(0,0,0,0.18); transform: scale(1.05); }
.ctrl-btn .label { font-size: 11px; font-weight: 700; white-space: nowrap; letter-spacing: 1px; }
.ctrl-btn.prev { background: linear-gradient(135deg, #A8D8EA, #C3E8F5); }
.ctrl-btn.speak { width: 55px; height: 55px; min-width: 55px; background: linear-gradient(135deg, #FF9A9E, #FAD0C4); }
.ctrl-btn.next { background: linear-gradient(135deg, #FFD1A9, #FFB88C); }
.ctrl-btn.game-toggle { background: linear-gradient(135deg, #C9B1FF, #A78BEA); }
.ctrl-btn.trans-btn { background: linear-gradient(135deg, #A8E6CF, #6BCB77); }
.ctrl-btn.trans-btn.active { background: linear-gradient(135deg, #20C997, #0D8C6B); }
.ctrl-btn.pinyin-btn { background: linear-gradient(135deg, #85D8E6, #5AB8D0); }
.ctrl-btn.pinyin-btn.active { background: linear-gradient(135deg, #3498DB, #2980B9); }
.ctrl-btn.auto-btn { background: linear-gradient(135deg, #FF6B6B, #FF8E53); }
.ctrl-btn.auto-btn.playing { background: linear-gradient(135deg, #51CF66, #20C997); }
.ctrl-btn.set-btn { background: linear-gradient(135deg, #D0C0E0, #B8A0D0); }
.ctrl-btn.fav-view { background: linear-gradient(135deg, #FFB3BA, #FF8A9E); }
.ctrl-btn.define-btn { background: linear-gradient(135deg, #F5C6A0, #E8A87C); }
.ctrl-btn.define-btn.active { background: linear-gradient(135deg, #FF8C42, #E06A2B); }
.ctrl-btn.pick-btn { background: linear-gradient(135deg, #FFD700, #FFA500); }

/* 横屏悬浮操作栏 */
.land-dots { position: fixed; right: 16px; bottom: 12px; z-index: 400; width: 22px; height: 22px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 900; color: #A08070; background: rgba(255,255,255,0.7); box-shadow: 0 2px 6px rgba(0,0,0,0.10); border: 1px solid rgba(255,255,255,0.8); }
.land-float-bar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 400; box-shadow: 0 -4px 16px rgba(0,0,0,0.08); }
.land-float-bar .bottom-controls { padding: 4px 6px 6px; justify-content: center; width: 100%; box-sizing: border-box; gap: 5px; }
.land-float-bar .more-controls { justify-content: center; width: 100%; box-sizing: border-box; gap: 5px; padding: 3px 6px; }
/* 横屏悬浮栏按钮缩小一倍（rpx 在横屏按长边换算，半尺寸才接近竖屏视觉大小） */
.land-float-bar .ctrl-btn { width: 24px; height: 24px; min-width: 24px; border-width: 1px; }
.land-float-bar .ctrl-btn.speak { width: 28px; height: 28px; min-width: 28px; }
.land-float-bar .ctrl-btn .label { font-size: 5.5px; letter-spacing: 0; }
.ctrl-btn.more-btn { background: linear-gradient(135deg, #B0BEC5, #90A4AE); }
.playing-tag { display: inline-block; font-size: 14px; margin-right: 6px; color: #FF6B6B; vertical-align: middle; animation: playingBounce 0.6s ease-in-out infinite; }
@keyframes playingBounce { 0%,100% { opacity: 1; } 50% { opacity: 0.4; } }

/* Panel */
.panel-overlay { position: fixed; inset: 0; z-index: 100; background: rgba(0,0,0,0.25); display: flex; align-items: flex-end; justify-content: center; opacity: 0; pointer-events: none; }
.panel-overlay.show { opacity: 1; pointer-events: auto; }
.panel-content { width: 100%; max-height: 70vh; max-height: 70dvh; overflow-y: auto; background: #FFFBF7; border-radius: 28px 28px 0 0; padding: 24px 20px calc(32px + env(safe-area-inset-bottom, 0px)); box-shadow: 0 -8px 32px rgba(0,0,0,0.08); }
.panel-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.panel-title { font-size: 18px; color: #7A6045; font-weight: 700; }
.panel-close { width: 36px; height: 36px; border-radius: 50%; background: rgba(0,0,0,0.05); font-size: 20px; display: flex; align-items: center; justify-content: center; color: #8A7560; }
.fav-list { display: flex; flex-direction: column; gap: 10px; }
.fav-item { display: flex; justify-content: space-between; align-items: center; padding: 12px 16px; background: rgba(255,235,220,0.4); border-radius: 14px; border: 1px solid rgba(255,200,150,0.2); }
.fav-item .chars { font-size: 20px; font-weight: 600; }
.goto-btn { padding: 6px 14px; border-radius: 49.5px; background: linear-gradient(135deg, #FF9A9E, #FAD0C4); color: #fff; font-size: 12px; font-weight: 600; }
.fav-empty { text-align: center; color: #B8957A; padding: 32px 0; font-size: 15px; }

/* Text Picker */
.text-list { display: flex; flex-direction: column; gap: 10px; }
.text-item { padding: 16px; background: rgba(255,240,225,0.5); border-radius: 14px; border: 1.5px solid rgba(255,180,120,0.2); }
.text-item.active { border-color: #FF9A9E; background: rgba(255,232,232,0.5); }
.text-item-title { display: block; font-size: 18px; font-weight: 700; color: #5A4030; margin-bottom: 3px; }
.text-item-desc { display: block; font-size: 13px; color: #8B7355; margin-bottom: 2px; }
.text-item-author { display: block; font-size: 12px; color: #A08070; text-align: right; }

/* Settings */
.settings-body { display: flex; flex-direction: column; gap: 16px; }
.settings-group { display: flex; flex-direction: column; gap: 6px; }
.settings-label { font-size: 14px; font-weight: 600; color: #7A6050; }
.settings-options { display: flex; gap: 8px; flex-wrap: wrap; }
.settings-opt { padding: 6px 16px; border-radius: 12px; border: 2px solid #E0D0C0; font-size: 14px; font-weight: 600; background: rgba(255,255,255,0.6); color: #7A6050; }
.settings-opt.active { border-color: #FF9A9E; background: #FFE8E8; color: #E06050; }

/* Loop */
.loop-info { display: flex; flex-direction: column; gap: 3px; margin-top: 4px; padding: 6px 10px; background: rgba(255,240,220,0.5); border-radius: 8px; }
.loop-text { font-size: 12px; color: #A08070; }

/* Loop Panel */
.loop-body { display: flex; flex-direction: column; gap: 16px; }
.loop-section { display: flex; flex-direction: column; gap: 8px; }
.loop-section-title { font-size: 14px; font-weight: 600; color: #7A6050; }
.loop-cat-list { display: flex; flex-wrap: wrap; gap: 8px; }
.loop-cat-item { display: inline-flex; flex-direction: column; align-items: center; padding: 8px 12px; border-radius: 12px; border: 2px solid #E0D0C0; background: rgba(255,255,255,0.6); min-width: 70px; }
.loop-cat-item.selected { border-color: #FF9A9E; background: #FFE8E8; }
.loop-cat-name { font-size: 13px; font-weight: 600; color: #7A6050; }
.loop-cat-range { font-size: 10px; color: #B8957A; margin-top: 2px; }
.loop-sentence-add { display: flex; justify-content: center; }
.loop-add-btn { padding: 8px 20px; border-radius: 12px; border: 2px dashed #E0D0C0; font-size: 14px; font-weight: 600; color: #7A6050; background: rgba(255,255,255,0.6); }
.loop-selected-list { display: flex; flex-wrap: wrap; gap: 6px; }
.loop-selected-item { padding: 5px 12px; border-radius: 8px; background: rgba(255,232,232,0.6); font-size: 12px; color: #7A6050; border: 1px solid #FF9A9E; }
.loop-clear-btn { text-align: center; padding: 6px; font-size: 13px; color: #E06050; text-decoration: underline; }
.loop-confirm-bar { display: flex; justify-content: center; margin-top: 8px; }
.loop-confirm-btn { padding: 10px 40px; border-radius: 16px; background: linear-gradient(135deg, #FF9A9E, #FAD0C4); color: #fff; font-size: 16px; font-weight: 700; }
.loop-panel-content { z-index: 102; }
.settings-panel-content { z-index: 101; }

/* Definition Panel */
.def-panel-content { max-height: 85vh; padding: 20px 20px 32px; }
.def-char-display { text-align: center; font-size: 90px; font-weight: 900; color: #333; line-height: 1.2; margin-bottom: 8px; }
.def-char-row { display: flex; align-items: center; justify-content: center; gap: 24px; margin-bottom: 8px; }
.def-char-row .def-char-display { margin-bottom: 0; }

/* Pronunciation button in definition panel */
.def-pronounce-row { display: flex; justify-content: center; margin: 6px 0 4px; }
.def-pronounce-btn { display: inline-flex; align-items: center; gap: 6px; padding: 8px 20px; border-radius: 49.5px; background: linear-gradient(135deg, #FF9A9E, #FAD0C4); box-shadow: 0 2px 8px rgba(255,154,158,0.3); }
.def-pronounce-btn.playing { background: linear-gradient(135deg, #E06050, #FF8C42); }
.def-pronounce-icon { font-size: 18px; }
.def-pronounce-label { font-size: 14px; font-weight: 700; color: #fff; }
.def-stroke-wrap { display: flex; flex-direction: column; align-items: center; gap: 3px; }
.def-stroke-img { width: 108px; height: 108px; background: #fff; border-radius: 8px; border: 1px solid rgba(200,160,120,0.25); }
.def-stroke-box { width: 108px; height: 108px; background: #fff; border-radius: 8px; border: 1px solid rgba(200,160,120,0.25); display: flex; align-items: center; justify-content: center; overflow: hidden; }
.def-stroke-label { font-size: 11px; color: #B8957A; font-weight: 600; }
.def-source-tag { text-align: center; font-size: 12px; color: #B8957A; margin-bottom: 8px; background: rgba(255,245,235,0.8); display: inline-block; padding: 3px 12px; border-radius: 49.5px; align-self: center; }
.def-debug { text-align: center; font-size: 11px; color: #C0392B; margin: 0 0 6px; padding: 4px 10px; background: #FDF3F0; border-radius: 6px; line-height: 1.5; }
.def-loading { text-align: center; padding: 40px 0; color: #B8957A; font-size: 15px; }
.def-scroll { max-height: 50vh; }
.def-item { background: rgba(255,245,235,0.6); border-radius: 12px; padding: 12px 16px; margin-bottom: 10px; border: 1px solid rgba(255,200,150,0.2); }
.def-item-title { display: block; font-weight: 700; color: #7A6045; margin-bottom: 4px; font-size: 14px; line-height: 1.4; }
.def-item-text { display: block; font-size: 14px; color: #666; line-height: 1.8; }
.def-links { text-align: center; margin-top: 12px; }
.def-source-link { font-size: 13px; color: #4D96FF; }

/* Confetti */
.confetti-canvas { position: fixed; inset: 0; z-index: 999; pointer-events: none; }

/* 横屏自动播放滑入动画 */
@keyframes landRise1 {
  from { transform: translateY(30px); opacity: 0.3; }
  to { transform: translateY(0); opacity: 1; }
}
@keyframes landRise2 {
  from { transform: translateY(30px); opacity: 0.3; }
  to { transform: translateY(0); opacity: 1; }
}
.land-rise-1 {
  animation: landRise1 0.5s ease-out;
}
.land-rise-2 {
  animation: landRise2 0.5s ease-out;
}


/* ===== 桌面版适配 ===== */
html, body { height: 100%; overflow: hidden; }
body {
  display: flex; justify-content: center; align-items: center;
  background: #FFF5E6;
}
.page {
  width: 100%; max-width: 640px; height: 100vh;
  height: 100dvh; /* 移动端动态视口 */
  position: relative; overflow: hidden;
  background: linear-gradient(135deg, #FFF5E6 0%, #FFE8E8 40%, #FFF0E0 70%, #FFE4F0 100%);
}
/* 隐藏微信 slider 样式，用原生 range */
.progress-slider { width: 100%; }
.category-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.bottom-section { position: absolute; bottom: 0; left: 0; right: 0; }
.panel-overlay { position: absolute; }
.confetti-canvas { position: absolute; }
.land-dots, .land-float-bar { position: absolute; }
/* 桌面 hover 反馈 */
.ctrl-btn { cursor: pointer; }
.ctrl-btn:active { transform: scale(0.95); }
.settings-opt, .loop-cat-item, .loop-add-btn, .goto-btn, .text-item, .loop-confirm-btn, .panel-close { cursor: pointer; }
/* 多句模式简译居中（2026-08-15 老陈反馈修复） */
.para-trans { text-align: center; }
/* 底部按钮居中（2026-08-15 老陈反馈修复） */
.bottom-controls, .more-controls { display: flex; justify-content: center; width: 100%; box-sizing: border-box; }
