/* =========================================================
   灶台小记 · 全站样式
   配色以暖米色、深灶台绿和少量番茄红为主
   ========================================================= */

:root {
  --bg: #f4f1e8;
  --surface: #fffdf8;
  --surface-soft: #faf7ef;
  --surface-deep: #f2ede1;
  --ink: #21352a;
  --ink-soft: #374d40;
  --muted: #56685c;
  --muted-light: #5f7064;
  --line: #e7e1d4;
  --line-strong: #d8cfbe;
  --green: #2b5a42;
  --green-deep: #1f4633;
  --green-mid: #47775b;
  --green-soft: #e8f2e9;
  --green-pale: #f1f7f2;
  --tomato: #b54c36;
  --tomato-deep: #963c2a;
  --tomato-soft: #faeae4;
  --amber: #9a6728;
  --amber-soft: #fbf0dc;
  --white: #ffffff;
  --shadow-sm: 0 4px 16px rgba(33, 53, 42, 0.05);
  --shadow-md: 0 16px 42px rgba(33, 53, 42, 0.08);
  --shadow-lg: 0 30px 80px rgba(27, 48, 36, 0.16);
  --radius-sm: 12px;
  --radius-md: 18px;
  --radius-lg: 26px;
  --radius-xl: 34px;
  --sans: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans CJK SC", "Source Han Sans SC", sans-serif;
  --serif: "Songti SC", "STSong", "SimSun", "Noto Serif CJK SC", serif;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  /* 兜底：真正的窄屏适配在下方媒体查询中完成 */
  overflow-x: hidden;
  overflow-x: clip;
}

