/* 猫公寓 · 竖屏经营养成 */
:root {
  --orange: #FF8A3D;
  --orange-deep: #F27022;
  --orange-soft: #FFE7D2;
  --cream: #FFF6EC;
  --cream-deep: #FFEBD7;
  --paper: #FFFDF8;
  --ink: #3D2A1E;
  --ink-soft: #7A6150;
  --ink-mute: #A68D79;
  --line: #F1DDC9;
  --green: #55A876;
  --green-soft: #E7F5EA;
  --purple: #8875C6;
  --purple-soft: #F0ECFA;
  --shadow: 0 8px 24px rgba(121, 75, 40, 0.12);
  --shadow-soft: 0 3px 12px rgba(121, 75, 40, 0.08);
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --radius: 20px;
  --font: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans CJK SC", system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  background: #F1E3D4;
  color: var(--ink);
  font-family: var(--font);
  overscroll-behavior: none;
}
body { min-height: 100vh; min-height: 100dvh; }
button { font-family: inherit; color: inherit; border: 0; cursor: pointer; touch-action: manipulation; }
button:focus-visible { outline: 3px solid rgba(255, 138, 61, 0.45); outline-offset: 2px; }
[hidden] { display: none !important; }
.mp-icon { flex: none; }

.game {
  position: relative;
  width: 100%;
  max-width: 480px;
  height: 100vh;
  height: 100dvh;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: #FFE6C7;
  isolation: isolate;
}

/* ================= 房间 ================= */
.room {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
  background: #FFE6C7;
  touch-action: manipulation;
}
.room-svg { display: block; width: 100%; height: 100%; }
.room-shade {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(180deg, rgba(78, 45, 20, 0.10) 0%, rgba(78, 45, 20, 0) 22%, rgba(78, 45, 20, 0) 74%, rgba(78, 45, 20, 0.09) 100%);
  z-index: 2;
}

