/* ============================================================
   食韵 SHIYUN · 全站样式表
   设计语言：Kitchen Stories 式留白与卡片质感
             × 中式朱砂 / 琥珀 / 青瓷配色，楷体点题
   ============================================================ */

/* ---------------- 设计变量 ---------------- */
:root {
  /* 色彩 */
  --white: #FFFFFF;
  --bg-block: #F4F4F4;      /* 区块底 */
  --bg-warm: #F8F6F3;       /* 暖白 */
  --bg-footer: #FFF5EA;     /* Footer 奶油 */
  --zhusha: #C41E3A;        /* 朱砂（品牌） */
  --zhusha-dark: #8B0000;   /* 深红（hover） */
  --amber: #D4A847;         /* 琥珀金（评分/链接） */
  --amber-dark: #B8912F;
  --qingci: #6B9E8C;        /* 青瓷（菜系） */
  --zhuye: #5B8A5B;         /* 竹叶（时令/简单） */
  --ink: #212121;           /* 主文字 */
  --ink-2: #505050;         /* 次文字 */
  --line: #ECECEC;
  /* 字体 */
  --font-display: 'LXGW WenKai', 'KaiTi', 'STKaiti', 'SimKai', serif;
  --font-body: system-ui, -apple-system, 'PingFang SC', 'Microsoft YaHei', sans-serif;
  /* 圆角 */
  --radius-card: 16px;
  --radius-lg: 24px;
  /* 动效 */
  --ease: cubic-bezier(.4, 0, .2, 1);
  --dur: .3s;
  /* 阴影 */
  --shadow-sm: 0 2px 10px rgba(33, 33, 33, .05);
  --shadow-md: 0 10px 32px rgba(33, 33, 33, .10);
  --shadow-red: 0 6px 18px rgba(196, 30, 58, .22);
}

/* ---------------- Reset 与基础 ---------------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-body);
  font-size: 14px;
  line-height: 1.65;
  color: var(--ink);
  background: var(--white);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
ul, ol { list-style: none; }
button { font: inherit; color: inherit; background: none; border: none; cursor: pointer; }
input, textarea, select { font: inherit; color: inherit; }

::selection { background: var(--zhusha); color: #fff; }

/* 滚动条 */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #d9d7d3; border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: #bdbab5; }

.hidden { display: none !important; }

/* ---------------- 布局容器 ---------------- */
.container {
  width: 100%;
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 16px;
}

/* 通用页面留白区（视图可直接使用） */
.page-section { padding: 36px 0 80px; }
.page-head { margin-bottom: 28px; }
.page-head .section-title { margin-bottom: 6px; }

/* ---------------- 通用按钮 ---------------- */
.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: var(--zhusha);
  color: #fff;
  border: none;
  border-radius: 16px;
  padding: 12px 32px;
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 2px;
  line-height: 1.4;
  white-space: nowrap;
  cursor: pointer;
  box-shadow: var(--shadow-red);
  transition: background var(--dur) var(--ease),
              transform var(--dur) var(--ease),
              box-shadow var(--dur) var(--ease);
}
.btn-primary:hover {
  background: var(--zhusha-dark);
  transform: translateY(-2px);
  box-shadow: 0 10px 24px rgba(139, 0, 0, .32);
}
.btn-primary:active { transform: translateY(0); }
.btn-primary:disabled { opacity: .55; cursor: not-allowed; transform: none; }
.btn-primary svg { width: 18px; height: 18px; }

.btn-ghost {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: transparent;
  color: var(--amber);
  border: 1.5px solid var(--amber);
  border-radius: 16px;
  padding: 12px 32px;
  font-size: 15px;
  font-weight: 500;
  letter-spacing: 1px;
  white-space: nowrap;
  cursor: pointer;
  transition: background var(--dur) var(--ease),
              color var(--dur) var(--ease),
              border-color var(--dur) var(--ease);
}
.btn-ghost:hover {
  background: rgba(212, 168, 71, .10);
  border-color: var(--amber-dark);
  color: var(--amber-dark);
}

