/* ===== 平板适配（华为平板 / iPad / 大屏浏览器） =====
   手机竖屏（<620px）保持原来的单列手机布局；
   平板改成「横向铺满 + 多栏」，不再是一条挤在中间的窄缝。
   断点：
     ≥720px   平板竖屏（华为 MatePad 竖屏 800×1280、iPad 810×1080）
     ≥1024px  平板横屏 / 小笔记本
     ≥1280px  大平板横屏、桌面窗口
     ≥1400px  超宽屏（今日页出第三栏家长提示）
*/

/* ---------- 0) JS 兜底：浏览器伪装媒体查询时，靠 html.pad 去掉手机壳 ---------- */
html.pad body.kid-mode { display: block; padding: 0; }
html.pad .phone {
  width: 100%; max-width: 100%;
  height: auto; min-height: 100vh; min-height: 100dvh;
  border: none; border-radius: 0; box-shadow: none;
  background: transparent; overflow: visible;
}
html.pad .island { display: none; }
html.pad .screen {
  overflow: visible;
  padding-bottom: calc(120px + env(safe-area-inset-bottom));
}
html.pad .tabbar {
  position: fixed; left: 50%; right: auto; bottom: calc(14px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  min-width: 460px; height: 74px; padding: 0 10px; gap: 4px;
  border-radius: 999px;
  border: 1px solid rgba(240, 230, 214, .95);
  background: rgba(255, 253, 248, .92);
  backdrop-filter: blur(18px) saturate(1.6);
  box-shadow: 0 10px 30px -8px rgba(90, 66, 35, .22), 0 2px 6px rgba(90, 66, 35, .06);
  z-index: 10;
}
html.pad .tabbar .tab { padding: 6px 26px; font-size: 11.5px; }
html.pad .tabbar .tab .ti { font-size: 23px; }
html.pad .sheet-mask, html.pad .success { position: fixed; }
html.pad #dzToast { bottom: 112px; }

/* ---------- 1) 平板：去掉手机外壳，铺满整个屏幕 ---------- */
@media (min-width: 720px), (min-device-width: 720px) {
  body.kid-mode {
    display: block;
    padding: 0;
    min-height: 100vh;
    min-height: 100dvh;
  }
  .phone {
    width: 100%;
    max-width: 100%;
    height: auto;
    min-height: 100vh;
    min-height: 100dvh;
    overflow: visible;
    border: none;
    border-radius: 0;
    box-shadow: none;
    background: transparent;
  }
  .island { display: none; }
  /* 平板靠窗口整体滚动，不再用内部滚动条（避免两层滚动打架） */
  .screen {
    overflow: visible;
    padding: calc(20px + env(safe-area-inset-top)) max(30px, env(safe-area-inset-left))
             calc(120px + env(safe-area-inset-bottom)) max(30px, env(safe-area-inset-right));
  }
  .screen::-webkit-scrollbar { width: 0; }
  body.kid-mode::before { background-size: 34px 34px; }

  .screen > section > * { max-width: 1120px; margin-left: auto; margin-right: auto; }

  /* ---------- 底部 tabbar：变成悬浮胶囊，居中，不再顶到屏幕底边 ---------- */
  .tabbar {
    left: 50%;
    right: auto;
    bottom: calc(14px + env(safe-area-inset-bottom));
    transform: translateX(-50%);
    width: auto;
    min-width: 460px;
    height: 74px;
    padding: 0 10px;
    gap: 4px;
    border-radius: 999px;
    border: 1px solid rgba(240, 230, 214, .95);
    background: rgba(255, 253, 248, .92);
    box-shadow: 0 10px 30px -8px rgba(90, 66, 35, .22), 0 2px 6px rgba(90, 66, 35, .06);
  }
  .tabbar .tab { padding: 6px 26px; font-size: 11.5px; }
  .tabbar .tab .ti { font-size: 23px; }

  /* ---------- Hero 放大 ---------- */
  .hero {
    border-radius: 34px;
    padding: 26px 30px 24px;
    animation-duration: .5s;
  }
  .hello { font-size: 27px; }
  .hero .date { font-size: 13px; margin-top: 7px; }
  /* 蛋仔动画（圆形 GIF）：平板上固定在右下完整显示，进度卡留出右侧空间不压住它 */
  .hero-egg-gif { right: 12px; bottom: 10px; }
  .ring-wrap {
    margin-top: 20px;
    padding: 16px 20px;
    gap: 18px;
    border-radius: 24px;
    max-width: calc(100% - 106px);
  }
  .ring { width: 78px; height: 78px; }
  .ring svg { width: 78px; height: 78px; }
  .ring .num { font-size: 19px; }
  .ring .num small { font-size: 9.5px; }
  .progress-txt { font-size: 14px; }
  .progress-txt b { font-size: 17px; }
  .hero-badges { margin-top: 16px; gap: 10px; }
  .badge { font-size: 13px; padding: 8px 15px; }
  .badge b { font-size: 15px; }

  /* ---------- 区块标题 ---------- */
  .sec-title { margin: 28px 4px 14px; }
  .sec-title h3 { font-size: 19px; gap: 10px; }
  .sec-title h3::before { width: 5px; height: 19px; }
  .sec-title .link { font-size: 13px; }

  /* ---------- 今日页：任务 2 列 ---------- */
  .today-body { display: block; }
  #taskList {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
    align-items: start;
  }
  .task {
    margin-bottom: 0;
    padding: 18px 18px;
    border-radius: 24px;
    gap: 15px;
    min-height: 96px;
  }
  .task .icon { width: 54px; height: 54px; border-radius: 17px; font-size: 26px; }
  .task .name { font-size: 17px; }
  .task .name-sub .pts.big, .ttype { height: 25px; font-size: 12.5px; }
  .task .go { height: 42px; min-width: 74px; font-size: 14px; }

  /* ---------- 奖励页：2 列卡片 ---------- */
  .reward-row {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 14px;
    padding: 2px 2px 4px;
  }
  .reward {
    grid-template-columns: 96px 1fr auto;
    gap: 16px;
    border-radius: 24px;
    padding: 15px 18px 15px 15px;
  }
  .reward .r-ic { width: 96px; height: 96px; border-radius: 20px; font-size: 46px; }
  .reward .r-ic.has-img { width: 96px; height: 96px; border-radius: 20px; }
  .reward .r-name { font-size: 16.5px; }
  .reward .r-cost { font-size: 26px; }
  .reward .r-cost em { font-size: 13px; }
  .reward .r-btn { font-size: 13.5px; padding: 12px 18px; }
  .mini-bar { height: 6px; margin: 10px 0 8px; }

  /* ---------- 成长页：左右两栏 ---------- */
  .stat-body {
    display: grid;
    grid-template-columns: 1.15fr .85fr;
    gap: 28px;
    align-items: start;
  }
  .std-main .sec-title:first-child, .std-aside .sec-title:first-child { margin-top: 0; }
  .stat-grid { gap: 14px; }
  .stat-card { border-radius: 24px; padding: 20px; }
  .stat-card .v { font-size: 32px; }
  .stat-card .k { font-size: 12.5px; }
  .cal-head { font-size: 12px; gap: 9px; }
  .cal { gap: 9px; }
  .cal .d { border-radius: 14px; font-size: 13px; }
  .log-item { font-size: 14px; padding: 14px 0; }
  .log-item .t { width: 48px; font-size: 13px; }
  .log-item .p { font-size: 13.5px; }
  .rdm-tag { font-size: 11px; }
  .sync-box { margin-top: 4px; padding: 18px 20px 16px; border-radius: 24px; }
  .sb-row { font-size: 14px; padding: 7px 0; }
  .sb-code { font-size: 15px; letter-spacing: 3px; }
  .sb-status { font-size: 13.5px; }
  .sb-btn { font-size: 13px; padding: 11px; border-radius: 14px; }

  /* ---------- 宠物页 ---------- */
  .pet-grid { grid-template-columns: repeat(5, 1fr); gap: 16px; }
  .pet-card { border-radius: 22px; padding: 18px 8px 14px; gap: 10px; }
  .pet-card .pet-art { width: 104px; height: 104px; }
  .pet-name { font-size: 13.5px; }
  .pet-home { padding: 24px 26px 22px; }
  .pet-stage { height: 340px; border-radius: 24px; }
  .pet-house { width: 140px; }
  .st1 .pet-creature { width: 84px; }
  .st2 .pet-creature { width: 112px; }
  .st3 .pet-creature { width: 142px; }
  .st4.max .pet-creature { width: 172px; }
  .pet-bubble { font-size: 13.5px; padding: 9px 14px; max-width: 46%; }
  .pet-title { font-size: 22px; }
  .pet-lv { font-size: 15px; padding: 4px 13px; }
  .pet-stage-tag { font-size: 12px; padding: 4px 11px; }
  .pet-prog { height: 12px; }
  .pet-sub { font-size: 13px; margin-top: 9px; }
  .pet-interact { grid-template-columns: repeat(10, 1fr); gap: 10px; margin-top: 16px; }
  .pet-ia { font-size: 13px; padding: 14px 2px; border-radius: 16px; }
  .pet-feed { margin-top: 20px; }
  .pet-feed-t { font-size: 14px; margin-bottom: 12px; }
  .pet-feed-chips { gap: 12px; }
  .pet-feed-chips .pk { font-size: 16px; padding: 12px 24px; border-radius: 18px; }
  .pet-tip { font-size: 12px; padding: 10px 14px; }
  .pd-item { padding: 13px 0; gap: 14px; }
  .pd-emoji { font-size: 32px; }
  .pd-info b { font-size: 15px; }
  .pd-info em { font-size: 12px; }
  .pet-adopt-next { font-size: 16px; padding: 15px 0; border-radius: 999px; }

  /* ---------- 弹层：从「底部抽屉」改成「居中卡片」 ---------- */
  /* 平板上 .phone 不再是滚动容器，遮罩和成功页都要改成 fixed 跟随视口 */
  .sheet-mask, .success { position: fixed; }
  .tabbar { position: fixed; }
  .sheet-mask { align-items: center; justify-content: center; padding: 24px; }
  .sheet {
    max-width: 560px;
    width: 100%;
    max-height: 88%;
    border-radius: 32px;
    padding: 20px 30px 28px;
    box-shadow: 0 26px 70px rgba(43, 32, 20, .3);
    animation: sheetPop .3s cubic-bezier(.2, .9, .3, 1.05);
  }
  @keyframes sheetPop { from { transform: translateY(24px) scale(.97); opacity: .6 } to { transform: none; opacity: 1 } }
  .sheet .grab { display: none; }
  .sheet h4 { font-size: 20px; }
  .sheet .sub { font-size: 13.5px; }
  .close-x { right: 24px; top: 22px; width: 34px; height: 34px; font-size: 14px; }
  .mic { width: 124px; height: 124px; font-size: 44px; }
  .mic-tip { font-size: 13.5px; }
  .pick-chips { gap: 12px; }
  .pick-chips .pk { min-width: 78px; font-size: 17px; padding: 12px 16px; border-radius: 18px; }
  .pick-chips .pk b { font-size: 19px; }
  .heard { padding: 15px 18px; min-height: 70px; }
  .heard #heardText { font-size: 15.5px; }
  .sheet .actions { gap: 14px; margin-top: 22px; }
  .sheet .actions .btn { padding: 15px 0; font-size: 16px; }
  .success h2 { font-size: 28px; }
  .success p { font-size: 14.5px; }
  .plus { font-size: 21px; padding: 11px 22px; }
  .success .btn { font-size: 16px; padding: 15px 0; }

  /* 奖励大图：平板上给小一点的下边距，居中卡片更宽 */
  .rw-zoom { padding: 40px; }
  .rwz-box { max-width: 440px; border-radius: 26px; }
  .rwz-name { font-size: 17px; }

  /* 家长入口浮标 / toast 避开胶囊 tabbar */
  .parent-fab { right: 28px; bottom: 24px; font-size: 13px; padding: 12px 18px; }
  #dzToast { bottom: 112px; font-size: 14px; padding: 12px 22px; max-width: 60vw; }
  .install-tip { align-items: center; }
  .it-card { border-radius: 30px; padding: 30px 28px; max-width: 460px; }
  .it-title { font-size: 20px; }
  .it-body { font-size: 14.5px; }
  .it-emoji { width: 58px; height: 58px; font-size: 30px; }
}

