/* 小星芽 · 孩子端 PWA 样式（2026-10-28 · 孩子端PWA方案.md §1）
 * 设计规范：平板 kiosk 风——浅色背景 + 白底圆角大卡片、标题 ≥24px、正文 ≥18px、
 * 按钮 ≥56px 高触控、不用 emoji（SVG 图标）、横竖屏自适应（max-width 720px 居中）
 * 皮肤：与小程序家庭皮肤同品牌（mint/butter/sky/peach，html[data-skin] 切换）
 * 语义色固定：危险红 #e04f4f / 完成绿 #52b788 / 星星金 #f5a623
 */
:root {
  --c-primary: #5ECDB0;
  --c-deep: #2FA98C;
  --c-bg: #E6F8F2;
  --c-light: #C2E9DB;
  --c-btn-text: #FFFFFF;
  --c-grad: rgba(94, 205, 176, 0.25);
}
html[data-skin="butter"] {
  --c-primary: #FFD166; --c-deep: #D98E04; --c-bg: #FFF7E0;
  --c-light: #FFE9A8; --c-btn-text: #5B4A00; --c-grad: rgba(255, 209, 102, 0.25);
}
html[data-skin="sky"] {
  --c-primary: #74C0EE; --c-deep: #3F8FD4; --c-bg: #E9F5FD;
  --c-light: #C5E6F9; --c-btn-text: #FFFFFF; --c-grad: rgba(116, 192, 238, 0.25);
}
html[data-skin="peach"] {
  --c-primary: #FFB27D; --c-deep: #E98C4B; --c-bg: #FFF2E7;
  --c-light: #FFD8BE; --c-btn-text: #FFFFFF; --c-grad: rgba(255, 178, 125, 0.25);
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--c-bg);
  color: #333;
  min-height: 100vh;
  transition: background 0.3s;
}
.app { max-width: 720px; margin: 0 auto; min-height: 100vh; position: relative; }
.page { padding: 24px 24px 40px; }

