/* 今天吃什么 —— 一副菜谱牌 */

@property --amb1 {
  syntax: "<color>";
  inherits: true;
  initial-value: hsl(24 48% 34%);
}
@property --amb2 {
  syntax: "<color>";
  inherits: true;
  initial-value: hsl(340 30% 22%);
}

:root {
  --bg: #0b0908;
  --text: #f6f1ea;
  --text-2: rgba(246, 241, 234, 0.74);
  --text-3: rgba(246, 241, 234, 0.48);
  --line: rgba(255, 255, 255, 0.12);
  --gold: #d9b77e;
  --gold-soft: rgba(217, 183, 126, 0.55);
  --yes: #9fe3b4;
  --no: #ff9a8a;

  --serif: "Noto Serif SC", "Source Han Serif SC", "Songti SC", "STSong", serif;
  --sans: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", system-ui, sans-serif;

  --spring: linear(0, 0.059, 0.155, 0.305, 0.431, 0.581, 0.688, 0.802, 0.874, 0.944, 0.984, 1.018, 1.034, 1.044, 1.047, 1.045, 1.04, 1.034, 1.028, 1.021, 1.015, 1.01, 1.006, 1.003, 1.001, 0.999, 0.999, 0.998, 0.998, 0.998, 0.998, 0.998, 0.999, 0.999, 0.999, 0.999, 1);
  --out: cubic-bezier(.2, .85, .15, 1);

  --card-w: 320px;
  --card-h: calc(var(--card-w) * 4 / 3);
  --radius: 26px;

  color-scheme: dark;
  transition: --amb1 1.4s ease, --amb2 1.4s ease;
}

@supports not (transition-timing-function: linear(0, 1)) {
  :root { --spring: cubic-bezier(.2, .9, .25, 1.12); }
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }

html, body { height: 100%; }

body {
  margin: 0;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  user-select: none;
  -webkit-user-select: none;
}

button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; padding: 0; }
button:disabled { cursor: default; }
input { font: inherit; color: inherit; }

:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; }

svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- 氛围光：颜色跟着当前这道菜走 ---------- */

.ambient {
  position: fixed;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}

.ambient i {
  position: absolute;
  width: 80vmax;
  height: 80vmax;
  border-radius: 50%;
  filter: blur(70px);
  opacity: 0.7;
  will-change: transform;
}

.ambient i:nth-child(1) {
  left: -25vmax;
  top: -30vmax;
  background: radial-gradient(circle, var(--amb1) 0%, transparent 62%);
  animation: drift-a 26s ease-in-out infinite alternate;
}

.ambient i:nth-child(2) {
  right: -30vmax;
  bottom: -35vmax;
  background: radial-gradient(circle, var(--amb2) 0%, transparent 60%);
  animation: drift-b 32s ease-in-out infinite alternate;
}

.ambient i:nth-child(3) {
  left: 20%;
  top: 30%;
  width: 50vmax;
  height: 50vmax;
  opacity: 0.25;
  background: radial-gradient(circle, var(--amb1) 0%, transparent 65%);
  animation: drift-c 40s ease-in-out infinite alternate;
}

@keyframes drift-a { to { transform: translate(18vw, 14vh) scale(1.15); } }
@keyframes drift-b { to { transform: translate(-16vw, -12vh) scale(1.1); } }
@keyframes drift-c { to { transform: translate(-20vw, 10vh) scale(0.85); } }

.grain {
  position: fixed;
  inset: -50%;
  pointer-events: none;
  opacity: 0.09;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 .6 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  animation: grain 1.2s steps(6) infinite;
  z-index: 60;
  mix-blend-mode: overlay;
}

@keyframes grain {
  0% { transform: translate(0, 0); }
  20% { transform: translate(-3%, 2%); }
  40% { transform: translate(2%, -3%); }
  60% { transform: translate(-2%, -1%); }
  80% { transform: translate(3%, 3%); }
  100% { transform: translate(0, 0); }
}

/* ---------- 玻璃质感 ---------- */

.glass {
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1), 0 10px 30px -12px rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(22px) saturate(150%);
  -webkit-backdrop-filter: blur(22px) saturate(150%);
}

/* ---------- 主界面布局 ---------- */

.app {
  position: relative;
  z-index: 1;
  height: 100%;
  display: grid;
  grid-template-rows: auto auto 1fr auto auto;
  justify-items: center;
  padding: max(14px, env(safe-area-inset-top)) 16px max(18px, env(safe-area-inset-bottom));
}

