:root {
  --paper: #f6f0e4;
  --paper-deep: #eadfca;
  --paper-light: #fffaf0;
  --smoke: #173f36;
  --smoke-soft: #315d50;
  --ink: #241f1a;
  --muted: #756d62;
  --line: rgba(36, 31, 26, 0.16);
  --line-strong: rgba(23, 63, 54, 0.34);
  --cinnabar: #c6573c;
  --cinnabar-dark: #9d3e2b;
  --fire: #e3a833;
  --sage: #9cb3a5;
  --good: #2f7b5a;
  --warning: #a46b18;
  --danger: #a43a2f;
  --display: "STKaiti", "KaiTi", "FZKai-Z03", "Songti SC", serif;
  --body: "LXGW WenKai", "Microsoft YaHei UI", "Microsoft YaHei", sans-serif;
  --mono: "Cascadia Mono", "SFMono-Regular", Consolas, monospace;
  --radius-sm: 12px;
  --radius: 20px;
  --radius-lg: 30px;
  --shadow: 0 18px 45px rgba(45, 35, 24, 0.12);
  --nav-height: 76px;
  color-scheme: light;
}

* {
  box-sizing: border-box;
}

html {
  background: #d9d2c6;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(circle at 12% 8%, rgba(227, 168, 51, 0.12), transparent 24rem),
    radial-gradient(circle at 92% 24%, rgba(23, 63, 54, 0.12), transparent 30rem),
    #d9d2c6;
  font-family: var(--body);
  -webkit-font-smoothing: antialiased;
}

button,
input,
select {
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

button {
  color: inherit;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: 3px solid rgba(227, 168, 51, 0.7);
  outline-offset: 3px;
}

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

.paper-grain {
  position: fixed;
  inset: 0;
  z-index: 10;
  opacity: 0.18;
  pointer-events: none;
  background-image:
    repeating-linear-gradient(0deg, transparent 0 3px, rgba(61, 45, 27, 0.035) 3px 4px),
    repeating-linear-gradient(90deg, transparent 0 5px, rgba(255, 255, 255, 0.09) 5px 6px);
  mix-blend-mode: multiply;
}

.app-shell {
  position: relative;
  width: min(100%, 1180px);
  min-height: 100vh;
  margin: 0 auto;
  padding-bottom: calc(var(--nav-height) + env(safe-area-inset-bottom));
  overflow: hidden;
  background:
    linear-gradient(90deg, transparent 0 5%, rgba(157, 62, 43, 0.035) 5% 5.2%, transparent 5.2% 94.8%, rgba(157, 62, 43, 0.035) 94.8% 95%, transparent 95%),
    var(--paper);
  box-shadow: 0 0 70px rgba(36, 31, 26, 0.18);
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 70px;
  padding: 12px 18px;
  border-bottom: 1px solid rgba(23, 63, 54, 0.12);
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  backdrop-filter: blur(18px);
}

.brand {
  display: inline-flex;
  gap: 10px;
  align-items: center;
  color: var(--smoke);
  text-decoration: none;
}

.brand-seal {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  color: var(--paper-light);
  background: var(--cinnabar);
  border-radius: 8px 8px 8px 2px;
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.25);
  font: 700 22px/1 var(--display);
  transform: rotate(-3deg);
}

.brand strong,
.brand small {
  display: block;
}

.brand strong {
  font: 700 20px/1.1 var(--display);
  letter-spacing: 0.08em;
}

.brand small {
  margin-top: 3px;
  color: var(--muted);
  font: 8px/1 var(--mono);
  letter-spacing: 0.13em;
}

.topbar-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.icon-button {
  display: inline-flex;
  min-height: 40px;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 250, 240, 0.72);
  cursor: pointer;
}

.basket-button {
  position: relative;
  width: 42px;
  padding: 0;
}

.basket-button svg {
  width: 19px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.count-badge {
  position: absolute;
  top: -4px;
  right: -3px;
  display: grid;
  min-width: 18px;
  height: 18px;
  padding: 0 4px;
  place-items: center;
  color: white;
  background: var(--cinnabar);
  border: 2px solid var(--paper);
  border-radius: 999px;
  font: 700 9px/1 var(--mono);
}

#app-view {
  min-height: calc(100vh - 70px - var(--nav-height));
}

.page {
  width: 100%;
  padding: 22px 16px 42px;
  animation: page-in 0.38s cubic-bezier(0.2, 0.75, 0.2, 1) both;
}

@keyframes page-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}

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

.page-title {
  margin: 5px 0 0;
  color: var(--smoke);
  font: 700 clamp(34px, 9vw, 58px)/0.98 var(--display);
  letter-spacing: -0.06em;
}

.page-subtitle {
  max-width: 38rem;
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.7;
}

.eyebrow {
  display: flex;
  gap: 8px;
  align-items: center;
  color: var(--cinnabar);
  font: 700 10px/1 var(--mono);
  letter-spacing: 0.11em;
  text-transform: uppercase;
}

.eyebrow::before {
  width: 20px;
  height: 1px;
  content: "";
  background: currentColor;
}

.section-head {
  display: flex;
  gap: 16px;
  align-items: baseline;
  justify-content: space-between;
  margin: 30px 0 14px;
}

.section-head h2,
.section-head h3 {
  margin: 0;
  color: var(--smoke);
  font: 700 24px/1.1 var(--display);
  letter-spacing: -0.03em;
}

.section-head span,
.section-head a,
.text-action {
  color: var(--cinnabar-dark);
  font-size: 12px;
  text-decoration: none;
}

.text-action {
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
}

.bottom-nav {
  position: fixed;
  z-index: 40;
  bottom: 0;
  left: 50%;
  display: grid;
  width: min(100%, 1180px);
  height: calc(var(--nav-height) + env(safe-area-inset-bottom));
  padding: 7px 10px env(safe-area-inset-bottom);
  grid-template-columns: repeat(4, 1fr);
  border-top: 1px solid rgba(23, 63, 54, 0.14);
  background: color-mix(in srgb, var(--paper-light) 92%, transparent);
  box-shadow: 0 -12px 34px rgba(36, 31, 26, 0.08);
  backdrop-filter: blur(20px);
  transform: translateX(-50%);
}

.bottom-nav button {
  position: relative;
  display: flex;
  min-width: 0;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 3px;
  color: #716c62;
  border: 0;
  background: none;
  cursor: pointer;
  font-size: 11px;
}

.bottom-nav svg {
  width: 23px;
  height: 23px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.bottom-nav button.active {
  color: var(--smoke);
  font-weight: 700;
}

.bottom-nav button.active::after {
  position: absolute;
  bottom: -1px;
  width: 20px;
  height: 3px;
  content: "";
  background: var(--cinnabar);
  border-radius: 3px 3px 0 0;
}

/* 首页 */
.hero-intro {
  padding-top: 6px;
}

.hero-title {
  max-width: 780px;
  margin: 14px 0 10px;
  color: var(--smoke);
  font: 700 clamp(46px, 13vw, 92px)/0.9 var(--display);
  letter-spacing: -0.085em;
}

.hero-title em {
  position: relative;
  color: var(--cinnabar);
  font-style: normal;
}

.hero-title em::after {
  position: absolute;
  right: 0;
  bottom: 4px;
  left: 0;
  height: 8px;
  content: "";
  background: rgba(227, 168, 51, 0.32);
  transform: rotate(-2deg);
  z-index: -1;
}

.hero-lead {
  max-width: 530px;
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.8;
}

.main-choices {
  display: grid;
  gap: 13px;
  margin-top: 25px;
}

.choice-card {
  position: relative;
  min-height: 214px;
  padding: 22px;
  overflow: hidden;
  text-align: left;
  border: 0;
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.choice-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow);
}

.choice-card.primary {
  isolation: isolate;
  color: var(--paper-light);
  background: var(--smoke);
}

