/* =========================================================
   MaoMao · Recipe 页面
   设计稿基准尺寸：1608 × 3496（与所有图层原始尺寸一致）
   整个舞台按 --s 等比缩放，内部全部使用设计稿像素，保证与效果图 1:1
   ========================================================= */

:root {
  --canvas-w: 1608;
  --canvas-h: 3496;
  --s: 1;                       /* 由 JS 计算 */
  --ink: #666666;
  --page-a: #ece5d8;
  --page-b: #bfb5a2;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
}

body {
  background: var(--page-b);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
  -webkit-tap-highlight-color: transparent;
  -webkit-font-smoothing: antialiased;
}

/* ---------- 桌面端背景 ---------- */
.backdrop {
  position: fixed;
  inset: 0;
  background:
    radial-gradient(120% 90% at 50% 8%, #f3eee4 0%, #e2dacb 38%, #c9bfad 72%, #b3a894 100%);
  z-index: 0;
}
.backdrop::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(70% 55% at 50% 42%, transparent 45%, rgba(70, 56, 38, .16) 100%);
  pointer-events: none;
}

/* ---------- 舞台容器 ---------- */
.device-wrap {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1;
  filter: drop-shadow(0 38px 70px rgba(62, 46, 26, .34))
          drop-shadow(0 10px 22px rgba(62, 46, 26, .18));
}

.device {
  position: relative;
  flex: 0 0 auto;                 /* 关键：防止被 flex 容器压缩 */
  width: calc(var(--canvas-w) * 1px);
  height: calc(var(--canvas-h) * 1px);
  transform: scale(var(--s));
  transform-origin: center center;
  overflow: hidden;
  border-radius: 200px;      /* 与素材圆角一致（实测半径 ≈200px） */
  background: transparent;
  isolation: isolate;
}

/* 手机上铺满屏幕时去掉投影与背景 */
body.is-mobile .device-wrap { filter: none; }
body.is-mobile .backdrop {
  background: #cfc6b5;
}
body.is-mobile .backdrop::after { display: none; }

/* ---------- 通用屏幕 ---------- */
.screen {
  position: absolute;
  inset: 0;
  overflow: hidden;
}

.art {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  user-select: none;
  -webkit-user-drag: none;
  pointer-events: none;
}

/* =========================================================
   首页
   ========================================================= */
.screen--home {
  z-index: 1;
  transition: filter .5s ease, opacity .5s ease;
}

.device.is-recipe .screen--home {
  filter: brightness(.9) saturate(.96);
}

.hotspot {
  position: absolute;
  border: 0;
  padding: 0;
  margin: 0;
  background: transparent;
  border-radius: 28px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: background-color .18s ease, box-shadow .18s ease;
}
.hotspot::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: rgba(255, 255, 255, 0);
  transition: background .18s ease;
}
.hotspot:hover::after { background: rgba(255, 255, 255, .10); }
.hotspot:active::after { background: rgba(255, 255, 255, .22); }
.hotspot:focus-visible {
  outline: 4px solid rgba(90, 120, 150, .75);
  outline-offset: 4px;
}

/* 冰箱搁板：牛奶 + 碗 */
.hs-shelf  { left: 70px;  top: 800px;  width: 600px; height: 195px; }
/* 冰箱本体 */
.hs-fridge { left: 985px; top: 820px;  width: 545px; height: 850px; border-radius: 44px; }
/* 底部导航 · 菜谱图标 */
.hs-nav    { left: 930px; top: 3195px; width: 200px; height: 190px; border-radius: 40px; }

/* =========================================================
   菜谱页
   ========================================================= */
.screen--recipe {
  z-index: 3;
  transform: translateY(100%);
  opacity: 0;
  pointer-events: none;
  transition: transform .56s cubic-bezier(.22, .9, .26, 1), opacity .38s ease;
  will-change: transform;
}