.bar {
  width: 100%;
  max-width: 980px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 48px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0;
  font-family: var(--serif);
  font-weight: 600;
  font-size: 17px;
  letter-spacing: 0.2em;
}

.brand-mark {
  position: relative;
  width: 16px;
  height: 21px;
  border: 1.5px solid var(--gold);
  border-radius: 4px;
  transform: rotate(-8deg);
}
.brand-mark::after {
  content: "";
  position: absolute;
  inset: 2px -6px -2px 6px;
  border: 1.5px solid var(--gold-soft);
  border-radius: 4px;
  transform: rotate(16deg);
}

.bar-actions { display: flex; gap: 10px; }

.icon-btn {
  position: relative;
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: var(--text);
  transition: transform 0.4s var(--spring), background 0.2s;
}
.icon-btn:hover { background: rgba(255, 255, 255, 0.13); }
.icon-btn:active { transform: scale(0.9); }

.badge {
  position: absolute;
  top: 6px;
  right: 6px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 999px;
  background: var(--gold);
  color: #1a120d;
  font-size: 10px;
  font-weight: 700;
  line-height: 16px;
  text-align: center;
}

/* 餐次切换：滑块跟着走 */
.meal-switch {
  position: relative;
  display: inline-flex;
  margin-top: 10px;
  padding: 4px;
  border-radius: 999px;
}

.meal-thumb {
  position: absolute;
  top: 4px;
  bottom: 4px;
  left: 4px;
  width: 0;
  border-radius: 999px;
  background: var(--text);
  box-shadow: 0 6px 20px -6px rgba(255, 255, 255, 0.45);
  transition: left 0.6s var(--spring), width 0.6s var(--spring);
}

.meal-btn {
  position: relative;
  z-index: 1;
  min-width: 52px;
  padding: 7px 14px;
  border-radius: 999px;
  font-size: 14px;
  letter-spacing: 0.06em;
  color: var(--text-2);
  transition: color 0.35s ease;
}
.meal-btn[aria-pressed="true"] { color: #17110d; font-weight: 600; }

@media (max-width: 380px) {
  .meal-btn { min-width: 0; padding: 7px 11px; font-size: 13px; }
}

/* ---------- 牌桌和卡牌 ---------- */

.table {
  width: 100%;
  display: grid;
  place-items: center;
  min-height: 0;
}

.deck {
  position: relative;
  width: var(--card-w);
  height: var(--card-h);
}

/* 每张牌自带透视，翻牌时不会和后面的牌互相穿插 */
.card {
  position: absolute;
  inset: 0;
  perspective: 1400px;
  will-change: transform, opacity;
  touch-action: none;
}

.card-tilt,
.card-inner {
  position: absolute;
  inset: 0;
  transform-style: preserve-3d;
}

.card-tilt { transition: transform 0.6s var(--out); }
.card.dragging .card-tilt,
.card.tilting .card-tilt { transition: transform 0.12s linear; }

.card.is-top.revealed { cursor: grab; }
.card.dragging { cursor: grabbing; }

/* 待抽时最上面一张轻轻浮动，提示可以点 */
.deck.idle .card.is-top .card-tilt { animation: float 3.6s ease-in-out infinite; }
.deck.idle { cursor: pointer; }

@keyframes float {
  0%, 100% { transform: translateY(0) rotateX(0deg); }
  50% { transform: translateY(-8px) rotateX(3deg); }
}

.card-face {
  position: absolute;
  inset: 0;
  border-radius: var(--radius);
  overflow: hidden;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.12) inset, 0 40px 70px -30px rgba(0, 0, 0, 0.85), 0 12px 24px -12px rgba(0, 0, 0, 0.6);
}

