/* ===== 单词大冲关 WordRush 样式 ===== */
* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
:root {
  /* iPhone 刘海/灵动岛/Home Indicator、iPad 圆角与状态栏。
     standalone 模式下 env() 不可靠，由 JS 动态测量覆盖。
     桌面/普通浏览器下 env() 返回 0，退化为普通边距。 */
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
}
html, body { height: 100%; overflow: hidden; }
html, body, #app { height: 100%; height: 100dvh; } /* iOS 地址栏伸缩时 100% 不准，dvh 是唯一可靠的动态视口单位 */
body {
  font-family: "Comic Sans MS", "Chalkboard SE", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: linear-gradient(160deg, #667eea 0%, #764ba2 100%);
  color: #333;
  user-select: none;
  -webkit-user-select: none;
  /* 去掉 iOS 点击灰色高亮（上面 * 已做），并禁用双击缩放延迟 */
  touch-action: manipulation;
}
#app { width: 100%; height: 100%; position: relative; }

/* ===== 通用 ===== */
.screen { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: calc(16px + var(--safe-top)) calc(16px + var(--safe-right)) calc(16px + var(--safe-bottom)) calc(16px + var(--safe-left)); animation: fadeIn .35s ease; overflow-x: hidden; overflow-y: auto; justify-content: safe center; }
@keyframes fadeIn { from { opacity: 0; transform: scale(.98); } to { opacity: 1; transform: scale(1); } }
@keyframes pop { 0% { transform: scale(.6); opacity: 0; } 70% { transform: scale(1.08); } 100% { transform: scale(1); opacity: 1; } }
@keyframes shake { 0%,100% { transform: translateX(0); } 20% { transform: translateX(-8px); } 40% { transform: translateX(8px); } 60% { transform: translateX(-5px); } 80% { transform: translateX(5px); } }
@keyframes floaty { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }
@keyframes confettiFall { 0% { transform: translateY(-10vh) rotate(0deg); opacity: 1; } 100% { transform: translateY(105vh) rotate(720deg); opacity: 0; } }

.card { background: #fff; border-radius: 24px; padding: 22px; box-shadow: 0 10px 30px rgba(0,0,0,.22); }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: none; border-radius: 999px; padding: 14px 30px; font-size: 22px; font-weight: 700;
  color: #fff; cursor: pointer; background: linear-gradient(135deg, #ff9a56, #ff6a3d);
  box-shadow: 0 6px 0 rgba(0,0,0,.18); transition: transform .08s, box-shadow .08s;
  font-family: inherit; min-height: 52px;
}
.btn:active { transform: translateY(4px); box-shadow: 0 2px 0 rgba(0,0,0,.18); }
.btn.primary { background: linear-gradient(135deg, #4facfe, #00c6fb); }
.btn.green { background: linear-gradient(135deg, #43e97b, #38c172); }
.btn.gold { background: linear-gradient(135deg, #f6d365, #fda085); }
.btn.purple { background: linear-gradient(135deg, #a18cd1, #8e6bd8); }
.btn.ghost { background: rgba(255,255,255,.25); box-shadow: none; }
.modal-box .btn.ghost { background: #f0f0f0; color: #555; box-shadow: none; }
.card .btn.ghost { color: #555; background: rgba(0,0,0,.08); }
.card .btn.ghost:active { background: rgba(0,0,0,.16); }
.btn.small { padding: 8px 18px; font-size: 17px; min-height: 40px; }
.btn:disabled { filter: grayscale(.7); opacity: .6; cursor: not-allowed; }

.title { font-size: clamp(34px, 7vw, 56px); color: #fff; text-shadow: 0 4px 0 rgba(0,0,0,.2); font-weight: 900; letter-spacing: 2px; }
.subtitle { color: rgba(255,255,255,.92); font-size: 18px; margin-top: 6px; }

/* ===== 首页（档案选择） ===== */
.home-box { display: flex; flex-direction: column; align-items: center; gap: 18px; width: min(560px, 94vw); }
.logo { font-size: 64px; animation: floaty 3s ease-in-out infinite; }
.profile-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 14px; width: 100%; margin-top: 6px; }
.profile-card {
  background: #fff; border-radius: 20px; padding: 14px 8px; text-align: center; cursor: pointer;
  box-shadow: 0 6px 16px rgba(0,0,0,.18); transition: transform .1s; position: relative;
}
.profile-card:hover { transform: scale(1.05); }
.profile-card.active { outline: 4px solid #ffd93d; }
.profile-card .avatar { font-size: 44px; }
.profile-card .pname { font-size: 16px; font-weight: 700; margin-top: 4px; }
.profile-card .pmeta { font-size: 12px; color: #888; }
.profile-card .del { position: absolute; top: 4px; right: 8px; font-size: 16px; color: #e05; cursor: pointer; }
.add-card { background: rgba(255,255,255,.85); border: 3px dashed #aaa; display: flex; align-items: center; justify-content: center; font-size: 44px; color: #888; }
.home-row { display: flex; gap: 12px; flex-wrap: wrap; justify-content: center; }

/* ===== 地图（章节选择） ===== */
.map-wrap { width: min(720px, 96vw); max-height: 92vh; overflow-y: auto; padding: 6px; scrollbar-width: none; -ms-overflow-style: none; }
.map-wrap::-webkit-scrollbar { display: none; }
.map-stage { margin-bottom: 18px; }
.map-stage h2 { color: #fff; font-size: 22px; text-shadow: 0 2px 0 rgba(0,0,0,.25); margin-bottom: 10px; display: flex; align-items: center; gap: 8px; }
.chapter-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.chapter-card {
  background: #fff; border-radius: 18px; padding: 14px 10px; text-align: center; cursor: pointer;
  box-shadow: 0 6px 14px rgba(0,0,0,.18); transition: transform .1s; position: relative; min-height: 92px;
}
.chapter-card:hover { transform: scale(1.04); }
.chapter-card.locked { filter: grayscale(1); opacity: .55; cursor: not-allowed; }
.chapter-card .cnum { font-size: 26px; }
.chapter-card .cname { font-size: 16px; font-weight: 700; margin-top: 2px; }
.chapter-card .cmeta { font-size: 12px; color: #888; }
.chapter-card .best { position: absolute; top: 6px; right: 8px; font-size: 13px; font-weight: 800; color: #f90; }
.badge-verify { position: absolute; top: 6px; left: 8px; background: #4facfe; color: #fff; font-size: 11px; border-radius: 999px; padding: 2px 8px; }
.map-top { display: flex; align-items: center; justify-content: flex-start; flex-wrap: wrap; gap: 8px; width: 100%; margin-bottom: 10px; }
.map-top .btn { padding: 8px 14px; font-size: 15px; white-space: nowrap; flex: 0 0 auto; }
.map-top .profile-name { white-space: nowrap; color: #fff; }
/* 返回按钮居左，其余按钮被 margin auto 推到右侧 */
.map-top .btn[data-act="back"] { margin-right: auto; }

/* ===== 地图 Tab 栏（默认课程 / 外研-剑桥三上） ===== */
.map-tabs { display: flex; gap: 8px; width: 100%; margin-bottom: 12px; }
.map-tab { flex: 1; border: none; background: rgba(255,255,255,.14); color: #fff; font-weight: 800; font-size: 15px; padding: 10px 8px; border-radius: 14px; cursor: pointer; font-family: inherit; transition: background .15s, transform .1s; }
.map-tab.on { background: #ffc107; color: #6b4a00; box-shadow: 0 4px 12px rgba(255,193,7,.35); }
.map-tab:active { transform: scale(.97); }

/* ===== 外研-剑桥 tab 大入口卡（指令乐园 / 电子教材） ===== */
.join3a-entry { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; margin-bottom: 18px; }
.entry-card { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; border: none; border-radius: 18px; padding: 16px; text-align: left; cursor: pointer; font-family: inherit; color: #fff; box-shadow: 0 8px 20px rgba(0,0,0,.25); transition: transform .12s; }
.entry-card:active { transform: scale(.97); }
.entry-card.cmd { background: linear-gradient(135deg, #ff6a3d, #ff9a3d); }
.entry-card.ebook { background: linear-gradient(135deg, #667eea, #764ba2); }
.entry-card .ec-ico { font-size: 30px; }
.entry-card .ec-name { font-size: 19px; font-weight: 800; }
.entry-card em { font-style: normal; font-size: 12px; opacity: .9; }

/* 带顶部导航栏的页面：内容顶部对齐，保证导航栏固定在最顶（不被 safe center 居中） */
.screen.topbar { justify-content: flex-start; }

/* ===== 顶部栏固定浮动（导航栏式：按状态栏 safe-area 高度吸顶） ===== */
.map-top:not(.settings-top), .level-top, .matching-top {
  position: sticky;
  top: var(--safe-top);
  z-index: 10;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
/* 地图/关卡：深色半透明胶囊栏（深色渐变背景上） */
.map-top:not(.settings-top), .level-top {
  background: rgba(40, 44, 80, .78);
  border-radius: 999px;
  padding: 8px 12px;
  box-shadow: 0 2px 8px rgba(0,0,0,.25);
}
/* 设置弹窗：白底浅色栏（白底卡片内） */
.settings-top {
  background: transparent;
  border-radius: 0;
  box-shadow: none;
  backdrop-filter: none;
  padding: 0;
}
.settings-top .btn {
  color: #555;
}
.settings-top h3 {
  color: #333;
  font-size: 17px;
}
/* 窄屏（手机竖屏）：隐藏姓名与按钮文字，只留图标（返回按钮除外） */
@media (max-width: 480px) {
  .map-top .profile-name { display: none; }
  .map-top .btn .btn-txt { display: none; }
  .map-top .btn { padding: 8px 12px; }
}

/* ===== 关卡 ===== */
.level-wrap { width: min(760px, 96vw); display: flex; flex-direction: column; align-items: center; gap: 14px; }
.level-top { width: 100%; display: flex; justify-content: space-between; align-items: center; color: #fff; font-weight: 700; font-size: 17px; text-shadow: 0 1px 0 rgba(0,0,0,.25); }
/* 语速调节条：每个关卡页随时可调 */
.level-speed { width: 100%; display: flex; align-items: center; justify-content: center; gap: 10px; }
.level-speed .speed-label { color: #fff; font-size: 15px; font-weight: 700; text-shadow: 0 1px 0 rgba(0,0,0,.25); }
.speed-group { display: flex; gap: 6px; background: rgba(255,255,255,.28); border-radius: 999px; padding: 4px; box-shadow: inset 0 1px 3px rgba(0,0,0,.15); }
.speed-btn { border: none; background: transparent; color: #fff; font-size: 15px; font-weight: 700; padding: 6px 14px; border-radius: 999px; cursor: pointer; transition: all .2s; opacity: .85; }
.speed-btn:active { transform: translateY(2px); }
.speed-btn.on { background: #fff; color: #e67e22; opacity: 1; box-shadow: 0 2px 8px rgba(0,0,0,.25); }
.progress-bar { width: 100%; height: 14px; background: rgba(255,255,255,.35); border-radius: 999px; overflow: hidden; }
.progress-bar > div { height: 100%; background: linear-gradient(90deg, #f6d365, #ff9a56); border-radius: 999px; transition: width .4s; }
.word-card { background: #fff; border-radius: 26px; padding: 22px 26px; width: 100%; text-align: center; box-shadow: 0 10px 30px rgba(0,0,0,.25); }
.word-display { font-size: clamp(40px, 9vw, 64px); font-weight: 900; letter-spacing: 2px; color: #333; word-break: break-all; min-height: 1.2em; }
.word-display.hidden { color: transparent; text-shadow: none; background: repeating-linear-gradient(90deg, #ddd 0 8px, transparent 8px 16px); border-radius: 8px; }
.word-info { margin-top: 8px; font-size: 18px; color: #555; line-height: 1.6; }
.word-info .ipa { color: #7c5cff; font-weight: 700; }
.word-info .pos { color: #38a169; font-weight: 700; }
.word-info .zh { color: #333; font-weight: 700; font-size: 20px; }
.word-info .ex { color: #888; font-style: italic; margin-top: 4px; }
.word-info .pattern { display: inline-block; background: #fff3cd; color: #b7791f; border-radius: 8px; padding: 1px 8px; margin-top: 4px; font-weight: 700; }
.word-info.hidden-info .ex { display: none; }

/* 字母槽 */
.slots { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; margin-top: 16px; }
.slot {
  width: clamp(34px, 7.5vw, 52px); height: clamp(44px, 9vw, 60px);
  border-bottom: 4px solid #bbb; border-radius: 10px 10px 0 0;
  display: flex; align-items: center; justify-content: center;
  font-size: clamp(24px, 5vw, 36px); font-weight: 800; color: #333;
  background: #f4f4f8; transition: all .15s;
}
.slot.hit { background: #d4f7dc; border-bottom-color: #38c172; transform: translateY(-3px); color: #1d7a3c; animation: pop .25s ease; }
.slot.space { border-bottom: none; background: transparent; width: clamp(10px, 2vw, 16px); }
.slot.error { animation: shake .3s; }

/* 乱序字母池 */
.pool { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 14px; }
.chip {
  width: clamp(36px, 8vw, 54px); height: clamp(40px, 8.5vw, 56px);
  background: #eef; border: 3px solid #7c5cff; border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  font-size: clamp(22px, 5vw, 32px); font-weight: 800; color: #5b3fd4;
  transition: all .15s;
}
.chip.used { background: #e2e2ea; border-color: #ccc; color: #bbb; transform: scale(.92); }
.chip.noise { border-style: dashed; border-color: #f0a; background: #fff0f6; color: #d63384; }

/* 音频按钮 */
.play-btn {
  width: clamp(64px, 13vw, 84px); height: clamp(64px, 13vw, 84px); border-radius: 50%;
  border: none; background: linear-gradient(135deg, #4facfe, #00c6fb); color: #fff;
  font-size: clamp(28px, 6vw, 38px); cursor: pointer; box-shadow: 0 6px 0 rgba(0,0,0,.18);
  display: inline-flex; align-items: center; justify-content: center; transition: transform .08s, box-shadow .08s;
}
.play-btn:active { transform: translateY(4px); box-shadow: 0 2px 0 rgba(0,0,0,.18); }
.play-btn.playing { animation: playPulse .7s ease-in-out infinite; }
@keyframes playPulse {
  0%, 100% { transform: scale(1); box-shadow: 0 6px 0 rgba(0,0,0,.18), 0 0 0 0 rgba(79,172,254,.4); }
  50% { transform: scale(1.1); box-shadow: 0 4px 0 rgba(0,0,0,.18), 0 0 0 12px rgba(79,172,254,0); }
}

/* 音标/例句按钮播放动画 */
.ipa-btn.playing { animation: ipaPulse .7s ease-in-out infinite; border-color: #4facfe; background: #e3f2ff; }
@keyframes ipaPulse {
  0%, 100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(79,172,254,.3); }
  50% { transform: scale(1.15); box-shadow: 0 0 0 6px rgba(79,172,254,0); }
}

/* 朗读面板 */
.read-panel { width: 100%; background: #fff; border-radius: 22px; padding: 18px; text-align: center; box-shadow: 0 8px 24px rgba(0,0,0,.2); }
.read-panel .mic { width: 76px; height: 76px; border-radius: 50%; border: none; background: linear-gradient(135deg, #ff9a56, #ff6a3d); color: #fff; font-size: 34px; cursor: pointer; box-shadow: 0 6px 0 rgba(0,0,0,.18); }
.read-panel .mic.listening { animation: pulse 1s infinite; background: linear-gradient(135deg, #f5576c, #f093fb); }
@keyframes pulse { 0%,100% { transform: scale(1); } 50% { transform: scale(1.12); } }
.read-status { margin-top: 10px; font-size: 17px; font-weight: 700; color: #555; min-height: 24px; }

/* 结算/评级 */
.rating-big { font-size: clamp(44px, 10vw, 72px); font-weight: 900; animation: pop .5s ease; }
.rating-P { color: #f6d365; text-shadow: 0 3px 0 rgba(0,0,0,.2); }
.rating-E { color: #4facfe; text-shadow: 0 3px 0 rgba(0,0,0,.2); }
.rating-G { color: #43e97b; text-shadow: 0 3px 0 rgba(0,0,0,.2); }
.rating-O { color: #bbb; text-shadow: 0 3px 0 rgba(0,0,0,.2); }
.result-modal { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; background: rgba(0,0,0,.45); z-index: 50; }
.result-box { text-align: center; display: flex; flex-direction: column; gap: 14px; align-items: center; width: min(460px, 92vw); animation: pop .4s ease; }
.score-line { font-size: 26px; font-weight: 800; color: #333; }

/* 遮罩（防切屏/加载） */
.overlay { position: absolute; inset: 0; background: rgba(20, 20, 60, .92); z-index: 100; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px; color: #fff; text-align: center; padding: 24px; }
.overlay .big { font-size: 30px; font-weight: 800; }
.overlay .sub { font-size: 17px; color: rgba(255,255,255,.85); }
.loading-bar { width: min(420px, 80vw); height: 18px; background: rgba(255,255,255,.2); border-radius: 999px; overflow: hidden; }
.loading-bar > div { height: 100%; width: 0%; background: linear-gradient(90deg, #f6d365, #ff9a56); border-radius: 999px; transition: width .2s; }

/* 虚拟键盘 */
.vkb { width: 100%; max-width: 900px; display: flex; flex-direction: column; gap: 6px; padding: 8px 4px; }
.vkb-row { display: flex; gap: 5px; justify-content: center; }
.vkb-key {
  flex: 1; max-width: 56px; height: clamp(40px, 7.5vh, 52px); border-radius: 10px; border: none;
  background: #fff; font-size: 20px; font-weight: 800; color: #333; cursor: pointer;
  box-shadow: 0 3px 0 rgba(0,0,0,.2); font-family: inherit;
}
.vkb-key:active { transform: translateY(2px); box-shadow: 0 1px 0 rgba(0,0,0,.2); }
.vkb-key.wide { max-width: 110px; font-size: 16px; background: #ffe08a; }

/* 彩带 */
.confetti { position: absolute; top: 0; font-size: 22px; z-index: 60; pointer-events: none; animation: confettiFall 2.2s ease-in forwards; }

/* Toast */
#toast { position: absolute; top: calc(14% + var(--safe-top)); left: 50%; transform: translateX(-50%); z-index: 200; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast-item { background: rgba(0,0,0,.78); color: #fff; padding: 10px 20px; border-radius: 999px; font-size: 17px; font-weight: 700; animation: pop .25s ease; }

/* 设置 */
.settings-box { width: min(520px, 94vw); display: flex; flex-direction: column; gap: 12px; max-height: 90vh; overflow-y: auto; }
.set-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px dashed #eee; }
.set-row label { font-size: 17px; font-weight: 700; color: #444; }
.set-row select, .set-row input { font-size: 16px; padding: 6px 10px; border-radius: 10px; border: 2px solid #ddd; font-family: inherit; }
.pin-input { letter-spacing: 8px; font-size: 22px; text-align: center; width: 140px; }

/* 表单弹窗 */
.modal-bg { position: absolute; inset: 0; background: rgba(0,0,0,.5); z-index: 80; display: flex; align-items: center; justify-content: center; }
.modal-box { position: relative; background: #fff; border-radius: 24px; padding: calc(34px + var(--safe-top)) calc(24px + var(--safe-right)) calc(24px + var(--safe-bottom)) calc(24px + var(--safe-left)); width: min(400px, 90vw); max-height: 88vh; overflow-y: auto; scrollbar-width: none; text-align: center; display: flex; flex-direction: column; gap: 14px; animation: pop .3s ease; }
.modal-box.modal-wide { width: min(600px, 95vw); }
.modal-box::-webkit-scrollbar { display: none; }
.modal-box .row:last-child { margin-top: 6px; }
.modal-box > * { flex-shrink: 0; }
.modal-box h3 { font-size: 24px; }
.modal-box input { font-size: 18px; padding: 10px 14px; border-radius: 12px; border: 2px solid #ddd; text-align: center; font-family: inherit; }
.avatar-row { display: flex; justify-content: center; gap: 8px; flex-wrap: wrap; }
.avatar-opt { font-size: 30px; padding: 6px 10px; border-radius: 12px; border: 2px solid transparent; cursor: pointer; background: #f4f4f8; }
.avatar-opt.sel { border-color: #4facfe; background: #e3f2ff; }

/* 统计 */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; width: 100%; }
.stat-cell { background: #f4f4f8; border-radius: 14px; padding: 10px; font-size: 14px; color: #555; }
.stat-cell b { display: block; font-size: 20px; color: #333; }

/* 通用小组件 */
.row { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; align-items: center; }
.mt8 { margin-top: 8px; } .mt16 { margin-top: 16px; }
.hint-text { color: rgba(255,255,255,.85); font-size: 15px; }

/* ===== P10：音标/意思换行 + 播放按钮 ===== */
.ipa-line { margin: 4px 0 2px; display: flex; align-items: center; flex-wrap: wrap; gap: 2px 6px; justify-content: center; }
.ipa-line .ipa { font-size: 15px; color: #666; }
.zh-line { margin: 2px 0; font-size: 18px; font-weight: 600; color: #333; text-align: center; }
.zh-line .pos { font-size: 12px; color: #999; font-weight: 400; margin-right: 4px; }
.ipa-btn { background: none; border: 1px solid #ccc; border-radius: 50%; width: 24px; height: 24px; font-size: 11px; line-height: 1; cursor: pointer; padding: 0; vertical-align: middle; flex: none; }
.ipa-btn:hover { border-color: #4caf50; background: #e8f5e9; }
.ex { margin-top: 6px; font-size: 14px; color: #555; }
.ex-en { margin-right: 4px; }
.ex-zh { margin-top: 2px; font-size: 13px; color: #999; }



/* ===== P10：通关选择 / 报告 / 错题收藏 ===== */

.chapter-actions { display: flex; gap: 4px; margin-top: 8px; flex-wrap: wrap; justify-content: center; }

.report-list { max-height: 55vh; overflow-y: auto; text-align: left; margin-top: 10px; }

.report-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 6px; border-bottom: 1px solid #f0f0f0; flex-wrap: wrap; }

.report-word { font-size: 16px; font-weight: 600; }

.report-word .zh { font-size: 13px; color: #999; font-weight: 400; margin-left: 6px; }

.report-meta { font-size: 13px; color: #777; }

.report-actions { display: flex; gap: 4px; }

.report-actions .btn.active { background: #fff3e0; border-color: #ff9800; color: #e65100; }


/* 鍚堟垚 loading 鐘舵€侊紙鈾?鎸夐挶鍔ㄧ敾锛?*/
.play-btn.synth-busy, .ipa-btn.synth-busy { animation: synthPulse 1s ease-in-out infinite; opacity: .8; }
@keyframes synthPulse { 0%,100% { opacity: .45; } 50% { opacity: 1; } }

.modal-box .modal-x { position: absolute; top: 10px; right: 10px; width: 30px; height: 30px; border: none; background: #f0f0f0; border-radius: 50%; color: #888; font-size: 14px; line-height: 1; cursor: pointer; display: flex; align-items: center; justify-content: center; padding: 0; z-index: 2; }
.modal-box .modal-x:hover { background: #e0e0e0; color: #333; }

/* ===== 积分兑换 ===== */
.btn.gold { background: linear-gradient(135deg, #ffd700 0%, #ffaa00 100%); color: #fff; border: none; box-shadow: 0 2px 8px rgba(255, 215, 0, 0.4); }
.coin-icon { font-size: 16px; margin-right: 4px; }
.coin-amount { font-weight: bold; font-size: 14px; }
.redeem-box { max-width: 420px; max-height: 85vh; overflow-y: auto; padding: 20px; }
.redeem-header { text-align: center; margin-bottom: 16px; }
.redeem-header h3 { font-size: 22px; margin-bottom: 8px; }
.points-display { display: flex; align-items: center; justify-content: center; gap: 8px; background: linear-gradient(135deg, #fff9e6, #fff3cc); border-radius: 12px; padding: 12px; margin-bottom: 16px; }
.points-label { font-size: 14px; color: #888; }
.points-value { font-size: 24px; font-weight: bold; color: #f5a623; }
.rewards-list { display: flex; flex-direction: column; gap: 10px; margin-bottom: 16px; }
.reward-item { display: flex; align-items: center; gap: 12px; padding: 12px; border-radius: 12px; border: 2px solid #f0f0f0; transition: all .2s; }
.reward-item.unaffordable { opacity: .5; }
.reward-item.redeemed { border-color: #ff6b6b; background: #fff5f5; }
.reward-icon { font-size: 32px; width: 48px; text-align: center; }
.reward-info { flex: 1; }
.reward-name { font-size: 16px; font-weight: bold; }
.reward-cost { font-size: 14px; color: #f5a623; margin-top: 2px; }
.redeem-btn { padding: 6px 16px; font-size: 14px; min-height: 32px; }
.redeemed-section h4 { font-size: 16px; margin-bottom: 8px; color: #666; }
.redeemed-list { display: flex; flex-direction: column; gap: 6px; }
.redeemed-item { display: flex; align-items: center; gap: 8px; font-size: 13px; color: #888; padding: 6px 8px; background: #f9f9f9; border-radius: 8px; }
.redeemed-icon { font-size: 18px; }
.redeemed-name { flex: 1; font-weight: 600; color: #555; }
.redeemed-time { font-size: 11px; color: #aaa; }

/* ===== 家长设置 - 积分管理 ===== */
.settings-section { margin-bottom: 16px; }
.settings-section h4 { font-size: 16px; margin-bottom: 8px; color: #555; }
.reward-manage-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 12px; }
.reward-manage-item { display: flex; align-items: center; gap: 10px; padding: 10px; border-radius: 10px; border: 1px solid #e8e8e8; background: #fafafa; }
.reward-manage-item .reward-icon { font-size: 24px; width: 36px; text-align: center; }
.reward-manage-item .reward-info { flex: 1; }
.reward-manage-item .reward-name { font-size: 14px; font-weight: 600; }
.reward-manage-item .reward-cost { font-size: 13px; color: #f5a623; }
.add-reward-form { display: flex; gap: 8px; margin-top: 8px; flex-wrap: wrap; }
.add-reward-form input { flex: 1; min-width: 0; padding: 8px 12px; border: 1px solid #ddd; border-radius: 8px; font-size: 14px; font-family: inherit; }
.add-reward-form input[type="number"] { flex: 0 0 80px; }
.add-reward-form input[type="text"][placeholder="图标"] { flex: 0 0 60px; }
.btn.danger { background: linear-gradient(135deg, #ff6b6b, #ee5a5a); }

/* ===== 积分兑换 ===== */
.points-display {
  text-align: center;
  font-size: 18px;
  font-weight: 700;
  padding: 16px;
  background: linear-gradient(135deg, #ffb703, #ff9500);
  color: white;
  border-radius: 12px;
  margin-bottom: 16px;
}
.points-display strong {
  font-size: 24px;
}
.points-earned {
  text-align: center;
  font-size: 16px;
  font-weight: 700;
  color: #ffb703;
  margin: 8px 0;
}
.redeem-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 16px;
}
.redeem-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border-radius: 12px;
  background: #f8f9fa;
  cursor: pointer;
  transition: all 0.2s;
}
.redeem-item:hover {
  background: #e9ecef;
}
.redeem-item.affordable {
  border: 2px solid #ffb703;
}
.redeem-item.redeemed {
  opacity: 0.5;
  cursor: default;
}
.redeem-item.expensive {
  opacity: 0.7;
}
.reward-icon {
  font-size: 24px;
  flex: 0 0 32px;
}
.reward-name {
  flex: 1;
  font-weight: 600;
  font-size: 14px;
}
.reward-cost {
  font-size: 14px;
  color: #ffb703;
  font-weight: 700;
}
.reward-status {
  font-size: 12px;
  color: #888;
  padding: 4px 8px;
  border-radius: 6px;
  background: #f0f0f0;
}
.redeem-item.affordable .reward-status {
  background: #e8f5e9;
  color: #4caf50;
}
.redeem-item.expensive .reward-status {
  background: #fff3e0;
  color: #ff9800;
}
.redeemed-history {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid #eee;
}
.redeemed-history h4 {
  font-size: 14px;
  color: #666;
  margin-bottom: 8px;
}
.redeemed-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px;
  font-size: 13px;
}
.redeemed-time {
  margin-left: auto;
  font-size: 11px;
  color: #999;
}

/* ===== 家长设置 - 奖励管理 ===== */
.reward-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px;
  margin-bottom: 8px;
  border-radius: 8px;
  background: #f8f9fa;
}
.reward-item .reward-icon {
  font-size: 20px;
  flex: 0 0 28px;
}
.reward-item .reward-name {
  flex: 1;
  font-weight: 600;
  font-size: 14px;
}
.reward-item .reward-cost {
  font-size: 14px;
  color: #ffb703;
  font-weight: 700;
}

/* ===== 移动端适配（iPhone / iPad） ===== */

/* 横屏矮屏（iPhone 横放）：压缩纵向占用，保证单词区与虚拟键盘同屏可见 */
@media (orientation: landscape) and (max-height: 500px) {
  .level-wrap { gap: 8px; }
  .word-card { padding: 12px 16px; }
  .word-display { font-size: clamp(28px, 6vw, 40px); }
  .slot { width: clamp(28px, 6vw, 40px); height: clamp(36px, 7vw, 46px); font-size: clamp(20px, 4.5vw, 28px); }
  .chip { width: clamp(30px, 6vw, 42px); height: clamp(34px, 7vw, 44px); font-size: clamp(18px, 4vw, 26px); }
  .btn { padding: 10px 20px; font-size: 18px; min-height: 44px; }
  .map-wrap { max-height: 86vh; }
}

/* iPad 竖屏 / 大屏：放大词卡与按钮，触控目标不小于 44pt */
@media (min-width: 768px) and (min-height: 1024px) {
  .word-display { font-size: clamp(48px, 8vw, 72px); }
  .slot { width: clamp(40px, 6vw, 56px); height: clamp(50px, 8vw, 66px); }
  .chip { width: clamp(42px, 6vw, 58px); height: clamp(46px, 7vw, 62px); }
  .btn { min-height: 56px; }
}

/* ===== 连连看玩法 ===== */
.matching-screen { gap: 10px; }
.matching-top { width: 100%; max-width: 480px; display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.speech-hint {
  width: 100%; max-width: 480px; padding: 8px 12px; border-radius: 12px;
  background: #fff3cd; color: #856404; font-size: 13px; text-align: center;
}
.matching-board {
  width: 100%; max-width: 480px; display: grid;
  grid-template-columns: repeat(4, 1fr); gap: 10px;
}
.m-card {
  aspect-ratio: 1 / 1; border-radius: 14px; border: 2px solid #e8e0d2;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  font-size: clamp(28px, 8vw, 44px); cursor: pointer; min-height: 64px;
  transition: transform .12s ease, background .12s ease;
  touch-action: manipulation; -webkit-tap-highlight-color: transparent;
  font-family: inherit;
}
.m-card.down { background: linear-gradient(150deg, #ffb703, #ff9f1a); color: #fff; border-color: #f59e0b; }
.m-card.up { background: #fff; color: #333; border-color: #4a90d9; box-shadow: 0 2px 8px rgba(74,144,217,.25); }
.m-card.matched { background: rgba(92,184,92,.12); color: #5cb85c; border-color: #5cb85c; cursor: default; }
.m-card:active:not(.matched) { transform: scale(.94); }
.m-zh { font-size: clamp(11px, 3vw, 15px); color: #888; line-height: 1.2; }
.m-card.up .m-zh { color: #4a90d9; font-weight: 700; }

.m-challenge, .m-retry, .m-done {
  width: 100%; max-width: 480px; background: #fff; border-radius: 16px;
  padding: 14px; display: flex; flex-direction: column; align-items: center; gap: 10px;
  box-shadow: 0 2px 10px rgba(0,0,0,.08);
}
.m-ch-word { font-size: clamp(22px, 6vw, 32px); font-weight: 700; color: #333; text-align: center; }
.m-retry-title { font-size: 16px; font-weight: 700; color: #b45309; text-align: center; }
.m-done { padding: 22px 14px; }
.m-done .score-line { font-size: 18px; }

/* ===== 打地鼠玩法（真实打地鼠：随机冒头 + 打中拼读） ===== */
.whack-screen {
  gap: 10px;
  background: url('../assets/game/whack-bg.svg') no-repeat center / cover;
}
/* 草地背景上的信息条：半透明白底保证可读 */
.whack-screen .matching-top {
  background: rgba(255,255,255,.82);
  border-radius: 999px; padding: 8px 14px;
}
/* 返回按钮在草地/白底上要有清晰对比，不能隐形 */
.whack-screen .matching-top .btn.ghost {
  background: #fff;
  color: #2f6faf;
  border-color: #4a90d9;
  font-weight: 700;
}
.whack-question {
  width: 100%; max-width: 480px; padding: 8px 12px; border-radius: 12px;
  background: rgba(255,255,255,.85); color: #1a6fa0;
  font-size: 15px; font-weight: 700; text-align: center;
}
.whack-board {
  width: 100%; max-width: 480px; display: grid;
  grid-template-columns: repeat(3, 1fr); gap: 12px;
}
/* 洞口：卡通草皮土丘（whack-hole.svg 原创） */
.whack-hole {
  aspect-ratio: 1 / 1;
  background: url('../assets/game/whack-hole.svg') no-repeat center / contain;
  border: none; position: relative; overflow: hidden; cursor: pointer;
  min-height: 72px; font-family: inherit; padding: 0;
  touch-action: manipulation; -webkit-tap-highlight-color: transparent;
}
/* 地鼠：默认藏在洞底（黑洞后），up 时快速弹出 */
.gopher {
  position: absolute; bottom: 24%; left: 50%; z-index: 2;
  width: 74%; height: 78%;
  background: url('../assets/game/mole.svg') no-repeat center bottom / contain;
  transform: translate(-50%, 130%);
  transition: transform .14s ease-out;
  filter: drop-shadow(0 3px 3px rgba(0,0,0,.35));
}
/* 冒头：地鼠从黑洞探出 */
.whack-hole.up .gopher { transform: translate(-50%, 4%); }
/* 打中：地鼠被打飞弹开消失 */
.whack-hole.hit .gopher {
  opacity: 0;
  transform: translate(-50%, -70%) scale(.5) rotate(20deg);
  transition: transform .3s ease-in, opacity .25s ease-in;
}
/* 打中星花 */
.whack-hole.hit::before {
  content: '💥'; position: absolute; top: 4%; left: 50%; z-index: 3;
  font-size: clamp(20px, 6vw, 34px);
  transform: translateX(-50%);
  animation: whack-spark .5s ease-out forwards;
}
@keyframes whack-spark {
  0%   { opacity: 1; transform: translate(-50%, 10%) scale(.5); }
  100% { opacity: 0; transform: translate(-50%, -60%) scale(1.7); }
}
/* 锤击动画 */
@keyframes whack-hit {
  0%   { transform: scale(1); }
  30%  { transform: scale(.85) rotate(-8deg); }
  60%  { transform: scale(1.08) rotate(5deg); }
  100% { transform: scale(1); }
}
.whack-hole.hit {
  animation: whack-hit .35s ease;
}
.whack-combo { color: #ff6b35; font-size: 18px; font-weight: 800; }
.whack-board, .whack-hole {
  cursor: url("data:image/svg+xml,%3Csvg%20xmlns%3D%27http%3A//www.w3.org/2000/svg%27%20width%3D%2756%27%20height%3D%2756%27%20viewBox%3D%270%200%2056%2056%27%3E%3Ctext%20x%3D%2728%27%20y%3D%2744%27%20font-size%3D%2748%27%20text-anchor%3D%27middle%27%3E%F0%9F%94%A8%3C/text%3E%3C/svg%3E") 20 14, crosshair;
}

/* 点击锤击画面：锤子从上方砸下到点击位置（鼠标/触屏统一） */
@keyframes hammer-strike {
  0%   { transform: translate(-50%, -170%) rotate(38deg) scale(.75); opacity: 1; }
  50%  { transform: translate(-50%, -100%) rotate(0deg) scale(1.08); opacity: 1; }
  100% { transform: translate(-50%, -100%) rotate(0deg) scale(1); opacity: 0; }
}
.hammer-hit {
  position: fixed; z-index: 60; pointer-events: none;
  font-size: clamp(44px, 10vw, 68px); line-height: 1;
  transform: translate(-50%, -100%) rotate(-25deg);
  animation: hammer-strike .4s ease-out forwards;
  filter: drop-shadow(0 4px 4px rgba(0,0,0,.3));
}

/* ===== 自定义词表 ===== */
.custom-area {
  width: 100%; border: 2px solid #d8d2c4; border-radius: 12px;
  padding: 10px; font: inherit; color: #333; resize: vertical;
  background: #fff; line-height: 1.7;
}
.custom-area:focus { outline: none; border-color: #4a90d9; }

/* ===== 听指令做动作（课堂指令 TPR，教材化玩法） ===== */
.primary-outline {
  background: #fff; color: #0a84ff;
  border: 2.5px solid #0a84ff; box-shadow: none;
}
.btn.primary-outline:hover { background: #eaf3ff; }
.instr-board {
  gap: 12px;
  background: linear-gradient(160deg, #fff7e6 0%, #e8f4ff 55%, #eafce8 100%);
}
.instr-board .level-head {
  display: flex; align-items: center; gap: 12px; width: min(640px, 94vw);
  justify-content: space-between; flex-wrap: wrap;
}
.instr-board .level-head .btn.ghost {
  color: #2b3a67;
  background: rgba(255, 255, 255, .9);
}
.instr-board .lvl-title { font-weight: 800; color: #2b3a67; font-size: 18px; }
.instr-board .lvl-progress { color: #0a84ff; font-weight: 800; font-size: 18px; }
.instr-stage {
  width: min(640px, 94vw); padding: 22px 20px; border-radius: 24px;
  background: rgba(255, 255, 255, .8); box-shadow: 0 8px 28px rgba(40, 60, 120, .14);
  display: flex; flex-direction: column; align-items: center; gap: 14px;
}
.instr-prompt { font-size: 20px; font-weight: 800; color: #2b3a67; }
.instr-stage .btn.speak { background: linear-gradient(135deg, #f6d365, #fda085); }
.instr-q {
  font-size: 26px; font-weight: 800; color: #6a4bb5; text-align: center; line-height: 1.4;
}
.instr-q .instr-q-wait { opacity: .45; font-size: 20px; }
.instr-miss {
  background: #ffe3e3; color: #d00000; border-radius: 14px; padding: 10px 16px;
  font-weight: 700; font-size: 17px; text-align: center;
}
.instr-read { text-align: center; padding-top: 4px; display: flex; flex-direction: column; gap: 10px; align-items: center; }
.instr-read-q {
  font-size: 18px; color: #2b3a67; font-weight: 700; line-height: 1.5;
}
.instr-read-q b { color: #0a84ff; }
.instr-read-status { font-size: 16px; color: #2b3a67; background: rgba(10,132,255,.10); border-radius: 12px; padding: 8px 14px; font-weight: 600; }
.act-grid {
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px;
  width: 100%;
}
.act-tile {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 92px; border-radius: 20px; border: none; cursor: pointer;
  background: linear-gradient(135deg, #4facfe, #00c6fb); color: #fff;
  font-size: 40px; font-weight: 700; box-shadow: 0 5px 12px rgba(0,120,255,.25);
  transition: transform .12s ease;
}
.act-tile span { font-size: 24px; font-weight: 800; color: #fff; }
.act-tile:nth-child(4n + 1) { background: linear-gradient(135deg, #43e97b, #38c172); }
.act-tile:nth-child(4n + 2) { background: linear-gradient(135deg, #f6d365, #fda085); }
.act-tile:nth-child(4n + 3) { background: linear-gradient(135deg, #b06bf2, #7b5bf2); }
.act-tile:active { transform: scale(.93); }
.act-tile.good {
  background: linear-gradient(135deg, #00d26a, #00a854) !important;
  outline: 4px solid #ffe066; animation: act-good .5s ease;
}
.act-tile.bad {
  background: linear-gradient(135deg, #ff5f5f, #d00000) !important;
  animation: act-bad .4s ease;
}
@keyframes act-good { 0% { transform: scale(1); } 40% { transform: scale(1.18); } 100% { transform: scale(1); } }
@keyframes act-bad { 0%,100% { transform: translateX(0); } 25% { transform: translateX(-8px); } 75% { transform: translateX(8px); } }

/* ===== 指令乐园 · 更多教材场景（找一找 / 涂颜色 / 活动广场菜单） ===== */
.act-grid.find-grid { grid-template-columns: repeat(2, 1fr); }
.item-tile { font-size: 52px; min-height: 108px; flex-direction: column; gap: 4px; }
.item-tile span { font-size: 22px; }
.colour-obj {
  display: flex; align-items: center; gap: 12px;
  background: #fff; border-radius: 18px; padding: 8px 16px;
  box-shadow: 0 4px 12px rgba(40,60,120,.12);
}
.colour-obj-icon { font-size: 56px; }
.colour-obj-name { font-size: 18px; font-weight: 800; color: #6a4bb5; }
.colour-swatch {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px;
  min-height: 108px; border-radius: 20px; border: none; cursor: pointer; background: #fff;
  box-shadow: 0 5px 12px rgba(40,60,120,.14); transition: transform .12s ease; padding: 10px;
}
.colour-swatch .sw-fill {
  width: 64px; height: 64px; border-radius: 50%; background: var(--sw, #ccc);
  box-shadow: inset 0 -6px 0 rgba(0,0,0,.18), 0 4px 8px rgba(0,0,0,.18);
}
.colour-swatch .sw-label { font-size: 18px; font-weight: 800; color: #2b3a67; }
.colour-swatch:active { transform: scale(.93); }
.colour-swatch.good { outline: 4px solid #ffe066; animation: act-good .5s ease; }
.colour-swatch.bad { animation: act-bad .4s ease; outline: 3px solid #ff5f5f; }

/* 教材活动广场菜单 */
.menu-board { gap: 14px; background: linear-gradient(160deg, #fff7e6 0%, #e8f4ff 55%, #eafce8 100%); }
.menu-board .level-head { display: flex; align-items: center; gap: 12px; width: min(640px, 94vw); justify-content: space-between; }
.menu-board .level-head .btn.ghost { color: #2b3a67; background: rgba(255, 255, 255, .9); }
.menu-board .lvl-title { font-weight: 800; color: #2b3a67; font-size: 20px; }
.menu-sub { font-size: 17px; color: #6a7b9e; font-weight: 700; }
.menu-grid { display: grid; grid-template-columns: 1fr; gap: 16px; width: min(560px, 94vw); }
.menu-tile {
  display: flex; align-items: center; gap: 16px; text-align: left; cursor: pointer;
  border: none; border-radius: 22px; padding: 18px 20px; color: #fff;
  box-shadow: 0 8px 22px rgba(0,0,0,.16); transition: transform .12s ease;
}
.menu-tile:active { transform: scale(.97); }
.menu-tile.tone-a { background: linear-gradient(135deg, #4facfe, #00c6fb); }
.menu-tile.tone-b { background: linear-gradient(135deg, #43e97b, #38c172); }
.menu-tile.tone-c { background: linear-gradient(135deg, #b06bf2, #7b5bf2); }
.menu-icon { font-size: 44px; }
.menu-name { font-size: 24px; font-weight: 800; }
.menu-desc { display: block; font-size: 14px; opacity: .92; margin-top: 2px; }
.menu-go { margin-left: auto; font-size: 16px; font-weight: 800; opacity: .95; }

/* ===== 电子教材学习模块（剑桥 Join In 三年级上册·点读） ===== */
.ebook-screen { background: linear-gradient(170deg, #3a3f66, #23263f); overflow: hidden; animation: none; }
.ebook-head { display: flex; align-items: center; gap: 12px; width: 100%; max-width: 860px; padding: 10px 14px; color: #fff; background: rgba(255,255,255,.08); border-radius: 16px; margin-bottom: 10px; flex-wrap: wrap; flex: 0 0 auto; }
.ebook-head .btn.ghost { background: rgba(255,255,255,.16); color: #fff; }
.ebook-title { flex: 1; text-align: center; font-weight: 800; font-size: 18px; min-width: 120px; }
.ebook-page { white-space: nowrap; font-size: 14px; opacity: .82; }

.ebook-body { position: relative; flex: 1 1 0%; width: 100%; max-width: 860px; display: flex; flex-direction: column; align-items: center; justify-content: flex-start; gap: 8px; overflow: hidden; min-height: 0; }
.ebook-canvas { position: relative; flex: 1 1 auto; height: 100%; min-height: 0; max-width: 100%; background: #fff; border-radius: 12px; box-shadow: 0 12px 32px rgba(0,0,0,.38); overflow: hidden; display: flex; align-items: stretch; justify-content: center; }
.ebook-canvas.no-border { box-shadow: 0 0 0 rgba(0,0,0,0); }
.ebook-canvas .ebook-img { display: block; height: 100%; width: auto; max-width: 100%; }
.ebook-hot-layer { position: absolute; inset: 0; }
.ebook-hot { position: absolute; border: 0; background: transparent; cursor: pointer; border-radius: 6px; transition: background .15s, box-shadow .15s; }
.ebook-hot:hover { background: rgba(255,193,7,.32); box-shadow: inset 0 0 0 2px #ffc107; }
.ebook-hot.on { background: rgba(255,193,7,.42); box-shadow: inset 0 0 0 3px #f5a623; }

.ebook-status { position: relative; width: min(99%, 820px); background: #fff; border-radius: 14px; padding: 8px 34px 8px 14px; box-shadow: 0 6px 18px rgba(0,0,0,.22); font-weight: 700; color: #333; flex: 0 0 auto; max-height: 34%; overflow: hidden; }
.ebook-status.read { border-left: 6px solid #ff6a3d; }
.ebook-status.trans { border-left: 6px solid #00c6fb; }
.est-close { position: absolute; top: 6px; right: 6px; width: 24px; height: 24px; border: none; border-radius: 50%; background: #eef1f6; color: #667; font-size: 13px; line-height: 1; cursor: pointer; display: flex; align-items: center; justify-content: center; }
.est-close:hover { background: #ff6a3d; color: #fff; }
.est-q { font-size: 16px; line-height: 1.3; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.est-zh { color: #e67700; margin-top: 3px; font-size: 15px; line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.est-bar { color: #d35400; margin-top: 2px; font-size: 13px; }
.est-actions { display: flex; gap: 8px; margin-top: 6px; justify-content: flex-end; }
.dim { color: #999; }

.ebook-tools { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; flex: 0 0 auto; }
.ebook-tool { display: flex; flex-direction: column; align-items: center; gap: 2px; border: none; background: rgba(255,255,255,.14); color: #fff; border-radius: 16px; padding: 8px 14px; font-weight: 800; font-size: 13px; cursor: pointer; min-width: 64px; font-family: inherit; }
.ebook-tool span { font-size: 13px; }
.ebook-tool.on { background: #ffc107; color: #6b4a00; box-shadow: 0 0 0 2px #fff; }

.ebook-nav { display: flex; gap: 10px; flex: 0 0 auto; }
.ebook-nav .btn.ghost { background: rgba(255,255,255,.16); color: #fff; font-size: 14px; padding: 8px 14px; }

.ebook-rail { position: absolute; right: calc(10px + var(--safe-right)); top: 50%; transform: translateY(-50%); display: flex; flex-direction: column; gap: 10px; z-index: 20; }
.ebook-rail-btn { display: flex; flex-direction: column; align-items: center; gap: 2px; border: none; background: rgba(255,255,255,.16); color: #fff; border-radius: 14px; padding: 10px 8px; font-weight: 800; font-size: 11px; cursor: pointer; min-width: 58px; font-family: inherit; }
.ebook-rail-btn:active { background: #ffc107; color: #6b4a00; }

.ebook-sidebar { position: absolute; right: 0; top: 0; bottom: 0; width: min(322px, 84vw); background: linear-gradient(180deg, #fff, #f2f4fb); color: #333; z-index: 30; border-radius: 18px 0 0 18px; box-shadow: -6px 0 22px rgba(0,0,0,.32); display: flex; flex-direction: column; animation: ebookSlideR .25s ease; }
.ebook-sidebar.no-anim { animation: none; }
@keyframes ebookSlideR { from { transform: translateX(100%); } to { transform: translateX(0); } }
.ebook-side-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; font-weight: 800; font-size: 18px; border-bottom: 1px solid #e6e8f0; }
.ebook-side-head .btn.ghost { background: #eceef5; color: #555; }
.ebook-toc-list { flex: 1; overflow-y: auto; padding: 10px; }
.ebook-toc-row { display: flex; align-items: center; gap: 8px; width: 100%; border: none; background: transparent; text-align: left; padding: 10px 8px; border-radius: 12px; cursor: pointer; font-family: inherit; }
.ebook-toc-row:active { background: #e9ecf5; }
.ebook-toc-row.unit .toc-name { font-weight: 800; color: #222; }
.ebook-toc-row.unit.cur { background: #ffedf0; }
.ebook-toc-row.unit.cur .toc-name { color: #d63a5a; }
.ebook-toc-row.sec { padding-left: 26px; }
.ebook-toc-row.sec .toc-name { font-weight: 500; color: #667; font-size: 14px; }
.ebook-toc-row.sec.on { background: #fb7185; }
.ebook-toc-row.sec.on .toc-name { color: #fff; font-weight: 700; }
.toc-arrow { width: 15px; font-size: 13px; color: #fb7185; flex: 0 0 auto; text-align: center; }
.ebook-toc-row .toc-page { color: #aab; font-size: 12px; flex: 0 0 auto; margin-left: auto; white-space: nowrap; }
.toc-no { background: #e8eaf6; color: #667eea; border-radius: 8px; padding: 2px 7px; font-weight: 800; font-size: 12px; flex: 0 0 auto; }
.ebook-toc-row.play .toc-no { background: #ff6a3d; }
.toc-name { font-weight: 700; flex: 1 1 auto; font-size: 15px; }
.toc-zh { color: #889; font-size: 12px; flex: 0 0 auto; }

/* ===== 电子教材·音视频面板（补充媒体资源） ===== */
.em-layer { position: absolute; inset: 0; z-index: 40; background: rgba(15, 20, 45, .42); display: flex; align-items: center; justify-content: center; padding: calc(16px + var(--safe-top)) 16px calc(16px + var(--safe-bottom)); }
.em-panel { background: linear-gradient(180deg, #fff, #f5f7fd); color: #333; border-radius: 20px; box-shadow: 0 14px 40px rgba(0,0,0,.35); width: min(680px, 100%); max-height: 100%; display: flex; flex-direction: column; overflow: hidden; }
.em-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 18px; font-weight: 900; font-size: 19px; border-bottom: 1px solid #e6e8f0; }
.em-head .btn.ghost { background: #eceef5; color: #555; }
.em-body { flex: 1; overflow-y: auto; padding: 14px 16px 18px; }
.em-group { margin-bottom: 8px; }
.em-group:not(:empty) + .em-group { margin-top: 10px; }
.em-empty { color: #aab; font-size: 14px; padding: 10px 4px; text-align: center; }
.em-item { display: flex; align-items: center; gap: 12px; padding: 12px; background: #fff; border-radius: 14px; box-shadow: 0 2px 8px rgba(0,0,0,.06); margin-bottom: 10px; }
.em-icon { font-size: 26px; flex: 0 0 auto; }
.em-info { flex: 1 1 auto; min-width: 0; }
.em-name { font-weight: 800; font-size: 15px; color: #222; }
.em-sub { color: #99a; font-size: 12px; margin-top: 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.em-play { border: none; border-radius: 999px; padding: 9px 18px; font-weight: 800; font-size: 14px; cursor: pointer; color: #fff; background: linear-gradient(135deg, #4facfe, #00c6fb); font-family: inherit; flex: 0 0 auto; box-shadow: 0 3px 0 rgba(0,0,0,.14); min-width: 84px; }
.em-play:active { transform: translateY(2px); box-shadow: 0 1px 0 rgba(0,0,0,.14); }
.em-jump { border: 1.5px solid #c9d3f5; border-radius: 999px; padding: 7px 14px; font-weight: 800; font-size: 13px; cursor: pointer; color: #4a5bd0; background: #eef1ff; font-family: inherit; flex: 0 0 auto; }
.em-jump:active { background: #dde3ff; }
.em-jump.on { background: #4a5bd0; color: #fff; border-color: #4a5bd0; }
.em-item.on { outline: 2px solid #ffb347; outline-offset: -2px; }
.em-player { background: #10131f; border-radius: 14px; padding: 12px; margin-bottom: 12px; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.em-player.audio { background: #1b2340; }
.em-player .em-close { background: rgba(255,255,255,.18); color: #fff; font-size: 13px; padding: 6px 14px; align-self: flex-end; min-height: 32px; }
.em-atitle { color: #ffe9a8; font-weight: 800; font-size: 14px; }
.em-video { width: 100%; max-height: 56vh; border-radius: 10px; background: #000; }
.em-audio { width: 100%; }

/* 学习设置弹窗补充 */
.set-ctl { display: flex; align-items: center; gap: 10px; }
.set-val { min-width: 56px; text-align: center; font-weight: 800; }
.btn.gray { background: #dfe2ea; color: #555; }