/* ---------------- 通用小组件 ---------------- */
.tag-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 14px;
  border-radius: 999px;
  background: #fff;
  border: 1px solid var(--line);
  color: var(--ink-2);
  font-size: 13px;
  line-height: 1.5;
  white-space: nowrap;
  transition: color var(--dur) var(--ease),
              border-color var(--dur) var(--ease),
              background var(--dur) var(--ease);
}
.tag-pill:hover { color: var(--zhusha); border-color: rgba(196, 30, 58, .35); }

.section-title {
  font-family: var(--font-display);
  font-size: clamp(24px, 3vw, 32px);
  font-weight: 700;
  color: var(--ink);
  line-height: 1.35;
  letter-spacing: 2px;
}

.section-sub {
  font-size: 14px;
  color: var(--ink-2);
  letter-spacing: .5px;
}

/* 区块标题行：左标题 + 右链接 */
.section-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
}
.section-head .section-sub { margin-top: 4px; }

.link-more {
  flex-shrink: 0;
  font-size: 14px;
  letter-spacing: 1px;
  white-space: nowrap;
}

.empty-state {
  text-align: center;
  padding: 64px 16px;
  color: var(--ink-2);
  font-size: 14px;
  letter-spacing: 1px;
}

/* ---------------- 顶部导航 ---------------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(255, 255, 255, .92);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(33, 33, 33, .07);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  height: 64px;
}

.header-left { display: flex; align-items: center; gap: 44px; min-width: 0; }

.logo { display: inline-flex; align-items: center; gap: 10px; flex-shrink: 0; }
.logo-seal {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: var(--zhusha);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 700;
  box-shadow: 0 2px 8px rgba(196, 30, 58, .35);
}
.logo-text {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 700;
  color: var(--zhusha);
  letter-spacing: 6px;
}

.nav-desktop { display: flex; align-items: center; gap: 30px; }
.nav-desktop a {
  position: relative;
  font-size: 14px;
  color: var(--ink-2);
  letter-spacing: 1px;
  padding: 6px 0;
  transition: color var(--dur) var(--ease);
}
.nav-desktop a:hover { color: var(--zhusha); }
.nav-desktop a.active { color: var(--zhusha); font-weight: 600; }
.nav-desktop a.active::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: -4px;
  height: 2px;
  border-radius: 2px;
  background: var(--zhusha);
}
.nav-desktop a.nav-import { color: var(--zhusha); font-weight: 500; }
.nav-desktop a.nav-import:hover { color: var(--zhusha-dark); }

.header-right { display: flex; align-items: center; gap: 18px; flex-shrink: 0; }

.user-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 14px;
  color: var(--ink);
}
.user-chip svg { width: 16px; height: 16px; color: var(--ink-2); }
.user-chip .user-name {
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.btn-logout {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 13px;
  color: var(--ink-2);
  padding: 6px 14px;
  border-radius: 999px;
  border: 1px solid var(--line);
  transition: color var(--dur) var(--ease),
              border-color var(--dur) var(--ease);
}
.btn-logout svg { width: 14px; height: 14px; }
.btn-logout:hover { color: var(--zhusha); border-color: rgba(196, 30, 58, .4); }

.login-link { font-size: 14px; color: var(--ink-2); letter-spacing: 1px; transition: color var(--dur) var(--ease); }
.login-link:hover { color: var(--zhusha); }

/* ---------------- 主内容与视图切换 ---------------- */
main { min-height: 62vh; }
main > section { display: none; }
main > section.active { display: block; animation: viewIn .45s var(--ease); }

@keyframes viewIn {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: none; }
}

/* ---------------- 页脚 ---------------- */
.site-footer {
  position: relative;
  margin-top: 88px;
  background: var(--bg-footer);
}
.site-footer::before {
  content: '';
  display: block;
  height: 3px;
  background: linear-gradient(90deg,
    var(--zhusha) 0%,
    var(--amber) 50%,
    var(--qingci) 100%);
}

.footer-grid {
  display: grid;
  grid-template-columns: 1.5fr 1fr 1.2fr;
  gap: 48px;
  padding: 56px 16px 44px;
}

.footer-logo {
  font-family: var(--font-display);
  font-size: 30px;
  font-weight: 700;
  color: var(--zhusha);
  letter-spacing: 10px;
}
.footer-slogan {
  margin-top: 12px;
  font-size: 13px;
  color: var(--ink-2);
  letter-spacing: 2px;
}

