/* ============================================================
   菜谱记录小程序 — 线框稿样式系统
   视觉方向：Artistic 设计系统（暖纸底 + 单一赭石强调）
   保真度：线框（灰块 / 占位线 / 占位图），克制使用强调色
   设备：微信小程序手机尺寸 375 × 812，带手机外框
   ============================================================ */

/* --- Artistic 令牌（来自 tokens.css，原样绑定）--- */
:root {
  --bg: #fbf6ee;
  --surface: #fffdf8;
  --surface-warm: #f1e3cf;
  --fg: #201914;
  --fg-2: #4c4037;
  --muted: #7a6d63;
  --meta: #9b5b32;
  --border: #ded2c3;
  --border-soft: #eee4d7;
  --accent: #9b5b32;
  --accent-on: #ffffff;
  --accent-hover: color-mix(in oklab, var(--accent), black 8%);
  --accent-active: color-mix(in oklab, var(--accent), black 14%);
  --success: #4f8a4f;
  --warn: #c9822f;
  --danger: #b33a3a;
  --font-display: Georgia, "Times New Roman", serif;
  --font-body: Inter, system-ui, sans-serif;
  --font-mono: "SF Mono", ui-monospace, Menlo, monospace;
  --text-xs: 12px;
  --text-sm: 14px;
  --text-base: 17px;
  --text-lg: 20px;
  --text-xl: 28px;
  --text-2xl: 42px;
  --text-3xl: 64px;
  --text-4xl: 88px;
  --leading-body: 1.62;
  --leading-tight: 1;
  --tracking-display: -0.025em;
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 32px;
  --space-12: 48px;
  --radius-sm: 10px;
  --radius-md: 16px;
  --radius-lg: 24px;
  --radius-pill: 9999px;
  --elev-ring: 0 0 0 1px var(--border);
  --elev-raised: 0 20px 52px rgba(32, 25, 20, 0.12);
  --focus-ring: 0 0 0 4px rgba(155, 91, 50, 0.24);
  --motion-fast: 150ms;
  --motion-base: 240ms;
  --ease-standard: cubic-bezier(0.2, 0, 0, 1);

  /* 线框专用：占位块的中性灰（基于暖纸派生，避免冷灰突兀） */
  --wf-block: #ece4d8;
  --wf-block-2: #e3d8c8;
  --wf-line: #d8cbba;
  --screen-w: 375px;
  --screen-h: 812px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: var(--font-body);
  color: var(--fg);
  background:
    radial-gradient(1200px 600px at 50% -10%, color-mix(in oklab, var(--surface-warm), transparent 55%), transparent 60%),
    var(--bg);
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

/* ============================================================
   手机外框
   ============================================================ */
.stage {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px 16px;
}

.phone {
  width: var(--screen-w);
  height: var(--screen-h);
  background: #1b1510;
  border-radius: 46px;
  padding: 11px;
  box-shadow: var(--elev-raised), 0 0 0 2px rgba(0,0,0,.35) inset;
  position: relative;
  flex: none;
}

.screen {
  position: relative;
  width: 100%;
  height: 100%;
  background: var(--surface);
  border-radius: 36px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* 灵动岛 */
.dynamic-island {
  position: absolute;
  top: 10px; left: 50%;
  transform: translateX(-50%);
  width: 116px; height: 32px;
  background: #0c0a08;
  border-radius: 20px;
  z-index: 60;
}

/* 状态栏 */
.statusbar {
  height: 50px;
  flex: none;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  padding: 0 26px 8px;
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 600;
  color: var(--fg);
  letter-spacing: .02em;
}
.statusbar .sb-icons { display: flex; gap: 6px; align-items: center; }
.statusbar .sb-icons span { width: 17px; height: 11px; background: var(--fg); border-radius: 2px; opacity: .85; display: inline-block; }
.statusbar .sb-icons .bat { width: 24px; border-radius: 3px; }

/* 顶部导航条 */
.topbar {
  flex: none;
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-2) var(--space-5) var(--space-3);
  min-height: 44px;
}
.topbar .title {
  font-family: var(--font-display);
  font-size: var(--text-lg);
  font-weight: 700;
  letter-spacing: var(--tracking-display);
  flex: 1;
}
.topbar.center .title { text-align: center; }
.iconbtn {
  width: 40px; height: 40px;
  flex: none;
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  background: var(--surface);
  color: var(--fg-2);
  display: grid; place-items: center;
  font-size: 18px;
  cursor: pointer;
  transition: background var(--motion-fast) var(--ease-standard);
}
.iconbtn:hover { background: var(--border-soft); }
.iconbtn:focus-visible { outline: none; box-shadow: var(--focus-ring); }

/* 可滚动内容区 */
.content {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: var(--space-2) var(--space-5) var(--space-6);
  -webkit-overflow-scrolling: touch;
}
.content::-webkit-scrollbar { width: 0; }
.content.has-fab { padding-bottom: 96px; }
.content.with-tabbar { padding-bottom: 84px; }

/* ============================================================
   线框基础元件
   ============================================================ */
.wf-label {
  font-size: var(--text-xs);
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: .12em;
  color: var(--muted);
  margin-bottom: var(--space-2);
  display: block;
}
.eyebrow {
  font-size: 11px;
  font-family: var(--font-mono);
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--meta);
}
.section-title {
  font-family: var(--font-display);
  font-size: var(--text-lg);
  font-weight: 700;
  letter-spacing: var(--tracking-display);
}
.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin: var(--space-6) 0 var(--space-3);
}
.section-head .more { font-size: var(--text-xs); color: var(--meta); }

