/* KET 学习系统 · 儿童友好 · PC+H5 响应式 */
* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
:root {
  --blue: #4A7DFF; --blue-d: #2F5FE0; --blue-l: #EAF0FF;
  --green: #2BB673; --green-l: #E5F7EE;
  --orange: #FF9F43; --orange-l: #FFF3E4;
  --red: #FF6B6B; --red-l: #FFECEC;
  --purple: #8C7AE6; --purple-l: #F0EDFC;
  --ink: #2D3648; --ink-2: #6B7688; --ink-3: #9AA3B5;
  --bg: #F5F7FB; --card: #FFFFFF; --line: #E8ECF3;
  --r: 16px; --r-s: 12px;
  --shadow: 0 2px 10px rgba(45,54,72,.06);
}
html { font-size: 16px; }
body {
  font-family: "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
  background: var(--bg); color: var(--ink); line-height: 1.6;
  min-height: 100vh;
}
button { font-family: inherit; cursor: pointer; border: none; }

/* ===== 布局：PC 侧栏 + 移动底栏 ===== */
.app { display: flex; min-height: 100vh; }
.sidebar {
  width: 220px; background: var(--card); border-right: 1px solid var(--line);
  padding: 24px 14px; position: fixed; top: 0; bottom: 0; left: 0; z-index: 20;
  display: flex; flex-direction: column; gap: 6px;
}
.logo { font-size: 20px; font-weight: 700; color: var(--blue); padding: 0 12px 18px; letter-spacing: 1px; }
.logo small { display: block; font-size: 12px; color: var(--ink-3); font-weight: 400; letter-spacing: 0; }
.nav-btn {
  display: flex; align-items: center; gap: 10px; padding: 12px 14px;
  border-radius: var(--r-s); background: transparent; color: var(--ink-2);
  font-size: 15px; text-align: left; transition: all .15s;
}
.nav-btn:hover { background: var(--bg); }
.nav-btn.active { background: var(--blue-l); color: var(--blue); font-weight: 600; }
.nav-btn .ico { width: 22px; height: 22px; flex: none; }
.main { flex: 1; margin-left: 220px; padding: 24px; max-width: 860px; }
.tabbar { display: none; }

@media (max-width: 768px) {
  .sidebar { display: none; }
  .main { margin-left: 0; padding: 16px 14px 80px; }
  .tabbar {
    display: flex; position: fixed; bottom: 0; left: 0; right: 0; z-index: 30;
    background: var(--card); border-top: 1px solid var(--line);
    padding: 6px 0 calc(6px + env(safe-area-inset-bottom));
  }
  .tab-btn {
    flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px;
    background: none; color: var(--ink-3); font-size: 11px;
  }
  .tab-btn .ico { width: 24px; height: 24px; }
  .tab-btn.active { color: var(--blue); font-weight: 600; }
}

/* ===== 通用组件 ===== */
.card {
  background: var(--card); border-radius: var(--r); padding: 20px;
  box-shadow: var(--shadow); margin-bottom: 16px;
}
.page-title { font-size: 22px; font-weight: 700; margin-bottom: 4px; }
.page-sub { color: var(--ink-2); font-size: 14px; margin-bottom: 18px; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 12px 24px; border-radius: 999px; font-size: 16px; font-weight: 600;
  background: var(--blue); color: #fff; transition: transform .1s, opacity .15s;
}
.btn:active { transform: scale(.96); }
.btn.ghost { background: var(--blue-l); color: var(--blue); }
.btn.green { background: var(--green); }
.btn.orange { background: var(--orange); }
.btn.red { background: var(--red-l); color: var(--red); }
.btn.sm { padding: 8px 16px; font-size: 14px; }
.btn.block { width: 100%; }
.btn:disabled { opacity: .4; cursor: not-allowed; }
.pill {
  display: inline-block; padding: 3px 12px; border-radius: 999px;
  font-size: 12px; font-weight: 600;
}
.pill.blue { background: var(--blue-l); color: var(--blue); }
.pill.green { background: var(--green-l); color: var(--green); }
.pill.orange { background: var(--orange-l); color: var(--orange); }
.pill.red { background: var(--red-l); color: var(--red); }
.pill.purple { background: var(--purple-l); color: var(--purple); }