body {
  margin: 0;
  min-height: 100vh;
  overflow-x: hidden;
  overflow-x: clip;
  color: var(--ink);
  background:
    radial-gradient(circle at 4% 0%, rgba(218, 230, 212, 0.7), transparent 28rem),
    radial-gradient(circle at 96% 8%, rgba(246, 224, 200, 0.68), transparent 24rem),
    linear-gradient(180deg, #f8f5ed 0%, var(--bg) 48%, #f0ecdf 100%);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

body.modal-open {
  overflow: hidden;
}

[hidden] {
  display: none !important;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  color: inherit;
}

img,
svg {
  display: block;
  max-width: 100%;
}

a {
  color: inherit;
}

h1,
h2,
h3,
h4,
p,
dl,
dd {
  margin: 0;
}

fieldset {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

::selection {
  color: #fff;
  background: var(--green-mid);
}

:focus-visible {
  outline: 3px solid #3a7153;
  outline-offset: 3px;
}

.hero :focus-visible {
  outline-color: #f0d39b;
}

.page-texture {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  opacity: 0.32;
  background-image:
    radial-gradient(rgba(44, 73, 56, 0.12) 0.65px, transparent 0.65px),
    radial-gradient(rgba(125, 91, 52, 0.1) 0.65px, transparent 0.65px);
  background-position: 0 0, 7px 7px;
  background-size: 14px 14px;
  mask-image: linear-gradient(180deg, #000 0%, transparent 72%);
}

.sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

/* ----------------------------- 基础排版 ----------------------------- */

.eyebrow {
  margin-bottom: 6px;
  color: var(--green-mid);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.16em;
  line-height: 1.4;
  text-transform: uppercase;
}

.eyebrow-light {
  color: rgba(247, 235, 208, 0.82);
}

h1,
h2,
h3 {
  letter-spacing: -0.02em;
  overflow-wrap: anywhere;
}

h1 {
  font-family: var(--serif);
  font-weight: 700;
}

h2 {
  font-size: clamp(24px, 2.4vw, 32px);
  font-weight: 700;
  line-height: 1.25;
}

h3 {
  font-size: 16px;
  font-weight: 700;
  line-height: 1.35;
}

.section-desc {
  max-width: 650px;
  margin-top: 7px;
  color: var(--muted);
  font-size: 14px;
  overflow-wrap: anywhere;
}

.app-shell {
  width: min(1180px, calc(100% - 48px));
  margin: 0 auto;
  padding-bottom: 30px;
}

main {
  padding-top: 6px;
}

/* ----------------------------- 按钮 ----------------------------- */

.btn {
  display: inline-flex;
  min-height: 42px;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 0 17px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--ink);
  font-size: 14px;
  font-weight: 650;
  line-height: 1.2;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: transform 160ms var(--ease), background-color 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn:active {
  transform: translateY(0);
}

.btn:disabled {
  opacity: 0.42;
  cursor: not-allowed;
  transform: none;
}

.btn-primary {
  border-color: var(--green);
  background: var(--green);
  color: #fff;
  box-shadow: 0 7px 18px rgba(43, 90, 66, 0.16);
}

.btn-primary:hover {
  background: var(--green-deep);
  border-color: var(--green-deep);
  box-shadow: 0 10px 24px rgba(43, 90, 66, 0.22);
}

.btn-ghost {
  border-color: var(--line);
  background: rgba(255, 253, 248, 0.66);
  color: var(--ink-soft);
}

.btn-ghost:hover {
  background: var(--white);
  border-color: var(--line-strong);
}

.btn-soft {
  border-color: #d4e4d9;
  background: var(--green-soft);
  color: var(--green-deep);
}

.btn-soft:hover {
  background: #dcecdf;
}

.btn-cream {
  border-color: #f6e7ca;
  background: #f8ebd2;
  color: #294b39;
  box-shadow: 0 10px 24px rgba(11, 31, 20, 0.14);
}

.btn-cream:hover {
  background: #fff4e0;
}

.btn-outline-light {
  border-color: rgba(255, 255, 255, 0.32);
  background: rgba(255, 255, 255, 0.07);
  color: #fff;
}

.btn-outline-light:hover {
  background: rgba(255, 255, 255, 0.14);
  border-color: rgba(255, 255, 255, 0.48);
}

.btn-danger {
  border-color: var(--tomato);
  background: var(--tomato);
  color: #fff;
}

.btn-danger:hover {
  border-color: var(--tomato-deep);
  background: var(--tomato-deep);
}

.btn-danger-ghost {
  border-color: #efd0c8;
  background: #fff8f5;
  color: var(--tomato-deep);
}

.btn-danger-ghost:hover {
  background: var(--tomato-soft);
}

.btn-dashed {
  min-height: 38px;
  border: 1px dashed var(--line-strong);
  background: transparent;
  color: var(--muted);
}

.btn-dashed:hover {
  border-color: var(--green-mid);
  background: var(--green-pale);
  color: var(--green);
}

.btn-sm {
  min-height: 36px;
  padding: 0 12px;
  border-radius: 10px;
  font-size: 13px;
}

.btn-block {
  width: 100%;
  min-height: 48px;
}

.btn-icon {
  width: 17px;
  height: 17px;
  flex: 0 0 auto;
}

.text-btn {
  padding: 4px 2px;
  border: 0;
  background: none;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: color 160ms ease;
}

.text-btn:hover {
  color: var(--tomato);
}

.text-btn:disabled {
  color: var(--muted-light);
  opacity: 0.55;
  cursor: not-allowed;
}

/* ----------------------------- 顶部栏 ----------------------------- */

.app-header {
  position: sticky;
  top: 12px;
  z-index: 30;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-top: 12px;
  padding: 11px 14px 11px 17px;
  border: 1px solid rgba(255, 255, 255, 0.75);
  border-radius: 20px;
  background: rgba(255, 253, 248, 0.82);
  box-shadow: 0 8px 30px rgba(33, 53, 42, 0.055);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

.brand {
  display: inline-flex;
  min-width: 0;
  align-items: center;
  gap: 10px;
}

.brand-logo {
  display: grid;
  width: 43px;
  height: 43px;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid #e5dccb;
  border-radius: 14px;
  background: #fbf7ed;
  box-shadow: inset 0 1px 0 #fff;
}

.brand-logo svg {
  width: 34px;
  height: 34px;
}

.brand-copy {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 1px;
}

.brand-copy strong {
  font-family: var(--serif);
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 0.05em;
  line-height: 1.3;
}

.brand-copy small {
  color: var(--muted);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.12em;
  line-height: 1.3;
}

.header-actions {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 8px;
}

/* ----------------------------- 首屏 ----------------------------- */

.hero {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1.18fr) minmax(260px, 0.82fr);
  gap: clamp(24px, 4vw, 58px);
  margin-top: 18px;
  padding: clamp(28px, 4.8vw, 56px);
  overflow: hidden;
  isolation: isolate;
  border-radius: var(--radius-xl);
  background:
    radial-gradient(circle at 91% 18%, rgba(249, 225, 179, 0.22), transparent 23%),
    radial-gradient(circle at 76% 110%, rgba(170, 206, 168, 0.2), transparent 33%),
    linear-gradient(128deg, #1e4131 0%, #2c5b42 54%, #3b6d50 100%);
  color: #fdf9ef;
  box-shadow: 0 32px 74px rgba(31, 61, 44, 0.2);
}

.hero::before {
  position: absolute;
  top: -110px;
  right: -70px;
  width: 360px;
  height: 360px;
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 50%;
  box-shadow:
    0 0 0 48px rgba(255, 255, 255, 0.028),
    0 0 0 96px rgba(255, 255, 255, 0.018);
  content: "";
  pointer-events: none;
}

.hero::after {
  position: absolute;
  right: 38%;
  bottom: -100px;
  width: 240px;
  height: 240px;
  border-radius: 50%;
  background: rgba(226, 204, 161, 0.055);
  content: "";
  pointer-events: none;
}

.hero-copy {
  position: relative;
  z-index: 2;
}

.hero h1 {
  max-width: 620px;
  color: #fffdf6;
  font-size: clamp(34px, 4.8vw, 58px);
  line-height: 1.18;
  text-wrap: balance;
}

.hero-desc {
  max-width: 500px;
  margin-top: 17px;
  color: rgba(248, 243, 231, 0.73);
  font-size: 14px;
  line-height: 1.85;
  overflow-wrap: anywhere;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 27px;
}

.hero-stats {
  display: flex;
  max-width: 470px;
  gap: clamp(22px, 4vw, 42px);
  margin-top: 33px;
  padding-top: 20px;
  border-top: 1px solid rgba(255, 255, 255, 0.14);
}

.hero-stats div {
  min-width: 64px;
}

.hero-stats dt {
  color: rgba(245, 239, 225, 0.58);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.06em;
}

.hero-stats dd {
  margin-top: 2px;
  color: rgba(255, 253, 246, 0.92);
  font-size: 12px;
}

.hero-stats strong {
  margin-right: 2px;
  font-family: var(--serif);
  font-size: 25px;
  font-weight: 700;
  line-height: 1.1;
}

.hero-art {
  position: relative;
  display: flex;
  min-height: 300px;
  align-items: center;
  justify-content: center;
  z-index: 2;
}

.hero-orbit {
  position: absolute;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 50%;
  pointer-events: none;
}

.hero-orbit-one {
  width: 340px;
  height: 340px;
}

.hero-orbit-two {
  width: 250px;
  height: 250px;
  border-color: rgba(255, 255, 255, 0.07);
}

.hero-menu-card {
  position: relative;
  z-index: 2;
  width: min(286px, 92%);
  padding: 24px 24px 21px;
  border: 1px solid rgba(255, 255, 255, 0.7);
  border-radius: 24px;
  background: rgba(255, 251, 242, 0.95);
  color: var(--ink);
  box-shadow: 0 25px 60px rgba(9, 27, 17, 0.23);
  transform: rotate(2.2deg);
  animation: card-breathe 7s ease-in-out infinite;
}

.hero-menu-eyebrow {
  color: var(--green-mid);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.15em;
}

.hero-menu-ingredients {
  margin-top: 7px;
  color: var(--ink);
  font-family: var(--serif);
  font-size: 19px;
  font-weight: 700;
  line-height: 1.5;
}

.hero-menu-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 13px;
  color: var(--muted);
  font-size: 11px;
}

.hero-ready {
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--green-soft);
  color: var(--green);
  font-size: 10px;
  font-weight: 700;
  white-space: nowrap;
}

.hero-menu-divider {
  height: 1px;
  margin: 18px 0 16px;
  background: var(--line);
}

.hero-menu-dish {
  font-family: var(--serif);
  font-size: 17px;
  font-weight: 700;
}

.hero-menu-meta {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
}

.hero-menu-arrow {
  position: absolute;
  right: 22px;
  bottom: 20px;
  color: var(--green-mid);
  font-size: 20px;
}

.hero-float-card {
  position: absolute;
  right: -8px;
  bottom: 13px;
  z-index: 3;
  display: flex;
  align-items: flex-start;
  gap: 8px;
  max-width: 192px;
  padding: 12px 13px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 14px;
  background: rgba(22, 48, 34, 0.72);
  color: rgba(255, 250, 239, 0.83);
  font-size: 10px;
  line-height: 1.65;
  box-shadow: 0 15px 30px rgba(10, 28, 18, 0.2);
  backdrop-filter: blur(10px);
}

.hero-float-dot {
  width: 7px;
  height: 7px;
  flex: 0 0 auto;
  margin-top: 5px;
  border-radius: 50%;
  background: #e6be7d;
  box-shadow: 0 0 0 4px rgba(230, 190, 125, 0.12);
}

@keyframes card-breathe {
  0%,
  100% {
    transform: rotate(2.2deg) translateY(0);
  }
  50% {
    transform: rotate(1.2deg) translateY(-7px);
  }
}

/* ----------------------------- 标签页 ----------------------------- */

.tab-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin: 24px 0 28px;
}

.tabbar {
  display: inline-flex;
  min-width: 0;
  max-width: 100%;
  gap: 4px;
  padding: 5px;
  border: 1px solid rgba(223, 215, 200, 0.8);
  border-radius: 999px;
  background: rgba(255, 253, 248, 0.7);
  box-shadow: 0 5px 18px rgba(33, 53, 42, 0.04);
  backdrop-filter: blur(10px);
}

.tab {
  display: inline-flex;
  min-width: 0;
  min-height: 40px;
  align-items: center;
  gap: 8px;
  padding: 0 19px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 650;
  white-space: normal;
  cursor: pointer;
  transition: color 180ms ease, background-color 180ms ease, box-shadow 180ms ease;
}

.tab:hover {
  color: var(--ink);
}

.tab.is-active {
  background: var(--ink);
  color: #fff;
  box-shadow: 0 4px 14px rgba(33, 53, 42, 0.19);
}

.tab-count {
  display: inline-grid;
  min-width: 20px;
  flex: 0 0 auto;
  height: 20px;
  padding: 0 6px;
  place-items: center;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.14);
  color: inherit;
  font-size: 10px;
  line-height: 1;
}

.tab:not(.is-active) .tab-count {
  background: var(--surface-deep);
  color: var(--muted);
}

.tab-hint {
  color: var(--muted-light);
  font-size: 11px;
}

.tab-panel {
  animation: panel-in 320ms var(--ease);
}

@keyframes panel-in {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ----------------------------- 区块标题 ----------------------------- */

.section-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 22px;
  margin-bottom: 20px;
}

.section-head .eyebrow {
  margin-bottom: 3px;
}

.section-head h2 {
  font-family: var(--serif);
}

.library-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 22px;
}