/* 占位文字线 */
.ph-line { height: 11px; border-radius: 6px; background: var(--wf-line); }
.ph-line.lg { height: 15px; }
.ph-line.w90{width:90%}.ph-line.w80{width:80%}.ph-line.w70{width:70%}
.ph-line.w60{width:60%}.ph-line.w50{width:50%}.ph-line.w40{width:40%}.ph-line.w30{width:30%}
.ph-stack > * + * { margin-top: 8px; }

/* 占位图（带对角线交叉，经典线框记号） */
.ph-img {
  background: var(--wf-block);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  position: relative;
  overflow: hidden;
}
.ph-img::before, .ph-img::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(to top right, transparent calc(50% - 0.6px), var(--border) 50%, transparent calc(50% + 0.6px));
}
.ph-img::after { transform: scaleX(-1); }
.ph-img.no-x::before, .ph-img.no-x::after { display: none; }
.ph-img .ph-tag {
  position: absolute; left: 10px; bottom: 8px;
  font-size: 11px; font-family: var(--font-mono); color: var(--muted);
  background: color-mix(in oklab, var(--surface), transparent 8%);
  padding: 2px 7px; border-radius: 6px;
}

.ph-avatar {
  border-radius: var(--radius-pill);
  background: var(--wf-block-2);
  border: 1px solid var(--border);
  flex: none;
  display: grid; place-items: center;
  color: var(--muted); font-size: 12px;
}

/* 卡片 / 列表行 / 面板 */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-4);
}
.list-row {
  display: flex;
  gap: var(--space-3);
  align-items: center;
  padding: var(--space-3) 0;
  border-bottom: 1px solid var(--border-soft);
}
.list-row:last-child { border-bottom: none; }
.row-body { flex: 1; min-width: 0; }
.chev { color: var(--muted); font-size: 18px; flex: none; }

/* chips / 筛选 */
.chips { display: flex; gap: var(--space-2); flex-wrap: wrap; }
.chips.scroll { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 4px; }
.chips.scroll::-webkit-scrollbar { height: 0; }
.chip {
  flex: none;
  font-size: var(--text-sm);
  padding: 7px 14px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--fg-2);
  cursor: pointer;
  white-space: nowrap;
  transition: all var(--motion-fast) var(--ease-standard);
}
.chip[aria-selected="true"], .chip.active {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-on);
}

/* 按钮 */
.btn {
  font-family: var(--font-body);
  font-size: var(--text-base);
  font-weight: 600;
  padding: 13px var(--space-5);
  border-radius: var(--radius-pill);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--fg);
  cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  transition: all var(--motion-fast) var(--ease-standard);
}
.btn:hover { background: var(--border-soft); }
.btn:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-on);
}
.btn-primary:hover { background: var(--accent-hover); }
.btn:disabled, .btn[aria-disabled="true"] {
  background: var(--border-soft);
  border-color: var(--border);
  color: var(--muted);
  cursor: not-allowed;
}
.btn-block { display: flex; width: 100%; }

