:root {
  --ink: #3d2c24;
  --ink-soft: #6b5241;
  --cream: #fff8e8;
  --paper: #f7ead0;
  --paper-deep: #ead4ad;
  --terracotta: #c75d3e;
  --terracotta-deep: #9d432d;
  --sage: #7e9a61;
  --sage-deep: #4d6840;
  --gold: #e7b24a;
  --shadow: 0 0.28rem 0 rgba(61, 44, 36, 0.22), 0 0.8rem 1.8rem rgba(39, 28, 19, 0.16);
  --font: "Microsoft YaHei", "PingFang SC", "Noto Sans SC", "Hiragino Sans GB", sans-serif;
  --display: "KaiTi", "STKaiti", "Kaiti SC", "FZKai-Z03", "Microsoft YaHei", serif;
}

* { box-sizing: border-box; }

html, body {
  height: 100%;
  margin: 0;
}

body {
  background:
    radial-gradient(circle at 18% 12%, rgba(199, 93, 62, 0.22), transparent 25%),
    radial-gradient(circle at 84% 82%, rgba(126, 154, 97, 0.22), transparent 30%),
    linear-gradient(160deg, #26382a, #18241c 70%);
  color: var(--ink);
  font-family: var(--font);
  overflow: hidden;
  display: grid;
  place-items: center;
  -webkit-tap-highlight-color: transparent;
}

button { font-family: inherit; }
button:focus-visible { outline: 3px solid #f2c75f; outline-offset: 3px; }

.pond-bg {
  position: fixed;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}
.blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(60px);
  opacity: 0.32;
}
.blob-a {
  width: 46vmax; height: 46vmax;
  left: -18vmax; top: -18vmax;
  background: #a77a52;
}
.blob-b {
  width: 38vmax; height: 38vmax;
  right: -12vmax; bottom: -12vmax;
  background: #60805a;
}
.grain {
  position: absolute;
  inset: 0;
  opacity: 0.035;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='180' height='180' filter='url(%23n)' opacity='.9'/%3E%3C/svg%3E");
}

#game-frame {
  position: relative;
  width: min(calc(100vw - 28px), calc((100dvh - 28px) * 1.77778));
  aspect-ratio: 16 / 9;
  max-height: calc(100dvh - 28px);
  filter: drop-shadow(0 30px 50px rgba(0, 0, 0, 0.4));
}

#game-shell {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
  border-radius: 20px;
  border: 1px solid rgba(255, 240, 207, 0.22);
  background: #8caa6f;
  font-size: calc(var(--u, 1) * 16px);
  isolation: isolate;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

#game-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  outline: none;
}

.canvas-grain {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  opacity: 0.05;
  mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='g'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.75' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='200' height='200' filter='url(%23g)' opacity='.8'/%3E%3C/svg%3E");
}
.canvas-vignette {
  position: absolute;
  inset: 0;
  z-index: 3;
  pointer-events: none;
  box-shadow: inset 0 0 6rem rgba(44, 34, 20, 0.2), inset 0 0 2rem rgba(44, 34, 20, 0.08);
}

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

/* ------------------------------------------------------------------ */
/* 游戏 HUD                                                            */
/* ------------------------------------------------------------------ */

#game-ui {
  position: absolute;
  inset: 0;
  z-index: 6;
  pointer-events: none;
}

.hud {
  position: absolute;
  top: 1rem;
  left: 1.15rem;
  right: 1.15rem;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.8rem;
  pointer-events: none;
}
.hud-left, .hud-right {
  display: flex;
  align-items: flex-start;
  gap: 0.55rem;
  pointer-events: auto;
}
.hud-right { align-items: center; }