.search-box {
  position: relative;
  display: flex;
  width: min(100%, 570px);
  align-items: center;
  gap: 10px;
  padding: 0 12px 0 15px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  transition: border-color 160ms ease, box-shadow 160ms ease;
}

.search-box:focus-within {
  border-color: #abc4b3;
  box-shadow: 0 0 0 4px rgba(71, 119, 91, 0.08);
}

.search-icon {
  width: 19px;
  height: 19px;
  flex: 0 0 auto;
  color: var(--muted);
}

.search-box input {
  width: 100%;
  min-width: 0;
  min-height: 48px;
  padding: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
  font-size: 14px;
}

.search-box input::placeholder {
  color: var(--muted-light);
}

.search-box input::-webkit-search-cancel-button {
  display: none;
}

.search-clear {
  flex: 0 0 auto;
  padding: 4px 2px;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

.search-clear:hover {
  color: var(--tomato);
}

/* ----------------------------- 菜谱卡片 ----------------------------- */

.recipe-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 17px;
}

.recipe-card {
  position: relative;
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 15px;
  padding: 21px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: transform 220ms var(--ease), box-shadow 220ms ease, border-color 220ms ease;
}

.recipe-card::before {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 3px;
  background: linear-gradient(90deg, var(--green), #9bb89f, transparent 90%);
  opacity: 0;
  content: "";
  transition: opacity 220ms ease;
}

.recipe-card:hover {
  border-color: #cedccf;
  box-shadow: var(--shadow-md);
  transform: translateY(-3px);
}

.recipe-card:hover::before {
  opacity: 1;
}

.recipe-card:focus-within {
  border-color: #abc4b3;
}

.card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.category-pill {
  display: inline-flex;
  align-items: center;
  max-width: 100%;
  min-height: 25px;
  padding: 0 9px;
  overflow: hidden;
  border: 1px solid #e4ddce;
  border-radius: 999px;
  background: #faf7ee;
  color: #7b6b50;
  font-size: 10px;
  font-weight: 650;
  letter-spacing: 0.03em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.difficulty {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 650;
  white-space: nowrap;
}

.difficulty::before {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
  content: "";
}

.difficulty.is-easy {
  background: var(--green-soft);
  color: #2b6548;
}

.difficulty.is-medium {
  background: var(--amber-soft);
  color: #936224;
}

.difficulty.is-hard {
  background: var(--tomato-soft);
  color: #a0432f;
}

.card-title {
  margin-top: -2px;
  font-family: var(--serif);
  font-size: 21px;
  font-weight: 700;
  line-height: 1.38;
  overflow-wrap: anywhere;
}

.card-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 5px 13px;
  margin-top: -7px;
  color: var(--muted);
  font-size: 11px;
}

.meta-item {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.meta-item + .meta-item::before {
  width: 3px;
  height: 3px;
  margin-right: 2px;
  border-radius: 50%;
  background: var(--line-strong);
  content: "";
}

.ingredient-preview {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-height: 27px;
}

.mini-chip {
  display: inline-flex;
  max-width: 100%;
  min-height: 24px;
  align-items: center;
  gap: 4px;
  padding: 0 8px;
  border: 1px solid #e5e9df;
  border-radius: 7px;
  background: #f7faf5;
  color: var(--ink-soft);
  font-size: 11px;
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.mini-chip em {
  color: var(--muted-light);
  font-size: 9px;
  font-style: normal;
}

.mini-chip.is-optional {
  border-color: #eee8dc;
  background: #fbf9f3;
  color: var(--muted);
}

.mini-more {
  display: inline-flex;
  min-height: 24px;
  align-items: center;
  color: var(--muted-light);
  font-size: 11px;
}

.card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: auto;
  padding-top: 13px;
  border-top: 1px solid #efebe1;
}

.card-count {
  color: var(--muted-light);
  font-size: 10px;
}

.card-actions {
  display: flex;
  align-items: center;
  gap: 2px;
}

.card-action {
  padding: 5px 8px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--green-mid);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 150ms ease, color 150ms ease;
}

.card-action:hover {
  background: var(--green-soft);
  color: var(--green-deep);
}

.card-action.is-danger {
  color: var(--muted);
}

.card-action.is-danger:hover {
  background: var(--tomato-soft);
  color: var(--tomato-deep);
}

/* ----------------------------- 空状态 ----------------------------- */

.empty-state {
  display: flex;
  min-height: 300px;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 38px 24px;
  border: 1px dashed var(--line-strong);
  border-radius: 24px;
  background: rgba(255, 253, 248, 0.54);
  text-align: center;
}

.empty-mark {
  display: grid;
  width: 60px;
  height: 60px;
  margin-bottom: 13px;
  place-items: center;
  border: 1px solid #e5ddcd;
  border-radius: 18px;
  background: var(--surface);
  color: #a49a87;
  transform: rotate(-3deg);
}

.empty-mark svg {
  width: 40px;
  height: 40px;
}

.empty-state h3 {
  font-family: var(--serif);
  font-size: 19px;
}

.empty-state p {
  max-width: 390px;
  margin-top: 5px;
  color: var(--muted);
  font-size: 13px;
}

.empty-state .btn {
  margin-top: 16px;
}

/* ----------------------------- 推荐页 ----------------------------- */

.recommend-layout {
  display: grid;
  grid-template-columns: minmax(300px, 346px) minmax(0, 1fr);
  gap: 22px;
  align-items: start;
}

.pantry-card {
  position: sticky;
  top: 92px;
  min-width: 0;
  padding: 21px;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: var(--surface);
  box-shadow: var(--shadow-md);
}

.card-heading {
  display: flex;
  min-width: 0;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.card-heading-sm {
  margin-bottom: 9px;
}

.heading-with-step {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 9px;
}

.step-badge {
  display: inline-grid;
  width: 23px;
  height: 23px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 8px;
  background: var(--green);
  color: #fff;
  font-family: var(--serif);
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
}

.card-heading h3 {
  min-width: 0;
  font-family: var(--serif);
  font-size: 17px;
}

.heading-note {
  color: var(--muted-light);
  font-size: 10px;
}

.pantry-tags {
  display: flex;
  min-height: 54px;
  flex-wrap: wrap;
  align-content: flex-start;
  gap: 7px;
  margin-top: 13px;
  padding: 10px;
  border: 1px dashed #dad2c1;
  border-radius: 15px;
  background: #fbf8f1;
}

.pantry-empty {
  width: 100%;
  align-self: center;
  padding: 8px 3px;
  color: var(--muted-light);
  font-size: 11px;
  line-height: 1.6;
}

.pantry-tag {
  display: inline-flex;
  max-width: 100%;
  min-height: 28px;
  align-items: center;
  gap: 4px;
  padding: 3px 5px 3px 10px;
  border: 1px solid var(--green);
  border-radius: 999px;
  background: var(--green);
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.3;
  animation: tag-in 180ms var(--ease);
}

.pantry-tag > span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pantry-tag button {
  display: grid;
  width: 24px;
  height: 24px;
  flex: 0 0 auto;
  padding: 0;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.16);
  color: #fff;
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
}

.pantry-tag button:hover {
  background: rgba(255, 255, 255, 0.3);
}

@keyframes tag-in {
  from {
    opacity: 0;
    transform: scale(0.88);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.pantry-form {
  display: flex;
  gap: 7px;
  margin-top: 10px;
}

.pantry-form input {
  width: 100%;
  min-width: 0;
  min-height: 42px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 11px;
  outline: 0;
  background: var(--surface-soft);
  color: var(--ink);
  font-size: 13px;
}

.pantry-form input:focus {
  border-color: #abc4b3;
  background: var(--white);
  box-shadow: 0 0 0 3px rgba(71, 119, 91, 0.08);
}

.pantry-form .btn {
  min-height: 42px;
  padding: 0 14px;
  flex: 0 0 auto;
}

.input-hint {
  margin-top: 5px;
  color: var(--muted-light);
  font-size: 10px;
}

.quick-pick {
  margin-top: 17px;
  padding-top: 15px;
  border-top: 1px solid #efebe1;
}

.suggestion-list {
  display: flex;
  max-height: 155px;
  flex-wrap: wrap;
  gap: 6px;
  overflow: auto;
  padding: 2px 2px 4px;
  scrollbar-width: thin;
  scrollbar-color: #d9d1c1 transparent;
}

.suggest-chip {
  display: inline-flex;
  max-width: 100%;
  min-height: 27px;
  align-items: center;
  gap: 4px;
  padding: 0 7px;
  border: 1px solid #e6e0d3;
  border-radius: 7px;
  background: #faf8f3;
  color: var(--ink-soft);
  font-size: 11px;
  line-height: 1;
  overflow-wrap: anywhere;
  cursor: pointer;
  transition: border-color 140ms ease, background-color 140ms ease, color 140ms ease;
}

.suggest-chip:hover {
  border-color: #bfd4c4;
  background: #f1f7f1;
  color: var(--green);
}

.suggest-chip span {
  color: var(--muted-light);
  font-size: 9px;
}

.suggest-chip.is-selected {
  border-color: var(--green);
  background: var(--green);
  color: #fff;
}

.suggest-chip.is-selected span {
  color: rgba(255, 255, 255, 0.66);
}

.suggestion-empty {
  color: var(--muted-light);
  font-size: 11px;
}

.filters-block {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid #efebe1;
}

.filter-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px;
  margin-top: 12px;
}

.filter-field {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 4px;
  color: var(--muted);
  font-size: 10px;
}

.filter-field:first-child {
  grid-column: 1 / -1;
}

.filter-field select,
.filter-field input {
  width: 100%;
  min-width: 0;
  min-height: 38px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 9px;
  outline: 0;
  background: var(--surface-soft);
  color: var(--ink);
  font-size: 12px;
}

.filter-field select:focus,
.filter-field input:focus {
  border-color: #abc4b3;
  background: var(--white);
}

.time-input-wrap {
  position: relative;
  display: flex;
}

.time-input-wrap input {
  padding-right: 35px;
}

.time-input-wrap em {
  position: absolute;
  top: 50%;
  right: 9px;
  color: var(--muted-light);
  font-size: 9px;
  font-style: normal;
  pointer-events: none;
  transform: translateY(-50%);
}

.check-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-top: 11px;
  color: var(--muted);
  font-size: 11px;
}

.checkbox-label {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  cursor: pointer;
}

.checkbox-label input {
  width: 14px;
  height: 14px;
  margin: 0;
  accent-color: var(--green);
  cursor: pointer;
}

.missing-number {
  width: 46px;
  min-height: 28px;
  padding: 0 5px;
  border: 1px solid var(--line);
  border-radius: 7px;
  outline: 0;
  background: var(--surface-soft);
  color: var(--ink);
  font-size: 12px;
  text-align: center;
}

.missing-number:focus {
  border-color: #abc4b3;
}

.missing-number:disabled {
  opacity: 0.48;
}

.pantry-card > .btn-block {
  margin-top: 16px;
}

/* ----------------------------- 推荐结果 ----------------------------- */

.results-panel {
  min-width: 0;
}

.results-head {
  display: flex;
  min-height: 56px;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 4px;
}

.results-head h2 {
  font-family: var(--serif);
}

.result-count {
  display: inline-flex;
  min-height: 26px;
  align-items: center;
  padding: 0 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 253, 248, 0.6);
  color: var(--muted);
  font-size: 10px;
  white-space: nowrap;
}

