/* Eggs · 界面（docs/plan/04 §12，rc.3 重做）
   风格：小丑牌（Balatro）的厚板、彩色按钮、会晃的卡片 —— 配色更淡雅；拟物（木、纸、绒布的底纹，上亮下暗，厚边 + 投影）。
   形状：不用 border-radius。面板、按钮、格子都是程序画的像素九宫格（ui/skin.js）：阶梯圆角 + 深色描边 + 高光行 + 厚边。
   字体：正文用黑体（系统自带的苹方 / 思源黑体 / 微软雅黑，中等字重；rc.3 第五批从霞鹜文楷换过来——楷体在小字号和深色底上发虚）；标题、数字用 Fusion Pixel 像素字体（12px 的整数倍，白字 + 深色描边，读得清）。
   --u = 一个「界面像素」（九宫格的放大倍数、像素字号的倍数）。 */
@font-face {
  font-family: 'FusionPixel';
  src: url('./assets/font/fusion-pixel-12px.woff2') format('woff2');
  font-display: block;
}
:root {
  --u: 2px;
  --fs: 15px;
  --fs-s: 13px;
  --ink: #2a2d3a; /* 描边、最深 */
  --panel: #4a5764; /* 面板 */
  --panel-hi: #5f6e7c;
  --well: #333c47; /* 凹槽 */
  --paper: #f5ecd9;
  --paper2: #e6dac0;
  --paper-ink: #4a3f31;
  --text: #f6efe0;
  --muted: #b3bcc8;
  --good: #86d6a0;
  --bad: #ff9684;
  --warn: #ffd978;
  --cu: #f0a56c;
  --ag: #dfe6f0;
  --au: #ffd96a;
  --cr: #c4b2ff;
  --heart: #ff92ae;
  --sel: #ffd978;
  --amb: 0 calc(var(--u) * 4) calc(var(--u) * 7) rgba(18, 20, 30, 0.3);
  /* 正文：思源黑体（Noto Sans SC 可变字重，CDN，见 src/ui/fonts.js）；没连上时依次退到系统里的黑体 */
  --body: 'Noto Sans SC Variable', 'PingFang SC', 'Hiragino Sans GB', 'Source Han Sans SC', 'Noto Sans CJK SC', 'Noto Sans SC', 'Microsoft YaHei UI', 'Microsoft YaHei', 'Heiti SC', 'WenQuanYi Micro Hei', sans-serif;
  /* 字重分工：说明小字 350 · 正文 450 · 按钮与列表名 600 · 强调 700 · 卡名与大数字 900 */
  --w-light: 350; --w-body: 450; --w-mid: 600; --w-bold: 700; --w-black: 900;
  --pix: 'FusionPixel', 'PingFang SC', 'Microsoft YaHei', monospace;
  --ol: var(--u) 0 var(--ink), calc(var(--u) * -1) 0 var(--ink), 0 var(--u) var(--ink), 0 calc(var(--u) * -1) var(--ink), var(--u) var(--u) var(--ink), calc(var(--u) * -1) var(--u) var(--ink), var(--u) calc(var(--u) * -1) var(--ink), calc(var(--u) * -1) calc(var(--u) * -1) var(--ink);
}
@media (max-width: 999px) {
  :root { --u: 1px; --fs: 14px; --fs-s: 12px; }
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: var(--ink); }
body { font-family: var(--body); font-size: var(--fs); font-weight: var(--w-body); line-height: 1.45; letter-spacing: 0.02em; -webkit-font-smoothing: antialiased; color: var(--text); user-select: none; -webkit-user-select: none; }
#view { position: fixed; inset: 0; width: 100vw; height: 100vh; display: block; image-rendering: pixelated; touch-action: none; }
#ui { position: fixed; inset: 0; pointer-events: none; z-index: 10; }
#ui > * { pointer-events: auto; }
#ui .passthru { pointer-events: none; }
#ui .passthru > * { pointer-events: auto; }
button, input, textarea, select { font: inherit; color: inherit; letter-spacing: inherit; }
img, canvas.pix, .ico, .box, .btn, .slot, .list-item, .pill, .bar, .field, .card, .pcard { image-rendering: pixelated; }