.device.is-recipe .screen--recipe {
  transform: translateY(0);
  opacity: 1;
  pointer-events: auto;
}

/* ---------- 可滑动内容 ---------- */
.scroller {
  position: absolute;
  left: 0;
  top: 680px;
  width: 1608px;
  height: 2816px;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  padding-bottom: 70px;
  outline: none;
  /* 顶部渐隐，滑动时内容淡出到可颂后面 */
  -webkit-mask-image: linear-gradient(to bottom, transparent 0, rgba(0,0,0,.45) 34px, #000 96px);
  mask-image: linear-gradient(to bottom, transparent 0, rgba(0,0,0,.45) 34px, #000 96px);
}
.scroller::-webkit-scrollbar { width: 0; height: 0; display: none; }
.scroller { scrollbar-width: none; -ms-overflow-style: none; }

.scroller .content {
  display: block;
  width: 1540px;
  height: 2972px;
  user-select: none;
  -webkit-user-drag: none;
  pointer-events: none;
  transition: opacity .22s ease;
}
.scroller.is-switching .content { opacity: .35; }
.scroller.is-drag { cursor: grabbing; }
.scroller { cursor: grab; }

/* ---------- Food / Sweets 可颂 ---------- */
.tabs {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.tab {
  position: absolute;
  width: 636px;
  height: 479px;
  border: 0;
  padding: 0;
  margin: 0;
  background: transparent;
  cursor: pointer;
  pointer-events: auto;
  -webkit-tap-highlight-color: transparent;
  transition: transform .2s ease;
  will-change: transform;
}
.tab:focus-visible {
  outline: 4px solid rgba(90, 120, 150, .75);
  outline-offset: 6px;
  border-radius: 40px;
}

/* Food 按钮外框（两种状态的并集） */
.tab--food  { left: 52px;  top: 348px; }
/* Sweets 按钮外框 */
.tab--sweet { left: 623px; top: 344px; }

.tab__img {
  position: absolute;
  display: block;
  user-select: none;
  -webkit-user-drag: none;
  pointer-events: none;
  transition: opacity .16s ease;
}

/* 常态图：相对按钮内偏移 */
.tab__img--idle {
  left: 73px;
  top: 92px;
  width: 472px;
  height: 356px;
  opacity: 1;
}
/* 点击（裂开）状态图 */
.tab__img--hit {
  left: 0;
  top: 0;
  width: 636px;
  height: 479px;
  opacity: 0;
}

.tab.is-active .tab__img--idle { opacity: 0; }
.tab.is-active .tab__img--hit  { opacity: 1; }

/* 按下时轻微回弹 */
.tab:active { transform: scale(.972); }

@keyframes burst {
  0%   { transform: scale(1); }
  28%  { transform: scale(.958); }
  62%  { transform: scale(1.028); }
  82%  { transform: scale(.994); }
  100% { transform: scale(1); }
}
.tab.is-bursting { animation: burst .5s cubic-bezier(.3, .8, .35, 1); }

/* ---------- 返回按钮 ---------- */
.back {
  position: absolute;
  left: 94px;
  top: 281px;
  width: 78px;
  height: 72px;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: transform .2s ease, opacity .2s ease;
  border-radius: 18px;
}
.back svg {
  display: block;
  width: 78px;
  height: 72px;
  overflow: visible;
  fill: none;
  stroke: var(--ink);
  stroke-width: 7;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.back:hover  { transform: translateX(-4px); }
.back:active { transform: translateX(-8px) scale(.94); opacity: .75; }
.back:focus-visible {
  outline: 4px solid rgba(90, 120, 150, .75);
  outline-offset: 6px;
}

/* ---------- 无障碍：减少动效 ---------- */
@media (prefers-reduced-motion: reduce) {
  .screen--recipe, .tab, .tab__img, .back, .scroller .content { transition-duration: .01ms !important; }
  .tab.is-bursting { animation: none; }
}