.result-summary {
  min-height: 23px;
  margin-bottom: 12px;
  color: var(--muted);
  font-size: 12px;
}

.result-list {
  display: flex;
  flex-direction: column;
  gap: 13px;
}

.result-card {
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  transition: border-color 200ms ease, box-shadow 200ms ease;
}

.result-card:hover {
  border-color: #d1ddd2;
  box-shadow: 0 12px 30px rgba(33, 53, 42, 0.065);
}

.result-card.is-ready {
  border-color: #c2d9c8;
  background:
    linear-gradient(135deg, rgba(237, 247, 238, 0.42), transparent 38%),
    var(--surface);
}

.result-head {
  display: flex;
  align-items: center;
  gap: 15px;
}

.match-ring {
  --percent: 0;
  position: relative;
  display: grid;
  width: 68px;
  height: 68px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 50%;
  background: conic-gradient(var(--green-mid) calc(var(--percent) * 1%), #e9e4d8 0);
}

.match-ring::after {
  position: absolute;
  inset: 5px;
  border-radius: 50%;
  background: var(--surface);
  content: "";
}

.match-ring.is-low {
  background: conic-gradient(#c37b60 calc(var(--percent) * 1%), #ece5d9 0);
}

.match-ring.is-ready {
  background: conic-gradient(var(--green) calc(var(--percent) * 1%), #dfe9df 0);
}

.match-ring strong {
  position: relative;
  z-index: 1;
  color: var(--green-deep);
  font-family: var(--serif);
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.04em;
  line-height: 1;
}

.match-ring strong small {
  margin-left: 1px;
  font-family: var(--sans);
  font-size: 9px;
  font-weight: 600;
}

.match-ring.is-low strong {
  color: #9e543d;
}

.result-info {
  min-width: 0;
  flex: 1;
}

.result-badge-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-bottom: 5px;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 650;
  line-height: 1.4;
}

.status-badge.is-ready {
  background: var(--green-soft);
  color: var(--green);
}

.status-badge.is-ready::before {
  content: "✓";
  font-size: 10px;
}

.status-badge.is-missing {
  background: var(--tomato-soft);
  color: var(--tomato-deep);
}

.result-title {
  font-family: var(--serif);
  font-size: 20px;
  font-weight: 700;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.result-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 12px;
  margin-top: 4px;
  color: var(--muted);
  font-size: 10px;
}

.result-meta .difficulty {
  padding: 0;
  background: transparent;
  font-size: 10px;
}

.result-meta .difficulty::before {
  width: 4px;
  height: 4px;
}

.result-head .btn {
  flex: 0 0 auto;
  align-self: center;
}

.match-groups {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-top: 15px;
  padding-top: 14px;
  border-top: 1px solid #f0ece2;
}

.match-group {
  min-width: 0;
  padding: 10px 11px;
  border-radius: 12px;
  background: #fbf9f3;
}

.match-group.is-have {
  background: #f5faf5;
}

.match-group.is-missing {
  background: #fdf7f4;
}

.match-group.is-optional {
  background: #fdfaf5;
}

.match-group h4 {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 5px;
  margin-bottom: 7px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 650;
  line-height: 1.5;
}

.group-count {
  display: inline-grid;
  min-width: 17px;
  height: 17px;
  padding: 0 4px;
  place-items: center;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.75);
  color: var(--muted-light);
  font-size: 9px;
  font-weight: 600;
}

.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.ingredient-tag {
  display: inline-flex;
  max-width: 100%;
  align-items: baseline;
  gap: 3px;
  padding: 3px 7px;
  border: 1px solid transparent;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.ingredient-tag small {
  opacity: 0.72;
  font-size: 9px;
  font-weight: 400;
}

.ingredient-tag.have {
  border-color: #cfe3d3;
  background: var(--green-soft);
  color: #276043;
}

.ingredient-tag.have.is-optional {
  border-color: #d9e6db;
  background: #f2f8f2;
  color: #4c745a;
}

.ingredient-tag.missing {
  border-color: #f0cfc7;
  background: var(--tomato-soft);
  color: #a43e29;
}

.ingredient-tag.missing-optional {
  border-style: dashed;
  border-color: #e5c7bd;
  background: #fffaf7;
  color: #a96754;
}

.group-empty {
  color: var(--muted-light);
  font-size: 10px;
  line-height: 1.5;
}

.group-ok {
  color: var(--green-mid);
  font-size: 10px;
  font-weight: 600;
  line-height: 1.5;
}

/* ----------------------------- 页脚 ----------------------------- */

.app-footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px 24px;
  margin-top: 38px;
  padding: 19px 4px 5px;
  border-top: 1px solid rgba(216, 207, 190, 0.65);
  color: var(--muted-light);
  font-size: 10px;
  line-height: 1.7;
}

/* ----------------------------- 弹窗 ----------------------------- */

.modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  overflow: auto;
  padding: 24px;
  place-items: center;
  opacity: 0;
  transition: opacity 180ms ease;
}