/* ---------- 像素字：标题与数字。白字 + 一圈深色描边 + 底下一条影 ---------- */
.title, .title-bar h3, .big, .pixfont, .devpanel h4, .badge, h3, h4, .num, .coin b, .clock-t, .price {
  font-family: var(--pix);
  -webkit-font-smoothing: none;
  font-weight: normal;
  letter-spacing: 0;
}
.title, .title-bar h3, h3 { font-size: calc(var(--u) * 12); line-height: calc(var(--u) * 15); color: #fff8e6; text-shadow: var(--ol), 0 calc(var(--u) * 2) 0 var(--ink); margin: 0; }
.title.gold, .title-bar h3 { color: #ffe9a6; }
.big { font-size: calc(var(--u) * 24); line-height: calc(var(--u) * 28); }
.box.paper .title { color: #fff8e6; }

/* ---------- 图标 ---------- */
.ico { width: 24px; height: 24px; flex: none; display: inline-block; vertical-align: middle; filter: drop-shadow(0 var(--u) 0 rgba(20, 22, 32, 0.45)); }
.ico.sm { width: 18px; height: 18px; }
.ico.lg { width: 36px; height: 36px; }
.ico.xl { width: 48px; height: 48px; }

/* ---------- 加载 ---------- */
#boot { position: fixed; inset: 0; z-index: 100; background: #5f8f86; background-image: radial-gradient(ellipse at 50% 40%, #86b4a4, #4a7670 75%); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px; transition: opacity 0.5s; }
#boot.done { opacity: 0; pointer-events: none; }
.boot-egg { width: 44px; height: 56px; background: radial-gradient(circle at 35% 30%, #fff 0 12%, var(--paper) 13% 60%, var(--paper2)); border-radius: 50% 50% 46% 46% / 58% 58% 42% 42%; border: 3px solid var(--ink); box-shadow: 0 6px 0 rgba(0, 0, 0, 0.3); animation: wob 0.9s steps(6) infinite; }
.boot-bar { width: 220px; height: 16px; background: var(--well); border: 3px solid var(--ink); overflow: hidden; }
.boot-bar i { display: block; height: 100%; width: 0; background: linear-gradient(#ffe9a6 0 35%, var(--warn) 35% 75%, #d9a83e 75%); transition: width 0.25s steps(8); }
.boot-msg { color: #f6efe0; }
@keyframes wob { 0%, 100% { transform: rotate(0); } 25% { transform: rotate(-7deg) translateY(-2px); } 75% { transform: rotate(7deg) translateY(-2px); } }

/* ---------- 面板：九宫格厚板（中间是带底纹的底色）---------- */
.box {
  position: relative;
  border-style: solid; border-color: transparent;
  border-width: calc(var(--u) * 6) calc(var(--u) * 6) calc(var(--u) * 9);
  border-image: var(--f-panel);
  background: var(--panel) var(--t-panel) padding-box;
  background-size: 32px 32px;
  box-shadow: var(--amb);
  padding: 6px 8px;
}
.box.paper { border-image: var(--f-paper); background: var(--paper) var(--t-paper) padding-box; background-size: 32px 32px; color: var(--paper-ink); }
.box.paper .muted { color: #8f8068; }
.box.wood { border-width: calc(var(--u) * 5) calc(var(--u) * 5) calc(var(--u) * 8); border-image: var(--f-wood); background: #b98858 var(--t-wood) padding-box; background-size: 64px 48px; }
.box.dark { border-width: calc(var(--u) * 5); border-image: var(--f-well); background: var(--well) padding-box; box-shadow: none; padding: 5px 7px; }
.box.paper .box.dark { border-image: var(--f-well-paper); background: #e6dac0 padding-box; }
.muted { color: var(--muted); }
.good { color: var(--good); }
.bad { color: var(--bad); }
.warn { color: var(--warn); }
.box.paper .good { color: #3f9a62; } .box.paper .bad { color: #c8543e; } .box.paper .warn { color: #b8862a; }
.cu { color: var(--cu); } .ag { color: var(--ag); } .au { color: var(--au); } .cr { color: var(--cr); }
.box.paper .cu { color: #b0602c; } .box.paper .ag { color: #66727f; } .box.paper .au { color: #a8821c; } .box.paper .cr { color: #6a54b8; }
.box.paper .btn .cu, .box.paper .btn .ag, .box.paper .btn .au, .box.paper .btn .cr { color: #fff; }
.row { display: flex; align-items: center; gap: 8px; }
.col { display: flex; flex-direction: column; gap: 8px; }
.wrap { flex-wrap: wrap; }
.grow { flex: 1; }
.right { margin-left: auto; }
.center { text-align: center; }
.small { font-size: var(--fs-s); }
/* 字重（思源黑体可变字重）*/
b, strong { font-weight: var(--w-bold); }
.muted.small, .small.muted, .ds, .tip { font-weight: var(--w-light); }
.btn, .st-tab, .pill, .chip { font-weight: var(--w-mid); }
.list-item b, .nametag .nm { font-weight: var(--w-bold); }
.letter-text { font-weight: 400; }
hr.pix { border: 0; height: calc(var(--u) * 2); background: linear-gradient(rgba(0, 0, 0, 0.3) 50%, rgba(255, 255, 255, 0.1) 50%); margin: 8px 0; }
.title-bar { display: flex; align-items: center; gap: 10px; margin: -6px -8px 10px; padding: 7px 10px 8px; background: linear-gradient(#6c7d8e 0 calc(var(--u) * 1), #5c6c7c calc(var(--u) * 1)); border-bottom: calc(var(--u) * 2) solid var(--ink); box-shadow: 0 calc(var(--u) * 1) 0 rgba(255, 255, 255, 0.08); }
.title-bar .ico { width: 30px; height: 30px; }
.title-bar .muted { font-size: var(--fs-s); color: #dfe6ee; }
.title-bar .x-btn { margin-left: auto; flex: none; padding: 0 3px; }
.title-bar .right + .x-btn { margin-left: 6px; }
.x-btn .ico { width: 18px; height: 18px; filter: none; }

/* ---------- 按钮：一块凸起的彩色板；悬停抬起一格，按下沉进厚边里 ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border-style: solid; border-color: transparent;
  border-width: calc(var(--u) * 4) calc(var(--u) * 4) calc(var(--u) * 6);
  border-image: var(--f) fill;
  background: none; color: #fff;
  padding: 1px 8px 0;
  text-shadow: 0 var(--u) 0 rgba(30, 30, 44, 0.55);
  cursor: pointer; white-space: nowrap;
  position: relative;
  transition: transform 0.07s steps(2), filter 0.1s;
}
.btn:hover { transform: translateY(calc(var(--u) * -1)); filter: brightness(1.07) saturate(1.05); }
.btn:active, .btn.on { border-image: var(--fp) fill; border-image-width: calc(var(--u) * 6) calc(var(--u) * 4) calc(var(--u) * 4); transform: none; padding-top: calc(1px + var(--u) * 2); margin-bottom: calc(var(--u) * -2); }
.btn.paper { color: var(--paper-ink); text-shadow: none; }
.btn.ghost { border-image: none; color: var(--muted); text-shadow: none; }
.btn.ghost:hover { color: #fff; }
.box.paper .btn.ghost { color: #8f8068; }
.btn.tiny { font-size: var(--fs-s); padding: 0 5px; border-width: calc(var(--u) * 3) calc(var(--u) * 4) calc(var(--u) * 5); }
.btn.tiny:active, .btn.tiny.on { border-image-width: calc(var(--u) * 5) calc(var(--u) * 4) calc(var(--u) * 3); }
.btn.large { font-size: 20px; padding: 3px 18px 2px; }
.btn:disabled, .btn.disabled { filter: grayscale(0.75) brightness(0.82); cursor: not-allowed; transform: none; }
.btn .price, .price { font-size: calc(var(--u) * 6 + 6px); }

/* ---------- 输入 / 凹槽 ---------- */
.field { border-style: solid; border-color: transparent; border-width: calc(var(--u) * 5); border-image: var(--f-well) fill; background: none; color: var(--text); padding: 2px 6px; outline: none; }
.field:focus { filter: brightness(1.2); }
.box.paper .field { border-image: var(--f-well-paper) fill; color: var(--paper-ink); }
.field::placeholder { color: #8d97a6; }

/* ---------- 顶栏 ---------- */
/* 顶栏：第一行 日期时间 | 钱（同高）……图标；第二行 小目标（在日期下面）*/
#hud { position: fixed; top: 8px; left: 8px; right: 8px; display: grid; grid-template-columns: auto auto 1fr auto; grid-template-areas: 'clock money . icons' 'quest quest quest quest'; gap: 6px 8px; align-items: stretch; pointer-events: none; }
#hud > * { pointer-events: auto; }
.hud-clock { grid-area: clock; display: flex; align-items: center; gap: 8px; padding: 2px 8px; white-space: nowrap; }
.hud-clock > span { white-space: nowrap; }
.hud-clock .clock-t { font-size: calc(var(--u) * 12); line-height: 1; min-width: 3.1em; color: #fff8e6; text-shadow: 0 var(--u) 0 var(--ink); }
.hud-money { grid-area: money; display: flex; gap: 14px; padding: 2px 10px; align-items: center; }
.coin { display: inline-flex; align-items: center; gap: 5px; }
.coin b { font-size: calc(var(--u) * 12); line-height: 1; text-shadow: 0 var(--u) 0 var(--ink); }
.coin .ico { width: 24px; height: 24px; }
.coin.bump { animation: bump 0.36s steps(6); }
@keyframes bump { 40% { transform: translateY(-6px) scale(1.15); } }
.hud-clock, .hud-money, .hud-icons { flex: none; }
.hud-quest { grid-area: quest; justify-self: start; max-width: min(460px, 100%); min-width: 0; padding: 1px 8px 2px 6px; display: flex; gap: 8px; align-items: flex-start; }
.hud-quest .q-text { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.hud-quest b { color: #c46a3c; font-weight: normal; }
.hud-icons { grid-area: icons; display: flex; gap: 6px; align-self: start; }
.icon-btn { padding: 2px 3px 1px; }
.icon-btn .ico { width: 30px; height: 30px; }
.badge { position: absolute; top: -9px; right: -9px; background: #e2776a; color: #fff; padding: 1px 5px 0; min-width: 20px; text-align: center; border: var(--u) solid var(--ink); font-size: 12px; line-height: 14px; animation: pulse 1.2s steps(4) infinite; text-shadow: none; }
@keyframes pulse { 50% { transform: scale(1.18); } }

/* ---------- 底部区域导航：一条木托盘，上面一排彩色图标按钮 ---------- */
#dock { position: fixed; bottom: 8px; left: 50%; transform: translateX(-50%); display: flex; gap: 5px; padding: 4px 6px 5px; border-width: calc(var(--u) * 5) calc(var(--u) * 5) calc(var(--u) * 8); border-image: var(--f-wood); background: #b98858 var(--t-wood) padding-box; background-size: 64px 48px; }
#dock .btn { flex-direction: column; gap: 0; min-width: 64px; padding: 2px 4px 0; font-size: var(--fs-s); }
#dock .btn .ico { width: 36px; height: 36px; transition: transform 0.15s steps(3); }
#dock .btn:hover .ico { transform: translateY(-4px) rotate(-6deg); }
#dock .btn.on .ico { transform: scale(1.1); }

/* ---------- 侧边面板 ---------- */
.side { position: fixed; right: 8px; top: 64px; bottom: 100px; width: 400px; display: flex; flex-direction: column; overflow: hidden; z-index: 2; animation: sideIn 0.26s steps(6); }
@keyframes sideIn { from { transform: translateX(46px); opacity: 0; } }
.side .scroll { overflow-y: auto; overflow-x: hidden; flex: 1; padding-right: 4px; }
.side.left { right: auto; left: 8px; }
.scroll::-webkit-scrollbar { width: 10px; }
.scroll::-webkit-scrollbar-track { background: rgba(0, 0, 0, 0.18); }
.scroll::-webkit-scrollbar-thumb { background: #8794a4; border: 2px solid var(--ink); }

/* ---------- 弹窗 ---------- */
.modal-back { position: fixed; inset: 0; background: rgba(30, 34, 46, 0.62); display: flex; align-items: center; justify-content: center; z-index: 40; animation: fadeIn 0.18s steps(4); }
@keyframes fadeIn { from { opacity: 0; } }
.modal { max-width: min(92vw, 560px); max-height: 88vh; overflow: auto; animation: popIn 0.26s steps(6); padding: 10px 14px; }
@keyframes popIn { from { transform: scale(0.82) translateY(16px); opacity: 0; } 70% { transform: scale(1.04); } }
.modal.wide { max-width: min(96vw, 900px); width: min(96vw, 820px); }
.modal-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 12px; }
.modal .title { margin-bottom: 4px; }

/* ---------- 提示 ---------- */
#toasts { position: fixed; left: 50%; top: calc(var(--hud-b, 62px) + 8px); transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; gap: 6px; pointer-events: none; z-index: 60; }
.toast { pointer-events: auto; cursor: pointer; max-width: min(92vw, 560px); padding: 2px 12px; animation: toastIn 0.3s steps(6); border-width: calc(var(--u) * 5) calc(var(--u) * 5) calc(var(--u) * 7); border-image: var(--f-panel-s); background-color: #56646f; }
.toast.good { filter: hue-rotate(-60deg) saturate(2.4) brightness(1.12); }
.toast.bad { filter: hue-rotate(150deg) saturate(3) brightness(1.15); }
.toast.warn { filter: hue-rotate(-165deg) saturate(3.4) brightness(1.3); }
.toast.out { animation: toastOut 0.3s steps(5) forwards; }
.toast .n { margin-left: 8px; font-family: var(--pix); color: #fff2a0; }
.toast .n:empty { display: none; }
.toast.again { animation: toastAgain 0.2s steps(4); }
@keyframes toastAgain { 0% { transform: scale(1.08); } 100% { transform: scale(1); } }
@keyframes toastIn { from { transform: translateY(-16px) scale(0.9); opacity: 0; } }
@keyframes toastOut { to { transform: translateY(-10px); opacity: 0; } }
.tip { position: fixed; z-index: 70; pointer-events: none; padding: 2px 6px; max-width: 260px; font-size: var(--fs-s); border-width: calc(var(--u) * 5) calc(var(--u) * 5) calc(var(--u) * 8); border-image: var(--f-paper); background: var(--paper) padding-box; color: var(--paper-ink); }
.floater { position: fixed; z-index: 55; pointer-events: none; white-space: nowrap; font-family: var(--pix); font-size: calc(var(--u) * 12); text-shadow: var(--ol), 0 calc(var(--u) * 2) 0 var(--ink); }

.nametag { position: fixed; left: 0; top: 0; z-index: 8; pointer-events: none; display: flex; align-items: center; gap: 6px; padding: 0 6px 1px; background: var(--paper); color: var(--paper-ink); border: calc(var(--u) * 1) solid var(--ink); box-shadow: 0 calc(var(--u) * 2) 0 rgba(26, 28, 40, 0.45); white-space: nowrap; animation: popIn 0.16s steps(4); }
.nametag::after { content: ''; position: absolute; left: 50%; top: 100%; margin-left: -5px; border: 5px solid transparent; border-top-color: var(--ink); }
.nametag .nm { font-size: 16px; }
.nametag .sp { font-size: 12.5px; color: #8f8068; }
.nametag .ico { filter: none; }
.nametag.hint { background: #2c3340; color: #fff8e6; padding: 1px 8px 2px; }
.nametag.hint .sp { color: #ffe9a6; }
.nametag.hint::after { border-top-color: #2c3340; }

.floater.pow { font-size: calc(var(--u) * 12 * var(--sz, 1)); transform: translate(-50%, -50%); animation: powIn 0.6s steps(12) forwards; }
@keyframes powIn { 0% { transform: translate(-50%, -50%) rotate(var(--rot, 0deg)) scale(0.3); opacity: 0; } 18% { transform: translate(-50%, -62%) rotate(var(--rot, 0deg)) scale(1.35); opacity: 1; } 34% { transform: translate(-50%, -66%) rotate(var(--rot, 0deg)) scale(1); } 75% { transform: translate(-50%, -74%) rotate(var(--rot, 0deg)) scale(1); opacity: 1; } 100% { transform: translate(-50%, -92%) rotate(var(--rot, 0deg)) scale(0.9); opacity: 0; } }

/* ---------- 格子 / 列表 ---------- */
.slots { display: grid; grid-template-columns: repeat(auto-fill, minmax(78px, 1fr)); gap: 6px; }
.slot { position: relative; border-style: solid; border-color: transparent; border-width: calc(var(--u) * 5); border-image: var(--f-well) fill; padding: 2px; min-height: 80px; display: flex; flex-direction: column; align-items: center; justify-content: center; cursor: pointer; text-align: center; transition: transform 0.1s steps(2), filter 0.1s; }
.slot:hover { filter: brightness(1.22); transform: translateY(calc(var(--u) * -1)); }
.slot.sel { filter: brightness(1.25); }
.slot.sel::after, .list-item.sel::after { content: ''; position: absolute; inset: calc(var(--u) * -6); border-style: solid; border-color: transparent; border-width: calc(var(--u) * 5); border-image: var(--f-sel); pointer-events: none; animation: selPulse 0.8s steps(2) infinite; }
@keyframes selPulse { 50% { inset: calc(var(--u) * -7); } }
.slot.empty { color: #66717f; cursor: default; }
.slot.empty:hover { transform: none; filter: none; }
.slot img, .slot canvas { width: 56px; height: 56px; filter: drop-shadow(0 var(--u) 0 rgba(20, 22, 32, 0.5)); }
.slot .n { position: absolute; right: 1px; bottom: -2px; font-size: var(--fs-s); }
.slot .tag { position: absolute; left: 1px; top: -3px; font-size: var(--fs-s); }
.list-item { position: relative; display: flex; align-items: center; gap: 10px; border-style: solid; border-color: transparent; border-width: calc(var(--u) * 5) calc(var(--u) * 5) calc(var(--u) * 7); border-image: var(--f-panel-s) fill; padding: 0 4px; cursor: pointer; transition: transform 0.1s steps(2), filter 0.1s; }
.list-item:hover { filter: brightness(1.1); transform: translateX(calc(var(--u) * 2)); }
.list-item.muted { filter: grayscale(0.6) brightness(0.85); }
.list-item img, .list-item canvas { width: 40px; height: 40px; flex: none; filter: drop-shadow(0 var(--u) 0 rgba(20, 22, 32, 0.5)); }
.bar { height: calc(var(--u) * 6); min-width: 50px; flex: 1; position: relative; background: #262d36; border: var(--u) solid var(--ink); box-shadow: inset 0 var(--u) 0 rgba(0, 0, 0, 0.35); }
.bar i { position: absolute; left: 0; top: 0; bottom: 0; background: linear-gradient(#bff0c8 0 34%, var(--good) 34% 78%, #58a874 78%); }
.bar.warn i { background: linear-gradient(#fff0b8 0 34%, var(--warn) 34% 78%, #d9a83e 78%); }
.bar.bad i { background: linear-gradient(#ffc6b8 0 34%, var(--bad) 34% 78%, #d0604c 78%); }
.bar.heart i { background: linear-gradient(#ffd0dc 0 34%, var(--heart) 34% 78%, #d85a80 78%); }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 2px 12px; }
.kv > :nth-child(odd) { color: var(--muted); }
.stars { color: var(--warn); letter-spacing: -1px; text-shadow: 0 var(--u) 0 rgba(30, 30, 44, 0.5); }
.stars .off { color: #6a7482; text-shadow: none; }
.box.paper .stars .off { color: #cdbf9e; }
.tabs { display: flex; gap: 6px; margin-bottom: 8px; flex-wrap: wrap; }
.gene { color: #a8e4ff; }
.gene b { color: var(--warn); font-weight: normal; }
.pill { display: inline-block; padding: 0 6px; background: #5f6e7c; border: var(--u) solid var(--ink); font-size: var(--fs-s); line-height: 1.25; }
.pill.cu { background: #b06a3c; color: #ffe8d0; } .pill.ag { background: #7c8898; color: #fff; } .pill.au { background: #c09a2c; color: #fff8d8; } .pill.cr { background: #7862b8; color: #f0e8ff; }

/* ---------- 卡片（小丑牌式）：品阶色的厚边卡框 + 纸面；ui/cardfx.js 给它加倾斜、流光 shader 和会动的底图 ---------- */
.pcard, .card {
  position: relative; flex: none;
  border-style: solid; border-color: transparent;
  border-width: calc(var(--u) * 6) calc(var(--u) * 6) calc(var(--u) * 9);
  border-image: var(--f-card) fill;
  color: var(--paper-ink);
  transform: perspective(700px) rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg)) translateY(var(--ty, 0px)) rotate(var(--rz, 0deg)) scale(var(--sc, 1));
  transform-style: preserve-3d;
  will-change: transform;
  filter: drop-shadow(0 calc(var(--sh, 3px)) 0 rgba(26, 28, 40, 0.42));
}
.card { width: 240px; height: 336px; padding: 0; }
.card .inner, .pcard .inner { position: relative; background: var(--paper) var(--t-paper); background-size: 32px 32px; height: 100%; display: flex; flex-direction: column; padding: 5px; gap: 4px; overflow: hidden; border: var(--u) solid rgba(60, 46, 30, 0.55); }
.card .name { display: flex; justify-content: space-between; align-items: baseline; font-family: var(--pix); font-size: 12px; line-height: 14px; }
.card .name b { font-weight: normal; font-size: 12px; }
.card .photo, .pcard .photo { position: relative; flex: none; height: 142px; display: flex; align-items: center; justify-content: center; border: var(--u) solid rgba(60, 46, 30, 0.6); overflow: hidden; background: #e9dcc0; }
.photo canvas.art { position: absolute; inset: 0; width: 100%; height: 100%; image-rendering: pixelated; }
.card .photo img { position: relative; height: 128px; width: auto; animation: cardWob 2.4s steps(12) infinite; transform-origin: 50% 90%; filter: drop-shadow(0 3px 0 rgba(40, 30, 20, 0.35)); }
@keyframes cardWob { 0%, 100% { transform: rotate(0); } 20% { transform: rotate(-4deg); } 40% { transform: rotate(3deg); } 60% { transform: rotate(0); } }
.card .stat { font-size: var(--fs-s); line-height: 1.3; color: #6a5d48; }
.card .msg { font-size: var(--fs-s); line-height: 1.35; background: #fffaf0; padding: 3px 6px; flex: 1; overflow: hidden; border: var(--u) solid #d6c8a8; }
.card .sticker { position: absolute; right: 8px; top: 116px; font-size: 40px; transform: rotate(12deg); }
canvas.fx { position: absolute; inset: calc(var(--u) * -6) calc(var(--u) * -6) calc(var(--u) * -9); width: calc(100% + var(--u) * 12); height: calc(100% + var(--u) * 15); pointer-events: none; mix-blend-mode: screen; image-rendering: pixelated; }
/* 小卡（货架、图鉴）*/
.pcard { width: 132px; padding: 0; cursor: pointer; }
.pcard .inner { padding: 4px; gap: 2px; align-items: center; }
.pcard .photo { width: 100%; height: 76px; }
.pcard .photo img { position: relative; height: 66px; width: auto; filter: drop-shadow(0 2px 0 rgba(40, 30, 20, 0.35)); }
.pcard .pc-name { font-size: 15px; line-height: 1.15; text-align: center; }
.pcard .pc-sub { font-size: 12px; color: #7a6c56; white-space: nowrap; }
.pcard.sold { filter: grayscale(0.85) brightness(0.8); }
.pcard .ribbon { position: absolute; left: calc(var(--u) * -3); top: 5px; padding: 0 6px; background: var(--gc); border: var(--u) solid var(--ink); font-family: var(--pix); font-size: 12px; line-height: 14px; color: #fff; text-shadow: 0 1px 0 rgba(0, 0, 0, 0.45); z-index: 2; }
.card-back { width: 240px; height: 336px; border: calc(var(--u) * 2) solid var(--ink); background: repeating-linear-gradient(45deg, #7a6aa8 0 8px, #6a5a98 8px 16px); display: flex; align-items: center; justify-content: center; color: var(--warn); box-shadow: inset 0 0 0 calc(var(--u) * 3) #e3bd58, inset 0 0 0 calc(var(--u) * 4) var(--ink), 0 6px 0 rgba(26, 28, 40, 0.5); }
.flip { perspective: 900px; }
.flip .faces { position: relative; transition: transform 0.7s cubic-bezier(0.3, 1.3, 0.5, 1); transform-style: preserve-3d; }
.flip.flipped .faces { transform: rotateY(180deg); }
.flip .face { backface-visibility: hidden; }
.flip .face.back { position: absolute; inset: 0; transform: rotateY(180deg); }
/* 二级面板：主面板左边的一块，放选中的那颗蛋 / 那只生物的状况和能做的事（竖屏时叠在主面板上） */
.side.sub { right: 416px; width: 340px; bottom: auto; max-height: calc(100vh - 176px); z-index: 3; }
.side.sub .scroll { max-height: calc(100vh - 250px); }
/* 列表里一行的状态：ready = 有事等你（一道光扫过去）· alert = 不太妙（一明一暗） */
.list-item.state-ready::before, .btn.glint::before, .slot.state-ready::before { content: ''; position: absolute; inset: 0; pointer-events: none; background: linear-gradient(105deg, transparent 0 38%, rgba(255, 246, 200, 0.5) 38% 44%, transparent 44% 48%, rgba(255, 246, 200, 0.28) 48% 51%, transparent 51%); background-size: 260% 100%; animation: rowGlint 2.6s steps(14) infinite; }
.btn.glint { position: relative; overflow: hidden; }
@keyframes rowGlint { 0% { background-position: 130% 0; } 55%, 100% { background-position: -130% 0; } }
.list-item.state-alert, .slot.state-alert { animation: rowAlert 1.2s steps(2) infinite; }
@keyframes rowAlert { 50% { filter: brightness(1.18) saturate(1.3) hue-rotate(-12deg); } }
.list-item.empty-row { filter: saturate(0.6) brightness(0.92); }
.pill.st-ready { background: #e8a82c; color: #2a2010; } .pill.st-good { background: #4f9a66; color: #f0ffe8; } .pill.st-warn { background: #b8862a; color: #fff8d8; } .pill.st-alert { background: #c8543e; color: #fff0e8; }
.pill.need { background: var(--nc, #ff9ab8); color: #2a1e26; }
.hearts { font-family: var(--pix); font-size: 12px; letter-spacing: 1px; color: #ff6f91; text-shadow: 0 1px 0 var(--ink); }
.hearts .off { color: #4a5362; }
.den-need { display: flex; align-items: center; gap: 6px; padding: 1px 8px; background: var(--nc, #ff9ab8); color: #2a1e26; border: var(--u) solid var(--ink); font-weight: var(--w-mid); }
.den-need .ico { filter: none; }
/* 两只之间的小牌子 */
.meet { align-items: center; min-width: min(86vw, 360px); }
.meet-pair { gap: 18px; justify-content: center; align-items: center; }
.meet-face img { width: 72px; height: 72px; image-rendering: pixelated; }
.col.center { align-items: center; }
/* 小窝（src/ui/den.js）：叠在 3D 屋子上的几块 */
.den-info { position: fixed; left: 10px; top: 132px; width: 330px; display: flex; flex-direction: column; gap: 5px; }
.den-name { font-size: 18px; }
.den-side { position: fixed; right: 10px; top: 132px; width: 280px; display: flex; flex-direction: column; gap: 4px; max-height: calc(100vh - 300px); overflow: auto; }
.den-pal { display: flex; align-items: center; gap: 6px; }
.den-pal img { width: 32px; height: 32px; image-rendering: pixelated; flex: none; }
.den-top { position: fixed; right: 10px; top: 86px; display: flex; gap: 6px; }
.kv2 { display: grid; grid-template-columns: auto 1fr; gap: 3px 8px; align-items: center; }
.den-actions { position: fixed; left: 50%; bottom: 14px; transform: translateX(-50%); display: flex; gap: 8px; }
.btn.care { position: relative; flex-direction: column; gap: 0; min-width: 84px; padding: 4px 6px 2px; overflow: hidden; }
.btn.care .nm { font-size: var(--fs-s); }
.btn.care .cd { position: absolute; left: 0; right: 0; bottom: 0; height: 0; background: rgba(24, 26, 38, 0.72); pointer-events: none; transition: height 0.3s steps(6); }
.btn.care .cdt { position: absolute; left: 0; right: 0; top: 12px; text-align: center; font-family: var(--pix); font-size: 12px; color: #fff8e6; text-shadow: var(--ol); }
.btn.care.cooling { filter: saturate(0.5); }
.btn.care.wanted { animation: selPulse 0.8s steps(2) infinite; box-shadow: 0 0 0 calc(var(--u) * 2) #ffd24a; }
.den-say { position: fixed; left: 50%; bottom: 112px; transform: translateX(-50%); width: min(92vw, 520px); min-height: 58px; padding: 10px 14px 8px; }
.den-say-name { position: absolute; left: 10px; top: -13px; padding: 0 8px; background: var(--ink); color: #fff8e6; font-family: var(--pix); font-size: 12px; line-height: 16px; }
.den-say-text { font-size: calc(var(--fs) + 2px); line-height: 1.5; }
.den-foods { position: fixed; left: 50%; bottom: 112px; transform: translateX(-50%); width: min(92vw, 520px); z-index: 4; display: flex; flex-direction: column; gap: 6px; }
/* 3D 卡片（src/ui/card3d.js）：元素本身是卡片的占位（5:7），里面的画布比它大一圈——倾斜出去的角和底下的影子画在多出来的那圈里 */
.card3d { position: relative; flex: none; aspect-ratio: 5 / 7; width: 300px; cursor: pointer; touch-action: none; }
.card3d.sm { width: 150px; }
.card3d.md { width: 220px; }
.card3d.xl { width: min(380px, 78vw, calc((100vh - 150px) * 5 / 7)); }
.card3d > canvas { position: absolute; left: -13%; top: -10%; width: 126%; height: 120%; pointer-events: none; image-rendering: auto; }
/* 新生命卡：压暗的全屏层 + 3D 卡 + 起名栏（矮屏时卡和起名栏横着排）*/
.newborn { position: fixed; inset: 0; z-index: 45; background: rgba(20, 18, 26, 0.62); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; animation: fadeIn 0.3s steps(5); }
.newborn .title.big { font-size: calc(var(--u) * 16); line-height: 1.2; color: #ffe9a6; }
.newborn-bar { display: flex; align-items: center; gap: 8px; padding: 6px 10px; white-space: nowrap; }
.newborn-bar .field { width: 9em; }
@media (max-height: 560px) { .newborn { flex-direction: row; flex-wrap: wrap; gap: 8px 22px; } .newborn .title.big { flex-basis: 100%; text-align: center; font-size: calc(var(--u) * 12); } .newborn .card3d.xl { width: calc((100vh - 90px) * 5 / 7); } .newborn-bar { flex-direction: column; align-items: stretch; } }
/* 放大看卡片：弹窗没有框，只有卡和一行字 */
.modal.bare { background: none; border: 0; border-image: none; box-shadow: none; overflow: visible; padding: 0; }
.cardview { align-items: center; gap: 34px; }
.cardview .small { color: #f6eedd; text-shadow: 0 1px 0 #1d1b28; }
.card-stage { padding: 14px 20px; flex: none; }
.modal:has(.card3d):not(.bare) { overflow-x: hidden; }
.st-item .card3d { margin: 6px 16px 4px; }
/* 信箱：信的列表、信纸、委托要的东西、礼物的小标签 */
.mail-body { max-height: min(60vh, calc(100vh - 176px)); overflow: auto; min-height: 96px; min-width: min(80vw, 420px); padding-right: 2px; }
.col.tight { gap: 0; min-width: 0; }
.mail-row.read { filter: saturate(0.7) brightness(0.92); }
.mail-row .dot { width: 8px; height: 8px; flex: none; background: #ff6a5a; border: var(--u) solid var(--ink); animation: selPulse 0.8s steps(2) infinite; }
.mail-row .small, .folk .small { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pill.k-card { background: #b8862a; color: #fff8d8; } .pill.k-gift { background: #4f9a66; color: #f0ffe8; } .pill.k-request { background: #c8543e; color: #fff0e8; } .pill.k-letter { background: #5f6e7c; }
.letter { padding: 8px 12px 6px; max-width: 460px; }
.letter-text { font-size: calc(var(--fs) + 1px); line-height: 1.7; text-indent: 2em; }
.letter-sign { text-align: right; margin-top: 6px; color: #8f8068; }
.gift-row { align-items: center; gap: 6px; }
.chip { display: inline-flex; align-items: center; gap: 4px; padding: 0 6px 0 2px; background: #4a5866; border: var(--u) solid var(--ink); font-size: var(--fs-s); line-height: 1.5; }
.chip img { width: 22px; height: 22px; image-rendering: pixelated; }
.need-row { display: flex; align-items: center; gap: 10px; padding: 4px 8px; }
.need-row img { width: 36px; height: 36px; image-rendering: pixelated; flex: none; }
.envelope { width: 280px; height: 180px; background: #e9d8b4; position: relative; border: calc(var(--u) * 2) solid var(--ink); box-shadow: inset 0 -6px 0 #cbb48a, 0 6px 0 rgba(26, 28, 40, 0.5); overflow: hidden; cursor: pointer; }
.envelope::before { content: ''; position: absolute; left: 0; right: 0; top: 0; height: 60%; background: #dcc79e; clip-path: polygon(0 0, 100% 0, 50% 100%); }
.envelope .seal { position: absolute; left: 50%; top: 52%; width: 28px; height: 28px; margin: -14px; background: #c84a52; border: calc(var(--u) * 2) solid var(--ink); box-shadow: inset 3px 3px 0 #f08088, inset -3px -3px 0 #8a2a34; }
.fly-away { animation: flyAway 0.9s cubic-bezier(0.5, 0, 0.8, 0.4) forwards; }
@keyframes flyAway { 30% { transform: translateY(12px) rotate(-4deg); } to { transform: translate(60vw, -60vh) rotate(25deg) scale(0.4); opacity: 0; } }
.drop-in { animation: dropIn 0.5s steps(8); }
@keyframes dropIn { from { transform: translateY(-40vh) rotate(-10deg); opacity: 0; } }

/* ---------- 登录 ---------- */
.login { position: fixed; left: 50%; top: 50%; transform: translate(-50%, -50%); width: 360px; padding: 14px 16px 16px; animation: popIn 0.4s steps(8); }
.login .logo { text-align: center; margin-bottom: 12px; }
.login .logo .big { color: #ffe9a6; font-size: 48px; line-height: 56px; text-shadow: var(--ol), 0 6px 0 var(--ink); }
.login .field { width: 100%; }

/* ---------- 检视台 / 开蛋 ---------- */
.stage-tools { position: fixed; left: 50%; bottom: 12px; transform: translateX(-50%); display: flex; gap: 6px; padding: 4px 6px; }
.stage-info { position: fixed; left: 10px; top: 64px; width: 320px; }
.stage-hint { position: fixed; left: 50%; top: 78px; transform: translateX(-50%); padding: 2px 12px; }
.cursor-hammer { cursor: crosshair; }
.charge { position: fixed; width: 60px; height: 12px; pointer-events: none; z-index: 30; }

/* ---------- 图鉴 ---------- */
.codex-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 6px; }
.codex-cell { border-style: solid; border-color: transparent; border-width: calc(var(--u) * 5); border-image: var(--f-well) fill; padding: 2px; text-align: center; cursor: pointer; min-height: 108px; display: flex; flex-direction: column; align-items: center; justify-content: space-between; font-size: var(--fs-s); transition: transform 0.1s steps(2), filter 0.1s; }
.codex-cell.unknown { color: #66717f; }
.codex-cell img, .codex-cell canvas { width: 72px; height: 72px; }
.codex-cell:hover { filter: brightness(1.22); transform: translateY(calc(var(--u) * -1)); }

/* ---------- 世界 ---------- */
.world-hud { position: fixed; left: 10px; bottom: 10px; padding: 4px 8px; }
.compass { position: fixed; top: 64px; left: 50%; transform: translateX(-50%); padding: 0 10px; }
.prompt { position: fixed; left: 50%; bottom: 90px; transform: translateX(-50%); padding: 2px 12px; animation: popIn 0.3s steps(6); }
.prompt.good { color: #d6ffb8; }
.prompt.bad { color: #ffc0b0; }
.minimap { position: fixed; right: 10px; bottom: 10px; width: 176px; height: 176px; padding: 0; overflow: hidden; }
.minimap canvas { width: 100%; height: 100%; display: block; image-rendering: pixelated; }

/* ---------- 全屏的柜台（集市 / 商人 / 工坊）：ui/stations.js ---------- */
.station { position: fixed; inset: 0; z-index: 30; display: flex; flex-direction: column; overflow: hidden; animation: fadeIn 0.2s steps(4); }
.station canvas.st-bg { position: absolute; inset: 0; width: 100%; height: 100%; image-rendering: pixelated; }
.st-awning { position: relative; flex: none; height: 54px; background: repeating-linear-gradient(90deg, #e2776a 0 48px, #f6ecd8 48px 96px); border-bottom: calc(var(--u) * 2) solid var(--ink); box-shadow: inset 0 -8px 0 rgba(0, 0, 0, 0.1), inset 0 6px 0 rgba(255, 255, 255, 0.2); z-index: 2; }
.st-awning::after { content: ''; position: absolute; left: 0; right: 0; top: 100%; height: 30px; background: var(--t-awning) repeat-x; background-size: 96px 30px; image-rendering: pixelated; }
.station.blue .st-awning { background: repeating-linear-gradient(90deg, #5fa4dc 0 48px, #f6ecd8 48px 96px); }
.station.blue .st-awning::after { background-image: var(--t-awning-b); }
.station.green .st-awning { background: repeating-linear-gradient(90deg, #62bc92 0 48px, #f6ecd8 48px 96px); }
.station.green .st-awning::after { background-image: var(--t-awning-g); }
.st-sign { position: absolute; left: 50%; top: 14px; transform: translateX(-50%) rotate(-1deg); display: flex; align-items: center; gap: 10px; padding: 4px 18px 5px; z-index: 3; animation: signSwing 3.2s steps(16) infinite; transform-origin: 50% -20px; }
@keyframes signSwing { 0%, 100% { transform: translateX(-50%) rotate(-1.4deg); } 50% { transform: translateX(-50%) rotate(1.4deg); } }
.st-sign .title { font-size: calc(var(--u) * 18); line-height: calc(var(--u) * 20); }
.st-sign .ico { width: 40px; height: 40px; }
.st-close { position: absolute; right: 12px; top: 10px; z-index: 4; }
.st-wallet { position: absolute; left: 12px; top: 8px; z-index: 4; display: flex; gap: 12px; padding: 1px 8px; }
.st-body { position: relative; flex: 1; min-height: 0; display: flex; gap: 14px; padding: 46px 18px 0; z-index: 1; }
.st-tabs { flex: none; display: flex; flex-direction: column; gap: 10px; padding-top: 8px; width: 132px; }
.st-tab { display: flex; align-items: center; gap: 8px; padding: 2px 6px 2px 4px; cursor: pointer; transform-origin: 0 50%; transition: transform 0.12s steps(3), filter 0.1s; font-size: 18px; filter: brightness(0.86) saturate(0.8); }
.st-tab .ico { width: 30px; height: 30px; }
.st-tab:hover { transform: translateX(4px) rotate(-1.5deg); filter: none; }
.st-tab.on { transform: translateX(10px) scale(1.06); filter: none; }
.st-main { position: relative; flex: 1; min-width: 0; overflow-y: auto; overflow-x: hidden; padding: 6px 6px 20px; }
.st-side { flex: none; width: 300px; overflow-y: auto; padding: 4px 6px 16px; }
.st-shelf { display: flex; flex-wrap: wrap; gap: 14px 0; justify-content: center; align-items: flex-end; padding: 14px 0 6px; }
.st-item { display: flex; flex-direction: column; align-items: center; padding: 0; }
.st-item .pcard { margin: 0 12px; }
.st-item .plank { align-self: stretch; height: 16px; margin-top: 3px; background: #b98858 var(--t-wood); background-size: 64px 48px; border-top: calc(var(--u) * 2) solid var(--ink); border-bottom: calc(var(--u) * 2) solid var(--ink); box-shadow: 0 6px 0 rgba(26, 28, 40, 0.3), inset 0 4px 0 rgba(255, 255, 255, 0.2); image-rendering: pixelated; }
.st-item:first-child .plank { border-left: calc(var(--u) * 2) solid var(--ink); margin-left: -10px; }
.st-item:last-child .plank { border-right: calc(var(--u) * 2) solid var(--ink); margin-right: -10px; }
.st-item .btn, .st-item > .muted { margin-top: 10px; min-width: 84px; text-align: center; }
.st-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px; }
.st-good { display: flex; align-items: center; gap: 8px; padding: 2px 4px; }
.st-good img { width: 48px; height: 48px; flex: none; filter: drop-shadow(0 2px 0 rgba(40, 30, 20, 0.4)); }
.st-good .nm { font-size: 17px; line-height: 1.15; }
.st-good .ds { font-size: 12.5px; line-height: 1.2; color: #8f8068; }
.st-counter { position: relative; flex: none; height: 96px; margin-top: auto; z-index: 2; background: #b98858 var(--t-wood); background-size: 96px 72px; border-top: calc(var(--u) * 2) solid var(--ink); box-shadow: inset 0 10px 0 rgba(255, 255, 255, 0.16), inset 0 -34px 0 rgba(60, 34, 14, 0.38); display: flex; align-items: center; gap: 14px; padding: 0 18px 22px; image-rendering: pixelated; }
.st-keeper { position: relative; width: 96px; height: 96px; margin-top: -78px; flex: none; }
.st-keeper img { width: 96px; height: 96px; animation: keeperBob 1.6s steps(4) infinite; transform-origin: 50% 100%; filter: drop-shadow(0 3px 0 rgba(26, 28, 40, 0.4)); }
@keyframes keeperBob { 50% { transform: scaleY(0.96) translateY(2px); } }
.st-say { position: relative; max-width: 520px; padding: 1px 10px 2px; margin-top: -56px; animation: popIn 0.25s steps(5); }
.st-say::before { content: ''; position: absolute; left: -12px; top: 16px; border: 7px solid transparent; border-right-color: var(--ink); }
/* 料理台 */
.kitchen { display: flex; gap: 16px; align-items: flex-start; }
/* 料理台：食材架（窄）｜ 锅（主角，固定大小）｜ 配方本（吃掉剩下的宽度）*/
.ing-shelf { flex: none; width: 208px; max-height: calc(100vh - 230px); overflow: auto; }
.recipe-book { flex: 1; min-width: 190px; max-height: calc(100vh - 230px); overflow: auto; }
.pot-wrap { position: relative; flex: none; width: 400px; display: flex; flex-direction: column; align-items: center; gap: 6px; }
/* 3D 的锅（scenes/kitchen.js 离屏渲染后拷进来）：画布的一个像素 = 两个 CSS 像素 */
canvas.pot { width: 400px; height: 352px; image-rendering: pixelated; border: calc(var(--u) * 2) solid var(--ink); box-shadow: 0 calc(var(--u) * 3) 0 rgba(26, 28, 40, 0.4); }
/* 出锅时的菜名：贴在锅的画布上方（成品的模型在画布里） */
.dish-pop.text { position: absolute; left: 50%; top: 6px; transform: translateX(-50%); z-index: 3; animation: popIn 0.3s steps(6); white-space: nowrap; pointer-events: none; }
.dish-pop.text .box { white-space: normal; max-width: 300px; text-align: center; }
.pot-slots { display: flex; gap: 8px; min-height: 60px; align-items: center; }
.pot-slot { width: 56px; height: 56px; border-style: solid; border-color: transparent; border-width: calc(var(--u) * 5); border-image: var(--f-well) fill; display: flex; align-items: center; justify-content: center; cursor: pointer; }
.pot-slot img { width: 40px; height: 40px; animation: popIn 0.2s steps(4); }
.fly-ico { position: fixed; z-index: 70; width: 48px; height: 48px; pointer-events: none; image-rendering: pixelated; }
.ing-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 8px; align-content: start; }
.ing { position: relative; display: flex; flex-direction: column; align-items: center; padding: 2px 2px 0; cursor: pointer; text-align: center; font-size: 14px; line-height: 1.15; transition: transform 0.1s steps(2); }
.ing:hover { transform: translateY(-3px) rotate(-2deg); }
.ing img { width: 48px; height: 48px; filter: drop-shadow(0 2px 0 rgba(40, 30, 20, 0.4)); }
.ing .cnt { position: absolute; right: 2px; top: -4px; font-family: var(--pix); font-size: 12px; color: #fff; text-shadow: var(--ol); }
.ing.out { filter: grayscale(1) brightness(0.8); cursor: default; }
.recipe { padding: 2px 4px; border-bottom: var(--u) dashed #cdbf9e; font-size: 15px; line-height: 1.3; }
.recipe .ds { font-size: 12.5px; color: #8f8068; }
.dish-pop { position: fixed; left: 50%; top: 42%; transform: translate(-50%, -50%); z-index: 75; display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; animation: dishPop 1.9s steps(24) forwards; }
.dish-pop img { width: 128px; height: 128px; image-rendering: pixelated; filter: drop-shadow(0 6px 0 rgba(26, 28, 40, 0.45)); }
@keyframes dishPop { 0% { transform: translate(-50%, 10%) scale(0.2); opacity: 0; } 18% { transform: translate(-50%, -60%) scale(1.25); opacity: 1; } 28% { transform: translate(-50%, -50%) scale(1); } 82% { transform: translate(-50%, -50%) scale(1); opacity: 1; } 100% { transform: translate(-50%, -90%) scale(0.9); opacity: 0; } }
.shake { animation: shake 0.5s steps(10); }
@keyframes shake { 20% { transform: translate(-4px, 2px) rotate(-2deg); } 40% { transform: translate(4px, -2px) rotate(2deg); } 60% { transform: translate(-3px, 1px) rotate(-1deg); } 80% { transform: translate(3px, 0) rotate(1deg); } }
/* 改造台 */
.op-table { position: relative; flex: none; width: 300px; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.op-pad { width: 300px; height: 260px; image-rendering: pixelated; border: calc(var(--u) * 2) solid var(--ink); box-shadow: inset 0 0 0 calc(var(--u) * 2) #e3bd58, 0 calc(var(--u) * 3) 0 rgba(26, 28, 40, 0.4); }
.who { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; }
.who .btn img { width: 32px; height: 32px; }
.tool-card { padding: 2px 6px 4px; }
.tool-card.locked { filter: grayscale(0.8) brightness(0.85); }

/* ---------- 面板（参数，开发用）---------- */
.devpanel { position: fixed; right: 10px; top: 66px; width: 340px; max-height: 80vh; overflow: auto; font-family: ui-monospace, monospace; font-size: 11px; line-height: 14px; z-index: 80; }
.devpanel label { display: grid; grid-template-columns: 120px 1fr 44px; gap: 4px; align-items: center; margin: 2px 0; }
.devpanel input[type=range] { width: 100%; }
.devpanel h4 { margin: 6px 0 2px; color: var(--warn); font-size: 12px; }

/* ---------- 窄一点的屏幕：顶栏收紧，右边的图标不被挤出去 ---------- */
@media (max-width: 1180px) {
  #hud { gap: 5px; }
  .icon-btn .ico { width: 24px; height: 24px; }
  .hud-icons { gap: 4px; }
  .hud-money { gap: 8px; padding: 3px 5px; }
  .hud-clock { gap: 5px; padding: 2px 6px; }
}

/* ---------- 竖屏 / 窄窗口（手机竖着拿）：顶栏分两行、底部导航可横滑、面板从底部升起 ---------- */
@media (max-width: 720px) {
  /* 竖屏：日期 | 钱 一行，小目标一行，图标一行（靠右）*/
  #hud { grid-template-columns: auto 1fr; grid-template-areas: 'clock money' 'quest quest' 'icons icons'; gap: 4px; top: max(4px, env(safe-area-inset-top)); left: 4px; right: 4px; }
  .hud-icons { justify-self: end; gap: 3px; }
  .hud-money { justify-content: space-around; gap: 6px; padding: 2px 4px; }
  .hud-quest { justify-self: stretch; max-width: none; }
  .icon-btn .ico { width: 22px; height: 22px; }
  /* 底栏：八个入口平分一行，都看得见（名字换成两个字的），不用横向滚 */
  #dock { left: 4px; right: 4px; transform: none; justify-content: space-between; gap: 2px; padding: 3px 3px 4px; bottom: max(4px, env(safe-area-inset-bottom)); }
  #dock .btn { flex: 1 1 0; min-width: 0; padding: 1px 0 0; }
  #dock .btn .ico { width: 26px; height: 26px; }
  #dock .btn .lb { font-size: 0; white-space: nowrap; }
  #dock .btn .lb::after { content: attr(data-short); font-size: 12px; }
  .side, .side.left { left: 4px; right: 4px; width: auto; top: auto; bottom: 90px; height: min(48vh, 430px); animation-name: sheetIn; }
  .side.sub { right: 4px; max-height: none; z-index: 4; }
  .side.sub .scroll { max-height: none; }
  .den-info { left: 4px; right: 4px; width: auto; top: 136px; }
  .den-side { display: none; }
  .den-top { top: 96px; right: 4px; }
  .den-actions { gap: 3px; bottom: 6px; }
  .btn.care { min-width: 0; width: 72px; padding: 2px 2px 1px; }
  .den-say, .den-foods { bottom: 92px; }
  .stage-info { left: 4px; right: 4px; width: auto; top: 104px; max-height: 26vh; overflow-y: auto; }
  .stage-hint { top: auto; bottom: 62px; max-width: 94vw; text-align: center; }
  .stage-tools { flex-wrap: wrap; justify-content: center; width: calc(100vw - 8px); bottom: 6px; }
  .modal, .modal.wide { max-width: 96vw; width: auto; max-height: 86vh; padding: 8px 10px; }
  .modal.wide { width: 96vw; } /* 图鉴、做蛋卡这些宽弹窗在竖屏占满宽度（不然里面的网格会缩成一列）*/
  .envelope { max-width: 100%; box-sizing: border-box; }
  /* 柜台界面（集市 / 商人 / 工坊）竖着排：钱袋和「离开」一行，招牌在下面一行，页签横排，内容上下叠 */
  .st-awning { height: 40px; }
  .st-sign { top: 42px; padding: 2px 12px 3px; gap: 6px; }
  .st-sign .title { font-size: calc(var(--u) * 13); line-height: calc(var(--u) * 16); }
  .st-sign .ico { width: 26px; height: 26px; }
  .st-wallet { left: 6px; top: 6px; gap: 6px; padding: 0 6px; }
  .st-close { right: 6px; top: 6px; }
  .st-body { flex-direction: column; gap: 6px; padding: 86px 8px 0; }
  .st-tabs { flex-direction: row; flex-wrap: wrap; width: auto; padding-top: 0; gap: 6px; }
  .st-tab { font-size: 15px; padding: 1px 8px 1px 3px; }
  .st-tab .ico { width: 22px; height: 22px; }
  .st-tab.on, .st-tab:hover { transform: translateY(-2px); }
  .st-side { width: auto; max-height: 32vh; }
  .st-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 6px; }
  .kitchen { flex-direction: column; height: auto; gap: 8px; }
  .pot-wrap, .op-table { width: 100%; }
  .ing-shelf, .recipe-book { width: auto; max-height: none; flex: none; }
  .kitchen { align-items: stretch; }
  .pot-wrap { order: -1; }
  canvas.pot { width: 320px; height: 282px; }
  .op-pad { width: 240px; height: 208px; }
  .st-say { max-width: none; }
  .st-item .card3d { margin: 6px 8px 4px; }
  .st-counter { height: 74px; gap: 8px; padding: 0 8px 16px; }
  .st-keeper { width: 72px; height: 72px; margin-top: -56px; }
  .st-keeper img { width: 72px; height: 72px; }
  .st-say { margin-top: 0; align-self: flex-end; margin-bottom: 2px; font-size: var(--fs-s); line-height: 1.3; max-height: 3.9em; overflow: hidden; }
  .minimap { width: 120px; height: 120px; }
  .compass { top: 104px; }
}
@keyframes sheetIn { from { transform: translateY(40px); opacity: 0; } }

/* ---------- 矮屏（手机横着拿）：上下都收紧，面板靠右、不挡住中间 ---------- */
@media (max-height: 520px) {
  #hud { top: 4px; gap: 4px; }
  .icon-btn .ico { width: 22px; height: 22px; }
  #dock { bottom: 4px; padding: 2px 5px 3px; }
  #dock .btn { min-width: 50px; font-size: 12px; }
  #dock .btn .ico { width: 24px; height: 24px; }
  .side { top: 48px; bottom: 80px; width: min(380px, 46vw); }
  .hud-quest .q-text { -webkit-line-clamp: 1; }
  .stage-info { top: 48px; width: min(300px, 40vw); max-height: calc(100vh - 116px); overflow-y: auto; }
  .stage-hint { top: 50px; }
  .modal { max-height: 94vh; }
  .st-awning { height: 30px; }
  .st-body { padding-top: 22px; }
  .st-counter { height: 60px; padding-bottom: 10px; }
}