/* 牌背：漆盒 + 回纹 + 金线 */
.card-back {
  background:
    radial-gradient(120% 70% at 50% 0%, #4a2b1c 0%, #22140e 50%, #120b08 100%);
}

.card-back::before {
  content: "";
  position: absolute;
  inset: 0;
  opacity: 0.13;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='28' height='28' viewBox='0 0 28 28'%3E%3Cpath d='M2 26V2h24v20H6V6h16v12H10v-8h8v4' fill='none' stroke='%23d9b77e' stroke-width='1.2'/%3E%3C/svg%3E");
  background-size: 22px 22px;
  background-position: center;
}

.cb-frame {
  position: absolute;
  inset: 12px;
  border: 1px solid var(--gold-soft);
  border-radius: calc(var(--radius) - 9px);
}
.cb-frame::after {
  content: "";
  position: absolute;
  inset: 5px;
  border: 1px solid rgba(217, 183, 126, 0.22);
  border-radius: calc(var(--radius) - 13px);
}

.cb-emblem {
  position: absolute;
  left: 50%;
  top: 46%;
  width: 46%;
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  border: 1px solid var(--gold-soft);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  background: radial-gradient(circle, rgba(217, 183, 126, 0.16) 0%, rgba(18, 11, 8, 0.6) 70%);
  box-shadow: 0 0 0 6px rgba(18, 11, 8, 0.6), 0 0 0 7px rgba(217, 183, 126, 0.25), 0 0 60px rgba(217, 183, 126, 0.18);
  font-family: var(--serif);
  font-weight: 700;
  font-size: calc(var(--card-w) * 0.17);
  line-height: 1;
  color: var(--gold);
  text-shadow: 0 0 24px rgba(217, 183, 126, 0.4);
}

.cb-caption {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 12%;
  text-align: center;
  font-family: var(--serif);
  font-size: calc(var(--card-w) * 0.038);
  letter-spacing: 0.6em;
  text-indent: 0.6em;
  color: rgba(217, 183, 126, 0.75);
}

.cb-sheen {
  position: absolute;
  inset: 0;
  background: linear-gradient(115deg, transparent 30%, rgba(255, 236, 200, 0.09) 46%, transparent 60%);
}

/* 牌面 */
.card-front {
  transform: rotateY(180deg);
  background: #1a1411;
}

.cf-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  pointer-events: none;
  -webkit-user-drag: none;
}

.cf-fallback {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background:
    radial-gradient(90% 60% at 30% 20%, hsl(var(--hue, 24) 55% 42%) 0%, transparent 70%),
    radial-gradient(80% 60% at 80% 90%, hsl(calc(var(--hue, 24) + 40) 45% 30%) 0%, transparent 70%),
    #16100d;
  font-family: var(--serif);
  font-weight: 700;
  font-size: calc(var(--card-w) * 0.62);
  color: rgba(255, 255, 255, 0.08);
}

.cf-shade {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(to top, rgba(8, 6, 5, 0.92) 0%, rgba(8, 6, 5, 0.55) 32%, rgba(8, 6, 5, 0) 58%),
    linear-gradient(to bottom, rgba(8, 6, 5, 0.45) 0%, rgba(8, 6, 5, 0) 22%);
}

.cf-glare {
  position: absolute;
  inset: 0;
  opacity: 0;
  background: radial-gradient(circle at var(--mx, 50%) var(--my, 20%), rgba(255, 255, 255, 0.3), transparent 45%);
  mix-blend-mode: soft-light;
  transition: opacity 0.4s ease;
  pointer-events: none;
}
.card.tilting .cf-glare { opacity: 1; }

.cf-shine {
  position: absolute;
  inset: -10% -60%;
  background: linear-gradient(105deg, transparent 42%, rgba(255, 255, 255, 0.38) 50%, transparent 58%);
  transform: translateX(-100%);
  pointer-events: none;
}

.cf-top {
  position: absolute;
  top: 16px;
  left: 16px;
  right: 16px;
  display: flex;
  justify-content: space-between;
  gap: 8px;
}