.choice-card.primary::before {
  position: absolute;
  z-index: -1;
  inset: 0;
  content: "";
  background:
    linear-gradient(90deg, var(--smoke) 0%, rgba(23, 63, 54, 0.92) 38%, rgba(23, 63, 54, 0.48) 63%, rgba(23, 63, 54, 0.06) 100%),
    url("../../assets/ui/home-ingredient-basket-v1.png") center / cover no-repeat;
  opacity: 0.98;
}

.choice-card.primary::after {
  position: absolute;
  z-index: -1;
  inset: 0;
  content: "";
  background: linear-gradient(135deg, rgba(227, 168, 51, 0.08), transparent 56%);
}

.choice-card.primary strong,
.choice-card.primary p {
  max-width: 72%;
  text-shadow: 0 1px 0 rgba(7, 31, 27, 0.7), 0 0 18px rgba(7, 31, 27, 0.58);
}

.choice-card.secondary {
  isolation: isolate;
  color: var(--paper-light);
  background: var(--smoke);
}

.choice-card.secondary::before {
  position: absolute;
  z-index: -1;
  inset: 0;
  content: "";
  background:
    linear-gradient(90deg, var(--smoke) 0%, rgba(23, 63, 54, 0.95) 38%, rgba(23, 63, 54, 0.5) 64%, rgba(23, 63, 54, 0.08) 100%),
    url("../../assets/dishes/ai/32-beijing-kaoya.png") 106% 58% / 74% auto no-repeat;
  opacity: 0.98;
}

.choice-card.secondary::after {
  position: absolute;
  z-index: -1;
  inset: 0;
  content: "";
  background: linear-gradient(135deg, rgba(227, 168, 51, 0.08), transparent 56%);
}

.choice-card.secondary strong,
.choice-card.secondary p {
  max-width: 72%;
  text-shadow: 0 1px 0 rgba(7, 31, 27, 0.7), 0 0 18px rgba(7, 31, 27, 0.58);
}

.choice-number {
  position: absolute;
  top: 16px;
  right: 20px;
  color: rgba(255, 255, 255, 0.2);
  font: 700 58px/1 var(--mono);
  letter-spacing: -0.1em;
}

.secondary .choice-number {
  color: rgba(255, 255, 255, 0.2);
}

.choice-kicker {
  display: block;
  margin-bottom: 30px;
  color: var(--fire);
  font: 700 10px/1 var(--mono);
  letter-spacing: 0.12em;
}

.secondary .choice-kicker {
  color: var(--fire);
}

.choice-card strong {
  display: block;
  max-width: 85%;
  font: 700 30px/1.08 var(--display);
  letter-spacing: -0.04em;
}

.choice-card p {
  max-width: 80%;
  margin: 10px 0 0;
  color: rgba(255, 250, 240, 0.68);
  font-size: 12px;
  line-height: 1.65;
}

.secondary p {
  color: rgba(255, 250, 240, 0.68);
}

.choice-arrow {
  position: absolute;
  right: 20px;
  bottom: 20px;
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border: 1px solid currentColor;
  border-radius: 50%;
  font-size: 22px;
}

.stage-tag,
.tag,
.mini-tag {
  display: inline-flex;
  min-height: 25px;
  padding: 0 9px;
  align-items: center;
  border: 1px solid currentColor;
  border-radius: 999px;
  font: 700 10px/1 var(--mono);
  letter-spacing: 0.04em;
}

.stage-tag {
  color: var(--good);
}

.recipe-strip {
  display: grid;
  gap: 12px;
  grid-auto-columns: minmax(255px, 78%);
  grid-auto-flow: column;
  overflow-x: auto;
  padding: 2px 2px 12px;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
}

.recipe-strip::-webkit-scrollbar {
  display: none;
}

.recipe-strip > * {
  scroll-snap-align: start;
}

.pantry-summary-card,
.paper-card,
.settings-card,
.safety-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 250, 240, 0.76);
  box-shadow: 0 8px 22px rgba(43, 33, 21, 0.05);
}

.pantry-summary-card {
  position: relative;
  display: grid;
  min-height: 124px;
  padding: 18px;
  grid-template-columns: 1fr auto;
  align-items: center;
  overflow: hidden;
}

.pantry-summary-card::after {
  position: absolute;
  right: -35px;
  bottom: -55px;
  width: 145px;
  height: 145px;
  content: "";
  border: 1px solid rgba(23, 63, 54, 0.15);
  border-radius: 50%;
  box-shadow: 0 0 0 18px rgba(23, 63, 54, 0.035), 0 0 0 36px rgba(23, 63, 54, 0.025);
}

.pantry-summary-card strong {
  display: block;
  color: var(--smoke);
  font: 700 25px/1.1 var(--display);
}

.pantry-summary-card p {
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.mini-pixels {
  position: relative;
  z-index: 1;
  display: flex;
}

.mini-pixels img {
  width: 42px;
  height: 42px;
  margin-left: -8px;
  object-fit: contain;
  image-rendering: pixelated;
  filter: drop-shadow(0 5px 4px rgba(36, 31, 26, 0.16));
}

/* 通用菜谱卡 */
.recipe-card {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper-light);
  box-shadow: 0 9px 24px rgba(40, 31, 20, 0.07);
  cursor: pointer;
  transition: transform 0.24s ease, box-shadow 0.24s ease;
}

.recipe-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 15px 30px rgba(40, 31, 20, 0.12);
}

.recipe-card-media {
  position: relative;
  overflow: hidden;
  aspect-ratio: 1.24 / 1;
  background:
    linear-gradient(135deg, rgba(198, 87, 60, 0.12), rgba(23, 63, 54, 0.08)),
    var(--paper-deep);
}

.recipe-card-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s ease;
}

.recipe-card:hover .recipe-card-media img {
  transform: scale(1.04);
}

.image-fallback::after {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: var(--smoke);
  content: "烟火有谱";
  font: 700 20px/1 var(--display);
}

.favorite-button {
  position: absolute;
  z-index: 2;
  top: 10px;
  right: 10px;
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  color: var(--smoke);
  border: 0;
  border-radius: 50%;
  background: rgba(255, 250, 240, 0.9);
  box-shadow: 0 6px 18px rgba(20, 25, 20, 0.15);
  cursor: pointer;
  font-size: 19px;
}

.favorite-button.saved {
  color: var(--cinnabar);
}

.recipe-card-body {
  padding: 14px;
}

.card-meta {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: space-between;
  color: var(--muted);
  font: 10px/1.3 var(--mono);
}

.recipe-card h3 {
  margin: 9px 0 4px;
  color: var(--smoke);
  font: 700 23px/1.08 var(--display);
  letter-spacing: -0.04em;
}

.recipe-card .en-name {
  min-height: 28px;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.4;
}

.match-line {
  display: flex;
  gap: 7px;
  align-items: center;
  margin-top: 11px;
  padding-top: 10px;
  color: var(--good);
  border-top: 1px solid var(--line);
  font-size: 11px;
}

.match-line.missing {
  color: var(--warning);
}

.match-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
}

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

.recipe-grid .recipe-card h3 {
  font-size: 20px;
}

/* 搜索、筛选 */
.search-bar {
  position: relative;
  display: flex;
  gap: 8px;
  margin: 15px 0 14px;
}

.search-input {
  width: 100%;
  min-height: 50px;
  padding: 0 48px 0 17px;
  color: var(--ink);
  border: 1px solid var(--line-strong);
  border-radius: 15px;
  background: rgba(255, 250, 240, 0.72);
}

.search-input::placeholder {
  color: #999084;
}

.search-symbol {
  position: absolute;
  top: 50%;
  right: 17px;
  width: 18px;
  height: 18px;
  pointer-events: none;
  border: 1.7px solid var(--smoke);
  border-radius: 50%;
  transform: translateY(-56%);
}

.search-symbol::after {
  position: absolute;
  right: -5px;
  bottom: -3px;
  width: 7px;
  height: 1.7px;
  content: "";
  background: var(--smoke);
  transform: rotate(45deg);
}