/* ---------- 2) 平板横屏 / 桌面窗口：今日页左「任务」右「奖励小铺」 ---------- */
@media (min-width: 1024px), (min-device-width: 1024px) {
  .screen {
    padding: calc(22px + env(safe-area-inset-top)) max(36px, env(safe-area-inset-left))
             calc(112px + env(safe-area-inset-bottom)) max(36px, env(safe-area-inset-right));
  }
  .screen > section > * { max-width: 1240px; margin-left: auto; margin-right: auto; }

  .today-body {
    display: block;
    max-width: 1240px;
    margin: 0 auto;
  }
  .td-col .sec-title:first-child { margin-top: 26px; }
  .shop-body { max-width: 1240px; }
  .reward-row { grid-template-columns: repeat(2, 1fr); gap: 16px; }
  .reward .r-ic { width: 104px; height: 104px; font-size: 50px; }
  .reward .r-ic.has-img { width: 104px; height: 104px; }
  .reward .r-name { font-size: 17.5px; }
  #taskList { grid-template-columns: 1fr; gap: 14px; }
  .task { min-height: 104px; padding: 20px 22px; }
  .task .name { font-size: 18px; }
  .task .icon { width: 58px; height: 58px; font-size: 28px; border-radius: 18px; }
  .task .go { height: 44px; min-width: 84px; font-size: 14.5px; }

  .hello { font-size: 30px; }
  .hero { padding: 28px 34px 26px; }
  .hero-egg-gif { right: 16px; bottom: 12px; width: 96px; height: 96px; }
  .ring-wrap { max-width: calc(100% - 122px); }

  .stat-body { max-width: 1240px; margin: 0 auto; grid-template-columns: 1.3fr .9fr; gap: 36px; }
  .stat-body .sec-title:first-child { margin-top: 0; }
  .stat-card .v { font-size: 36px; }
  .pet-stage { height: 400px; }
  .st4.max .pet-stage { height: 440px; }

  .tabbar { min-width: 520px; height: 78px; }
  .tabbar .tab { padding: 6px 34px; }

  /* 平板横屏下弹层用更宽的卡片 */
  .sheet { max-width: 620px; }
}