/* 墙纸 / 地板 / 家具切换 */
.wp, .floor-layer, .furniture { display: none; }
.room[data-wall="cream"] .wp-cream,
.room[data-wall="mint"] .wp-mint,
.room[data-wall="sunset"] .wp-sunset,
.room[data-wall="star"] .wp-star { display: block; }
.room[data-wall="cream"] .wallpaper { fill: #FFE6C7; }
.room[data-wall="cream"] #room-svg > rect:first-of-type { fill: #FFE6C7; }
.room[data-wall="mint"] .wallpaper { fill: #DDF1E4; }
.room[data-wall="mint"] #room-svg > rect:first-of-type { fill: #DDF1E4; }
.room[data-wall="sunset"] .wallpaper { fill: #FFD9C4; }
.room[data-wall="sunset"] #room-svg > rect:first-of-type { fill: #FFD9C4; }
.room[data-wall="star"] .wallpaper { fill: #413D65; }
.room[data-wall="star"] #room-svg > rect:first-of-type { fill: #413D65; }
.room[data-wall="star"] .room-shade { background: linear-gradient(180deg, rgba(20, 16, 48, 0.16), rgba(20, 16, 48, 0) 30%, rgba(20, 16, 48, 0.12)); }
.room[data-wall="star"] .wall-art text { fill: #413D65; }

.room[data-floor="wood"] .floor-wood { display: block; }
.room[data-floor="tile"] .floor-tile { display: block; }
.room[data-floor="carpet"] .floor-carpet { display: block; }

.room[data-furniture="tree"] .f-furniture-tree,
.room[data-furniture="sofa"] .f-furniture-sofa,
.room[data-furniture="bed"] .f-furniture-bed,
.room[data-furniture="lamp"] .f-furniture-lamp,
.room[data-furniture="plants"] .f-furniture-plants { display: block; }

/* ================= 顶部 HUD ================= */
.hud {
  position: absolute;
  top: calc(var(--safe-top) + 10px);
  left: 16px;
  right: 16px;
  z-index: 6;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  pointer-events: none;
}
.hud > * { pointer-events: auto; }
.player-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  max-width: 58%;
  padding: 5px 12px 5px 5px;
  border: 1px solid rgba(255, 255, 255, 0.82);
  border-radius: 999px;
  background: rgba(255, 252, 246, 0.86);
  box-shadow: 0 5px 16px rgba(112, 68, 35, 0.14);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}
.avatar {
  position: relative;
  flex: none;
  width: 36px;
  height: 36px;
  overflow: hidden;
  border-radius: 50%;
  background: linear-gradient(145deg, #FFD9A8, #FFB26E);
  border: 2px solid #FFFDF7;
  box-shadow: 0 2px 6px rgba(124, 74, 38, 0.2);
}
.avatar svg, .avatar img { display: block; width: 100%; height: 100%; object-fit: cover; }
.avatar img { position: absolute; inset: 0; }
.player-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.15; }
.player-text b {
  max-width: 105px;
  overflow: hidden;
  color: #4B3324;
  font-size: 13px;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.player-text small { margin-top: 2px; color: #A7856C; font-size: 9.5px; font-weight: 500; letter-spacing: 0.2px; }
.hud-right { display: flex; align-items: center; gap: 7px; }
.coin-chip {
  display: flex;
  align-items: center;
  gap: 4px;
  height: 38px;
  padding: 0 12px 0 9px;
  border: 1px solid rgba(255, 255, 255, 0.9);
  border-radius: 999px;
  background: linear-gradient(180deg, #FFF9ED, #FFF0D7);
  box-shadow: 0 5px 14px rgba(148, 91, 30, 0.17);
  color: #7B4A1E;
}
.coin-chip .mp-icon { width: 20px; height: 20px; color: #F5A623; }
.coin-chip b { font-size: 15px; font-weight: 800; font-variant-numeric: tabular-nums; letter-spacing: 0.2px; }
.coin-chip.bump { animation: coinBump 0.42s ease; }
.round-btn {
  position: relative;
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.9);
  background: rgba(255, 252, 246, 0.9);
  box-shadow: 0 5px 14px rgba(112, 68, 35, 0.14);
  color: #7F6492;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  transition: transform 0.16s ease, background 0.16s ease;
}
.round-btn .mp-icon { width: 20px; height: 20px; }
.round-btn:active { transform: scale(0.92); background: #FFF2E2; }
.round-btn .dot {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 9px;
  height: 9px;
  border: 2px solid #FFF9EF;
  border-radius: 50%;
  background: #FF5B4D;
  animation: dotPulse 1.6s infinite;
}

/* ================= 猫咪 ================= */
.cat-layer { position: absolute; inset: 0; z-index: 3; pointer-events: none; }
.cat {
  position: absolute;
  display: block;
  width: clamp(66px, 22vw, 96px);
  padding: 0;
  border: 0;
  background: transparent;
  pointer-events: auto;
  transform: translateX(-50%) rotate(var(--rot, 0deg)) scale(var(--s, 1));
  transform-origin: 50% 100%;
  filter: drop-shadow(0 7px 5px rgba(86, 49, 24, 0.12));
  transition: filter 0.2s ease;
  will-change: transform;
}
.cat:active { filter: drop-shadow(0 3px 2px rgba(86, 49, 24, 0.1)); }
.cat svg { display: block; width: 100%; height: auto; overflow: visible; }
.cat .cat-breathe { animation: catBreathe 3.8s ease-in-out infinite; transform-box: fill-box; transform-origin: 50% 100%; }
.cat .cat-tail { animation: tailSwish 3.1s ease-in-out infinite; transform-box: fill-box; transform-origin: 8% 88%; }
.cat .cat-eyes { animation: catBlink 5.2s infinite; transform-box: fill-box; transform-origin: center; }
.cat .cat-ear { transform-box: fill-box; transform-origin: 50% 100%; }
.cat.active .cat-tag { opacity: 1; transform: translateY(0); }
.cat.petted { animation: catPet 0.5s ease; }
.cat.new-cat { animation: catArrive 0.72s cubic-bezier(0.2, 0.9, 0.3, 1.25); }
.cat-tag {
  position: absolute;
  left: 50%;
  top: -12px;
  transform: translate(-50%, 5px);
  padding: 2px 8px;
  border: 1px solid #FFE2C8;
  border-radius: 999px;
  background: rgba(255, 252, 246, 0.94);
  box-shadow: 0 3px 8px rgba(117, 70, 37, 0.13);
  color: #8E5A32;
  font-size: 9.5px;
  font-weight: 700;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
}
.cat-heart {
  position: absolute;
  z-index: 8;
  color: #FF6D7A;
  pointer-events: none;
  animation: heartFloat 0.95s ease-out forwards;
}
.cat-heart .mp-icon { width: 17px; height: 17px; filter: drop-shadow(0 2px 2px rgba(155, 55, 65, 0.15)); }
.food-bowl {
  position: absolute;
  left: 50%;
  bottom: 8%;
  display: grid;
  place-items: center;
  width: 30px;
  height: 22px;
  transform: translateX(-50%);
  border-radius: 0 0 14px 14px;
  background: linear-gradient(180deg, #FFC078, #E9893F);
  box-shadow: 0 3px 0 #C76E2E, 0 5px 10px rgba(102, 54, 20, 0.18);
  color: #FFF9EC;
  animation: bowlPop 1.2s ease forwards;
  pointer-events: none;
}
.food-bowl::before {
  content: "";
  position: absolute;
  left: 4px;
  right: 4px;
  top: -5px;
  height: 9px;
  border-radius: 50%;
  background: #A86633;
  box-shadow: inset 0 2px 0 rgba(255, 240, 219, 0.25);
}
.food-bowl .mp-icon { width: 14px; height: 14px; margin-top: 3px; }

.room-flash::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 4;
  pointer-events: none;
  background: radial-gradient(circle at 50% 62%, rgba(255, 240, 196, 0.55), rgba(255, 240, 196, 0) 58%);
  animation: roomFlash 0.7s ease-out forwards;
}

.room-hint {
  position: absolute;
  left: 50%;
  top: calc(var(--safe-top) + 58px);
  bottom: auto;
  transform: translateX(-50%);
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
  padding: 6px 11px 6px 8px;
  border: 1px solid rgba(255, 255, 255, 0.7);
  border-radius: 999px;
  background: rgba(69, 42, 24, 0.62);
  color: #FFF8ED;
  font-size: 10.5px;
  font-weight: 500;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  animation: hintIn 0.4s ease both;
  pointer-events: none;
}
.room-hint .mp-icon { width: 15px; height: 15px; color: #FFD08D; }

/* ================= 底部经营面板 ================= */
.panel {
  position: relative;
  z-index: 7;
  flex: none;
  display: flex;
  flex-direction: column;
  gap: 9px;
  margin-top: -22px;
  padding: 8px 16px calc(10px + var(--safe-bottom));
  border-radius: 28px 28px 0 0;
  border-top: 1px solid rgba(255, 255, 255, 0.9);
  background: linear-gradient(180deg, #FFFDF9 0%, #FFF7EE 100%);
  box-shadow: 0 -10px 30px rgba(112, 66, 30, 0.13);
}
.grip { width: 40px; height: 4px; margin: 0 auto 1px; border-radius: 99px; background: #EAD6C2; flex: none; }

.cat-status {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 11px;
  border: 1px solid #F3E0CD;
  border-radius: 18px;
  background: linear-gradient(135deg, #FFFFFF 0%, #FFF8EF 100%);
  box-shadow: var(--shadow-soft);
  flex: none;
}
.cat-portrait {
  display: grid;
  place-items: center;
  flex: none;
  width: 50px;
  height: 50px;
  overflow: hidden;
  border-radius: 16px;
  border: 2px solid #FFF6EA;
  background: radial-gradient(circle at 50% 30%, #FFE5C6, #FFD1A0);
  box-shadow: inset 0 0 0 1px rgba(226, 167, 112, 0.3), 0 3px 8px rgba(144, 88, 42, 0.12);
}
.cat-portrait svg { width: 100%; height: 100%; }
.cat-meta { display: flex; flex-direction: column; gap: 4px; min-width: 0; flex: 1 1 auto; }
.cat-name-row { display: flex; align-items: baseline; gap: 6px; min-width: 0; }
.cat-name-row b { flex: none; font-size: 15px; font-weight: 800; letter-spacing: 0.2px; }
.cat-name-row span {
  overflow: hidden;
  color: var(--ink-mute);
  font-size: 10px;
  font-weight: 500;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.aff-row { display: flex; align-items: center; gap: 6px; }
.aff-label { flex: none; color: #B1947C; font-size: 9.5px; }
.aff-track { flex: 1 1 auto; height: 6px; overflow: hidden; border-radius: 99px; background: #F2E2D2; box-shadow: inset 0 1px 2px rgba(122, 75, 36, 0.08); }
.aff-track i { display: block; width: 0; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #FFB05F, #FF7A3D); transition: width 0.35s cubic-bezier(0.2, 0.8, 0.3, 1); }
.aff-row b { flex: none; width: 24px; color: #B16E3A; font-size: 10px; font-weight: 800; font-variant-numeric: tabular-nums; text-align: right; }
.income-chip {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex: none;
  gap: 1px;
  width: 50px;
  padding: 5px 2px;
  border-radius: 12px;
  background: #F3F9F1;
  color: #5E9A6E;
  line-height: 1.1;
}
.income-chip .mp-icon { width: 16px; height: 16px; }
.income-chip span { font-size: 8.5px; font-weight: 700; white-space: nowrap; }

.goal-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 7px;
  padding: 9px 11px 10px;
  border: 1px solid #FFDDBD;
  border-radius: 18px;
  background: linear-gradient(150deg, #FFF7EC 0%, #FFEFDD 100%);
  box-shadow: var(--shadow-soft);
  flex: none;
}
.goal-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.level-title { display: flex; align-items: center; gap: 6px; min-width: 0; }
.lv-badge {
  flex: none;
  padding: 3px 7px;
  border-radius: 7px;
  background: var(--orange);
  box-shadow: 0 2px 5px rgba(238, 105, 30, 0.25);
  color: #FFF9F0;
  font-size: 9.5px;
  font-weight: 800;
  letter-spacing: 0.3px;
}
.level-title b { overflow: hidden; color: #5B3922; font-size: 13px; font-weight: 800; text-overflow: ellipsis; white-space: nowrap; }
.reward-chip {
  display: flex;
  align-items: center;
  gap: 3px;
  flex: none;
  padding: 3px 8px 3px 6px;
  border-radius: 999px;
  background: #FFFDF7;
  color: #A4692F;
  font-size: 10.5px;
  font-weight: 800;
  box-shadow: inset 0 0 0 1px #F6E3CE;
}
.reward-chip .mp-icon { width: 13px; height: 13px; color: #F5A623; }

.goal-chips { display: flex; gap: 6px; }
.goal-chip {
  position: relative;
  display: flex;
  align-items: center;
  gap: 4px;
  flex: 1 1 0;
  min-width: 0;
  padding: 6px 7px 7px;
  overflow: hidden;
  border: 1px solid #F5E1CC;
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.72);
  color: #836248;
  font-size: 10px;
}
.goal-chip .mp-icon { width: 13px; height: 13px; color: #C98E5C; }
.goal-chip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.goal-chip b { margin-left: auto; color: #6B4A31; font-size: 10.5px; font-weight: 800; font-variant-numeric: tabular-nums; }
.goal-chip .goal-progress { position: absolute; left: 0; bottom: 0; height: 2.5px; border-radius: 99px; background: #FFB069; transition: width 0.3s ease; }
.goal-chip.done { border-color: #CBE8D2; background: #F0FAF2; color: #4B8A60; }
.goal-chip.done .mp-icon { color: #55A876; }
.goal-chip.done b { color: #3F8055; }
.goal-chip.done .goal-progress { background: #62B47D; }
.goal-chip.done::after {
  content: "";
  position: absolute;
  right: 5px;
  top: 4px;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #62B47D;
}

.complete-btn {
  position: relative;
  width: 100%;
  height: 38px;
  margin-top: 1px;
  border-radius: 12px;
  background: linear-gradient(135deg, #FFA457 0%, #FF7B2D 100%);
  box-shadow: 0 5px 12px rgba(240, 105, 28, 0.26);
  color: #FFFDF8;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.3px;
  transition: transform 0.15s ease, opacity 0.2s ease, box-shadow 0.2s ease;
}
.complete-btn:active { transform: scale(0.98); }
.complete-btn:disabled {
  background: #F0E4D6;
  box-shadow: none;
  color: #B9A38E;
  cursor: default;
}
.complete-btn.ready { animation: readyPulse 1.5s ease-in-out infinite; }
.complete-btn.pulse-now { animation: pulseNow 0.6s ease; }
.complete-btn.hidden { display: none; }

.dock { display: grid; grid-template-columns: repeat(4, 1fr); gap: 7px; flex: none; }
.dock-btn {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  height: 57px;
  border: 1px solid #F1DFCC;
  border-radius: 15px;
  background: #FFFFFF;
  box-shadow: 0 3px 9px rgba(120, 72, 35, 0.07);
  color: #6E4E37;
  font-size: 10px;
  font-weight: 700;
  transition: transform 0.14s ease, box-shadow 0.14s ease, background 0.14s ease;
}
.dock-btn .mp-icon { width: 21px; height: 21px; }
.dock-btn:active { transform: translateY(1px) scale(0.96); box-shadow: 0 1px 4px rgba(120, 72, 35, 0.06); }
.dock-pet { background: #FFF4E6; color: #C8783C; border-color: #FFE1C5; }
.dock-pet .mp-icon { color: #FF8A3D; }
.dock-feed {
  background: linear-gradient(135deg, #FFA95E 0%, #FF7C30 100%);
  border-color: transparent;
  box-shadow: 0 5px 13px rgba(240, 105, 28, 0.25);
  color: #FFFDF8;
}
.dock-feed .mp-icon { color: #FFFDF8; }
.dock-feed em {
  position: absolute;
  top: 3px;
  right: 4px;
  display: flex;
  align-items: center;
  padding: 1px 4px;
  border-radius: 99px;
  background: rgba(255, 253, 248, 0.24);
  color: #FFFDF8;
  font-size: 8px;
  font-style: normal;
  font-weight: 700;
}
.dock-decor { background: #F0F8F0; color: #5D9468; border-color: #DCEEDD; }
.dock-decor .mp-icon { color: #62A472; }
.dock-book { background: #F4F1FB; color: #7B6AB5; border-color: #E7E1F6; }
.dock-book .mp-icon { color: #8875C6; }

/* ================= 通用弹层 ================= */
.sheet-wrap {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}
.sheet-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(48, 28, 15, 0.52);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  animation: fadeIn 0.22s ease both;
}
.sheet {
  position: relative;
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 480px;
  max-height: 80vh;
  max-height: 80dvh;
  padding: 14px 16px calc(16px + var(--safe-bottom));
  border-radius: 26px 26px 0 0;
  background: linear-gradient(180deg, #FFFDF8 0%, #FFF7ED 100%);
  box-shadow: 0 -18px 40px rgba(61, 39, 21, 0.24);
  animation: sheetUp 0.3s cubic-bezier(0.2, 0.85, 0.3, 1) both;
}
.sheet::before {
  content: "";
  position: absolute;
  top: 7px;
  left: 50%;
  width: 38px;
  height: 4px;
  transform: translateX(-50%);
  border-radius: 99px;
  background: #EAD8C6;
}
.sheet-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 8px 2px 10px; }
.sheet-head h2 { margin: 0; color: #4A3121; font-size: 19px; font-weight: 800; letter-spacing: 0.2px; }
.sheet-head p { margin: 4px 0 0; color: #9A806B; font-size: 11px; line-height: 1.5; }
.sheet-close {
  display: grid;
  place-items: center;
  flex: none;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: #F6EBDD;
  color: #8E6F56;
  transition: transform 0.15s ease;
}
.sheet-close:active { transform: scale(0.9); }
.sheet-close .mp-icon { width: 18px; height: 18px; }
.sheet-body { min-height: 0; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; padding-bottom: 4px; }
.sheet-body::-webkit-scrollbar { width: 0; }

/* 装饰面板 */
.tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 12px;
  padding: 4px;
  border-radius: 14px;
  background: #F5E9DA;
}
.tab {
  flex: 1;
  height: 34px;
  border-radius: 10px;
  background: transparent;
  color: #9A7E66;
  font-size: 12px;
  font-weight: 700;
  transition: background 0.18s ease, color 0.18s ease, box-shadow 0.18s ease;
}
.tab.active { background: #FFFFFF; box-shadow: 0 2px 7px rgba(120, 72, 35, 0.1); color: #E07832; }
.decor-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 9px; }
.decor-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 5px;
  padding: 7px 7px 8px;
  overflow: hidden;
  border: 1.5px solid #F1DFCC;
  border-radius: 14px;
  background: #FFFFFF;
  box-shadow: 0 2px 6px rgba(120, 72, 35, 0.05);
  text-align: left;
  transition: transform 0.14s ease, border-color 0.14s ease;
}
.decor-card:active { transform: scale(0.96); }
.decor-card.equipped { border-color: #FF9B53; box-shadow: 0 0 0 2px rgba(255, 138, 61, 0.14); }
.decor-card.locked { opacity: 0.52; }
.decor-preview {
  position: relative;
  display: grid;
  place-items: center;
  height: 72px;
  overflow: hidden;
  border-radius: 10px;
  background: #F7EDE1;
  color: #B6855C;
}
.decor-preview .mp-icon { width: 24px; height: 24px; }
.decor-preview.wall-preview { background-size: cover; }
.decor-preview.wall-preview::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.08), rgba(92, 54, 26, 0.1));
}
.decor-name { overflow: hidden; color: #5B412E; font-size: 10.5px; font-weight: 700; text-overflow: ellipsis; white-space: nowrap; }
.decor-price { display: flex; align-items: center; gap: 2px; color: #B88C60; font-size: 9px; font-weight: 700; }
.decor-price .mp-icon { width: 11px; height: 11px; color: #F5A623; }
.decor-price.owned { color: #61A276; }
.decor-card .check-badge {
  position: absolute;
  top: 4px;
  right: 4px;
  display: none;
  place-items: center;
  width: 19px;
  height: 19px;
  border-radius: 50%;
  background: #FF8A3D;
  color: #FFFFFF;
  box-shadow: 0 2px 5px rgba(223, 100, 25, 0.3);
  z-index: 2;
}
.decor-card .check-badge .mp-icon { width: 12px; height: 12px; }
.decor-card.equipped .check-badge { display: grid; }
.lock-layer {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  border-radius: 14px;
  background: rgba(247, 239, 229, 0.82);
  color: #8D7460;
  font-size: 8.5px;
  font-weight: 700;
  backdrop-filter: blur(1px);
  z-index: 3;
}
.lock-layer .mp-icon { width: 15px; height: 15px; }
.coin-bar {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 6px 10px;
  border-radius: 999px;
  background: #FFF4E4;
  color: #8A5C32;
  font-size: 11px;
  font-weight: 800;
}
.coin-bar .mp-icon { width: 14px; height: 14px; color: #F5A623; }

/* 图鉴 */
.book-progress {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  padding: 9px 12px;
  border-radius: 14px;
  background: #FFF4E4;
  color: #8A684B;
  font-size: 11px;
  font-weight: 600;
}
.book-progress .bar { flex: 1; height: 7px; overflow: hidden; border-radius: 99px; background: #F0DCC5; }
.book-progress .bar i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #FFB05F, #FF7A3D); transition: width 0.4s ease; }
.book-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 9px; }
.book-card {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 94px;
  padding: 9px;
  border: 1.5px solid #F0DECA;
  border-radius: 16px;
  background: linear-gradient(145deg, #FFFFFF, #FFF7ED);
  text-align: left;
  transition: transform 0.14s ease, border-color 0.14s ease;
}
.book-card:active { transform: scale(0.97); }
.book-card.collected { border-color: #FFD9B6; }
.book-card.active-cat { border-color: #FF9B53; box-shadow: 0 0 0 2px rgba(255, 138, 61, 0.12); }
.book-art { display: grid; place-items: center; flex: none; width: 58px; height: 66px; }
.book-art svg { width: 100%; height: 100%; overflow: visible; }
.book-card.locked .book-art { filter: grayscale(1) brightness(0.55); opacity: 0.38; }
.book-info { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.book-info b { overflow: hidden; color: #513724; font-size: 12.5px; font-weight: 800; text-overflow: ellipsis; white-space: nowrap; }
.book-info span { overflow: hidden; color: #A1846B; font-size: 9px; text-overflow: ellipsis; white-space: nowrap; }
.book-info em { margin-top: 2px; color: #C17D42; font-size: 9px; font-style: normal; font-weight: 700; }
.book-card.locked .book-info b { color: #A9927E; }
.book-card.wide { grid-column: 1 / -1; justify-content: center; }
.lock-pill {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  margin-top: 3px;
  padding: 2px 6px;
  border-radius: 99px;
  background: #F4E9DC;
  color: #9B816B;
  font-size: 8px;
  font-weight: 700;
}
.lock-pill .mp-icon { width: 10px; height: 10px; }

/* ================= 模态框 ================= */
.modal-wrap { position: fixed; inset: 0; z-index: 60; display: flex; align-items: center; justify-content: center; padding: 22px; }
.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(48, 28, 15, 0.58);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  animation: fadeIn 0.24s ease both;
}
.modal-card {
  position: relative;
  width: 100%;
  max-width: 342px;
  max-height: 86vh;
  max-height: 86dvh;
  overflow-y: auto;
  padding: 22px 20px 18px;
  border-radius: 26px;
  background: linear-gradient(180deg, #FFFDF8 0%, #FFF4E6 100%);
  box-shadow: 0 22px 50px rgba(48, 27, 12, 0.3), inset 0 0 0 1px rgba(255, 255, 255, 0.8);
  text-align: center;
  animation: modalPop 0.34s cubic-bezier(0.2, 0.9, 0.3, 1.18) both;
}
.modal-card::-webkit-scrollbar { width: 0; }
.modal-card h2 { margin: 8px 0 5px; color: #4A2F1D; font-size: 22px; font-weight: 900; letter-spacing: 0.3px; }
.modal-card p { margin: 0 0 12px; color: #967B65; font-size: 11.5px; line-height: 1.55; }
.modal-kicker { display: inline-flex; align-items: center; gap: 4px; padding: 3px 9px; border-radius: 99px; background: #FFE7CF; color: #D4712E; font-size: 9px; font-weight: 800; letter-spacing: 1px; }
.modal-kicker .mp-icon { width: 12px; height: 12px; }
.big-icon {
  display: grid;
  place-items: center;
  width: 58px;
  height: 58px;
  margin: 0 auto 4px;
  border-radius: 50%;
  background: linear-gradient(145deg, #FFE3C2, #FFC88E);
  color: #E77A2F;
  box-shadow: inset 0 0 0 2px #FFF6E8, 0 6px 14px rgba(206, 117, 48, 0.2);
}
.big-icon .mp-icon { width: 29px; height: 29px; }
.reward-line {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  margin: 4px 0 14px;
  padding: 9px;
  border-radius: 14px;
  background: #FFF3DF;
  color: #A26527;
  font-size: 19px;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
}
.reward-line .mp-icon { width: 22px; height: 22px; color: #F5A623; }
.unlock-cat {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 12px;
  padding: 10px 12px;
  border: 1px dashed #F3C99E;
  border-radius: 16px;
  background: #FFF9F0;
  text-align: left;
}
.unlock-cat .cat-art { display: grid; place-items: center; flex: none; width: 70px; height: 78px; }
.unlock-cat .cat-art svg { width: 100%; height: 100%; }
.unlock-cat .unlock-info { display: flex; flex-direction: column; gap: 2px; }
.unlock-cat .unlock-info small { color: #C18A55; font-size: 9px; font-weight: 700; }
.unlock-cat .unlock-info b { color: #4F3522; font-size: 17px; font-weight: 900; }
.unlock-cat .unlock-info span { color: #9C8069; font-size: 10px; }
.unlock-note { margin: 0 0 14px; padding: 7px 10px; border-radius: 10px; background: #EFF8F0; color: #5F966C; font-size: 10px; line-height: 1.5; }
.modal-actions { display: flex; flex-direction: column; gap: 8px; }
.primary-btn {
  width: 100%;
  height: 45px;
  border-radius: 14px;
  background: linear-gradient(135deg, #FFA457 0%, #FF7A2D 100%);
  box-shadow: 0 7px 16px rgba(240, 105, 28, 0.28);
  color: #FFFDF8;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.3px;
  transition: transform 0.15s ease;
}
.primary-btn:active { transform: scale(0.97); }
.ghost-btn {
  width: 100%;
  height: 40px;
  border-radius: 12px;
  background: #F6E9DB;
  color: #8A6D55;
  font-size: 12px;
  font-weight: 700;
}
.ghost-btn:active { background: #F0DFCD; }
.modal-card .hint { margin: 10px 0 0; color: #B09A87; font-size: 9.5px; line-height: 1.5; }

/* 离线收益 */
.offline-art {
  position: relative;
  width: 112px;
  height: 86px;
  margin: 2px auto 4px;
}
.offline-moon {
  position: absolute;
  top: 4px;
  left: 27px;
  display: grid;
  place-items: center;
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background: linear-gradient(145deg, #6E6198, #4B426F);
  box-shadow: inset -8px -7px 0 rgba(43, 36, 75, 0.35), 0 8px 20px rgba(71, 58, 115, 0.28);
  color: #FFE8A8;
}
.offline-moon .mp-icon { width: 32px; height: 32px; }
.offline-cat { position: absolute; right: -2px; bottom: -2px; width: 58px; height: 64px; }
.offline-cat svg { width: 100%; height: 100%; }
.offline-coins { position: absolute; left: 0; top: 10px; display: flex; flex-direction: column; gap: 2px; color: #F5B43D; }
.offline-coins .mp-icon { width: 18px; height: 18px; }
.offline-coins .mp-icon:nth-child(2) { width: 13px; height: 13px; margin-left: 8px; opacity: 0.75; }
.offline-amount {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 12px 0 6px;
  padding: 11px 14px;
  border-radius: 15px;
  background: linear-gradient(135deg, #FFF3DE, #FFEACB);
  color: #9A5E24;
  font-size: 11.5px;
  font-weight: 700;
}
.offline-amount b { display: flex; align-items: center; gap: 4px; font-size: 22px; font-weight: 900; font-variant-numeric: tabular-nums; }
.offline-amount b .mp-icon { width: 20px; height: 20px; color: #F5A623; }
.offline-time { color: #C07937; font-weight: 800; }

/* 彩纸 */
.confetti { position: absolute; inset: 0; overflow: hidden; pointer-events: none; border-radius: 26px; }
.confetti i {
  position: absolute;
  top: -14px;
  width: 7px;
  height: 11px;
  border-radius: 2px;
  background: var(--c, #FFB15E);
  opacity: 0;
  animation: confettiFall var(--dur, 1.6s) ease-in forwards;
  animation-delay: var(--delay, 0s);
}

/* ================= 引导 ================= */
.tutorial { position: fixed; inset: 0; z-index: 80; pointer-events: none; }
.tut-blocker { position: absolute; z-index: 1; pointer-events: auto; }
.tut-spot {
  z-index: 2;
  position: absolute;
  border: 2.5px solid #FFD08A;
  border-radius: 20px;
  box-shadow: 0 0 0 9999px rgba(43, 26, 14, 0.64), 0 0 0 5px rgba(255, 208, 138, 0.18);
  transition: top 0.3s ease, left 0.3s ease, width 0.3s ease, height 0.3s ease, border-radius 0.3s ease;
  pointer-events: none;
  animation: spotPulse 1.6s ease-in-out infinite;
}
.tut-tip {
  position: absolute;
  z-index: 5;
  left: 16px;
  right: 16px;
  max-width: 430px;
  margin: 0 auto;
  padding: 16px 16px 14px;
  border: 1px solid rgba(255, 255, 255, 0.9);
  border-radius: 20px;
  background: linear-gradient(180deg, #FFFDF8, #FFF5E8);
  box-shadow: 0 18px 40px rgba(38, 22, 10, 0.32);
  pointer-events: auto;
  transition: top 0.3s ease, bottom 0.3s ease;
}
.tut-step { display: inline-flex; align-items: center; gap: 4px; padding: 3px 8px; border-radius: 99px; background: #FFE9D3; color: #D06F2C; font-size: 9px; font-weight: 800; letter-spacing: 0.4px; }
.tut-tip h3 { margin: 8px 0 5px; color: #4A2F1D; font-size: 17px; font-weight: 900; }
.tut-tip p { margin: 0; color: #8F735D; font-size: 11.5px; line-height: 1.6; }
.tut-tip .tut-actions { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 12px; }
.tut-dots { display: flex; gap: 5px; }
.tut-dots i { width: 6px; height: 6px; border-radius: 50%; background: #E9D5C1; transition: background 0.2s ease, width 0.2s ease; }
.tut-dots i.on { width: 16px; border-radius: 99px; background: #FF9B53; }
.tut-skip { padding: 6px 4px; background: transparent; color: #A98E78; font-size: 10.5px; font-weight: 600; }
.tut-next {
  padding: 8px 18px;
  border-radius: 11px;
  background: linear-gradient(135deg, #FFA457, #FF7A2D);
  box-shadow: 0 4px 10px rgba(240, 105, 28, 0.22);
  color: #FFFDF8;
  font-size: 11.5px;
  font-weight: 800;
}
.tut-hand {
  position: absolute;
  z-index: 4;
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: #FFF7EA;
  color: #E8772E;
  box-shadow: 0 5px 14px rgba(38, 22, 10, 0.28);
  animation: handTap 1.2s ease-in-out infinite;
  pointer-events: none;
}
.tut-hand .mp-icon { width: 19px; height: 19px; }

/* ================= Toast & 浮字 ================= */
.toast {
  position: fixed;
  left: 50%;
  top: calc(var(--safe-top) + 64px);
  bottom: auto;
  z-index: 45;
  width: max-content;
  max-width: 82vw;
  padding: 9px 16px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 999px;
  background: rgba(55, 36, 23, 0.9);
  box-shadow: 0 8px 20px rgba(44, 27, 14, 0.22);
  color: #FFF9F1;
  font-size: 11.5px;
  font-weight: 600;
  text-align: center;
  transform: translate(-50%, 8px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.float-text {
  position: absolute;
  z-index: 9;
  color: #FFFDF8;
  font-size: 13px;
  font-weight: 900;
  text-shadow: 0 2px 5px rgba(102, 54, 20, 0.42);
  pointer-events: none;
  animation: floatUp 1s ease-out forwards;
}
.float-text.coin { color: #FFE08B; }

/* ================= 动画 ================= */
@keyframes catBreathe { 0%, 100% { transform: scaleY(1); } 50% { transform: scaleY(1.018) translateY(-0.5px); } }
@keyframes tailSwish { 0%, 100% { transform: rotate(-5deg); } 50% { transform: rotate(8deg); } }
@keyframes catBlink { 0%, 44%, 48%, 100% { transform: scaleY(1); } 46% { transform: scaleY(0.08); } }
@keyframes catPet { 0% { transform: translateX(-50%) rotate(var(--rot,0deg)) scale(var(--s,1)); } 35% { transform: translateX(-50%) rotate(calc(var(--rot,0deg) - 4deg)) scale(calc(var(--s,1) * 1.06)) translateY(-5px); } 70% { transform: translateX(-50%) rotate(calc(var(--rot,0deg) + 3deg)) scale(var(--s,1)) translateY(0); } 100% { transform: translateX(-50%) rotate(var(--rot,0deg)) scale(var(--s,1)); } }
@keyframes catArrive { 0% { opacity: 0; transform: translateX(-50%) scale(0.3) translateY(16px); } 60% { opacity: 1; transform: translateX(-50%) scale(1.1) translateY(-8px); } 100% { opacity: 1; transform: translateX(-50%) rotate(var(--rot,0deg)) scale(var(--s,1)); } }
@keyframes heartFloat { 0% { opacity: 0; transform: translate(-50%, 4px) scale(0.5); } 25% { opacity: 1; transform: translate(-50%, -10px) scale(1.1); } 100% { opacity: 0; transform: translate(-50%, -44px) scale(0.9); } }
@keyframes bowlPop { 0% { opacity: 0; transform: translate(-50%, 8px) scale(0.6); } 18% { opacity: 1; transform: translate(-50%, 0) scale(1.04); } 78% { opacity: 1; transform: translate(-50%, 0) scale(1); } 100% { opacity: 0; transform: translate(-50%, 4px) scale(0.94); } }
@keyframes roomFlash { 0% { opacity: 0; } 26% { opacity: 1; } 100% { opacity: 0; } }
@keyframes pulseNow { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.025); } }
@keyframes floatUp { 0% { opacity: 0; transform: translate(-50%, 4px) scale(0.8); } 22% { opacity: 1; } 100% { opacity: 0; transform: translate(-50%, -34px) scale(1); } }
@keyframes coinBump { 0%, 100% { transform: scale(1); } 38% { transform: scale(1.09); } 66% { transform: scale(0.97); } }
@keyframes dotPulse { 0%, 100% { transform: scale(1); opacity: 1; } 50% { transform: scale(1.22); opacity: 0.72; } }
@keyframes readyPulse { 0%, 100% { box-shadow: 0 5px 12px rgba(240, 105, 28, 0.26); } 50% { box-shadow: 0 5px 20px rgba(240, 105, 28, 0.46); } }
@keyframes sheetUp { from { transform: translateY(100%); } to { transform: translateY(0); } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes modalPop { 0% { opacity: 0; transform: scale(0.82) translateY(14px); } 100% { opacity: 1; transform: scale(1) translateY(0); } }
@keyframes hintIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes spotPulse { 0%, 100% { border-color: #FFD08A; } 50% { border-color: #FFF1C9; } }
@keyframes handTap { 0%, 100% { transform: translate(0, 0) scale(1); } 50% { transform: translate(4px, -7px) scale(1.06); } }
@keyframes confettiFall { 0% { opacity: 0; transform: translate3d(0, 0, 0) rotate(0deg); } 8% { opacity: 1; } 100% { opacity: 0; transform: translate3d(var(--dx, 0px), 420px, 0) rotate(540deg); } }

/* ================= 适配 ================= */
@media (max-width: 370px) {
  .hud { left: 12px; right: 12px; }
  .panel { padding-left: 12px; padding-right: 12px; }
  .player-chip { max-width: 54%; padding-right: 9px; }
  .player-text b { max-width: 82px; font-size: 12px; }
  .player-text small { font-size: 8.5px; }
  .avatar { width: 32px; height: 32px; }
  .coin-chip { height: 35px; padding: 0 10px 0 8px; }
  .coin-chip b { font-size: 13.5px; }
  .round-btn { width: 35px; height: 35px; }
  .cat-name-row span { display: none; }
  .income-chip { width: 44px; }
  .goal-chip { font-size: 9.5px; padding-left: 6px; padding-right: 6px; }
  .goal-chip .mp-icon { width: 12px; height: 12px; }
  .dock-btn { height: 54px; font-size: 9.5px; }
  .dock-btn .mp-icon { width: 19px; height: 19px; }
  .decor-grid { gap: 6px; }
  .decor-card { padding: 6px; }
  .book-grid { gap: 7px; }
  .book-card { padding: 7px; gap: 5px; }
  .book-art { width: 48px; height: 58px; }
}

@media (max-height: 700px) {
  .panel { gap: 7px; padding-top: 6px; }
  .grip { height: 3px; margin-bottom: 0; }
  .cat-status { padding: 6px 9px; }
  .cat-portrait { width: 42px; height: 42px; border-radius: 13px; }
  .cat-name-row b { font-size: 13.5px; }
  .goal-card { gap: 5px; padding: 7px 9px 8px; }
  .goal-chip { padding: 5px 6px 6px; }
  .complete-btn { height: 33px; font-size: 11px; }
  .dock-btn { height: 50px; }
  .dock-btn .mp-icon { width: 19px; height: 19px; }
}

@media (max-height: 620px) {
  .player-text small { display: none; }
  .cat-status { gap: 7px; padding: 4px 8px; border-radius: 14px; }
  .cat-portrait { width: 36px; height: 36px; border-radius: 11px; }
  .cat-name-row { gap: 4px; }
  .cat-name-row b { font-size: 12px; }
  .cat-name-row span { display: none; }
  .aff-label { display: none; }
  .aff-track { height: 5px; }
  .income-chip { width: 42px; padding: 3px 1px; }
  .income-chip .mp-icon { width: 13px; height: 13px; }
  .income-chip span { font-size: 7.5px; }
  .goal-chips { gap: 4px; }
  .dock-btn { height: 46px; }
  .dock-btn span { font-size: 9px; }
  .panel { margin-top: -16px; border-radius: 22px 22px 0 0; }
}

@media (min-width: 520px) {
  body { display: flex; align-items: center; justify-content: center; padding: 16px; background: radial-gradient(circle at 50% 20%, #F8EBDC, #EAD7C4); }
  .game {
    height: min(920px, calc(100dvh - 32px));
    border-radius: 34px;
    box-shadow: 0 24px 70px rgba(80, 49, 25, 0.26), 0 0 0 1px rgba(255, 255, 255, 0.5);
  }
  .room { border-radius: 34px 34px 0 0; }
  .panel { border-radius: 26px 26px 0 0; }
}

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