.chip-row {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 2px 1px 8px;
  scrollbar-width: none;
}

.chip-row::-webkit-scrollbar {
  display: none;
}

.chip {
  flex: 0 0 auto;
  min-height: 36px;
  padding: 0 14px;
  color: var(--smoke);
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: rgba(255, 250, 240, 0.7);
  cursor: pointer;
  font-size: 12px;
}

.chip.active,
.chip[aria-pressed="true"] {
  color: var(--paper-light);
  border-color: var(--smoke);
  background: var(--smoke);
}

.filter-summary {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  margin: 10px 0 14px;
  color: var(--muted);
  font-size: 12px;
}

.filter-summary strong {
  color: var(--smoke);
}

.select-compact {
  min-height: 36px;
  padding: 0 30px 0 11px;
  color: var(--smoke);
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--paper-light);
}

/* 食材篮 */
.pantry-board {
  position: relative;
  min-height: 154px;
  padding: 20px;
  overflow: hidden;
  color: var(--paper-light);
  border-radius: var(--radius-lg);
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.06), transparent),
    var(--smoke);
}

.pantry-board::before,
.pantry-board::after {
  position: absolute;
  content: "";
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 50%;
}

.pantry-board::before {
  right: -50px;
  bottom: -92px;
  width: 210px;
  height: 210px;
}

.pantry-board::after {
  right: -20px;
  bottom: -62px;
  width: 150px;
  height: 150px;
}

.pantry-board strong {
  position: relative;
  z-index: 1;
  display: block;
  font: 700 31px/1 var(--display);
}

.pantry-board p {
  position: relative;
  z-index: 1;
  margin: 8px 0 16px;
  color: rgba(255, 250, 240, 0.68);
  font-size: 12px;
}

.selected-ingredient-row {
  position: relative;
  z-index: 1;
  display: flex;
  gap: 8px;
  max-width: calc(100% - 10px);
  min-height: 50px;
  align-items: center;
  overflow-x: auto;
  scrollbar-width: none;
}

.selected-pixel {
  position: relative;
  display: grid;
  width: 48px;
  height: 48px;
  flex: 0 0 48px;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 13px;
  background: rgba(255, 255, 255, 0.1);
}

.selected-pixel img {
  width: 37px;
  height: 37px;
  object-fit: contain;
  image-rendering: pixelated;
}

.selected-remove {
  position: absolute;
  z-index: 2;
  top: 2px;
  right: 2px;
  display: grid;
  width: 18px;
  height: 18px;
  padding: 0;
  place-items: center;
  color: white;
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: 50%;
  background: var(--cinnabar);
  box-shadow: 0 3px 8px rgba(18, 24, 20, 0.32);
  cursor: pointer;
  font: 700 13px/1 var(--body);
}

.selected-remove:hover {
  background: var(--cinnabar-dark);
  transform: scale(1.08);
}

.custom-pixel {
  color: var(--fire);
  font: 700 20px/1 var(--display);
}

.feature-shortcuts {
  display: grid;
  gap: 10px;
  margin: 14px 0 18px;
  grid-template-columns: 1fr 1fr;
}

.feature-shortcut {
  min-height: 82px;
  padding: 13px;
  text-align: left;
  color: var(--smoke);
  border: 1px dashed var(--line-strong);
  border-radius: 16px;
  background: rgba(255, 250, 240, 0.5);
  cursor: pointer;
}

.feature-shortcut span {
  display: inline-block;
  margin-bottom: 8px;
  color: var(--cinnabar);
  font: 700 9px/1 var(--mono);
  letter-spacing: 0.06em;
}

.feature-shortcut strong {
  display: block;
  font-size: 13px;
}

.feature-shortcut.enabled {
  border-style: solid;
  border-color: rgba(23, 63, 54, 0.28);
  background: linear-gradient(145deg, rgba(255, 250, 240, 0.9), rgba(219, 229, 214, 0.7));
  box-shadow: 0 10px 24px rgba(23, 63, 54, 0.07);
}

.feature-shortcut.enabled span::before {
  content: "● ";
  color: var(--good);
}

.ingredient-grid {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.ingredient-tile {
  position: relative;
  display: flex;
  min-width: 0;
  min-height: 104px;
  padding: 9px 5px 10px;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 7px;
  color: var(--smoke);
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255, 250, 240, 0.65);
  cursor: pointer;
  transition: transform 0.2s ease, background 0.2s ease;
}

.ingredient-tile:hover {
  transform: translateY(-2px);
}

.ingredient-tile img {
  width: 54px;
  height: 54px;
  object-fit: contain;
  image-rendering: pixelated;
  filter: drop-shadow(0 5px 3px rgba(36, 31, 26, 0.12));
}

.ingredient-tile span {
  max-width: 100%;
  overflow: hidden;
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ingredient-tile.selected {
  color: var(--paper-light);
  border-color: var(--smoke);
  background: var(--smoke);
}

.ingredient-tile.selected::after {
  position: absolute;
  top: 7px;
  right: 7px;
  display: grid;
  width: 20px;
  height: 20px;
  place-items: center;
  color: var(--smoke);
  content: "✓";
  background: var(--fire);
  border-radius: 50%;
  font-size: 12px;
  font-weight: 800;
}

.custom-add {
  display: flex;
  gap: 8px;
  margin: 18px 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255, 250, 240, 0.6);
}

.custom-add input {
  min-width: 0;
  min-height: 44px;
  flex: 1;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--paper-light);
}

.primary-button,
.secondary-button,
.ghost-button,
.danger-button {
  display: inline-flex;
  min-height: 48px;
  padding: 0 18px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: 14px;
  cursor: pointer;
  font-weight: 700;
  text-decoration: none;
}

.primary-button {
  color: var(--paper-light);
  border: 1px solid var(--smoke);
  background: var(--smoke);
  box-shadow: 0 9px 18px rgba(23, 63, 54, 0.18);
}

.primary-button.fire {
  color: var(--ink);
  border-color: var(--fire);
  background: var(--fire);
}

.secondary-button {
  color: var(--cinnabar-dark);
  border: 1px solid var(--cinnabar);
  background: transparent;
}

.ghost-button {
  color: var(--smoke);
  border: 1px solid var(--line-strong);
  background: rgba(255, 250, 240, 0.5);
}

.danger-button {
  color: var(--danger);
  border: 1px solid rgba(164, 58, 47, 0.3);
  background: rgba(164, 58, 47, 0.06);
}

.wide-button {
  width: 100%;
}

.sticky-action {
  position: sticky;
  z-index: 20;
  bottom: calc(var(--nav-height) + 8px);
  display: flex;
  gap: 8px;
  margin: 22px -4px 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 250, 240, 0.92);
  box-shadow: 0 12px 32px rgba(36, 31, 26, 0.14);
  backdrop-filter: blur(18px);
}

.sticky-action > * {
  flex: 1;
}

/* 推荐 */
.result-stats {
  display: grid;
  gap: 8px;
  margin: 16px 0;
  grid-template-columns: repeat(3, 1fr);
}

.result-stat {
  padding: 13px 8px;
  text-align: center;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: rgba(255, 250, 240, 0.6);
}

.result-stat strong,
.result-stat span {
  display: block;
}

.result-stat strong {
  color: var(--smoke);
  font: 700 24px/1 var(--display);
}

.result-stat span {
  margin-top: 5px;
  color: var(--muted);
  font-size: 10px;
}

.recommendation-list {
  display: grid;
  gap: 13px;
}

.recommendation-card {
  display: grid;
  min-height: 150px;
  overflow: hidden;
  grid-template-columns: 128px 1fr;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper-light);
  box-shadow: 0 8px 22px rgba(43, 33, 21, 0.06);
}

.recommendation-card .rec-image {
  position: relative;
  min-height: 100%;
  overflow: hidden;
  background: var(--paper-deep);
  cursor: pointer;
}

.recommendation-card .rec-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.rec-copy {
  min-width: 0;
  padding: 13px 13px 12px;
}

