/* ============================================================
 * app.css —— 海燕小厨
 *
 * 设计规则（改的时候别破坏）
 * ------------------------------------------------
 * 配色：只用一个强调色（深林绿）。没有第二个彩色。
 *       底色是冷调米白，不是暖奶油色。暖米 + 黄铜 + 深棕是
 *       烹饪类界面的 AI 默认配色，最容易撞脸，所以避开。
 * 字体：用系统原生中文字体。不用衬线体（衬线是典型 AI 默认选择），
 *       也不加载任何网络字体（国内加载 Google Fonts 基本会失败）。
 * 圆角：一套规则，不混用
 *       卡片 14 / 输入框和按钮 10 / 小标签 9 / 头像和返回键 正圆
 * 阴影：一律带绿色调，不用纯黑投影
 *
 * 删掉的功能，样式也一起删了（购物车、订单、采买清单、配料、通知…）。
 * 用 deploy/audit-css.js 能查出「定义了但没用到」和「用到了但没定义」。
 * ============================================================ */
:root {
  /* 底色与文字
     注意：加了整页背景图之后，这几个颜色不能只按白底挑了。
     图里最暗的地方压过白纱是 #cdc9c8，按那个底色算对比度才准
     （之前只按平均色算，结论是 13.7:1，实际最差只有 3.2:1，差点翻车）。
     现在这组值是用 deploy/check-contrast.js 逐点验过的。 */
  --bg:      #f7f7f5;
  --card:    #ffffff;
  --ink:     #18211d;   /* 菜名      最低 9.2:1 */
  --ink2:    #46524a;   /* 分类名    最低 4.6:1 */
  --ink3:    #5c6862;   /* 次要小字  最低 3.3:1 */
  --line:    #e8eae7;

  /* 页面背景图上盖的那层白纱浓度。
     数字越小 → 背景图越明显、文字越难读。
     0.78 是 deploy/check-contrast.js 算出来的下限：
     按「图里有一块纯黑」的最坏情况验，三种字色全部达标。
     换背景图之后一定要重跑一次那个脚本，别凭感觉。 */
  --veil:   .78;
  --bg-img: url("hero.jpg");

  /* 唯一的强调色 */
  --green:   #1e6b4f;
  --green-d: #14503a;
  --green-l: #e6f0ea;

  /* 语义色：只在报错时出现，不做装饰 */
  --warn:    #b4443c;
  --warn-l:  #fbeceb;

  --rail:    #f1f3f0;

  --r-card:  14px;
  --r-ctl:   10px;
  --r-tag:   9px;

  --hero-h:   178px;
  --rail-w:   84px;
  --tabbar-h: 58px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0; padding: 0; height: 100%;
  background: #e9ebe8;
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "HarmonyOS Sans SC",
               "MiSans", "Source Han Sans SC", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
body { overflow: hidden; }

#app {
  position: relative;
  max-width: 560px; margin: 0 auto;
  height: 100%;
  background: var(--bg);
  display: flex; flex-direction: column;
  overflow: hidden;
}

/* ---- 页面背景图 ----
   用两个伪元素做：一层是图，一层是白纱。
   为什么不用 background-attachment: fixed —— 安卓上它会掉帧、还会错位。
   伪元素固定在 #app 里（#app 本身就是整屏高、overflow:hidden），
   内容在它上面自己滚，效果一样而且不卡。 */
#app::before,
#app::after {
  content: '';
  position: absolute; inset: 0;
  z-index: 0; pointer-events: none;
}
#app::before {
  background: var(--bg-img) center top / cover no-repeat;
}
#app::after {
  background: rgba(249, 249, 246, var(--veil));
}
/* 所有内容都压在白纱之上 */
#app > * { position: relative; z-index: 1; }

/* 图标统一垂直居中 */
.ic { flex: none; vertical-align: middle; display: inline-block; }

/* ---------------- 工具类 ---------------- */
.row { display: flex; align-items: center; }
.between { justify-content: space-between; }
.grow { flex: 1; min-width: 0; }
.spacer { flex: 1; }
.ml12 { margin-left: 12px; }
.mt4 { margin-top: 4px; }
.mt6 { margin-top: 6px; }
.mt12 { margin-top: 12px; }
.p16 { padding: 16px; }
.pt0 { padding-top: 0; }
.mx16 { margin-left: 16px; margin-right: 16px; }
.tiny { font-size: 11.5px; }
.small { font-size: 12.5px; }
.s15 { font-size: 15px; }
.s18 { font-size: 18px; }
.bold { font-weight: 650; }
.muted { color: var(--ink3); }

/* ============================================================
 * 启动 / 提示条 / 弹提示
 * ============================================================ */