.modal.is-open {
  opacity: 1;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(20, 34, 26, 0.48);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
}

.modal-dialog {
  position: relative;
  z-index: 1;
  width: min(100%, 720px);
  max-height: min(90vh, 900px);
  overflow: auto;
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-lg);
  outline: none;
  animation: modal-rise 260ms var(--ease);
  scrollbar-width: thin;
  scrollbar-color: #d8d0c0 transparent;
}

.modal-lg {
  max-width: 760px;
}

.modal-sm {
  width: min(100%, 420px);
}

@keyframes modal-rise {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.985);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.modal-header {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  padding: 21px 24px 16px;
  border-bottom: 1px solid #f0ece2;
  background: rgba(255, 253, 248, 0.95);
  backdrop-filter: blur(12px);
}

.modal-header .eyebrow {
  margin-bottom: 2px;
}

.modal-header h2 {
  font-family: var(--serif);
  font-size: 23px;
  line-height: 1.3;
}

.modal-close {
  display: grid;
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
  padding: 0;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 21px;
  line-height: 1;
  cursor: pointer;
  transition: background-color 150ms ease, color 150ms ease;
}

.modal-close:hover {
  background: var(--tomato-soft);
  color: var(--tomato);
}

.recipe-form {
  padding: 20px 24px 0;
}

/* 智能识别菜谱卡片 */
.smart-import-box {
  margin-bottom: 18px;
  padding: 14px 16px;
  border: 1px solid #d7e3d9;
  border-radius: 16px;
  background:
    linear-gradient(135deg, rgba(232, 242, 233, 0.52), rgba(250, 247, 239, 0.92));
}

.smart-import-box.is-collapsed {
  padding-bottom: 12px;
}

.smart-import-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 12px;
}

.smart-import-title-group {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.smart-import-title-group strong {
  color: var(--ink);
  font-size: 13px;
  font-weight: 700;
}

.smart-import-badge {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 0 8px;
  border-radius: 999px;
  background: var(--green);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.smart-import-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: auto;
}

.ai-status-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 24px;
  padding: 0 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 253, 248, 0.9);
  color: var(--muted);
  font-size: 10px;
  font-weight: 600;
  white-space: nowrap;
}

.ai-status-pill::before {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #a4b0a7;
  content: "";
}

.ai-status-pill.is-online {
  border-color: #c2dcc8;
  background: var(--green-soft);
  color: var(--green);
}

.ai-status-pill.is-online::before {
  background: #2f8f5b;
}

.ai-status-pill.is-offline {
  border-color: #e7dbc5;
  background: #fdf7eb;
  color: var(--amber);
}

.ai-status-pill.is-offline::before {
  background: #c89143;
}

.smart-toggle-btn {
  font-size: 11px;
  font-weight: 600;
}

.smart-import-body {
  margin-top: 11px;
}

.smart-import-body textarea {
  width: 100%;
  min-height: 92px;
  padding: 10px 12px;
  border: 1px solid #d9e2d8;
  border-radius: 11px;
  outline: 0;
  background: rgba(255, 255, 255, 0.92);
  color: var(--ink);
  font-size: 12px;
  line-height: 1.65;
  resize: vertical;
  transition: border-color 150ms ease, box-shadow 150ms ease;
}