.rec-copy h3 {
  margin: 7px 0 5px;
  color: var(--smoke);
  font: 700 22px/1 var(--display);
}

.rec-reason {
  margin: 7px 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.55;
}

.ingredient-mini-list {
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
  margin-top: 8px;
}

.ingredient-mini-list span {
  padding: 4px 7px;
  color: var(--smoke);
  border-radius: 999px;
  background: rgba(23, 63, 54, 0.08);
  font-size: 9px;
}

.ingredient-mini-list span.missing {
  color: var(--cinnabar-dark);
  background: rgba(198, 87, 60, 0.1);
}

.rec-actions {
  display: flex;
  gap: 9px;
  margin-top: 10px;
}

.small-button {
  min-height: 32px;
  padding: 0 10px;
  color: var(--smoke);
  border: 1px solid var(--line);
  border-radius: 9px;
  background: transparent;
  cursor: pointer;
  font-size: 10px;
}

.small-button.ai {
  color: var(--cinnabar-dark);
  border-style: dashed;
}

/* 详情 */
.detail-page {
  padding: 0 0 42px;
}

.detail-hero {
  position: relative;
  min-height: 390px;
  overflow: hidden;
  background: var(--paper-deep);
}

.detail-hero > img {
  width: 100%;
  height: 390px;
  object-fit: cover;
}

.detail-hero::after {
  position: absolute;
  inset: 42% 0 0;
  content: "";
  background: linear-gradient(transparent, rgba(23, 24, 18, 0.84));
}

.back-button {
  position: absolute;
  z-index: 3;
  top: 16px;
  left: 16px;
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  color: var(--smoke);
  border: 0;
  border-radius: 50%;
  background: rgba(255, 250, 240, 0.9);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
  cursor: pointer;
  font-size: 23px;
}

.detail-title-block {
  position: absolute;
  z-index: 2;
  right: 18px;
  bottom: 21px;
  left: 18px;
  color: white;
}

.detail-title-block h1 {
  margin: 9px 0 4px;
  font: 700 clamp(38px, 11vw, 62px)/0.94 var(--display);
  letter-spacing: -0.06em;
}

.detail-title-block p {
  margin: 0;
  color: rgba(255, 255, 255, 0.72);
  font-size: 11px;
}

.detail-content {
  padding: 18px 16px 0;
}

.fact-row {
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(3, 1fr);
}

.fact {
  padding: 12px 8px;
  text-align: center;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: rgba(255, 250, 240, 0.65);
}

.fact strong,
.fact span {
  display: block;
}

.fact strong {
  color: var(--smoke);
  font: 700 18px/1 var(--display);
}

.fact span {
  margin-top: 5px;
  color: var(--muted);
  font-size: 9px;
}

.match-panel {
  display: grid;
  gap: 10px;
  margin: 14px 0 5px;
  padding: 16px;
  grid-template-columns: 1fr auto;
  align-items: center;
  color: var(--paper-light);
  border-radius: 18px;
  background: var(--smoke);
}

.match-panel strong {
  display: block;
  font-size: 14px;
}

.match-panel p {
  margin: 5px 0 0;
  color: rgba(255, 250, 240, 0.65);
  font-size: 11px;
}

.match-ring {
  display: grid;
  width: 58px;
  height: 58px;
  place-items: center;
  border: 5px solid rgba(255, 255, 255, 0.16);
  border-top-color: var(--fire);
  border-right-color: var(--fire);
  border-radius: 50%;
  font: 700 12px/1 var(--mono);
}

.serving-control {
  display: inline-flex;
  gap: 10px;
  align-items: center;
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--paper-light);
}

.serving-control button {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: var(--paper-deep);
  cursor: pointer;
  font-size: 19px;
}

.serving-control strong {
  min-width: 34px;
  text-align: center;
  font: 700 13px/1 var(--mono);
}

.ingredient-list {
  display: grid;
  gap: 8px;
}

.ingredient-row {
  display: grid;
  min-height: 58px;
  padding: 10px 12px;
  grid-template-columns: 28px 1fr auto;
  gap: 10px;
  align-items: center;
  border-bottom: 1px solid var(--line);
}

.ingredient-state {
  display: grid;
  width: 25px;
  height: 25px;
  place-items: center;
  color: var(--paper-light);
  background: var(--good);
  border-radius: 50%;
  font-size: 12px;
}

.ingredient-state.missing {
  color: var(--cinnabar);
  border: 1px solid var(--cinnabar);
  background: transparent;
}

.ingredient-copy strong,
.ingredient-copy span {
  display: block;
}

.ingredient-copy strong {
  color: var(--smoke);
  font-size: 13px;
}

.ingredient-copy span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 10px;
}

.core-label {
  color: var(--cinnabar-dark);
  font: 700 9px/1 var(--mono);
}

.safety-card {
  position: relative;
  padding: 16px;
  overflow: hidden;
}

.safety-card.warning {
  border-color: rgba(164, 107, 24, 0.36);
  background: rgba(227, 168, 51, 0.09);
}

.safety-card.danger {
  border-color: rgba(164, 58, 47, 0.38);
  background: rgba(164, 58, 47, 0.07);
}

.safety-card h3 {
  margin: 0 0 8px;
  color: var(--smoke);
  font: 700 18px/1.2 var(--display);
}

.safety-card p,
.safety-card li {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.65;
}

.safety-card ul {
  margin: 8px 0 0;
  padding-left: 18px;
}

.step-preview-list {
  display: grid;
  gap: 9px;
}

.step-preview {
  display: grid;
  min-height: 78px;
  padding: 13px;
  grid-template-columns: 36px 1fr;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: rgba(255, 250, 240, 0.55);
}

.step-number {
  color: var(--cinnabar);
  font: 700 23px/1 var(--mono);
}

.step-preview p {
  margin: 0;
  font-size: 12px;
  line-height: 1.6;
}

.step-meta {
  display: flex;
  gap: 8px;
  margin-top: 8px;
  color: var(--muted);
  font: 9px/1 var(--mono);
}

.heritage-preview {
  position: relative;
  padding: 20px;
  overflow: hidden;
  color: var(--paper-light);
  border-radius: 20px;
  background: var(--cinnabar-dark);
}

.heritage-preview::after {
  position: absolute;
  right: -20px;
  bottom: -40px;
  color: rgba(255, 255, 255, 0.08);
  content: "味";
  font: 700 140px/1 var(--display);
}

.heritage-preview h3 {
  position: relative;
  z-index: 1;
  margin: 8px 0;
  font: 700 25px/1.1 var(--display);
}

.heritage-preview p {
  position: relative;
  z-index: 1;
  max-width: 80%;
  margin: 0 0 13px;
  color: rgba(255, 255, 255, 0.72);
  font-size: 11px;
  line-height: 1.65;
}

/* 采购清单 */
.shopping-summary {
  display: grid;
  gap: 10px;
  margin: 14px 0 18px;
  padding: 17px;
  grid-template-columns: 1fr auto;
  align-items: center;
  color: var(--paper-light);
  border-radius: 20px;
  background: var(--smoke);
}

.shopping-summary strong {
  display: block;
  font: 700 25px/1 var(--display);
}

.shopping-summary p {
  margin: 7px 0 0;
  color: rgba(255, 250, 240, 0.66);
  font-size: 11px;
}

.shopping-list {
  display: grid;
  gap: 8px;
}

.shopping-item {
  display: grid;
  min-height: 70px;
  padding: 11px 13px;
  grid-template-columns: 34px 1fr auto;
  gap: 10px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: rgba(255, 250, 240, 0.68);
}

.check-button {
  display: grid;
  width: 30px;
  height: 30px;
  place-items: center;
  color: transparent;
  border: 1.5px solid var(--smoke);
  border-radius: 9px;
  background: transparent;
  cursor: pointer;
}

.shopping-item.checked {
  opacity: 0.58;
}

.shopping-item.checked .check-button {
  color: white;
  background: var(--good);
  border-color: var(--good);
}