.cf-chip {
  padding: 3px 11px;
  border-radius: 999px;
  font-size: 12px;
  letter-spacing: 0.06em;
  background: rgba(10, 8, 6, 0.38);
  border: 1px solid rgba(255, 255, 255, 0.16);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.cf-fav {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: rgba(10, 8, 6, 0.38);
  border: 1px solid rgba(255, 255, 255, 0.16);
  color: #ffb4c0;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}
.cf-fav svg { width: 15px; height: 15px; fill: currentColor; stroke: none; }

.cf-body {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 0 22px 22px;
}

.cf-name {
  margin: 0;
  font-family: var(--serif);
  font-weight: 700;
  font-size: min(calc(var(--card-w) * 0.118), calc(var(--card-w) * 0.82 / var(--len, 5)));
  line-height: 1.2;
  letter-spacing: 0.04em;
  white-space: nowrap;
  text-shadow: 0 2px 20px rgba(0, 0, 0, 0.5);
}

.cf-name .ch {
  display: inline-block;
  opacity: 0;
  transform: translateY(0.4em) rotateX(-60deg);
  filter: blur(6px);
  animation: char-in 0.75s var(--out) forwards;
}

@keyframes char-in {
  to { opacity: 1; transform: none; filter: blur(0); }
}

.cf-summary {
  margin: 6px 0 0;
  font-size: 13px;
  line-height: 1.6;
  color: var(--text-2);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.cf-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 12px;
}

.cf-meta span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
.cf-meta svg { width: 13px; height: 13px; }

/* 拖动时出现的印章 */
.stamp {
  position: absolute;
  top: 64px;
  padding: 6px 16px;
  border: 3px solid currentColor;
  border-radius: 12px;
  font-family: var(--serif);
  font-weight: 700;
  font-size: calc(var(--card-w) * 0.085);
  letter-spacing: 0.12em;
  line-height: 1.2;
  opacity: 0;
  pointer-events: none;
  text-shadow: 0 0 20px currentColor;
  box-shadow: 0 0 24px -4px currentColor, inset 0 0 18px -6px currentColor;
  background: rgba(8, 6, 5, 0.25);
  backdrop-filter: blur(4px);
}
.stamp-no { left: 20px; color: var(--no); transform: rotate(-14deg); }
.stamp-yes { right: 20px; color: var(--yes); transform: rotate(12deg); }

.card.settling .stamp { transition: opacity 0.3s ease; }

/* 牌堆震一下：没有可抽的菜时 */
.deck.shake { animation: shake 0.5s ease; }
@keyframes shake {
  20% { transform: translateX(-10px) rotate(-2deg); }
  40% { transform: translateX(9px) rotate(2deg); }
  60% { transform: translateX(-6px); }
  80% { transform: translateX(4px); }
}

/* ---------- 提示和底部操作 ---------- */

.hint {
  min-height: 22px;
  margin: 14px 0 0;
  font-size: 13px;
  letter-spacing: 0.08em;
  color: var(--text-3);
  text-align: center;
  transition: opacity 0.3s;
}

.hint kbd {
  display: inline-block;
  min-width: 22px;
  margin: 0 3px;
  padding: 0 6px;
  border: 1px solid var(--line);
  border-radius: 6px;
  font-family: var(--sans);
  font-size: 12px;
  line-height: 20px;
  color: var(--text-2);
}

.dock {
  display: flex;
  align-items: center;
  gap: 22px;
  margin-top: 14px;
}

.round {
  width: 62px;
  height: 62px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: var(--text);
  transition: transform 0.5s var(--spring), opacity 0.3s, background 0.2s, color 0.2s, box-shadow 0.3s;
}
.round svg { width: 26px; height: 26px; stroke-width: 1.9; }
.round:disabled { opacity: 0.32; }
.round:not(:disabled):active { transform: scale(0.88) !important; }
.round.lit-no { color: var(--no); background: rgba(255, 154, 138, 0.16); box-shadow: 0 0 40px -6px rgba(255, 154, 138, 0.6); }
.round.lit-yes { color: var(--yes); background: rgba(159, 227, 180, 0.16); box-shadow: 0 0 40px -6px rgba(159, 227, 180, 0.6); }

.round.yes:not(:disabled) svg { fill: rgba(255, 255, 255, 0.0); transition: fill 0.3s; }
.round.yes:not(:disabled):hover svg { fill: currentColor; }

.shuffle {
  position: relative;
  height: 62px;
  min-width: 150px;
  padding: 0 34px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--text);
  color: #17110d;
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 0.32em;
  text-indent: 0.32em;
  box-shadow: 0 16px 40px -14px rgba(255, 244, 228, 0.55), inset 0 -2px 0 rgba(0, 0, 0, 0.08);
  transition: transform 0.5s var(--spring), box-shadow 0.3s, opacity 0.3s;
}
.shuffle span { position: relative; z-index: 1; }
.shuffle::after {
  content: "";
  position: absolute;
  inset: 0 -40%;
  background: linear-gradient(105deg, transparent 40%, rgba(255, 255, 255, 0.85) 50%, transparent 60%);
  transform: translateX(-100%);
  animation: sheen 4.5s ease-in-out 1.5s infinite;
}
.shuffle:active:not(:disabled) { transform: scale(0.94) !important; }
.shuffle:disabled { opacity: 0.55; }
.shuffle:disabled::after { animation: none; }

@keyframes sheen {
  0%, 70% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

.burst {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 55;
}

.toast {
  position: fixed;
  left: 50%;
  top: max(18px, env(safe-area-inset-top));
  z-index: 70;
  padding: 10px 20px;
  border-radius: 999px;
  font-size: 14px;
  color: var(--text);
  background: rgba(30, 24, 20, 0.72);
  border: 1px solid rgba(255, 255, 255, 0.14);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  box-shadow: 0 20px 40px -20px rgba(0, 0, 0, 0.8);
  opacity: 0;
  transform: translate(-50%, -24px) scale(0.96);
  transition: opacity 0.3s ease, transform 0.5s var(--spring);
  pointer-events: none;
}
.toast.show { opacity: 1; transform: translate(-50%, 0) scale(1); }

/* ---------- 菜谱详情 ---------- */

.detail {
  position: fixed;
  inset: 0;
  z-index: 40;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  background: var(--bg);
  user-select: text;
  -webkit-user-select: text;
}

.detail.entering { background: transparent; overflow: hidden; }
.detail.entering > * { visibility: hidden; }

.flyer-backdrop {
  position: fixed;
  inset: 0;
  z-index: 39;
  background: var(--bg);
  pointer-events: none;
}

.flyer {
  position: fixed;
  z-index: 41;
  overflow: hidden;
  background-size: cover;
  background-position: center;
  pointer-events: none;
  box-shadow: 0 40px 80px -30px rgba(0, 0, 0, 0.9);
}

.d-topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 3;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: max(12px, env(safe-area-inset-top)) 14px 12px;
  pointer-events: none;
}

.d-topbar > * { pointer-events: auto; }

.d-topbar::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: rgba(11, 9, 8, 0.6);
  backdrop-filter: blur(20px) saturate(150%);
  -webkit-backdrop-filter: blur(20px) saturate(150%);
  border-bottom: 1px solid var(--line);
  opacity: 0;
  transition: opacity 0.3s ease;
}
.detail.scrolled .d-topbar::before { opacity: 1; }