.smart-import-body textarea:focus {
  border-color: #8eb39a;
  background: var(--white);
  box-shadow: 0 0 0 3px rgba(43, 90, 66, 0.09);
}

.smart-import-body textarea::placeholder {
  color: #9ba59e;
}

.smart-import-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
}

.smart-import-actions .text-btn {
  margin-left: auto;
  font-size: 11px;
}

.smart-parse-status {
  margin-top: 9px;
  padding: 7px 10px;
  border-radius: 9px;
  background: rgba(255, 253, 248, 0.85);
  color: var(--ink-soft);
  font-size: 11px;
  line-height: 1.55;
}

.smart-parse-status.is-loading {
  border: 1px solid #cfe0d3;
  background: var(--green-pale);
  color: var(--green);
}

.smart-parse-status.is-success {
  border: 1px solid #c5deca;
  background: var(--green-soft);
  color: var(--green-deep);
}

.smart-parse-status.is-warning {
  border: 1px solid #ebd7b3;
  background: var(--amber-soft);
  color: #7c521c;
}

.smart-parse-status.is-error {
  border: 1px solid #efd2ca;
  background: #fff8f5;
  color: var(--tomato-deep);
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.form-field {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 15px;
}

.form-grid .form-field {
  margin-bottom: 0;
}

.form-field-wide {
  grid-column: 1 / -1;
}

.form-field > span {
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 650;
}

.form-field em,
.ingredient-fieldset legend em {
  color: var(--tomato);
  font-style: normal;
}

.form-field input,
.form-field select,
.form-field textarea {
  width: 100%;
  min-height: 42px;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: 10px;
  outline: 0;
  background: var(--surface-soft);
  color: var(--ink);
  font-size: 13px;
  line-height: 1.6;
  transition: border-color 150ms ease, background-color 150ms ease, box-shadow 150ms ease;
}

.form-field textarea {
  min-height: 88px;
  resize: vertical;
}

.form-field input:focus,
.form-field select:focus,
.form-field textarea:focus {
  border-color: #abc4b3;
  background: var(--white);
  box-shadow: 0 0 0 3px rgba(71, 119, 91, 0.08);
}

.form-field input::placeholder,
.form-field textarea::placeholder {
  color: #a7afa8;
}

.ingredient-fieldset {
  margin: 17px 0 4px;
  padding-top: 16px;
  border-top: 1px solid #efebe1;
}

.ingredient-fieldset legend {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 7px;
  padding: 0;
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 650;
}

.legend-hint {
  color: var(--muted-light);
  font-size: 10px;
  font-weight: 400;
}

.ingredient-rows {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 11px 0 10px;
}

.ingredient-row {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(0, 0.8fr) auto 31px;
  gap: 7px;
  align-items: center;
}

.ingredient-row input {
  width: 100%;
  min-width: 0;
  min-height: 40px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 9px;
  outline: 0;
  background: var(--surface-soft);
  color: var(--ink);
  font-size: 12px;
}

.ingredient-row input:focus {
  border-color: #abc4b3;
  background: var(--white);
  box-shadow: 0 0 0 3px rgba(71, 119, 91, 0.07);
}

.ingredient-row input::placeholder {
  color: #a7afa8;
}

.required-toggle {
  min-width: 58px;
  min-height: 40px;
  padding: 0 9px;
  border: 1px solid transparent;
  border-radius: 9px;
  font-size: 11px;
  font-weight: 650;
  cursor: pointer;
  transition: background-color 150ms ease, color 150ms ease, border-color 150ms ease;
}

.required-toggle.is-required {
  border-color: #c5ddcb;
  background: var(--green-soft);
  color: var(--green);
}

.required-toggle.is-optional {
  border-color: #e9d9bb;
  background: #fdf6e9;
  color: var(--amber);
}

.remove-ingredient {
  display: grid;
  width: 31px;
  height: 31px;
  padding: 0;
  place-items: center;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--muted-light);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
}

.remove-ingredient:hover {
  border-color: #f0d4cc;
  background: var(--tomato-soft);
  color: var(--tomato);
}

.ingredient-fieldset > .btn {
  margin-bottom: 15px;
}

.form-error {
  margin: 0 0 14px;
  padding: 9px 12px;
  border: 1px solid #efd2ca;
  border-radius: 9px;
  background: #fff8f5;
  color: var(--tomato-deep);
  font-size: 12px;
  line-height: 1.6;
}

.modal-footer {
  position: sticky;
  bottom: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 9px;
  margin-top: 10px;
  padding: 15px 24px 18px;
  border-top: 1px solid #f0ece2;
  background: rgba(255, 253, 248, 0.95);
  backdrop-filter: blur(12px);
}

.modal-footer .btn-danger-ghost {
  margin-right: auto;
}

/* ----------------------------- 菜谱详情 ----------------------------- */

.detail-content {
  padding: 21px 24px 6px;
}

.detail-hero {
  padding-bottom: 18px;
  border-bottom: 1px solid #efebe1;
}

.detail-hero h2 {
  margin-top: 8px;
  font-family: var(--serif);
  font-size: clamp(25px, 4vw, 32px);
  line-height: 1.3;
}

.detail-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 14px;
  margin-top: 11px;
  color: var(--muted);
  font-size: 12px;
}

.detail-section {
  padding: 19px 0;
  border-bottom: 1px solid #f0ece2;
}

.detail-section:last-child {
  border-bottom: 0;
}

.detail-section h3 {
  margin-bottom: 11px;
  font-family: var(--serif);
  font-size: 17px;
}

.detail-ingredient-groups {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 13px;
}

.detail-ingredient-group h4 {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 7px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 650;
}

.detail-ingredient-group h4::before {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--green-mid);
  content: "";
}

.detail-ingredient-group.is-optional h4::before {
  background: #c7a36a;
}

