/* ==========================================================
   花慢慢 · 全站统一外壳（导航 / 提示 / 返回 / 页面归一）
   在所有页面样式之后加载，用 ID 选择器覆盖各页旧样式
   ========================================================== */

/* ---------------- 底部导航 ---------------- */
#tabbar{
  position:fixed;left:50%;bottom:0;transform:translateX(-50%);
  z-index:20;
  display:grid;grid-template-columns:repeat(4,1fr);
  width:100%;max-width:430px;
  padding:8px 10px calc(6px + env(safe-area-inset-bottom));
  background:rgba(255,255,255,.95);
  backdrop-filter:blur(16px);-webkit-backdrop-filter:blur(16px);
  border-top:1px solid rgba(226,238,226,.9);
  box-shadow:0 -6px 20px rgba(48,92,67,.05);
}
#tabbar .tab{
  display:flex;flex-direction:column;align-items:center;justify-content:center;gap:3px;
  padding:4px 0 2px;
  border:0;background:none;text-decoration:none;
  font-size:11.5px;font-weight:500;line-height:1.25;
  color:#849B8D;cursor:pointer;
  -webkit-tap-highlight-color:transparent;
}
#tabbar .tab .tab-icon{
  width:42px;height:30px;border-radius:999px;
  display:grid;place-items:center;
  background:none;box-shadow:none;
  transition:background .18s ease;
}
#tabbar .tab .tab-icon img{
  width:27px;height:27px;object-fit:contain;display:block;
  border-radius:0;box-shadow:none;
  opacity:.8;filter:saturate(.85);
  transition:opacity .18s ease,filter .18s ease,transform .18s ease;
}
#tabbar .tab-label{
  display:block;font-size:11.5px;line-height:1.25;letter-spacing:.2px;
}
#tabbar .tab.is-active{color:#43835E;font-weight:700}
#tabbar .tab.is-active .tab-icon{background:#E5F3E7}
#tabbar .tab.is-active .tab-icon img{opacity:1;filter:none;transform:none}
#tabbar .tab.is-active .tab-label{font-weight:700}

/* ---------------- 轻提示 ---------------- */
#toast{
  position:fixed;left:50%;bottom:calc(88px + env(safe-area-inset-bottom));
  z-index:60;
  transform:translate(-50%,10px);
  max-width:80%;
  padding:10px 18px;border-radius:999px;
  background:rgba(44,87,67,.95);color:#fff;
  font-size:13px;line-height:1.45;text-align:center;
  opacity:0;pointer-events:none;
  transition:opacity .22s ease,transform .22s ease;
  box-shadow:0 8px 20px rgba(35,70,52,.24);
}
#toast.show{opacity:1;transform:translate(-50%,0)}

/* ---------------- 返回按钮（子页）：固定在屏幕左上角 ---------------- */
.back-chip{
  position:fixed;z-index:60;
  top:calc(10px + env(safe-area-inset-top));
  left:calc(10px + env(safe-area-inset-left));
  width:42px;height:42px;
  display:grid;place-items:center;
  padding:0;border:0;border-radius:0;
  background:transparent;box-shadow:none;backdrop-filter:none;-webkit-backdrop-filter:none;
  color:#3E7A57;text-decoration:none;
  -webkit-tap-highlight-color:transparent;
  transition:transform .16s ease,opacity .16s ease;
}
.back-chip:active{transform:scale(.92);opacity:.7}
.back-chip svg{width:22px;height:22px;display:block}

/* ---------------- 诊断页：去掉手机框 ---------------- */
body[data-page="diagnose"]{
  display:block;padding:0;
  min-height:100dvh;
}
body[data-page="diagnose"] .phone{
  width:100%;max-width:430px;
  height:100dvh;
  margin:0 auto;
  border:0;border-radius:0;
  box-shadow:none;
  background:#f9fdf7;
}
body[data-page="diagnose"] .app{min-height:0}
body[data-page="diagnose"] .screen-host{
  padding-bottom:calc(80px + env(safe-area-inset-bottom));
}

/* ---------------- 养护知识页 ---------------- */
body[data-page="care"] .app-shell{
  width:100%;max-width:430px;
  min-height:100dvh;
}
body[data-page="care"] .knowledge-page{
  min-height:100dvh;
  padding-bottom:20px;
}
body[data-page="care"] .hero{
  padding-top:calc(58px + env(safe-area-inset-top));
}

/* ---------------- 成就页 ---------------- */
body[data-page="achievement"]{
  padding:0;
  min-height:100dvh;
}
body[data-page="achievement"] .app{
  max-width:430px;
  min-height:100dvh;
  border-radius:0;
  box-shadow:none;
}
body[data-page="achievement"] .hero{
  padding-top:calc(56px + env(safe-area-inset-top));
}

/* ---------------- 我的页：去掉预览外壳 ---------------- */
body[data-page="mine"]{
  display:block;
  padding:0;
  height:100dvh;
  overflow:hidden;
  background:var(--page);
}
body[data-page="mine"] .stage{
  display:block;
  height:100%;
  padding:0;
  gap:0;
}
body[data-page="mine"]::before{display:none}
body[data-page="mine"] .phone{
  width:100%;max-width:430px;
  height:100dvh;min-height:0;
  margin:0 auto;
  border:0;border-radius:0;
  box-shadow:none;
  overflow:hidden;
  background:var(--page);
}
body[data-page="mine"] .statusbar,
body[data-page="mine"] .caption{display:none}
body[data-page="mine"] .page{
  position:absolute;inset:0;
  min-height:0;
  padding:calc(18px + env(safe-area-inset-top)) 20px calc(96px + env(safe-area-inset-bottom));
  overflow-y:auto;overflow-x:hidden;
}

/* ---------------- 子页通用 ---------------- */
.subpage{
  min-height:100dvh;
  max-width:430px;
  margin:0 auto;
  padding:calc(60px + env(safe-area-inset-top)) 18px calc(30px + env(safe-area-inset-bottom));
  background:
    radial-gradient(110% 40% at 100% 0%, #EDF7E8 0%, rgba(237,247,232,0) 60%),
    var(--bg,#F3F8F1);
  box-shadow:0 0 60px rgba(40,80,55,.10);
  box-sizing:border-box;
}

@media (prefers-reduced-motion:reduce){
  #toast,#tabbar .tab,#tabbar .tab .tab-icon img{transition:none}
}