.d-mini-title {
  flex: 1;
  font-family: var(--serif);
  font-weight: 600;
  font-size: 16px;
  letter-spacing: 0.08em;
  text-align: center;
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 0.3s ease, transform 0.4s var(--out);
}
.detail.scrolled .d-mini-title { opacity: 1; transform: none; }

.d-topbar .icon-btn { flex: none; }
.d-spacer { width: 44px; flex: none; }

.d-hero {
  position: relative;
  height: min(72vh, 680px);
  min-height: 420px;
  overflow: hidden;
}

.d-hero-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform-origin: center top;
  will-change: transform;
}

.d-hero .cf-fallback { font-size: 60vmin; }

.d-hero::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, var(--bg) 0%, rgba(11, 9, 8, 0.6) 28%, rgba(11, 9, 8, 0) 60%), linear-gradient(to bottom, rgba(11, 9, 8, 0.5), transparent 25%);
}

.d-title {
  position: absolute;
  z-index: 1;
  left: 0;
  right: 0;
  bottom: 0;
  max-width: 760px;
  margin: 0 auto;
  padding: 0 24px 26px;
  will-change: opacity, transform;
}

.d-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }

.d-name {
  margin: 0;
  font-family: var(--serif);
  font-weight: 700;
  font-size: clamp(44px, 12vw, 84px);
  line-height: 1.08;
  letter-spacing: 0.04em;
  text-shadow: 0 4px 40px rgba(0, 0, 0, 0.5);
}

.d-body {
  max-width: 760px;
  margin: 0 auto;
  padding: 6px 24px 150px;
}

/* 进场：内容依次浮现 */
.detail [data-in] {
  opacity: 0;
  transform: translateY(26px);
}
.detail.entered [data-in] {
  opacity: 1;
  transform: none;
  transition: opacity 0.7s ease, transform 0.9s var(--out);
  transition-delay: calc(var(--d, 0) * 70ms + 60ms);
}
.detail.leaving [data-in] { opacity: 0; transition: opacity 0.15s ease; transition-delay: 0s; }

.d-summary {
  margin: 0;
  font-family: var(--serif);
  font-size: 18px;
  line-height: 1.95;
  color: var(--text-2);
}

.d-facts {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-top: 26px;
}

.fact {
  padding: 14px 16px;
  border-radius: 18px;
}
.fact dt { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-3); }
.fact dt svg { width: 14px; height: 14px; }
.fact dd { margin: 4px 0 0; font-family: var(--serif); font-weight: 600; font-size: 20px; }

