/* ===== 星星成长园 儿童风基座 ===== */
/* ============================================================
 * 星星成长园 v2 主题设计系统（依据 docs/ui-v2-guide.md v2.1）
 * 兼容优先：旧 token 名保留为别名（见本 :root 底部"兼容别名块"），
 *  app.js / t4 / t5 / t6 内联 var(--pink-deep/--cream/--sub/--gold/--ok/--warn 等) 全部自动生效。
 * ============================================================ */
:root {
  /* 画布 / 表面 / 描边（t29：樱花粉——孩子喜欢粉色，白卡+暖白粉背景） */
  --bg: #FDF8FA;
  --bg-grad: linear-gradient(180deg,#FEFBFC 0%,#F9F0F5 100%);
  --surface: #FFFFFF;
  --surface-2: #FAF3F7;
  --surface-soft: #FCF7FA;
  --line: #F3E8EE;
  --line-strong: #E8D5E0;
  /* 品牌主色（樱花粉 + 深玫瑰文字） */
  --brand: #F48FB8;
  --brand-deep: #C2447E;
  --brand-soft: #FCE9F1;
  --brand-grad: linear-gradient(135deg,#F7A8C9 0%,#F9C6D9 100%);
  --brand-on: #FFFFFF;
  /* 辅助 / 强调 / 支持 */
  --gold: #F5A623;
  --gold-soft: #FFE9C2;
  --gold-grad: linear-gradient(135deg,#FFC94D,#F5A623);
  --mint: #3EC6A8;
  --mint-soft: #CFF3E7;
  --mint-grad: linear-gradient(135deg,#53D6BB,#3EC6A8);
  --sky: #5AB3F0;
  --sky-soft: #D6EBFC;
  /* 文字 */
  --ink: #4E4249;
  --ink-sub: #968890;
  --ink-faint: #CDBFC7;
  --ink-on-brand: #FFFFFF;
  /* 功能色 */
  --ok: #4FC97A;
  --ok-soft: #DCF7E4;
  --warn: #FFB84C;
  --warn-soft: #FFEFD2;
  --danger: #F0726B;
  --danger-soft: #FBE3E0;
  --info: #5AB3F0;
  /* 学科色 */
  --cat-chinese: #EE5F7C;
  --cat-math: #5C8EF0;
  --cat-english: #F0A23A;
  --cat-science: #3EC6A8;
  --cat-habit: #9B72E8;
  --cat-sport: #FF8A5C;
  --cat-chore: #5AB3F0;
  --cat-custom: #8A93A6;
  /* 圆角标尺 */
  --r-sm: 12px;
  --r-md: 16px;
  --r-lg: 22px;
  --r-xl: 28px;
  --r-full: 999px;
  /* 阴影标尺（t29 玫瑰灰调） */
  --sh-sm: 0 2px 8px rgba(150,80,110,.06);
  --sh-md: 0 8px 24px -6px rgba(150,80,110,.13);
  --sh-lg: 0 16px 42px -12px rgba(150,80,110,.20);
  --sh-ring: 0 10px 24px -8px rgba(244,143,184,.38);
  --sh-float: 0 20px 50px -16px rgba(95,50,70,.30);
  /* 间距标尺 */
  --sp-1: 4px;
  --sp-2: 8px;
  --sp-3: 12px;
  --sp-4: 16px;
  --sp-5: 24px;
  --sp-6: 32px;
  --sp-7: 40px;
  --sp-8: 56px;
  /* 字体 */
  --font-display: "ZCOOL KuaiLe","PingFang SC","Hiragino Sans GB",system-ui,sans-serif;
  --font-body: "PingFang SC","Hiragino Sans GB","Microsoft YaHei","Noto Sans SC",system-ui,sans-serif;
  --fs-hero: 30px;
  --fs-title: 24px;
  --fs-h2: 20px;
  --fs-lg: 18px;
  --fs-base: 16px;
  --fs-sm: 14px;
  --fs-xs: 12px;
  --w-regular: 400;
  --w-medium: 600;
  --w-bold: 800;
  /* 动效 */
  --t-fast: .12s;
  --t-base: .2s;
  --t-slow: .32s;
  --t-float: 3.2s;
  --ease-out: cubic-bezier(.22,.61,.36,1);
  --ease-spring: cubic-bezier(.34,1.4,.64,1);
  --ease-in-out: cubic-bezier(.45,0,.55,1);
  /* 进度 / 数据 */
  --progress-track: #F5E8EE;
  --progress-ink: var(--brand-grad);
  --progress-gold: var(--gold-grad);
  --ring-track: #F5E8EE;
  /* ---- 兼容别名块（旧名 → 新 canonical；ui-v2-guide §2.13）---- */
  --card: var(--surface);
  --cream: var(--brand-soft);
  --pink: var(--brand);
  --pink-deep: var(--brand-deep);
  --sub: var(--ink-sub);
  --radius: var(--r-lg);
  --shadow: var(--sh-md);
  --yellow: var(--gold);
  /* --bg/--ink/--gold/--ok/--warn/--mint/--sky 同名已规范化为新值 */
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--ink);
  font-family: var(--font-body); }
#app { max-width: 560px; margin: 0 auto; padding: env(safe-area-inset-top) 16px calc(env(safe-area-inset-bottom) + 150px); min-height: 100vh; }

/* ===== 通用 ===== */
h1, h2, h3 { margin: .4em 0; }
h1, h2 { font-family: var(--font-display); color: var(--ink); }
.btn { display:inline-flex; align-items:center; justify-content:center; gap:6px;
  border:0; border-radius:var(--r-full); padding:12px 22px; font-size:17px; font-weight:var(--w-bold);
  color:#93415F; background:var(--brand-grad); box-shadow:var(--sh-ring); cursor:pointer;   /* t29：粉底配深玫瑰字 */
  transition:transform var(--t-fast) var(--ease-out), filter var(--t-fast) var(--ease-out); user-select:none; }
.btn.ok, .btn.danger, .btn.warn { color:#fff; }
.btn:active { transform: scale(.94); filter: brightness(1.05); }
.btn.ghost { background:#fff; color:var(--brand-deep); border:2px solid var(--brand); box-shadow:var(--sh-sm); }
.btn.wide { width:100%; height:var(--sp-6); }
.btn.small { padding:8px 14px; font-size:14px; }
.btn.ok { background:var(--mint-grad); }
.btn.warn { background:var(--warn); }
.btn.danger { background:var(--danger); }
.btn:disabled { opacity:.45; box-shadow:none; }
.card { background:linear-gradient(180deg,#FFFFFF 0%,#FEFCFD 62%,#FDF7FA 100%); border-radius:var(--r-lg); padding:var(--sp-4);
  box-shadow:0 10px 26px -12px rgba(180,120,60,.20), inset 0 1px 0 rgba(255,255,255,.95); }
.row { display:flex; align-items:center; gap:10px; }
.grow { flex:1; min-width:0; }
.center { text-align:center; }
.muted { color:var(--ink-sub); font-size:13px; }
.tag { display:inline-block; padding:3px 10px; border-radius:var(--r-full); font-size:var(--fs-xs);
  background:var(--brand-soft); color:var(--brand-deep); font-weight:var(--w-bold); }
input, select, textarea { font:inherit; color:var(--ink); width:100%; padding:11px 14px;
  border:2px solid var(--line); border-radius:var(--r-md); background:var(--surface-2); outline:none; }
input:focus, select:focus, textarea:focus { border-color:var(--brand); }

/* ===== 顶部页头 ===== */
.topbar { display:flex; align-items:center; gap:10px; padding:8px 2px 14px; }
.topbar .back { font-size:26px; background:none; border:0; cursor:pointer; color:var(--pink-deep); }
.topbar h2 { margin:0; font-size:20px; flex:1; }

/* ===== 首页 ===== */
.hero { text-align:center; padding:var(--sp-4) 0 6px; background:radial-gradient(120% 90% at 50% -20%, rgba(244,143,184,.15), rgba(244,143,184,0) 62%), linear-gradient(180deg,#FBEFF4 0%,#F9E8F0 100%); border-radius:0 0 var(--r-xl) var(--r-xl); }
.hero .logo { font-size:56px; line-height:1; filter:drop-shadow(0 8px 16px rgba(80,40,20,.18)); }
.hero h1 { font-size:var(--fs-hero); color:var(--brand-deep); margin:6px 0 2px; }
.kid-grid { display:grid; grid-template-columns:repeat(auto-fit,minmax(150px,1fr)); gap:var(--sp-4); margin-top:var(--sp-6); }
.kid-card { cursor:pointer; text-align:center; padding:var(--sp-4); transition:transform var(--t-fast) var(--ease-out); }
.kid-card:active { transform:scale(.96); }
.kid-card .face { font-size:var(--fs-hero); line-height:1; background:var(--brand-soft); border-radius:var(--r-md); width:64px; margin:0 auto; padding:6px; }
.kid-card .nm { font-family:var(--font-display); font-weight:var(--w-bold); margin-top:8px; font-size:var(--fs-lg); }
.kid-card .pt { font-size:var(--fs-sm); color:var(--ink-sub); }
.parent-door { position:fixed; right:14px; bottom:calc(env(safe-area-inset-bottom) + 14px);
  width:44px; height:44px; border-radius:var(--r-full); background:var(--surface); box-shadow:var(--sh-float);
  display:flex; align-items:center; justify-content:center; font-size:20px; cursor:pointer;
  border:2px solid var(--line); color:var(--ink-sub); opacity:.85; }

/* ===== 孩子端 ===== */
.ring-wrap { display:flex; align-items:center; gap:16px; margin:6px 0 14px; }
.ring { position:relative; width:110px; height:110px; flex:0 0 auto; }
.ring svg { transform:rotate(-90deg); }
.ring .num { position:absolute; inset:0; display:flex; flex-direction:column;
  align-items:center; justify-content:center; font-family:var(--font-display); font-weight:var(--w-bold); font-size:var(--fs-title); color:var(--brand-deep); }
.ring .num small { font-size:var(--fs-xs); color:var(--ink-sub); font-weight:var(--w-medium); }
.streak-chip { font-weight:var(--w-bold); color:#C47C00; background:var(--gold-soft); padding:6px 12px;
  border-radius:var(--r-full); font-size:var(--fs-sm); white-space:nowrap; }
.task-list { display:grid; grid-template-columns:repeat(auto-fill,minmax(112px,1fr)); gap:10px; margin-top:14px; align-items:stretch; }
.task { display:flex; align-items:center; gap:12px; padding:var(--sp-4); position:relative; }
.task-list .task { min-height:130px; display:flex; align-items:flex-start; }   /* t18：等高卡（对齐/按钮沉底） */
.task-list .task .l.grow { display:flex; flex-direction:column; min-width:0; }
.task-list .task .row { margin-top:auto; padding-top:8px; }
.task-list .task .row { flex-wrap:wrap; gap:4px; }        /* t18：窄卡内行可换行，防右侧截断 */
.task-list .task .link { font-size:12px; }
.task-list .task .rd-actions { margin-top:auto; }
.task .rd-more { margin-top:6px; font-size:12px; }
.task .rd-more summary { cursor:pointer; color:var(--brand-deep); font-weight:700; }
.task .rd-more .rd-text { font-size:12px; margin-top:4px; white-space:pre-wrap; }
.task .ic { font-size:34px; width:46px; height:46px; text-align:center; display:flex; align-items:center; justify-content:center;
  background:linear-gradient(180deg,#FFFFFF 0%,#FFECD9 100%); border-radius:var(--r-md);
  box-shadow:inset 0 1px 0 rgba(255,255,255,.9), 0 2px 8px rgba(180,120,60,.12); }
.task .t { font-weight:var(--w-medium); font-size:var(--fs-lg); }
.task .pts { color:var(--gold); font-weight:var(--w-bold); font-size:var(--fs-base); }
.task .link { font-size:var(--fs-sm); color:var(--sky); text-decoration:none; font-weight:var(--w-bold); }
.task.done-ok { background:var(--ok-soft); }
.task.done-wait { background:var(--warn-soft); }
.task.done-no { background:var(--danger-soft); opacity:.78; }
.task.done-ok::before, .task.done-wait::before, .task.done-no::before {
  content:""; position:absolute; left:0; top:14px; bottom:14px; width:4px; border-radius:0 4px 4px 0; }
.task.done-ok::before { background:var(--ok); }
.task.done-wait::before { background:var(--warn); }
.task.done-no::before { background:var(--danger); }
.pill { font-size:12px; font-weight:800; padding:4px 10px; border-radius:999px; white-space:nowrap; }
.pill.ok { background:#D8F3DC; color:#2E7D32; }
.pill.wait { background:#FFEDC9; color:#B26A00; }
.pill.no { background:#FBDDDD; color:#B00020; }

/* ===== 宠物 ===== */
.pet-stage { text-align:center; padding:8px 0 2px; position:relative; }
.pet-stage::before { content:""; position:absolute; left:50%; top:50%; width:240px; height:240px; transform:translate(-50%,-50%); background:radial-gradient(circle, rgba(244,143,184,.14) 0%, rgba(244,143,184,0) 68%); pointer-events:none; }
.pet-avatar { font-size:120px; line-height:1; filter:drop-shadow(0 10px 18px rgba(180,130,220,.32));
  animation: float var(--t-float) var(--ease-in-out) infinite; }
@keyframes float { 0%,100%{ transform:translateY(0); } 50%{ transform:translateY(-10px); } }
.pet-bubble { position:relative; display:inline-block; }
.pet-heart { position:absolute; font-size:26px; animation: heartUp 1.4s ease-out forwards; pointer-events:none; }
@keyframes heartUp { from{ opacity:1; transform:translateY(0) scale(1);} to{ opacity:0; transform:translateY(-70px) scale(1.6);} }
.expbar { height:18px; background:var(--progress-track); border-radius:var(--r-full); overflow:hidden; margin:10px 0 4px; }
.expbar > i { display:block; height:100%; border-radius:var(--r-full); background:var(--mint-grad); transition:width var(--t-slow) var(--ease-in-out); }
.moods { font-size:18px; letter-spacing:2px; }
.skin-grid { display:grid; grid-template-columns:repeat(3,1fr); gap:10px; margin-top:10px; }
.skin { border:3px solid transparent; border-radius:16px; padding:10px 4px; text-align:center;
  background:#FFFDFE; cursor:pointer; }
.skin.on { border-color:var(--brand); background:var(--brand-soft); box-shadow:var(--sh-ring); }
.skin .s-face { font-size:34px; }

/* ===== 商店 ===== */
.shop-list { display:flex; flex-direction:column; gap:12px; margin-top:14px; }
.reward { display:flex; align-items:center; gap:12px; padding:var(--sp-4); }
.reward .emo { font-size:var(--fs-title); background:var(--brand-soft); border-radius:var(--r-full); width:56px; height:56px; display:flex; align-items:center; justify-content:center; }
.reward .pts { color:var(--gold); font-weight:var(--w-bold); }

/* ===== Toast & 彩带 ===== */
.toast { position:fixed; left:50%; top:18%; transform:translateX(-50%);
  background:rgba(74,50,66,.92); color:#fff; padding:12px 22px; border-radius:999px;
  font-size:15px; font-weight:700; z-index:99; box-shadow:0 8px 24px rgba(0,0,0,.2); }
.confetti-layer { position:fixed; inset:0; pointer-events:none; z-index:98; overflow:hidden; }
.confetti { position:absolute; top:-20px; font-size:22px; animation: fall linear forwards; }
@keyframes fall { to { transform: translateY(105vh) rotate(720deg); } }

/* ===== 家长端 ===== */
.pin-box { max-width:220px; margin:10px auto; text-align:center; }
.pin-input { text-align:center; font-size:28px; letter-spacing:14px; font-weight:800; }
.tabs { display:flex; gap:8px; overflow-x:auto; padding:4px 0 12px; }
.tab { flex:0 0 auto; padding:8px 16px; border-radius:999px; background:#fff; border:2px solid var(--cream);
  font-weight:700; color:var(--sub); cursor:pointer; }
.tab.on { background:var(--brand); border-color:var(--brand); color:#fff; }
.list { display:flex; flex-direction:column; gap:10px; }
.lrow { display:flex; align-items:center; gap:10px; padding:12px; }
.lrow .l { flex:1; min-width:0; }
.switch { position:relative; width:52px; height:30px; border-radius:999px; background:#E6D3DC;
  cursor:pointer; transition:background .2s; flex:0 0 auto; }
.switch.on { background:var(--brand); }
.switch::after { content:""; position:absolute; top:3px; left:3px; width:24px; height:24px;
  border-radius:50%; background:#fff; transition:left .2s; box-shadow:0 2px 6px rgba(0,0,0,.15); }
.switch.on::after { left:25px; }
.panel { margin-bottom:14px; }
.section-title { font-weight:var(--w-bold); font-size:var(--fs-lg); margin:var(--sp-6) 2px 10px; color:var(--brand-deep); }
.tpl-grid { display:grid; grid-template-columns:1fr 1fr; gap:10px; }
.tpl { padding:12px; cursor:pointer; }
.tpl .t { font-weight:800; }
code, .mono { font-family:ui-monospace,Consolas,monospace; font-size:12px; }
.mt10 { margin-top:10px; } .mb10 { margin-bottom:10px; }
.hidden { display:none !important; }
.shake { animation: shake .4s; }
@keyframes shake { 0%,100%{transform:translateX(0);} 25%{transform:translateX(-8px);} 75%{transform:translateX(8px);} }
.ok-note { background:#EAF7EC; color:#2E7D32; border-radius:12px; padding:8px 12px; font-size:13px; font-weight:700; }

/* ===== v2 借鉴 StarKids UI-DESIGN-REF：金色积分、儿童端大字号大按钮、家长端沉稳蓝 ===== */
:root { --gold:#F5A623; }
body.kid-mode h2 { font-size:22px; }
body.kid-mode .btn { height:56px; font-size:18px; border-radius:28px; padding:0 22px; }
body.kid-mode .btn.small { height:48px; font-size:16px; border-radius:24px; padding:0 16px; }
body.kid-mode .task .t { font-size:18px; }
body.kid-mode .pts { color:var(--gold); font-size:16px; }
body.kid-mode .section-title { font-size:18px; }
.greet { display:flex; align-items:center; gap:12px; margin-bottom:14px; }
.chips { display:flex; gap:8px; flex-wrap:wrap; }
.navtabs { display:flex; gap:8px; margin:14px 0 2px; }
.nt { flex:1; text-align:center; padding:10px 4px; border-radius:16px; background:#fff;
  color:var(--sub); text-decoration:none; font-weight:700; border:2px solid var(--cream); }
.nt.on { background:var(--pink); border-color:var(--pink); color:#fff; }
.nt-i { font-size:22px; display:block; }
.nt-l { font-size:13px; }
.pet-mini svg { width:100%; height:auto; display:block; margin:0 auto; }
.kid-card .pet-mini { width:64px; margin:6px auto 0; }
.task { position:relative; }
.floatstar { position:absolute; left:50%; top:8px; pointer-events:none; font-weight:800;
  color:var(--gold); font-size:22px; animation: starUp 1s ease-out forwards; z-index:5; }
@keyframes starUp { from{ opacity:1; transform:translate(-50%,0) scale(.8);} to{ opacity:0; transform:translate(-50%,-48px) scale(1.5);} }
.modal-mask { position:fixed; inset:0; background:rgba(74,50,66,.45); z-index:97;
  display:flex; align-items:center; justify-content:center; padding:24px; }
.modal { background:#fff; border-radius:24px; padding:22px; width:100%; max-width:340px; text-align:center; }
.m-title { font-size:20px; font-weight:800; margin-bottom:10px; }
.m-row { font-size:16px; padding:4px 0; }
.modal .btn { border-radius:14px; }
.skin .s-face svg { width:52px; height:auto; }
body.parent-mode { background:#F4F6FA; }
body.parent-mode #app { font-size:15px; }
body.parent-mode h1, body.parent-mode h2 { color:#2E4B73; }
body.parent-mode .card { border-radius:14px; box-shadow:0 2px 10px rgba(40,70,120,.08); }
body.parent-mode .btn { background:#3B7BD6; border-radius:var(--r-md); box-shadow:none; }
body.parent-mode .btn.ghost { background:#fff; color:#3B7BD6; border-color:#3B7BD6; }
body.parent-mode .btn.ok { background:#3FA56B; }
body.parent-mode .btn.warn { background:#E8A200; }
body.parent-mode .btn.danger { background:#E05C5C; }
body.parent-mode .tab.on { background:#3B7BD6; border-color:#3B7BD6; }
body.parent-mode .switch.on { background:#3B7BD6; }
body.parent-mode .section-title, body.parent-mode h2 { color:#2E4B73; }
body.parent-mode .t { font-size:15px; }
body.parent-mode .pts { color:#E8A200; }
body.parent-mode input, body.parent-mode select, body.parent-mode textarea { background:#F7F9FC; border-color:#E3E9F0; }
body.parent-mode input:focus, body.parent-mode select:focus, body.parent-mode textarea:focus { border-color:#3B7BD6; }

/* ===== v2 AI 功能组（t6：陪聊/错题/朗读/周报） ===== */
.chat-reply { background:#FFF8E1; border:2px solid #FBE7B9; border-radius:14px; padding:10px 12px; margin-top:10px;
  font-size:15px; font-weight:600; color:#7A5A00; min-height:22px; line-height:1.6; }
.btn.chip { background:#fff; color:var(--pink-deep); border:2px solid var(--cream); border-radius:999px;
  padding:8px 14px; font-size:13px; font-weight:700; box-shadow:none; height:auto; white-space:nowrap; }
.btn.chip:active { transform:scale(.94); }
body.kid-mode .btn.chip { height:auto; }
.tiny { font-size:11px; color:var(--sub); }
.explain { background:#EAF7EC; border-radius:12px; padding:10px 12px; font-weight:700; color:#2E7D32; margin-top:10px; line-height:1.7; }
.rd-text { background:#FFF8F5; border-radius:12px; padding:10px 12px; line-height:1.8; }
.rd-result { min-height:24px; margin-top:10px; font-size:15px; font-weight:700; color:var(--pink-deep); line-height:1.7; }
.rd-stars { font-size:24px; letter-spacing:3px; }
.rd-ans { font-weight:800; color:#2E7D32; background:#EFFBF1; border-radius:10px; padding:6px 10px; }
#ai-input { min-width:0; }
body.parent-mode .rd-result, body.parent-mode .chat-reply { color:#7A5A00; }

/* ===== v2 桌宠引擎（t4）：浮层/气泡/三层状态机 =====
 * grep 对照（验收 A2）：idle / happy / sad / eat / sleep / drag / boost
 * → 环境 idle-breath…、情绪 mood-happy/excited/sad/hungry/dirty/sick、
 *   事件 ev-pet/ev-pet-reject/ev-eat/ev-sleep/ev-drag/ev-boost（dp-* keyframes 同名）。
 */
.deskpet { position:fixed; z-index:90; width:118px; height:118px; pointer-events:none;
  user-select:none; -webkit-user-select:none; -webkit-tap-highlight-color:transparent;
  font-family:"PingFang SC","Microsoft YaHei",system-ui,sans-serif; }
.deskpet .pet-float { width:100%; height:100%; pointer-events:auto; touch-action:none; cursor:grab; }
.deskpet .pet-avatar { width:100%; height:100%; animation:none; filter:none; /* 隔离通用 .pet-avatar 的 float/drop-shadow，避免干扰 dp-* 呼吸；不 !important 以免压掉更具体的 dp 状态动画 */ }
.deskpet .pet-avatar svg { width:100%; height:100%; display:block; overflow:visible;
  filter:drop-shadow(0 8px 14px rgba(232,116,156,.28)); }
/* 部件 transform 基准：以自身包围盒中心为原点（SVG 默认以视口原点，必须覆写） */
#deskpet svg [id^="pet-"] { transform-box:fill-box; transform-origin:center; }
.deskpet .pet-particles { position:absolute; inset:0; pointer-events:none; }

/* —— 说话气泡（ui-v2-guide §3.14 .pet-bubble）—— */
.pet-bubble { position:absolute; left:50%; bottom:calc(100% + 6px); transform:translateX(-50%) translateY(4px);
  max-width:190px; background:#fff; border:2px solid var(--brand-soft); border-radius:16px; padding:9px 13px;
  font-size:14px; font-weight:700; line-height:1.5; color:var(--ink); text-align:center; white-space:normal;
  opacity:0; pointer-events:none; box-shadow:0 6px 18px rgba(0,0,0,.14); transition:opacity .2s, transform .2s; }
.pet-bubble::after { content:""; position:absolute; left:50%; bottom:-8px; transform:translateX(-50%);
  border:6px solid transparent; border-top-color:#fff; }
.pet-bubble.show { opacity:1; transform:translateX(-50%) translateY(0); }
.pet-bubble.bwarn { background:#FFF8E1; border-color:#FBE7B9; }
.pet-bubble.bwarn::after { border-top-color:#FFF8E1; }
.pet-bubble.bstar { background:#EAF7EC; border-color:#C8E6C9; }   /* 里程碑（配小星/爱心） */
.pet-bubble.bstar::after { border-top-color:#EAF7EC; }
.pet-bubble.bboom { background:#FFF0F5; border-color:#FFC4CE; }   /* 进化/开蛋庆祝 */
.pet-bubble.bboom::after { border-top-color:#FFF0F5; }

/* —— 隐藏暂停（document.hidden 时 JS 加 .dp-hidden，动画 play-state 全暂停）—— */
.dp-hidden .pet-avatar, .dp-hidden .pet-avatar svg, .dp-hidden .pet-avatar [id^="pet-"] { animation-play-state:paused !important; }

/* —— 环境态：idle 呼吸 / 眨眼 / 打哈欠 / 微摆 / 睡眠（sleep）—— */
#deskpet[data-state="idle"] .pet-avatar svg,
#deskpet[data-state^="mood-"] .pet-avatar svg { animation: dp-idle 1.9s ease-in-out infinite; }
@keyframes dp-idle { 0%,100%{ transform:scaleY(1);} 50%{ transform:scaleY(1.03);} }
.dp-blink #pet-eye-l, .dp-blink #pet-eye-r { animation: dp-blink .13s ease; }
@keyframes dp-blink { 0%,100%{ transform:scaleY(1);} 45%,55%{ transform:scaleY(.08);} }
.dp-yawn .dk-svg { animation: dp-yawn .6s ease; }
.dp-yawn #pet-eye-l, .dp-yawn #pet-eye-r { transform:scaleY(.6); }
@keyframes dp-yawn { 0%,100%{ transform:rotate(0);} 40%{ transform:rotate(-4deg) translateY(-2px);} }
.dp-wiggle #pet-ear-l, .dp-wiggle #pet-tail { animation: dp-wiggle .8s ease-in-out; }
.dp-wiggle #pet-ear-r { animation: dp-wiggle .8s ease-in-out .12s; }
@keyframes dp-wiggle { 0%,100%{ transform:rotate(0);} 30%{ transform:rotate(8deg);} 70%{ transform:rotate(-8deg);} }
#pet-pupil-l, #pet-pupil-r { transition:transform .7s ease; }
#deskpet[data-state="sleep"] .pet-avatar svg { animation: dp-sleep 2.4s ease-in-out infinite; }
#deskpet[data-state="sleep"] #pet-eye-l, #deskpet[data-state="sleep"] #pet-eye-r { transform:scaleY(.12); }
@keyframes dp-sleep { 0%,100%{ transform:scaleY(1);} 50%{ transform:scaleY(1.02);} }

/* —— 情绪态姿态 —— */
#deskpet[data-mood="sad"] .pet-avatar { animation: dp-sad 3s ease-in-out infinite; }
#deskpet[data-mood="sad"] #pet-ear-l { transform:rotate(14deg); }
#deskpet[data-mood="sad"] #pet-ear-r { transform:rotate(-14deg); }
#deskpet[data-mood="sad"] #pet-tail { transform:rotate(12deg); }
@keyframes dp-sad { 0%,100%{ transform:translateY(0) scale(1);} 50%{ transform:translateY(3px) scale(.99);} }
#deskpet[data-mood="dirty"] .pet-avatar { animation: dp-shiver 1.6s linear infinite; }
#deskpet[data-mood="sick"] .pet-avatar { animation: dp-sleep 3s ease-in-out infinite; transform:rotate(-4deg); }
#deskpet[data-mood="excited"] .pet-avatar { animation: dp-happy 1.2s ease-in-out infinite; }
@keyframes dp-happy { 0%,100%{ transform:translateY(0);} 30%{ transform:translateY(-8px) scale(1.04,1.02);} 60%{ transform:translateY(0);} 80%{ transform:translateY(-4px);} }
#deskpet[data-mood="hungry"] .pet-avatar { animation: dp-hungry 2.2s ease-in-out infinite; }
@keyframes dp-hungry { 0%,100%{ transform:scale(1);} 50%{ transform:scale(.97,1.03);} }

/* —— 事件态：ev-pet(摸蹦) / ev-pet-reject(害羞躲) / ev-eat(喂食) / ev-drag+ev-drop(拖拽回弹) / ev-boost(进化闪光) —— */
.dp-pet { animation: dp-pet .32s ease; }
@keyframes dp-pet { 0%,100%{ transform:translateY(0) scale(1,1);} 35%{ transform:translateY(-8px) scale(1.06,1.02);} 60%{ transform:translateY(0) scale(.96,1.04);} }
.dp-reject { animation: dp-reject .52s ease; }
@keyframes dp-reject { 0%,100%{ transform:translateX(0);} 30%{ transform:translateX(9px) rotate(3deg);} 60%{ transform:translateX(-4px);} }
#deskpet[data-state="ev-eat"] .pet-avatar { animation: dp-eat .3s ease-in-out infinite; }
@keyframes dp-eat { 0%,100%{ transform:scale(1,1);} 50%{ transform:scale(1.04,.96);} }
.dp-glow { animation: dp-glow .4s ease; }
@keyframes dp-glow { 0%,100%{ filter:drop-shadow(0 0 0 rgba(120,220,120,0));} 50%{ filter:drop-shadow(0 0 12px rgba(120,220,120,.9));} }
.dp-drag { transform:scale(1.08,.86); }
.dp-drop { animation: dp-drop .22s ease; }
@keyframes dp-drop { 0%{ transform:scale(1,1);} 45%{ transform:scale(1.1,.9);} 100%{ transform:scale(1,1);} }
#deskpet[data-state="ev-boost"] .pet-avatar { animation: dp-boost 1.3s ease; }
@keyframes dp-boost { 0%{ transform:scale(1) rotate(0);} 25%{ transform:scale(1.12,1.05) rotate(6deg);} 50%{ transform:scale(1,.9) rotate(-6deg);} 75%{ transform:scale(1.1,1.06) rotate(3deg);} 100%{ transform:scale(1) rotate(0);} }
.dp-talk, #deskpet[data-state="ev-talk"] .pet-avatar { animation: dp-talk .3s ease; }
@keyframes dp-talk { 0%,100%{ transform:translateY(0);} 50%{ transform:translateY(-2px);} }
.dp-shiver { animation: dp-shiver .5s linear; }
@keyframes dp-shiver { 0%,100%{ transform:translateX(0);} 25%{ transform:translateX(-3px);} 75%{ transform:translateX(3px);} }

/* —— 粒子：红心/星/ZZZ/球 —— */
.dk-particle { position:absolute; pointer-events:none; font-size:15px; line-height:1; z-index:2; }
.dk-rise { animation: dk-rise .5s ease-out forwards; }
@keyframes dk-rise { from{ opacity:1; transform:translateY(0) scale(.8);} to{ opacity:0; transform:translateY(-48px) scale(1.6);} }
.dk-pz { font-size:16px; animation: dk-pz 1.6s ease-out forwards; }
@keyframes dk-pz { from{ opacity:0; transform:translate(0,0) scale(.7);} 25%{ opacity:1;} to{ opacity:0; transform:translate(16px,-42px) scale(1.25);} }
.dk-star { font-size:17px; animation: dk-star 1.3s ease-out forwards; }
@keyframes dk-star { from{ opacity:1; transform:rotate(0) scale(.4);} to{ opacity:0; transform:rotate(200deg) translateY(-34px) scale(1.5);} }
.dk-ball { font-size:15px; animation: dk-ball .7s ease-out forwards; }
@keyframes dk-ball { 0%{ transform:translateX(0);} 60%{ opacity:1;} 100%{ transform:translateX(34px) translateY(-6px); opacity:0;} }

/* ===== v2 教材进度 + 课程表（t5）：颜色一律 var(--*) token，不硬编码粉色（ui-v2-guide §6） ===== */
.cchips { display:flex; flex-wrap:wrap; gap:6px; margin-top:4px; }
.cchip { background:var(--yellow); color:var(--warn); border-radius:999px; padding:4px 10px; font-size:13px; font-weight:700; }
.club-line { margin-top:6px; font-size:15px; font-weight:700; color:var(--pink-deep); }
.club-line .muted { font-weight:400; }
.tag.ghost { background:var(--card); border:2px solid var(--cream); color:var(--sub); }
.tb-row { background:var(--card); border-radius:12px; margin-top:6px; }
.tb-row.done-ok { background:var(--mint); }
.tt-table { width:100%; border-collapse:collapse; font-size:13px; }
.tt-table th, .tt-table td { border:1px solid var(--cream); padding:6px; text-align:center; vertical-align:middle; }
.tt-table th { background:var(--cream); color:var(--pink-deep); font-weight:800; white-space:nowrap; }
.tt-table td.t { font-weight:800; white-space:nowrap; }
.tt-table select, .tt-table input { padding:6px 8px; font-size:13px; border-radius:10px; min-width:72px; }
.tt-table td:last-child input { min-width:130px; }
body.parent-mode .tt-table th { background:var(--sky); color:#2E4B73; }
body.parent-mode .tt-table th, body.parent-mode .tt-table td { border-color:var(--sky); }

/* ===== t22 课程表全时段（任意时段行 + 周末 + 课后班/补习班） ===== */
/* 孩子端今日卡：时段行 + 课后班高亮 + 周末休息占位（ui-v2-guide §3.5） */
.sched-row { display:flex; gap:8px; align-items:flex-start; }
.sched-row-label { flex:0 0 40px; font-size:12px; font-weight:800; color:var(--ink-sub); padding-top:4px; }
.sched-item.interest { display:flex; align-items:center; gap:8px; background:var(--gold-soft);
  border-radius:var(--r-md); padding:8px 10px; font-size:14px; }
.sched-item.interest .cat-bar { width:4px; align-self:stretch; border-radius:4px; background:var(--gold); }
.rest-day { padding:10px 0 2px; text-align:center; }
/* 家长编辑器：每天一张卡，时段行 = 科目下拉格 + 加减节 */
.tt-day { overflow-x:auto; }
.tt-grid { overflow-x:auto; margin-top:8px; }
.tt-row.emph .tt-label { color:var(--brand); font-weight:800; }
.tt-row .tt-label { white-space:nowrap; font-weight:700; }
.tt-row.emph td { background:var(--brand-soft); }
.tt-ops { white-space:nowrap; width:64px; }
.tt-mini { border:none; background:var(--cream); color:var(--ink-sub); border-radius:8px; width:26px; height:26px;
  font-size:14px; cursor:pointer; margin:0 2px; line-height:1; }
.tt-mini.danger { background:#FDE8E8; color:#C25B5B; }
.tt-mini:hover { background:var(--brand); color:#fff; }
.tt-as-box { background:var(--gold-soft); border-radius:var(--r-md); padding:8px; display:flex; flex-direction:column; gap:6px; }
.tt-as-row { display:flex; gap:6px; align-items:center; flex-wrap:wrap; }
.tt-as-row input { padding:6px 8px; font-size:13px; border-radius:10px; border:1px solid var(--cream); min-width:0; flex:1 1 110px; }
.tt-as-row input[style*="flex:0 0 86px"] { flex:0 0 96px !important; }

/* ===== v2 新增组件（ui-v2-guide §3.5 课程表 / §3.6 教材进度 / §3.13 accordion / §3.15 AI）===== */
.sched { display:flex; flex-direction:column; gap:var(--sp-3); margin:var(--sp-3) 0; }
.sched-header { display:flex; gap:var(--sp-2); overflow-x:auto; padding:4px 0; }
.sched-day { background:var(--surface); border-radius:var(--r-md); box-shadow:var(--sh-sm); padding:var(--sp-3); }
.sched-day-name { font-weight:var(--w-bold); font-size:var(--fs-base); color:var(--brand-deep); margin-bottom:var(--sp-2); }
.sched-item { display:flex; align-items:center; gap:var(--sp-2); padding:var(--sp-2) 0; border-bottom:1px dashed var(--line); }
.sched-item:last-child { border-bottom:none; }
.sched-item .cat-bar { width:4px; align-self:stretch; border-radius:4px; background:var(--cat-custom); }
.sched-item.interest { background:var(--gold-soft); border-radius:var(--r-md); padding:var(--sp-2); }
.sched-item.interest .cat-bar { background:var(--gold); }
.sched-today { background:var(--brand); color:#fff; border-radius:var(--r-full); padding:4px 10px; font-weight:var(--w-bold); font-size:var(--fs-xs); }
.book-progress { background:var(--surface); border-radius:var(--r-md); padding:var(--sp-4); box-shadow:var(--sh-sm); }
.book-progress .bar { height:14px; background:var(--progress-track); border-radius:var(--r-full); overflow:hidden; }
.book-progress .bar > i { display:block; height:100%; border-radius:var(--r-full); background:var(--brand-grad); transition:width var(--t-slow) var(--ease-in-out); }
.book-progress .num { font-family:var(--font-display); font-weight:var(--w-bold); color:var(--gold); font-size:var(--fs-sm); }
.book-units { display:flex; gap:var(--sp-2); margin-top:var(--sp-2); flex-wrap:wrap; }
.book-unit { padding:4px 12px; border-radius:var(--r-full); font-size:var(--fs-xs); font-weight:var(--w-bold); color:#fff; }
.book-unit.done { background:var(--mint); }
.book-unit.doing { background:var(--gold); }
.book-unit.todo { background:var(--ink-faint); }
.accordion { background:var(--surface); border-radius:var(--r-md); box-shadow:var(--sh-sm); overflow:hidden; }
.accordion > summary { list-style:none; display:flex; align-items:center; justify-content:space-between; padding:var(--sp-3) var(--sp-4); font-weight:var(--w-bold); cursor:pointer; }
.accordion > summary::-webkit-details-marker { display:none; }
.accordion > summary::after { content:"›"; transform:rotate(90deg); transition:transform var(--t-base) var(--ease-out); color:var(--ink-sub); }
.accordion[open] > summary::after { transform:rotate(-90deg); }
.accordion .acc-body { padding:0 var(--sp-4) var(--sp-3); }
.cat-chip { display:inline-flex; align-items:center; justify-content:center; width:52px; height:52px; border-radius:var(--r-md); background:var(--cat-custom); color:#fff; font-size:24px; }
.cat-chip.chinese { background:var(--cat-chinese); } .cat-chip.math { background:var(--cat-math); }
.cat-chip.english { background:var(--cat-english); } .cat-chip.science { background:var(--cat-science); }
.cat-chip.habit { background:var(--cat-habit); } .cat-chip.sport { background:var(--cat-sport); }
.cat-chip.chore { background:var(--cat-chore); } .cat-chip.custom { background:var(--cat-custom); }
.ai-card { background:var(--surface); border-radius:var(--r-lg); padding:var(--sp-4); box-shadow:var(--sh-md); }
.ai-card .ai-title { font-family:var(--font-display); font-weight:var(--w-bold); color:var(--brand-deep); font-size:var(--fs-title); margin-bottom:var(--sp-2); }
.rating-pill { display:inline-block; padding:4px 12px; border-radius:var(--r-full); font-weight:var(--w-bold); font-size:var(--fs-sm); }
.rating-3 { background:var(--ok-soft); color:#2E7D32; }
.rating-2 { background:var(--warn-soft); color:#B26A00; }
.rating-1 { background:var(--brand-soft); color:var(--brand-deep); }

/* 动效降级（ui-v2-guide §5：prefers-reduced-motion） */
@media (prefers-reduced-motion: reduce) {
  * { animation-duration:.01ms !important; animation-iteration-count:1 !important; transition-duration:.01ms !important; }
  .pet-avatar, .deskpet, .confetti { animation:none !important; }
}

/* ===== t13 桌宠换装：精灵表帧运行器 ===== */
.dk-frame { display:block; box-sizing:border-box; transform-origin:center bottom; }
.dk-hatch { animation: dk-hatch .7s ease; }
@keyframes dk-hatch { 0%{ transform:scale(.4); filter:brightness(2); opacity:.6;} 100%{ transform:scale(1); filter:none; opacity:1;} }
.pf { transform-origin:center bottom; }
@media (prefers-reduced-motion: reduce){ .dk-frame { animation:none !important; } }

/* ===== t14 换伙伴 + iPad/桌面响应式（<768 手机端不变） ===== */
.partner-row { display:flex; flex-wrap:wrap; gap:10px; margin-top:12px; }
.partner { display:flex; flex-direction:column; align-items:center; gap:4px; flex:1 1 96px; max-width:120px;
  border:2px solid var(--cream); background:var(--card); border-radius:var(--r-lg); padding:10px 8px;
  cursor:pointer; font-family:inherit; }
.partner.on { border-color:var(--brand); background:var(--brand-soft); }
.partner .pf-mini { width:64px; height:64px; display:block; }
.partner .pf-mini .pf, .partner .pf-mini svg { width:100%; height:100%; }

/* t14 修订：官方图鉴立绘桌宠（img 代替像素精灵表） */
.dk-poke { width:100%; height:100%; object-fit:contain; transform-origin:center bottom; display:block; }
.poke-img { transform-origin:center bottom; }
#deskpet[data-state="idle"] .dk-poke, #deskpet[data-state^="mood-"] .dk-poke { animation: dp-poke-idle 1.9s ease-in-out infinite; }
@keyframes dp-poke-idle { 0%,100%{ transform:translateY(0) scale(1);} 50%{ transform:translateY(-4px) scale(1.02);} }
.dp-blink .dk-poke, .dp-yawn .dk-poke { animation: dp-poke-idle .55s ease; }   /* 眨眼/哈欠 = 一次轻微缩放 */
#deskpet[data-state="sleep"] .dk-poke { animation: dp-poke-sleep 2.4s ease-in-out infinite; }
@keyframes dp-poke-sleep { 0%,100%{ transform:scale(1); filter:brightness(.96) saturate(.9);} 50%{ transform:scale(1.015);} }

@media (min-width:768px) {
  #app { max-width:880px; }
  /* t26：单娃/多娃都居中（此前 1fr 1fr 让单卡偏左、半屏空白） */
  .kid-grid { grid-template-columns:repeat(auto-fit,minmax(230px,300px)); justify-content:center; }
  .task-list { grid-template-columns:repeat(3,1fr); gap:12px; }
  .tab, .lrow .t, .card .t { font-size:16px; }
  .navtabs .nt-l { font-size:15px; }
  .tt-table { font-size:14px; }
  .tt-table select, .tt-table input { min-width:88px; }
  .partner { max-width:150px; }
}
@media (min-width:1024px) {
  #app { max-width:980px; }
  .task-list { grid-template-columns:repeat(4,1fr); }
  .tabs .tab { font-size:17px; }
}
/* ===== t19 导入作业弹窗 ===== */
.modal #hw-text { width:100%; min-height:110px; box-sizing:border-box; text-align:left; }
.modal .hw-photo-hint { text-align:left; line-height:1.6; color:var(--ink-sub); }
.hidden { display:none !important; }

/* ===== t23 轻量日历待办：本周日历条 + 截止日标签 ===== */
.week-strip { padding:10px 14px; }
.ws-head { font-size:13px; font-weight:800; color:var(--ink); margin-bottom:8px; }
.ws-row { display:flex; gap:4px; }
.ws-day { flex:1; text-align:center; padding:4px 0; border-radius:8px; position:relative; transition:background .15s; }
.ws-day.ws-today { background:rgba(244,143,184,.16); }
.ws-label { font-size:11px; color:var(--ink-sub); font-weight:600; }
.ws-count { font-size:14px; font-weight:800; color:var(--ink); min-height:18px; }
.ws-dot { position:absolute; top:2px; right:4px; width:6px; height:6px; border-radius:50%; background:var(--brand); }
.due-tag { background:rgba(244,143,184,.16); color:var(--brand-deep); font-size:11px; }

/* ===== t20 桌宠悬浮快捷面板（仿鲸鱼娘深色小面板 · 暖色主题） ===== */
.deskpet.dk-hidden { display:none !important; }               /* 🙈 用户隐藏小宠 */
.dk-restore { position:fixed; right:14px; bottom:14px; width:30px; height:30px; padding:0;
  display:flex; align-items:center; justify-content:center; font-size:12px; line-height:1;
  border-radius:50%; border:1px solid rgba(255,255,255,.55); background:rgba(30,40,60,.55); color:#fff;
  cursor:pointer; z-index:90; opacity:.85; }
.dk-restore:hover { opacity:1; background:rgba(150,90,220,.7); }
/* t27：面板改浅紫可爱卡片（旧深色玻璃面板与主题不搭、白字对比差） */
.dk-panel { position:absolute; left:50%; bottom:calc(100% + 44px); transform:translateX(-50%) scale(.94);
  transform-origin:center bottom; z-index:91; min-width:196px; max-width:240px; box-sizing:border-box;
  background:#FFFFFF; color:var(--ink); border:2px solid var(--brand-soft); border-radius:16px; padding:10px 12px;
  box-shadow:0 12px 30px rgba(95,55,140,.22);
  display:flex; flex-direction:column; gap:7px; pointer-events:auto;
  opacity:0; visibility:hidden; transition:opacity .18s ease, transform .18s ease, visibility .18s; }
.dk-panel.show { opacity:1; visibility:visible; transform:translateX(-50%) scale(1); }
.dk-panel.dk-below { bottom:auto; top:calc(100% + 12px); transform-origin:center top; }
.dk-panel.dk-below.show { transform:translateX(-50%) scale(1); }
.dkp-close { position:absolute; top:4px; right:6px; width:22px; height:22px; border:none; border-radius:50%;
  background:var(--surface-2); color:var(--ink-sub); font-size:12px; line-height:1; cursor:pointer; padding:0; }
.dkp-close:hover { background:var(--brand-soft); color:var(--brand-deep); }
.dkp-info { display:flex; align-items:center; gap:8px; font-size:12px; line-height:1.25;
  white-space:nowrap; overflow:hidden; justify-content:center; }
.dkp-name { font-weight:800; color:var(--brand-deep); max-width:64px; overflow:hidden; text-overflow:ellipsis; }
.dkp-bond { background:var(--brand-soft); color:var(--brand-deep); border-radius:999px; padding:1px 8px; font-size:11px; font-weight:700; }
.dkp-stars { color:#C47C00; font-weight:800; }
.dkp-actions { display:flex; gap:6px; }
.dkp-btn { flex:1; height:32px; border:none; border-radius:10px; background:var(--surface-2); color:var(--ink);
  font-size:15px; line-height:1; cursor:pointer; padding:0; }
.dkp-btn:hover, .dkp-btn:active { background:var(--brand-soft); }
.dkp-feedlist { display:none; gap:5px; }
.dkp-feedlist.open { display:flex; }
.dkp-item { flex:1; height:32px; border:none; border-radius:10px; background:var(--surface-2);
  font-size:15px; line-height:1; cursor:pointer; padding:0; }
.dkp-item:hover { background:#EBDDF9; }
.dkp-item:disabled { opacity:.4; cursor:not-allowed; }

/* ===== t25 孩子端首页版式（ui-kid-home-v2 §1-7 落地，末尾覆盖） ===== */
/* 问候卡：文字区 | 固定宠物位 */
.greet { display:grid; grid-template-columns:1fr auto; align-items:center; gap:12px; min-height:84px; padding:14px 16px; }
.greet .g-text { min-width:0; }
.greet .g-title { font-family:var(--font-display); font-size:22px; font-weight:var(--w-bold); color:var(--ink);
  white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.greet .g-title .mood-badge { font-size:16px; margin-right:4px; }
.greet .g-sub { font-size:13px; color:var(--ink-sub); white-space:nowrap; overflow:hidden; text-overflow:ellipsis; margin-top:3px; }
.greet .g-pet { width:72px; height:72px; justify-self:end; }
.greet .g-pet svg, .greet .g-pet .pf, .greet .g-pet img { width:100%; height:100%; }
/* 今日课程：一行横向滚动 chips + 金徽章 */
.course-scroll { display:flex; align-items:center; gap:8px; overflow-x:auto; -webkit-overflow-scrolling:touch; padding-bottom:4px; scrollbar-width:none; }
.course-scroll::-webkit-scrollbar { display:none; }
.cchip { display:inline-flex; align-items:center; white-space:nowrap; font-size:13px; line-height:1; font-weight:var(--w-medium);
  padding:7px 12px; border-radius:999px; background:var(--brand-soft); color:var(--brand-deep);
  max-width:128px; overflow:hidden; text-overflow:ellipsis; flex:0 0 auto; }
.cchip.c-inter { background:var(--gold-soft); color:#C47C00; font-weight:var(--w-bold); }
.course-head { display:flex; align-items:center; gap:8px; font-size:15px; font-weight:var(--w-bold); margin-bottom:8px; }
/* 教材进度：折叠 + 紧凑 3 行 */
.book-progress summary { cursor:pointer; list-style:none; }
.book-progress summary::-webkit-details-marker { display:none; }
.bp-head { display:flex; justify-content:space-between; font-size:15px; font-weight:var(--w-bold); margin-bottom:2px; }
.bp-head span { color:var(--ink-sub); font-size:13px; font-weight:var(--w-medium); }
.bp-rows { display:grid; gap:7px; margin-top:8px; }
.bp-row { display:grid; grid-template-columns:44px 1fr 40px; align-items:center; gap:8px; font-size:13px; }
.bp-name { white-space:nowrap; color:var(--ink); font-weight:var(--w-medium); }
.bp-bar { height:6px; background:var(--progress-track); border-radius:999px; overflow:hidden; }
.bp-bar > i { display:block; height:100%; border-radius:999px; background:var(--brand); }
.bp-pct { text-align:right; color:var(--ink-sub); font-size:12px; }
.bp-current { font-size:12px; color:var(--ink-sub); margin-top:8px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
/* 统计区：76px 环 | 副信息 + 金星 */
.ring-wrap { display:grid; grid-template-columns:auto 1fr; align-items:center; gap:14px; }
.ring { width:76px; height:76px; flex:0 0 auto; }
.ring .num { font-family:var(--font-display); font-size:18px; font-weight:var(--w-bold); color:var(--brand-deep); }
.ring .num small { font-size:11px; color:var(--ink-sub); }
.stats-side { display:flex; flex-direction:column; gap:6px; min-width:0; }
.stats-chips { display:flex; gap:6px; flex-wrap:wrap; }
.stats-star { font-size:15px; color:var(--ink-sub); white-space:nowrap; }
.stats-star b { color:var(--gold); font-size:16px; font-weight:var(--w-bold); }
/* navtabs：等宽 64px，激活渐变 */
.navtabs { grid-template-columns:repeat(4,1fr); gap:8px; height:64px; margin:var(--sp-4) 0 2px; }
.nt { height:64px; flex-direction:column; align-items:center; justify-content:center; gap:3px; border-radius:var(--r-md); }
.nt-i { font-size:22px; line-height:1; }
.nt-l { font-size:11px; line-height:1; }
/* 任务卡：横排 icon|文字|按钮；列表 1 列（iPad 最多 2 列，禁 3/4 列） */
.task-list { grid-template-columns:1fr; gap:12px; }
.task-list .task { display:grid; grid-template-columns:40px 1fr 72px; align-items:flex-start; gap:10px; min-height:0; padding:14px; }
.task-list .task .ic { width:40px; height:40px; font-size:20px; }
.task-list .task .t { font-size:15px; display:-webkit-box; -webkit-line-clamp:2; -webkit-box-orient:vertical; overflow:hidden; }
.task-list .task .t-meta { display:flex; align-items:center; gap:6px; margin-top:4px; font-size:12px; flex-wrap:wrap; min-width:0; }
.task-list .task .btn, .task-list .task .kid-btn { justify-self:end; align-self:center; width:72px; }
.task-list .task .rd-actions { margin-top:0; justify-self:end; align-self:center; }
/* iPad/宽屏：孩子端 clamp 720 + 任务 2 列 */
@media (min-width:768px) {
  .kid-mode #app { max-width:720px; }
  .task-list { grid-template-columns:repeat(2,1fr); }
  .greet .g-title { font-size:24px; }
}
@media (min-width:1024px) {
  .kid-mode #app { max-width:720px; }
  .task-list { grid-template-columns:repeat(2,1fr); }
}

/* ===== t19 导入作业弹窗 ===== */
.modal #hw-text { width:100%; min-height:110px; box-sizing:border-box; text-align:left; }
.modal .hw-photo-hint { text-align:left; line-height:1.6; color:var(--ink-sub); }
.hidden { display:none !important; }

/* ================================================================
 * ── t5 整合样式（checkin / time / polish 补丁 + 整合微调）────────
 * ================================================================ */

/* ---------- checkin patch ---------- */
/**
 * checkin.css — 打卡模块改造样式（demo 版式）
 * 作者：打卡工程师 (kid-workbench-v2)
 *
 * 三段分组按截止日 + 卡片式任务列表
 * 与现有 styles.css 变量体系完全兼容
 */

/* ============================================================
 * 容器
 * ============================================================ */

.ci-container {
  margin-top: 14px;
}

/* ============================================================
 * 分段标题（demo: .section-label）
 * ============================================================ */

.ci-section {
  margin-bottom: 20px;
}

.ci-section-label {
  font-size: 13px;
  font-weight: 600;
  padding: 10px 0 6px;
  border-bottom: 1px solid var(--line, #F0E4F8);
  margin-bottom: 8px;
}

.ci-section-label.ci-overdue { color: var(--danger, #E74C3C); }
.ci-section-label.ci-today { color: var(--brand, #FF8A5B); }
.ci-section-label.ci-upcoming { color: var(--mint, #4ECDC4); }

.ci-empty {
  font-size: 12px;
  color: var(--ink-sub, #888);
  padding: 8px 0;
  text-align: center;
}

/* ============================================================
 * 任务卡片（demo: .task-card）
 * ============================================================ */

.ci-card {
  display: flex;
  align-items: center;
  padding: 14px;
  background: var(--surface, #FFFFFF);
  border-radius: 14px;
  margin-bottom: 10px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.04);
  transition: transform 0.15s;
  border-left: 4px solid transparent;
}

.ci-card:active {
  transform: scale(0.98);
}

/* 左侧竖条颜色（按分组） */
.ci-card.ci-overdue { border-left-color: var(--danger, #E74C3C); }
.ci-card.ci-today { border-left-color: var(--brand, #FF8A5B); }
.ci-card.ci-upcoming { border-left-color: var(--mint, #4ECDC4); }

/* 已完成态 */
.ci-card.ci-done {
  opacity: 0.55;
  background: #F8F8F8;
}
.ci-card.ci-done .ci-name {
  text-decoration: line-through;
}

/* 拒绝态 */
.ci-card.ci-rejected {
  opacity: 0.55;
  background: var(--danger-soft, #FBE3E0);
}

/* ============================================================
 * 勾选圈（demo: .task-check）
 * ============================================================ */

.ci-check {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 2px solid var(--line, #F0E6DC);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-right: 12px;
  cursor: pointer;
  font-size: 16px;
  flex-shrink: 0;
  transition: all 0.2s;
  background: #fff;
  user-select: none;
}

.ci-check:active {
  transform: scale(0.85);
}

.ci-check.ci-checked {
  background: var(--mint, #4ECDC4);
  border-color: var(--mint, #4ECDC4);
  color: #fff;
}

.ci-check.ci-pending {
  background: var(--warn, #FFB84C);
  border-color: var(--warn, #FFB84C);
  color: #fff;
  font-size: 12px;
}

/* ============================================================
 * 任务信息区（demo: .task-info）
 * ============================================================ */

.ci-info {
  flex: 1;
  min-width: 0;
}

.ci-name {
  font-size: 15px;
  font-weight: 600;
  color: var(--ink, #333);
  line-height: 1.3;
}

.ci-name-done {
  text-decoration: line-through;
}

.ci-desc {
  font-size: 12px;
  color: var(--ink-sub, #888);
  margin-top: 2px;
  line-height: 1.4;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

/* ============================================================
 * 科目标签（demo: .task-cat-tag）
 * ============================================================ */

.ci-cat {
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 600;
  margin-left: 8px;
  flex-shrink: 0;
  white-space: nowrap;
}

/* 科目色（demo 原样） */
.cat-语文 { background: #FFE6E6; color: #CC3333; }
.cat-数学 { background: #E6F3FF; color: #3366CC; }
.cat-英语 { background: #E6FFE6; color: #339933; }
.cat-科学 { background: #FFFFE6; color: #999933; }
.cat-习惯 { background: #FFF0E6; color: #E67340; }
.cat-运动 { background: #FFF0E6; color: #E67340; }
.cat-家务 { background: #F5F0E6; color: #996633; }
.cat-劳动 { background: #F5F0E6; color: #996633; }
.cat-自定义 { background: #F0E6FF; color: #9966CC; }

/* ============================================================
 * 星星（demo: .task-points）
 * ============================================================ */

.ci-points {
  font-size: 14px;
  font-weight: 700;
  color: var(--gold, #FFC93C);
  margin-left: 8px;
  flex-shrink: 0;
  white-space: nowrap;
}

/* ============================================================
 * 朗读评测卡扩展
 * ============================================================ */

.ci-readaloud .ci-desc {
  display: block;
}

.ci-expand {
  margin-top: 4px;
}

.ci-expand summary {
  cursor: pointer;
  color: var(--brand-deep, #C2447E);
  font-weight: 700;
  font-size: 13px;
  user-select: none;
}

.ci-expand summary:hover {
  text-decoration: underline;
}

.ci-fulltext {
  font-size: 13px;
  color: var(--ink-sub, #888);
  line-height: 1.5;
  white-space: pre-wrap;
  margin-top: 6px;
  padding: 10px;
  background: var(--surface-soft, #FFF8F0);
  border-radius: 8px;
}

.ci-rd-result {
  margin-top: 6px;
}

/* ============================================================
 * 响应式：iPad 保持单列（demo 只有 560px max-width）
 * ============================================================ */

@media (min-width: 768px) {
  .ci-card {
    padding: 16px;
  }
}


/* ---------- time patch ---------- */
/* ======================================================================
 * t3 课表真网格 + 月历真视图 — 样式 patch
 * 追加到 styles.css 末尾（在最后的 @media 块之后）。
 * 依赖 CSS 变量：--brand / --brand-soft / --brand-deep / --gold / --gold-soft /
 *   --ok-soft / --ink / --ink-sub / --ink-faint / --surface-soft / --surface-2 /
 *   --line / --r-md / --r-full / --w-bold / --w-medium / --cat-chinese /
 *   --cat-math / --cat-english / --cat-science / --cat-sport / --cat-chore /
 *   --cat-custom / --ease-out
 * ====================================================================== */

/* ===== 周课表真网格（孩子端 home 页可折叠） ===== */
.week-grid { padding:10px 14px; }
.wg-head { display:flex; justify-content:space-between; align-items:center; cursor:pointer;
  font-size:15px; font-weight:var(--w-bold); margin-bottom:2px; list-style:none; }
.wg-head::-webkit-details-marker { display:none; }
.wg-toggle { font-size:12px; color:var(--ink-sub); transition:transform .2s; }
.week-grid[open] .wg-toggle { transform:rotate(180deg); }
.wg-scroll { overflow-x:auto; -webkit-overflow-scrolling:touch; scrollbar-width:none; }
.wg-scroll::-webkit-scrollbar { display:none; }
.wg-table { width:100%; border-collapse:collapse; font-size:13px; table-layout:fixed; min-width:480px; }
.wg-table th, .wg-table td { border:1px solid var(--line); padding:5px 4px; text-align:center; vertical-align:middle; }
.wg-table th { background:var(--brand-soft); color:var(--brand-deep); font-weight:var(--w-bold); font-size:12px; }
.wg-label { background:var(--surface-2); font-weight:var(--w-bold); color:var(--ink-sub); font-size:11px;
  width:36px; white-space:nowrap; }
.wg-day-h { min-width:72px; }
.wg-day-h.wg-today-col { background:var(--brand); color:#fff; }
.wg-cell { min-height:28px; }
.wg-empty { color:var(--ink-faint); font-size:11px; }
.wg-chip { display:inline-block; padding:2px 6px; border-radius:999px; font-size:11px; font-weight:var(--w-bold);
  color:#fff; margin:1px; white-space:normal; word-break:break-word; line-height:1.3; max-width:100%; }
.wg-emph { }
.wg-emph .wg-label { color:var(--brand); }
.wg-emph td { background:rgba(244,143,184,.06); }
body.parent-mode .wg-table th { background:var(--sky); color:#2E4B73; }
body.parent-mode .wg-table th, body.parent-mode .wg-table td { border-color:var(--sky); }

/* ===== 月历真视图（flex 周行布局，每行 7 格均分） ===== */
.cal-top { padding:14px 16px; }
.cal-nav { display:flex; align-items:center; justify-content:space-between; }
.cal-nav-btn { width:40px; height:40px; border:none; border-radius:var(--r-full); background:var(--surface-2);
  color:var(--brand-deep); font-size:22px; font-weight:var(--w-bold); cursor:pointer;
  display:flex; align-items:center; justify-content:center; transition:background .15s; }
.cal-nav-btn:active { background:var(--brand-soft); transform:scale(.94); }
.cal-title { font-family:var(--font-display); font-size:20px; font-weight:var(--w-bold); color:var(--ink); }
.cal-legend { display:flex; gap:14px; justify-content:center; margin-top:8px; }
.cal-leg-item { display:flex; align-items:center; gap:5px; font-size:12px; color:var(--ink-sub); font-weight:var(--w-medium); }
.cal-wrap { padding:10px 12px; }
.cal-header { display:grid; grid-template-columns:repeat(7,1fr); gap:2px; margin-bottom:4px; }
.cal-th { font-size:11px; font-weight:var(--w-bold); color:var(--ink-sub); text-align:center; padding:4px 0; }
.cal-week { display:grid; grid-template-columns:repeat(7,1fr); gap:2px; margin-bottom:2px; }
.cal-cell { text-align:center; padding:5px 1px 3px; border-radius:10px; cursor:pointer; transition:background .15s;
  min-height:52px; background:var(--surface-soft); display:flex; flex-direction:column; align-items:center; justify-content:flex-start; }
.cal-cell:hover { background:var(--brand-soft); }
.cal-num { font-size:14px; font-weight:var(--w-bold); color:var(--ink); line-height:1.2; }
.cal-empty { background:transparent; cursor:default; min-height:52px; }
.cal-empty:hover { background:transparent; }
.cal-today .cal-num { background:var(--brand); color:#fff; width:26px; height:26px;
  border-radius:50%; display:inline-flex; align-items:center; justify-content:center; font-size:13px; }
.cal-dots { display:flex; gap:3px; justify-content:center; margin-top:3px; min-height:8px; }
.cal-dot { width:5px; height:5px; border-radius:50%; }
.cal-dot-course { background:var(--brand); }
.cal-dot-task { background:var(--gold); }
.cal-count { font-size:9px; color:var(--ink-sub); margin-top:1px; font-weight:var(--w-medium); line-height:1; }
.cal-stats { display:flex; gap:12px; padding:12px 16px; }
.cal-stat { flex:1; text-align:center; padding:10px 0; background:var(--surface-2); border-radius:var(--r-md); }
.cal-stat-num { display:block; font-size:16px; font-weight:var(--w-bold); color:var(--ink); }
.cal-stat-lbl { display:block; font-size:11px; color:var(--ink-sub); margin-top:2px; }
.cal-info { padding:0 16px 12px; }
.cal-info-title { font-size:14px; font-weight:var(--w-bold); color:var(--ink); margin-bottom:6px; }
.cal-info-chips { display:flex; flex-wrap:wrap; gap:6px; }
.cal-ichip { display:inline-flex; align-items:center; padding:4px 10px; border-radius:999px; font-size:12px;
  font-weight:var(--w-medium); background:var(--brand-soft); color:var(--brand-deep); }
.cal-ichip-club { background:var(--gold-soft); color:#C47C00; font-weight:var(--w-bold); }
.cal-detail-card { padding:14px 16px; animation:slideIn .2s var(--ease-out); }
.cal-detail-head { display:flex; justify-content:space-between; align-items:center; margin-bottom:10px; font-size:15px; }
.cal-detail-section { margin-top:10px; }
.cal-detail-title { font-size:13px; font-weight:var(--w-bold); color:var(--ink); margin-bottom:6px; }
.cal-d-chips { display:flex; flex-wrap:wrap; gap:5px; }
.cal-dchip { padding:3px 8px; border-radius:999px; font-size:12px; font-weight:var(--w-bold);
  background:var(--brand-soft); color:var(--brand-deep); }
.cal-dchip-club { background:var(--gold-soft); color:#C47C00; }
.cal-dtask { display:flex; align-items:center; gap:8px; padding:8px 10px; border-radius:var(--r-md);
  background:var(--surface-2); margin-bottom:6px; font-size:13px; }
.cal-dtask-done { background:var(--ok-soft); }
.cal-dtask-ic { font-size:18px; flex-shrink:0; }
.cal-dtask-title { flex:1; font-weight:var(--w-medium); color:var(--ink); }
.cal-dtask-pts { color:var(--gold); font-weight:var(--w-bold); font-size:12px; white-space:nowrap; }
.cal-dtask-st { font-size:14px; }
.cal-dtask-wait { opacity:.7; }
@keyframes slideIn { from{opacity:0;transform:translateY(8px);} to{opacity:1;transform:translateY(0);} }
body.parent-mode .cal-nav-btn { background:#E8EDF4; color:#3B7BD6; }
body.parent-mode .cal-nav-btn:active { background:#D0D8E8; }
body.parent-mode .cal-today .cal-num { background:#3B7BD6; }
body.parent-mode .cal-dot-course { background:#3B7BD6; }
body.parent-mode .cal-ichip { background:#E0ECF8; color:#3B7BD6; }
body.parent-mode .cal-stat { background:#F0F3F8; }

/* ===== 响应式：iPad+ 扩展周网格与月历 ===== */
@media (min-width:768px) {
  .wg-table { min-width:600px; }
  .wg-chip { font-size:12px; padding:3px 8px; }
  .cal-week { gap:4px; margin-bottom:4px; }
  .cal-cell { min-height:64px; padding:8px 4px 4px; }
  .cal-num { font-size:16px; }
  .cal-today .cal-num { width:30px; height:30px; font-size:15px; }
  .cal-dot { width:6px; height:6px; }
  .cal-header { gap:4px; }
}


/* ---------- polish patch ---------- */
/**
 * polish.css — 星星成长园 6 项润色功能样式（v2 改进版）
 * 作者：优化工程师 (kid-workbench-v2)
 *
 * 功能清单样式：
 * 1. 热力图 (heatmap)
 * 2. 连续条 (streak bar)
 * 3. 角标 (badge)
 * 4. 分享图入口 (share image)
 * 5. 密码分格 (PIN split) — 注意：使用 .pin-digit 而非 .pin-box 避免与原样式冲突
 * 6. 里程碑 (milestones)
 *
 * 合并说明：追加到 styles.css 末尾即可
 */

/* ============================================================
 * 1. 热力图 (Heatmap)
 * ============================================================ */

.heatmap-section {
  margin: 12px 0;
  padding: 12px;
  background: linear-gradient(135deg, #FFF9E6 0%, #FFF3CC 100%);
  border-radius: var(--r-md, 16px);
  border: 1px solid #FFE4A0;
}

.heatmap-label {
  font-size: 14px;
  color: var(--ink-sub, #8C726F);
  margin-bottom: 8px;
  font-weight: 600;
}

.heatmap-grid {
  display: grid;
  grid-template-columns: repeat(10, 1fr);
  gap: 3px;
}

.hm-cell {
  width: 100%;
  aspect-ratio: 1;
  border-radius: 3px;
  background: var(--progress-track, #EFE2F9);
  transition: all 0.2s ease;
}

.hm-cell.hm-done {
  background: linear-gradient(135deg, var(--ok, #4FC97A) 0%, #8BC34A 100%);
  box-shadow: 0 1px 3px rgba(76, 175, 80, 0.3);
  animation: heatmap-appear 0.3s ease;
}

.hm-cell:hover {
  transform: scale(1.2);
  z-index: 1;
}

@keyframes heatmap-appear {
  from { opacity: 0; transform: scale(0.8); }
  to   { opacity: 1; transform: scale(1); }
}

/* ============================================================
 * 2. 连续条 (Streak Bar)
 * ============================================================ */

.streak-bar-section {
  margin: 12px 0;
  padding: 12px;
  background: linear-gradient(135deg, #FBEFF4 0%, #FDEFF2 100%);
  border-radius: var(--r-md, 16px);
  border: 1px solid #F0D6E2;
}

.streak-bar-label {
  font-size: 14px;
  color: var(--brand, #F48FB8);
  font-weight: 600;
  margin-bottom: 8px;
}

.streak-bar-track {
  position: relative;
  height: 12px;
  background: #F5E8EE;
  border-radius: 6px;
  overflow: visible;
}

.streak-bar-fill {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  background: linear-gradient(90deg, var(--gold, #F5A623) 0%, var(--brand, #F48FB8) 100%);
  border-radius: 6px;
  transition: width 0.5s ease;
  box-shadow: 0 2px 6px rgba(245, 166, 35, 0.3);
  animation: streak-glow 2s infinite;
}

@keyframes streak-glow {
  0%, 100% { box-shadow: 0 2px 6px rgba(245, 166, 35, 0.3); }
  50%      { box-shadow: 0 2px 12px rgba(245, 166, 35, 0.6); }
}

.streak-bar-milestone {
  position: absolute;
  top: -6px;
  transform: translateX(-50%);
  font-size: 16px;
  z-index: 1;
}

.streak-bar-hint {
  font-size: 12px;
  color: var(--ink-sub, #8C726F);
  margin-top: 8px;
}

/* ============================================================
 * 3. 角标 (Badge)
 * ============================================================ */

.tab-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  margin-left: 4px;
  background: linear-gradient(135deg, var(--danger, #F0726B) 0%, #F44336 100%);
  color: white;
  font-size: 11px;
  font-weight: 600;
  border-radius: 9px;
  box-shadow: 0 2px 4px rgba(244, 67, 54, 0.3);
  animation: badge-pulse 2s infinite;
  vertical-align: middle;
}

@keyframes badge-pulse {
  0%, 100% { transform: scale(1); }
  50%      { transform: scale(1.1); }
}

/* ============================================================
 * 4. 分享图入口 (Share Image)
 * ============================================================ */

.share-section {
  margin: 16px 0;
  text-align: center;
}

.share-btn {
  padding: 12px 28px;
  font-size: 15px;
  font-weight: 600;
  background: linear-gradient(135deg, var(--sky, #5AB3F0) 0%, #764BA2 100%);
  color: white;
  border: none;
  border-radius: var(--r-full, 999px);
  cursor: pointer;
  box-shadow: 0 4px 15px rgba(90, 179, 240, 0.4);
  transition: all 0.3s ease;
}

.share-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(90, 179, 240, 0.5);
}

.share-btn:active {
  transform: translateY(0);
}

/* ============================================================
 * 5. 密码分格 (PIN Split Input)
 *    ⚠️ 使用 .pin-digit 避免与原 .pin-box（div 容器）冲突
 * ============================================================ */

.pin-split-container {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin: 20px 0;
}

.pin-digit {
  width: 56px;
  height: 64px;
  font-size: 28px;
  font-weight: 700;
  text-align: center;
  border: 3px solid var(--line, #F0E4F8);
  border-radius: var(--r-sm, 12px);
  background: white;
  color: var(--ink, #4A3B3A);
  outline: none;
  transition: all 0.2s ease;
  box-shadow: var(--sh-sm, 0 2px 8px rgba(0,0,0,.06));
}

.pin-digit:focus {
  border-color: var(--brand, #F48FB8);
  box-shadow: 0 0 0 3px rgba(255, 122, 92, 0.2);
}

/* 抖动动画（密码错误时触发） */
.pin-split-container.shake {
  animation: pin-shake 0.5s ease;
}

@keyframes pin-shake {
  0%, 100% { transform: translateX(0); }
  20%      { transform: translateX(-8px); }
  40%      { transform: translateX(8px); }
  60%      { transform: translateX(-6px); }
  80%      { transform: translateX(6px); }
}

/* ============================================================
 * 6. 里程碑 (Milestones)
 * ============================================================ */

.milestones-section {
  margin: 16px 0;
  padding: 16px;
  background: linear-gradient(135deg, #F3E5F5 0%, #E1BEE7 100%);
  border-radius: var(--r-lg, 22px);
  border: 1px solid #CE93D8;
}

.milestones-title {
  font-size: 16px;
  font-weight: 700;
  color: #7B1FA2;
  margin-bottom: 12px;
  text-align: center;
}

.milestones-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.milestone-item {
  display: flex;
  align-items: center;
  padding: 10px 12px;
  background: white;
  border-radius: var(--r-sm, 12px);
  box-shadow: var(--sh-sm, 0 2px 8px rgba(0,0,0,.06));
  transition: all 0.2s ease;
}

.milestone-item:hover {
  transform: translateX(4px);
}

.milestone-emoji {
  font-size: 24px;
  margin-right: 12px;
  flex-shrink: 0;
}

.milestone-info {
  flex: 1;
  min-width: 0;
}

.milestone-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--ink, #4A3B3A);
}

.milestone-desc {
  font-size: 12px;
  color: var(--ink-sub, #8C726F);
}

.milestone-status {
  font-size: 16px;
  flex-shrink: 0;
  margin-left: 8px;
}

.milestone-done {
  background: linear-gradient(135deg, var(--ok-soft, #DCF7E4) 0%, #C8E6C9 100%);
  border: 1px solid #A5D6A7;
}

.milestone-done .milestone-emoji {
  animation: milestone-celebrate 1s ease;
}

.milestone-locked {
  opacity: 0.6;
  background: #FAFAFA;
  border: 1px solid #EEEEEE;
}

@keyframes milestone-celebrate {
  0%  { transform: scale(1); }
  50% { transform: scale(1.3); }
  100% { transform: scale(1); }
}

/* ============================================================
 * 响应式适配
 * ============================================================ */

@media (max-width: 768px) {
  .heatmap-grid {
    grid-template-columns: repeat(7, 1fr);
  }

  .pin-digit {
    width: 48px;
    height: 56px;
    font-size: 24px;
  }

  .milestone-item {
    padding: 8px 10px;
  }

  .milestone-emoji {
    font-size: 20px;
  }
}


/* ---------- t5 整合微调 ---------- */
/* 拒绝态勾选圈：✘ 红色（原补丁未定义） */
.ci-card.ci-rejected .ci-check {
  background: var(--danger-soft, #FBE3E0);
  border-color: var(--danger, #F0726B);
  color: var(--danger, #F0726B);
  font-size: 12px;
  cursor: default;
}
/* 5 tab 导航（time README Step3）：桌面端 4 列 grid → 5 列 */
@media (min-width: 768px) {
  .navtabs { grid-template-columns: repeat(5,1fr); gap:8px; height:64px; margin:var(--sp-4) 0 2px; }
}
/* ============ t5 整合样式结束 ============ */

/* ============================================================
 * t26 适龄/美观/BUG 修复块（末尾覆盖）
 * 1) 桌宠气泡竖排 BUG：.pet-bubble 绝对定位在 118px 容器内 shrink-to-fit
 *    → 可用宽度仅 ~60px，中文一两个字就换行。#deskpet 作用域加宽。
 * ============================================================ */
#deskpet .pet-bubble { width:max-content; max-width:min(190px, 44vw); }

/* 折叠卡通用样式（本周课表 / 30天热力图 / 本周待办，t26 默认收起） */
.fold { padding:0; }
.fold > summary { list-style:none; cursor:pointer; display:flex; justify-content:space-between; align-items:center;
  padding:13px 16px; font-weight:var(--w-bold); color:var(--ink); font-size:15px; }
.fold > summary::-webkit-details-marker { display:none; }
.fold > summary .wg-toggle { color:var(--ink-sub); font-size:12px; transition:transform .2s; }
.fold[open] > summary .wg-toggle { transform:rotate(180deg); }
.fold .fold-body { padding:0 16px 14px; }
.fold .fold-body.heatmap-section { padding-top:2px; }

/* 任务卡「打开课本」外链小按钮（t26：新标签打开，不丢 App 会话） */
.ci-link { display:inline-block; margin-top:5px; font-size:12px; font-weight:800; color:var(--sky);
  background:var(--sky-soft); border-radius:999px; padding:3px 10px; text-decoration:none; }
.ci-link:active { filter:brightness(.94); }

/* 全站按钮禁用态（惊喜蛋未到期等：一眼看出不可点） */
.btn:disabled { opacity:.45; filter:grayscale(.55); cursor:not-allowed; box-shadow:none; }

/* 首页头像下提示语（t26：填充单卡留白 + 引导点击） */
.home-hint { text-align:center; color:var(--ink-sub); font-weight:700; font-size:15px; margin-top:18px; }

/* ============================================================
 * t27 改名/紫粉主题/桌宠动作与易用性修复块（末尾覆盖）
 * ============================================================ */

/* —— 顶栏家长入口（单娃直进主界面后，🔐 收进孩子页顶栏右侧）—— */
.topbar .head-door { margin-left:auto; width:38px; height:38px; border:none; border-radius:50%;
  background:var(--surface-2); font-size:17px; line-height:1; cursor:pointer; padding:0; }
.topbar .head-door:active { transform:scale(.92); }

/* —— 气泡贴边翻转锚点（say() 里按桌宠位置切换，防止超出屏幕）—— */
#deskpet .pet-bubble.bb-left  { left:auto; right:-8px; transform:translateY(4px); }
#deskpet .pet-bubble.bb-left.show { transform:translateY(0); }
#deskpet .pet-bubble.bb-right { left:-8px; transform:translateY(4px); }
#deskpet .pet-bubble.bb-right.show { transform:translateY(0); }

/* —— 桌宠小动作（t27）：对官方立绘 img 与矢量 svg 都生效 —— */
@keyframes dp-hop { 0%,100% { transform:translateY(0) scale(1); }
  30% { transform:translateY(-13%) scale(1.05,.95); }
  55% { transform:translateY(0) scale(.97,1.03); }
  75% { transform:translateY(-5%); } }
@keyframes dp-sway { 0%,100% { transform:rotate(0); }
  25% { transform:rotate(-7deg) translateY(1%); }
  75% { transform:rotate(7deg) translateY(1%); } }
@keyframes dp-tilt { 0%,100% { transform:rotate(0); }
  40%,68% { transform:rotate(-9deg) translateY(2%); } }
@keyframes dp-look { 0%,100% { transform:translateX(0) rotate(0); }
  30% { transform:translateX(-6%) rotate(-3deg); }
  65% { transform:translateX(6%) rotate(3deg); } }
.dp-hop .dk-poke,  .dp-hop .dk-svg,  .dp-hop .pet-avatar svg { animation: dp-hop .95s var(--ease-spring); }
.dp-sway .dk-poke, .dp-sway .dk-svg, .dp-sway .pet-avatar svg { animation: dp-sway 1.15s ease-in-out; }
.dp-tilt .dk-poke, .dp-tilt .dk-svg, .dp-tilt .pet-avatar svg { animation: dp-tilt 1.25s ease-in-out; }
.dp-look .dk-poke, .dp-look .dk-svg, .dp-look .pet-avatar svg { animation: dp-look 1.3s ease-in-out; }

/* ============================================================
 * t28 底部 Tab / 信息架构 / 横屏 / 分组样式块（末尾覆盖）
 * ============================================================ */

/* —— iOS 风格固定底部 Tab 栏（毛玻璃 + 安全区适配）—— */
.navtabs { position:fixed; bottom:0; left:0; right:0; transform:none;
  max-width:720px; margin:0 auto; z-index:80; height:calc(64px + env(safe-area-inset-bottom));
  padding:6px 10px calc(env(safe-area-inset-bottom) + 6px);
  background:rgba(255,255,255,.88); backdrop-filter:blur(14px); -webkit-backdrop-filter:blur(14px);
  border-top:1px solid var(--line); box-shadow:0 -6px 24px rgba(110,80,150,.10); border-radius:0; }
.navtabs .nt.on { background:#fff; color:var(--brand-deep); border:2px solid var(--brand-soft);
  box-shadow:0 4px 14px rgba(150,100,200,.22); }
.navtabs .nt.on .nt-l { color:var(--brand-deep); }
body.parent-mode .deskpet, body.parent-mode .dk-restore { display:none !important; }  /* t28：家长端隐藏桌宠 */

/* —— 任务分组折叠（t28）—— */
.ci-group { border:1px solid var(--line); border-radius:16px; margin-bottom:10px; background:var(--surface-soft); overflow:hidden; }
.ci-group-head { list-style:none; cursor:pointer; display:flex; align-items:center; gap:8px;
  padding:11px 14px; font-weight:800; font-size:14px; color:var(--ink); }
.ci-group-head::-webkit-details-marker { display:none; }
.ci-group-emoji { font-size:17px; }
.ci-group-count { margin-left:auto; font-size:12px; font-weight:800; color:var(--brand-deep);
  background:var(--brand-soft); border-radius:999px; padding:2px 10px; }
.ci-group-done .ci-group-count { background:var(--ok-soft); color:#2E7D32; }
.ci-group-done .ci-group-head { color:var(--ink-sub); }
.ci-group-body { padding:0 8px 8px; }

/* —— 学伴页 / 成长页（t28）—— */
.tutor-hint { padding:0 2px; }
.growth-calendar-link { display:flex; align-items:center; gap:12px; text-decoration:none; color:var(--ink); margin-bottom:12px; }
.poke-ani { image-rendering:auto; }
.dkp-study { font-size:13px; font-weight:700; color:var(--ink); text-align:center;
  background:var(--surface-2); border-radius:10px; padding:7px 8px; }
.dkp-study b { color:var(--brand-deep); font-size:15px; }
.dkp-btn-wide { flex:2.2; }

/* —— iPad 横屏：多列平衡布局（t30：长组不再独占左列，组自动均分两列）—— */
@media (orientation:landscape) and (min-width:1000px) {
  body.kid-mode #app { max-width:1080px; }
  body.kid-mode .ci-section { columns:2; column-gap:24px; }
  body.kid-mode .ci-section .ci-group { break-inside:avoid; margin-bottom:12px; }
  body.kid-mode .ci-group-body { max-height:none; overflow:visible; }
  .navtabs { max-width:1080px; }
}

/* ============================================================
 * t29 樱花粉 / 宠物缩小锐化 / 必做标记 / 进度 / 课程表时间段
 * ============================================================ */

/* —— 桌宠缩小 + 高清立绘（t30：像素 gif 退役，官方立绘 475px 缩放依旧锐利）—— */
.deskpet { width:80px !important; height:80px !important; }
.pet-stage .pet-avatar { width:150px; height:150px; display:inline-block; }
.skin .s-face img { width:64px !important; height:64px !important; object-fit:contain; }
/* t30：立绘呼吸漂浮（容器级动画，不与图片 scale 冲突；矢量回退同样生效） */
@keyframes dp-bob { 0%,100% { transform:translateY(0); } 50% { transform:translateY(-5%); } }
#deskpet[data-state="idle"] .pet-avatar, #deskpet[data-state^="mood-"] .pet-avatar { animation: dp-bob 2.8s ease-in-out infinite; }
.pet-stage .pet-avatar { animation: dp-bob 3.4s ease-in-out infinite; }

/* —— 任务分组：竖屏组体限高内滚（长分类不用滚半天）—— */
.ci-group-body { max-height:60vh; overflow-y:auto; -webkit-overflow-scrolling:touch; }

/* —— 必做标记：圈里直接印「必」字（孩子不用猜任何颜色边框的含义）—— */
.ci-check.ci-must { border-color:var(--gold); color:#C47C00; font-size:15px; font-weight:800; }

/* —— 今日总进度条 —— */
.ci-title-row { display:flex; align-items:center; justify-content:space-between; gap:10px; margin:var(--sp-6) 2px 10px; }
.ci-progress { display:flex; align-items:center; gap:8px; }
.ci-progress-num { font-size:13px; font-weight:800; color:var(--brand-deep); white-space:nowrap; }
.ci-progress-bar { display:inline-block; width:90px; height:8px; background:var(--progress-track); border-radius:999px; overflow:hidden; }
.ci-progress-bar i { display:block; height:100%; background:var(--brand-grad); border-radius:999px; transition:width .3s; }
.ci-group-arrow { margin-left:2px; font-size:11px; color:var(--ink-sub); transition:transform .2s; }
.ci-group[open] .ci-group-arrow { transform:rotate(180deg); }

/* —— 课程表：上/下午大段分隔 + 行列加宽 —— */
.wg-label { text-align:left; width:104px; min-width:104px; }
.wg-time { display:block; font-size:9px; font-weight:600; color:var(--ink-sub); line-height:1.2;
  white-space:normal; word-break:break-all; }
.wg-time-note, .tt-time-note { display:block; color:var(--ink-faint); font-weight:600; }
.tt-time { font-size:10px; color:var(--ink-sub); font-weight:600; white-space:normal; word-break:break-all; }
.wg-seg td { background:var(--surface-2); color:var(--brand-deep); font-weight:800; font-size:12px;
  padding:4px 10px; border-radius:8px; }
.fold-sum { display:inline-flex; align-items:center; gap:6px; font-size:12px; font-weight:800; color:var(--brand-deep); }

/* —— 课文详情 / 重难点 / 教辅 —— */
.tutor-more summary { cursor:pointer; list-style:none; font-size:12px; font-weight:800; color:var(--brand-deep); margin-top:8px; }
.tutor-more summary::-webkit-details-marker { display:none; }
.tutor-detail { border-top:1px dashed var(--line-strong); padding-top:10px; }
.tutor-points { display:flex; flex-wrap:wrap; gap:6px; }
.ai-focus-text { background:var(--surface-2); border-radius:12px; padding:8px 10px; font-size:12px; line-height:1.7; white-space:pre-wrap; }

/* ============================================================
 * v6-a1 批次A：整卡可点 / AI 对话框 / 朗读对比面板 / 版本号
 * ============================================================ */

/* —— 打卡整卡可点（未完成卡手势提示 + 按压反馈；完成态保持默认）—— */
.ci-card.ci-undone { cursor:pointer; }
.ci-card.ci-undone:active { transform:scale(.985); }

/* —— AI 老师对话框（消息流：孩子右粉 / 老师左白紫，高度限内滚）—— */
.ai-chat-card .chat-log { display:flex; flex-direction:column; gap:8px; max-height:280px; overflow-y:auto;
  -webkit-overflow-scrolling:touch; background:var(--surface-2); border-radius:14px; padding:10px; margin-top:10px; }
.chat-msg { display:flex; align-items:flex-end; gap:6px; max-width:86%; }
.chat-msg.kid { align-self:flex-end; flex-direction:row-reverse; }
.chat-msg.ai { align-self:flex-start; }
.chat-bubble { border-radius:14px; padding:8px 12px; font-size:13.5px; line-height:1.65; white-space:pre-wrap; word-break:break-word; }
.chat-msg.kid .chat-bubble { background:var(--brand-grad, #FF8A5B); color:#fff; border-bottom-right-radius:4px; font-weight:600; }
.chat-msg.ai .chat-bubble { background:#fff; color:var(--ink, #333); border:1px solid var(--line, #eee); border-bottom-left-radius:4px; }
.chat-time { font-size:10px; color:var(--ink-sub); flex:0 0 auto; }
.chat-typing .chat-bubble { opacity:.75; font-style:italic; }

/* —— 朗读评测面板（录音态 / 评分态 / 失败原因 / 逐字对比）—— */
.rd-panel { border-radius:14px; padding:10px 12px; margin-top:8px; font-size:13px; line-height:1.7; }
.rd-panel.rd-wait { background:var(--surface-2); }
.rd-panel.rd-live { background:#FFF6E8; border:1px dashed var(--gold, #E8B84B); }
.rd-panel.rd-ok { background:#F0FBF4; border:1px solid #BFE8CD; }
.rd-panel.rd-mid { background:#FFF6E8; border:1px solid #F2D9A4; }
.rd-panel .rd-note { font-size:11px; color:var(--ink-sub); margin-top:4px; }
.rd-verdict { font-weight:800; color:var(--brand-deep); margin-left:6px; }
.rd-stars { font-size:18px; letter-spacing:2px; display:inline-block; }
.rd-stars.rd-soft { font-size:15px; }
.rd-meter { display:flex; align-items:center; gap:8px; margin-top:6px; font-size:12px; }
.rd-meter span { flex:0 0 48px; color:var(--ink-sub); }
.rd-meter-bar { flex:1; height:8px; background:var(--progress-track); border-radius:999px; overflow:hidden; }
.rd-meter-bar i { display:block; height:100%; background:var(--brand-grad, #FF8A5B); border-radius:999px; }
.rd-meter b { flex:0 0 40px; text-align:right; color:var(--brand-deep); }
.rd-diff-label { font-size:11px; color:var(--ink-sub); margin:8px 0 4px; }
.rd-diff { background:#fff; border:1px solid var(--line, #eee); border-radius:10px; padding:8px 10px; font-size:13.5px; line-height:2; }
.rd-diff .rd-hit { color:#1B9E4B; font-weight:700; }
.rd-diff .rd-miss { color:#D6455B; font-weight:700; text-decoration:underline wavy rgba(214,69,91,.5); }
.rd-diff-label .rd-hit { color:#1B9E4B; font-weight:800; }
.rd-diff-label .rd-miss { color:#D6455B; font-weight:800; }
.rd-heard { font-size:11.5px; color:var(--ink-sub); margin-top:6px; }

/* —— 设置页版本号 —— */
.app-ver { text-align:center; font-size:11px; color:var(--ink-sub); padding:14px 0 6px; }

/* ============================================================
 * v6.1-bcd 批次B/C/D：课表按天 Tab / 导入预览行 / 资料库
 * ============================================================ */

/* —— 课表按天编辑（复用 .tabs 样式，微调间距）—— */
.tt-daytabs { margin-bottom:10px; }
.tt-daytabs .tab { min-width:64px; }

/* —— 导入作业两步向导：预览编辑行 —— */
.hw-step2 { font-weight:800; color:var(--brand-deep); font-size:13px; }
.hw-list { display:flex; flex-direction:column; gap:6px; }
.hw-row { display:flex; align-items:center; gap:6px; background:var(--surface-2); border-radius:10px; padding:6px 8px; }
.hw-row .hw-cat { flex:0 0 76px; font-size:12px; }
.hw-row .hw-title { font-size:13px; min-width:0; }
.hw-row .hw-pts { flex:0 0 52px; font-size:12px; text-align:center; }
.hw-row .hw-core { flex:0 0 auto; font-size:12px; display:flex; align-items:center; gap:2px; color:var(--ink-sub); }

/* —— 资料库存储用量条 —— */
.kb-meter { display:flex; align-items:center; gap:8px; font-size:11px; color:var(--ink-sub); }
.kb-meter span { flex:0 0 auto; }
.kb-meter-bar { flex:1; height:6px; background:var(--progress-track); border-radius:999px; overflow:hidden; }
.kb-meter-bar i { display:block; height:100%; background:var(--brand-grad, #FF8A5B); border-radius:999px; }

/* ============================================================
 * v6.2-e1：乐园分页 / 两栏商店 / 撤回圈 / 顶栏播报按钮
 * ============================================================ */
.park-tabs { margin:2px 0 12px; }
.park-cols { display:grid; grid-template-columns:1fr 1fr; gap:14px; align-items:start; }
@media (max-width: 768px) { .park-cols { grid-template-columns:1fr; } }
.park-col { min-width:0; }
.ci-check.ci-undo { cursor:pointer; }
.ci-check.ci-undo:active { transform:scale(.92); }
.topbar .narrate-btn { margin-right:6px; }

/* —— v6.3：课文按钮就地出结果（讲解/出题/判题） —— */
.tq-result { margin-top:10px; }
.tq-result.tq-loading, .tq-result .tq-loading { background:var(--surface-2); border-radius:12px; padding:10px 12px; font-size:13px; color:var(--ink-sub); }
.tq-result .tq-q { background:#FFF6E8; border:1px dashed var(--gold, #E8B84B); border-radius:12px; padding:10px 12px; font-size:14px; font-weight:700; line-height:1.7; }
.tq-result .tq-ans { background:#F0FBF4; border:1px solid #BFE8CD; border-radius:12px; padding:10px 12px; font-size:13.5px; line-height:1.8; white-space:pre-wrap; }
.tq-result .tq-fail { background:var(--surface-2); border-radius:12px; padding:10px 12px; font-size:13px; color:var(--ink-sub); }
.tq-result input { font-size:14px; }
.op-select { font-size:15px; font-weight:800; padding:8px 14px; border-radius:12px; border:2px solid var(--brand, #FF8A5B); background:#fff; color:var(--brand-deep); }

/* —— v6.4：教材目录单元折叠 —— */
.unit-fold > summary { cursor:pointer; list-style:none; font-weight:800; display:flex; align-items:center; justify-content:space-between; gap:8px; }
.unit-fold > summary::-webkit-details-marker { display:none; }
.unit-fold > summary .uf-sum { font-size:12px; font-weight:700; color:var(--ink-sub); white-space:nowrap; }
.explain { white-space:pre-wrap; line-height:1.9; }