.shopping-item.checked .shopping-copy strong {
  text-decoration: line-through;
}

.shopping-copy strong,
.shopping-copy span {
  display: block;
}

.shopping-copy strong {
  color: var(--smoke);
  font-size: 13px;
}

.shopping-copy span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 9px;
}

.remove-button {
  width: 34px;
  height: 34px;
  color: var(--muted);
  border: 0;
  background: none;
  cursor: pointer;
  font-size: 20px;
}

/* 烹饪 */
.cooking-page {
  min-height: calc(100vh - 70px);
  padding-bottom: 25px;
  color: var(--paper-light);
  background:
    radial-gradient(circle at 50% 20%, rgba(227, 168, 51, 0.14), transparent 20rem),
    var(--smoke);
}

body.cooking-mode .bottom-nav {
  transform: translate(-50%, 110%);
}

body.cooking-mode .app-shell {
  padding-bottom: 0;
}

.cook-top {
  display: flex;
  padding: 18px 16px 8px;
  align-items: center;
  justify-content: space-between;
}

.cook-top button {
  min-height: 40px;
  padding: 0 12px;
  color: var(--paper-light);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  cursor: pointer;
}

.cook-progress {
  padding: 8px 16px 18px;
}

.progress-track {
  height: 5px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.12);
  border-radius: 999px;
}

.progress-track span {
  display: block;
  height: 100%;
  background: var(--fire);
  border-radius: inherit;
  transition: width 0.35s ease;
}

.progress-label {
  display: flex;
  margin-top: 8px;
  justify-content: space-between;
  color: rgba(255, 255, 255, 0.6);
  font: 10px/1 var(--mono);
}

.cook-card {
  margin: 0 16px;
  padding: 24px 20px;
  color: var(--ink);
  border-radius: 28px;
  background: var(--paper-light);
  box-shadow: 0 24px 45px rgba(0, 0, 0, 0.2);
}

.cook-card .step-big-number {
  color: var(--cinnabar);
  font: 700 56px/0.8 var(--mono);
  letter-spacing: -0.11em;
}

.cook-card h1 {
  margin: 22px 0 13px;
  color: var(--smoke);
  font: 700 clamp(30px, 8vw, 45px)/1.2 var(--display);
  letter-spacing: -0.04em;
}

.cook-note {
  padding: 12px;
  color: var(--muted);
  border-left: 3px solid var(--fire);
  background: rgba(227, 168, 51, 0.09);
  font-size: 11px;
  line-height: 1.6;
}

.heat-control {
  display: grid;
  gap: 7px;
  margin-top: 20px;
  grid-template-columns: repeat(3, 1fr);
}

.heat-level {
  min-height: 54px;
  padding: 8px;
  text-align: center;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--paper);
  font-size: 11px;
}

.heat-level::before {
  display: block;
  margin-bottom: 5px;
  color: var(--fire);
  content: "▲";
  font-size: 8px;
}

.heat-level.medium::before {
  content: "▲ ▲";
}

.heat-level.high::before {
  content: "▲ ▲ ▲";
}

.heat-level.active {
  color: var(--paper-light);
  border-color: var(--smoke);
  background: var(--smoke);
}

.timer-panel {
  display: grid;
  gap: 10px;
  margin-top: 14px;
  padding: 13px;
  grid-template-columns: 1fr auto;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 14px;
}

.timer-panel strong,
.timer-panel span {
  display: block;
}

.timer-panel strong {
  color: var(--smoke);
  font: 700 23px/1 var(--mono);
}

.timer-panel span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 9px;
}

.cook-actions {
  display: grid;
  gap: 10px;
  margin: 14px 16px 0;
  grid-template-columns: 0.75fr 1.25fr;
}

.cook-actions button {
  min-height: 58px;
  border-radius: 16px;
}

.cook-done {
  text-align: center;
}

.cook-done-mark {
  display: grid;
  width: 86px;
  height: 86px;
  margin: 0 auto 20px;
  place-items: center;
  color: var(--smoke);
  background: var(--fire);
  border-radius: 50% 50% 50% 15%;
  font: 700 45px/1 var(--display);
  transform: rotate(-6deg);
}

/* 我的 */
.profile-hero {
  display: grid;
  gap: 14px;
  padding: 20px;
  grid-template-columns: 1fr auto;
  align-items: center;
  color: var(--paper-light);
  border-radius: var(--radius-lg);
  background: var(--smoke);
}

.profile-hero h1 {
  margin: 0 0 6px;
  font: 700 34px/1 var(--display);
}

.profile-hero p {
  margin: 0;
  color: rgba(255, 255, 255, 0.65);
  font-size: 11px;
}

.profile-seal {
  display: grid;
  width: 68px;
  height: 68px;
  place-items: center;
  color: var(--paper-light);
  border: 2px solid rgba(255, 255, 255, 0.58);
  border-radius: 18px 18px 18px 5px;
  font: 700 35px/1 var(--display);
  transform: rotate(4deg);
}

.profile-stats {
  display: grid;
  gap: 8px;
  margin-top: 10px;
  grid-template-columns: repeat(3, 1fr);
}

.profile-stat {
  padding: 13px 8px;
  text-align: center;
  border-bottom: 1px solid var(--line-strong);
}

.profile-stat strong,
.profile-stat span {
  display: block;
}

.profile-stat strong {
  color: var(--smoke);
  font: 700 25px/1 var(--display);
}

.profile-stat span {
  margin-top: 5px;
  color: var(--muted);
  font-size: 9px;
}

.settings-card {
  margin-top: 12px;
  padding: 16px;
}

.settings-card h3 {
  margin: 0 0 5px;
  color: var(--smoke);
  font: 700 19px/1.2 var(--display);
}

.settings-card > p {
  margin: 0 0 13px;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.55;
}

.preference-grid {
  display: flex;
  gap: 7px;
  flex-wrap: wrap;
}

.preference-chip {
  min-height: 35px;
  padding: 0 11px;
  color: var(--smoke);
  border: 1px solid var(--line);
  border-radius: 999px;
  background: transparent;
  cursor: pointer;
  font-size: 11px;
}

.preference-chip.active {
  color: var(--paper-light);
  border-color: var(--cinnabar-dark);
  background: var(--cinnabar-dark);
}

.feature-list {
  display: grid;
  gap: 8px;
}

.feature-row {
  display: grid;
  min-height: 72px;
  padding: 13px;
  grid-template-columns: 36px 1fr auto;
  gap: 10px;
  align-items: center;
  text-align: left;
  border: 1px dashed var(--line-strong);
  border-radius: 15px;
  background: rgba(255, 250, 240, 0.48);
  cursor: pointer;
}

.feature-icon {
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  color: var(--paper-light);
  background: var(--cinnabar);
  border-radius: 10px 10px 10px 3px;
  font: 700 15px/1 var(--mono);
}

.feature-row strong,
.feature-row span {
  display: block;
}

.feature-row strong {
  color: var(--smoke);
  font-size: 13px;
}

.feature-row span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 9px;
}

.feature-row b {
  color: var(--cinnabar-dark);
  font: 700 9px/1 var(--mono);
}

.feature-row.enabled {
  border-style: solid;
  border-color: rgba(23, 63, 54, 0.24);
  background: linear-gradient(135deg, rgba(255, 250, 240, 0.86), rgba(219, 229, 214, 0.55));
}

.feature-row.enabled .feature-icon {
  background: var(--smoke);
}

.feature-row.enabled > b {
  color: var(--good);
}

/* 空状态 */
.empty-state {
  padding: 45px 24px;
  text-align: center;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  background: rgba(255, 250, 240, 0.42);
}

.empty-mark {
  display: grid;
  width: 74px;
  height: 74px;
  margin: 0 auto 17px;
  place-items: center;
  color: var(--smoke);
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  font: 700 32px/1 var(--display);
}