.d-tags { display: flex; flex-wrap: wrap; gap: 8px; margin: 18px 0 0; padding: 0; list-style: none; }
.d-tags li {
  padding: 4px 13px;
  border-radius: 999px;
  border: 1px solid var(--line);
  font-size: 13px;
  color: var(--text-2);
}

.d-section { margin-top: 52px; }

.d-section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}

.d-section-head h2 {
  margin: 0;
  font-family: var(--serif);
  font-weight: 700;
  font-size: 26px;
  letter-spacing: 0.12em;
}

.d-section-head small { font-size: 13px; color: var(--text-3); font-variant-numeric: tabular-nums; }

.progress {
  height: 3px;
  margin: -6px 0 18px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
}
.progress i {
  display: block;
  height: 100%;
  width: calc(var(--p, 0) * 100%);
  border-radius: 3px;
  background: linear-gradient(90deg, var(--gold), #f3dcae);
  transition: width 0.6s var(--spring);
}

.ings {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

@media (min-width: 640px) {
  .ings { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

.ing {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border-radius: 16px;
  text-align: left;
  transition: transform 0.4s var(--spring), background 0.3s;
}
.ing:active { transform: scale(0.96); }

.ing-check {
  flex: none;
  width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
  border: 1.5px solid rgba(255, 255, 255, 0.35);
  border-radius: 50%;
  transition: background 0.3s, border-color 0.3s;
}
.ing-check svg { width: 14px; height: 14px; stroke: #17110d; stroke-width: 2.6; stroke-dasharray: 20; stroke-dashoffset: 20; transition: stroke-dashoffset 0.35s ease 0.05s; }

.ing-text { min-width: 0; display: flex; flex-direction: column; }
.ing-name { font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; transition: color 0.3s; }
.ing-amount { font-size: 12px; color: var(--text-3); }

.ing[aria-pressed="true"] { background: rgba(217, 183, 126, 0.12); }
.ing[aria-pressed="true"] .ing-check { background: var(--gold); border-color: var(--gold); }
.ing[aria-pressed="true"] .ing-check svg { stroke-dashoffset: 0; }
.ing[aria-pressed="true"] .ing-name { color: var(--text-3); text-decoration: line-through; text-decoration-color: var(--gold); }

/* 做法：时间线，滚到哪一步亮哪一步 */
.steps {
  position: relative;
  margin: 0;
  padding: 0;
  list-style: none;
}

.steps::before,
.steps::after {
  content: "";
  position: absolute;
  left: 19px;
  top: 20px;
  bottom: 20px;
  width: 2px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.08);
}
.steps::after {
  bottom: auto;
  height: calc(var(--sp, 0) * (100% - 40px));
  background: linear-gradient(var(--gold), #f3dcae);
  transition: height 0.6s var(--out);
}

.step {
  position: relative;
  display: grid;
  grid-template-columns: 40px 1fr;
  gap: 18px;
  padding-bottom: 30px;
}

.step-no {
  position: relative;
  z-index: 1;
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #17120f;
  border: 1.5px solid rgba(255, 255, 255, 0.18);
  font-family: var(--serif);
  font-weight: 700;
  font-size: 17px;
  color: var(--text-3);
  transition: background 0.4s, color 0.4s, border-color 0.4s, transform 0.5s var(--spring), box-shadow 0.4s;
}

.step-text {
  margin: 0;
  padding-top: 6px;
  font-family: var(--serif);
  font-size: 17px;
  line-height: 1.95;
  color: var(--text-3);
  white-space: pre-line;
  transition: color 0.4s;
}

.step.done .step-no { border-color: var(--gold-soft); color: var(--gold); }
.step.done .step-text { color: var(--text-2); }
.step.active .step-no {
  background: var(--gold);
  border-color: var(--gold);
  color: #17110d;
  transform: scale(1.12);
  box-shadow: 0 0 0 6px rgba(217, 183, 126, 0.15), 0 0 30px rgba(217, 183, 126, 0.35);
}
.step.active .step-text { color: var(--text); }

.steps-html {
  font-family: var(--serif);
  font-size: 17px;
  line-height: 1.95;
  color: var(--text-2);
}
.steps-html img { max-width: 100%; border-radius: 14px; }

.photos {
  display: flex;
  gap: 12px;
  margin: 0 -24px;
  padding: 4px 24px 10px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
}
.photos::-webkit-scrollbar { display: none; }

.photos a {
  flex: none;
  width: min(68vw, 300px);
  aspect-ratio: 3 / 4;
  border-radius: 20px;
  overflow: hidden;
  scroll-snap-align: start;
  background: #17120f;
}
.photos img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.8s var(--out); }
.photos a:hover img { transform: scale(1.05); }

.tips {
  position: relative;
  margin: 0;
  padding: 24px 24px 24px 60px;
  border-radius: 22px;
  font-family: var(--serif);
  font-size: 16px;
  line-height: 1.95;
  color: var(--text-2);
  white-space: pre-line;
}
.tips::before {
  content: "“";
  position: absolute;
  left: 18px;
  top: 6px;
  font-family: var(--serif);
  font-size: 64px;
  line-height: 1;
  color: var(--gold);
}

.d-action {
  position: fixed;
  left: 50%;
  bottom: max(20px, env(safe-area-inset-bottom));
  z-index: 3;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px;
  border-radius: 999px;
  transform: translate(-50%, 140%);
  transition: transform 0.7s var(--spring) 0.35s;
}
.detail.entered .d-action { transform: translate(-50%, 0); }
.detail.leaving .d-action { transform: translate(-50%, 140%); transition-delay: 0s; transition-duration: 0.25s; }

.d-action .pill {
  height: 50px;
  padding: 0 28px;
  border-radius: 999px;
  background: var(--text);
  color: #17110d;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.16em;
  white-space: nowrap;
  transition: transform 0.4s var(--spring), background 0.3s, color 0.3s;
}
.d-action .pill:active { transform: scale(0.95); }
.d-action .pill.done { background: transparent; color: var(--gold); }

/* ---------- 全部菜谱 ---------- */

.gallery {
  position: fixed;
  inset: 0;
  z-index: 30;
  overflow-y: auto;
  overscroll-behavior: contain;
  background: rgba(11, 9, 8, 0.94);
  backdrop-filter: blur(30px);
  -webkit-backdrop-filter: blur(30px);
}

.g-head {
  position: sticky;
  top: 0;
  z-index: 2;
  padding: max(14px, env(safe-area-inset-top)) 20px 14px;
  background: linear-gradient(rgba(11, 9, 8, 0.95) 70%, rgba(11, 9, 8, 0));
}

.g-head-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: 1080px;
  margin: 0 auto;
}

.g-title { margin: 0; font-family: var(--serif); font-weight: 700; font-size: 30px; letter-spacing: 0.1em; }
.g-title small { margin-left: 10px; font-family: var(--sans); font-weight: 400; font-size: 14px; letter-spacing: 0; color: var(--text-3); }

.g-search {
  position: relative;
  max-width: 1080px;
  margin: 14px auto 0;
}
.g-search svg { position: absolute; z-index: 1; left: 16px; top: 50%; width: 18px; height: 18px; transform: translateY(-50%); color: var(--text-3); pointer-events: none; }
.g-search input {
  width: 100%;
  height: 46px;
  padding: 0 16px 0 44px;
  border-radius: 999px;
  outline: none;
  user-select: text;
}
.g-search input::placeholder { color: var(--text-3); }
.g-search input:focus { border-color: rgba(217, 183, 126, 0.6); }

.g-recent {
  max-width: 1080px;
  margin: 18px auto 0;
  padding: 0 20px;
}
.g-recent p { margin: 0 0 10px; font-size: 12px; letter-spacing: 0.16em; color: var(--text-3); }
.g-recent-list { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; padding-bottom: 4px; }
.g-recent-list::-webkit-scrollbar { display: none; }
.g-recent-list button {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px 6px 6px;
  border-radius: 999px;
  font-size: 14px;
}
.g-recent-list img, .g-recent-list .dot { width: 28px; height: 28px; border-radius: 50%; object-fit: cover; background: #2a1e17; }
.g-recent-list small { color: var(--text-3); font-size: 12px; }

.g-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  max-width: 1080px;
  margin: 22px auto 0;
  padding: 0 20px max(40px, env(safe-area-inset-bottom));
}

@media (min-width: 720px) { .g-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; } }
@media (min-width: 1040px) { .g-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }

.tile {
  position: relative;
  display: block;
  width: 100%;
  text-align: left;
  opacity: 0;
  transform: translateY(40px) scale(0.96);
  transition: opacity 0.7s ease, transform 0.9s var(--out);
  transition-delay: calc(var(--d, 0) * 60ms);
}
.tile.in { opacity: 1; transform: none; }
.tile:nth-child(even) { margin-top: 28px; }
@media (min-width: 720px) {
  .tile:nth-child(even) { margin-top: 0; }
  .tile:nth-child(3n + 2) { margin-top: 36px; }
}
@media (min-width: 1040px) {
  .tile:nth-child(3n + 2) { margin-top: 0; }
  .tile:nth-child(even) { margin-top: 36px; }
}

.tile-media {
  position: relative;
  aspect-ratio: 3 / 4;
  border-radius: 22px;
  overflow: hidden;
  background: #17120f;
  box-shadow: 0 30px 50px -30px rgba(0, 0, 0, 0.9);
}
.tile-media img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.9s var(--out); }
.tile:hover .tile-media img { transform: scale(1.06); }
.tile-media .cf-fallback { font-size: 34vw; }
@media (min-width: 720px) { .tile-media .cf-fallback { font-size: 140px; } }
.tile-media::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(8, 6, 5, 0.85), rgba(8, 6, 5, 0) 50%);
}

