/* 音程训练营 · 网页版样式（移动端优先） */
* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html { touch-action: manipulation; }

body {
  background: #f5f6fa;
  color: #2d3436;
  font-family: -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Microsoft YaHei', sans-serif;
  font-size: 17px;
  line-height: 1.5;
}

.app { max-width: 640px; margin: 0 auto; padding: 0 16px 40px; }

/* 顶栏 */
.topbar {
  position: sticky; top: 0; z-index: 10;
  background: #4c3ef0;
  padding: calc(env(safe-area-inset-top, 0px) + 12px) 16px 12px;
  margin: 0 -16px 20px;
}
.topbar-inner { max-width: 640px; margin: 0 auto; display: flex; justify-content: space-between; align-items: center; }
.logo { color: #fff; font-weight: 700; font-size: 18px; }
.bar-stats { color: rgba(255,255,255,.85); font-size: 13px; }

.slogan { color: #636e72; font-size: 14px; margin-bottom: 16px; text-align: center; }

/* 课程卡片 */
.card {
  background: #fff; border-radius: 16px; padding: 20px;
  margin-bottom: 16px; box-shadow: 0 4px 16px rgba(0,0,0,.06);
  cursor: pointer; transition: transform .08s ease;
}
.card:active { transform: scale(.985); }
.card-top { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.badge { color: #fff; font-size: 12px; padding: 3px 10px; border-radius: 999px; flex-shrink: 0; }
.c1 .badge { background: #4c3ef0; }
.c2 .badge { background: #e17055; }
.c3 .badge { background: #00b894; }
.card-title { font-size: 19px; font-weight: 700; }
.card-desc { color: #636e72; font-size: 14px; margin-bottom: 14px; }
.card-stats { display: flex; gap: 24px; margin-bottom: 14px; }
.cs-num { display: block; font-size: 18px; font-weight: 700; color: #2d3436; }
.cs-lbl { font-size: 12px; color: #b2bec3; }
.go-btn {
  text-align: center; color: #fff; font-weight: 600;
  padding: 12px; border-radius: 10px; font-size: 16px;
}
.c1 .go-btn { background: #4c3ef0; }
.c2 .go-btn { background: #e17055; }
.c3 .go-btn { background: #00b894; }

.footnote { text-align: center; color: #b2bec3; font-size: 12px; line-height: 1.8; margin-top: 24px; }

/* 刷题页 */
.qbar { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.btn-back {
  border: none; background: #fff; color: #4c3ef0; font-size: 20px;
  width: 44px; height: 44px; border-radius: 12px; cursor: pointer;
  box-shadow: 0 2px 8px rgba(0,0,0,.06); flex-shrink: 0;
}
.qbar-mid { min-width: 0; }
.q-title { font-size: 16px; font-weight: 700; }
.q-stats { font-size: 12px; color: #636e72; }

.qcard {
  background: #fff; border-radius: 16px; padding: 20px;
  box-shadow: 0 4px 16px rgba(0,0,0,.06);
}
.q-head { margin-bottom: 12px; }
.tag {
  display: inline-block; font-size: 12px; color: #4c3ef0;
  background: #efedff; padding: 4px 12px; border-radius: 999px;
}
.q-text { font-size: 21px; font-weight: 700; margin-bottom: 8px; }
.q-sub { font-size: 14px; color: #636e72; margin-bottom: 20px; }

/* 选项 */
.opts { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 360px) { .opts { grid-template-columns: 1fr; } }
.opt {
  border: 2px solid #e8e8f0; background: #fafafe; border-radius: 12px;
  padding: 16px 10px; font-size: 17px; font-weight: 600; color: #2d3436;
  cursor: pointer; transition: background .12s, border-color .12s, transform .05s;
  font-family: inherit; text-align: center;
}
.opt:active { transform: scale(.97); }
.opt.correct { background: #e6fff5; border-color: #00b894; color: #00b894; }
.opt.wrong { background: #fff0ec; border-color: #e17055; color: #e17055; }
.opt.dim { opacity: .45; }

/* 解析 */
.explain {
  margin-top: 18px; padding: 14px 16px; border-radius: 12px;
  background: #f8f9ff; border-left: 4px solid #4c3ef0;
  font-size: 15px; white-space: pre-line; line-height: 1.7;
}
.explain.good { border-left-color: #00b894; }
.explain.bad { border-left-color: #e17055; }

.next-btn {
  display: block; width: 100%; margin-top: 18px; padding: 14px;
  border: none; border-radius: 12px; background: #6c5ce7; color: #fff;
  font-size: 17px; font-weight: 700; cursor: pointer; font-family: inherit;
}
.next-btn:active { background: #5a4bd6; }
.btn-amber { background: #e1a039; }
.btn-amber:active { background: #cf8f2c; }
.btn-ghost { background: #fff; color: #636e72; box-shadow: inset 0 0 0 2px #e8e8f0; }
.btn-ghost:active { background: #f1f1f6; }

/* 进度条 */
.progress-row { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.progress-text { font-size: 13px; color: #636e72; flex-shrink: 0; }
.progress-wrap { flex: 1; height: 8px; background: #e8e8f0; border-radius: 999px; overflow: hidden; }
.progress-fill { height: 100%; width: 0; background: #6c5ce7; border-radius: 999px; transition: width .25s ease; }
.q-timer { font-size: 13px; color: #636e72; flex-shrink: 0; font-variant-numeric: tabular-nums; }

/* 错题重现标记 */
.re-tag { display: inline-block; font-size: 12px; color: #e1a039; background: #fdf3e3; padding: 4px 12px; border-radius: 999px; margin-left: 8px; }

/* 今日完成标记 */
.done-badge { font-size: 12px; color: #00b894; background: #e6fff5; padding: 3px 10px; border-radius: 999px; margin-left: auto; }

/* 错题本入口卡 */
.c4 .badge { background: #e1a039; }
.g4 { background: #e1a039; }

/* 结算页 */
.summary { text-align: center; }
.sum-emoji { font-size: 56px; line-height: 1.2; }
.sum-rating { color: #636e72; font-size: 15px; margin: 4px 0 10px; }
.sum-score { font-size: 52px; font-weight: 800; color: #2d3436; margin-bottom: 18px; }
.sum-score b { color: #00b894; }
.score-sub { font-size: 22px; color: #b2bec3; font-weight: 600; }
.sum-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-bottom: 16px; }
.sum-cell { background: #f8f9ff; border-radius: 12px; padding: 12px 4px; }
.sum-num { display: block; font-size: 19px; font-weight: 700; }
.sum-lbl { font-size: 11px; color: #b2bec3; }
.sum-note { font-size: 13px; color: #636e72; margin-bottom: 18px; line-height: 1.7; }
.summary .next-btn { margin-top: 10px; }

/* 错题本 */
.notes-group { font-size: 14px; font-weight: 700; color: #636e72; margin: 20px 0 10px; }
.note-item { background: #fff; border-radius: 12px; margin-bottom: 10px; box-shadow: 0 2px 8px rgba(0,0,0,.05); overflow: hidden; }
.note-head { padding: 14px 16px; cursor: pointer; }
.note-text { font-size: 16px; font-weight: 600; margin-left: 8px; }
.note-body { padding: 0 16px 14px; font-size: 14px; color: #636e72; white-space: pre-line; line-height: 1.7; border-top: 1px dashed #e8e8f0; padding-top: 12px; }
.empty { text-align: center; color: #b2bec3; padding: 48px 0; }

[hidden] { display: none !important; }

/* ===== 关卡制 v2 新增 ===== */

/* 速查按钮 */
.cheat-btn {
  border: 1px solid rgba(255,255,255,.5); background: rgba(255,255,255,.15);
  color: #fff; font-size: 13px; padding: 5px 12px; border-radius: 999px; cursor: pointer;
}
.cheat-btn:active { background: rgba(255,255,255,.3); }

/* 课时区块 */
.lesson-section {
  background: #fff; border-radius: 16px; padding: 18px 14px 10px;
  margin-bottom: 18px; box-shadow: 0 4px 16px rgba(0,0,0,.06);
}
.lesson-head { display: flex; align-items: center; gap: 10px; margin: 0 6px 6px; }
.lesson-title { font-size: 19px; font-weight: 700; flex: 1; }
.lesson-prog { font-size: 13px; color: #b2bec3; font-weight: 600; }
.lesson-desc { color: #636e72; font-size: 13px; margin: 0 6px 4px; }

/* 路径图 */
.map-svg { width: 100%; display: block; }
.map-path { fill: none; stroke: #dfe3f5; stroke-width: 5; stroke-linecap: round; }
.map-node { cursor: pointer; }
.map-node circle { fill: #4c3ef0; stroke: #fff; stroke-width: 3; }
.map-node text { fill: #fff; font-size: 14px; font-weight: 700; pointer-events: none; }
.map-node .map-label { fill: #636e72; font-size: 11px; font-weight: 500; }
.map-node.locked { cursor: default; }
.map-node.locked circle { fill: #dfe3f5; }
.map-node.locked text { fill: #b2bec3; font-size: 12px; }
.map-node.passed circle { fill: #00b894; }
.map-node.boss circle { stroke: #ffd166; stroke-width: 4; }
.map-node:active circle { transform: scale(.94); transform-origin: center; transform-box: fill-box; }

/* 学页面 */
.learn-card { margin-top: 4px; }
.learn-label { font-size: 13px; color: #b2bec3; font-weight: 700; margin: 18px 0 8px; }
.learn-label:first-child { margin-top: 0; }
.learn-rule {
  font-size: 19px; font-weight: 700; line-height: 1.7;
  background: linear-gradient(135deg, #f8f9ff, #eef0ff);
  border-left: 4px solid #4c3ef0; border-radius: 10px; padding: 14px 16px;
}
.learn-passed {
  margin-top: 10px; font-size: 13px; color: #00b894; font-weight: 600;
  background: #e8fff6; border-radius: 8px; padding: 8px 12px;
}
.example {
  background: #f8f9ff; border-radius: 10px; padding: 12px 14px; margin-bottom: 10px;
  font-size: 15px;
}
.example-q { font-weight: 600; }
.example-sub { color: #636e72; font-size: 13px; font-weight: 400; margin-left: 6px; }
.example-a { color: #00b894; font-weight: 700; margin: 6px 0 2px; }
.example-e { color: #636e72; font-size: 13px; line-height: 1.7; }
.learn-actions { margin-top: 20px; }
.learn-actions .next-btn { margin-bottom: 10px; }

/* 结算页错题列表 */
.wronglist-head { font-size: 14px; font-weight: 700; color: #636e72; margin: 4px 0 10px; text-align: left; }
.wrong-item {
  background: #fff8f6; border-radius: 10px; margin-bottom: 8px;
  text-align: left; overflow: hidden; border: 1px solid #ffe5de;
}
.wrong-item summary {
  padding: 12px 14px; cursor: pointer; font-size: 15px; font-weight: 600;
  list-style: none;
}
.wrong-item summary::before { content: '▸ '; color: #e17055; }
.wrong-item[open] summary::before { content: '▾ '; }
.wrong-item summary::-webkit-details-marker { display: none; }
.wrong-body {
  padding: 0 14px 12px 28px; font-size: 13px; color: #636e72;
  line-height: 1.7; white-space: normal;
}
#sum-actions { margin-top: 16px; }
#sum-actions .next-btn { margin-top: 10px; }

/* 速查弹层 */
.cheat-modal {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(30, 25, 60, .55);
  display: flex; align-items: flex-end; justify-content: center;
}
.cheat-panel {
  background: #fff; width: 100%; max-width: 640px;
  border-radius: 20px 20px 0 0; padding: 18px 20px calc(env(safe-area-inset-bottom, 0px) + 24px);
  max-height: 76vh; overflow-y: auto;
}
.cheat-head { display: flex; justify-content: space-between; align-items: center; font-size: 17px; font-weight: 700; margin-bottom: 12px; }
.cheat-close { border: none; background: #f1f2f6; width: 32px; height: 32px; border-radius: 50%; cursor: pointer; font-size: 14px; color: #636e72; }
.cheat-line { font-size: 14px; line-height: 1.6; padding: 9px 12px; border-radius: 8px; margin-bottom: 6px; background: #f8f9ff; }
.cheat-extra { background: #fff8ec; color: #8d6e3a; }
.cheat-panel hr { border: none; border-top: 1px dashed #e0e2f0; margin: 10px 0; }

/* ===== 课内关卡列表（竖排按钮）===== */
.lesson-list { display: flex; flex-direction: column; gap: 12px; margin-top: 10px; }

.lvl-btn {
  display: flex; align-items: center; gap: 14px; width: 100%;
  background: #fff; border: 2px solid #e8e8f0; border-radius: 16px;
  padding: 14px 16px; cursor: pointer; text-align: left;
  font-family: inherit; box-shadow: 0 4px 16px rgba(0,0,0,.06);
  transition: transform .08s ease;
}
.lvl-btn:not(.locked):active { transform: scale(.985); }
.lvl-btn:focus-visible { outline: 3px solid #cfc6f5; outline-offset: 2px; }

/* 序号圆 */
.lvl-num {
  width: 44px; height: 44px; border-radius: 50%; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  background: #fff; border: 3px solid #4c3ef0; color: #4c3ef0;
  font-size: 18px; font-weight: 800;
}

.lvl-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.lvl-name { font-size: 17px; font-weight: 700; color: #2d3436; }
.lvl-stars { font-size: 13px; color: #f0a429; letter-spacing: 3px; }
.lvl-go { color: #b2bec3; font-size: 22px; font-weight: 700; flex-shrink: 0; }

/* 可挑战：紫描边 + 脉动 */
.lvl-btn.open .lvl-num { animation: nodepulse 1.6s ease-in-out infinite; }
@keyframes nodepulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(76, 62, 240, .35); }
  50% { box-shadow: 0 0 0 7px rgba(76, 62, 240, 0); }
}

/* 已通过：金币黄 */
.lvl-btn.passed { border-color: #ffe1a8; background: #fffdf6; }
.lvl-btn.passed .lvl-num { background: #ffd166; border-color: #f0a429; color: #7a4a00; }

/* 锁定：灰 */
.lvl-btn.locked { cursor: default; box-shadow: none; background: #fafbfc; }
.lvl-btn.locked .lvl-num { background: #e5e8ee; border-color: #c9cdd6; color: #9aa0ab; font-size: 15px; }
.lvl-btn.locked .lvl-name { color: #b6bbc4; }

/* Boss：金圈序号 */
.lvl-btn.boss .lvl-num { border-color: #ffd166; }
.lvl-btn.boss.passed .lvl-num { border-color: #f0a429; }

/* 课内列表页微调 */
#view-lesson .qbar { margin-bottom: 6px; }
#view-lesson .footnote { margin-top: 10px; }

/* ===== 登录页 ===== */
#view-login { display: flex; justify-content: center; }
.login-card {
  width: 100%; max-width: 380px; margin-top: 7vh; height: fit-content;
  background: #fff; border-radius: 22px; padding: 34px 26px 26px;
  text-align: center; box-shadow: 0 10px 36px rgba(76, 62, 240, .12);
}
.login-logo { font-size: 46px; }
.login-title { font-size: 23px; font-weight: 800; margin-top: 6px; }
.login-sub { color: #636e72; font-size: 14px; margin: 4px 0 22px; }
.login-input {
  width: 100%; padding: 15px 18px; font-size: 19px; letter-spacing: 2px;
  text-align: center; border: 2px solid #e8e8f0; border-radius: 14px;
  outline: none; font-family: inherit; transition: border-color .15s;
  font-variant-numeric: tabular-nums;
}
.login-input:focus { border-color: #4c3ef0; }
.login-code-row { display: flex; gap: 10px; margin-top: 12px; }
.code-input { flex: 1; min-width: 0; }
.send-code-btn {
  white-space: nowrap; border: 2px solid #4c3ef0; background: #fff; color: #4c3ef0;
  border-radius: 14px; padding: 0 14px; font-size: 14px; font-family: inherit;
  cursor: pointer; transition: color .15s, border-color .15s;
}
.send-code-btn[disabled] { border-color: #dfe0ea; color: #b2b6cc; background: #fafafc; cursor: default; }
.login-input.shake { animation: shk .4s; border-color: #e17055; }
@keyframes shk { 0%,100%{transform:translateX(0)} 25%{transform:translateX(-7px)} 50%{transform:translateX(7px)} 75%{transform:translateX(-4px)} }
.login-err { color: #e17055; font-size: 13px; margin-top: 10px; line-height: 1.6; }
.login-btn { margin-top: 16px; }
.login-btn[disabled] { opacity: .6; }
.login-note { color: #b2bec3; font-size: 12px; line-height: 1.8; margin-top: 18px; }

/* 首页账号行 */
.account-line { display: flex; align-items: center; justify-content: center; gap: 8px; margin-top: 20px; font-size: 12px; color: #9aa0ab; }
.acc-avatar { width: 36px; height: 36px; border-radius: 50%; object-fit: cover; background: #eef0f7; }
.acc-meta { display: inline-flex; flex-direction: column; align-items: flex-start; line-height: 1.25; text-align: left; }
.acc-meta .js-acc-name { color: #4a4f5e; font-size: 13px; font-weight: 600; }
.acc-meta .js-acc-region { font-size: 11px; }
.bar-avatar { width: 30px; height: 30px; border-radius: 50%; overflow: hidden; flex: none; background: #eef0f7; }
.bar-avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.link-btn {
  border: none; background: none; color: #4c3ef0; font-size: 12px;
  cursor: pointer; text-decoration: underline; font-family: inherit; padding: 0;
}

/* ===== 庆祝颁奖特效 ===== */
.celebrate {
  position: fixed; inset: 0; z-index: 300;
  background: rgba(38, 22, 80, .5);
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
}
.celebrate-card {
  background: #fff; border-radius: 24px; padding: 26px 34px 24px;
  text-align: center; max-width: 320px; width: 86%;
  box-shadow: 0 24px 70px rgba(0, 0, 0, .35);
  animation: cpop .45s cubic-bezier(.2, 1.4, .4, 1);
  position: relative; z-index: 2;
}
@keyframes cpop { from { transform: scale(.55); opacity: 0; } }
.celebrate-card .trophy { font-size: 54px; display: inline-block; animation: tbounce 1.1s ease infinite; }
@keyframes tbounce { 0%, 100% { transform: translateY(0) rotate(-4deg); } 50% { transform: translateY(-12px) rotate(4deg); } }
.c-title { font-size: 21px; font-weight: 800; margin-top: 6px; }
.c-level { color: #6b7280; font-size: 14px; margin-top: 2px; }
.c-score { margin: 12px 0 4px; }
.c-score b { font-size: 42px; color: #4c3ef0; }
.c-score span { color: #9aa0ab; font-size: 15px; margin-left: 4px; }
.stars { font-size: 30px; letter-spacing: 8px; margin: 4px 0 8px; }
.stars .lit { color: #ffd166; text-shadow: 0 2px 8px rgba(255, 180, 0, .5); display: inline-block; animation: starpop .5s backwards; }
.stars .lit:nth-child(2) { animation-delay: .15s; }
.stars .lit:nth-child(3) { animation-delay: .3s; }
@keyframes starpop { from { transform: scale(0) rotate(-90deg); } }
.stars .dim { color: #e5e8ee; }
.c-unlock { background: #eef0ff; color: #4c3ef0; font-size: 13px; font-weight: 600; border-radius: 999px; padding: 7px 14px; display: inline-block; margin-top: 4px; }
.celebrate-btn { margin-top: 16px; width: 100%; }

/* 彩带雨 */
.confetti {
  position: absolute; top: -16px; width: 9px; height: 15px; z-index: 1;
  animation: confall linear forwards;
  pointer-events: none;
}
@keyframes confall {
  to { transform: translateY(108vh) rotate(720deg); }
}