.footer-col h4 {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: 3px;
  margin-bottom: 16px;
}
.footer-col a {
  display: block;
  font-size: 13px;
  color: var(--ink-2);
  margin-bottom: 11px;
  letter-spacing: 1px;
  transition: color var(--dur) var(--ease);
}
.footer-col a:hover { color: var(--zhusha); }
.footer-col p {
  font-size: 13px;
  color: var(--ink-2);
  margin-bottom: 9px;
  letter-spacing: 1px;
  line-height: 1.8;
}

.footer-bottom { border-top: 1px solid rgba(196, 30, 58, .10); padding: 18px 0; }
.footer-bottom .container {
  text-align: center;
  font-size: 12px;
  color: #a49a8c;
  letter-spacing: 1.5px;
}

/* ---------------- 移动端底部 Tab ---------------- */
.mobile-nav {
  display: none;
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 100;
  background: rgba(255, 255, 255, .96);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  border-top: 1px solid rgba(33, 33, 33, .07);
  box-shadow: 0 -4px 20px rgba(33, 33, 33, .05);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
.mobile-nav a {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  height: 60px;
  font-size: 11px;
  letter-spacing: 1px;
  color: var(--ink-2);
  transition: color var(--dur) var(--ease);
}
.mobile-nav a svg { width: 22px; height: 22px; }
.mobile-nav a.active { color: var(--zhusha); font-weight: 600; }

/* ============================================================
   首页 · Hero
   ============================================================ */
.hero { padding: 60px 0 72px; }

.hero-inner {
  display: flex;
  flex-direction: column-reverse;  /* 移动端：图上文下 */
  align-items: center;
  gap: 40px;
}
.hero-text { flex: 1.05; min-width: 0; }
.hero-media { flex: 1; width: 100%; min-width: 0; }

.hero-kicker {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 13px;
  color: var(--zhusha);
  letter-spacing: 5px;
  margin-bottom: 18px;
}
.hero-kicker::before {
  content: '';
  width: 30px;
  height: 1.5px;
  background: var(--zhusha);
}

.hero-title {
  font-family: var(--font-display);
  font-size: clamp(40px, 6vw, 56px);
  font-weight: 700;
  line-height: 1.18;
  letter-spacing: 4px;
  color: var(--ink);
}
.hero-title .hero-accent {
  font-style: normal;
  color: var(--zhusha);
  padding: 0 4px;
}

.hero-sub {
  margin: 20px 0 38px;
  font-size: 16px;
  color: var(--ink-2);
  letter-spacing: 1.5px;
}

/* Hero 大图卡 */
.hero-card {
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--bg-warm);
  box-shadow: 0 24px 48px -14px rgba(196, 30, 58, .22);
  transition: transform .4s var(--ease), box-shadow .4s var(--ease);
}
.hero-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 32px 60px -14px rgba(196, 30, 58, .28);
}
.hero-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform .6s var(--ease);
}
.hero-card:hover img { transform: scale(1.05); }

.hero-card-fallback {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--bg-warm), #EDEBE7);
}
.hero-card-fallback span {
  font-family: var(--font-display);
  font-size: 88px;
  font-weight: 700;
  color: rgba(196, 30, 58, .30);
}

.hero-card-overlay {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 56px 26px 26px;
  background: linear-gradient(to top, rgba(0, 0, 0, .66) 0%, rgba(0, 0, 0, .30) 55%, transparent 100%);
}
.hero-card-tag {
  display: inline-block;
  font-size: 12px;
  color: #fff;
  letter-spacing: 4px;
  border: 1px solid rgba(255, 255, 255, .65);
  border-radius: 999px;
  padding: 3px 12px;
  margin-bottom: 10px;
}
.hero-card-name {
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 700;
  color: #fff;
  letter-spacing: 3px;
}
.hero-card-meta {
  margin-top: 6px;
  font-size: 13px;
  color: rgba(255, 255, 255, .88);
  letter-spacing: 1px;
}
.hero-card-placeholder { pointer-events: none; }

/* ============================================================
   首页 · 当季鲜味（全宽灰底区块）
   ============================================================ */
.section-block {
  background: var(--bg-block);
  padding: 56px 0 64px;
}