.hud-chip {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  min-height: 2.75rem;
  padding: 0.28rem 0.8rem 0.32rem 0.6rem;
  border: 2px solid var(--ink);
  border-radius: 0.85rem;
  background: rgba(255, 248, 232, 0.94);
  box-shadow: 0 0.2rem 0 rgba(61, 44, 36, 0.28), 0 0.6rem 1.2rem rgba(42, 30, 20, 0.12);
  backdrop-filter: blur(6px);
  white-space: nowrap;
}
.day-chip { padding-right: 0.72rem; }
.chip-ornament {
  width: 1.75rem;
  height: 1.75rem;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #f5dfae;
  border: 1.5px solid #b68f51;
  color: #b0643f;
  font-size: 1.05rem;
  line-height: 1;
}
.day-main { display: flex; flex-direction: column; line-height: 1.08; }
.day-main strong { font-size: 0.92rem; letter-spacing: 0.02em; }
.day-main small { font-size: 0.58rem; color: #8d6e50; letter-spacing: 0.06em; }

.coin-chip { gap: 0.34rem; }
.coin-dot {
  width: 1.35rem; height: 1.35rem; border-radius: 50%;
  background:
    radial-gradient(circle at 34% 28%, #fff6c8 0 16%, transparent 17%),
    radial-gradient(circle at 45% 42%, #f2c85f, #db9f31 66%, #a87220);
  border: 1.5px solid #9d6d24;
  box-shadow: inset 0 -2px 2px rgba(146, 95, 24, 0.35);
  flex: none;
}
.coin-chip strong { font-size: 1.22rem; line-height: 1; font-variant-numeric: tabular-nums; color: #6b4a21; }
.coin-goal { font-size: 0.6rem; color: #947655; margin-left: 0.14rem; }
.coin-goal b { color: #b3752f; }

.timer-card {
  position: absolute;
  left: 50%;
  top: 0;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 0.55rem;
  width: 14.5rem;
  padding: 0.35rem 0.85rem 0.4rem 0.6rem;
  border: 2px solid var(--ink);
  border-radius: 0.9rem;
  background: rgba(64, 46, 32, 0.9);
  color: var(--cream);
  box-shadow: 0 0.22rem 0 rgba(35, 24, 16, 0.35), 0 0.8rem 1.4rem rgba(31, 22, 14, 0.18);
  backdrop-filter: blur(7px);
  pointer-events: auto;
}
.sun-icon {
  width: 2.05rem;
  height: 2.05rem;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: radial-gradient(circle at 40% 35%, #ffe7a2, #e7b24a 68%);
  color: #9a5d23;
  font-size: 1.15rem;
  border: 1.5px solid #c08a2b;
  box-shadow: 0 0 0.7rem rgba(240, 195, 95, 0.3);
  flex: none;
}
.timer-inner { flex: 1; min-width: 0; }
.timer-row { display: flex; align-items: baseline; justify-content: space-between; gap: 0.5rem; }
.timer-row strong { font-size: 1rem; letter-spacing: 0.04em; font-variant-numeric: tabular-nums; }
.timer-row span { font-size: 0.56rem; color: #e3cfab; letter-spacing: 0.08em; }
.timer-track {
  height: 0.3rem;
  margin-top: 0.22rem;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(255, 244, 219, 0.18);
}
.timer-track i {
  display: block;
  height: 100%;
  width: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #e7b24a, #f3d27e);
  transition: width 0.25s linear, background 0.3s;
}
.timer-card.urgent .timer-track i { background: linear-gradient(90deg, #d75a42, #eea167); }
.timer-card.urgent .sun-icon { animation: pulseSun 1s infinite alternate; }

.hearts { display: flex; align-items: center; gap: 0.1rem; padding-right: 0.25rem; filter: drop-shadow(0 2px 0 rgba(66, 43, 29, 0.18)); }
.heart {
  width: 1.45rem;
  height: 1.45rem;
  display: grid;
  place-items: center;
  transition: transform 0.2s;
}
.heart svg { width: 100%; height: 100%; overflow: visible; }
.heart svg path {
  fill: #c95a48;
  stroke: #5e2e25;
  stroke-width: 1.1;
  stroke-linejoin: round;
}
.heart.empty { opacity: 0.72; }
.heart.empty svg path {
  fill: rgba(255, 248, 232, 0.12);
  stroke: rgba(255, 248, 232, 0.72);
  stroke-width: 1.4;
}
.heart.beat { animation: heartBeat 0.35s ease; }

.icon-btn {
  width: 2.55rem;
  height: 2.55rem;
  display: grid;
  place-items: center;
  border: 2px solid var(--ink);
  border-radius: 0.8rem;
  background: rgba(255, 248, 232, 0.94);
  color: var(--ink);
  cursor: pointer;
  padding: 0;
  box-shadow: 0 0.18rem 0 rgba(61, 44, 36, 0.28);
  transition: transform 0.15s, background 0.15s;
}
.icon-btn:hover { transform: translateY(-2px); background: #fffdf3; }
.icon-btn:active { transform: translateY(1px); box-shadow: 0 0.06rem 0 rgba(61, 44, 36, 0.28); }
.icon-btn svg {
  width: 1.25rem; height: 1.25rem;
  fill: none; stroke: currentColor; stroke-width: 1.8;
  stroke-linecap: round; stroke-linejoin: round;
}
#sound-btn svg path:first-child { fill: currentColor; stroke-width: 1.2; }
#sound-btn .ico-off { display: none; }
#sound-btn.muted .ico-on { display: none; }
#sound-btn.muted .ico-off { display: block; }

/* 任务卡 */
.quest-card {
  position: absolute;
  top: 6.5rem;
  left: 1.25rem;
  width: 16.5rem;
  padding: 0.55rem 0.7rem 0.6rem;
  border: 1.5px solid rgba(88, 63, 43, 0.65);
  border-radius: 0.7rem;
  background: rgba(255, 248, 231, 0.9);
  box-shadow: 0 0.18rem 0 rgba(61, 44, 36, 0.15);
  transform: rotate(-0.45deg);
  transition: opacity 0.4s, transform 0.4s;
  pointer-events: none;
  backdrop-filter: blur(4px);
}
.quest-card.done {
  opacity: 0;
  transform: translateY(-6px) rotate(-0.45deg);
}
.quest-tag {
  display: inline-block;
  margin-bottom: 0.28rem;
  font-size: 0.5rem;
  letter-spacing: 0.16em;
  color: #9a5b36;
  font-weight: 700;
}
.quest-body { display: flex; align-items: center; gap: 0.42rem; font-size: 0.7rem; font-weight: 700; color: #55402e; }
.quest-check {
  width: 1.2rem; height: 1.2rem; flex: none;
  display: grid; place-items: center;
  border-radius: 50%;
  border: 1.5px solid #b38d5d;
  background: #f2dfba;
  font-size: 0.6rem;
  color: #7f5d39;
}
.quest-card.complete .quest-check { background: #7e9a61; border-color: #5c7749; color: #fff8df; }

/* 顶部提示条 */
.banner {
  position: absolute;
  top: 21%;
  left: 50%;
  transform: translate(-50%, 8px);
  z-index: 12;
  min-width: 21rem;
  padding: 0.65rem 1.7rem 0.75rem;
  text-align: center;
  color: #fff5dc;
  background: rgba(57, 42, 29, 0.86);
  border: 1.5px solid rgba(255, 239, 200, 0.35);
  border-radius: 0.85rem;
  box-shadow: 0 0.4rem 1.5rem rgba(30, 22, 14, 0.28);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.35s, transform 0.35s;
  backdrop-filter: blur(8px);
}
.banner.show { opacity: 1; transform: translate(-50%, 0); }
.banner span { display: block; font-size: 0.55rem; letter-spacing: 0.26em; color: #e6bd7a; }
.banner strong { display: block; margin: 0.2rem 0 0.12rem; font-family: var(--display); font-size: 1.7rem; letter-spacing: 0.06em; line-height: 1.1; }
.banner small { display: block; font-size: 0.62rem; color: #ddceb3; letter-spacing: 0.04em; }

/* Toast */
.toast-stack {
  position: absolute;
  left: 50%;
  bottom: 7.3rem;
  transform: translateX(-50%);
  z-index: 20;
  display: flex;
  flex-direction: column-reverse;
  align-items: center;
  gap: 0.35rem;
  pointer-events: none;
  width: max-content;
  max-width: 80%;
}
.toast {
  padding: 0.38rem 0.9rem 0.4rem;
  border: 1.5px solid rgba(61, 44, 36, 0.85);
  border-radius: 999px;
  background: rgba(255, 248, 232, 0.97);
  color: #4a3628;
  font-size: 0.68rem;
  font-weight: 600;
  box-shadow: 0 0.16rem 0 rgba(61, 44, 36, 0.18), 0 0.6rem 1.2rem rgba(36, 25, 16, 0.16);
  animation: toastIn 0.28s cubic-bezier(0.2, 1.2, 0.4, 1) both;
  white-space: normal;
  text-align: center;
}
.toast.good { border-color: #5d7c47; color: #3e5c2e; background: #f1f7de; }
.toast.warn { border-color: #aa6f2c; color: #7f4e1e; background: #fff3d5; }
.toast.bad { border-color: #a34e3e; color: #7c392d; background: #fbe7de; }
.toast.out { animation: toastOut 0.25s ease forwards; }

/* 底部菜篮 */
.dock {
  position: absolute;
  left: 50%;
  bottom: 0.9rem;
  transform: translateX(-50%);
  display: flex;
  align-items: stretch;
  gap: 0.65rem;
  max-width: calc(100% - 6rem);
  padding: 0.36rem 0.7rem 0.42rem;
  border: 2px solid var(--ink);
  border-radius: 0.95rem;
  background: rgba(255, 248, 232, 0.95);
  box-shadow: 0 0.22rem 0 rgba(61, 44, 36, 0.3), 0 0.8rem 1.6rem rgba(36, 25, 16, 0.16);
  backdrop-filter: blur(7px);
  pointer-events: auto;
}
.dock-group { min-width: 0; }
.dock-heading {
  display: flex;
  align-items: baseline;
  gap: 0.4rem;
  font-size: 0.52rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  color: #7c5d3f;
  line-height: 1;
  margin-bottom: 0.26rem;
}
.dock-heading small { font-size: 0.46rem; font-weight: 500; color: #ac8b67; letter-spacing: 0.03em; }
.pantry-list, .dish-list { display: flex; align-items: center; gap: 0.18rem; min-height: 2.1rem; }
.pantry-item, .dish-item {
  position: relative;
  width: 2.25rem;
  height: 2.25rem;
  display: grid;
  place-items: center;
  border-radius: 0.55rem;
  background: #f1e2c4;
  border: 1px solid rgba(105, 77, 48, 0.22);
  transition: transform 0.15s, opacity 0.2s;
}
.pantry-item img { width: 1.8rem; height: 1.8rem; object-fit: contain; filter: drop-shadow(0 1px 0 rgba(78, 54, 31, 0.14)); }
.pantry-item.empty { opacity: 0.28; filter: grayscale(0.7); }
.pantry-item .count, .dish-item .count {
  position: absolute;
  right: -0.15rem;
  bottom: -0.13rem;
  min-width: 0.9rem;
  height: 0.9rem;
  padding: 0 0.18rem;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: var(--ink);
  color: #fff6df;
  border: 1px solid #fff4d9;
  font-size: 0.5rem;
  font-weight: 800;
  line-height: 1;
}
.pantry-item.flash { animation: itemPop 0.3s ease; }
.dish-item { width: 2.55rem; height: 2.25rem; background: #eef1d7; }
.dish-item img { width: 2.2rem; height: 2rem; object-fit: contain; }
.dish-item .count { background: #6c8a50; }
.dock-divider { width: 1px; align-self: stretch; margin: 0.1rem 0; background: repeating-linear-gradient(to bottom, #bea17c 0 3px, transparent 3px 6px); }
.empty-dish { font-size: 0.56rem; color: #b19778; white-space: nowrap; padding: 0 0.25rem; }
.dock.shake { animation: dockShake 0.35s ease; }

/* ------------------------------------------------------------------ */
/* 触屏控制                                                            */
/* ------------------------------------------------------------------ */
.touch-ui { display: none; }
#game-shell.touch-show .touch-ui {
  display: flex;
  position: absolute;
  inset: 0;
  z-index: 15;
  pointer-events: none;
}
.joystick {
  position: absolute;
  left: 1.3rem;
  bottom: 1.1rem;
  width: 6.3rem;
  height: 6.3rem;
  border-radius: 50%;
  border: 2px solid rgba(255, 245, 220, 0.55);
  background: rgba(59, 46, 31, 0.22);
  box-shadow: inset 0 0 1rem rgba(50, 39, 26, 0.2);
  pointer-events: auto;
  touch-action: none;
  backdrop-filter: blur(2px);
}
.joystick::before {
  content: "";
  position: absolute;
  inset: 25%;
  border-radius: 50%;
  border: 1px dashed rgba(255, 246, 227, 0.22);
}
.stick-knob {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 2.75rem;
  height: 2.75rem;
  border-radius: 50%;
  background: rgba(255, 248, 230, 0.88);
  border: 2px solid rgba(72, 51, 34, 0.65);
  box-shadow: 0 0.18rem 0.5rem rgba(35, 26, 17, 0.2);
  transform: translate(-50%, -50%);
  pointer-events: none;
}
.touch-actions {
  position: absolute;
  right: 1.25rem;
  bottom: 1.15rem;
  display: flex;
  align-items: flex-end;
  gap: 0.65rem;
  pointer-events: auto;
}
.touch-btn {
  width: 4.2rem;
  height: 4.2rem;
  border-radius: 50%;
  border: 2px solid #51392a;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.1rem;
  color: #4b3628;
  background: rgba(255, 248, 231, 0.92);
  box-shadow: 0 0.22rem 0 rgba(61, 44, 36, 0.32);
  font-weight: 800;
  touch-action: manipulation;
  padding: 0;
}
.touch-btn span { font-size: 0.76rem; line-height: 1; }
.touch-btn small { font-size: 0.46rem; font-weight: 600; color: #8c6c4d; }
.touch-btn.action-btn { width: 4.7rem; height: 4.7rem; background: #f2d59e; border-color: #543a28; }
.touch-btn:active { transform: translateY(2px); box-shadow: 0 0.05rem 0 rgba(61, 44, 36, 0.32); }
.touch-btn.cooling { opacity: 0.55; }
.touch-btn.ready { animation: readyGlow 1.3s infinite; }

/* ------------------------------------------------------------------ */
/* 屏幕 / 弹窗                                                          */
/* ------------------------------------------------------------------ */
.screen {
  position: absolute;
  inset: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.6rem;
}
.screen.hidden { display: none; }
.screen:focus { outline: none; }

.title-screen {
  justify-content: flex-start;
  padding: 2.6rem 5%;
  background:
    linear-gradient(90deg, rgba(35, 28, 19, 0.56) 0%, rgba(35, 28, 19, 0.34) 38%, rgba(35, 28, 19, 0.02) 70%, transparent 100%),
    radial-gradient(ellipse at 26% 50%, rgba(29, 22, 14, 0.22), transparent 55%);
  overflow: hidden;
}
.title-card {
  position: relative;
  width: min(34rem, 51%);
  max-height: calc(100% - 1rem);
  overflow-y: auto;
  padding: 2rem 2.3rem 1.5rem;
  border: 2px solid var(--ink);
  border-radius: 1.15rem;
  background:
    linear-gradient(140deg, rgba(255, 252, 241, 0.97), rgba(245, 229, 199, 0.96)),
    var(--paper);
  box-shadow: 0.45rem 0.55rem 0 rgba(53, 39, 26, 0.22), 0 1.8rem 4rem rgba(23, 17, 11, 0.35);
  transform: rotate(-0.55deg);
  scrollbar-width: thin;
}
.title-card::before, .title-card::after {
  content: "";
  position: absolute;
  width: 5rem;
  height: 1.45rem;
  background: rgba(224, 195, 144, 0.58);
  border: 1px solid rgba(151, 116, 73, 0.2);
  box-shadow: 0 2px 4px rgba(72, 49, 30, 0.08);
  top: -0.6rem;
}
.title-card::before { left: 2rem; transform: rotate(-3deg); }
.title-card::after { right: 2.1rem; transform: rotate(2.4deg); }
.title-stamp {
  display: inline-block;
  padding: 0.25rem 0.6rem 0.22rem;
  border: 1px solid #b38552;
  border-radius: 0.25rem;
  font-size: 0.51rem;
  font-weight: 800;
  letter-spacing: 0.16em;
  color: #91653c;
  background: rgba(255, 250, 235, 0.55);
}
.title-logo { position: relative; margin-top: 0.7rem; }
.title-logo h1 {
  margin: 0;
  font-family: var(--display);
  font-weight: 700;
  font-size: 4.4rem;
  line-height: 0.92;
  letter-spacing: 0.04em;
  color: var(--ink);
  text-shadow: 0 0.16rem 0 rgba(255, 251, 237, 0.7);
}
.title-logo h1 span:last-child { color: var(--terracotta-deep); margin-left: 0.12em; }
.title-en {
  margin: 0.5rem 0 0;
  font-size: 0.55rem;
  font-weight: 800;
  letter-spacing: 0.42em;
  color: #a6845d;
}
.logo-leaf {
  position: absolute;
  width: 1.5rem;
  height: 0.75rem;
  border-radius: 100% 0 100% 0;
  background: #789455;
  border: 1px solid #5f7c43;
}
.leaf-a { right: 5.4rem; top: 0.15rem; transform: rotate(-24deg); }
.leaf-b { right: 4.4rem; top: 0.75rem; transform: rotate(16deg) scale(0.72); background: #9aad70; }
.title-copy {
  margin: 1.05rem 0 1.2rem;
  font-size: 0.83rem;
  line-height: 1.8;
  color: #6d5540;
  letter-spacing: 0.02em;
}
.title-actions { display: flex; align-items: stretch; gap: 0.55rem; }
.primary-btn {
  position: relative;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 3.45rem;
  padding: 0.45rem 1.55rem 0.5rem;
  border: 2px solid #5b3022;
  border-radius: 0.75rem;
  background: linear-gradient(180deg, #d87550, #c15336);
  color: #fff6df;
  cursor: pointer;
  box-shadow: 0 0.28rem 0 #7c3a27, 0 0.65rem 1.2rem rgba(93, 45, 27, 0.22);
  transition: transform 0.16s, box-shadow 0.16s, filter 0.16s;
}
.primary-btn::after {
  content: "";
  position: absolute;
  inset: 0.22rem;
  border-radius: 0.5rem;
  border: 1px solid rgba(255, 235, 199, 0.32);
  pointer-events: none;
}
.primary-btn span { font-size: 1.04rem; font-weight: 800; letter-spacing: 0.12em; line-height: 1.2; }
.primary-btn small { font-size: 0.54rem; opacity: 0.8; letter-spacing: 0.07em; margin-top: 0.1rem; }
.primary-btn:hover { transform: translateY(-2px); filter: brightness(1.04); box-shadow: 0 0.34rem 0 #7c3a27, 0 0.9rem 1.6rem rgba(93, 45, 27, 0.25); }
.primary-btn:active { transform: translateY(1px); box-shadow: 0 0.1rem 0 #7c3a27; }
.primary-btn:disabled { opacity: 0.48; filter: grayscale(0.5); cursor: not-allowed; transform: none; }
.primary-btn.small { min-height: 2.5rem; padding: 0.25rem 1.1rem; }
.primary-btn.small span, .primary-btn.small { font-size: 0.75rem; letter-spacing: 0.08em; }
.ghost-btn {
  min-height: 3.45rem;
  padding: 0.35rem 1rem;
  border: 2px solid #8f6d49;
  border-radius: 0.75rem;
  background: rgba(255, 250, 235, 0.5);
  color: #725437;
  font-size: 0.78rem;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 0.2rem 0 rgba(104, 77, 50, 0.18);
  transition: background 0.15s, transform 0.15s;
}
.ghost-btn:hover { background: #fffaf0; transform: translateY(-1px); }
.ghost-btn.small { min-height: 2.5rem; font-size: 0.7rem; padding: 0.25rem 0.9rem; }
.title-meta {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  margin-top: 1.15rem;
  padding-top: 0.8rem;
  border-top: 1px dashed rgba(143, 109, 71, 0.38);
}
.best-line { font-size: 0.62rem; color: #8b6d4f; letter-spacing: 0.04em; }
.best-line strong { margin-left: 0.35rem; font-size: 0.82rem; color: #a25b35; }
.key-hints { display: flex; flex-wrap: wrap; gap: 0.45rem 0.8rem; font-size: 0.56rem; color: #8d7256; }
.key-hints span { display: flex; align-items: center; gap: 0.25rem; white-space: nowrap; }
.touch-hints { display: none; }
.touch-tip { display: none; }
kbd {
  display: inline-grid;
  place-items: center;
  min-width: 1.35rem;
  height: 1.15rem;
  padding: 0 0.26rem;
  border: 1px solid #ad8c63;
  border-bottom-width: 2px;
  border-radius: 0.25rem;
  background: #fffaed;
  color: #614a35;
  font-family: var(--font);
  font-size: 0.55rem;
  font-weight: 800;
  line-height: 1;
  box-shadow: 0 1px 0 rgba(96, 69, 43, 0.14);
}
.title-ingredients {
  position: absolute;
  right: 5.5%;
  top: 50%;
  width: 30%;
  height: 56%;
  transform: translateY(-50%);
  pointer-events: none;
}
.title-ingredients img {
  position: absolute;
  width: 4.5rem;
  height: 4.5rem;
  object-fit: contain;
  filter: drop-shadow(0 0.5rem 0.6rem rgba(37, 29, 20, 0.3));
  animation: floaty 4.5s ease-in-out infinite;
}
.title-ingredients img:nth-child(1) { left: 12%; top: 10%; width: 5.2rem; height: 5.2rem; animation-delay: -0.8s; }
.title-ingredients img:nth-child(2) { right: 10%; top: 34%; animation-delay: -2s; }
.title-ingredients img:nth-child(3) { left: 22%; bottom: 8%; width: 4rem; height: 4rem; animation-delay: -3.1s; }
.title-ingredients img:nth-child(4) { right: 20%; bottom: 14%; width: 4.8rem; height: 4.8rem; animation-delay: -1.4s; }
.title-footnote {
  position: absolute;
  right: 2rem;
  bottom: 1rem;
  margin: 0;
  font-size: 0.58rem;
  letter-spacing: 0.04em;
  color: rgba(255, 247, 226, 0.82);
  text-shadow: 0 1px 4px rgba(34, 24, 14, 0.5);
}

/* 通用弹窗 */
.modal-screen {
  background: rgba(35, 27, 18, 0.58);
  backdrop-filter: blur(4px) saturate(0.9);
  animation: fadeIn 0.2s ease both;
}
.modal {
  position: relative;
  width: min(100%, 64rem);
  max-height: 92%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 2px solid var(--ink);
  border-radius: 1.1rem;
  background:
    linear-gradient(145deg, #fffbf0, #f4e5c9 90%),
    var(--paper);
  box-shadow: 0 0.7rem 0 rgba(47, 33, 21, 0.22), 0 2rem 4rem rgba(24, 17, 10, 0.38);
  animation: modalIn 0.28s cubic-bezier(0.2, 1.05, 0.4, 1) both;
}
.modal::after {
  content: "";
  position: absolute;
  inset: 0.4rem;
  border: 1px solid rgba(156, 121, 80, 0.18);
  border-radius: 0.8rem;
  pointer-events: none;
}
.modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.15rem 1.35rem 1rem;
  border-bottom: 2px dashed rgba(150, 115, 76, 0.35);
  flex: none;
}
.modal-head.compact { padding-bottom: 0.85rem; }
.modal-title { display: flex; align-items: center; gap: 0.75rem; min-width: 0; }
.modal-icon {
  width: 2.7rem;
  height: 2.7rem;
  display: grid;
  place-items: center;
  flex: none;
  border: 1.5px solid #8c4a33;
  border-radius: 50%;
  background: #e8c68d;
  color: #8a4932;
  font-size: 1.2rem;
  box-shadow: inset 0 0 0 3px rgba(255, 249, 232, 0.45);
}
.modal-title h2 { margin: 0; font-family: var(--display); font-size: 1.55rem; line-height: 1.1; letter-spacing: 0.03em; }
.modal-title p { margin: 0.28rem 0 0; font-size: 0.65rem; color: #8a6b4d; line-height: 1.55; }
.close-btn {
  width: 2.2rem; height: 2.2rem;
  flex: none;
  border: 1.5px solid #8d6a48;
  border-radius: 50%;
  background: #f8ecd5;
  color: #755538;
  font-size: 1.35rem;
  line-height: 1;
  cursor: pointer;
  transition: transform 0.15s, background 0.15s;
}
.close-btn:hover { transform: rotate(8deg); background: #fff9eb; }
.modal-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.75rem 1.35rem 0.9rem;
  border-top: 1px dashed rgba(150, 115, 76, 0.38);
  flex: none;
  background: rgba(244, 229, 201, 0.55);
}
.cook-foot { justify-content: space-between; }
.cook-note { display: flex; align-items: center; gap: 0.4rem; font-size: 0.58rem; color: #896b4d; }
.cook-note .dot { width: 0.4rem; height: 0.4rem; border-radius: 50%; background: #8da75d; flex: none; }
.small-btn {
  padding: 0.42rem 0.8rem;
  border: 1.5px solid #a47f55;
  border-radius: 0.5rem;
  background: #fff7e7;
  color: #6d5137;
  font-size: 0.64rem;
  font-weight: 700;
  cursor: pointer;
}
.small-btn:hover { background: #fffdf5; }

/* 菜谱 */
.recipe-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.7rem;
  padding: 1rem 1.25rem;
  overflow-y: auto;
  min-height: 0;
}
.recipe-card {
  position: relative;
  display: flex;
  flex-direction: column;
  padding: 0.65rem 0.7rem 0.62rem;
  border: 1.5px solid #bd9a6e;
  border-radius: 0.7rem;
  background: rgba(255, 251, 240, 0.8);
  box-shadow: 0 0.15rem 0 rgba(96, 67, 40, 0.1);
  transition: border-color 0.15s, transform 0.15s, box-shadow 0.15s;
  min-height: 8.6rem;
}
.recipe-card.available { border-color: #8fa36b; }
.recipe-card.available:hover { transform: translateY(-2px); box-shadow: 0 0.3rem 0 rgba(96, 67, 40, 0.12); }
.recipe-card.locked { opacity: 0.6; filter: saturate(0.6); }
.recipe-card .recipe-top { display: flex; gap: 0.55rem; align-items: center; }
.recipe-icon {
  width: 3.7rem; height: 3.2rem;
  display: grid; place-items: center;
  flex: none;
  border-radius: 0.5rem;
  background: #f2e5ca;
  border: 1px solid rgba(146, 108, 68, 0.22);
}
.recipe-icon img { width: 3.4rem; height: 3rem; object-fit: contain; }
.recipe-info { min-width: 0; flex: 1; }
.recipe-name { font-family: var(--display); font-size: 1.04rem; font-weight: 700; line-height: 1.15; }
.recipe-desc { margin-top: 0.15rem; font-size: 0.52rem; color: #9b7e5f; line-height: 1.35; }
.recipe-price { font-size: 0.62rem; color: #a4672d; font-weight: 800; margin-top: 0.15rem; }
.recipe-ingredients { display: flex; flex-wrap: wrap; gap: 0.25rem; margin: 0.55rem 0; }
.ing-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.18rem;
  padding: 0.15rem 0.36rem 0.15rem 0.16rem;
  border-radius: 999px;
  background: #f0e3c9;
  border: 1px solid rgba(133, 101, 66, 0.2);
  font-size: 0.48rem;
  font-weight: 700;
  color: #6d5339;
}
.ing-pill img { width: 1.05rem; height: 1.05rem; object-fit: contain; }
.ing-pill.missing { color: #b04d3d; border-color: #d7a393; background: #f8e5da; }
.recipe-foot { display: flex; align-items: center; justify-content: space-between; gap: 0.4rem; margin-top: auto; }
.recipe-stock { font-size: 0.49rem; color: #a38461; }
.cook-btn {
  padding: 0.38rem 0.78rem;
  border: 1.5px solid #6b4930;
  border-radius: 0.45rem;
  background: linear-gradient(180deg, #d68154, #bf5e3c);
  color: #fff7e4;
  font-size: 0.6rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  cursor: pointer;
  box-shadow: 0 0.13rem 0 #7c3e28;
}
.cook-btn:hover { filter: brightness(1.05); }
.cook-btn:active { transform: translateY(1px); box-shadow: 0 0.05rem 0 #7c3e28; }
.cook-btn:disabled {
  background: #ddcdb3;
  border-color: #b5a083;
  color: #8b775e;
  cursor: not-allowed;
  box-shadow: none;
}
.recipe-lock {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.2rem;
  border-radius: inherit;
  background: rgba(245, 235, 215, 0.5);
  font-size: 0.62rem;
  color: #816246;
  font-weight: 800;
  pointer-events: none;
  backdrop-filter: blur(1px);
}
.recipe-lock small { font-size: 0.5rem; font-weight: 500; color: #a38666; }

/* 暂停 */
.pause-modal { width: min(100%, 48rem); }
#pause-screen.help-mode .modal-foot { justify-content: flex-end; }
#pause-screen.help-mode .modal-icon { font-family: var(--font); }
.pause-body { padding: 1rem 1.35rem; overflow-y: auto; }
.howto-grid { display: flex; flex-direction: column; gap: 0.58rem; }
.howto-row {
  display: flex;
  align-items: flex-start;
  gap: 0.8rem;
  padding: 0.55rem 0.7rem;
  border: 1px solid rgba(145, 109, 72, 0.18);
  border-radius: 0.55rem;
  background: rgba(255, 251, 240, 0.6);
  font-size: 0.68rem;
  line-height: 1.55;
  color: #6f563e;
}
.key-group { display: flex; gap: 0.22rem; flex: none; min-width: 8.6rem; }
.pause-tip {
  margin-top: 0.8rem;
  padding: 0.6rem 0.75rem;
  border-left: 3px solid #c28b43;
  background: #f5e8cc;
  border-radius: 0 0.4rem 0.4rem 0;
  font-size: 0.61rem;
  color: #84613e;
  line-height: 1.65;
}

/* 结算 */
.summary-modal { width: min(100%, 58rem); overflow-y: auto; display: block; }
.summary-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.2rem 1.4rem 0.9rem;
}
.summary-kicker { font-size: 0.56rem; font-weight: 800; letter-spacing: 0.2em; color: #a27349; }
.summary-head h2 { margin: 0.2rem 0 0.25rem; font-family: var(--display); font-size: 2rem; line-height: 1.1; letter-spacing: 0.02em; }
.summary-head p { margin: 0; font-size: 0.63rem; color: #957759; }
.summary-stars { display: flex; gap: 0.12rem; padding-top: 0.35rem; flex: none; }
.summary-stars .star {
  font-size: 1.55rem;
  line-height: 1;
  color: #d8c3a1;
  text-shadow: 0 0.1rem 0 rgba(94, 65, 37, 0.15);
  transform-origin: center;
  animation: starPop 0.45s cubic-bezier(0.2, 1.4, 0.4, 1) both;
}
.summary-stars .star.on { color: #e7b24a; text-shadow: 0 0.12rem 0 rgba(147, 100, 33, 0.28); }
.summary-stars .star:nth-child(2) { animation-delay: 0.08s; }
.summary-stars .star:nth-child(3) { animation-delay: 0.16s; }
.summary-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.45rem;
  margin: 0 1.4rem 0.95rem;
}
.stat-card {
  padding: 0.5rem 0.65rem 0.55rem;
  border: 1px solid rgba(148, 113, 74, 0.26);
  border-radius: 0.55rem;
  background: rgba(255, 251, 240, 0.66);
}
.stat-card span { display: block; font-size: 0.49rem; letter-spacing: 0.08em; color: #a08364; }
.stat-card strong { display: block; margin-top: 0.16rem; font-size: 1rem; color: #5f422c; font-variant-numeric: tabular-nums; }
.stat-card.primary { background: #f3dfb8; border-color: #c69e64; }
.stat-card.primary strong { color: #a25132; font-size: 1.18rem; }
.upgrade-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
  margin: 0 1.4rem 0.55rem;
  padding-top: 0.8rem;
  border-top: 1px dashed rgba(150, 115, 76, 0.35);
}
.upgrade-head h3 { margin: 0; font-family: var(--display); font-size: 1.25rem; }
.upgrade-head p { margin: 0.15rem 0 0; font-size: 0.55rem; color: #9b7e5f; }
.upgrade-status { font-size: 0.5rem; font-weight: 800; letter-spacing: 0.08em; color: #a27349; background: #f0e2c7; border: 1px solid #cfb68e; border-radius: 999px; padding: 0.16rem 0.5rem; }
.upgrade-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.55rem;
  padding: 0 1.4rem 0.85rem;
}
.upgrade-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.22rem;
  padding: 0.65rem 0.7rem 0.6rem;
  border: 1.5px solid #c0a078;
  border-radius: 0.6rem;
  background: #fff9ea;
  color: #5c432e;
  text-align: left;
  cursor: pointer;
  transition: transform 0.15s, border-color 0.15s, box-shadow 0.15s;
  min-height: 6.6rem;
}
.upgrade-card:hover { transform: translateY(-2px); box-shadow: 0 0.3rem 0 rgba(102, 72, 42, 0.12); }
.upgrade-card.selected { border-color: #6e8e50; background: #f4f6dd; box-shadow: 0 0 0 2px rgba(110, 142, 80, 0.27); }
.upgrade-card.selected::after {
  content: "✓";
  position: absolute;
  top: 0.42rem; right: 0.5rem;
  width: 1.1rem; height: 1.1rem;
  display: grid; place-items: center;
  border-radius: 50%;
  background: #708e52;
  color: #fff9e7;
  font-size: 0.62rem;
  font-weight: 800;
}
.upgrade-card:disabled { opacity: 0.48; cursor: not-allowed; }
.upgrade-icon {
  width: 1.9rem; height: 1.9rem;
  display: grid; place-items: center;
  border-radius: 0.45rem;
  background: #f0dfc0;
  border: 1px solid #c4a477;
  color: #8e6039;
  font-size: 0.86rem;
  font-weight: 800;
}
.upgrade-icon svg { width: 1.2rem; height: 1.2rem; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.upgrade-card h4 { margin: 0.28rem 0 0; font-size: 0.78rem; }
.upgrade-card p { margin: 0; color: #8b6e50; font-size: 0.53rem; line-height: 1.5; }
.upgrade-level { display: flex; gap: 0.16rem; margin-top: auto; padding-top: 0.3rem; }
.upgrade-level i { width: 0.7rem; height: 0.24rem; border-radius: 999px; background: #ddc9a8; }
.upgrade-level i.on { background: #8e9f61; }
.unlock-note {
  margin: 0 1.4rem 0.8rem;
  padding: 0.5rem 0.65rem;
  border: 1px dashed #c2a273;
  border-radius: 0.45rem;
  background: rgba(245, 231, 200, 0.55);
  font-size: 0.58rem;
  color: #81603f;
}
.unlock-note strong { color: #9e5432; }
.summary-foot {
  margin-top: 0.2rem;
  justify-content: flex-end;
  position: sticky;
  bottom: 0;
  z-index: 4;
  background: rgba(249, 239, 220, 0.97);
  box-shadow: 0 -0.45rem 0.9rem rgba(86, 61, 38, 0.08);
  backdrop-filter: blur(5px);
}

/* 竖屏提示 */
.portrait-screen {
  display: none;
  position: absolute;
  inset: 0;
  z-index: 90;
  align-items: center;
  justify-content: center;
  padding: 1.4rem;
  background:
    radial-gradient(circle at 50% 34%, rgba(241, 216, 164, 0.14), transparent 42%),
    #263626;
  color: #f7ecd4;
}
.portrait-card {
  width: min(100%, 23rem);
  text-align: center;
  border: 1px solid rgba(255, 243, 213, 0.28);
  border-radius: 1.2rem;
  padding: 2rem 1.5rem 1.6rem;
  background: rgba(47, 36, 24, 0.56);
  box-shadow: 0 1.5rem 3rem rgba(0, 0, 0, 0.22);
}
.portrait-card h2 {
  margin: 1.1rem 0 0.4rem;
  font-family: var(--display);
  font-size: 2rem;
  letter-spacing: 0.08em;
}
.portrait-card p { margin: 0; font-size: 0.82rem; line-height: 1.7; color: #d9c9a9; }
.portrait-card small { display: block; margin-top: 0.85rem; font-size: 0.66rem; color: #b9a27d; letter-spacing: 0.06em; }
.rotate-phone {
  position: relative;
  width: 4.8rem;
  height: 8rem;
  margin: 0 auto;
  border: 2px solid #e7d5ae;
  border-radius: 0.8rem;
  transform: rotate(-8deg);
  animation: phoneTurn 3.2s ease-in-out infinite;
}
.rotate-screen {
  position: absolute;
  inset: 0.38rem;
  border-radius: 0.42rem;
  background:
    linear-gradient(160deg, rgba(143, 174, 119, 0.55), rgba(82, 116, 79, 0.8));
  border: 1px solid rgba(255, 244, 214, 0.25);
}
.rotate-arrow {
  position: absolute;
  right: -2.1rem;
  bottom: -0.3rem;
  color: #e9c87f;
  font-size: 2rem;
  font-weight: 800;
}
/* 启动 */
.boot-screen {
  position: absolute;
  inset: 0;
  z-index: 100;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  background:
    radial-gradient(circle at 50% 42%, rgba(240, 214, 164, 0.16), transparent 45%),
    #2c3a29;
  color: #f3e5c8;
  transition: opacity 0.45s ease, visibility 0.45s;
}
.boot-screen.done { opacity: 0; visibility: hidden; }
.boot-logo {
  font-family: var(--display);
  font-size: 2.6rem;
  letter-spacing: 0.16em;
  text-shadow: 0 0.2rem 0 rgba(0, 0, 0, 0.25);
}
.boot-bar { width: 9rem; height: 0.28rem; border-radius: 999px; overflow: hidden; background: rgba(255, 244, 218, 0.18); }
.boot-bar i { display: block; height: 100%; width: 40%; border-radius: inherit; background: #e7b24a; animation: bootSlide 0.9s ease-in-out infinite; }

/* ------------------------------------------------------------------ */
/* 小屏适配                                                            */
/* ------------------------------------------------------------------ */
@media (max-width: 1500px), (max-height: 900px) {
  .title-card { width: min(33rem, 53%); }
}

@media (max-height: 640px), (max-width: 1000px) {
  #game-shell { border-radius: 14px; }
  .hud { top: 0.6rem; left: 0.7rem; right: 0.7rem; }
  .hud-chip { min-height: 2.35rem; padding: 0.2rem 0.55rem 0.24rem 0.45rem; border-width: 1.5px; border-radius: 0.7rem; }
  .day-main strong { font-size: 0.78rem; }
  .day-main small { font-size: 0.5rem; }
  .chip-ornament { width: 1.45rem; height: 1.45rem; font-size: 0.85rem; }
  .coin-dot { width: 1.05rem; height: 1.05rem; }
  .coin-chip strong { font-size: 1rem; }
  .coin-goal { font-size: 0.5rem; }
  .timer-card { width: 12.5rem; min-height: 2.35rem; padding: 0.24rem 0.6rem; }
  .sun-icon { width: 1.65rem; height: 1.65rem; font-size: 0.9rem; }
  .timer-row strong { font-size: 0.86rem; }
  .timer-row span { font-size: 0.48rem; }
  .icon-btn { width: 2.2rem; height: 2.2rem; border-width: 1.5px; border-radius: 0.65rem; }
  .icon-btn svg { width: 1.05rem; height: 1.05rem; }
  .heart { width: 1.15rem; height: 1.15rem; }
  .quest-card { top: 5.2rem; left: 0.75rem; width: 14.5rem; }
  .quest-body { font-size: 0.62rem; }
  .banner { min-width: 18rem; padding: 0.5rem 1.2rem 0.6rem; }
  .banner strong { font-size: 1.4rem; }
  .banner small { font-size: 0.55rem; }
  .dock { bottom: 0.5rem; padding: 0.28rem 0.5rem 0.32rem; border-width: 1.5px; border-radius: 0.75rem; gap: 0.4rem; }
  .dock-heading { font-size: 0.45rem; margin-bottom: 0.18rem; }
  .dock-heading small { display: none; }
  .pantry-item, .dish-item { width: 1.9rem; height: 1.9rem; border-radius: 0.45rem; }
  .pantry-item img { width: 1.55rem; height: 1.55rem; }
  .dish-item img { width: 1.85rem; height: 1.7rem; }
  .pantry-item .count, .dish-item .count { font-size: 0.42rem; min-width: 0.8rem; height: 0.8rem; }
  .toast-stack { bottom: 5.7rem; }
  .toast { font-size: 0.58rem; padding: 0.28rem 0.7rem; }
  .title-screen { padding: 1.4rem 4%; }
  .title-card { width: min(29rem, 58%); padding: 1.2rem 1.5rem 1rem; border-radius: 0.9rem; }
  .title-logo h1 { font-size: 3.2rem; }
  .title-stamp { font-size: 0.42rem; }
  .title-copy { margin: 0.6rem 0 0.75rem; font-size: 0.68rem; line-height: 1.65; }
  .primary-btn { min-height: 2.7rem; padding: 0.3rem 1.15rem 0.35rem; border-radius: 0.6rem; }
  .primary-btn span { font-size: 0.85rem; }
  .primary-btn small { font-size: 0.46rem; }
  .ghost-btn { min-height: 2.7rem; font-size: 0.64rem; border-radius: 0.6rem; }
  .title-meta { margin-top: 0.7rem; padding-top: 0.55rem; gap: 0.4rem; }
  .best-line { font-size: 0.52rem; }
  .key-hints { font-size: 0.48rem; gap: 0.3rem 0.6rem; }
  kbd { min-width: 1.1rem; height: 0.95rem; font-size: 0.46rem; }
  .title-ingredients img { width: 3.4rem; height: 3.4rem; }
  .title-footnote { font-size: 0.48rem; bottom: 0.5rem; right: 1rem; }
  .modal { border-radius: 0.85rem; }
  .modal-head { padding: 0.75rem 0.95rem 0.7rem; }
  .modal-icon { width: 2.1rem; height: 2.1rem; font-size: 0.95rem; }
  .modal-title h2 { font-size: 1.2rem; }
  .modal-title p { font-size: 0.53rem; }
  .close-btn { width: 1.8rem; height: 1.8rem; font-size: 1.1rem; }
  .recipe-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.5rem; padding: 0.7rem 0.9rem; }
  .recipe-card { min-height: 7.2rem; padding: 0.5rem 0.55rem; }
  .recipe-icon { width: 2.9rem; height: 2.5rem; }
  .recipe-icon img { width: 2.7rem; height: 2.4rem; }
  .recipe-name { font-size: 0.86rem; }
  .recipe-desc { font-size: 0.43rem; }
  .recipe-ingredients { margin: 0.35rem 0; }
  .recipe-stock { display: none; }
  .modal-foot { padding: 0.55rem 0.95rem 0.65rem; }
  .cook-note { font-size: 0.48rem; }
  .summary-head { padding: 0.85rem 1rem 0.65rem; }
  .summary-head h2 { font-size: 1.5rem; }
  .summary-head p { font-size: 0.53rem; }
  .summary-stars .star { font-size: 1.15rem; }
  .summary-stats { margin: 0 1rem 0.6rem; gap: 0.3rem; }
  .stat-card { padding: 0.35rem 0.45rem 0.4rem; }
  .stat-card span { font-size: 0.4rem; }
  .stat-card strong { font-size: 0.8rem; }
  .stat-card.primary strong { font-size: 0.95rem; }
  .upgrade-head { margin: 0 1rem 0.4rem; padding-top: 0.55rem; }
  .upgrade-head h3 { font-size: 1rem; }
  .upgrade-head p { font-size: 0.46rem; }
  .upgrade-grid { padding: 0 1rem 0.55rem; gap: 0.35rem; }
  .upgrade-card { min-height: 5.1rem; padding: 0.45rem 0.5rem; }
  .upgrade-icon { width: 1.45rem; height: 1.45rem; font-size: 0.7rem; }
  .upgrade-icon svg { width: 0.95rem; height: 0.95rem; }
  .upgrade-card h4 { font-size: 0.65rem; margin-top: 0.15rem; }
  .upgrade-card p { font-size: 0.43rem; }
  .upgrade-level i { width: 0.5rem; height: 0.18rem; }
  .unlock-note { margin: 0 1rem 0.55rem; font-size: 0.48rem; }
  .pause-body { padding: 0.6rem 1rem; }
  .howto-row { font-size: 0.56rem; padding: 0.4rem 0.5rem; }
  .pause-tip { font-size: 0.52rem; }
  .joystick { width: 5rem; height: 5rem; left: 0.8rem; bottom: 0.7rem; }
  .stick-knob { width: 2.2rem; height: 2.2rem; }
  .touch-actions { right: 0.8rem; bottom: 0.8rem; gap: 0.45rem; }
  .touch-btn { width: 3.4rem; height: 3.4rem; }
  .touch-btn.action-btn { width: 3.8rem; height: 3.8rem; }
}

@media (pointer: coarse) {
  #game-shell { border-radius: 0; border: none; }
  #game-frame { width: 100vw; max-height: 100dvh; aspect-ratio: auto; height: 100dvh; filter: none; }
  #game-shell { width: 100vw; height: 100dvh; }
  #game-canvas { object-fit: contain; background: #8caa6f; }
  .dock { max-width: calc(100% - 11rem); }
  .title-screen { justify-content: center; }
  .title-card { width: min(34rem, 92%); }
  .title-ingredients { display: none; }
  .title-footnote { display: none; }
  .key-hints:not(.touch-hints) { display: none; }
  .touch-hints { display: flex; }
  .touch-tip { display: block; }
  .quest-card { top: 5rem; }
  .hud {
    top: max(0.35rem, env(safe-area-inset-top));
    left: calc(0.45rem + env(safe-area-inset-left));
    right: calc(0.45rem + env(safe-area-inset-right));
    gap: 0.3rem;
  }
  .hud-left, .hud-right { gap: 0.25rem; }
  .hud-chip { min-height: 38px; }
  .icon-btn { width: 40px; height: 40px; }
  .heart { width: 20px; height: 20px; }
  .dish-list { max-width: 12rem; overflow-x: auto; }
  .pantry-list { overflow-x: auto; }
  .close-btn { width: 40px; height: 40px; font-size: 1.35rem; }
  .dock { bottom: calc(0.9rem + env(safe-area-inset-bottom)); }
  .joystick {
    left: calc(0.8rem + env(safe-area-inset-left));
    bottom: calc(1.1rem + env(safe-area-inset-bottom));
  }
  .touch-actions {
    right: calc(0.8rem + env(safe-area-inset-right));
    bottom: calc(1.15rem + env(safe-area-inset-bottom));
  }
  .recipe-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .screen { padding: 0.5rem; }
  .modal { max-height: 96%; }
  .screen, .modal, .recipe-grid, .title-card, .pause-body, .summary-modal { touch-action: pan-y; }
}

@media (pointer: coarse) and (orientation: landscape) and (min-aspect-ratio: 19/10) {
  #game-canvas { object-fit: cover; }
}

@media (pointer: coarse) and (orientation: portrait) {
  .portrait-screen { display: flex; }
  #game-canvas { object-fit: contain; }
  .title-card { width: min(34rem, 94%); }
  .title-logo h1 { font-size: 3rem; }
  .title-screen { background: rgba(35, 28, 19, 0.42); }
  .timer-card { width: 10rem; }
  .timer-row span { display: none; }
  .day-chip .day-main small { display: none; }
  .coin-chip .coin-goal { display: none; }
  .dock { flex-direction: column; gap: 0.25rem; bottom: 0.35rem; max-width: calc(100% - 9rem); padding: 0.3rem 0.5rem; }
  .dock-divider { display: none; }
  .dish-group { display: none; }
  .pantry-list { gap: 0.12rem; }
  .pantry-item { width: 1.55rem; height: 1.55rem; }
  .pantry-item img { width: 1.3rem; height: 1.3rem; }
  .joystick { bottom: 1rem; }
  .touch-actions { bottom: 1.1rem; }
}

@media (max-height: 430px) and (pointer: coarse) {
  .hud { top: max(0.25rem, env(safe-area-inset-top)); }
  .hud-chip { min-height: 34px; padding: 0.1rem 0.4rem 0.15rem 0.3rem; }
  .chip-ornament { width: 1.15rem; height: 1.15rem; font-size: 0.65rem; border-width: 1px; }
  .day-main strong { font-size: 11px; }
  .day-main small { font-size: 8px; }
  .coin-chip strong { font-size: 12px; }
  .timer-card { width: 9.5rem; min-height: 34px; padding: 0.14rem 0.4rem; gap: 0.3rem; }
  .sun-icon { width: 1.25rem; height: 1.25rem; font-size: 0.65rem; }
  .timer-row strong { font-size: 11px; }
  .timer-row span { font-size: 7px; }
  .icon-btn { width: 40px; height: 40px; border-radius: 0.6rem; }
  .heart { width: 18px; height: 18px; }
  .quest-card { display: none; }
  .dock { bottom: calc(0.25rem + env(safe-area-inset-bottom)); }
  .dock-heading { display: none; }
  .pantry-item, .dish-item { width: 24px; height: 24px; }
  .pantry-item img { width: 21px; height: 21px; }
  .dish-item img { width: 23px; height: 21px; }
  .pantry-item .count, .dish-item .count { font-size: 7px; min-width: 11px; height: 11px; }
  .joystick {
    width: 4.4rem; height: 4.4rem;
    left: calc(0.6rem + env(safe-area-inset-left));
    bottom: calc(0.55rem + env(safe-area-inset-bottom));
  }
  .stick-knob { width: 2rem; height: 2rem; }
  .touch-actions {
    right: calc(0.6rem + env(safe-area-inset-right));
    bottom: calc(0.6rem + env(safe-area-inset-bottom));
    gap: 0.35rem;
  }
  .touch-btn { width: 3rem; height: 3rem; }
  .touch-btn.action-btn { width: 3.35rem; height: 3.35rem; }
  .touch-btn span { font-size: 11px; }
  .touch-btn small { font-size: 7px; }
  .toast-stack { bottom: 4.2rem; }
  .banner { top: 18%; }
  .banner strong { font-size: 20px; }
}

@media (max-width: 780px) {
  .recipe-grid { grid-template-columns: 1fr; }
  .title-card { width: min(31rem, 92%); }
  .title-logo h1 { font-size: 3.4rem; }
  .title-ingredients { display: none; }
  .summary-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .upgrade-grid { grid-template-columns: 1fr; }
  .modal { max-height: 96%; }
  .upgrade-card { min-height: 4.5rem; }
  .title-footnote { display: none; }
  .timer-card { width: 11rem; }
}

@media (max-width: 560px) {
  #game-frame { width: 100vw; max-height: 100dvh; height: 100dvh; aspect-ratio: auto; filter: none; }
  #game-shell { border-radius: 0; border: none; width: 100vw; height: 100dvh; }
  #game-canvas { object-fit: contain; }
  .hud { left: 0.35rem; right: 0.35rem; top: 0.35rem; }
  .timer-card { width: 8.6rem; }
  .coin-chip { display: none; }
  .quest-card { display: none; }
  .dock { max-width: calc(100% - 1rem); }
  .summary-head h2 { font-size: 1.35rem; }
  .upgrade-grid { grid-template-columns: 1fr; }
  .pause-modal .modal-foot { flex-wrap: wrap; }
  .title-card { padding: 1rem 1.05rem 0.85rem; }
  .title-logo h1 { font-size: 2.7rem; }
  .title-copy { font-size: 0.68rem; }
  .title-actions { flex-direction: column; }
  .title-actions .primary-btn, .title-actions .ghost-btn { width: 100%; min-height: 2.6rem; }
}

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

/* 动画 */
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes modalIn { from { opacity: 0; transform: translateY(14px) scale(0.985); } to { opacity: 1; transform: translateY(0) scale(1); } }
@keyframes toastIn { from { opacity: 0; transform: translateY(8px) scale(0.96); } to { opacity: 1; transform: translateY(0) scale(1); } }
@keyframes toastOut { to { opacity: 0; transform: translateY(-6px) scale(0.97); } }
@keyframes itemPop { 0% { transform: scale(1); } 45% { transform: scale(1.22) rotate(-3deg); } 100% { transform: scale(1); } }
@keyframes dockShake { 0%,100% { transform: translateX(-50%); } 25% { transform: translateX(calc(-50% - 5px)); } 75% { transform: translateX(calc(-50% + 5px)); } }
@keyframes heartBeat { 0%,100% { transform: scale(1); } 40% { transform: scale(1.3); } }
@keyframes pulseSun { from { box-shadow: 0 0 0.4rem rgba(240, 195, 95, 0.25); } to { box-shadow: 0 0 1.2rem rgba(240, 195, 95, 0.65); } }
@keyframes floaty { 0%,100% { transform: translateY(0) rotate(-3deg); } 50% { transform: translateY(-12px) rotate(3deg); } }
@keyframes starPop { from { opacity: 0; transform: scale(0.3) rotate(-20deg); } to { opacity: 1; transform: scale(1) rotate(0); } }
@keyframes readyGlow { 0%,100% { box-shadow: 0 0.22rem 0 rgba(61,44,36,.32), 0 0 0 0 rgba(242, 206, 127, 0.5); } 50% { box-shadow: 0 0.22rem 0 rgba(61,44,36,.32), 0 0 0 0.35rem rgba(242, 206, 127, 0); } }
@keyframes bootSlide { 0% { transform: translateX(-120%); } 100% { transform: translateX(320%); } }
@keyframes phoneTurn {
  0%, 22% { transform: rotate(-8deg); }
  55%, 82% { transform: rotate(82deg); }
  100% { transform: rotate(-8deg); }
}

/* 滚动条 */
* { scrollbar-width: thin; scrollbar-color: rgba(148, 111, 71, 0.45) transparent; }
*::-webkit-scrollbar { width: 8px; height: 8px; }
*::-webkit-scrollbar-thumb { background: rgba(148, 111, 71, 0.4); border-radius: 999px; border: 2px solid transparent; background-clip: content-box; }
*::-webkit-scrollbar-track { background: transparent; }