.boot {
  height: 100%; display: flex; align-items: center; justify-content: center;
  color: var(--ink3); font-size: 13px;
}
.tip {
  background: var(--green-l); color: var(--green-d);
  font-size: 11px; padding: 7px 14px; text-align: center; line-height: 1.6;
}
.tip.err { background: var(--warn-l); color: var(--warn); font-weight: 600; }

#toast {
  position: fixed; left: 50%; bottom: calc(var(--tabbar-h) + 26px);
  transform: translate(-50%, 14px);
  max-width: 88vw; padding: 10px 18px; border-radius: 10px;
  background: rgba(24,33,29,.93); color: #fff; font-size: 13px;
  opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s;
  z-index: 99; text-align: center;
}
#toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ============================================================
 * 登录
 * ============================================================ */
.login { height: 100%; display: flex; flex-direction: column; overflow-y: auto; }
.login-art { height: 38vh; min-height: 190px; position: relative; overflow: hidden; flex: none; }
.login-art svg { width: 100%; height: 100%; display: block; }

.login-card {
  flex: 1; margin-top: -26px; position: relative;
  background: var(--card);
  border-radius: 22px 22px 0 0;
  padding: 26px 22px 28px;
}
.login-mark {
  width: 44px; height: 44px; border-radius: 14px;
  background: var(--green); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px; font-weight: 600;
}
.login-title { margin: 14px 0 0; font-size: 26px; font-weight: 700; letter-spacing: -.02em; }
.login-sub { margin: 5px 0 22px; color: var(--ink3); font-size: 12.5px; }

