/* ==========================================================
   漫希的工作台 — 鸿蒙手机端
   底部固定导航 + 卡片流
   ========================================================== */

html, body { overscroll-behavior-y: none; }
body { background: var(--bg); }

/* 不钉死、不限制高度：交由 window 原生滚动，兼容性最好 */
.m-app { display: block; }

/* ---------------- 顶栏 ---------------- */
.m-head {
  position: fixed; top: 0; left: 0; right: 0; z-index: 50;
  padding-top: env(safe-area-inset-top);
  /* 顶栏本体透明，模糊与渐变由 ::before 承担，避免硬性分割线 */
}
/* 默认（未滚动）：顶栏完全透明，与背景融为一体；向下不延伸，避免模糊提前沾到下方卡片 */
.m-head::before {
  content: ''; position: absolute; left: 0; right: 0; top: 0; bottom: 0;
  background: transparent;
  pointer-events: none;
  transition: bottom .28s var(--ease), background .28s var(--ease);
}
/* 滚动后：毛玻璃渐变浮现，向下柔和延伸并淡出 */
.m-head.scrolled::before {
  bottom: -46px;
  background: linear-gradient(to bottom,
    color-mix(in srgb, var(--bg) 52%, transparent) 0%,
    color-mix(in srgb, var(--bg) 40%, transparent) 40%,
    color-mix(in srgb, var(--bg) 20%, transparent) 70%,
    color-mix(in srgb, var(--bg) 5%, transparent) 90%,
    transparent 100%);
  -webkit-backdrop-filter: saturate(1.8) blur(20px);
  backdrop-filter: saturate(1.8) blur(20px);
  -webkit-mask-image: linear-gradient(to bottom, #000 0%, #000 28%, rgba(0,0,0,.6) 64%, rgba(0,0,0,.14) 90%, transparent 100%);
  mask-image: linear-gradient(to bottom, #000 0%, #000 28%, rgba(0,0,0,.6) 64%, rgba(0,0,0,.14) 90%, transparent 100%);
}
.m-head-in { position: relative; z-index: 1; height: 50px; display: flex; align-items: center; padding: 0 16px; gap: 10px; }
.m-head h1 { font-size: 18px; letter-spacing: -.01em; flex: 1; }
.m-head .hbtn {
  width: 34px; height: 34px; border-radius: 10px;
  display: grid; place-items: center; font-size: 16px;
  color: var(--text-2); background: rgba(255,255,255,.7);
  transition: all .15s var(--ease);
}
.m-head .hbtn:active { transform: scale(.92); background: var(--surface-3); }

/* ---------------- 主体 ---------------- */
.m-body {
  /* 顶栏(50+安全区)与底栏(56+安全区)是 fixed 浮层，中间内容用 padding 避让，由 window 原生滚动 */
  /* 顶栏与首张卡片间距收紧到约 2 毫米 */
  padding: calc(env(safe-area-inset-top) + 50px + 2mm) 14px calc(env(safe-area-inset-bottom) + 96px);
  display: flex; flex-direction: column; gap: 13px;
  max-width: 640px; margin: 0 auto; width: 100%;
  box-sizing: border-box;
}

/* ---------------- 底部导航 ---------------- */
.m-tabs {
  /* 悬浮磨砂底栏：固定高度，避免华为浏览器非全屏下滑时高度跳变；四角更圆 */
  position: fixed; left: 14px; right: 14px;
  bottom: calc(14px + env(safe-area-inset-bottom)); z-index: 50;
  display: grid; grid-template-columns: repeat(5, 1fr); gap: 4px;
  background: rgba(255,255,255,.46);
  -webkit-backdrop-filter: saturate(1.7) blur(18px);
  backdrop-filter: saturate(1.7) blur(18px);
  border-radius: 28px;
  border: .5px solid rgba(255,255,255,.4);
  box-shadow: 0 8px 24px rgba(15,30,50,.10);
  /* inner padding 不随 safe-area 变化 → 高度恒定；safe-area 只影响外 bottom 偏移 */
  padding: 6px 4px;
  height: 62px;
  box-sizing: border-box;
  overflow: hidden;
}
.m-tab {
  height: 50px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  color: #5a6478; position: relative; transition: color .2s var(--ease);
  border-radius: 14px;
}
.m-tab .ic {
  width: 22px; height: 22px;
  transition: transform .22s var(--ease), fill .2s var(--ease), stroke .2s var(--ease);
}
.m-tab .lb {
  font-size: 10px; line-height: 1; font-weight: 500; letter-spacing: .02em;
  transition: color .2s var(--ease);
}
.m-tab.on { color: var(--brand); }
.m-tab.on .ic {
  fill: currentColor; stroke: currentColor;
  transform: scale(1.12);
}
.m-tab.on .lb { color: var(--brand); font-weight: 600; }
.m-tab:active .ic { transform: scale(.9); }
.m-tab .bdg {
  position: absolute; top: 5px; right: calc(50% - 15px);
  min-width: 15px; height: 15px; padding: 0 4px;
  background: var(--danger); color: #fff; border-radius: var(--r-full);
  font-size: 9.5px; font-weight: 700; display: grid; place-items: center;
  font-family: var(--font-num);
  box-shadow: 0 0 0 2px rgba(255,255,255,.46);
}

/* ---------------- 卡片 ---------------- */
.mc {
  background: var(--surface); border-radius: var(--r-lg);
  border: .5px solid var(--line); box-shadow: var(--sh-1);
  overflow: hidden;
}
.mc-h {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px 11px; gap: 10px;
}
.mc-h h3 { font-size: 14.5px; display: flex; align-items: center; gap: 7px; }
.mc-h .sub { font-size: 11.5px; color: var(--text-3); font-weight: 400; }
.mc-h .more { font-size: 12px; color: var(--text-3); display: flex; align-items: center; gap: 2px; }
.mc-b { padding: 0 16px 16px; }
.mc-b.pt { padding-top: 14px; }

/* ---------------- 首页 Hero ---------------- */
.m-hero {
  background: linear-gradient(128deg, var(--brand-hover), var(--brand) 52%, var(--brand-soft));
  border-radius: var(--r-xl); padding: 20px; color: #fff;
  position: relative; overflow: hidden;
  box-shadow: 0 6px 20px rgba(var(--brand-rgb),.24);
}
.m-hero::after {
  content: ''; position: absolute; right: -40px; top: -56px;
  width: 168px; height: 168px; border-radius: 50%; background: rgba(255,255,255,.11);
}
.m-hero .top { display: flex; align-items: flex-start; gap: 14px; position: relative; z-index: 1; }
.m-hero h2 { font-size: 20px; font-weight: 600; }
.m-hero .dt { font-size: 11.5px; opacity: .86; margin-top: 4px; }
.m-hero .sc { text-align: center; flex: none; }
.m-hero .sc .wrap { position: relative; width: 62px; height: 62px; }
.m-hero .sc .val { position: absolute; inset: 0; display: grid; place-items: center; font-size: 19px; font-weight: 650; font-family: var(--font-num); }
.m-hero .sc .lb { font-size: 9.5px; opacity: .85; margin-top: 2px; }
.m-hero .tip {
  margin-top: 14px; font-size: 12px; line-height: 1.6;
  background: rgba(255,255,255,.16); padding: 10px 12px;
  border-radius: var(--r-md); position: relative; z-index: 1;
}

/* 快捷统计 */
.m-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.m-st {
  background: var(--surface); border-radius: var(--r-md); border: .5px solid var(--line);
  padding: 12px 4px; text-align: center;
}
.m-st .em { font-size: 17px; display: block; margin-bottom: 4px; }
.m-st b { display: block; font-size: 16px; font-family: var(--font-num); letter-spacing: -.02em; }
.m-st b small { font-size: 10px; font-weight: 500; color: var(--text-3); }
.m-st span { font-size: 10px; color: var(--text-3); display: block; margin-top: 1px; }

/* ---------------- 睡眠大按钮 ---------------- */
.m-sleep-box {
  background: linear-gradient(150deg, #eff1fc, #e7ebf9);
  border: 1px solid #dbe0f4; border-radius: var(--r-lg);
  padding: 18px; display: flex; flex-direction: column; gap: 15px;
}
.m-sleep-box .big { font-size: 34px; font-weight: 650; color: var(--c-sleep); font-family: var(--font-num); letter-spacing: -.03em; line-height: 1; }
.m-sleep-box .lb { font-size: 12px; color: #7b86b8; margin-top: 6px; }
.m-big-btn {
  height: 52px; border-radius: var(--r-md); font-size: 16px; font-weight: 600;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  color: #fff; transition: transform .16s var(--ease); width: 100%;
}
.m-big-btn:active { transform: scale(.975); }
.m-bb-sleep { background: var(--c-sleep); box-shadow: 0 4px 14px rgba(106,127,208,.34); }
.m-bb-wake  { background: #e8a33d; box-shadow: 0 4px 14px rgba(232,163,61,.34); }
.m-sub-btn { display: flex; gap: 9px; }
.m-sub-btn .btn { flex: 1; height: 38px; }

/* ---------------- 睡眠日历 ---------------- */
.m-cal .cal-cell { min-height: 54px; padding: 5px 1px 4px; border-radius: 8px; }
.m-cal .cal-cell .d { font-size: 12px; }
.m-cal .cal-cell .t { font-size: 9.5px; margin-top: 2px; }
.m-cal .cal-cell .h { font-size: 8.5px; }
.m-cal .cal-grid, .m-cal .cal-head { gap: 4px; }

.m-month {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
}
.m-month b { font-size: 15px; font-family: var(--font-num); }
.m-mbtn {
  width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center;
  background: var(--surface-3); color: var(--text-2); font-size: 15px;
}
.m-mbtn:active { transform: scale(.9); }

/* ---------------- 习惯 ---------------- */
.m-habit {
  padding: 13px 0; border-bottom: .5px solid var(--line);
}
.m-habit:last-child { border-bottom: none; }
.m-habit .hd { display: flex; align-items: center; gap: 11px; margin-bottom: 11px; }
.m-habit .hic {
  width: 34px; height: 34px; border-radius: 10px; flex: none;
  display: grid; place-items: center; font-size: 16px;
}
.m-habit .hnm { flex: 1; min-width: 0; }
.m-habit .hnm b { font-size: 14px; font-weight: 550; display: block; }
.m-habit .hnm span { font-size: 11px; color: var(--text-3); }
.m-habit .wk-d { font-size: 10.5px; }

/* 今日待办（手机） */
.m-todo {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 0; border-bottom: .5px solid var(--line);
}
.m-todo:last-child { border-bottom: none; }
.m-todo .cb {
  width: 24px; height: 24px; border-radius: 8px; flex: none;
  border: 2px solid var(--line-2); transition: all .18s var(--ease);
}
.m-todo.on .cb { border-color: transparent; position: relative; }
.m-todo.on .cb::after {
  content: ''; position: absolute; inset: 0;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6L9 17l-5-5'/%3E%3C/svg%3E") center/62% no-repeat;
}
.m-todo .em { font-size: 17px; }
.m-todo .nm { font-size: 14px; flex: 1; transition: all .2s; }
.m-todo.on .nm { color: var(--text-3); text-decoration: line-through; }

/* ---------------- 食谱 ---------------- */
.m-meal {
  border-radius: var(--r-lg); border: .5px solid var(--line);
  background: var(--surface); overflow: hidden; margin-bottom: 11px;
}
.m-meal:last-child { margin-bottom: 0; }
.m-meal .mt {
  padding: 11px 14px; display: flex; align-items: center; justify-content: space-between;
  border-bottom: .5px solid var(--line);
}
.m-meal .mb { padding: 13px 14px; }
.m-meal h4 { font-size: 16px; margin-bottom: 8px; letter-spacing: -.01em; }
.m-meal .kv { display: flex; gap: 12px; font-size: 11.5px; color: var(--text-3); margin-bottom: 10px; }
.m-meal .kv b { font-family: var(--font-num); color: var(--text-2); }
.m-meal .acts { display: flex; gap: 8px; margin-top: 12px; }
.m-meal .acts .btn { flex: 1; height: 38px; }
.m-meal .acts .btn.fav { flex: 0 0 46px; }

.m-rec {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 0; border-bottom: .5px solid var(--line);
}
.m-rec:last-child { border-bottom: none; }
.m-rec .tx { flex: 1; min-width: 0; }
.m-rec .tx b { font-size: 13.5px; font-weight: 550; display: block; }
.m-rec .tx span { font-size: 11px; color: var(--text-3); display: flex; gap: 9px; margin-top: 3px; }
.m-rec .tx span em { font-style: normal; font-family: var(--font-num); color: var(--text-2); }

/* 分段 tab */
.m-seg {
  display: flex; background: var(--surface-3); border-radius: var(--r-md);
  padding: 3px; gap: 2px;
}
.m-seg button {
  flex: 1; height: 32px; border-radius: 9px;
  font-size: 12.5px; font-weight: 500; color: var(--text-2);
  transition: all .18s var(--ease);
}
.m-seg button.on { background: var(--surface); color: var(--text); font-weight: 600; box-shadow: var(--sh-1); }

/* ---------------- 运动 ---------------- */
.m-wo {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 0; border-bottom: .5px solid var(--line);
}
.m-wo:last-child { border-bottom: none; }
.m-wo .ic {
  width: 38px; height: 38px; border-radius: 11px; flex: none;
  background: var(--c-fitness-soft); display: grid; place-items: center; font-size: 17px;
}
.m-wo .tx { flex: 1; min-width: 0; }
.m-wo .tx b { font-size: 14px; font-weight: 550; display: block; }
.m-wo .tx span { font-size: 11px; color: var(--text-3); }
.m-wo .kc { font-size: 13px; font-family: var(--font-num); color: var(--brand); font-weight: 650; }

.m-week { display: grid; grid-template-columns: repeat(7,1fr); gap: 6px; }
.m-wd {
  display: flex; flex-direction: column; align-items: center; gap: 5px;
  padding: 10px 2px; border-radius: 10px; background: var(--surface-3);
}
.m-wd.on { background: var(--c-fitness-soft); box-shadow: inset 0 0 0 1px var(--brand-line); }
.m-wd.td { box-shadow: inset 0 0 0 1.5px var(--brand); }
.m-wd .dw { font-size: 10px; color: var(--text-3); font-weight: 600; }
.m-wd .em { font-size: 16px; height: 20px; }
.m-wd .mn { font-size: 10px; font-family: var(--font-num); color: var(--text-2); font-weight: 600; }

/* 悬浮按钮 */
.fab {
  position: fixed; right: 16px; z-index: 45;
  bottom: calc(82px + env(safe-area-inset-bottom));
  height: 46px; padding: 0 18px; border-radius: var(--r-full);
  background: var(--brand); color: #fff; font-size: 14px; font-weight: 600;
  display: flex; align-items: center; gap: 6px;
  box-shadow: 0 6px 20px rgba(var(--brand-rgb),.4);
  transition: transform .16s var(--ease);
}
.fab:active { transform: scale(.94); }

/* 图文提示块 */
.m-tips { display: flex; flex-direction: column; gap: 9px; }
.m-tip-i {
  display: flex; gap: 11px; padding: 12px 13px;
  border-radius: var(--r-md); background: var(--surface-2); border: .5px solid var(--line);
}
.m-tip-i .em { font-size: 19px; flex: none; }
.m-tip-i .tx b { font-size: 13px; display: block; margin-bottom: 3px; }
.m-tip-i .tx p { font-size: 12px; line-height: 1.62; color: var(--text-2); }

.m-legend { display: flex; gap: 12px; flex-wrap: wrap; font-size: 11px; color: var(--text-3); margin-top: 13px; padding-top: 12px; border-top: .5px solid var(--line); }

/* 电脑端独立页面已移除，不再有切换提示 */