.empty-state h2 {
  margin: 0 0 8px;
  color: var(--smoke);
  font: 700 24px/1.1 var(--display);
}

.empty-state p {
  max-width: 360px;
  margin: 0 auto 18px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.65;
}

/* 弹层 */
.sheet {
  position: fixed;
  inset: auto 0 0;
  z-index: 100;
  width: min(100%, 620px);
  max-height: min(88vh, 760px);
  margin: auto auto 0;
  padding: 28px 18px calc(22px + env(safe-area-inset-bottom));
  overflow: auto;
  color: var(--ink);
  border: 0;
  border-radius: 28px 28px 0 0;
  background: var(--paper-light);
  box-shadow: 0 -30px 70px rgba(20, 18, 15, 0.25);
}

.sheet::backdrop {
  background: rgba(16, 25, 21, 0.58);
  backdrop-filter: blur(4px);
}

.sheet[open] {
  animation: sheet-up 0.3s cubic-bezier(0.2, 0.78, 0.2, 1) both;
}

@keyframes sheet-up {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

.sheet-handle {
  position: absolute;
  top: 10px;
  left: 50%;
  width: 42px;
  height: 4px;
  background: rgba(36, 31, 26, 0.2);
  border-radius: 999px;
  transform: translateX(-50%);
}

.sheet-close {
  position: absolute;
  top: 17px;
  right: 15px;
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  color: var(--muted);
  border: 0;
  border-radius: 50%;
  background: var(--paper);
  cursor: pointer;
  font-size: 24px;
}

.sheet-kicker {
  color: var(--cinnabar);
  font: 700 10px/1 var(--mono);
  letter-spacing: 0.1em;
}

.sheet h2 {
  max-width: calc(100% - 50px);
  margin: 9px 0 10px;
  color: var(--smoke);
  font: 700 30px/1.05 var(--display);
  letter-spacing: -0.04em;
}

.sheet-lead {
  margin: 0 0 17px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.7;
}

.preview-note {
  margin: 13px 0;
  padding: 13px;
  color: var(--smoke);
  border-left: 3px solid var(--fire);
  background: rgba(227, 168, 51, 0.1);
  font-size: 11px;
  line-height: 1.6;
}

.sheet-actions {
  display: grid;
  gap: 9px;
  margin-top: 17px;
}

.mode-list {
  display: grid;
  gap: 10px;
  margin-top: 16px;
}

.mode-card {
  display: grid;
  min-height: 88px;
  padding: 13px;
  grid-template-columns: 44px 1fr auto;
  gap: 11px;
  align-items: center;
  text-align: left;
  color: var(--smoke);
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--paper);
  cursor: pointer;
}

.mode-card.preview {
  border-style: dashed;
}

.mode-icon {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  color: var(--paper-light);
  background: var(--smoke);
  border-radius: 13px 13px 13px 4px;
  font: 700 21px/1 var(--display);
}

.mode-card strong,
.mode-card span {
  display: block;
}

.mode-card strong {
  font-size: 14px;
}

.mode-card span {
  margin-top: 5px;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.45;
}

.mode-card b {
  color: var(--cinnabar);
  font: 700 9px/1 var(--mono);
}

.game-preview {
  position: relative;
  min-height: 235px;
  margin: 15px 0;
  padding: 14px;
  overflow: hidden;
  color: var(--paper-light);
  border-radius: 20px;
  background:
    linear-gradient(rgba(255, 255, 255, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.04) 1px, transparent 1px),
    #244c41;
  background-size: 16px 16px;
}

.game-hint {
  width: 72%;
  padding: 10px 12px;
  color: var(--smoke);
  border-radius: 13px 13px 13px 3px;
  background: var(--paper-light);
  font-size: 10px;
  line-height: 1.45;
}

.game-stove {
  position: absolute;
  top: 82px;
  left: 50%;
  width: 116px;
  height: 88px;
  border: 9px solid #1c2420;
  border-radius: 50% 50% 42% 42%;
  background: #39473e;
  box-shadow: 0 12px 0 #162019, 0 18px 30px rgba(0, 0, 0, 0.25);
  transform: translateX(-50%);
}

.game-flame {
  position: absolute;
  top: 170px;
  left: 50%;
  color: var(--fire);
  font-size: 22px;
  letter-spacing: -7px;
  transform: translateX(-50%);
}

.game-tray {
  position: absolute;
  right: 13px;
  bottom: 13px;
  left: 13px;
  display: flex;
  min-height: 55px;
  padding: 8px;
  gap: 5px;
  align-items: center;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 13px;
  background: rgba(0, 0, 0, 0.14);
}

.game-tray img {
  width: 39px;
  height: 39px;
  object-fit: contain;
  image-rendering: pixelated;
}

/* 阶段二：AI 确认式交互 */
.provider-row {
  display: flex;
  margin: 6px 42px 10px 0;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.provider-row > span:last-child {
  color: var(--muted);
  font-size: 9px;
}

.provider-badge {
  display: inline-flex;
  min-height: 24px;
  padding: 0 9px;
  align-items: center;
  color: var(--smoke);
  border: 1px solid rgba(23, 63, 54, 0.22);
  border-radius: 999px;
  background: rgba(219, 229, 214, 0.7);
  font: 700 8px/1 var(--mono);
  letter-spacing: 0.04em;
}

.provider-badge.ai-live {
  color: var(--paper-light);
  border-color: var(--smoke);
  background: var(--smoke);
}

.ai-error-card {
  display: grid;
  padding: 16px;
  gap: 8px;
  border-left: 0;
  border: 1px solid rgba(197, 77, 50, 0.24);
  border-radius: 16px;
  background:
    linear-gradient(135deg, rgba(197, 77, 50, 0.11), rgba(227, 168, 51, 0.07)),
    var(--paper);
}

.ai-error-card .ai-error-code {
  width: max-content;
  padding: 5px 8px;
  color: var(--paper-light);
  border-radius: 999px;
  background: var(--cinnabar);
  font: 700 8px/1 var(--mono);
  letter-spacing: 0.08em;
}

.ai-error-card strong {
  color: var(--smoke);
  font-size: 12px;
  line-height: 1.55;
}

.ai-error-card p {
  margin: 0;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.6;
}

.ai-input-label,
.game-control-title {
  display: block;
  margin-bottom: 8px;
  color: var(--smoke);
  font: 700 10px/1 var(--mono);
  letter-spacing: 0.06em;
}

.ai-textarea {
  width: 100%;
  min-height: 112px;
  padding: 14px;
  resize: vertical;
  color: var(--smoke);
  border: 1px solid var(--line-strong);
  border-radius: 16px;
  outline: none;
  background: var(--paper);
  font: 14px/1.7 var(--body);
}

.ai-textarea:focus {
  border-color: var(--cinnabar);
  box-shadow: 0 0 0 3px rgba(198, 74, 45, 0.1);
}

.privacy-note {
  display: grid;
  margin: 13px 0;
  padding: 12px 13px;
  gap: 4px;
  color: var(--muted);
  border: 1px solid rgba(23, 63, 54, 0.14);
  border-radius: 13px;
  background: rgba(219, 229, 214, 0.38);
  font-size: 10px;
  line-height: 1.55;
}

.privacy-note b {
  color: var(--smoke);
}

.ai-loading {
  display: flex;
  min-height: 115px;
  padding: 20px;
  gap: 8px;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  border-radius: 18px;
  background: var(--smoke);
}

.ai-loading span {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--fire);
  animation: ai-pulse 1.05s ease-in-out infinite alternate;
}

.ai-loading span:nth-child(2) { animation-delay: 0.18s; }
.ai-loading span:nth-child(3) { animation-delay: 0.36s; }

.ai-loading b {
  width: 100%;
  color: rgba(255, 255, 255, 0.68);
  text-align: center;
  font-size: 9px;
}

@keyframes ai-pulse {
  to { opacity: 0.28; transform: translateY(-5px); }
}

.ai-candidate-list,
.substitution-results,
.substitution-picker {
  display: grid;
  gap: 8px;
}