/* 浮动操作按钮 */
.fab {
  position: absolute;
  right: 18px; bottom: 86px;
  width: 56px; height: 56px;
  border-radius: var(--radius-pill);
  background: var(--accent);
  color: var(--accent-on);
  border: none;
  font-size: 28px; line-height: 1;
  display: grid; place-items: center;
  box-shadow: 0 10px 24px rgba(155,91,50,.34);
  cursor: pointer;
  z-index: 40;
}

/* 表单字段 */
.field { margin-bottom: var(--space-4); }
.field > label {
  display: block;
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--fg-2);
  margin-bottom: var(--space-2);
}
.field .req { color: var(--danger); }
.input, .textarea, .select {
  width: 100%;
  font-family: var(--font-body);
  font-size: var(--text-base);
  color: var(--fg);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px var(--space-4);
}
.input::placeholder, .textarea::placeholder { color: var(--muted); }
.input:focus, .textarea:focus, .select:focus { outline: none; box-shadow: var(--focus-ring); border-color: var(--accent); }
.textarea { resize: none; min-height: 92px; line-height: var(--leading-body); }
.hint { font-size: var(--text-xs); color: var(--muted); margin-top: 6px; }

/* ============================================================
   底部 Tab 导航（首页 / 菜谱 / 记录 / 我的）
   ============================================================ */
.tabbar {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 78px;
  background: color-mix(in oklab, var(--surface), transparent 4%);
  backdrop-filter: blur(8px);
  border-top: 1px solid var(--border);
  display: flex;
  padding: 8px 6px 22px;
  z-index: 50;
}
.tabbar a {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  text-decoration: none;
  color: var(--muted);
  font-size: 11px;
  padding-top: 4px;
}
.tabbar .ti {
  width: 24px; height: 24px;
  display: grid; place-items: center;
  color: currentColor;
}
.tabbar .ti svg { width: 23px; height: 23px; display: block; }
.tabbar a[aria-current="page"] { color: var(--accent); font-weight: 600; }

/* Home indicator */
.home-indicator {
  position: absolute;
  bottom: 7px; left: 50%; transform: translateX(-50%);
  width: 134px; height: 5px;
  border-radius: 3px;
  background: color-mix(in oklab, var(--fg), transparent 70%);
  z-index: 55;
}

/* ============================================================
   首页：轮播 + 幸运大转盘
   ============================================================ */
.hero-greet { display: flex; align-items: center; gap: var(--space-3); padding-top: var(--space-1); }

.carousel { margin-top: var(--space-3); }
.carousel .ph-img { height: 168px; }
.carousel .ph-img .ph-tag { font-size: 12px; }
.dots { display: flex; gap: 6px; justify-content: center; margin-top: 10px; }
.dots i { width: 6px; height: 6px; border-radius: 50%; background: var(--wf-line); }
.dots i.on { width: 18px; border-radius: 3px; background: var(--accent); }

/* 幸运大转盘（静态展示） */
.wheel-card {
  margin-top: var(--space-4);
  background: var(--surface-warm);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  text-align: center;
}
.wheel-wrap { position: relative; width: 184px; height: 184px; margin: var(--space-4) auto var(--space-3); }
.wheel {
  width: 100%; height: 100%;
  border-radius: 50%;
  border: 6px solid var(--surface);
  box-shadow: var(--elev-ring), 0 8px 20px rgba(32,25,20,.12);
  background: conic-gradient(
    var(--wf-block) 0 45deg, var(--wf-block-2) 45deg 90deg,
    var(--wf-block) 90deg 135deg, var(--wf-block-2) 135deg 180deg,
    var(--wf-block) 180deg 225deg, var(--wf-block-2) 225deg 270deg,
    var(--wf-block) 270deg 315deg, var(--wf-block-2) 315deg 360deg);
  position: relative;
}
.wheel::after {
  content: "今天吃什么";
  position: absolute; inset: 50%;
  width: 64px; height: 64px; margin: -32px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--accent-on);
  display: grid; place-items: center;
  font-size: 12px; font-weight: 700; text-align: center; line-height: 1.3;
  font-family: var(--font-body);
}
.wheel-pointer {
  position: absolute; top: -6px; left: 50%; transform: translateX(-50%);
  width: 0; height: 0;
  border-left: 11px solid transparent;
  border-right: 11px solid transparent;
  border-top: 18px solid var(--accent);
  z-index: 2;
}
.wheel-seg-label {
  position: absolute; font-size: 11px; color: var(--fg-2); font-family: var(--font-mono);
}