/* 今日任务 */
.hero {
  background: linear-gradient(135deg, #4A7DFF, #6C5CE7); color: #fff;
  border-radius: var(--r); padding: 22px; margin-bottom: 16px;
}
.hero h2 { font-size: 18px; font-weight: 700; }
.hero .row { display: flex; gap: 18px; margin-top: 14px; flex-wrap: wrap; }
.hero .stat { text-align: center; min-width: 64px; }
.hero .stat b { display: block; font-size: 24px; }
.hero .stat span { font-size: 12px; opacity: .85; }
.task {
  display: flex; align-items: center; gap: 14px; padding: 16px;
  background: var(--card); border-radius: var(--r); box-shadow: var(--shadow);
  margin-bottom: 12px; cursor: pointer; transition: transform .1s;
}
.task:active { transform: scale(.98); }
.task .t-ico {
  width: 46px; height: 46px; border-radius: 14px; flex: none;
  display: flex; align-items: center; justify-content: center;
}
.task .t-body { flex: 1; min-width: 0; }
.task .t-name { font-weight: 700; font-size: 16px; }
.task .t-detail { font-size: 13px; color: var(--ink-2); }
.task .t-state { flex: none; font-size: 13px; color: var(--ink-3); display: flex; align-items: center; gap: 4px; }
.task.done { opacity: .62; }
.task.done .t-name { text-decoration: line-through; }

/* 单词卡 */
.wordcard {
  background: var(--card); border-radius: 20px; padding: 34px 24px;
  box-shadow: var(--shadow); text-align: center; margin-bottom: 16px;
  min-height: 320px; display: flex; flex-direction: column; justify-content: center;
}
.wordcard .w { font-size: 40px; font-weight: 800; letter-spacing: .5px; cursor: pointer; }
.wordcard .pos { color: var(--ink-3); font-size: 14px; margin-top: 2px; }
.wordcard .cn { font-size: 22px; color: var(--blue-d); font-weight: 600; margin-top: 12px; }
.wordcard .ex { margin-top: 16px; font-size: 16px; color: var(--ink); }
.wordcard .excn { font-size: 13px; color: var(--ink-2); margin-top: 2px; }
.speak-btn {
  width: 52px; height: 52px; border-radius: 50%; background: var(--blue-l);
  display: inline-flex; align-items: center; justify-content: center;
  margin: 14px auto 0; transition: transform .1s;
}
.speak-btn:active { transform: scale(.9); }
.grade-row { display: flex; gap: 10px; }
.grade-row .btn { flex: 1; padding: 14px 4px; font-size: 15px; }
.g-again { background: var(--red-l); color: var(--red); }
.g-hard { background: var(--orange-l); color: var(--orange); }
.g-good { background: var(--green-l); color: var(--green); }
.g-easy { background: var(--blue-l); color: var(--blue); }

/* 进度条 */
.prog { height: 8px; background: var(--line); border-radius: 99px; overflow: hidden; margin: 10px 0 18px; }
.prog i { display: block; height: 100%; background: var(--blue); border-radius: 99px; transition: width .3s; }

/* 测验 */
.quiz-q { font-size: 19px; font-weight: 700; margin-bottom: 16px; line-height: 1.5; }
.opt {
  display: block; width: 100%; text-align: left; padding: 14px 16px;
  background: var(--bg); border: 2px solid transparent; border-radius: var(--r-s);
  font-size: 16px; margin-bottom: 10px; color: var(--ink); transition: all .12s;
}
.opt:hover { border-color: var(--blue); }
.opt.sel-right { background: var(--green-l); border-color: var(--green); color: var(--green); font-weight: 700; }
.opt.sel-wrong { background: var(--red-l); border-color: var(--red); color: var(--red); font-weight: 700; }
.opt.show-right { border-color: var(--green); }
.opt:disabled { cursor: default; }
.tipbox { background: var(--orange-l); border-radius: var(--r-s); padding: 12px 14px; font-size: 14px; color: #9a6511; margin-bottom: 12px; }
.banner { background: linear-gradient(135deg, var(--red), #ff7a59); color: #fff; border-radius: var(--r-m); padding: 13px 16px; font-size: 14px; font-weight: 600; margin-bottom: 14px; cursor: pointer; box-shadow: 0 4px 14px rgba(216,90,48,.25); display: flex; align-items: center; gap: 8px; }
.banner b { font-size: 18px; }
.banner:active { transform: scale(.99); }

/* 拼写 */
.spell-input {
  width: 100%; padding: 14px; font-size: 22px; text-align: center; letter-spacing: 2px;
  border: 2px solid var(--line); border-radius: var(--r-s); outline: none;
  font-family: inherit; color: var(--ink); background: var(--card);
}
.spell-input:focus { border-color: var(--blue); }

/* 语法 */
.lesson-item {
  display: flex; align-items: center; gap: 12px; padding: 14px 16px;
  background: var(--card); border-radius: var(--r); box-shadow: var(--shadow);
  margin-bottom: 10px; cursor: pointer;
}
.lesson-item .num {
  width: 36px; height: 36px; border-radius: 50%; background: var(--purple-l);
  color: var(--purple); font-weight: 700; display: flex; align-items: center;
  justify-content: center; flex: none;
}
.lesson-item.locked { opacity: .5; }
.word-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.wchip {
  display: inline-flex; align-items: center; gap: 4px; font-size: 13px; font-weight: 600;
  background: var(--blue-l); color: var(--blue); padding: 6px 10px; border-radius: 999px; cursor: pointer;
}
.wchip i { font-style: normal; font-weight: 400; opacity: .8; }
.wchip:hover { filter: brightness(.97); }
.gpoint { padding: 10px 0 10px 14px; border-left: 3px solid var(--blue-l); margin-bottom: 10px; font-size: 15px; }
.gex { background: var(--bg); border-radius: var(--r-s); padding: 10px 14px; margin-bottom: 8px; }
.gex .en { font-weight: 600; }
.gex .cn { font-size: 13px; color: var(--ink-2); }

/* 统计 */
.stat-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin-bottom: 16px; }
@media (min-width: 560px) { .stat-grid { grid-template-columns: repeat(4, 1fr); } }
.stat-card { background: var(--card); border-radius: var(--r); padding: 16px; text-align: center; box-shadow: var(--shadow); }
.stat-card b { display: block; font-size: 26px; color: var(--blue); }
.stat-card span { font-size: 12px; color: var(--ink-2); }
.heatmap { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.hm-cell { aspect-ratio: 1; border-radius: 6px; background: var(--line); position: relative; }
.hm-cell.l1 { background: #BFE3CF; }
.hm-cell.l2 { background: #6FCB96; }
.hm-cell.l3 { background: var(--green); }
.hm-cell.today { outline: 2px solid var(--blue); outline-offset: 1px; }
.hm-cell span { position: absolute; top: 2px; left: 4px; font-size: 10px; color: rgba(45,54,72,.55); }

/* 打卡成功遮罩 */
.overlay {
  position: fixed; inset: 0; background: rgba(45,54,72,.55); z-index: 100;
  display: flex; align-items: center; justify-content: center; padding: 24px;
}
.overlay .panel {
  background: var(--card); border-radius: 24px; padding: 36px 28px; text-align: center;
  max-width: 340px; width: 100%; animation: pop .3s ease;
}
@keyframes pop { from { transform: scale(.7); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.overlay .big { font-size: 52px; line-height: 1.2; }
.overlay h3 { font-size: 20px; margin: 10px 0 6px; }
.overlay p { color: var(--ink-2); font-size: 14px; margin-bottom: 18px; }

.empty { text-align: center; color: var(--ink-3); padding: 40px 0; font-size: 15px; }
.center { text-align: center; }
.mt { margin-top: 14px; }
.row-between { display: flex; justify-content: space-between; align-items: center; }
textarea.io {
  width: 100%; min-height: 120px; border: 2px solid var(--line); border-radius: var(--r-s);
  padding: 10px; font-size: 12px; font-family: monospace; outline: none;
}

/* ===== 游戏化：顶部挂件 ===== */
.g-topbar { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.g-chip { background: var(--card); border: 1px solid var(--line); border-radius: 999px;
  padding: 5px 12px; font-size: 13px; font-weight: 600; color: var(--ink); box-shadow: var(--shadow); }
.g-chip.shield { color: var(--blue); }
.g-chip.ticket { color: var(--purple); cursor: pointer; }
.g-flame { color: var(--orange); font-weight: 700; }
.g-flame.off { color: var(--ink-3); font-weight: 600; }

/* ===== 宠物 ===== */
.pet-card { display: flex; align-items: center; gap: 16px; }
.pet-emoji { line-height: 1; filter: drop-shadow(0 4px 6px rgba(0,0,0,.08)); }
.pet-info { flex: 1; }
.pet-name { font-weight: 700; font-size: 15px; }
.pet-bar { height: 8px; background: var(--line); border-radius: 999px; overflow: hidden; margin-top: 6px; }
.pet-bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--orange), var(--red)); border-radius: 999px; transition: width .5s; }
.pet-bar.full i { background: linear-gradient(90deg, var(--green), var(--blue)); }
.pet-hint { font-size: 11px; color: var(--ink-3); margin-top: 5px; }
.pet-home { display: flex; flex-direction: column; }

/* ===== 奖励弹窗 ===== */
.reward-panel { max-width: 320px; }
.r-title { font-size: 18px; font-weight: 700; margin-bottom: 14px; }
.r-row { font-size: 15px; padding: 7px 0; border-bottom: 1px dashed var(--line); }
.r-row.lvl { color: var(--purple); font-weight: 700; }
.r-row.evo { color: var(--orange); font-weight: 700; }
.r-badges { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin: 12px 0; }
.r-badge { background: var(--orange-l); color: var(--orange); border-radius: 999px; padding: 5px 12px; font-size: 13px; font-weight: 600; }

/* ===== Boss ===== */
.boss { font-size: 64px; line-height: 1.2; animation: bossfloat 2s ease-in-out infinite; }
@keyframes bossfloat { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }
.boss-hp { display: flex; align-items: center; gap: 10px; font-size: 12px; color: var(--ink-2); margin: 6px 0; }

/* ===== 徽章墙 ===== */
.badge-wall { display: grid; grid-template-columns: repeat(auto-fill, minmax(78px, 1fr)); gap: 10px; }
.badge { text-align: center; padding: 10px 6px; border-radius: var(--r-s); border: 1px solid var(--line); }
.badge.on { background: var(--orange-l); border-color: transparent; }
.badge.off { opacity: .45; filter: grayscale(1); }
.b-emoji { font-size: 26px; }
.b-name { font-size: 12px; font-weight: 600; margin-top: 2px; }
.b-date { font-size: 10px; color: var(--ink-3); margin-top: 2px; }

/* ===== 闯关地图 ===== */
.map-phase { background: var(--card); border-radius: var(--r); padding: 14px 16px; margin-bottom: 12px; border-left: 5px solid var(--line); }
.map-phase.active { border-left-color: var(--blue); box-shadow: var(--shadow); }
.map-phase.passed { border-left-color: var(--green); }
.map-phase.locked { opacity: .6; }
.mp-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.mp-cont { font-weight: 700; font-size: 15px; }
.mp-weeks { display: flex; flex-wrap: wrap; gap: 8px; }
.mp-node { background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; font-size: 12px; }
.mp-node.done { background: var(--green-l); border-color: transparent; color: var(--green); font-weight: 600; }
.mp-node.cur { background: var(--blue-l); border-color: transparent; color: var(--blue); font-weight: 700; box-shadow: 0 0 0 3px rgba(74,125,255,.15); }
.mp-node.todo { color: var(--ink-3); }

/* ===== 抽卡 ===== */
.gacha-spin { font-size: 48px; animation: spin .5s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.gacha-result { font-size: 18px; font-weight: 700; color: var(--orange); }

/* ===== 记忆健康度 ===== */
.mem-bar { display: flex; height: 14px; border-radius: 8px; overflow: hidden; background: var(--line); }
.mem-seg { height: 100%; transition: width .4s ease; }
.mem-healthy { background: var(--green); }
.mem-review { background: var(--orange); }
.mem-weak { background: var(--red); }
.mem-legend { display: flex; gap: 14px; flex-wrap: wrap; margin-top: 10px; font-size: 13px; color: var(--ink-2); }
.mem-legend .dot { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: middle; }
.mem-legend .dot.healthy { background: var(--green); }
.mem-legend .dot.review { background: var(--orange); }
.mem-legend .dot.weak { background: var(--red); }

/* ===== 家长周报 + 打印 ===== */
.report-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 16px; }
@media print {
  .sidebar, .tabbar, .no-print, #overlay { display: none !important; }
  .app { display: block !important; }
  .main, #main { width: 100% !important; max-width: 100% !important; padding: 0 !important; }
  .card, .stat-card { box-shadow: none !important; border: 1px solid #e3e7ef !important; break-inside: avoid; }
  body { background: #fff !important; }
  .page-title { color: #1b2b4a !important; }
}

/* ===== 账户 / 登录 ===== */
#overlay-bg { display: none; }