.ai-candidate,
.substitution-picker > button,
.substitution-result {
  display: grid;
  min-height: 68px;
  padding: 10px 12px;
  grid-template-columns: 52px 1fr auto;
  gap: 10px;
  align-items: center;
  text-align: left;
  color: var(--smoke);
  border: 1px solid var(--line);
  border-radius: 15px;
  background: var(--paper);
}

.ai-candidate {
  cursor: pointer;
  opacity: 0.62;
}

.ai-candidate.selected {
  opacity: 1;
  border-color: var(--smoke);
  background: rgba(219, 229, 214, 0.52);
}

.ai-candidate img,
.substitution-result img,
.ai-candidate .custom-pixel,
.substitution-result .custom-pixel {
  width: 48px;
  height: 48px;
  object-fit: contain;
  image-rendering: pixelated;
}

.ai-candidate span,
.ai-candidate strong,
.substitution-picker span,
.substitution-picker strong,
.substitution-result span,
.substitution-result strong {
  display: block;
}

.ai-candidate small,
.substitution-picker small,
.substitution-result small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 9px;
  line-height: 1.45;
}

.ai-candidate > b {
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  color: white;
  border-radius: 50%;
  background: var(--smoke);
}

.photo-drop {
  display: grid;
  min-height: 220px;
  padding: 18px;
  gap: 8px;
  place-items: center;
  overflow: hidden;
  color: var(--smoke);
  text-align: center;
  border: 1px dashed var(--line-strong);
  border-radius: 20px;
  background: var(--paper);
  cursor: pointer;
}

.photo-drop.compact { min-height: 145px; }
.photo-drop input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.photo-drop img { width: 100%; max-height: 280px; object-fit: contain; border-radius: 13px; }
.photo-drop small { color: var(--muted); font-size: 9px; }

.photo-preview {
  display: grid;
  min-height: 150px;
  margin-bottom: 12px;
  padding: 12px;
  gap: 8px;
  place-items: center;
  overflow: hidden;
  color: var(--smoke);
  text-align: center;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--paper);
}

.photo-preview img { width: 100%; max-height: 260px; object-fit: contain; border-radius: 13px; }
.photo-preview span { color: var(--muted); font-size: 10px; overflow-wrap: anywhere; }

.photo-source-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.photo-source-button {
  position: relative;
  display: flex;
  min-height: 132px;
  padding: 15px 12px;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 7px;
  color: var(--smoke);
  text-align: center;
  border: 1px solid rgba(23, 63, 54, 0.28);
  border-radius: 18px;
  background: linear-gradient(145deg, rgba(255, 250, 240, 0.96), rgba(219, 229, 214, 0.72));
  box-shadow: 0 10px 22px rgba(23, 63, 54, 0.06);
  cursor: pointer;
}

.photo-source-button.camera {
  border-color: rgba(198, 74, 45, 0.3);
  background: linear-gradient(145deg, rgba(255, 250, 240, 0.96), rgba(239, 211, 188, 0.64));
}

.photo-source-button input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.photo-source-button strong { font-size: 14px; }
.photo-source-button small { color: var(--muted); font-size: 9px; line-height: 1.45; }

.photo-source-icon {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  color: var(--paper-light);
  border-radius: 13px 13px 13px 4px;
  background: var(--smoke);
  font: 700 17px/1 var(--display);
}

.photo-source-button.camera .photo-source-icon { background: var(--cinnabar); }

.photo-file-note {
  margin: 9px 0 0;
  color: var(--muted);
  text-align: center;
  font-size: 9px;
}

.photo-mark {
  display: grid;
  width: 54px;
  height: 54px;
  place-items: center;
  color: var(--paper-light);
  border-radius: 16px 16px 16px 5px;
  background: var(--cinnabar);
  font: 700 24px/1 var(--display);
}

.ai-bullet-list {
  display: grid;
  margin: 0;
  padding: 0;
  gap: 8px;
  list-style: none;
}

.ai-bullet-list li {
  padding: 11px 12px 11px 32px;
  color: var(--smoke);
  border-radius: 12px;
  background: var(--paper);
  font-size: 11px;
  line-height: 1.55;
}

.ai-bullet-list li::before {
  margin-left: -19px;
  margin-right: 9px;
  color: var(--cinnabar);
  content: "谱";
  font-weight: 700;
}

.substitution-picker > button {
  min-height: 64px;
  padding-left: 14px;
  grid-template-columns: 1fr auto;
  cursor: pointer;
}

.substitution-picker > button > b {
  color: var(--cinnabar);
  font-size: 10px;
}

.substitution-result {
  grid-template-columns: 48px 1fr auto;
}

.substitution-result button {
  min-height: 34px;
  padding: 0 9px;
  color: white;
  border: 0;
  border-radius: 999px;
  background: var(--smoke);
  cursor: pointer;
  font-size: 9px;
}

.primary-button:disabled,
.secondary-button:disabled,
.ghost-button:disabled {
  opacity: 0.42;
  cursor: not-allowed;
}

/* 阶段三：无失败烹饪新手小游戏 */
.game-page {
  padding-bottom: 34px;
  background:
    radial-gradient(circle at 25% 25%, rgba(227, 168, 51, 0.17), transparent 24rem),
    linear-gradient(135deg, #173f36, #0e2d27);
}

.game-layout {
  display: grid;
  max-width: 1060px;
  margin: 0 auto;
  padding: 0 16px;
  gap: 12px;
}

.game-stage,
.game-controls {
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 25px;
  background: rgba(255, 255, 255, 0.06);
  box-shadow: 0 24px 45px rgba(0, 0, 0, 0.14);
}

.game-stage {
  position: relative;
  min-height: 395px;
  padding: 23px;
  overflow: hidden;
}

.game-stage::after {
  position: absolute;
  right: -60px;
  bottom: -90px;
  width: 240px;
  height: 240px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 50%;
  content: "";
  box-shadow: 0 0 0 38px rgba(255, 255, 255, 0.025);
}

.game-step-tag {
  color: var(--fire);
  font: 700 9px/1 var(--mono);
  letter-spacing: 0.08em;
}

.game-stage h1 {
  position: relative;
  z-index: 1;
  max-width: 680px;
  margin: 12px 0 10px;
  font: 700 clamp(27px, 6vw, 44px)/1.16 var(--display);
  letter-spacing: -0.035em;
}

.game-feedback {
  position: relative;
  z-index: 1;
  display: inline-block;
  max-width: 520px;
  padding: 9px 12px;
  color: var(--smoke);
  border-radius: 12px 12px 12px 3px;
  background: var(--paper-light);
  font-size: 10px;
  line-height: 1.5;
}

.game-pan-wrap {
  position: absolute;
  right: 50%;
  bottom: 40px;
  width: 190px;
  height: 150px;
  transform: translateX(50%);
}

.game-pan {
  position: absolute;
  z-index: 2;
  right: 16px;
  bottom: 37px;
  display: grid;
  width: 148px;
  height: 83px;
  place-items: center;
  color: var(--fire);
  border: 10px solid #121d19;
  border-radius: 50% 50% 44% 44%;
  background: #2a3b34;
  box-shadow: 0 13px 0 #101916, 0 23px 28px rgba(0, 0, 0, 0.32);
  font: 700 34px/1 var(--display);
}

.game-pan::after {
  position: absolute;
  top: 27px;
  right: -70px;
  width: 72px;
  height: 15px;
  border-radius: 0 999px 999px 0;
  background: #121d19;
  content: "";
}

.game-burner {
  position: absolute;
  right: 25px;
  bottom: 0;
  display: flex;
  width: 130px;
  justify-content: center;
  gap: 2px;
}

.game-burner i {
  display: block;
  width: 19px;
  height: 34px;
  border-radius: 50% 50% 45% 45%;
  background: var(--fire);
  clip-path: polygon(50% 0, 100% 100%, 0 100%);
}

.game-burner.low i:nth-child(n+2),
.game-burner.medium i:nth-child(3) { opacity: 0.2; }

.game-steam {
  position: absolute;
  z-index: 1;
  right: 52px;
  bottom: 110px;
  display: flex;
  gap: 18px;
}

.game-steam i {
  display: block;
  width: 12px;
  height: 42px;
  border-left: 3px solid rgba(255, 255, 255, 0.32);
  border-radius: 50%;
  animation: steam-rise 1.5s ease-in-out infinite alternate;
}

.game-steam i:nth-child(2) { animation-delay: .32s; }
.game-steam i:nth-child(3) { animation-delay: .65s; }

@keyframes steam-rise {
  to { opacity: 0.16; transform: translateY(-10px) rotate(8deg); }
}

.game-heat-label {
  position: absolute;
  z-index: 2;
  right: 20px;
  bottom: 18px;
  color: rgba(255, 255, 255, 0.55);
  font-size: 9px;
}

.game-heat-label strong { color: var(--fire); }

.game-controls {
  padding: 17px;
}

.game-control-block + .game-control-block {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.11);
}