.seasonal-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.seasonal-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 22px;
  border-radius: 999px;
  background: #fff;
  border: 1px solid rgba(33, 33, 33, .06);
  font-size: 14px;
  color: var(--ink);
  letter-spacing: 1px;
  white-space: nowrap;
  box-shadow: 0 1px 4px rgba(33, 33, 33, .04);
  transition: all var(--dur) var(--ease);
}
.seasonal-pill:hover {
  color: var(--zhusha);
  border-color: rgba(196, 30, 58, .4);
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(196, 30, 58, .10);
}

/* ============================================================
   菜品卡片（首页 / 列表 / 搜索结果通用）
   ============================================================ */
.home-recipes { padding: 56px 0 16px; }

.recipe-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 24px;
}

.recipe-card {
  display: block;
  background: #fff;
  border-radius: var(--radius-card);
  padding: 8px 8px 16px;
  box-shadow: var(--shadow-sm);
  transition: transform var(--dur) var(--ease),
              box-shadow var(--dur) var(--ease);
}
.recipe-card:hover {
  transform: translateY(-5px);
  box-shadow: var(--shadow-md);
}

.recipe-card-img {
  position: relative;
  aspect-ratio: 4 / 3;
  border-radius: var(--radius-card);
  overflow: hidden;
  background: linear-gradient(135deg, var(--bg-warm), #EEEEEE);
}
.recipe-card-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform .5s var(--ease);
}
.recipe-card:hover .recipe-card-img img { transform: scale(1.05); }

/* 无图占位：渐变底 + 菜名首字 */
.recipe-card-fallback {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-size: 48px;
  font-weight: 700;
  color: rgba(196, 30, 58, .30);
  background: linear-gradient(135deg, #F8F6F3, #EEEEEE);
}

/* 图片左下：烹饪时间药丸 */
.time-pill {
  position: absolute;
  left: 12px;
  bottom: 12px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 11px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .92);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
  font-size: 12px;
  font-weight: 500;
  color: var(--ink);
  white-space: nowrap;
}
.time-pill svg { width: 12px; height: 12px; color: var(--ink-2); }

/* 图片右上：评分药丸（琥珀星） */
.score-pill {
  position: absolute;
  top: 12px;
  right: 12px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 11px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .92);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
  font-size: 12px;
  font-weight: 600;
  color: var(--ink);
  white-space: nowrap;
}
.score-pill svg { width: 12px; height: 12px; fill: var(--amber); color: var(--amber); }

/* 图片右上：食材匹配药丸（朱砂底白字） */
.match-pill {
  position: absolute;
  top: 12px;
  right: 12px;
  display: inline-flex;
  align-items: center;
  padding: 4px 11px;
  border-radius: 999px;
  background: var(--zhusha);
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .5px;
  white-space: nowrap;
  box-shadow: 0 2px 10px rgba(196, 30, 58, .35);
}

.recipe-card-name {
  margin-top: 13px;
  padding: 0 8px;
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: 1px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: color var(--dur) var(--ease);
}
.recipe-card:hover .recipe-card-name { color: var(--zhusha); }

.recipe-card-meta {
  margin-top: 4px;
  padding: 0 8px;
  font-size: 13px;
  color: var(--ink-2);
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 20px;
}
.meta-cuisine { color: var(--qingci); }
.meta-dot { color: rgba(80, 80, 80, .4); }
.meta-diff { color: var(--ink-2); }
.meta-diff.easy { color: var(--zhuye); }
.meta-diff.medium { color: var(--amber); }
.meta-diff.hard { color: var(--zhusha); }

