/* ===== 基础 ===== */
* { margin: 0; padding: 0; box-sizing: border-box; }
body {
  font-family: "Microsoft YaHei", "PingFang SC", sans-serif;
  background: linear-gradient(135deg, #a8e063, #56ab2f);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #333;
  user-select: none;
}
.hidden { display: none !important; }
.screen { width: 860px; max-width: 96vw; }

.title {
  text-align: center;
  font-size: 42px;
  color: #fff;
  text-shadow: 2px 3px 0 #2d6a1e;
  margin-bottom: 8px;
}
.subtitle { text-align: center; color: #f4ffdf; margin-bottom: 24px; font-size: 18px; }

.btn {
  border: none;
  border-radius: 10px;
  padding: 10px 18px;
  font-size: 15px;
  cursor: pointer;
  background: #fff;
  box-shadow: 0 3px 0 rgba(0,0,0,.2);
  transition: transform .1s, box-shadow .1s;
}
.btn:hover { transform: translateY(-2px); box-shadow: 0 5px 0 rgba(0,0,0,.2); }
.btn:active { transform: translateY(1px); box-shadow: 0 1px 0 rgba(0,0,0,.2); }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; }
.btn-primary { background: #ff8c42; color: #fff; font-weight: bold; }

/* ===== 选宠界面 ===== */
.pet-options { display: flex; gap: 16px; justify-content: center; flex-wrap: wrap; margin-bottom: 24px; }
.pet-card {
  width: 130px; padding: 16px 8px;
  background: rgba(255,255,255,.92);
  border-radius: 14px; text-align: center;
  cursor: pointer; border: 4px solid transparent;
  transition: transform .15s;
}
.pet-card:hover { transform: scale(1.06); }
.pet-card.selected { border-color: #ff8c42; background: #fff3e6; }
.pet-card .emoji { font-size: 56px; display: block; animation: bounce 1.6s infinite ease-in-out; }
.pet-card h3 { margin: 8px 0 4px; }
.pet-card p { font-size: 12px; color: #777; }
@keyframes bounce { 0%,100%{transform:translateY(0)} 50%{transform:translateY(-8px)} }

.name-box { display: flex; gap: 10px; justify-content: center; }
.name-box input {
  padding: 10px 14px; border-radius: 10px; border: none;
  font-size: 15px; width: 220px; outline: none;
}

/* ===== 游戏界面 ===== */
#game-screen {
  background: rgba(255,255,255,.95);
  border-radius: 18px;
  box-shadow: 0 12px 40px rgba(0,0,0,.3);
  overflow: hidden;
}

#status-bar {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  background: #3d5a3a; color: #fff;
  padding: 10px 16px; font-size: 13px;
}
.stat { display: flex; align-items: center; gap: 6px; }
.stat b { min-width: 26px; text-align: right; }
.money { font-size: 15px; margin-left: auto; }
.bar { width: 90px; height: 12px; background: rgba(0,0,0,.35); border-radius: 6px; overflow: hidden; }
.bar-fill { height: 100%; width: 100%; border-radius: 6px; transition: width .4s, background .4s; }
.bar-fill.hunger { background: #f6a93b; }
.bar-fill.mood   { background: #e86fd0; }
.bar-fill.health { background: #e74c3c; }
.bar-fill.clean  { background: #4fb3e8; }
.bar-fill.low { animation: blink .6s infinite alternate; }
@keyframes blink { from{opacity:1} to{opacity:.35} }

#room-nav { display: flex; background: #2c4429; }
.room-btn {
  flex: 1; padding: 10px 0; border: none; cursor: pointer;
  background: transparent; color: #cfe6c8; font-size: 14px;
  border-bottom: 3px solid transparent;
}
.room-btn:hover { background: rgba(255,255,255,.08); }
.room-btn.active { color: #fff; border-bottom-color: #ffb347; background: rgba(255,255,255,.1); }

#room-area { height: 430px; position: relative; }
.room { display: none; height: 100%; padding: 14px 18px; overflow-y: auto; }
.room.active { display: block; }
.room h2 { margin-bottom: 6px; }
.room h3 { margin: 12px 0 6px; color: #4a6b3f; }
.tip { font-size: 13px; color: #888; margin-bottom: 10px; }

/* ===== 客厅 / 宠物活动区 ===== */
#room-living { padding: 0; display: none; flex-direction: column; }
#room-living.active { display: flex; }
#playground {
  flex: 1; position: relative; overflow: hidden;
  background:
    radial-gradient(circle at 20% 80%, rgba(255,255,255,.5) 0 8%, transparent 9%),
    radial-gradient(circle at 80% 30%, rgba(255,255,255,.4) 0 6%, transparent 7%),
    linear-gradient(#bfe8ff 0 55%, #9ad27a 55% 100%);
}
#pet {
  position: absolute; left: 50%; top: 55%;
  font-size: 64px; cursor: pointer;
  transform: translate(-50%, -50%);
  transition: left 1.6s linear, top 1.6s linear;
  filter: drop-shadow(0 6px 4px rgba(0,0,0,.25));
  z-index: 2;
}
#pet.walking { animation: waddle .35s infinite alternate ease-in-out; }
@keyframes waddle { from { margin-top: 0 } to { margin-top: -10px } }
#pet.flip { scale: -1 1; }
#pet-bubble {
  position: absolute; z-index: 3;
  background: #fff; border-radius: 12px; padding: 6px 12px;
  font-size: 14px; box-shadow: 0 2px 8px rgba(0,0,0,.2);
  pointer-events: none; white-space: nowrap;
  transform: translate(-50%, -130%);
}
#pet-bubble::after {
  content: ""; position: absolute; left: 50%; bottom: -6px;
  border: 7px solid transparent; border-top-color: #fff; border-bottom: 0;
  transform: translateX(-50%);
}
#poop { position: absolute; font-size: 34px; z-index: 1; animation: bounce 2s infinite; }

.room-actions {
  display: flex; gap: 10px; padding: 12px 16px; align-items: center;
  background: #eef7e6; border-top: 2px dashed #b8d9a3; flex-wrap: wrap;
}
#food-select { padding: 9px; border-radius: 8px; border: 1px solid #aaa; font-size: 14px; }
.speed-control {
  display: flex; align-items: center; gap: 6px; margin-left: auto;
  font-size: 14px; color: #4a6b3f;
}
.speed-control input[type="range"] { width: 110px; accent-color: #ff8c42; cursor: pointer; }
.speed-control span { min-width: 34px; font-size: 13px; }

/* ===== 商店/厨房 物品卡片 ===== */
.item-grid { display: flex; gap: 12px; flex-wrap: wrap; }
.item-card {
  width: 150px; background: #fff; border: 2px solid #d7ecd0;
  border-radius: 12px; padding: 10px; text-align: center;
}
.item-card .emoji { font-size: 38px; display: block; }
.item-card h4 { margin: 4px 0; }
.item-card p { font-size: 12px; color: #888; min-height: 30px; }
.item-card .btn { margin-top: 6px; padding: 6px 12px; font-size: 13px; }

/* ===== 厕所 / 医院 ===== */
.toilet-actions { display: flex; gap: 18px; flex-wrap: wrap; }
.toilet-card {
  width: 240px; background: #fff; border: 2px solid #d7ecd0;
  border-radius: 12px; padding: 18px; text-align: center;
}
.toilet-card p { font-size: 13px; color: #777; margin: 8px 0 12px; }
.big-emoji { font-size: 52px; }

/* ===== 扫雷 ===== */
.mine-controls { display: flex; gap: 18px; align-items: center; margin-bottom: 10px; font-size: 14px; }
#mine-board {
  display: grid; grid-template-columns: repeat(8, 36px); gap: 2px;
  background: #7ba05b; padding: 6px; border-radius: 8px; width: fit-content;
}
.cell {
  width: 36px; height: 36px; border: none; cursor: pointer;
  background: #c9e4a8; font-size: 17px; font-weight: bold;
  display: flex; align-items: center; justify-content: center;
}
.cell:hover:not(.open) { background: #dff2c4; }
.cell.open { background: #f0f7e6; cursor: default; }
.cell.mine-hit { background: #e74c3c; }
#mine-result { margin-top: 10px; font-size: 16px; font-weight: bold; min-height: 24px; }

/* ===== 背包 ===== */
#inventory-bar {
  background: #3d5a3a; color: #e8f5e0; padding: 10px 16px; font-size: 14px;
}
#inventory-list b { color: #ffd97a; margin: 0 2px; }

/* ===== 死亡界面 ===== */
#death-screen { text-align: center; }
.death-box {
  background: rgba(255,255,255,.95); border-radius: 18px;
  padding: 50px 60px; box-shadow: 0 12px 40px rgba(0,0,0,.35);
}
.death-box .big-emoji { font-size: 80px; }
.death-box h1 { margin: 14px 0 8px; color: #555; }
.death-box p { color: #999; margin-bottom: 22px; }

/* ===== Toast ===== */
#toast {
  position: fixed; left: 50%; bottom: 40px; transform: translateX(-50%);
  background: rgba(40,40,40,.92); color: #fff;
  padding: 12px 26px; border-radius: 30px; font-size: 15px;
  z-index: 99; animation: toast-in .25s ease-out;
}
@keyframes toast-in { from { opacity:0; transform:translate(-50%,16px) } to { opacity:1; transform:translate(-50%,0) } }
