/* ===== 基础重置 ===== */
* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; }
body {
  font-family: var(--font-body);
  color: var(--ink);
  background: #2b2622;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 16px;
}

/* ===== 手机外框 ===== */
.phone {
  position: relative;
  width: var(--phone-w);
  max-width: 100%;
  height: 860px;
  max-height: calc(100vh - 32px);
  background: var(--bg-child);
  border-radius: 44px;
  overflow: hidden;
  box-shadow: 0 30px 80px rgba(0,0,0,.45);
  display: flex;
  flex-direction: column;
  border: 10px solid #1b1714;
}
.screen {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  padding: 0 18px calc(var(--tabbar-h) + 18px);
  transition: background .25s ease;
}
.screen--child { background: var(--bg-child); }
.screen--parent { background: var(--bg-parent); }
.screen::-webkit-scrollbar { width: 0; }

/* ===== 顶部胶囊状态条 ===== */
.statusbar {
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 22px;
  font-size: 13px;
  font-weight: 700;
  color: var(--ink);
  opacity: .65;
}

/* ===== 通用文本 ===== */
.title-font { font-family: var(--font-title); }
h1,h2,h3 { font-family: var(--font-title); font-weight: 400; letter-spacing: .5px; }
.muted { color: var(--ink2); }
.weak { color: var(--ink-weak); }

/* ===== 顶栏（返回 / 标题） ===== */
.topbar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 2px 10px;
  position: sticky;
  top: 0;
  z-index: 5;
}
.topbar .back {
  width: 38px; height: 38px;
  border-radius: 50%;
  background: #fff;
  border: none;
  display: grid; place-items: center;
  box-shadow: 0 4px 12px rgba(0,0,0,.06);
  cursor: pointer;
  font-size: 18px;
}
.topbar h2 { font-size: 22px; }
.topbar .spacer { flex: 1; }