/* 快捷入口网格 */
.quick-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--space-3); margin-top: var(--space-3); }
.quick-grid .qi { text-align: center; font-size: var(--text-xs); color: var(--fg-2); }
.quick-grid .qi .ic { width: 48px; height: 48px; margin: 0 auto 6px; border-radius: var(--radius-md); background: var(--wf-block); border: 1px solid var(--border); display:grid;place-items:center;color:var(--muted); }

/* 菜谱网格（列表/管理） */
.recipe-grid { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-3); margin-top: var(--space-3); }
.recipe-card .ph-img { height: 110px; border-radius: var(--radius-sm); }
.recipe-card .meta { margin-top: 8px; }
.recipe-card .ph-line { margin-top: 0; }
.badge {
  display: inline-block; font-size: 10px; font-family: var(--font-mono);
  padding: 2px 7px; border-radius: var(--radius-pill);
  background: var(--border-soft); color: var(--meta); margin-top: 6px;
}

/* 搜索框 */
.searchbar {
  display: flex; align-items: center; gap: 8px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-pill); padding: 10px var(--space-4);
  color: var(--muted); font-size: var(--text-sm);
}
.searchbar svg { width: 18px; height: 18px; flex: none; }

/* ============================================================
   菜谱详情
   ============================================================ */
.detail-hero { height: 220px; border-radius: 0; margin: 0 calc(-1 * var(--space-5)); }
.stat-row { display: flex; gap: var(--space-4); margin-top: var(--space-4); }
.stat { flex: 1; text-align: center; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md); padding: var(--space-3) var(--space-2); }
.stat .n { font-family: var(--font-display); font-size: var(--text-lg); font-weight: 700; }
.stat .l { font-size: var(--text-xs); color: var(--muted); margin-top: 2px; }
.step { display: flex; gap: var(--space-3); padding: var(--space-3) 0; border-bottom: 1px solid var(--border-soft); }
.step:last-child { border-bottom: none; }
.step .no { width: 26px; height: 26px; flex: none; border-radius: 50%; background: var(--accent); color: var(--accent-on); display: grid; place-items: center; font-size: 13px; font-weight: 700; }
.ingredient { display: flex; justify-content: space-between; padding: 10px 0; border-bottom: 1px dashed var(--border); font-size: var(--text-sm); }
.ingredient:last-child { border-bottom: none; }
.ingredient .amt { color: var(--muted); font-family: var(--font-mono); }

/* 底部操作条（详情/表单） */
.action-bar {
  position: absolute; left: 0; right: 0; bottom: 0;
  padding: var(--space-3) var(--space-5) calc(var(--space-3) + 18px);
  background: color-mix(in oklab, var(--surface), transparent 2%);
  backdrop-filter: blur(8px);
  border-top: 1px solid var(--border);
  display: flex; gap: var(--space-3);
  z-index: 50;
}
.content.with-actionbar { padding-bottom: 104px; }

/* ============================================================
   记录页：日历 + 当日动态
   ============================================================ */