/* ---------- 3) 大屏 / 桌面窗口：等比例再放大一档 ---------- */
@media (min-width: 1280px), (min-device-width: 1280px) {
  .screen > section > * { max-width: 1320px; }
  .today-body, .stat-body { max-width: 1320px; }
  .shop-body { max-width: 1240px; }
  .reward-row { grid-template-columns: repeat(2, 1fr); }
  .pet-stage { height: 430px; }
  .hello { font-size: 32px; }
}

/* ---------- 4) 超大屏：内容再宽一档 ---------- */
@media (min-width: 1400px), (min-device-width: 1400px) {
  .screen > section > * { max-width: 1560px; }
  .today-body { max-width: 1560px; }
  .shop-body { max-width: 1420px; }
  .stat-body { max-width: 1560px; grid-template-columns: 1.35fr .9fr 290px; }

  /* 第三栏：家长提示卡片 */
  .td-side {
    display: block;
    margin-top: 26px;
    background: rgba(255, 255, 255, .78);
    border: 1px solid rgba(255, 255, 255, .95);
    border-radius: 26px;
    padding: 22px 22px 20px;
    box-shadow: var(--sh-md);
    font-size: 13px;
    line-height: 1.9;
    color: var(--ink-2);
  }
  .td-side::before {
    content: '📌 家长小提示';
    display: block;
    font-size: 15px;
    font-weight: 800;
    color: var(--ink);
    margin-bottom: 10px;
  }
  .td-side::after {
    content: '· 孩子完成打卡后，家长端「今日打卡」会实时更新\A· 奖励图片在家长端上传，孩子点小图可看大图\A· 积分可以喂宠物或兑换奖励，兑换后自动扣分\A· 一家人的设备用同一个家庭码自动同步';
    white-space: pre-line;
    display: block;
  }
}

