/* 嘟嘟小窩 — 手機直式、馬子狗 IP 風格：粗黑線、硬陰影、官方色票 */
:root {
  --ink: #141518;
  --paper: #FFFDF8;
  --cream: #F8E7C9;
  --red: #D86E66;
  --pink: #F09091;
  --pink-light: #FAD9D7;
  --green: #66A57C;
  --butter: #F6D58A;
  --line: 3px solid var(--ink);
  --shadow: 0 4px 0 var(--ink);
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
}
* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; overflow: hidden; overscroll-behavior: none; }
body {
  background: #85B8A6;
  background-image: radial-gradient(rgba(255,255,255,.35) 2px, transparent 2.5px);
  background-size: 26px 26px;
  font-family: "PingFang TC", "Noto Sans TC", "Microsoft JhengHei", sans-serif;
  color: var(--ink);
  user-select: none; -webkit-user-select: none; -webkit-touch-callout: none;
  touch-action: manipulation;
  display: flex; justify-content: center; align-items: center;
}
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; touch-action: manipulation; }
svg { display: block; }

/* 只做手機版：電腦開啟時置中顯示手機框 */
#app { position: relative; width: 100%; max-width: 430px; height: 100dvh; max-height: 932px; overflow: hidden; overflow: clip; background: var(--cream); }
@media (min-width: 500px) {
  #app { height: min(100dvh - 40px, 932px); border: 4px solid var(--ink); border-radius: 36px; box-shadow: 0 10px 0 var(--ink); }
}

/* clip：完全不能捲動（hidden 仍可被點擊、聚焦時的自動捲動帶走，畫面會整個往上跑） */
.stage { position: absolute; inset: 0; overflow: hidden; overflow: clip; container-type: size; }
/* 房間世界：900x1800 直式畫布，貼底、蓋滿舞台（矮螢幕裁掉上方牆面） */
.world {
  position: absolute; left: 50%; bottom: 0;
  height: max(100cqh, 200cqw); aspect-ratio: 1 / 2;
  transform: translateX(-50%) translateY(calc(-1 * var(--shift, 0px)));
  transition: transform .3s cubic-bezier(.3,.9,.4,1);
}
.room, .room svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.moving .furn { cursor: grab; }
.moving .furn.lifted { filter: drop-shadow(0 10px 0 rgba(20,21,24,.25)); }

/* ---------- 頂部 HUD ---------- */
.hud-top {
  position: absolute; left: 0; right: 0; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 8px;
  padding: calc(var(--safe-t) + 10px) 12px 0;
}
.profile {
  flex: 1; display: flex; align-items: center; gap: 8px; min-width: 0;
}
.avatar {
  position: relative; flex: none;
  width: 52px; height: 52px; border-radius: 50%;
  border: var(--line); box-shadow: var(--shadow);
  background: var(--green) url("../public/image/dodo_friends/角色_嘟嘟.png") 50% 26% / 150% auto no-repeat;
}
.avatar b {
  position: absolute; right: -8px; bottom: -8px;
  min-width: 26px; height: 26px; padding: 0 5px; border-radius: 13px;
  background: var(--red); color: #fff; border: 2.5px solid var(--ink);
  font-size: 14px; font-weight: 900; line-height: 21px; text-align: center;
}
.status {
  display: flex; flex-direction: column; gap: 4px;
  padding: 5px 10px 6px; background: #fff; border: var(--line); border-radius: 14px; box-shadow: var(--shadow);
}
.status-name { display: flex; align-items: center; gap: 6px; }
.status-name b { font-size: 14px; font-weight: 900; line-height: 1; }
.xp { display: block; width: 52px; height: 7px; border: 2px solid var(--ink); border-radius: 5px; overflow: hidden; background: var(--cream); }
.xp em { display: block; height: 100%; background: var(--red); transition: width .4s; }
.meters { display: flex; gap: 6px; }
.mini { display: flex; align-items: center; gap: 2px; }
.mini svg { width: 15px; }
.mini i { display: block; width: 26px; height: 8px; border: 2px solid var(--ink); border-radius: 5px; overflow: hidden; background: var(--paper); }
.mini em { display: block; height: 100%; transition: width .5s; }
.mini.pink em { background: var(--pink); }
.mini.yellow em { background: var(--butter); }
.mini.green em { background: var(--green); }
.mini.pink svg { color: var(--red); }
.coin {
  display: flex; align-items: center; gap: 6px;
  height: 40px; padding: 0 14px 0 8px; border: var(--line); border-radius: 999px;
  background: #fff; box-shadow: var(--shadow);
  font-size: 18px; font-weight: 900;
}
.coin svg { width: 28px; }
.round-btn {
  width: 44px; height: 44px; flex: none; border-radius: 50%;
  background: #fff; border: var(--line); box-shadow: var(--shadow);
  display: grid; place-items: center;
}
.round-btn svg { width: 24px; }
.round-btn:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--ink); }

/* 窄螢幕（360 寬）：狀態卡與小魚乾縮小，避免互相重疊 */
@media (max-width: 380px) {
  .hud-top { gap: 6px; padding-left: 10px; padding-right: 10px; }
  .avatar { width: 46px; height: 46px; }
  .status { padding: 4px 8px 5px; }
  .meters { gap: 4px; }
  .mini svg { width: 13px; }
  .mini i { width: 18px; }
  .xp { width: 40px; }
  .coin { height: 36px; padding: 0 10px 0 6px; font-size: 16px; gap: 4px; }
  .coin svg { width: 24px; }
  .round-btn { width: 40px; height: 40px; }
}