.cal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: var(--space-3); }
.cal-head .m { font-family: var(--font-display); font-size: var(--text-lg); font-weight: 700; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.cal-grid .dow { text-align: center; font-size: 11px; color: var(--muted); font-family: var(--font-mono); padding-bottom: 4px; }
.cal-cell {
  aspect-ratio: 1; border-radius: var(--radius-sm);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  font-size: var(--text-sm); color: var(--fg-2); cursor: pointer; position: relative;
}
.cal-cell.out { color: var(--wf-line); }
.cal-cell .dot { width: 5px; height: 5px; border-radius: 50%; background: var(--accent); margin-top: 3px; }
.cal-cell[aria-selected="true"] { background: var(--accent); color: var(--accent-on); font-weight: 700; }
.cal-cell[aria-selected="true"] .dot { background: var(--accent-on); }
.cal-cell.today { box-shadow: inset 0 0 0 1px var(--accent); }

/* 动态条目（feed） */
.feed-item { display: flex; gap: var(--space-3); padding: var(--space-4) 0; border-bottom: 1px solid var(--border-soft); }
.feed-item:last-child { border-bottom: none; }
.feed-item .time { font-family: var(--font-mono); font-size: 11px; color: var(--meta); }
.feed-body { flex: 1; min-width: 0; }
.feed-imgs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-top: 10px; }
.feed-imgs .ph-img { height: 78px; border-radius: var(--radius-sm); }
.feed-tags { display: flex; gap: 6px; margin-top: 10px; flex-wrap: wrap; }
.tag { font-size: 11px; color: var(--meta); background: var(--border-soft); padding: 3px 9px; border-radius: var(--radius-pill); }

/* 时间分组标题 */
.feed-day { font-family: var(--font-mono); font-size: var(--text-xs); color: var(--muted); letter-spacing: .08em; margin: var(--space-5) 0 var(--space-1); text-transform: uppercase; }

/* ============================================================
   我的页面
   ============================================================ */
.profile-head { display: flex; align-items: center; gap: var(--space-4); padding: var(--space-4) 0 var(--space-5); }
.profile-stats { display: flex; }
.profile-stats .s { flex: 1; text-align: center; }
.profile-stats .s + .s { border-left: 1px solid var(--border-soft); }
.profile-stats .n { font-family: var(--font-display); font-size: var(--text-lg); font-weight: 700; }
.profile-stats .l { font-size: var(--text-xs); color: var(--muted); margin-top: 2px; }
.menu-row { display: flex; align-items: center; gap: var(--space-3); padding: var(--space-4) 0; border-bottom: 1px solid var(--border-soft); cursor: pointer; }
.menu-row:last-child { border-bottom: none; }
.menu-row .mi { width: 34px; height: 34px; flex: none; border-radius: var(--radius-sm); background: var(--wf-block); border: 1px solid var(--border); display:grid;place-items:center;color:var(--muted); }
.menu-row .mt { flex: 1; font-size: var(--text-base); }
.seg { display: flex; background: var(--border-soft); border-radius: var(--radius-pill); padding: 4px; margin: var(--space-4) 0; }
.seg button { flex: 1; border: none; background: none; padding: 8px; border-radius: var(--radius-pill); font-size: var(--text-sm); color: var(--fg-2); cursor: pointer; font-family: var(--font-body); }
.seg button.active { background: var(--surface); color: var(--accent); font-weight: 600; box-shadow: var(--elev-ring); }

/* ============================================================
   交付打磨：统一焦点态 / 点击区 / 降级动效
   ============================================================ */
a:focus-visible,
.qi:focus-visible,
.fab:focus-visible,
.tabbar a:focus-visible,
.chip:focus-visible,
.cal-cell:focus-visible,
.menu-row:focus-visible,
.seg button:focus-visible,
.list-row:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
  border-radius: var(--radius-sm);
}
.tabbar a:focus-visible { border-radius: var(--radius-md); }
.fab:focus-visible { box-shadow: 0 10px 24px rgba(155,91,50,.34), var(--focus-ring); }

/* 触摸目标：底部 Tab 与列表项保证 ≥44px 可点区域 */
.tabbar a { min-height: 48px; }
.list-row { min-height: 44px; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    transition-duration: 1ms !important;
    animation-duration: 1ms !important;
    scroll-behavior: auto !important;
  }
}

/* 屏幕角标说明（仅线框稿可见的批注，便于评审） */
.wf-note {
  margin: var(--space-2) auto var(--space-6);
  max-width: var(--screen-w);
  font-size: var(--text-xs);
  color: var(--muted);
  text-align: center;
  font-family: var(--font-mono);
}