.game-controls .game-control-title { color: rgba(255, 255, 255, 0.7); }

.game-heat-buttons,
.game-action-grid {
  display: grid;
  gap: 7px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.game-heat-buttons button,
.game-action-grid button {
  min-height: 46px;
  color: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.05);
  cursor: pointer;
}

.game-heat-buttons button.active,
.game-action-grid button.suggested {
  color: var(--smoke);
  border-color: var(--fire);
  background: var(--fire);
}

.game-ingredient-tray {
  display: flex;
  gap: 8px;
  overflow-x: auto;
}

.game-tray-empty {
  width: 100%;
  min-height: 58px;
  padding: 13px;
  color: rgba(255, 255, 255, 0.58);
  border: 1px dashed rgba(255, 255, 255, 0.16);
  border-radius: 13px;
  font-size: 9px;
  line-height: 1.55;
}

.game-ingredient-tray button {
  position: relative;
  display: grid;
  min-width: 82px;
  min-height: 90px;
  padding: 8px;
  place-items: center;
  color: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.05);
  cursor: pointer;
  font-size: 9px;
}

.game-ingredient-tray button.ready {
  color: var(--smoke);
  border-color: var(--fire);
  background: var(--paper-light);
}

.game-ingredient-tray img,
.game-ingredient-tray .custom-pixel {
  width: 50px;
  height: 50px;
  object-fit: contain;
  image-rendering: pixelated;
}

.game-ingredient-tray button > b {
  position: absolute;
  top: 5px;
  right: 5px;
  display: grid;
  width: 19px;
  height: 19px;
  place-items: center;
  color: white;
  border-radius: 50%;
  background: var(--good);
}

.game-action-grid {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.game-action-grid button {
  display: grid;
  min-width: 0;
  min-height: 64px;
  padding: 7px 3px;
  place-items: center;
  gap: 4px;
}

.game-action-grid b { font: 700 22px/1 var(--display); }
.game-action-grid span { font-size: 8px; }

.game-complete-page {
  display: grid;
  padding: 35px 16px;
  place-items: center;
}

.game-complete-card {
  width: min(100%, 650px);
  padding: 28px;
  color: var(--ink);
  text-align: center;
  border-radius: 28px;
  background: var(--paper-light);
}

.game-complete-card h1 {
  margin: 12px 0;
  color: var(--smoke);
  font: 700 clamp(29px, 7vw, 45px)/1.15 var(--display);
}

.game-complete-card p { color: var(--smoke); font-size: 13px; }
.game-complete-card small { color: var(--muted); }

.game-score {
  display: flex;
  margin: 20px auto;
  align-items: baseline;
  justify-content: center;
  gap: 8px;
}

.game-score strong { color: var(--cinnabar); font: 700 70px/.8 var(--mono); }
.game-score span { color: var(--muted); font-size: 10px; }

.stage-timeline {
  display: grid;
  gap: 9px;
  margin-top: 17px;
}

.stage-line {
  display: grid;
  padding: 13px;
  grid-template-columns: 28px 1fr auto;
  gap: 10px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 14px;
}

.stage-line.current {
  color: var(--paper-light);
  border-color: var(--smoke);
  background: var(--smoke);
}

.stage-line strong,
.stage-line span {
  display: block;
}

.stage-line strong {
  font-size: 13px;
}

.stage-line span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 9px;
}

.stage-line.current span {
  color: rgba(255, 255, 255, 0.62);
}

.stage-line b {
  color: var(--cinnabar);
  font: 700 9px/1 var(--mono);
}

.stage-line.current b {
  color: var(--fire);
}

.toast {
  position: fixed;
  z-index: 200;
  right: 18px;
  bottom: calc(var(--nav-height) + 20px + env(safe-area-inset-bottom));
  left: 18px;
  max-width: 430px;
  margin: auto;
  padding: 12px 15px;
  color: white;
  text-align: center;
  border-radius: 13px;
  background: rgba(23, 63, 54, 0.94);
  box-shadow: 0 14px 35px rgba(0, 0, 0, 0.2);
  opacity: 0;
  pointer-events: none;
  transform: translateY(14px);
  transition: opacity 0.22s ease, transform 0.22s ease;
  font-size: 12px;
}

.toast.show {
  opacity: 1;
  transform: none;
}

.noscript {
  position: fixed;
  z-index: 999;
  inset: 0;
  display: grid;
  padding: 30px;
  place-items: center;
  color: white;
  text-align: center;
  background: var(--smoke);
}

@media (min-width: 720px) {
  :root {
    --nav-height: 82px;
  }

  .topbar {
    padding-right: 30px;
    padding-left: 30px;
  }

  .page {
    padding: 34px 30px 58px;
  }

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

  .choice-card {
    min-height: 286px;
    padding: 28px;
  }

  .choice-card strong {
    font-size: 39px;
  }

  .choice-kicker {
    margin-bottom: 55px;
  }

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

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

  .recommendation-list {
    grid-template-columns: 1fr 1fr;
  }

  .detail-content {
    max-width: 850px;
    margin: auto;
    padding-right: 28px;
    padding-left: 28px;
  }

  .detail-hero,
  .detail-hero > img {
    height: 510px;
  }

  .cook-card,
  .cook-actions,
  .cook-progress,
  .cook-top {
    max-width: 740px;
    margin-right: auto;
    margin-left: auto;
  }

  .cook-card {
    padding: 38px;
  }

  .game-layout {
    grid-template-columns: minmax(0, 1.2fr) minmax(320px, 0.8fr);
  }

  .game-stage {
    min-height: 570px;
  }

  .game-pan-wrap {
    right: 44%;
    bottom: 90px;
    transform: scale(1.35) translateX(37%);
  }

  .game-controls {
    align-self: stretch;
  }

  .feature-shortcuts {
    max-width: 620px;
  }
}

@media (min-width: 1000px) {
  .recipe-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .main-choices {
    gap: 18px;
  }

  .recipe-strip {
    grid-auto-columns: minmax(280px, 31%);
  }

  .bottom-nav {
    right: auto;
    bottom: 18px;
    left: 50%;
    width: 520px;
    height: 66px;
    padding: 5px 8px;
    border: 1px solid var(--line);
    border-radius: 24px;
    box-shadow: 0 18px 40px rgba(36, 31, 26, 0.16);
  }

  .bottom-nav button.active::after {
    bottom: -5px;
  }

  .sticky-action {
    bottom: 94px;
  }
}

@media (max-width: 390px) {
  .ingredient-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .recipe-grid {
    gap: 9px;
  }

  .recipe-card-body {
    padding: 11px;
  }

  .recipe-grid .recipe-card h3 {
    font-size: 18px;
  }

  .recommendation-card {
    grid-template-columns: 108px 1fr;
  }

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

  .game-stage {
    min-height: 420px;
  }

  .game-pan-wrap {
    transform: translateX(50%) scale(0.9);
  }
}

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