/* ---------- 5) 横屏矮屏（平板横放但浏览器工具条占位）：压缩纵向留白 ---------- */
@media (min-width: 720px) and (max-height: 620px) and (orientation: landscape),
       (min-device-width: 720px) and (max-device-height: 620px) and (orientation: landscape) {
  .hero { padding: 18px 24px 16px; }
  .hello { font-size: 22px; }
  .ring-wrap { margin-top: 12px; padding: 10px 16px; }
  .ring, .ring svg { width: 64px; height: 64px; }
  .pet-stage { height: 260px; }
  .mic { width: 92px; height: 92px; font-size: 34px; }
  .sheet { max-height: 94%; }
}

/* ---------- 6) 触屏平板去掉 hover 位移（点完不会卡住） ---------- */
@media (hover: none) and (min-width: 720px), (hover: none) and (min-device-width: 720px) {
  .task:hover, .reward:hover, .pet-card:hover, .parent-fab:hover,
  .btn:hover, .pet-ia:hover { transform: none; box-shadow: var(--sh-sm); }
  .task:active { transform: scale(.99); }
  .reward:active { transform: scale(.98); }
  .pet-card:active { transform: scale(.96); }
  /* 平板用「按下」的橙色描边代替 hover 提示 */
  .tab.on { background: rgba(255, 233, 176, .55); border-radius: 999px; }
}

/* ---------- 7) 小尺寸平板（720~860px）：任务回单列，避免文字被挤断 ---------- */
@media (min-width: 720px) and (max-width: 860px),
       (min-device-width: 720px) and (max-device-width: 860px) {
  #taskList { grid-template-columns: 1fr; }
  .reward-row { grid-template-columns: 1fr; }
  .pet-grid { grid-template-columns: repeat(4, 1fr); }
  .today-body { gap: 20px; }
  .stat-body { grid-template-columns: 1fr; gap: 0; }
  .std-aside .sec-title:first-child { margin-top: 26px; }
  .stat-grid { grid-template-columns: repeat(4, 1fr); }
}