.tile-text {
  position: absolute;
  z-index: 1;
  left: 14px;
  right: 14px;
  bottom: 14px;
}
.tile-name { display: block; font-family: var(--serif); font-weight: 700; font-size: 19px; letter-spacing: 0.04em; }
.tile-meta { display: block; margin-top: 2px; font-size: 12px; color: var(--text-2); }
.tile .cf-fav { position: absolute; z-index: 1; top: 10px; right: 10px; }
.tile.hidden-by-search { display: none; }

.g-empty { grid-column: 1 / -1; padding: 60px 0; text-align: center; color: var(--text-3); }
.g-empty a { color: var(--gold); }

/* ---------- 底部弹层：口味与时间 ---------- */

.sheet-layer {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.sheet-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(5, 4, 3, 0.55);
  opacity: 0;
  transition: opacity 0.35s ease;
}
.sheet-layer.open .sheet-backdrop { opacity: 1; }

.sheet {
  position: relative;
  width: 100%;
  max-width: 560px;
  padding: 10px 22px max(22px, env(safe-area-inset-bottom));
  border-radius: 30px 30px 0 0;
  background: rgba(28, 22, 18, 0.82);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-bottom: 0;
  backdrop-filter: blur(30px) saturate(160%);
  -webkit-backdrop-filter: blur(30px) saturate(160%);
  transform: translateY(105%);
  transition: transform 0.65s var(--spring);
}
.sheet-layer.open .sheet { transform: none; }