/* ---------------- 骨架屏 ---------------- */
@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}
.skeleton, .skeleton-line {
  background: linear-gradient(100deg, #F1EFEC 40%, #FAF8F5 50%, #F1EFEC 60%);
  background-size: 200% 100%;
  animation: shimmer 1.4s linear infinite;
}
.recipe-card-skeleton { pointer-events: none; box-shadow: none; border: 1px solid rgba(33,33,33,.04); }
.skeleton-line { height: 15px; border-radius: 8px; margin: 14px 8px 0; }
.skeleton-line + .skeleton-line { margin-top: 9px; margin-bottom: 8px; }
.ing-item-skeleton { pointer-events: none; border: none; height: 50px; }

/* ============================================================
   食材选择页
   ============================================================ */
.ing-page { padding: 36px 0 120px; }

.ing-search { margin-bottom: 20px; }

/* 搜索框：全宽圆角 + 左内嵌放大镜 */
.search-box {
  position: relative;
  width: 100%;
}
.search-box svg {
  position: absolute;
  left: 18px;
  top: 50%;
  transform: translateY(-50%);
  width: 18px;
  height: 18px;
  color: #9a9a9a;
  pointer-events: none;
}
.search-box input,
input.search-box {
  width: 100%;
  border: none;
  outline: none;
  background: var(--bg-block);
  border-radius: 16px;
  padding: 15px 18px 15px 50px;
  font-size: 14px;
  color: var(--ink);
  letter-spacing: 1px;
  transition: background var(--dur) var(--ease),
              box-shadow var(--dur) var(--ease);
}
.search-box input::placeholder { color: #a5a5a5; }
.search-box input:focus,
input.search-box:focus {
  background: #fff;
  box-shadow: 0 0 0 2px rgba(196, 30, 58, .35);
}

/* 分类标签行：横向滚动 */
.cat-tabs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 6px;
  margin-bottom: 24px;
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.cat-tabs::-webkit-scrollbar { display: none; }

.cat-tab {
  flex-shrink: 0;
  padding: 9px 20px;
  border-radius: 999px;
  background: #fff;
  border: 1px solid #E8E8E8;
  color: var(--ink-2);
  font-size: 13.5px;
  letter-spacing: 1px;
  white-space: nowrap;
  transition: all var(--dur) var(--ease);
}
.cat-tab:hover {
  color: var(--zhusha);
  border-color: rgba(196, 30, 58, .45);
}
.cat-tab.active {
  background: var(--zhusha);
  border-color: var(--zhusha);
  color: #fff;
  font-weight: 600;
  box-shadow: 0 4px 12px rgba(196, 30, 58, .25);
}

/* 食材网格：2 / 3 / 4 / 6 列响应式 */
.ing-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}
@media (min-width: 480px) {
  .ing-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (min-width: 768px) {
  .ing-grid { grid-template-columns: repeat(4, 1fr); }
}
@media (min-width: 1100px) {
  .ing-grid { grid-template-columns: repeat(6, 1fr); }
}
.ing-grid .empty-state { grid-column: 1 / -1; }

.ing-item {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 50px;
  padding: 13px 10px;
  background: #fff;
  border: 1.5px solid #ECECEC;
  border-radius: 12px;
  font-size: 14px;
  color: var(--ink);
  letter-spacing: 1px;
  text-align: center;
  transition: all .25s var(--ease);
}
.ing-item:hover {
  border-color: rgba(196, 30, 58, .45);
  transform: translateY(-1px);
}
.ing-item.selected {
  background: rgba(196, 30, 58, .05);
  border-color: var(--zhusha);
  color: var(--zhusha);
  font-weight: 600;
  box-shadow: 0 2px 10px rgba(196, 30, 58, .10);
}
.ing-item .ing-seasonal { font-size: 13px; line-height: 1; }

/* 底部浮动操作条 */
@keyframes floatUp {
  from { transform: translateY(26px); opacity: 0; }
  to   { transform: none; opacity: 1; }
}
.float-bar {
  position: fixed;
  left: 16px;
  right: 16px;
  bottom: 28px;
  z-index: 90;
  max-width: 760px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 14px;
  background: #fff;
  border: 1px solid rgba(33, 33, 33, .05);
  border-radius: var(--radius-card);
  box-shadow: 0 -6px 32px rgba(33, 33, 33, .16);
  padding: 13px 16px;
  animation: floatUp .35s var(--ease);
}

.float-bar-tags {
  flex: 1;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  max-height: 74px;
  overflow-y: auto;
  scrollbar-width: thin;
}

.float-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 7px 5px 13px;
  border-radius: 999px;
  background: rgba(196, 30, 58, .06);
  border: 1px solid rgba(196, 30, 58, .28);
  color: var(--zhusha);
  font-size: 13px;
  letter-spacing: .5px;
  white-space: nowrap;
}
.float-tag button {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: rgba(196, 30, 58, .12);
  color: var(--zhusha);
  font-size: 11px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background var(--dur) var(--ease);
}
.float-tag button:hover { background: var(--zhusha); color: #fff; }

.float-bar-btn {
  flex-shrink: 0;
  padding: 11px 26px;
  font-size: 14px;
  letter-spacing: 1.5px;
}

/* ============================================================
   榜单页
   ============================================================ */
.rank-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.rank-item {
  display: flex;
  align-items: center;
  gap: 16px;
  background: #fff;
  border-radius: var(--radius-card);
  padding: 14px 20px;
  box-shadow: var(--shadow-sm);
  transition: transform var(--dur) var(--ease),
              box-shadow var(--dur) var(--ease);
}
.rank-item:hover {
  transform: translateX(5px);
  box-shadow: 0 8px 26px rgba(33, 33, 33, .10);
}

.rank-badge {
  width: 40px;
  height: 40px;
  flex-shrink: 0;
  border-radius: 50%;
  background: var(--ink-2);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 700;
}
.rank-badge.gold   { background: linear-gradient(135deg, #E4C068, var(--amber));  box-shadow: 0 3px 10px rgba(212, 168, 71, .45); }
.rank-badge.silver { background: linear-gradient(135deg, #D9DDE1, #C0C4CC);       box-shadow: 0 3px 10px rgba(192, 196, 204, .5); }
.rank-badge.bronze { background: linear-gradient(135deg, #DA9A5E, #CD7F32);       box-shadow: 0 3px 10px rgba(205, 127, 50, .45); }

.rank-thumb {
  position: relative; /* 建立 fallback（absolute inset:0）的定位上下文，避免铺满整页遮挡 tabs */
  width: 64px;
  height: 64px;
  flex-shrink: 0;
  border-radius: 12px;
  overflow: hidden;
  background: linear-gradient(135deg, var(--bg-warm), #EEEEEE);
  display: flex;
  align-items: center;
  justify-content: center;
}
.rank-thumb img { width: 100%; height: 100%; object-fit: cover; }
.rank-thumb .rank-thumb-char {
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 700;
  color: rgba(196, 30, 58, .30);
}

.rank-info { flex: 1; min-width: 0; }
.rank-name {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: 1px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.rank-item:hover .rank-name { color: var(--zhusha); }
.rank-meta {
  margin-top: 3px;
  font-size: 12.5px;
  color: var(--ink-2);
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  overflow: hidden;
}

.rank-score {
  flex-shrink: 0;
  display: inline-flex;
  align-items: baseline;
  gap: 4px;
  font-family: var(--font-display);
  font-size: 21px;
  font-weight: 700;
  color: var(--amber);
}
.rank-score svg { width: 14px; height: 14px; fill: var(--amber); align-self: center; }

/* ============================================================
   登录 / 表单
   ============================================================ */
.form-page { padding: 52px 16px 88px; }

.form-card {
  width: 100%;
  max-width: 400px;
  margin: 0 auto;
  background: #fff;
  border-radius: var(--radius-lg);
  box-shadow: 0 10px 44px rgba(33, 33, 33, .09);
  padding: 40px 32px;
}

.form-title {
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: 3px;
  text-align: center;
  margin-bottom: 6px;
}
.form-sub {
  font-size: 13px;
  color: var(--ink-2);
  text-align: center;
  letter-spacing: 1px;
  margin-bottom: 28px;
}

.form-label {
  display: block;
  font-size: 14px;
  color: var(--ink-2);
  letter-spacing: 1px;
  margin-bottom: 8px;
}

.form-input {
  width: 100%;
  border: 1.5px solid #E5E5E5;
  border-radius: var(--radius-card);
  padding: 14px 16px;
  font-size: 14.5px;
  color: var(--ink);
  background: #fff;
  outline: none;
  transition: border-color .25s var(--ease),
              box-shadow .25s var(--ease);
}
.form-input::placeholder { color: #b0b0b0; }
.form-input:focus {
  border-color: var(--zhusha);
  box-shadow: 0 0 0 3px rgba(196, 30, 58, .12);
}

.form-row {
  display: flex;
  gap: 12px;
}
.form-row > * { flex: 1; min-width: 0; }

.form-error {
  display: block;
  color: var(--zhusha);
  font-size: 13px;
  letter-spacing: .5px;
  margin-top: 6px;
  min-height: 1em;
}

.form-footer {
  margin-top: 18px;
  text-align: center;
  font-size: 13px;
  color: var(--ink-2);
}

.link-gold {
  color: var(--amber);
  letter-spacing: .5px;
  transition: color .2s var(--ease);
}
.link-gold:hover { color: var(--amber-dark); text-decoration: underline; }

/* ============================================================
   菜谱详情页
   ============================================================ */
.detail-hero {
  position: relative;
  aspect-ratio: 16 / 10;
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: linear-gradient(135deg, var(--bg-warm), #EEEEEE);
  box-shadow: 0 18px 44px -16px rgba(33, 33, 33, .22);
}
.detail-hero img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.detail-hero-fallback {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-size: 96px;
  font-weight: 700;
  color: rgba(196, 30, 58, .30);
}

.detail-back {
  position: absolute;
  top: 20px;
  left: 20px;
  z-index: 2;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(255, 255, 255, .88);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 14px rgba(0, 0, 0, .18);
  transition: transform var(--dur) var(--ease),
              background var(--dur) var(--ease);
}
.detail-back:hover { background: #fff; transform: scale(1.08); }
.detail-back svg { width: 20px; height: 20px; color: var(--ink); }

.detail-title {
  font-family: var(--font-display);
  font-size: clamp(28px, 4vw, 36px);
  font-weight: 700;
  color: var(--ink);
  letter-spacing: 3px;
  line-height: 1.35;
}

.detail-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 24px;
  font-size: 14px;
  color: var(--ink-2);
  letter-spacing: 1px;
}
.detail-meta .meta-cuisine { color: var(--qingci); font-weight: 500; }

/* 食材清单 */
.ing-list {
  border-radius: var(--radius-card);
  overflow: hidden;
}
.ing-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 13px 10px;
  border-bottom: 1px solid #F0EFEF;
  transition: background .2s var(--ease);
}
.ing-row:hover { background: rgba(248, 246, 243, .9); }
.ing-row:last-child { border-bottom: none; }
.ing-row .ing-name {
  font-size: 14.5px;
  color: var(--ink);
  letter-spacing: 1px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.ing-row .ing-amount { font-size: 13px; color: var(--ink-2); white-space: nowrap; }

/* 步骤卡片 */
.step-card {
  display: flex;
  align-items: flex-start;
  gap: 18px;
  background: var(--bg-warm);
  border-radius: var(--radius-card);
  padding: 22px 24px;
}
.step-num {
  width: 32px;
  height: 32px;
  flex-shrink: 0;
  border-radius: 50%;
  background: var(--zhusha);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 700;
  box-shadow: 0 3px 8px rgba(196, 30, 58, .3);
}
.step-content { flex: 1; min-width: 0; font-size: 14.5px; color: var(--ink); line-height: 1.85; letter-spacing: .5px; }

/* 营养四格 */
.nutri-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
}
@media (min-width: 768px) {
  .nutri-grid { grid-template-columns: repeat(4, 1fr); }
}

.nutri-cell {
  background: var(--bg-warm);
  border-radius: var(--radius-card);
  border-top: 4px solid var(--zhusha);
  padding: 20px 12px 18px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  text-align: center;
}
.nutri-cell.c-amber  { border-top-color: var(--amber); }
.nutri-cell.c-qingci { border-top-color: var(--qingci); }
.nutri-cell.c-zhuye  { border-top-color: var(--zhuye); }

.nutri-value {
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 700;
  color: var(--ink);
  line-height: 1.2;
}
.nutri-unit { font-size: 13px; font-weight: 400; color: var(--ink-2); margin-left: 2px; }

.nutri-label {
  font-size: 12px;
  color: var(--ink-2);
  letter-spacing: 2px;
}

/* ============================================================
   评分星
   ============================================================ */
.stars {
  display: flex;
  align-items: center;
  gap: 4px;
}
.star {
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  line-height: 1;
  color: var(--amber);
  cursor: pointer;
  transition: transform .2s var(--ease);
}
.star:hover { transform: scale(1.1); }
.star svg { width: 28px; height: 28px; fill: currentColor; }
.star.empty { color: #E5E5E5; }

/* ============================================================
   导入菜谱（动态表单）
   ============================================================ */
.import-form {
  width: 100%;
  max-width: 720px;
  margin: 0 auto;
  background: #fff;
  border-radius: var(--radius-lg);
  box-shadow: 0 10px 44px rgba(33, 33, 33, .08);
  padding: 36px 32px;
}

.dyn-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}
.dyn-row .form-input,
.dyn-row input { flex: 1; min-width: 0; }

.dyn-add {
  width: 100%;
  padding: 12px;
  border: 1.5px dashed #D5D5D5;
  border-radius: 12px;
  background: transparent;
  color: var(--ink-2);
  font-size: 13.5px;
  letter-spacing: 1px;
  transition: all var(--dur) var(--ease);
}
.dyn-add:hover {
  border-color: var(--zhusha);
  color: var(--zhusha);
  background: rgba(196, 30, 58, .02);
}

.dyn-del {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: var(--bg-block);
  color: #9a9a9a;
  font-size: 15px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all var(--dur) var(--ease);
}
.dyn-del:hover {
  background: rgba(196, 30, 58, .08);
  color: var(--zhusha);
}

/* ============================================================
   响应式（< 768px）：隐藏桌面导航，显示底部 Tab
   ============================================================ */
@media (max-width: 768px) {
  body { padding-bottom: calc(64px + env(safe-area-inset-bottom, 0px)); }

  /* 顶栏仅保留 Logo */
  .nav-desktop, .header-right { display: none !important; }
  .header-left { gap: 0; }
  .header-inner { height: 56px; }
  .logo-text { font-size: 20px; letter-spacing: 5px; }

  /* 底部 Tab */
  .mobile-nav { display: flex; }

  /* 网格降列 */
  .recipe-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
  .recipe-card { padding: 6px 6px 12px; }
  .recipe-card-name { font-size: 16px; margin-top: 10px; }
  .recipe-card-meta { font-size: 12px; }

  /* Hero */
  .hero { padding: 32px 0 44px; }
  .hero-inner { gap: 28px; }
  .hero-sub { margin: 14px 0 26px; font-size: 15px; }
  .hero-card-fallback span { font-size: 64px; }
  .hero-card-name { font-size: 21px; }
  .hero-card-overlay { padding: 44px 18px 18px; }

  /* 区块 */
  .section-block { padding: 40px 0 48px; }
  .home-recipes { padding: 40px 0 8px; }
  .section-head { margin-bottom: 18px; }
  .seasonal-pill { padding: 8px 16px; font-size: 13px; }

  /* 详情 */
  .detail-title { font-size: 24px; letter-spacing: 2px; }
  .detail-hero { border-radius: var(--radius-card); }
  .detail-hero-fallback { font-size: 64px; }
  .step-card { padding: 18px 16px; gap: 14px; }

  /* 榜单 */
  .rank-item { padding: 12px 14px; gap: 12px; }
  .rank-thumb { width: 56px; height: 56px; }
  .rank-badge { width: 36px; height: 36px; font-size: 15px; }

  /* 表单 */
  .form-card { padding: 30px 22px; }
  .form-page { padding: 32px 16px 72px; }
  .import-form { padding: 24px 16px; }

  /* 药丸缩小 */
  .time-pill, .score-pill, .match-pill { padding: 3px 9px; font-size: 11px; }
  .time-pill { left: 9px; bottom: 9px; }
  .score-pill, .match-pill { top: 9px; right: 9px; }

  /* 浮动条避开底部 Tab */
  .float-bar { left: 12px; right: 12px; bottom: calc(78px + env(safe-area-inset-bottom, 0px)); padding: 11px 12px; gap: 10px; }
  .float-bar-btn { padding: 10px 18px; font-size: 13px; }

  /* 页脚单列 */
  .footer-grid { grid-template-columns: 1fr; gap: 30px; padding: 40px 16px 32px; }
  .footer-bottom { padding: 14px 0; }

  /* 评分星缩小 */
  .star { width: 24px; height: 24px; font-size: 22px; }
  .star svg { width: 24px; height: 24px; }
}

/* 减少动效偏好 */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}