/* ===== 卡片 ===== */
.card {
  background: var(--card);
  border-radius: var(--radius-md);
  padding: 18px;
  box-shadow: 0 8px 22px rgba(46,120,200,.09);
}
.card + .card, .stack > * + * { margin-top: 14px; }
.section-title {
  font-family: var(--font-title);
  font-size: 19px;
  margin: 18px 4px 10px;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ===== 按钮 ===== */
.btn {
  border: none;
  border-radius: 999px;
  font-family: var(--font-title);
  font-size: 17px;
  padding: 14px 22px;
  cursor: pointer;
  transition: transform .08s ease, filter .15s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.btn:active { transform: scale(.97); }
.btn-primary { background: linear-gradient(135deg, var(--brand), var(--orange)); color: #fff; box-shadow: 0 10px 22px rgba(255,140,40,.35); }
.btn-soft { background: var(--brand-soft); color: #14539E; }
.btn-ghost { background: #fff; color: var(--ink); box-shadow: 0 4px 12px rgba(0,0,0,.06); }
.btn-danger { background: #FF5C5C; color: #fff; box-shadow: 0 10px 22px rgba(255,92,92,.32); }
.btn-danger:active { background: #E03E3E; }
.btn-block { width: 100%; }
.btn[disabled] { filter: grayscale(.5) opacity(.6); cursor: not-allowed; }

/* ===== 标签 / 胶囊 ===== */
.chip {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 12px; font-weight: 700;
  padding: 4px 10px; border-radius: 999px;
  background: var(--brand-soft); color: #14539E;
}
.chip.sub { color: #fff; }

/* ===== 星星 ===== */
.star { color: var(--star); }
.star-row { display: inline-flex; gap: 2px; font-size: 14px; }

/* ===== 首页 ===== */
.hero {
  background: linear-gradient(160deg, #6FB8FF, #2E9BFF 55%, #2C86E6);
  border-radius: var(--radius-lg);
  padding: 20px;
  color: #fff;
  position: relative;
  overflow: hidden;
  box-shadow: 0 14px 30px rgba(46,155,255,.3);
}
.hero::after {
  content: "★";
  position: absolute; right: -10px; top: -10px;
  font-size: 120px; color: rgba(255,255,255,.18);
}
.hero .hi { font-family: var(--font-title); font-size: 24px; }
.hero .lvl { font-size: 13px; opacity: .9; margin-top: 2px; }
.hero .stats { display: flex; gap: 18px; margin-top: 16px; }
.hero .stat { display: flex; align-items: center; gap: 6px; font-weight: 700; }
.hero .stat small { font-weight: 400; opacity: .85; font-size: 11px; display: block; }
.hero .avatar {
  position: absolute; right: 18px; top: 18px;
  width: 52px; height: 52px; border-radius: 50%;
  background: #fff; color: var(--orange);
  display: grid; place-items: center;
  font-family: var(--font-title); font-size: 26px;
  box-shadow: 0 6px 16px rgba(0,0,0,.15);
}

/* 今日任务 */
.task {
  display: flex; align-items: center; gap: 12px;
  background: #fff; border-radius: var(--radius-sm);
  padding: 14px; box-shadow: 0 6px 16px rgba(46,120,200,.08);
}
.task .bar { width: 6px; align-self: stretch; border-radius: 6px; }
.task .info { flex: 1; min-width: 0; }
.task .info .t { font-weight: 700; font-size: 15px; }
.task .info .sub { font-size: 12px; color: var(--ink2); margin-top: 3px; display: flex; gap: 8px; align-items: center; }
.task .check {
  width: 30px; height: 30px; border-radius: 50%;
  border: 2px solid var(--line); display: grid; place-items: center;
  cursor: pointer; flex-shrink: 0; font-size: 16px; color: #fff;
}
.task.done .check { background: var(--sub-daofa); border-color: var(--sub-daofa); }
.task.done .info .t { color: var(--ink-weak); text-decoration: line-through; }

/* 快捷入口 */
.quick-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.quick {
  background: #fff; border-radius: var(--radius-sm); padding: 14px;
  display: flex; flex-direction: column; gap: 6px; cursor: pointer;
  box-shadow: 0 6px 16px rgba(46,120,200,.08); text-align: left; border: none;
}
.quick .emo { font-size: 26px; }
.quick .qt { font-family: var(--font-title); font-size: 16px; }
.quick .qs { font-size: 12px; color: var(--ink2); }

/* 家长入口 */
.parent-entry {
  margin-top: 16px; text-align: center; font-size: 12px; color: var(--ink-weak);
  cursor: pointer;
}

/* ===== 星球（闯关） ===== */
.planet-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.planet {
  border-radius: var(--radius-md); padding: 16px; color: #fff;
  min-height: 150px; display: flex; flex-direction: column; justify-content: space-between;
  cursor: pointer; position: relative; overflow: hidden;
  box-shadow: 0 10px 24px rgba(0,0,0,.12);
}
.planet .pemo { font-size: 40px; }
.planet .pname { font-family: var(--font-title); font-size: 20px; }
.planet .pdesc { font-size: 12px; opacity: .9; margin-top: 4px; }
.planet .pprog { font-size: 12px; background: rgba(255,255,255,.25); padding: 3px 10px; border-radius: 999px; align-self: flex-start; }

/* ===== 关卡路径 ===== */
.path-head { display: flex; align-items: center; gap: 12px; margin: 8px 0 18px; }
.path-head .pemo { font-size: 38px; }
.level-path { position: relative; padding-left: 8px; }
.level-path::before {
  content: ""; position: absolute; left: 26px; top: 18px; bottom: 18px;
  width: 4px; background: var(--line); border-radius: 4px;
}
.level-node {
  position: relative; display: flex; align-items: center; gap: 16px;
  background: #fff; border-radius: var(--radius-sm); padding: 14px 16px;
  margin-bottom: 14px; box-shadow: 0 6px 16px rgba(46,120,200,.08);
  cursor: pointer;
}
.level-node.locked { opacity: .55; cursor: not-allowed; }
.level-node .dot {
  width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center;
  font-family: var(--font-title); flex-shrink: 0; z-index: 1;
  background: var(--brand-soft); color: #14539E;
}
.level-node.active .dot { background: var(--brand); color: #fff; box-shadow: 0 0 0 5px rgba(46,155,255,.25); }
.level-node.done .dot { background: var(--sub-daofa); color: #fff; }
.level-node .lt { font-weight: 700; font-size: 15px; }
.level-node .ls { font-size: 12px; color: var(--ink2); margin-top: 2px; }
.level-node .lstars { margin-left: auto; font-size: 13px; color: var(--star); }

/* ===== 答题 ===== */
.quiz-progress { display: flex; gap: 6px; margin: 8px 0 16px; }
.quiz-progress .seg { flex: 1; height: 6px; border-radius: 6px; background: var(--line); }
.quiz-progress .seg.on { background: var(--brand); }
.quiz .stem { font-family: var(--font-title); font-size: 22px; line-height: 1.5; margin-bottom: 6px; }
.quiz .stem-img { font-size: 64px; text-align: center; margin: 6px 0 14px; }
.quiz .opts { display: flex; flex-direction: column; gap: 12px; margin-top: 14px; }
.opt {
  background: #fff; border: 2px solid var(--line); border-radius: var(--radius-sm);
  padding: 16px; font-size: 17px; font-weight: 600; cursor: pointer; text-align: left;
  display: flex; align-items: center; gap: 12px; transition: all .12s ease;
}
.opt .key { width: 30px; height: 30px; border-radius: 50%; background: var(--brand-soft); color: #14539E; display: grid; place-items: center; font-weight: 700; flex-shrink: 0; }
.opt.sel { border-color: var(--brand); background: var(--brand-soft); }
.opt.right { border-color: var(--sub-daofa); background: #E6F8F0; }
.opt.wrong { border-color: var(--sub-yuwen); background: #FFECEC; }

/* ===== 结算 ===== */
.result { text-align: center; padding-top: 24px; }
.result .big-star { font-size: 90px; }
.result h1 { font-size: 30px; margin: 6px 0; }
.result .score { font-family: var(--font-title); font-size: 18px; color: var(--orange); }
.result .earn { display: inline-flex; gap: 14px; margin: 16px 0; }
.result .earn .e { background: #fff; border-radius: var(--radius-sm); padding: 12px 18px; box-shadow: 0 6px 16px rgba(46,120,200,.09); }
.result .exp { background: #fff; border-radius: var(--radius-md); padding: 16px; text-align: left; margin-top: 14px; }
.result .exp .eq { font-weight: 700; margin-bottom: 6px; }
.result .exp .ea { font-size: 14px; color: var(--ink2); line-height: 1.6; }
.result .actions { display: flex; gap: 12px; margin-top: 18px; }

/* ===== 我的（星星树） ===== */
.profile-card {
  background: linear-gradient(160deg, #FFF, #EAF3FF);
  border-radius: var(--radius-lg); padding: 18px; display: flex; align-items: center; gap: 14px;
  box-shadow: 0 10px 24px rgba(46,120,200,.12);
}
.profile-card .avatar {
  width: 64px; height: 64px; border-radius: 50%;
  background: linear-gradient(135deg, var(--brand), var(--orange)); color: #fff;
  display: grid; place-items: center; font-family: var(--font-title); font-size: 32px; flex-shrink: 0;
}
.profile-card .pn { font-family: var(--font-title); font-size: 22px; }
.profile-card .pl { font-size: 13px; color: var(--ink2); }
.profile-card .pstats { display: flex; gap: 14px; margin-top: 6px; font-size: 13px; font-weight: 700; }
.startree { text-align: center; padding: 8px 0; }
.startree .tree { font-size: 13px; line-height: 1.2; }
.menu-row {
  display: flex; align-items: center; gap: 12px; background: #fff; border-radius: var(--radius-sm);
  padding: 16px; cursor: pointer; box-shadow: 0 6px 16px rgba(46,120,200,.08);
}
.menu-row + .menu-row { margin-top: 12px; }
.menu-row .mico { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; font-size: 22px; background: var(--brand-soft); }
.menu-row .mt { font-weight: 700; flex: 1; }
.menu-row .arrow { color: var(--ink-weak); }

/* ===== 签到 ===== */
.signin-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 8px; }
.signin-cell {
  aspect-ratio: 1; border-radius: 12px; background: #fff; display: grid; place-items: center;
  font-size: 11px; color: var(--ink2); box-shadow: 0 4px 10px rgba(46,120,200,.07); position: relative;
}
.signin-cell.signed { background: var(--brand-soft); color: #14539E; }
.signin-cell .ck { font-size: 18px; }
.reward-row { display: flex; gap: 10px; overflow-x: auto; padding: 4px 0; }
.reward {
  flex: 0 0 auto; width: 84px; background: #fff; border-radius: var(--radius-sm); padding: 12px 8px;
  text-align: center; box-shadow: 0 6px 16px rgba(46,120,200,.08);
}
.reward .re { font-size: 26px; }
.reward .rn { font-size: 11px; margin-top: 4px; color: var(--ink2); }
.reward.got { outline: 2px solid var(--brand); }

/* ===== 家长端通用 ===== */
.parent-head { background: linear-gradient(135deg, #5FB2FF, #2E9BFF); color: #fff; border-radius: var(--radius-lg); padding: 20px; box-shadow: 0 12px 26px rgba(46,120,200,.28); }
.parent-head h2 { font-size: 22px; }
.parent-head .ps { font-size: 13px; opacity: .9; margin-top: 4px; }

/* 趋势图 */
.chart { display: flex; align-items: flex-end; gap: 10px; height: 170px; padding: 10px 0; }
.chart .col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; height: 100%; justify-content: flex-end; }
.chart .bar { width: 60%; border-radius: 8px 8px 0 0; background: linear-gradient(180deg, #5FB2FF, #2E9BFF); transition: height .4s ease; }
.chart .lab { font-size: 11px; color: var(--ink2); }
.chart .val { font-size: 11px; font-weight: 700; color: var(--ink); }

.sub-acc { display: flex; flex-direction: column; gap: 12px; }
.sub-acc .row { display: flex; align-items: center; gap: 10px; }
.sub-acc .dot { width: 12px; height: 12px; border-radius: 50%; flex-shrink: 0; }
.sub-acc .name { width: 48px; font-size: 13px; font-weight: 600; }
.sub-acc .track { flex: 1; height: 12px; background: var(--line-blue); border-radius: 999px; overflow: hidden; }
.sub-acc .fill { height: 100%; border-radius: 999px; }
.sub-acc .pct { width: 42px; text-align: right; font-size: 13px; font-weight: 700; }

/* 错题 / 待巩固 */
.mistake { background: #fff; border-radius: var(--radius-sm); padding: 14px 16px; box-shadow: 0 6px 16px rgba(80,120,200,.08); }
.mistake + .mistake { margin-top: 12px; }
.mistake .ms { font-weight: 700; font-size: 15px; }
.mistake .ma { font-size: 13px; margin-top: 8px; display: flex; flex-direction: column; gap: 4px; }
.mistake .ma .bad { color: var(--sub-yuwen); }
.mistake .ma .good { color: var(--sub-daofa); }
.mistake .mbtn { margin-top: 10px; }

/* 设置列表 */
.set-row { display: flex; align-items: center; gap: 12px; background: #fff; border-radius: var(--radius-sm); padding: 14px 16px; }
.set-row + .set-row { margin-top: 10px; }
.set-row .st { flex: 1; }
.set-row .st .sname { font-weight: 700; font-size: 15px; }
.set-row .st .sdesc { font-size: 12px; color: var(--ink2); margin-top: 2px; }
.toggle { width: 50px; height: 30px; border-radius: 999px; background: var(--line-blue); position: relative; cursor: pointer; transition: background .2s; flex-shrink: 0; border: none; }
.toggle.on { background: var(--sub-daofa); }
.toggle::after { content: ""; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff; transition: transform .2s; box-shadow: 0 2px 4px rgba(0,0,0,.2); }
.toggle.on::after { transform: translateX(20px); }
.range { width: 100%; }
.dnd { display: flex; gap: 10px; align-items: center; }
.dnd input { flex: 1; border: 1px solid var(--line-blue); border-radius: 10px; padding: 8px; font-family: var(--font-body); }

/* 家长门禁键盘 */
.gate { text-align: center; padding: 20px 0; }
.gate .lock { font-size: 70px; }
.pin-display { display: flex; gap: 14px; justify-content: center; margin: 18px 0; }
.pin-display .d { width: 16px; height: 16px; border-radius: 50%; background: var(--line); }
.pin-display .d.filled { background: var(--brand); }
.keypad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; max-width: 280px; margin: 0 auto; }
.keypad button {
  aspect-ratio: 1; border-radius: 18px; border: none; background: #fff; font-family: var(--font-title);
  font-size: 28px; cursor: pointer; box-shadow: 0 6px 14px rgba(80,120,200,.1); color: var(--ink);
}
.keypad button:active { transform: scale(.95); }
.keypad .del { color: var(--sub-yuwen); font-size: 22px; }
.gate .hint { font-size: 12px; color: var(--ink-weak); margin-top: 14px; }

/* 报告 */
.range-tabs { display: flex; gap: 8px; background: #fff; border-radius: 999px; padding: 4px; width: fit-content; margin: 0 auto 14px; }
.range-tabs button { border: none; background: transparent; padding: 8px 18px; border-radius: 999px; font-family: var(--font-title); font-size: 14px; cursor: pointer; color: var(--ink2); }
.range-tabs button.on { background: var(--brand); color: #fff; }
.report-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.report-stats .rs { background: #fff; border-radius: var(--radius-sm); padding: 14px; text-align: center; box-shadow: 0 6px 16px rgba(80,120,200,.08); }
.report-stats .rs .v { font-family: var(--font-title); font-size: 24px; color: var(--orange); }
.report-stats .rs .l { font-size: 12px; color: var(--ink2); margin-top: 4px; }

/* ===== Tabbar ===== */
.tabbar {
  position: absolute; left: 0; right: 0; bottom: 0; height: var(--tabbar-h);
  background: #fff; display: flex; align-items: center; justify-content: space-around;
  box-shadow: 0 -6px 20px rgba(0,0,0,.06); padding-bottom: env(safe-area-inset-bottom);
  border-radius: 0 0 34px 34px; z-index: 20;
}
.tabbar[style*="none"] { display: none !important; }
.tab { border: none; background: transparent; display: flex; flex-direction: column; align-items: center; gap: 3px; cursor: pointer; color: var(--ink-weak); font-size: 11px; font-weight: 700; }
.tab .ico { font-size: 24px; }
.tab.active { color: var(--brand); }

/* ===== Toast ===== */
.toast {
  position: fixed; left: 50%; bottom: 120px; transform: translateX(-50%) translateY(20px);
  background: rgba(40,32,28,.92); color: #fff; padding: 10px 18px; border-radius: 999px;
  font-size: 14px; opacity: 0; pointer-events: none; transition: all .25s ease; z-index: 99;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ===== 保护眼 / 兜底 ===== */
.loading { text-align: center; color: var(--ink-weak); padding: 40px 0; font-size: 14px; }
.err { text-align: center; color: var(--sub-yuwen); padding: 30px 0; }
