:root {
  --o: #4A2511;            /* 卡通描边色 */
  --bg: #2A1210;
  --paper: #FFFBF1;
  --paper2: #FFF3D9;
  --ink: #3A2412;
  --ink2: #8A6A48;
  --ink3: #B4987A;
  --yellow: #FFC93C;
  --yellow2: #FFB000;
  --red: #E5484D;
  --green: #22A35A;
  --blue: #3B82F6;
  --r: 18px;
  --font: "PingFang SC", "HarmonyOS Sans SC", "Microsoft YaHei UI", "Microsoft YaHei", -apple-system, "Segoe UI", sans-serif;
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background-color: var(--bg);
  background-image:
    radial-gradient(ellipse 80% 50% at 50% -10%, rgba(255, 120, 60, .25), transparent 70%),
    radial-gradient(rgba(255, 220, 160, .06) 1.5px, transparent 1.6px);
  background-size: 100% 100%, 22px 22px;
  background-attachment: fixed;
  min-height: 100vh;
  color: var(--ink);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; padding: 0; }
button:disabled { cursor: default; }
[hidden] { display: none !important; }

.app { max-width: 1240px; margin: 0 auto; padding: 0 16px calc(24px + env(safe-area-inset-bottom)); }

/* ───── 顶栏 ───── */
.top { display: flex; align-items: center; justify-content: space-between; height: 58px; }
/* 致敬某橙色网站的经典排版：白字 + 色块里的黑字，换成爆米花黄 */
.brand {
  display: inline-flex; align-items: center; gap: 3px;
  font-family: "Arial Black", "Helvetica Neue", Arial, var(--font); font-weight: 900; font-size: 25px; letter-spacing: -.04em;
  background: #000; padding: 5px 8px; border-radius: 8px;
}
.brand .bp { color: #fff; }
.brand .bh { background: #FFB800; color: #000; border-radius: 5px; padding: 0 5px 1px; }
.brand .tld { color: #8A8A8A; font-size: 13px; font-family: var(--font); font-weight: 800; margin-left: 2px; align-self: flex-end; letter-spacing: 0; }
.icon-btn {
  width: 40px; height: 40px; border-radius: 12px; font-size: 18px; font-weight: 900; color: var(--o);
  background: var(--paper); border: 2.5px solid var(--o); box-shadow: 0 3px 0 var(--o);
}
.icon-btn:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--o); }

/* ───── 布局 ───── */
.layout { display: grid; gap: 16px; }
@media (min-width: 900px) {
  .layout { grid-template-columns: minmax(0, 1fr) 420px; align-items: start; }
  .stage { position: sticky; top: 10px; height: calc(100vh - 86px); min-height: 600px; }
}

/* ═════════ 工厂场景 ═════════ */
.stage {
  position: relative; overflow: hidden;
  height: max(500px, 68vh);
  border-radius: 26px;
  border: 3px solid var(--o);
  box-shadow: 0 6px 0 var(--o), 0 18px 40px rgba(91, 58, 30, .25);
  user-select: none; -webkit-user-select: none;
  isolation: isolate;
  container-type: size;
}
.stage.shake { animation: shake .25s; }
.stage.shake2 { animation: shake2 .5s; }
@keyframes shake { 25% { transform: translate(-3px, 1px); } 50% { transform: translate(3px, -1px); } 75% { transform: translate(-2px, 0); } }
@keyframes shake2 { 10%, 50%, 90% { transform: translate(-6px, 2px) rotate(-.4deg); } 30%, 70% { transform: translate(6px, -2px) rotate(.4deg); } }

/* 红色幕布：褶皱 + 中心聚光 + 四周暗角 */
.wall {
  position: absolute; inset: 0; z-index: 0;
  background:
    radial-gradient(ellipse 55% 45% at 50% 52%, rgba(255, 190, 90, .38), transparent 70%),
    radial-gradient(ellipse 120% 90% at 50% 50%, transparent 55%, rgba(20, 0, 0, .55)),
    repeating-linear-gradient(90deg, #9E1B26 0, #C8303A 26px, #D93A44 34px, #B3222D 52px, #9E1B26 68px);
}
/* 红白条纹雨棚，底边是波浪 */
.awning {
  position: absolute; z-index: 1; left: -2px; right: -2px; top: 30px; height: 36px;
  background: repeating-linear-gradient(90deg, #E63946 0 32px, #FFF6E6 32px 64px);
  -webkit-mask: radial-gradient(circle at 16px 0, #000 16px, transparent 16.5px) 0 20px / 32px 16px repeat-x, linear-gradient(#000, #000) 0 0 / 100% 21px no-repeat;
  mask: radial-gradient(circle at 16px 0, #000 16px, transparent 16.5px) 0 20px / 32px 16px repeat-x, linear-gradient(#000, #000) 0 0 / 100% 21px no-repeat;
  filter: drop-shadow(0 4px 0 rgba(0, 0, 0, .25));
}
/* 跑马灯泡 */
.bulbs {
  position: absolute; z-index: 1; left: 0; right: 0; top: 30px; height: 12px;
  background: radial-gradient(circle, #FFF8C9 0 2.5px, #FFC93C 3.5px, rgba(255, 201, 60, .35) 5px, transparent 7px) 0 0 / 32px 12px repeat-x;
  animation: chase .9s steps(2) infinite;
}
@keyframes chase { 0% { background-position-x: 0; } 100% { background-position-x: 32px; } }
/* 柜台：木质台面 + 红白条纹前脸 */
.counter {
  position: absolute; left: 0; right: 0; bottom: 0; height: 22%; z-index: 2;
  border-top: 4px solid var(--o);
  background:
    linear-gradient(#C98A50, #A86E3A) top / 100% 12px no-repeat,
    linear-gradient(var(--o), var(--o)) 0 12px / 100% 3px no-repeat,
    repeating-linear-gradient(90deg, #E63946 0 26px, #FFF3E0 26px 52px);
}
/* 展示柜（库存） */
.case {
  position: absolute; z-index: 4; left: 20%; width: 25%; bottom: 3%; height: 15%;
  border: 3px solid var(--o); border-radius: 10px; pointer-events: none;
  background: linear-gradient(115deg, rgba(255, 255, 255, .35) 0 18%, transparent 18% 30%, rgba(255, 255, 255, .15) 30% 36%, transparent 36%), rgba(255, 245, 220, .18);
  box-shadow: inset 0 0 0 3px rgba(255, 255, 255, .4), 0 3px 0 rgba(0, 0, 0, .25);
}
.case-label {
  position: absolute; left: 50%; bottom: calc(100% + 3px); transform: translateX(-50%); white-space: nowrap;
  font-size: 11px; font-weight: 900; color: #fff; background: var(--o); border-radius: 99px; padding: 1px 8px;
  font-variant-numeric: tabular-nums;
}
/* 进货 / 卖货 大按钮 */
.act-btn {
  position: absolute; z-index: 6; bottom: 3%; height: 15%; min-height: 54px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1.1;
  border: 3px solid var(--o); border-radius: 14px; box-shadow: 0 4px 0 var(--o); color: var(--o);
}
.act-btn:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--o); }
.act-btn .ico { font-size: 20px; }
.act-btn .lbl { font-size: 14px; font-weight: 900; }
.act-btn small { font-size: 10px; font-weight: 800; opacity: .8; white-space: nowrap; }
.act-btn .auto {
  position: absolute; top: -9px; right: -6px; font-style: normal; font-size: 10px; font-weight: 900;
  background: var(--green); color: #fff; border: 2px solid var(--o); border-radius: 99px; padding: 0 5px;
}
.corn-btn { left: 2%; width: 16%; background: linear-gradient(#FFE58A, #FFC93C); }
.sell-btn { left: 47%; width: 13%; background: linear-gradient(#B8F5C9, #4ADE80); }
.sell-btn.idle { filter: saturate(.3) brightness(.95); }
.act-btn.warn { animation: buyPulse .8s ease-in-out infinite; }
.act-btn.nudge { animation: shake .35s 2; }
.act-btn small.cheap { color: #0E7A3A; opacity: 1; }
.act-btn small.dear { color: #C0262D; opacity: 1; }
/* 顾客队列 */
.queue {
  position: absolute; z-index: 5; left: 61%; right: 1%; bottom: 3%; height: 15%;
  display: flex; gap: 2px; align-items: flex-end; overflow: hidden; padding-top: 30px; box-sizing: content-box;
}
.cust {
  position: relative; flex: 0 0 clamp(40px, 9cqw, 58px); display: flex; flex-direction: column; align-items: center;
  animation: custIn .45s cubic-bezier(.2, 1.4, .4, 1);
}
.cust .ava { font-size: clamp(26px, 6cqw, 36px); line-height: 1; filter: drop-shadow(0 2px 0 rgba(0, 0, 0, .3)); }
.cust .bubble {
  display: flex; align-items: center; gap: 1px; background: #fff; border: 2px solid var(--o); border-radius: 10px;
  padding: 0 4px 0 1px; font-size: 11px; font-weight: 900; color: var(--o); white-space: nowrap; margin-bottom: 2px;
  font-variant-numeric: tabular-nums;
}
.cust .bubble svg { width: 18px; height: 18px; }
.cust.ready .bubble { background: #D9FBE3; }
.cust.vip .bubble { background: #FFE14D; }
.cust .pat { width: 80%; height: 5px; border-radius: 4px; background: rgba(0, 0, 0, .35); overflow: hidden; margin-top: 2px; }
.cust .pat i { display: block; height: 100%; }
.cust.happy { animation: custHappy .65s ease-in forwards; pointer-events: none; }
.cust.angry { animation: custAngry .7s ease-in forwards; pointer-events: none; }
@keyframes custIn { from { transform: translateX(80px); opacity: 0; } }
@keyframes custHappy { 30% { transform: translateY(-14px); } 100% { transform: translate(60px, -10px); opacity: 0; } }
@keyframes custAngry { 20%, 60% { transform: translateX(-4px); } 40%, 80% { transform: translateX(4px); } 100% { transform: translateX(80px); opacity: 0; } }
.coin {
  position: absolute; z-index: 9; transform: translate(-50%, -50%); white-space: nowrap; pointer-events: none;
  font-weight: 900; font-size: 18px; color: #FFE14D; -webkit-text-stroke: 5px var(--o); paint-order: stroke fill;
  animation: floatUp 1s ease-out forwards;
}
/* 主角身后的光芒 */
.rays {
  position: absolute; z-index: 2; left: 50%; top: 47%; width: min(110cqw, 120cqh); aspect-ratio: 1;
  transform: translate(-50%, -50%); pointer-events: none; opacity: .42;
}
.rays svg { width: 100%; height: 100%; display: block; animation: m-spin 40s linear infinite; }

.broadcast {
  position: absolute; top: 0; left: 0; right: 0; height: 30px; z-index: 6;
  background: #2B1D10; border-bottom: 3px solid var(--o); overflow: hidden; white-space: nowrap;
  display: flex; align-items: center;
}
.broadcast .mic { position: relative; z-index: 1; background: #2B1D10; padding: 0 8px 0 10px; font-size: 14px; height: 100%; display: flex; align-items: center; }
.broadcast #ticker {
  display: inline-block; color: #FFB347; font-size: 13px; font-weight: 700; letter-spacing: .04em;
  text-shadow: 0 0 6px rgba(255, 150, 40, .7); padding-left: 100%;
  animation: marquee var(--dur, 14s) linear forwards;
}
@keyframes marquee { from { transform: translateX(0); } to { transform: translateX(-100%); } }

/* 设备 */
.machines { position: absolute; inset: 0; z-index: 3; pointer-events: none; }
.machine {
  --spd: 1;
  position: absolute; width: min(18cqw, 17cqh, 140px); aspect-ratio: 1; pointer-events: auto;
}
.machine svg { width: 100%; height: 100%; display: block; overflow: visible; }
.machine.L { left: 2%; }
.machine.R { right: 2%; }
.machine.t0 { bottom: 25%; }
.machine.t1 { bottom: 46%; }
.machine.t2 { bottom: 67%; }
.machine::after {
  content: ''; position: absolute; left: -8%; right: -8%; bottom: -9px; height: 11px; pointer-events: none;
  background: linear-gradient(#FFD966, #D9A21E); border: 2.5px solid var(--o); border-radius: 4px;
  box-shadow: 0 5px 0 rgba(0, 0, 0, .25);
}
.machine.empty, .machine.locked { display: grid; place-items: center; }
.machine.empty .emptyico { font-size: 26px; font-weight: 900; color: rgba(255, 230, 200, .45); width: 60%; aspect-ratio: 1; display: grid; place-items: center; border: 3px dashed rgba(255, 230, 200, .35); border-radius: 14px; }
.machine.locked .lockico { font-size: 22px; opacity: .45; }
.machine.sel svg { filter: drop-shadow(0 0 0 #fff) drop-shadow(0 0 8px #FFE14D) drop-shadow(0 0 2px #FFE14D); }
.machine.star3 svg { filter: drop-shadow(0 0 6px #7CC4FF); }
.machine.star4 svg { filter: drop-shadow(0 0 7px #D58CFF); }
.machine.star5 svg { filter: drop-shadow(0 0 9px #FFD23F); }
.machine.starved svg { filter: grayscale(.8) brightness(.8); }
.machine.starved * { animation-play-state: paused !important; }
.machine .starve {
  display: none; position: absolute; left: 50%; top: 20%; transform: translateX(-50%); white-space: nowrap;
  font-size: 11px; font-weight: 900; color: #fff; background: var(--red); border: 2px solid var(--o); border-radius: 8px; padding: 1px 6px;
  animation: buyPulse .8s infinite;
}
.machine.starved .starve { display: block; }
.mbadge {
  position: absolute; top: -6px; left: 50%; transform: translateX(-50%); z-index: 1;
  font-size: 10px; font-weight: 900; padding: 0 5px; border-radius: 99px; letter-spacing: -1px;
  background: var(--o); color: #FFD23F; white-space: nowrap; border: 1.5px solid #FFD23F;
}
.mname { display: none; }
.machine.arrive { animation: m-arrive .7s cubic-bezier(.2, 1.5, .4, 1); }
.machine.bump svg { animation: m-bump .3s; }
@keyframes m-arrive { from { transform: translateY(-80px) scale(.3); opacity: 0; } }
@keyframes m-bump { 40% { transform: scale(1.12, .9); } }

.machine .a-spin { animation: m-spin calc(.45s * var(--spd)) linear infinite; }
.machine .a-lid { animation: m-lid calc(1.1s * var(--spd)) ease-in-out infinite; }
.machine .a-jiggle { animation: m-jiggle calc(1.1s * var(--spd)) ease-in-out infinite; }
.machine .a-flicker { animation: m-flicker .16s ease-in-out infinite alternate; }
.machine .a-blink { animation: m-blink 1s steps(2, jump-none) infinite; }
.machine .a-glow { animation: m-glow calc(1.3s * var(--spd)) ease-in-out infinite; }
.machine .a-turn { animation: m-turn calc(1.6s * var(--spd)) linear infinite; }
.machine .a-hum { animation: m-hum .1s linear infinite alternate; }
.machine .a-wind path { stroke-dasharray: 10 12; animation: m-dash calc(.45s * var(--spd)) linear infinite; }
.machine .a-belt { animation: m-belt calc(.5s * var(--spd)) linear infinite; }
.machine .a-carry { animation: m-carry calc(1.1s * var(--spd)) linear infinite; }
.machine .a-arm { animation: m-arm calc(.9s * var(--spd)) ease-in-out infinite alternate; }
.machine .a-eyes { animation: m-eyes 3s infinite; }
.machine .a-flash { animation: m-flash .7s ease-out infinite; }
.machine .a-dash { animation: m-dash 1s linear infinite; }
@keyframes m-spin { to { transform: rotate(360deg); } }
@keyframes m-lid { 0%, 55%, 100% { transform: translateY(0) rotate(0); } 68% { transform: translateY(-14px) rotate(-8deg); } 80% { transform: translateY(-3px) rotate(3deg); } }
@keyframes m-jiggle { 0%, 55%, 100% { transform: translateX(0); } 60% { transform: translateX(-2px); } 66% { transform: translateX(2px); } 72% { transform: translateX(-1px); } }
@keyframes m-flicker { from { transform: scaleY(.85); } to { transform: scaleY(1.15); } }
@keyframes m-blink { 50% { opacity: .2; } }
@keyframes m-glow { 0%, 100% { opacity: .35; } 50% { opacity: .85; } }
@keyframes m-turn { 0% { transform: scaleX(1); } 50% { transform: scaleX(-1); } 100% { transform: scaleX(1); } }
@keyframes m-hum { from { transform: translate(0, 0); } to { transform: translate(.6px, -.4px); } }
@keyframes m-dash { to { stroke-dashoffset: -22; } }
@keyframes m-belt { to { transform: translateX(-12px); } }
@keyframes m-carry { to { transform: translateX(-26px); } }
@keyframes m-arm { from { transform: rotate(-10deg); } to { transform: rotate(45deg); } }
@keyframes m-eyes { 0%, 92%, 100% { transform: scaleY(1); } 95% { transform: scaleY(.1); } }
@keyframes m-flash { 0% { transform: scale(.2); opacity: 1; } 100% { transform: scale(1.4); opacity: 0; } }

#sceneCanvas { position: absolute; inset: 0; z-index: 3; pointer-events: none; }

/* 主角：大爆米花 */
.corn {
  position: absolute; z-index: 4; left: 50%; top: 50%; transform: translate(-50%, -50%);
  touch-action: manipulation; outline: none; line-height: 0;
}
.corn.nocorn svg { filter: grayscale(.5); }
.corn svg {
  width: min(42cqw, 36cqh, 300px); height: auto; display: block; overflow: visible;
  transition: transform .1s cubic-bezier(.2, 1.8, .4, 1); transform-origin: 50% 92%;
}
.corn .h-body { animation: breathe 2.2s ease-in-out infinite; transform-origin: 120px 230px; transform-box: view-box; }
@keyframes breathe { 50% { transform: scale(1.025, .975) translateY(2px); } }
.corn:hover svg { transform: scale(1.04) rotate(-2deg); }
.corn.press svg { transform: scale(1.1, .86); transition: transform .03s; }
.corn:focus-visible svg { outline: 3px dashed #fff; outline-offset: 8px; border-radius: 40%; }
.corn .pupil { transition: transform .12s; }
.corn .h-blink { animation: blink 4.2s infinite; transform-origin: 120px 128px; transform-box: view-box; }
@keyframes blink { 0%, 94%, 100% { transform: scaleY(1); } 97% { transform: scaleY(.08); } }
/* 表情切换：按下 → 闭眼张嘴；连击 → 星星眼大笑 */
.corn .e-sq, .corn .e-star, .corn .m-open, .corn .m-grin { display: none; }
.corn.hype .e-normal, .corn.hype .m-normal { display: none; }
.corn.hype .e-star, .corn.hype .m-grin { display: inline; }
.corn.press .e-normal, .corn.press .e-star, .corn.press .m-normal, .corn.press .m-grin { display: none; }
.corn.press .e-sq, .corn.press .m-open { display: inline; }
.corn.hype .e-star path { animation: m-spin 1.2s linear infinite; transform-box: fill-box; transform-origin: center; }

.combo {
  position: absolute; z-index: 7; left: calc(50% + 60px); top: 30%; pointer-events: none;
  font-size: 26px; font-weight: 900; color: #fff; white-space: nowrap;
  -webkit-text-stroke: 7px var(--red); paint-order: stroke fill;
  transform: rotate(-8deg); opacity: 0; transition: opacity .3s;
}
.combo.on { opacity: 1; }
.combo.pop { animation: comboPop .18s; }
.combo small { font-size: 15px; }
@keyframes comboPop { 50% { transform: rotate(-8deg) scale(1.3); } }


/* HUD */
.hud {
  position: absolute; z-index: 6; top: 64px; left: 50%; transform: translateX(-50%);
  width: min(52%, 330px); text-align: center; pointer-events: none;
}
.rank {
  pointer-events: auto; display: inline-grid; grid-template-columns: auto auto; align-items: center; gap: 2px 7px;
  background: var(--paper); border: 2.5px solid var(--o); border-radius: 14px; box-shadow: 0 3px 0 var(--o);
  padding: 4px 12px 6px 5px;
}
.rank .lv {
  grid-row: span 2; font-size: 11px; font-weight: 900; color: var(--o); background: var(--yellow);
  border: 2px solid var(--o); border-radius: 9px; padding: 3px 6px;
}
.rank .rt { font-size: 13px; font-weight: 900; text-align: left; }
.rank .rbar { display: block; width: 110px; height: 7px; border-radius: 9px; background: #EADBC0; border: 1.5px solid var(--o); overflow: hidden; }
.rank .rbar i { display: block; height: 100%; width: 0; background: var(--green); transition: width .5s; }
.chips { display: flex; gap: 4px; justify-content: center; flex-wrap: wrap; margin-top: 7px; }
.chip-r {
  font-size: 12px; font-weight: 800; color: var(--o); background: rgba(255, 255, 255, .9); border: 2px solid var(--o);
  border-radius: 99px; padding: 1px 8px; white-space: nowrap; font-variant-numeric: tabular-nums;
}
.chip-r.low { background: #FFD6D6; color: var(--red); animation: buyPulse .8s infinite; }
.debt {
  pointer-events: auto; margin-top: 6px; font-size: 12px; font-weight: 900; color: #fff; background: var(--red);
  border: 2px solid var(--o); border-radius: 99px; padding: 2px 10px; box-shadow: 0 2px 0 var(--o);
}
.score {
  margin-top: 4px; font-size: clamp(34px, 6vw, 54px); font-weight: 900; line-height: 1;
  color: var(--yellow); -webkit-text-stroke: 9px var(--o); paint-order: stroke fill;
  letter-spacing: -.01em; font-variant-numeric: tabular-nums;
  filter: drop-shadow(0 4px 0 var(--o));
}
.score.pulse { animation: scorePulse .12s; }
@keyframes scorePulse { 50% { transform: scale(1.06); } }
.rate {
  display: inline-block; margin-top: 8px; font-size: 13px; font-weight: 800; color: var(--o);
  background: rgba(255, 255, 255, .85); border: 2px solid var(--o); border-radius: 99px; padding: 2px 12px;
  font-variant-numeric: tabular-nums;
}
.rate b { color: var(--green); }
.buffs { display: flex; gap: 5px; flex-wrap: wrap; justify-content: center; margin-top: 6px; }
.buff {
  font-size: 11px; font-weight: 800; padding: 2px 8px; border-radius: 99px;
  background: #FFE1E1; color: var(--red); border: 2px solid var(--red); font-variant-numeric: tabular-nums;
}

.event-pill {
  position: absolute; z-index: 7; left: 50%; bottom: 24%; transform: translateX(-50%);
  background: var(--red); color: #fff; font-weight: 900; font-size: 14px;
  padding: 8px 16px; border-radius: 99px; border: 2.5px solid var(--o); box-shadow: 0 4px 0 var(--o);
  animation: wobble 1.4s ease-in-out infinite;
}
@keyframes wobble { 0%, 100% { rotate: 0deg; } 10% { rotate: -7deg; scale: 1.06; } 20% { rotate: 7deg; scale: 1.06; } 30% { rotate: 0deg; scale: 1; } }

/* 点击特效 */
.fx { position: absolute; inset: 0; pointer-events: none; z-index: 8; overflow: hidden; }
.float {
  position: absolute; font-weight: 900; font-size: 22px; color: #fff; white-space: nowrap;
  -webkit-text-stroke: 6px var(--o); paint-order: stroke fill;
  transform: translate(-50%, -50%); animation: floatUp .9s ease-out forwards; font-variant-numeric: tabular-nums;
}
@keyframes floatUp { 0% { transform: translate(-50%, -30%) scale(.6); } 20% { transform: translate(-50%, -70%) scale(1.15); } 100% { transform: translate(-50%, -190%) scale(1); opacity: 0; } }
.popword {
  position: absolute; font-weight: 900; font-size: 30px; color: var(--yellow); white-space: nowrap;
  -webkit-text-stroke: 7px var(--o); paint-order: stroke fill;
  animation: popWord .6s cubic-bezier(.2, 1.6, .4, 1) forwards;
}
@keyframes popWord { 0% { transform: translate(-50%, -50%) scale(.2) rotate(var(--r)); } 40% { transform: translate(-50%, -50%) scale(1.15) rotate(var(--r)); opacity: 1; } 100% { transform: translate(-50%, -80%) scale(1) rotate(var(--r)); opacity: 0; } }
.ring {
  position: absolute; width: 20px; height: 20px; border-radius: 50%; border: 4px solid #fff;
  transform: translate(-50%, -50%); animation: ring .4s ease-out forwards;
}
@keyframes ring { to { width: 90px; height: 90px; opacity: 0; border-width: 1px; } }

/* ═════════ 右侧面板 ═════════ */
.panel { min-width: 0; }

/* 任务条（兼新手引导） */
.quest {
  display: grid; grid-template-columns: 44px 1fr auto; gap: 10px; align-items: center;
  background: linear-gradient(#FFF8E4, #FFEFC6); border: 2.5px solid var(--o); border-radius: 18px;
  box-shadow: 0 4px 0 var(--o); padding: 9px 10px; margin-bottom: 6px;
}
.quest:empty { display: none; }
.quest .qi { width: 44px; height: 44px; border-radius: 12px; background: var(--red); border: 2px solid var(--o); display: grid; place-items: center; font-size: 22px; }
.quest .qk { font-size: 11px; font-weight: 900; color: var(--red); letter-spacing: .05em; }
.quest .qt { font-size: 14.5px; font-weight: 900; line-height: 1.3; }
.quest .qbar { height: 9px; border-radius: 9px; background: #EADBC0; border: 1.5px solid var(--o); overflow: hidden; margin-top: 5px; }
.quest .qbar i { display: block; height: 100%; background: var(--green); transition: width .3s; }
.quest .qr { text-align: center; font-size: 11px; font-weight: 900; color: var(--ink2); min-width: 64px; }
.quest .qr b { display: block; font-size: 14px; color: var(--o); }
.quest .claim {
  padding: 8px 12px; border-radius: 12px; background: var(--green); color: #fff; font-weight: 900; font-size: 14px;
  border: 2.5px solid var(--o); box-shadow: 0 3px 0 var(--o); animation: buyPulse .9s ease-in-out infinite; white-space: nowrap;
}
.quest .claim:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--o); }
@keyframes buyPulse { 50% { transform: scale(1.07); } }

/* 待办清单 */
.quest.is-todo { display: block; padding: 10px 10px 8px; }
.todo-h { font-size: 14px; font-weight: 900; margin: 0 2px 8px; display: flex; align-items: baseline; gap: 6px; }
.todo-h small { font-size: 11.5px; color: var(--ink2); font-weight: 700; }
.todo-item {
  width: 100%; display: grid; grid-template-columns: 22px 1fr auto; gap: 8px; align-items: center; text-align: left;
  padding: 7px 8px; margin-bottom: 6px; border-radius: 12px; background: #fff; border: 2px solid var(--o); box-shadow: 0 2px 0 var(--o);
  transition: transform .08s, opacity .3s;
}
.todo-item:last-child { margin-bottom: 0; }
.todo-item:active { transform: translateY(2px); box-shadow: 0 0 0 var(--o); }
.todo-item .ck { width: 20px; height: 20px; border: 2.5px solid var(--o); border-radius: 6px; background: #fff; display: grid; place-items: center; font-size: 13px; font-weight: 900; color: #fff; }
.todo-item .tx b { display: block; font-size: 13.5px; font-weight: 900; }
.todo-item .tx small { display: block; font-size: 11.5px; color: var(--ink2); font-weight: 600; }
.todo-item .tc {
  font-size: 13px; font-weight: 900; color: var(--o); background: var(--yellow); border: 2px solid var(--o); border-radius: 10px;
  padding: 3px 9px; white-space: nowrap; font-variant-numeric: tabular-nums;
}
.todo-item.poor .tc { background: #E8DCC8; color: var(--ink2); }
.todo-item.done { opacity: .5; }
.todo-item.done .ck { background: var(--green); }
.todo-item.done .ck::after { content: '✓'; }
.todo-item.done .tx b { text-decoration: line-through; }

/* 副业：赌场 & 股市 */
.subtabs, .stock-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-bottom: 12px; }
.stock-tabs { grid-template-columns: repeat(3, 1fr); }
.subtabs button, .stock-tabs button {
  padding: 8px 4px; border-radius: 12px; font-weight: 900; font-size: 14px; background: var(--paper2); color: var(--ink2);
  border: 2.5px solid var(--o); box-shadow: 0 3px 0 var(--o);
}
.subtabs button.on, .stock-tabs button.on { background: var(--yellow); color: var(--o); transform: translateY(2px); box-shadow: 0 1px 0 var(--o); }
.stock-tabs small { display: block; font-size: 11px; font-weight: 800; font-variant-numeric: tabular-nums; }
.betbar { display: flex; align-items: center; gap: 5px; margin: 4px 0 12px; flex-wrap: wrap; }
.betbar > span { font-size: 13px; font-weight: 900; color: var(--ink2); margin-right: 2px; }
.betbar .bb { padding: 4px 9px; border-radius: 9px; font-size: 12.5px; font-weight: 900; background: #fff; border: 2px solid var(--o); }
.betbar .bb.all { background: var(--red); color: #fff; }
.betbar .betv { min-width: 70px; text-align: center; font-size: 16px; font-weight: 900; color: var(--o); background: var(--yellow); border: 2px solid var(--o); border-radius: 9px; padding: 2px 8px; font-variant-numeric: tabular-nums; }
.games { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
.game {
  display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 12px 6px; border-radius: 16px;
  background: linear-gradient(#FFF8E4, #FFE9B0); border: 2.5px solid var(--o); box-shadow: 0 4px 0 var(--o);
}
.game:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--o); }
.game .gi { font-size: 34px; line-height: 1.1; }
.game b { font-size: 15px; font-weight: 900; }
.game small { font-size: 11px; color: var(--ink2); font-weight: 700; }
.game-result { text-align: center; font-size: 15px; font-weight: 900; min-height: 22px; margin: 10px 0 6px; }
.sheet .actions.three { grid-template-columns: repeat(3, 1fr); }
/* 刮刮乐 */
.scratch { position: relative; margin: 12px 0 0; border: 3px solid var(--o); border-radius: 16px; overflow: hidden; background: #FFF6DE; touch-action: none; }
.sc-cells { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; padding: 10px; }
.sc-cell { aspect-ratio: 1.3; display: grid; place-items: center; font-size: 36px; background: #fff; border: 2px dashed #E3C88E; border-radius: 12px; }
.sc-cell.win { background: #FFE14D; border: 2px solid var(--o); animation: buyPulse .7s ease-in-out 3; }
#scCanvas { position: absolute; inset: 0; width: 100%; height: 100%; cursor: crosshair; touch-action: none; }
/* 弹珠机 */
.plinko { display: block; width: 100%; max-width: 360px; aspect-ratio: 300 / 330; margin: 10px auto 12px; border: 3px solid var(--o); border-radius: 16px; }
/* 老虎机 */
.slotm { position: relative; margin: 12px auto 0; padding: 10px; border-radius: 20px; background: linear-gradient(#E63946, #B3202A); border: 3px solid var(--o); box-shadow: 0 5px 0 var(--o); max-width: 300px; }
.reels { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.reel { height: 168px; overflow: hidden; background: #fff; border: 3px solid var(--o); border-radius: 12px; }
.reel .cell { height: 56px; display: grid; place-items: center; font-size: 34px; }
.payline { position: absolute; left: 6px; right: 6px; top: calc(10px + 84px); height: 3px; background: rgba(255, 201, 60, .9); transform: translateY(-50%); pointer-events: none; box-shadow: 0 0 6px #FFC93C; }
/* 轮盘 */
.wheel-wrap { position: relative; width: min(260px, 80%); aspect-ratio: 1; margin: 18px auto 8px; }
.wheel { width: 100%; height: 100%; border-radius: 50%; border: 6px solid var(--o); box-shadow: 0 0 0 4px #FFC93C, 0 6px 0 6px var(--o); position: relative; }
.wheel-hub { position: absolute; left: 50%; top: 50%; width: 24%; height: 24%; transform: translate(-50%, -50%); border-radius: 50%; background: #FFF3D9; border: 4px solid var(--o); display: grid; place-items: center; font-size: 22px; }
.wheel-pointer { position: absolute; z-index: 2; left: 50%; top: -14px; transform: translateX(-50%); width: 0; height: 0; border-left: 13px solid transparent; border-right: 13px solid transparent; border-top: 26px solid #FFE14D; filter: drop-shadow(0 2px 0 var(--o)) drop-shadow(0 -1px 0 var(--o)); }
.rhist { display: flex; gap: 4px; justify-content: center; flex-wrap: wrap; min-height: 16px; }
.rhist i { width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--o); }
.rhist i.red { background: #DC2626; } .rhist i.black { background: #1F1A17; } .rhist i.green { background: #16A34A; }
.rb { padding: 12px 4px; border-radius: 14px; font-weight: 900; font-size: 14px; color: #fff; border: 2.5px solid var(--o); box-shadow: 0 4px 0 var(--o); }
.rb:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--o); }
.rb.red { background: #DC2626; } .rb.black { background: #1F1A17; } .rb.green { background: #16A34A; }
/* 股市 */
.stock .sh { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; margin-bottom: 8px; }
.stock .sh b { font-size: 15px; font-weight: 900; }
.stock .sh .muted { font-size: 12px; }
.stock .sp { text-align: right; white-space: nowrap; }
.stock .px { font-size: 22px; font-weight: 900; font-variant-numeric: tabular-nums; }
.stock .chg { font-size: 13px; font-weight: 900; font-variant-numeric: tabular-nums; }
#kline { display: block; width: 100%; height: 200px; background: #fff; border: 2px solid var(--o); border-radius: 12px; }
.hold { font-size: 13px; margin: 10px 0 8px; color: var(--ink2); font-weight: 600; }
.trade { display: flex; gap: 6px; align-items: center; margin-top: 6px; }
.trade > span { font-size: 13px; font-weight: 900; width: 34px; }
.tb { flex: 1; padding: 8px 2px; border-radius: 10px; font-weight: 900; font-size: 13px; color: #fff; border: 2px solid var(--o); box-shadow: 0 3px 0 var(--o); }
.tb:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--o); }
.tb.buy { background: #E5484D; } .tb.sell { background: #22A35A; }

/* 手指引导 */
.guide { position: fixed; z-index: 45; pointer-events: none; left: 0; top: 0; }
.guide .hand {
  font-size: 44px; line-height: 1; transform: translate(-30%, 0); filter: drop-shadow(0 3px 0 rgba(0, 0, 0, .35));
  animation: tapHand 1s ease-in-out infinite;
}
@keyframes tapHand { 0%, 100% { translate: 0 0; } 50% { translate: 0 -12px; } }
.guide .tip {
  position: absolute; top: 50px; left: 0; transform: translateX(-50%); white-space: nowrap;
  background: #fff; color: var(--o); font-weight: 900; font-size: 14px; padding: 6px 12px; border-radius: 12px;
  border: 2.5px solid var(--o); box-shadow: 0 3px 0 var(--o);
}
.guide.up .tip { top: auto; bottom: 54px; }
.guide.up .hand { rotate: 180deg; }
.guide-hi { outline: 4px solid #FFE14D !important; outline-offset: 3px; animation: hiPulse 1s ease-in-out infinite !important; }
#corn.guide-hi { outline: none !important; }
@keyframes hiPulse { 50% { outline-color: #FF8A00; } }
.tabs {
  position: sticky; top: 0; z-index: 10;
  display: grid; grid-template-columns: repeat(6, 1fr); gap: 4px;
  padding: 8px 0 10px; background: var(--bg);
}
.tab {
  position: relative; padding: 7px 0 8px; border-radius: 14px; font-size: 14px; font-weight: 900; color: var(--ink2);
  background: var(--paper2); border: 2.5px solid var(--o); box-shadow: 0 3px 0 var(--o);
  display: flex; flex-direction: column; align-items: center; gap: 1px;
}
.tab span { font-size: 18px; line-height: 1.1; }
.tab.on { background: var(--yellow); color: var(--o); transform: translateY(2px); box-shadow: 0 1px 0 var(--o); }
.tab.badge::after {
  content: '!'; position: absolute; top: -8px; right: -6px; width: 20px; height: 20px; border-radius: 50%;
  background: var(--red); color: #fff; font-size: 12px; display: grid; place-items: center; border: 2px solid var(--o);
  animation: wobble 1.2s infinite;
}

.card {
  background: var(--paper); border: 2.5px solid var(--o); border-radius: var(--r);
  box-shadow: 0 4px 0 var(--o); padding: 14px; margin-bottom: 14px;
}
.card h3 { margin: 0 0 12px; font-size: 16px; font-weight: 900; display: flex; align-items: baseline; gap: 8px; }
.card h3 small { font-size: 12px; color: var(--ink2); font-weight: 700; }
.muted { color: var(--ink2); font-size: 13px; line-height: 1.55; }
.center { text-align: center; }
.empty { text-align: center; padding: 22px 8px; color: var(--ink2); font-size: 13.5px; line-height: 1.7; }

.story {
  display: flex; gap: 10px; align-items: center; margin-bottom: 12px; padding: 10px 12px;
  background: #fff; border: 2.5px solid var(--o); border-radius: 16px; font-size: 13px; line-height: 1.5; color: var(--ink2);
}
.story .who { font-size: 26px; }
.story b { color: var(--ink); }

.seg { display: inline-flex; gap: 4px; }
.seg button {
  padding: 3px 12px; font-size: 13px; font-weight: 900; border-radius: 10px; color: var(--ink2);
  background: var(--paper2); border: 2px solid var(--o);
}
.seg button.on { background: var(--yellow); color: var(--o); }
.bar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.bar .label { font-size: 13px; color: #E9CFA8; font-weight: 800; }

/* 设备卡 */
.dev {
  position: relative; width: 100%; display: grid; grid-template-columns: 64px 1fr auto; gap: 12px; align-items: center;
  text-align: left; background: var(--paper); border-radius: 18px; padding: 10px 12px; margin-bottom: 10px;
  border: 2.5px solid var(--o); box-shadow: 0 4px 0 var(--o); transition: transform .08s, box-shadow .08s, background .2s;
}
.dev.can { background: #FFFDF4; }
.dev.can:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--o); }
.dev.cant { background: #F4EADB; }
.dev.cant .dev-ico, .dev.cant .dev-name { opacity: .6; }
.dev-ico {
  width: 64px; height: 64px; border-radius: 14px; background: #FFF0C7; border: 2px solid var(--o);
  display: grid; place-items: center; font-size: 30px; overflow: hidden;
}
.dev-ico svg { width: 92%; height: 92%; }
.dev-ico svg * { animation: none !important; }
.dev-name { font-weight: 900; font-size: 15.5px; display: flex; align-items: baseline; gap: 6px; flex-wrap: wrap; }
.dev-n { color: var(--o); font-size: 12px; font-weight: 900; background: var(--yellow); border: 1.5px solid var(--o); padding: 0 6px; border-radius: 99px; }
.dev-desc { font-size: 12px; color: var(--ink2); margin-top: 3px; line-height: 1.45; }
.dev-meta { font-size: 11.5px; color: var(--ink2); margin-top: 5px; font-weight: 700; font-variant-numeric: tabular-nums; }
.dev-meta .boost { color: var(--green); }
.dev-cost {
  text-align: center; font-weight: 900; font-size: 15px; font-variant-numeric: tabular-nums; white-space: nowrap;
  padding: 6px 10px; border-radius: 12px; border: 2.5px solid var(--o); background: #E8DCC8; color: var(--ink2); min-width: 72px;
}
.dev-cost small { display: block; font-size: 10px; font-weight: 800; opacity: .8; }
.dev.can .dev-cost { background: var(--yellow); color: var(--o); box-shadow: 0 3px 0 var(--o); animation: buyGlow 1.6s ease-in-out infinite; }
@keyframes buyGlow { 50% { background: #FFD966; } }
.dev.locked { opacity: .6; pointer-events: none; background: #EFE3CF; box-shadow: 0 4px 0 rgba(91, 58, 30, .4); border-style: dashed; }
.dev.locked .dev-ico svg { filter: brightness(0); opacity: .15; }
.dev.upgrade .dev-ico { background: #FFE1DE; }

/* 爆米花卡片 */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(94px, 1fr)); gap: 9px; }
.pcard {
  position: relative; background: #fff; border-radius: 16px; padding: 8px 6px 9px; text-align: center;
  border: 2.5px solid var(--o); box-shadow: 0 3px 0 var(--rc, var(--o)); transition: transform .1s;
}
.pcard:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--rc, var(--o)); }
.pcard .pc { width: 70px; height: 70px; display: block; margin: 0 auto; }
.pcard .nm { font-size: 13px; font-weight: 900; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pcard .sp { font-size: 11px; color: var(--ink2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 600; }
.pcard .tagline { position: absolute; top: 5px; left: 5px; font-size: 10px; font-weight: 900; padding: 1px 6px; border-radius: 99px; background: var(--yellow); border: 1.5px solid var(--o); color: var(--o); }
.pcard .rdot { position: absolute; top: 8px; right: 8px; width: 10px; height: 10px; border-radius: 50%; border: 1.5px solid var(--o); }
.pcard.new::after { content: 'NEW'; position: absolute; top: 5px; right: 5px; font-size: 9px; font-weight: 900; color: #fff; background: var(--red); padding: 1px 5px; border-radius: 99px; border: 1.5px solid var(--o); }

.silhouette .pc { filter: brightness(0); opacity: .14; }
.pc .spin { animation: spin .7s linear infinite; }
.pc.nospin .spin { animation: none; }
@keyframes spin { to { transform: rotate(360deg); } }

.chip { display: inline-block; font-size: 11.5px; font-weight: 900; padding: 2px 9px; border-radius: 99px; color: #fff; border: 2px solid var(--o); }
.chip.soft { background: var(--paper2); color: var(--ink); }

/* 设备工位网格 */
.mgrid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.mslot {
  position: relative; background: #fff; border: 2.5px solid var(--o); border-radius: 16px; box-shadow: 0 3px 0 var(--o);
  padding: 6px 4px 7px; text-align: center; min-height: 112px; display: flex; flex-direction: column; align-items: center; justify-content: center;
}
.mslot svg { width: 58px; height: 58px; }
.mslot svg * { animation: none !important; }
.mslot .st { font-size: 11px; color: #E0A100; letter-spacing: -1px; line-height: 1; }
.mslot .nm { font-size: 12px; font-weight: 900; line-height: 1.2; margin-top: 2px; }
.mslot .rt { font-size: 10.5px; color: var(--ink2); font-weight: 700; }
.mslot.empty { border-style: dashed; box-shadow: none; background: var(--paper2); color: var(--ink2); font-size: 12px; font-weight: 800; }
.mslot.locked { border-style: dashed; box-shadow: none; background: transparent; color: var(--ink3); font-size: 11.5px; font-weight: 800; }
.mslot.sel { background: #FFF6C2; outline: 3px solid #FFB800; outline-offset: 1px; transform: translateY(-2px); }
.mslot.mergeable { background: #E1FBE8; animation: hiPulse 1s infinite; outline: 3px solid var(--green); }
.mslot.fusable { background: #FBE6FF; outline: 3px dashed #C04BE0; }
.mtools { display: flex; gap: 8px; margin-top: 12px; }
.mtools button { flex: 1; }

/* 菜单 */
.menu-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.menu-cell {
  background: #fff; border: 2.5px solid var(--o); border-radius: 16px; box-shadow: 0 3px 0 var(--o);
  padding: 6px 4px 8px; text-align: center; min-height: 112px; display: flex; flex-direction: column; align-items: center; justify-content: center;
}
.menu-cell .pc { width: 56px; height: 56px; }
.menu-cell .nm { font-size: 12px; font-weight: 900; line-height: 1.2; }
.menu-cell .pr { font-size: 12px; font-weight: 900; color: var(--green); }
.menu-cell.empty { border-style: dashed; box-shadow: none; background: var(--paper2); color: var(--ink2); font-size: 12.5px; font-weight: 900; }
.menu-cell.locked { border-style: dashed; box-shadow: none; background: transparent; color: var(--ink2); font-size: 11.5px; font-weight: 800; }

/* 员工位 */
.slots { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.slot {
  display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 16px; background: #fff;
  text-align: left; min-height: 70px; border: 2.5px solid var(--o); box-shadow: 0 3px 0 var(--o);
}
.slot .pc { width: 50px; height: 50px; flex: none; }
.slot .t { font-size: 13px; font-weight: 900; }
.slot .s { font-size: 11.5px; color: var(--green); font-weight: 800; }
.slot.empty { justify-content: center; color: var(--ink2); font-size: 13px; font-weight: 900; border-style: dashed; background: var(--paper2); box-shadow: none; }
.slot.locked { justify-content: center; color: var(--ink3); font-size: 12px; text-align: center; background: transparent; border-style: dashed; box-shadow: none; font-weight: 700; }

/* 实验室 */
.parents { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 8px; margin-bottom: 14px; }
.parent {
  background: #fff; border-radius: 18px; padding: 10px 6px; text-align: center; min-height: 142px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  border: 2.5px dashed var(--o);
}
.parent.filled { border-style: solid; box-shadow: 0 3px 0 var(--o); }
.parent .pc { width: 88px; height: 88px; }
.parent .nm { font-weight: 900; font-size: 14px; }
.parent .sp { font-size: 11.5px; color: var(--ink2); font-weight: 600; }
.parent .plus { font-size: 34px; color: var(--ink3); font-weight: 900; line-height: 1; }
.heart { font-size: 24px; }
.primary {
  width: 100%; padding: 13px; border-radius: 16px; background: var(--yellow); color: var(--o);
  font-weight: 900; font-size: 16px; border: 2.5px solid var(--o); box-shadow: 0 4px 0 var(--o); transition: transform .08s;
}
.primary:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--o); }
.primary:disabled { background: #E8DCC8; color: var(--ink3); }
.secondary {
  padding: 11px 14px; border-radius: 14px; background: #fff; font-weight: 900; font-size: 14px;
  border: 2.5px solid var(--o); box-shadow: 0 3px 0 var(--o);
}
.secondary:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--o); }
.secondary:disabled { opacity: .5; }
.danger { color: #D93036; }
.notes { margin: 0; padding: 0; list-style: none; }
.notes li { font-size: 13px; line-height: 1.5; padding: 8px 0; border-top: 2px dashed rgba(91, 58, 30, .15); color: var(--ink2); }
.notes li:first-child { border-top: 0; padding-top: 0; }
.notes li b { color: var(--ink); }

/* 图鉴 */
.progress { height: 12px; background: #EADBC0; border-radius: 99px; overflow: hidden; margin-top: 8px; border: 2px solid var(--o); }
.progress i { display: block; height: 100%; background: var(--green); transition: width .4s; }
.rgroup { margin: 0 0 10px; font-size: 13px; font-weight: 900; display: flex; align-items: center; gap: 6px; }
.rgroup::before { content: ''; width: 12px; height: 12px; border-radius: 50%; background: var(--rc); border: 2px solid var(--o); }

/* ═════════ 弹层 ═════════ */
.sheet-backdrop {
  position: fixed; inset: 0; z-index: 50; background: rgba(43, 29, 16, .45);
  display: flex; align-items: flex-end; justify-content: center; animation: fadeIn .2s ease-out;
}
@media (min-width: 700px) { .sheet-backdrop { align-items: center; } }
.sheet {
  width: 100%; max-width: 460px; max-height: 88vh; overflow: auto;
  background: var(--paper); border: 3px solid var(--o); border-bottom: 0;
  border-radius: 26px 26px 0 0; padding: 22px 20px calc(20px + env(safe-area-inset-bottom));
  animation: slideUp .3s cubic-bezier(.2, 1.3, .4, 1);
}
@media (min-width: 700px) { .sheet { border-radius: 26px; border-bottom: 3px solid var(--o); box-shadow: 0 6px 0 var(--o); } }
@keyframes fadeIn { from { opacity: 0; } }
@keyframes slideUp { from { transform: translateY(60px) scale(.96); opacity: 0; } }
.sheet { position: relative; }
.sheet-x {
  position: absolute; top: 12px; right: 12px; z-index: 3; width: 34px; height: 34px; border-radius: 50%;
  font-size: 15px; font-weight: 900; color: var(--o); background: var(--paper2); border: 2.5px solid var(--o);
}
.sheet h2 { margin: 0 0 4px; font-size: 22px; font-weight: 900; }
.sheet .kicker { font-size: 12px; font-weight: 900; color: var(--red); letter-spacing: .1em; margin-bottom: 6px; }
.sheet .body { white-space: pre-line; font-size: 15px; line-height: 1.7; color: var(--ink); margin: 12px 0 18px; }
.sheet .actions { display: grid; gap: 10px; }
.sheet .actions.two { grid-template-columns: 1fr 1fr; }
.portrait { display: grid; place-items: center; padding: 6px 0 2px; }
.portrait .pc { width: 168px; height: 168px; animation: bob 2.6s ease-in-out infinite; }
@keyframes bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }
.meta-row { display: flex; gap: 6px; justify-content: center; flex-wrap: wrap; margin: 8px 0; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; font-size: 13.5px; margin: 14px 0; }
.kv dt { color: var(--ink2); font-weight: 700; }
.kv dd { margin: 0; font-weight: 600; }
.report { background: #fff; border: 2px solid var(--o); border-radius: 14px; padding: 12px 14px; font-size: 13.5px; line-height: 1.65; color: var(--ink2); margin: 12px 0; }
.report b { color: var(--ink); }
.name-input {
  font: inherit; font-size: 22px; font-weight: 900; text-align: center; color: var(--ink);
  border: 0; border-bottom: 2.5px dashed var(--ink3); background: transparent; width: 70%; padding: 2px 4px; outline: none;
}
.name-input:focus { border-bottom-color: var(--yellow2); }
.pick-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 9px; margin-top: 12px; }
.breeding { display: flex; justify-content: center; gap: 4px; align-items: center; padding: 30px 0 10px; }
.breeding .pc { width: 110px; height: 110px; animation: shakeP .25s ease-in-out infinite; }
.breeding .pc:last-child { animation-delay: -.12s; }
.breeding .heart { animation: pulse .5s ease-in-out infinite; font-size: 30px; }
@keyframes shakeP { 0%, 100% { transform: translateX(0) rotate(0); } 25% { transform: translateX(-3px) rotate(-5deg); } 75% { transform: translateX(3px) rotate(5deg); } }
@keyframes pulse { 50% { transform: scale(1.35); } }
.newborn .pc { animation: born .7s cubic-bezier(.2, 1.6, .4, 1) both, bob 2.6s ease-in-out .7s infinite; }
@keyframes born { from { transform: scale(.2) rotate(-20deg); opacity: 0; } }
.banner { display: inline-block; font-size: 13px; font-weight: 900; padding: 4px 12px; border-radius: 99px; background: var(--yellow); border: 2px solid var(--o); color: var(--o); margin-bottom: 4px; }

/* 升职 */
.levelup {
  position: fixed; inset: 0; z-index: 70; display: grid; place-items: center; pointer-events: none;
}
.levelup .lu {
  text-align: center; background: var(--paper); border: 3px solid var(--o); border-radius: 26px; box-shadow: 0 8px 0 var(--o);
  padding: 20px 28px 22px; max-width: min(380px, calc(100vw - 40px));
  animation: luIn .6s cubic-bezier(.2, 1.6, .4, 1), luOut .4s ease-in 3.4s forwards;
}
.levelup .lu .big {
  font-size: 40px; font-weight: 900; color: var(--yellow); -webkit-text-stroke: 9px var(--o); paint-order: stroke fill; line-height: 1.1;
}
.levelup .lu .t { font-size: 20px; font-weight: 900; margin-top: 6px; }
.levelup .lu .q { font-size: 14px; color: var(--ink2); margin-top: 8px; line-height: 1.6; }
@keyframes luIn { from { transform: scale(.3) rotate(-10deg); opacity: 0; } }
@keyframes luOut { to { transform: scale(.8); opacity: 0; } }

/* 提示 */
.toasts { position: fixed; left: 50%; top: 12px; transform: translateX(-50%); z-index: 60; display: grid; gap: 8px; width: min(380px, calc(100vw - 32px)); pointer-events: none; }
.toast {
  pointer-events: auto; display: flex; align-items: center; gap: 10px; background: var(--paper); border-radius: 18px;
  padding: 6px 14px 6px 6px; border: 2.5px solid var(--o); box-shadow: 0 4px 0 var(--o);
  animation: toastIn .4s cubic-bezier(.2, 1.5, .4, 1); text-align: left; width: 100%;
}
.toast.out { transition: opacity .3s, transform .3s; opacity: 0; transform: translateY(-10px); }
.toast .pc { width: 46px; height: 46px; flex: none; }
.toast .tt { font-size: 12px; color: var(--red); font-weight: 900; }
.toast .tm { font-size: 14px; font-weight: 900; }
.toast .ico { width: 46px; height: 46px; display: grid; place-items: center; font-size: 26px; flex: none; }
@keyframes toastIn { from { transform: translateY(-20px) scale(.9); opacity: 0; } }

.foot { text-align: center; color: #A8805E; font-size: 12px; padding: 24px 0 4px; font-weight: 600; }

/* ───── 手机 ───── */
@media (max-width: 899px) {
  .hud { width: 62%; }
  .machine .starve { font-size: 9px; padding: 0 4px; top: 4%; }
  .tab { font-size: 11.5px; }
  .tab span { font-size: 16px; }
  .rank .rbar { width: 84px; }
  .combo { left: calc(50% + 40px); font-size: 22px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
}