/* ── 登录视图 ─────────────────────────────── */
.page-login { display: flex; flex-direction: column; justify-content: center; min-height: 100vh; }
.login-inner { text-align: center; padding: 12px 0; }
.logo { width: 96px; height: 96px; border-radius: 24px; box-shadow: 0 8px 24px var(--c-grad); }
.login-title { font-size: 28px; font-weight: 700; color: var(--c-deep); margin: 20px 0 28px; line-height: 1.5; }
.code-box {
  background: #fff; border-radius: 20px; padding: 24px 20px 20px;
  box-shadow: 0 6px 24px rgba(0,0,0,0.06);
}
.code-input {
  width: 100%; height: 72px; font-size: 40px; font-weight: 700; text-align: center;
  letter-spacing: 12px; text-indent: 12px; text-transform: uppercase;
  border: 3px solid var(--c-light); border-radius: 16px; color: var(--c-deep);
  caret-color: var(--c-deep); outline: none; background: #fff;
}
.code-input:focus { border-color: var(--c-primary); }
.code-input::placeholder { font-size: 24px; font-weight: 400; letter-spacing: 4px; text-indent: 0; color: #ccc; }
.code-hint { font-size: 16px; color: #999; margin-top: 14px; }
.login-error { color: #e04f4f; font-size: 18px; font-weight: 600; margin-top: 16px; }
.children-area { margin-top: 20px; }
.children-title { font-size: 20px; color: #666; margin-bottom: 14px; }
.children-list { display: flex; flex-wrap: wrap; justify-content: center; gap: 20px; }
.child-pick {
  width: 120px; padding: 16px 8px; background: #fff; border-radius: 20px;
  box-shadow: 0 6px 24px rgba(0,0,0,0.06); cursor: pointer; text-align: center;
  transition: transform 0.12s;
}
.child-pick:active { transform: scale(0.94); }
.child-pick .avatar { width: 72px; height: 72px; border-radius: 50%; margin: 0 auto 10px; font-size: 30px; color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 700; }
.child-pick .avatar img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; }
.child-pick .name { font-size: 18px; font-weight: 600; color: #333; word-break: break-all; }
.login-foot { margin-top: 32px; font-size: 16px; color: #aaa; }

/* ── 主页视图 ─────────────────────────────── */
.page-home { padding-top: 20px; }
.child-card {
  background: linear-gradient(135deg, var(--c-primary), var(--c-deep));
  border-radius: 24px; padding: 20px 24px; color: var(--c-btn-text);
  display: flex; align-items: center; justify-content: space-between;
  box-shadow: 0 8px 24px var(--c-grad);
}
.child-left { display: flex; align-items: center; gap: 14px; min-width: 0; }
.child-avatar { width: 64px; height: 64px; border-radius: 50%; background: rgba(255,255,255,0.28); color: #fff; font-size: 28px; font-weight: 700; display: flex; align-items: center; justify-content: center; overflow: hidden; flex-shrink: 0; }
.child-avatar img { width: 100%; height: 100%; object-fit: cover; }
.child-name { font-size: 26px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.child-right { text-align: right; flex-shrink: 0; }
.star-label { font-size: 16px; opacity: 0.9; display: flex; align-items: center; justify-content: flex-end; gap: 6px; }
.star-balance { font-size: 44px; font-weight: 800; line-height: 1.1; }
.star-balance.pop { animation: starPop 0.6s ease; }
@keyframes starPop { 0% { transform: scale(1); } 30% { transform: scale(1.32); } 100% { transform: scale(1); } }

.today-slogan { font-size: 18px; color: #777; margin: 14px 6px 4px; }
.home-topbar { display: flex; justify-content: flex-end; margin: 6px 0 0; }
.refresh-btn {
  width: 44px; height: 44px; border-radius: 50%; background: #fff; color: var(--c-deep);
  display: flex; align-items: center; justify-content: center; cursor: pointer;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}
.refresh-btn:active { transform: rotate(90deg); }
.refresh-btn svg { width: 22px; height: 22px; }

.group-title { font-size: 22px; font-weight: 700; color: #555; margin: 22px 4px 12px; display: flex; align-items: center; gap: 8px; }
.group-title .count { font-size: 16px; color: #aaa; font-weight: 400; }
.task-card {
  background: #fff; border-radius: 20px; padding: 16px 18px; margin-bottom: 14px;
  display: flex; align-items: center; box-shadow: 0 4px 16px rgba(0,0,0,0.05);
  gap: 14px;
}
.task-card.done { opacity: 0.55; }
.task-main { flex: 1; min-width: 0; }
.task-name { font-size: 22px; font-weight: 600; display: flex; align-items: center; gap: 10px; }
.cat-dot { width: 14px; height: 14px; border-radius: 50%; flex-shrink: 0; display: inline-block; }
.task-meta { font-size: 16px; color: #999; margin-top: 6px; }
.task-star { font-size: 20px; font-weight: 700; color: #f5a623; white-space: nowrap; flex-shrink: 0; }
.done-btn {
  min-width: 96px; height: 56px; padding: 0 18px; border: none; border-radius: 28px;
  background: var(--c-primary); color: var(--c-btn-text); font-size: 20px; font-weight: 700;
  cursor: pointer; flex-shrink: 0; transition: transform 0.1s, opacity 0.2s;
}
.done-btn:active { transform: scale(0.95); }
.done-btn:disabled { background: #e8e8e8; color: #bbb; cursor: default; }
.done-btn.loading { opacity: 0.7; }

/* 已完成卡片：半透明 + ✓ */
.done-mark { width: 34px; height: 34px; border-radius: 50%; background: #52b788; color: #fff; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }

/* 空态 */
.empty-state { text-align: center; padding: 60px 0 40px; color: #aaa; }
.empty-state img { width: 120px; height: 120px; opacity: 0.7; margin-bottom: 16px; }
.empty-state .txt { font-size: 22px; font-weight: 600; }
.empty-state .sub { font-size: 16px; margin-top: 8px; }

.logout { text-align: center; margin-top: 28px; font-size: 16px; color: #bbb; cursor: pointer; padding: 16px; }
.logout:active { color: #999; }

/* 星星飘落动画 */
.star-fall {
  position: fixed; z-index: 999; pointer-events: none;
  animation: fall 1.2s ease-out forwards;
}
.star-fall svg { width: 100%; height: 100%; }
@keyframes fall {
  0% { transform: translateY(0) rotate(0deg) scale(1); opacity: 1; }
  100% { transform: translateY(120px) rotate(160deg) scale(0.4); opacity: 0; }
}

/* Toast */
.toast {
  position: fixed; left: 50%; bottom: 120px; transform: translateX(-50%);
  background: rgba(0,0,0,0.78); color: #fff; font-size: 17px; padding: 14px 26px;
  border-radius: 999px; z-index: 1000; max-width: 80vw; text-align: center;
}

/* 横屏/大屏：内容居中不拉宽 */
@media (min-width: 720px) {
  .app { box-shadow: 0 0 40px rgba(0,0,0,0.06); background: transparent; }
}
@media (max-width: 400px) {
  .login-title { font-size: 24px; }
  .star-balance { font-size: 36px; }
  .task-name { font-size: 20px; }
}

/* ── 视图切换：页面淡入（登录 ⇄ 主页跳转感） ─────── */
.page { animation: pageFadeIn 0.32s ease; }
/* hidden 必须压倒一切布局规则：.page-login/.page-home 均设了 display:flex，
   会覆盖浏览器默认的 [hidden]{display:none}，导致被隐藏的页面仍然显示、两页纵向连排 */
.page[hidden] { display: none !important; }
@keyframes pageFadeIn {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: none; }
}

/* ── 大屏横屏 kiosk 适配（平板/学习机 ≥768px） ──────
 * 内容铺满大屏居中限宽（不再 720px 手机竖条）；任务卡多列网格；
 * 字号/触控整体放大（规范：标题 ≥24px、按钮 ≥56px 高）。 */
@media (min-width: 768px) {
  .app { max-width: 1200px; }
  .page { padding: 32px 40px 48px; }

  /* 主页 */
  .page-home { display: flex; flex-direction: column; min-height: 100vh; }
  .child-card { padding: 28px 36px; border-radius: 28px; }
  .child-avatar { width: 84px; height: 84px; font-size: 34px; }
  .child-name { font-size: 30px; }
  .star-label { font-size: 18px; }
  .star-balance { font-size: 56px; }
  .today-slogan { font-size: 20px; margin: 18px 8px 6px; }
  .refresh-btn { width: 52px; height: 52px; }
  .refresh-btn svg { width: 26px; height: 26px; }
  .group-title { font-size: 26px; margin: 28px 6px 14px; grid-column: 1 / -1; }
  .group-title .count { font-size: 18px; }
  .task-group { display: grid; grid-template-columns: repeat(auto-fill, minmax(360px, 1fr)); gap: 16px; }
  .task-card { margin-bottom: 0; padding: 20px 24px; border-radius: 24px; gap: 16px; }
  .task-name { font-size: 24px; }
  .task-meta { font-size: 17px; }
  .task-star { font-size: 22px; }
  .done-btn { min-width: 128px; height: 64px; font-size: 22px; border-radius: 32px; }
  .done-mark { width: 40px; height: 40px; }
  .empty-state { padding: 90px 0 60px; }
  .empty-state img { width: 140px; height: 140px; }
  .empty-state .txt { font-size: 26px; }
  .empty-state .sub { font-size: 18px; }
  .logout { margin-top: 36px; font-size: 18px; padding: 20px; }

  /* 登录视图 */
  .logo { width: 112px; height: 112px; border-radius: 28px; }
  .login-title { font-size: 34px; }
  .code-box { padding: 28px 24px 24px; border-radius: 24px; }
  .code-input { height: 84px; font-size: 46px; }
  .code-hint { font-size: 18px; }
  .login-error { font-size: 20px; }
  .children-title { font-size: 22px; }
  .children-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 22px; max-width: 680px; margin: 0 auto; }
  .child-pick { width: auto; padding: 20px 12px; border-radius: 24px; }
  .child-pick .avatar { width: 84px; height: 84px; font-size: 34px; }
  .child-pick .name { font-size: 20px; }
  .login-foot { font-size: 18px; }
}