.fld { display: block; margin-bottom: 14px; }
.fld-lbl { display: block; font-size: 12px; color: var(--ink2); font-weight: 600; margin-bottom: 6px; }
.fld input {
  width: 100%; height: 46px; padding: 0 14px;
  border: 1.5px solid var(--line); border-radius: var(--r-ctl);
  background: var(--bg); color: var(--ink); font-size: 15px; font-family: inherit;
  outline: none; transition: border-color .15s, background .15s;
}
.fld input::placeholder { color: #a9b2ac; }
.fld input:focus { border-color: var(--green); background: var(--card); }

.login-err {
  background: var(--warn-l); color: var(--warn); font-size: 12.5px;
  padding: 10px 13px; border-radius: var(--r-tag); margin-bottom: 12px;
}
.login-hint { text-align: center; color: var(--ink3); font-size: 11.5px; margin: 14px 0 0; }

/* ============================================================
 * 菜单页
 * ============================================================ */
.page-kitchen { flex: 1; display: flex; flex-direction: column; min-height: 0; }

.hero { position: relative; height: var(--hero-h); flex: none; overflow: hidden; background: #3a271a; }
.hero > svg, .hero > img { width: 100%; height: 100%; display: block; object-fit: cover; }
.hero-text {
  position: absolute; left: 18px; right: 18px; bottom: 15px; color: #fff;
  text-shadow: 0 1px 10px rgba(0,0,0,.45);
}
.hero-name { margin: 0; font-size: 27px; font-weight: 700; letter-spacing: -.01em; line-height: 1.15; }
.hero-sub { font-size: 11.5px; opacity: .85; margin-top: 4px; }

.actions {
  display: flex; align-items: center; gap: 7px;
  padding: 9px 14px 9px 16px; flex: none;
  background: var(--card); border-bottom: 1px solid var(--line);
}
/* 访客看到的「只读分享」小标签 */
.ro-tag {
  font-size: 10.5px; font-weight: 650; color: var(--green-d);
  background: var(--green-l); border-radius: 6px; padding: 3px 8px;
  white-space: nowrap;
}
.tab-live {
  font-size: 15px; font-weight: 700; color: var(--green);
  position: relative; padding-bottom: 3px;
}
.tab-live::after {
  content: ''; position: absolute; left: 0; right: 0; bottom: -4px;
  height: 2px; border-radius: 2px; background: var(--green);
}

.body { flex: 1; display: flex; min-height: 0; }

.rail {
  flex: none; width: var(--rail-w);
  /* 半透明：让背景图也透过来一点，但不能太透，否则分类名看不清 */
  background: rgba(247, 249, 247, .62);
  border-right: 1px solid var(--line);
  overflow-y: auto; -webkit-overflow-scrolling: touch;
}
.rail-item {
  min-height: 54px; display: flex; align-items: center; gap: 6px;
  padding: 0 8px 0 11px; font-size: 12px; color: var(--ink2);
  cursor: pointer; position: relative;
}
.rail-item .ic { color: var(--ink3); }
.rail-name { line-height: 1.25; }
.rail-item.on { background: var(--green-l); color: var(--green-d); font-weight: 700; }
.rail-item.on .ic { color: var(--green); }
.rail-item.on::before {
  content: ''; position: absolute; left: 0; top: 12px; bottom: 12px;
  width: 3px; border-radius: 0 2px 2px 0; background: var(--green);
}

/* min-width:0 必须有 —— 否则 flex 子项不肯收缩，菜名会被挤成竖排 */
.list { flex: 1; min-width: 0; overflow-y: auto; -webkit-overflow-scrolling: touch; padding-bottom: 24px; }

.cat-head {
  display: flex; align-items: center; gap: 6px;
  padding: 15px 12px 8px; font-size: 13.5px; font-weight: 700;
  color: var(--ink2);
}
.cat-head .ic { color: var(--green); }

/* 一行 = 图 + 菜名。就这些，没有价格、没有按钮。 */
.dish {
  display: flex; align-items: center; gap: 12px;
  padding: 5px 12px 5px 8px; cursor: pointer;
}
.dish:active { background: #f2f4f1; }
.dish-art {
  width: 104px; height: 104px; flex: none;
  border-radius: 11px; background: #eef0ec; overflow: hidden;
}
.dish-art svg, .dish-art img { width: 100%; height: 100%; object-fit: cover; display: block; }
.dish-mid { flex: 1; min-width: 0; }
.dish-name { font-size: 16px; font-weight: 650; line-height: 1.35; }

/* 底部两个标签 */
.tabbar {
  flex: none; height: var(--tabbar-h);
  display: flex; background: var(--card); border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}
.tabbar button {
  flex: 1; border: 0; background: none; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  color: var(--ink3); font-size: 11px; font-family: inherit;
}
.tabbar button.on { color: var(--green); font-weight: 650; }
.tabbar button:active { transform: scale(.96); }

/* ============================================================
 * 通用页面
 * ============================================================ */
.page { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; display: flex; flex-direction: column; }
.pad { padding: 16px; }

.card {
  background: var(--card); border-radius: var(--r-card);
  border: 1px solid var(--line); overflow: hidden;
}
.group-label { font-size: 11.5px; color: var(--ink3); font-weight: 600; margin: 20px 4px 8px; }
.empty { text-align: center; color: var(--ink3); font-size: 12.5px; padding: 28px 16px; line-height: 1.8; }

.nav {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 16px; border-bottom: 1px solid var(--line); background: var(--card);
}
.nav-title { text-align: center; font-weight: 650; font-size: 15px; }

/* ============================================================
 * 按钮 / 标签 / 输入
 * ============================================================ */
.btn {
  border: 0; cursor: pointer; font-family: inherit;
  display: inline-flex; align-items: center; justify-content: center; gap: 4px;
  height: 32px; padding: 0 13px; border-radius: var(--r-ctl);
  font-size: 12.5px; font-weight: 600; white-space: nowrap;
  transition: transform .08s, background .15s;
}
.btn:active { transform: scale(.97); }
.btn-fill { background: var(--green); color: #fff; }
.btn-fill:active { background: var(--green-d); }
.btn-line { background: transparent; color: var(--green); border: 1.5px solid var(--green); }
.btn-ghost { background: #eef1ee; color: var(--ink2); }
.btn-warn { background: var(--warn); color: #fff; }
.btn-warn:active { background: #9a332c; }

.btn-primary {
  border: 0; cursor: pointer; font-family: inherit;
  height: 48px; padding: 0 22px; border-radius: var(--r-ctl);
  background: var(--green); color: #fff; font-size: 15px; font-weight: 650;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
}
.btn-primary:active { transform: scale(.98); background: var(--green-d); }
.btn-primary:disabled { background: #9db3a8; }
.btn-primary.wide { width: 100%; }

/* 返回键（菜品大图页） */
.round-btn {
  width: 38px; height: 38px; border-radius: 50%; border: 1.5px solid var(--line);
  background: var(--card); color: var(--ink2); cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
}
.round-btn:active { transform: scale(.94); }
.round-btn.dark {
  position: absolute; top: 14px; left: 14px; border: 0;
  background: rgba(18,24,21,.5); color: #fff;
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
}

.chip {
  height: 30px; padding: 0 11px; border-radius: var(--r-tag);
  border: 1.5px solid var(--line); background: var(--card); color: var(--ink2);
  font-size: 12px; font-weight: 500; font-family: inherit; cursor: pointer;
  display: inline-flex; align-items: center; gap: 4px;
}
.chip:active { transform: scale(.97); }
.chip.on { background: var(--green-l); border-color: var(--green); color: var(--green-d); font-weight: 650; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }

.field { padding: 14px 16px; border-bottom: 1px solid var(--line); }
.field:last-child { border-bottom: 0; }
.lbl { font-size: 12px; color: var(--ink2); font-weight: 600; margin-bottom: 6px; }
.field input {
  width: 100%; border: 0; outline: none; background: none;
  color: var(--ink); font-size: 15px; font-family: inherit; padding: 0;
}
.field input::placeholder { color: #a9b2ac; }

/* 底部固定操作条 */
.bottombar {
  flex: none; display: flex; align-items: center; gap: 10px;
  padding: 10px 16px calc(10px + env(safe-area-inset-bottom));
  background: var(--card); border-top: 1px solid var(--line);
}
.bottombar .btn-primary.grow { flex: 1; }

/* ============================================================
 * 菜品大图页
 * ============================================================ */
.hero-dish { position: relative; height: 52vh; min-height: 260px; max-height: 440px; background: #eef0ec; }
.hero-dish svg, .hero-dish img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* 多张照片：横向滑动，一次一张（scroll-snap 会自动吸附对齐） */
.shots {
  display: flex; height: 100%;
  overflow-x: auto; overflow-y: hidden;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.shots::-webkit-scrollbar { display: none; }
.shot { flex: 0 0 100%; scroll-snap-align: start; }
.shot svg, .shot img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* 下面那排小圆点 */
.dots {
  position: absolute; left: 0; right: 0; bottom: 14px;
  display: flex; justify-content: center; gap: 6px;
  pointer-events: none;
}
.dots i {
  width: 6px; height: 6px; border-radius: 50%;
  background: rgba(255,255,255,.45);
  box-shadow: 0 0 3px rgba(0,0,0,.35);
  transition: width .18s, background .18s;
}
.dots i.on { width: 18px; border-radius: 3px; background: #fff; }

.d-title { font-size: 24px; font-weight: 700; letter-spacing: -.02em; }

/* ============================================================
 * 我的
 * ============================================================ */
.ava-lg {
  width: 58px; height: 58px; border-radius: 18px; flex: none;
  background: var(--green); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 24px; font-weight: 600;
}
.ava-img { overflow: hidden; padding: 0; }
.ava-img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.role-pill {
  display: inline-block; margin-top: 9px; padding: 3px 9px;
  background: var(--green-l); color: var(--green-d);
  border-radius: 6px; font-size: 10.5px; font-weight: 650;
}

.stats { display: flex; }
.stat { flex: 1; text-align: center; padding: 15px 0; }
.stat + .stat { border-left: 1px solid var(--line); }
.stat-v { font-size: 21px; font-weight: 700; letter-spacing: -.02em; }

.setting {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 16px; border-bottom: 1px solid var(--line);
  font-size: 14px; cursor: pointer;
}
.setting:last-child { border-bottom: 0; }
.setting:active { background: #f5f7f5; }
.set-ic { color: var(--ink3); display: flex; }
.go { color: var(--ink3); display: flex; }
.foot-note {
  text-align: center; color: var(--ink3); font-size: 11px;
  padding: 22px 0 30px; line-height: 1.7;
}

/* 管理页的一行 */
.mg-row {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 0; border-bottom: 1px solid var(--line);
}
.mg-row:last-child { border-bottom: 0; }
.cart-art { width: 60px; height: 60px; flex: none; border-radius: 10px; overflow: hidden; background: #eef0ec; }
.cart-art svg, .cart-art img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* ============================================================
 * 添加菜谱（上传）
 * ============================================================ */
.up-row { display: flex; gap: 10px; margin-top: 12px; flex-wrap: wrap; align-items: flex-start; }
.thumb {
  position: relative; width: 88px; height: 88px;
  border-radius: 11px; overflow: hidden; background: #eef0ec; flex: none;
}
.thumb img, .thumb-ph { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb-ph { display: flex; align-items: center; justify-content: center; color: var(--ink3); font-size: 11px; }
.thumb-tag {
  position: absolute; left: 0; bottom: 0; right: 0;
  background: rgba(18,24,21,.62); color: #fff;
  font-size: 10px; text-align: center; padding: 2px 0;
}
.thumb-del {
  position: absolute; top: 4px; right: 4px;
  width: 20px; height: 20px; border-radius: 50%; border: 0;
  background: rgba(18,24,21,.62); color: #fff; font-size: 14px; line-height: 1;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
}
.up-tile {
  width: 88px; height: 88px; flex: none;
  border: 1.5px dashed #cdd4cf; border-radius: 11px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  color: var(--ink3); cursor: pointer; background: var(--card);
}
.up-tile:active { border-color: var(--green); color: var(--green); }
.up-tile .cap { font-size: 10.5px; }
.up-hint {
  flex: 1 1 140px; min-width: 120px; height: 88px;
  font-size: 11px; color: var(--ink3); line-height: 1.6;
  display: flex; align-items: center;
}

/* ============================================================
 * 窄屏适配（≤375px 的小屏安卓）
 * ============================================================ */
@media (max-width: 375px) {
  :root { --rail-w: 74px; --hero-h: 162px; }
  .rail-item { font-size: 11.5px; min-height: 52px; padding-left: 9px; }
  .dish-art { width: 88px; height: 88px; }
  .dish-name { font-size: 15px; }
  .hero-name { font-size: 24px; }
}