@media (min-width: 640px) {
  .sheet-layer { align-items: center; }
  .sheet { border-radius: 30px; border-bottom: 1px solid rgba(255, 255, 255, 0.1); transform: translateY(40px) scale(0.96); opacity: 0; transition: transform 0.6s var(--spring), opacity 0.3s; }
  .sheet-layer.open .sheet { opacity: 1; }
}

.sheet-handle { width: 40px; height: 5px; margin: 0 auto 14px; border-radius: 3px; background: rgba(255, 255, 255, 0.25); }

.sheet h2 { margin: 0 0 4px; font-family: var(--serif); font-weight: 700; font-size: 22px; letter-spacing: 0.1em; }
.sheet-sub { margin: 0 0 20px; font-size: 13px; color: var(--text-3); }
.sheet-label { margin: 0 0 10px; font-size: 12px; letter-spacing: 0.16em; color: var(--text-3); }

.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 22px; }
.chip {
  min-height: 38px;
  padding: 6px 16px;
  border-radius: 999px;
  border: 1px solid var(--line);
  font-size: 14px;
  color: var(--text-2);
  transition: transform 0.4s var(--spring), background 0.25s, color 0.25s, border-color 0.25s;
}
.chip:active { transform: scale(0.93); }
.chip[aria-pressed="true"] { background: var(--text); border-color: var(--text); color: #17110d; font-weight: 600; }

.sheet-actions { display: flex; gap: 10px; }
.sheet-actions .reset { height: 50px; padding: 0 20px; border-radius: 999px; color: var(--text-2); }
.sheet-actions .apply {
  flex: 1;
  height: 50px;
  border-radius: 999px;
  background: var(--text);
  color: #17110d;
  font-weight: 600;
  letter-spacing: 0.1em;
  transition: transform 0.4s var(--spring), opacity 0.2s;
}
.sheet-actions .apply:disabled { opacity: 0.4; }
.sheet-actions .apply:active:not(:disabled) { transform: scale(0.97); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    transition-delay: 0s !important;
  }
  .grain { animation: none; }
}