.detail-ingredient-list {
  display: flex;
  flex-direction: column;
  gap: 3px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.detail-ingredient-list li {
  display: flex;
  min-width: 0;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 5px 8px;
  border-radius: 7px;
  background: #faf8f2;
  font-size: 12px;
  overflow-wrap: anywhere;
}

.detail-ingredient-list li span {
  color: var(--muted);
  font-size: 11px;
  text-align: right;
}

.step-list {
  display: flex;
  flex-direction: column;
  gap: 9px;
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: step;
}

.step-list li {
  position: relative;
  padding: 9px 11px 9px 35px;
  border-radius: 10px;
  background: #faf8f2;
  color: var(--ink-soft);
  font-size: 13px;
  line-height: 1.75;
  overflow-wrap: anywhere;
  counter-increment: step;
}

.step-list li::before {
  position: absolute;
  top: 10px;
  left: 10px;
  display: grid;
  width: 18px;
  height: 18px;
  place-items: center;
  border-radius: 6px;
  background: var(--green-soft);
  color: var(--green);
  content: counter(step);
  font-family: var(--serif);
  font-size: 10px;
  font-weight: 700;
}

.detail-notes {
  padding: 11px 13px;
  border-left: 3px solid #dfc99e;
  border-radius: 0 9px 9px 0;
  background: #fcf8ef;
  color: var(--ink-soft);
  font-size: 12px;
  line-height: 1.8;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.muted-text {
  color: var(--muted-light);
  font-size: 12px;
}

/* ----------------------------- 确认框与轻提示 ----------------------------- */

.cloud-sync-btn {
  border-color: #cde0d1;
  background: var(--green-pale);
  color: var(--green);
}

.cloud-sync-btn.is-syncing {
  border-color: #e6d7bb;
  background: #fdf6e9;
  color: var(--amber);
}

.cloud-sync-btn.is-error {
  border-color: #efc9be;
  background: var(--tomato-soft);
  color: var(--tomato-deep);
}

.cloud-dot {
  width: 7px;
  height: 7px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: #2f8f5b;
}

.cloud-sync-btn.is-syncing .cloud-dot {
  background: #c89143;
}

.cloud-sync-btn.is-error .cloud-dot {
  background: var(--tomato);
}

.passcode-dialog {
  padding: 28px 26px 24px;
  text-align: center;
}

.passcode-mark {
  display: grid;
  width: 48px;
  height: 48px;
  margin: 0 auto 12px;
  place-items: center;
  border: 1px solid #d7e4d9;
  border-radius: 15px;
  background: var(--green-soft);
  color: var(--green);
  font-family: var(--serif);
  font-size: 22px;
  font-weight: 700;
}

.passcode-dialog h2 {
  font-family: var(--serif);
  font-size: 22px;
}

.passcode-desc {
  margin-top: 6px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.7;
}

.passcode-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 18px;
  text-align: left;
}

.passcode-form input {
  width: 100%;
  min-height: 44px;
  padding: 0 13px;
  border: 1px solid var(--line-strong);
  border-radius: 11px;
  outline: 0;
  background: var(--surface-soft);
  color: var(--ink);
  font-size: 14px;
  text-align: center;
  letter-spacing: 0.08em;
}

.passcode-form input:focus {
  border-color: #8eb39a;
  background: var(--white);
  box-shadow: 0 0 0 3px rgba(43, 90, 66, 0.1);
}

.passcode-form .form-error {
  margin: 0;
  text-align: center;
}

.confirm-dialog {
  padding: 27px 26px 22px;
  text-align: center;
}

.confirm-mark {
  display: grid;
  width: 47px;
  height: 47px;
  margin: 0 auto 12px;
  place-items: center;
  border: 1px solid #efd0c7;
  border-radius: 50%;
  background: var(--tomato-soft);
  color: var(--tomato-deep);
  font-family: var(--serif);
  font-size: 22px;
  font-weight: 700;
}

.confirm-dialog h2 {
  font-family: var(--serif);
  font-size: 21px;
}

.confirm-dialog p {
  margin-top: 8px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.8;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.confirm-actions {
  display: flex;
  justify-content: center;
  gap: 9px;
  margin-top: 21px;
}

.confirm-actions .btn {
  min-width: 96px;
}

.toast {
  position: fixed;
  bottom: max(22px, env(safe-area-inset-bottom));
  left: 50%;
  z-index: 200;
  max-width: min(88vw, 460px);
  padding: 11px 17px;
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 12px;
  background: rgba(30, 53, 40, 0.95);
  color: #fff;
  font-size: 12px;
  font-weight: 500;
  line-height: 1.6;
  text-align: center;
  overflow-wrap: anywhere;
  box-shadow: 0 14px 35px rgba(22, 40, 29, 0.22);
  transform: translate(-50%, 0);
  animation: toast-in 220ms var(--ease);
  backdrop-filter: blur(10px);
}

.toast.is-error {
  background: rgba(126, 49, 34, 0.96);
}

.toast.is-info {
  background: rgba(56, 71, 62, 0.96);
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translate(-50%, 10px);
  }
  to {
    opacity: 1;
    transform: translate(-50%, 0);
  }
}

/* ----------------------------- 响应式 ----------------------------- */

@media (max-width: 1080px) {
  .recipe-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .hero {
    grid-template-columns: minmax(0, 1.2fr) minmax(230px, 0.8fr);
  }

  .hero-menu-card {
    width: min(260px, 94%);
  }

  .match-groups {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .match-group.is-optional {
    grid-column: 1 / -1;
  }
}

@media (max-width: 900px) {
  .hero {
    grid-template-columns: minmax(0, 1fr);
  }

  .hero-art {
    display: none;
  }

  .hero h1 {
    max-width: 640px;
  }

  .hero-desc {
    max-width: 580px;
  }

  .recommend-layout {
    grid-template-columns: minmax(0, 1fr);
  }

  .pantry-card {
    position: static;
  }

  .suggestion-list {
    max-height: 190px;
  }

  .filter-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .filter-field:first-child {
    grid-column: auto;
  }

  .match-groups {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .match-group.is-optional {
    grid-column: auto;
  }
}

@media (max-width: 720px) {
  .app-shell {
    width: min(100% - 28px, 680px);
  }

  .app-header {
    top: 7px;
    margin-top: 7px;
    border-radius: 17px;
  }

  .hero {
    margin-top: 12px;
    padding: 28px 23px;
    border-radius: 26px;
  }

  .hero h1 {
    font-size: clamp(31px, 9vw, 44px);
  }

  .hero-desc {
    font-size: 13px;
    line-height: 1.8;
  }

  .hero-actions .btn {
    flex: 1 1 auto;
    min-width: 142px;
  }

  .hero-stats {
    gap: 20px;
    margin-top: 26px;
    padding-top: 17px;
  }

  .tab-row {
    margin: 18px 0 22px;
  }

  .tab-hint {
    display: none;
  }

  .tabbar {
    width: 100%;
    min-width: 0;
    max-width: 100%;
  }

  .tab {
    flex: 1 1 0;
    min-width: 0;
    justify-content: center;
    padding: 0 12px;
    white-space: normal;
  }

  .section-head {
    align-items: flex-start;
  }

  .section-head h2 {
    font-size: 25px;
  }

  .section-head .btn {
    min-height: 39px;
    padding: 0 12px;
    font-size: 12px;
  }

  .section-desc {
    font-size: 12px;
  }

  .recipe-grid {
    grid-template-columns: minmax(0, 1fr);
    gap: 13px;
  }

  .recipe-card {
    padding: 18px;
    border-radius: 19px;
  }

  .card-title {
    font-size: 20px;
  }

  .empty-state {
    min-height: 260px;
    padding: 28px 17px;
  }

  .pantry-card {
    padding: 18px;
    border-radius: 20px;
  }

  .filter-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .filter-field:first-child {
    grid-column: 1 / -1;
  }

  .result-card {
    padding: 16px;
    border-radius: 19px;
  }

  .result-head {
    flex-wrap: wrap;
    gap: 11px;
  }

  .match-ring {
    width: 61px;
    height: 61px;
  }

  .match-ring strong {
    font-size: 15px;
  }

  .result-info {
    flex: 1 1 calc(100% - 78px);
  }

  .result-head .btn {
    width: 100%;
    min-height: 36px;
    margin-top: 1px;
  }

  .match-groups {
    grid-template-columns: minmax(0, 1fr);
    gap: 8px;
  }

  .match-group.is-optional {
    grid-column: auto;
  }

  .app-footer {
    margin-top: 26px;
  }

  .modal {
    padding: 10px;
    place-items: end center;
  }

  .modal-dialog {
    width: 100%;
    max-height: calc(100dvh - 20px);
    border-radius: 23px;
  }

  .modal-header {
    padding: 17px 17px 13px;
  }

  .modal-header h2 {
    font-size: 21px;
  }

  .recipe-form {
    padding: 17px 17px 0;
  }

  .form-grid {
    grid-template-columns: minmax(0, 1fr);
    gap: 12px;
  }

  .form-field-wide {
    grid-column: auto;
  }

  .form-grid .form-field {
    margin-bottom: 0;
  }

  .ingredient-row {
    grid-template-columns: minmax(0, 1fr) minmax(0, 0.9fr) auto 31px;
  }

  .modal-footer {
    padding: 13px 17px calc(15px + env(safe-area-inset-bottom));
  }

  .detail-content {
    padding: 18px 17px 4px;
  }

  .detail-ingredient-groups {
    grid-template-columns: minmax(0, 1fr);
  }

  .confirm-dialog {
    margin-bottom: 3vh;
    border-radius: 22px;
  }
}

@media (max-width: 520px) {
  .app-shell {
    width: calc(100% - 20px);
  }

  .app-header {
    flex-wrap: wrap;
    gap: 8px;
    padding: 10px;
  }

  .brand {
    gap: 8px;
  }

  .brand-logo {
    width: 38px;
    height: 38px;
    border-radius: 12px;
  }

  .brand-logo svg {
    width: 30px;
    height: 30px;
  }

  .brand-copy strong {
    font-size: 16px;
  }

  .brand-copy small {
    font-size: 9px;
    letter-spacing: 0.07em;
  }

  .header-actions {
    gap: 5px;
  }

  .header-actions .btn-sm {
    min-height: 33px;
    padding: 0 8px;
    gap: 4px;
    font-size: 11px;
  }

  .header-actions .btn-icon {
    width: 15px;
    height: 15px;
  }

  .hero {
    padding: 25px 19px;
  }

  .hero-actions {
    gap: 8px;
  }

  .hero-actions .btn {
    min-height: 40px;
    padding: 0 13px;
    font-size: 12px;
  }

  .hero-stats strong {
    font-size: 22px;
  }

  .hero-stats dt {
    font-size: 10px;
  }

  .section-head {
    flex-wrap: wrap;
    gap: 12px;
  }

  .section-head .btn {
    width: 100%;
  }

  .search-box {
    padding-left: 12px;
  }

  .recipe-card {
    padding: 16px;
  }

  .card-title {
    font-size: 19px;
  }

  .pantry-form {
    flex-wrap: wrap;
  }

  .pantry-form input {
    flex: 1 1 calc(100% - 72px);
  }

  .pantry-form .btn {
    flex: 0 0 63px;
    padding: 0 10px;
  }

  .filter-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .filter-field:first-child {
    grid-column: auto;
  }

  .result-head {
    align-items: flex-start;
  }

  .result-head .btn {
    flex-basis: 100%;
  }

  .result-head .match-ring {
    margin-top: 2px;
  }

  .result-info {
    flex-basis: calc(100% - 74px);
  }

  .status-badge,
  .result-meta {
    font-size: 9px;
  }

  .form-field input,
  .form-field select,
  .form-field textarea {
    min-height: 41px;
    font-size: 12px;
  }

  .ingredient-row {
    grid-template-columns: minmax(0, 1fr) auto 31px;
  }

  .ingredient-row input.ingredient-amount {
    grid-column: 1 / 2;
    grid-row: 2;
  }

  .ingredient-row .required-toggle {
    grid-column: 2 / 3;
    grid-row: 1 / 3;
    height: 100%;
    min-width: 50px;
    min-height: 40px;
    padding: 0 7px;
    font-size: 10px;
  }

  .ingredient-row .remove-ingredient {
    grid-column: 3 / 4;
    grid-row: 1 / 3;
  }

  .modal-header,
  .recipe-form,
  .detail-content {
    padding-right: 14px;
    padding-left: 14px;
  }

  .modal-footer {
    padding-right: 14px;
    padding-left: 14px;
  }

  .modal-footer .btn {
    flex: 1;
    padding: 0 10px;
  }

  .modal-footer .btn-danger-ghost {
    flex: 0 0 auto;
    margin-right: 0;
  }

  .smart-import-box {
    padding: 12px;
  }

  .smart-import-actions .btn {
    flex: 1 1 auto;
  }

  .smart-import-actions .text-btn {
    margin-left: 0;
  }

  .confirm-actions .btn {
    flex: 1;
  }
}

@media (max-width: 390px) {
  .brand-copy small {
    display: none;
  }

  .tab {
    font-size: 12px;
  }
}

/* 480px 以下：顶部操作收为图标，Hero 按钮独占整行，标签栏严格等分 */
@media (max-width: 480px) {
  .app-header {
    gap: 8px;
    padding: 10px;
  }

  .header-actions {
    margin-left: auto;
  }

  .header-actions .btn-sm {
    width: 38px;
    min-width: 38px;
    min-height: 38px;
    padding: 0;
    justify-content: center;
  }

  .header-actions .btn-sm > span {
    display: none;
  }

  .header-actions .btn-icon {
    width: 17px;
    height: 17px;
  }

  .hero {
    padding: 24px 16px;
  }

  .hero-copy,
  .hero-actions,
  .hero-stats {
    min-width: 0;
    max-width: 100%;
  }

  .hero-actions {
    flex-direction: column;
    align-items: stretch;
    gap: 9px;
  }

  .hero-actions .btn {
    flex: 1 1 auto;
    width: 100%;
    min-width: 0;
    white-space: normal;
  }

  .hero-stats {
    flex-wrap: wrap;
    gap: 10px 14px;
  }

  .hero-stats div {
    min-width: 0;
  }

  .tabbar {
    width: 100%;
    min-width: 0;
    max-width: 100%;
  }

  .tab {
    flex: 1 1 0;
    min-width: 0;
    gap: 5px;
    padding: 0 clamp(4px, 2vw, 10px);
    white-space: normal;
  }

  .results-head,
  .card-footer,
  .card-actions,
  .modal-footer,
  .confirm-actions {
    flex-wrap: wrap;
  }

  .empty-state .btn,
  .modal-footer .btn {
    min-width: 0;
    white-space: normal;
  }
}

@media (hover: none) {
  .recipe-card:hover {
    transform: none;
  }

  .btn:hover {
    transform: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
