* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
:root {
  --cream: #fbe9c4;
  --cream-deep: #f6d98f;
  --orange: #f2a65a;
  --orange-deep: #e07b39;
  --brown: #8a5a2b;
  --ink: #5b4636;
  --green: #8ed081;
  --green-deep: #5bb24a;
  --card: #fffdf6;
  --shadow: 0 4px 0 rgba(0,0,0,.12), 0 6px 14px rgba(0,0,0,.12);
  --radius: 22px;
  --scale: 1;
}
html, body { height: 100%; }
body {
  font-family: 'Nunito', 'Segoe UI', system-ui, -apple-system, sans-serif;
  font-weight: 800;
  color: var(--ink);
  background: var(--cream);
  overflow: hidden;
  user-select: none;
}
#app { position: relative; width: 100vw; height: 100dvh; overflow: hidden; }

/* night mode — engaged while a pet is sleeping */
#app::before { content:''; position:absolute; inset:0; z-index:15; pointer-events:none; opacity:0;
  transition:opacity .7s ease;
  background:radial-gradient(135% 95% at 50% 8%, rgba(70,84,165,.20) 0%, rgba(28,34,86,.5) 55%, rgba(10,13,44,.68) 100%); }
#app.night::before { opacity:1; }
#app.night .home-banner, #app.night .roomnav, #app.night .profile-chip { filter:brightness(.92); }
.night-stars { position:absolute; inset:0 0 auto 0; height:45%; z-index:16; pointer-events:none; opacity:0;
  transition:opacity .7s ease; }
#app.night .night-stars { opacity:1; }
.night-stars span { position:absolute; color:#fff; font-size:12px; animation:twinkle 2.6s ease-in-out infinite; }
@keyframes twinkle { 0%,100%{opacity:.3;} 50%{opacity:1;} }

/* ---------- loading ---------- */
.loading-screen {
  position: absolute; inset: 0; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 18px;
  background: linear-gradient(#fcdf9e, #fdf3cf);
}
.loading-house { font-size: 84px; animation: bob 1.4s ease-in-out infinite; }
.loading-bar { width: 180px; height: 18px; border-radius: 999px; background: #f2cf86; overflow: hidden; }
.loading-bar span { display:block; height:100%; width:40%; border-radius:999px;
  background: repeating-linear-gradient(45deg,#f6c453,#f6c453 8px,#f9d77f 8px,#f9d77f 16px);
  animation: slide 1.1s linear infinite; }
.loading-tip { color: #b08a55; font-size: 18px; }
@keyframes bob { 50% { transform: translateY(-12px); } }
@keyframes slide { from { transform: translateX(-60px); } to { transform: translateX(220px); } }

/* ---------- login ---------- */
.login-wrap { position:absolute; inset:0; display:flex; flex-direction:column;
  align-items:center; justify-content:center; gap:18px; padding:28px;
  background: linear-gradient(#fcdf9e,#fdf3cf); text-align:center; }
.login-logo { font-size:72px; }
.login-title { font-size:30px; color:var(--orange-deep); letter-spacing:.5px; }
.login-sub { font-size:15px; color:#a98a5c; font-weight:700; max-width:300px; }
.login-card { background:var(--card); border-radius:var(--radius); box-shadow:var(--shadow);
  padding:20px; width:100%; max-width:340px; display:flex; flex-direction:column; gap:12px; }
.field { width:100%; border:3px solid #f0dca8; border-radius:16px; padding:14px 16px;
  font-size:17px; font-weight:800; color:var(--ink); background:#fffef9; outline:none; text-align:center; }
.field:focus { border-color:var(--orange); }
.btn { border:none; cursor:pointer; font-family:inherit; font-weight:900; }
.btn-primary { background:var(--orange); color:#fff; border-radius:16px; padding:14px;
  font-size:18px; box-shadow:0 4px 0 var(--orange-deep); transition:transform .05s; }
.btn-primary:active { transform:translateY(2px); box-shadow:0 2px 0 var(--orange-deep); }
.btn-ghost { background:transparent; color:#b08a55; font-size:14px; padding:6px; }
.login-err { color:#e0564a; font-size:14px; font-weight:800; min-height:18px; }

/* ---------- MasterGo-style landing / login ---------- */
.mgo-landing { position:absolute; inset:0; overflow:hidden; display:flex; flex-direction:column;
  background:linear-gradient(165deg, #3d68ff 0%, #557dff 42%, #a7c0ff 100%); color:#fff; }
.mgo-top { display:flex; align-items:center; justify-content:space-between; padding:16px 18px; z-index:3; }
.mgo-brand { display:flex; align-items:center; gap:8px; font-weight:900; font-size:16px; letter-spacing:.4px; }
.mgo-brand .tri { width:0; height:0; border-left:8px solid transparent; border-right:8px solid transparent; border-bottom:14px solid #fff; }
.mgo-hero { flex:1; display:flex; flex-direction:column; align-items:center; padding:2px 22px 26px; z-index:2; overflow-y:auto; }
.mascot-wrap { position:relative; width:100%; max-width:360px; height:220px; margin-top:4px; flex:none; }

.mascot { position:absolute; left:50%; bottom:2px; transform:translateX(-50%); width:150px; height:200px;
  animation:floaty 3.8s ease-in-out infinite; filter:drop-shadow(0 18px 20px rgba(25,45,130,.4)); }
.mascot .body { position:absolute; inset:0; background:radial-gradient(120% 100% at 42% 26%, #ffffff, #e3ebff);
  clip-path:polygon(50% 0%, 70% 9%, 86% 30%, 92% 58%, 84% 84%, 64% 100%, 36% 100%, 16% 84%, 8% 58%, 14% 30%, 30% 9%);
  box-shadow:inset -10px -14px 22px rgba(150,170,235,.45), inset 8px 8px 14px rgba(255,255,255,.6); }
.mascot .eye { position:absolute; top:44%; width:15px; height:23px; background:#2a3550; border-radius:50%; }
.mascot .eye.l { left:44px; } .mascot .eye.r { right:44px; }
.mascot .arm { position:absolute; top:58%; width:20px; height:38px; background:radial-gradient(#fff,#e3ebff); border-radius:50%; }
.mascot .arm.l { left:-2px; transform:rotate(18deg); } .mascot .arm.r { right:-2px; transform:rotate(-18deg); }
.mascot .foot { position:absolute; bottom:-4px; width:36px; height:20px; background:#8fb0ff;
  border-radius:50% 50% 50% 50% / 60% 60% 40% 40%; }
.mascot .foot.l { left:34px; } .mascot .foot.r { right:34px; }
@keyframes floaty { 50% { transform:translateX(-50%) translateY(-13px); } }

.mascot-wrap .spark { position:absolute; color:#fff; opacity:.92; animation:twinkle 2.6s ease-in-out infinite; }
.mascot-wrap .dot { position:absolute; border-radius:50%; box-shadow:0 2px 6px rgba(20,40,120,.25); }
.mascot-wrap .float-emoji { position:absolute; font-size:30px; filter:drop-shadow(0 6px 8px rgba(25,45,130,.35));
  animation:floaty 4.4s ease-in-out infinite; }

.mgo-title { font-style:italic; font-weight:900; font-size:42px; line-height:.96; letter-spacing:1px;
  text-transform:uppercase; text-align:center; margin-top:2px; text-shadow:0 6px 22px rgba(15,35,110,.4); }
.mgo-title .s { color:#dbe6ff; }
.mgo-title .sp { display:inline-block; color:#fff; margin-right:6px; font-style:normal; }
.mgo-sub { margin-top:10px; font-size:15px; font-weight:800; color:#eef3ff; text-align:center; }
.mgo-card { margin-top:18px; width:100%; max-width:340px; background:#fff; border-radius:24px; padding:18px;
  box-shadow:0 20px 44px rgba(25,45,130,.34); display:flex; flex-direction:column; gap:12px; color:#2a3550; }
.mgo-card .field { border-color:#d7e1ff; background:#f5f8ff; color:#2a3550; }
.mgo-card .field:focus { border-color:#3d68ff; }
.mgo-card .btn-primary { background:#3d68ff; box-shadow:0 4px 0 #2a4fd6; }
.mgo-card .btn-ghost { color:#7183a8; }
.mgo-card .login-sub { color:#7183a8; font-size:13px; font-weight:700; }
.mgo-card .login-err { color:#e0564a; }
.mgo-foot { margin-top:16px; font-size:13px; color:#eef3ff; opacity:.85; }

/* ---------- room / home ---------- */
.room { position:absolute; inset:0; transition:background .3s; }
.room-living   { background:#f7e6c8 url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="40" height="40"><path d="M0 0h40v40H0z" fill="%23f7e6c8"/><path d="M0 20h40" stroke="%23efd9af" stroke-width="2"/></svg>'); }
.room-dining   { background:#fbe7a8; background-image:repeating-linear-gradient(45deg,#f7df9a 0 14px,#fbe7a8 14px 28px); }
.room-bathroom { background:#cfeefb; background-image:linear-gradient(#bfe7f8 2px,transparent 2px),linear-gradient(90deg,#bfe7f8 2px,transparent 2px); background-size:46px 46px; }
.room-bedroom  { background:#cfd6f3; background-image:repeating-linear-gradient(45deg,#c6cef0 0 16px,#cfd6f3 16px 32px); }
.room-garden   { background:linear-gradient(#bfe5f5 0 45%, #aee08f 45% 100%); }

.topbar { position:absolute; top:0; left:0; right:0; display:flex; align-items:center;
  justify-content:space-between; padding:12px 14px; z-index:30; }
.profile-chip { display:flex; align-items:center; gap:10px; background:linear-gradient(#fff7e6,#ffedc0);
  border:3px solid #efc978; border-radius:999px; padding:5px 18px 5px 6px; box-shadow:var(--shadow); }
.profile-chip .avatar { width:46px; height:46px; border-radius:50%; overflow:hidden; border:3px solid #fff;
  background:#ffe9bd; box-shadow:0 2px 5px rgba(0,0,0,.22); display:flex; align-items:center; justify-content:center; font-size:24px; }
.profile-chip .avatar img { width:100%; height:100%; object-fit:cover; }
.profile-chip .pinfo { display:flex; flex-direction:column; line-height:1.15; gap:1px; }
.profile-chip .pname { font-size:14px; color:var(--brown); max-width:120px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.coinrow { display:flex; align-items:center; gap:5px; }
.coin { width:20px; height:20px; border-radius:50%; flex:none; position:relative; display:inline-block; vertical-align:middle;
  background:radial-gradient(circle at 34% 30%, #fff2bd, #f6c033 58%, #dc9410);
  border:2px solid #e7a71c; box-shadow:inset 0 -2px 3px rgba(150,90,0,.4), inset 0 2px 2px rgba(255,255,255,.75); }
.coin::after { content:''; position:absolute; inset:4px; border-radius:50%; border:2px solid rgba(255,255,255,.5); box-sizing:border-box; }
.coin.sm { width:16px; height:16px; border-width:1.5px; }
.coin.sm::after { inset:3px; border-width:1.5px; }
.coinrow #coins { font-size:18px; color:#c9871a; }
.coinrow .plus { background:var(--green-deep); color:#fff; width:22px; height:22px; border-radius:50%;
  display:flex; align-items:center; justify-content:center; font-size:16px; box-shadow:0 2px 0 #3f8a32; margin-left:2px; }
.top-actions { display:flex; gap:10px; }
.icon-btn { width:50px; height:50px; border-radius:16px; background:#fff7e0; border:3px solid #f3d178;
  box-shadow:var(--shadow); display:flex; align-items:center; justify-content:center; font-size:24px; }

/* family banner */
.home-banner { position:absolute; top:74px; left:50%; transform:translateX(-50%); z-index:20;
  background:#fbe1ab; border:3px solid #f0c574; border-radius:18px; padding:8px 14px 10px;
  display:flex; flex-direction:column; align-items:center; gap:4px; box-shadow:var(--shadow); }
.home-banner .avatars { display:flex; gap:-6px; }
.home-banner .avatars .av { width:34px; height:34px; border-radius:50%; background:#fff; border:2px solid #fff;
  margin-left:-8px; display:flex; align-items:center; justify-content:center; font-size:18px; box-shadow:0 1px 3px rgba(0,0,0,.2);}
.home-banner .avatars .av:first-child { margin-left:0; }
.home-banner .ttl { font-size:13px; color:var(--brown); }

/* side toolbar */
.toolbar { position:absolute; right:10px; top:120px; z-index:25; display:flex; flex-direction:column;
  gap:12px; background:rgba(255,255,255,.55); padding:10px 8px; border-radius:26px; }
.tool { width:50px; height:50px; border-radius:15px; background:var(--card); box-shadow:var(--shadow);
  display:flex; align-items:center; justify-content:center; font-size:25px; position:relative; }
.tool .badge { position:absolute; top:-4px; right:-4px; background:#e0564a; color:#fff; border-radius:999px;
  font-size:10px; padding:1px 5px; }
.tool .free { position:absolute; top:-9px; right:-6px; background:#e0564a; color:#fff; border-radius:8px;
  font-size:9px; padding:1px 4px; }

/* pets stage */
.stage { position:absolute; left:0; right:0; bottom:120px; top:180px; display:flex; flex-wrap:wrap;
  align-items:center; justify-content:center; gap:18px 26px; padding:20px; z-index:10; pointer-events:none; }
.pet { display:flex; flex-direction:column; align-items:center; gap:6px; cursor:grab;
  transition:transform .12s; pointer-events:auto; }
.pet:active { transform:scale(.95); }
.pet .sprite { width:calc(120px * var(--scale)); height:calc(120px * var(--scale)); border-radius:24px; object-fit:cover;
  filter:drop-shadow(0 6px 6px rgba(0,0,0,.18)); animation:bob 3s ease-in-out infinite; background:transparent; }
.pet.selected .sprite { outline:4px solid var(--orange); outline-offset:2px; }
.pet .tag { background:#fff; border:2px solid #e9d6ab; border-radius:999px; padding:2px 12px; font-size:15px;
  display:flex; align-items:center; gap:5px; box-shadow:0 2px 4px rgba(0,0,0,.12); }
.pet .tag .home { font-size:14px; }
.pet .zzz { position:absolute; font-size:22px; transform:translate(40px,-46px); }
.pet .pet-timer { font-size:12px; font-weight:900; color:var(--orange-deep); background:#fff; border:2px solid #f4d98c;
  border-radius:999px; padding:3px 12px; box-shadow:0 3px 6px rgba(0,0,0,.14); white-space:nowrap; display:flex; align-items:center; gap:5px; }
.pet.away .sprite { opacity:.55; filter:drop-shadow(0 6px 6px rgba(0,0,0,.12)); }
.pet .mini-needs { display:flex; gap:3px; }
.pet .mini-needs i { width:7px; height:7px; border-radius:50%; display:inline-block; }

/* ---------- room scene (each tab = a visualized building) ---------- */
.scene-wrap { position:absolute; left:0; right:0; top:150px; bottom:104px; z-index:10; display:flex; flex-direction:column;
  align-items:center; justify-content:center; gap:24px; padding:12px 16px; overflow-y:auto; }
.house { position:relative; width:min(94vw,760px); filter:drop-shadow(0 14px 20px rgba(0,0,0,.22)); }
.house-roof { height:clamp(64px,9vw,128px); clip-path:polygon(50% 0, 100% 100%, 0 100%); margin:0 -8px -2px; border-radius:6px; }
.house-wall { border-radius:8px 8px 26px 26px; padding:clamp(24px,4vw,48px) clamp(20px,3vw,44px) clamp(30px,4.5vw,56px);
  min-height:clamp(200px,26vw,380px); position:relative; display:flex; gap:clamp(16px,3vw,40px); align-items:center;
  justify-content:center; flex-wrap:wrap; box-shadow:inset 0 0 0 3px rgba(255,255,255,.35); }
.house-door { position:absolute; right:20px; bottom:0; width:44px; height:56px;
  background:linear-gradient(#b07a3e,#8a5a2b); border-radius:9px 9px 0 0; box-shadow:inset 0 0 0 3px rgba(255,255,255,.25); }
.house-door::after { content:''; position:absolute; left:8px; top:26px; width:5px; height:5px; border-radius:50%; background:#ffe08a; }
.room-name { background:#fff; border:3px solid #efc978; border-radius:999px; padding:5px 22px; font-size:16px;
  font-weight:900; color:var(--brown); box-shadow:var(--shadow); white-space:nowrap; }
.house-decor { position:absolute; inset:0; pointer-events:none; z-index:0; }
.house-decor .hd { position:absolute; line-height:1; filter:drop-shadow(0 2px 2px rgba(0,0,0,.16)); }
.scene-pets { display:flex; gap:20px; justify-content:center; flex-wrap:wrap; position:relative; z-index:1; }
.pet-slot { display:flex; flex-direction:column; align-items:center; gap:6px; cursor:pointer; }
.house-window { width:clamp(120px,20vw,250px); height:clamp(120px,20vw,250px); border:7px solid #fff; border-radius:16px;
  background:linear-gradient(#cdeeff,#eaf7ff); box-shadow:inset 0 3px 10px rgba(0,0,0,.16), 0 4px 8px rgba(0,0,0,.18);
  overflow:hidden; position:relative; }
.house-window .win-pet { width:100%; height:100%; object-fit:cover; animation:bob 3s ease-in-out infinite; }
.house-window .zzz { position:absolute; top:4px; right:6px; font-size:20px; z-index:2; transform:none; }
.pet-slot .tag { background:#fff; border:2px solid #e9d6ab; border-radius:999px; padding:2px 12px; font-size:15px;
  display:flex; align-items:center; gap:5px; box-shadow:0 2px 4px rgba(0,0,0,.12); }
.pet-slot .tag .home { font-size:14px; }
.pet-slot .pet-timer { font-size:12px; font-weight:900; color:var(--orange-deep); background:#fff; border:2px solid #f4d98c;
  border-radius:999px; padding:3px 12px; box-shadow:0 3px 6px rgba(0,0,0,.14); white-space:nowrap; }
.scene-empty { padding:26px 16px; text-align:center; color:var(--brown); font-size:16px; }
.room-actions { display:flex; gap:12px; flex-wrap:wrap; justify-content:center; max-width:470px; }
.room-act { display:flex; flex-direction:column; align-items:center; gap:3px; background:var(--card); border:3px solid #efd9a8;
  border-radius:18px; padding:10px 14px; min-width:76px; box-shadow:var(--shadow); cursor:pointer; transition:transform .1s; }
.room-act:active { transform:translateY(2px) scale(.97); }
.room-act .ra-ic { font-size:30px; }
.room-act .ra-lbl { font-size:12px; font-weight:900; color:var(--brown); }
.garden-scene { position:relative; width:min(94vw,760px); min-height:clamp(260px,32vw,440px); border-radius:24px; overflow:hidden; border:4px solid #fff;
  box-shadow:var(--shadow); background:linear-gradient(#bfe5f5 0 58%, #b7e58f 58% 74%, #a9dc86 74% 100%);
  display:flex; align-items:center; justify-content:center; padding:20px; }
.garden-scene .scene-pets { position:relative; z-index:3; }
.gd { position:absolute; line-height:1; filter:drop-shadow(0 3px 3px rgba(0,0,0,.18)); }
.gd-sun { right:8%; top:10px; font-size:44px; filter:drop-shadow(0 0 12px rgba(255,210,90,.7)); animation:bob 5s ease-in-out infinite; }
.gd-cloud1 { left:14%; top:14px; font-size:34px; opacity:.95; animation:drift 30s ease-in-out infinite alternate; }
.gd-cloud2 { right:26%; top:40px; font-size:26px; opacity:.9; animation:drift 38s ease-in-out infinite alternate-reverse; }
.gd-tree1 { left:3%; bottom:6px; font-size:78px; }
.gd-tree2 { right:3%; bottom:2px; font-size:64px; }
.gd-bush { left:24%; bottom:8px; font-size:40px; }
.gd-fl1 { left:9%; bottom:6px; font-size:26px; }
.gd-fl2 { left:34%; bottom:4px; font-size:28px; }
.gd-fl3 { right:30%; bottom:8px; font-size:24px; }
.gd-fl4 { right:14%; bottom:4px; font-size:26px; }
.gd-fl5 { left:48%; bottom:6px; font-size:22px; }
.gd-mush { right:40%; bottom:6px; font-size:24px; }
.gd-bfly1 { left:20%; top:34%; font-size:26px; animation:flit 6s ease-in-out infinite; }
.gd-bfly2 { right:22%; top:44%; font-size:22px; animation:flit 7s ease-in-out infinite reverse; }
@keyframes flit { 0%,100%{ transform:translate(0,0) rotate(-6deg);} 25%{ transform:translate(14px,-12px) rotate(6deg);} 50%{ transform:translate(4px,-20px) rotate(-4deg);} 75%{ transform:translate(-12px,-8px) rotate(8deg);} }

/* bottom room nav */
.roomnav { position:absolute; bottom:14px; left:50%; transform:translateX(-50%); z-index:30;
  display:flex; gap:6px; background:#fbe1ab; border:3px solid #f0c574; border-radius:999px; padding:8px 12px;
  box-shadow:var(--shadow); }
.roomnav .rb { display:flex; flex-direction:column; align-items:center; gap:2px; padding:4px 10px; border-radius:18px;
  font-size:24px; color:var(--brown); min-width:54px; }
.roomnav .rb.active { background:#fff3cf; }
.roomnav .rb small { font-size:10px; font-weight:800; }

/* action bar (legacy) */
.actionbar { position:absolute; bottom:96px; left:50%; transform:translateX(-50%); z-index:28;
  display:flex; gap:10px; background:rgba(255,255,255,.7); border-radius:20px; padding:8px 10px;
  box-shadow:var(--shadow); }
.act { display:flex; flex-direction:column; align-items:center; gap:2px; font-size:24px; color:var(--ink);
  background:var(--card); border-radius:14px; padding:6px 8px; box-shadow:0 3px 0 rgba(0,0,0,.1); min-width:48px; }
.act small { font-size:10px; font-weight:800; }
.act { transition:transform .1s, background .1s, outline .1s; }
.act:active { transform:translateY(2px); }
.act.drop-hot { background:#ffe08a; outline:3px solid var(--orange); transform:translateY(-5px) scale(1.08); }

/* pet drag */
.pet-ghost { position:fixed; transform:translate(-50%,-50%); z-index:80; pointer-events:none;
  border-radius:24px; opacity:.92; object-fit:cover; filter:drop-shadow(0 12px 12px rgba(0,0,0,.32)); }
.pet.dragging .sprite { opacity:.35; }

/* interactive scene objects */
.obj-layer { position:absolute; inset:0; z-index:7; pointer-events:none; }
.obj { position:absolute; display:flex; flex-direction:column; align-items:center; gap:3px; pointer-events:auto;
  cursor:pointer; transition:transform .1s; filter:drop-shadow(0 5px 5px rgba(0,0,0,.16)); }
.obj:active { transform:scale(.92); }
.obj .oe { line-height:1; }
.obj .ol { font-size:11px; background:#fffdf6; border:2px solid #efd9a8; border-radius:999px; padding:1px 9px;
  color:var(--brown); box-shadow:0 2px 3px rgba(0,0,0,.12); white-space:nowrap; }
.obj.moving { cursor:grabbing; opacity:.9; transform:scale(1.03); }
.obj.drop-hot { transform:translateY(-6px) scale(1.1); }
.obj.drop-hot .ol { background:#ffe08a; border-color:var(--orange); color:var(--orange-deep); }
.obj.drop-hot .oe { filter:drop-shadow(0 0 8px rgba(240,150,40,.8)); }

/* ---------- modal / sheet ---------- */
.scrim { position:absolute; inset:0; background:rgba(60,40,20,.45); z-index:50; display:flex;
  align-items:flex-end; justify-content:center; }
.scrim.center { align-items:center; }
.sheet { background:var(--cream); width:100%; max-width:520px; max-height:86%; border-radius:26px 26px 0 0;
  box-shadow:0 -6px 20px rgba(0,0,0,.25); display:flex; flex-direction:column; overflow:hidden;
  animation:up .22s ease; }
.dialog { background:var(--card); width:100%; max-width:380px; border-radius:24px; box-shadow:var(--shadow);
  padding:22px; margin:16px; animation:pop .2s ease; text-align:center; }
@keyframes up { from { transform:translateY(100%); } }
@keyframes pop { from { transform:scale(.85); opacity:0; } }
.sheet-head { display:flex; align-items:center; justify-content:space-between; padding:16px 18px 10px; }
.sheet-head h2 { font-size:22px; color:var(--ink); }
.sheet-body { padding:0 16px 20px; overflow-y:auto; }
.close-x { width:40px; height:40px; border-radius:12px; background:#fff; box-shadow:var(--shadow);
  font-size:22px; display:flex; align-items:center; justify-content:center; color:#9a8467; }

.tabs { display:flex; gap:8px; padding:4px 16px 12px; overflow-x:auto; }
.tab { white-space:nowrap; background:#f0dca8; color:var(--brown); border-radius:14px; padding:8px 14px; font-size:14px; }
.tab.active { background:var(--orange); color:#fff; box-shadow:0 3px 0 var(--orange-deep); }

.grid { display:grid; grid-template-columns:repeat(3,1fr); gap:12px; }
.card-item { background:var(--card); border-radius:18px; box-shadow:var(--shadow); padding:12px 8px;
  display:flex; flex-direction:column; align-items:center; gap:6px; text-align:center; }
.card-item .emoji { font-size:38px; }
.card-item .nm { font-size:13px; color:var(--ink); min-height:32px; display:flex; align-items:center; }
.card-item .price { display:flex; align-items:center; gap:4px; font-size:14px; color:var(--orange-deep); }
.card-item .qty { font-size:12px; color:#9a8467; }
.card-item.disabled { opacity:.5; }

.list-row { background:var(--card); border-radius:18px; box-shadow:var(--shadow); padding:14px 16px;
  display:flex; align-items:center; gap:12px; margin-bottom:12px; }
.list-row .ic { font-size:26px; }
.list-row .grow { flex:1; }
.list-row .ttl { font-size:16px; }
.list-row .sub { font-size:12px; color:#9a8467; font-weight:700; }
.pill-btn { background:var(--orange); color:#fff; border-radius:14px; padding:8px 14px; font-size:14px;
  box-shadow:0 3px 0 var(--orange-deep); }
.pill-btn.gray { background:#cdbb97; box-shadow:0 3px 0 #b09a73; }
.pill-btn:active { transform:translateY(2px); }

/* stat bars */
.statlist { display:flex; flex-direction:column; gap:10px; margin-top:6px; }
.stat { display:flex; align-items:center; gap:10px; }
.stat .lbl { width:96px; font-size:13px; }
.stat .bar { flex:1; height:14px; border-radius:999px; background:#eaddc0; overflow:hidden; }
.stat .bar i { display:block; height:100%; border-radius:999px; }
.stat .pct { width:38px; text-align:right; font-size:12px; }

/* ---------- history (timeline) ---------- */
.hist-day { display:inline-block; background:var(--cream-deep); color:var(--brown); font-size:13px; font-weight:900;
  border-radius:999px; padding:5px 15px; margin:16px 0 12px; box-shadow:0 2px 4px rgba(0,0,0,.14); }
.hist-list { position:relative; }
.hist-item { display:flex; gap:12px; position:relative; padding-bottom:14px; }
.hist-item::before { content:''; position:absolute; left:21px; top:48px; bottom:-2px; width:3px; border-radius:3px; background:#f0dca8; }
.hist-item:last-child::before { display:none; }
.hist-item .badge { width:46px; height:46px; border-radius:50%; flex:none; display:flex; align-items:center; justify-content:center;
  font-size:23px; background:#fff; border:3px solid var(--cream-deep); box-shadow:var(--shadow); z-index:1; }
.hist-item .body { flex:1; background:var(--card); border-radius:16px; box-shadow:var(--shadow); padding:10px 14px; }
.hist-item .meta { display:flex; justify-content:space-between; align-items:center; margin-bottom:3px; }
.hist-item .who { font-size:13px; color:var(--green-deep); font-weight:900; }
.hist-item .time { font-size:11px; color:#9a8467; font-weight:700; }
.hist-item .txt { font-size:15px; color:var(--ink); }

/* settings */
.setrow { background:var(--card); border-radius:18px; box-shadow:var(--shadow); padding:16px 18px;
  display:flex; align-items:center; gap:14px; margin-bottom:14px; font-size:17px; }
.setrow .ic { font-size:24px; }
.setrow .grow { flex:1; }
.toggle { width:54px; height:30px; border-radius:999px; background:#cdbb97; position:relative; transition:background .15s; }
.toggle.on { background:var(--green-deep); }
.toggle i { position:absolute; top:3px; left:3px; width:24px; height:24px; border-radius:50%; background:#fff; transition:left .15s; }
.toggle.on i { left:27px; }

/* toast */
#toast { position:absolute; left:50%; top:86px; transform:translateX(-50%); z-index:90;
  display:flex; flex-direction:column; gap:10px; align-items:center; width:92%; max-width:440px; pointer-events:none; }
.toast { display:flex; align-items:center; gap:12px; background:#fffdf8; border:2px solid #efdfb8; border-radius:18px;
  padding:11px 16px 11px 12px; box-shadow:0 10px 26px rgba(90,60,20,.22); width:100%;
  animation:toastin .3s cubic-bezier(.2,1.35,.5,1); }
.toast .ti { width:34px; height:34px; border-radius:12px; flex:none; display:flex; align-items:center; justify-content:center;
  font-size:19px; font-weight:900; color:#fff; background:#f2b632; box-shadow:0 3px 0 #d79a1c; }
.toast.good .ti { background:#5fb84c; box-shadow:0 3px 0 #47942f; }
.toast.bad .ti { background:#ec6a4a; box-shadow:0 3px 0 #c94e30; }
.toast .tt { font-size:14.5px; color:var(--ink); line-height:1.25; }
@keyframes toastin { from { transform:translateY(-14px) scale(.96); opacity:0; } }

/* ---------- scene decoration ---------- */
.floor { position:absolute; left:0; right:0; bottom:0; height:170px; z-index:3; }
.room-living .floor   { background:linear-gradient(#e7c69b,#dcb684); box-shadow:inset 0 8px 12px rgba(120,80,30,.12); }
.room-dining .floor   { background:linear-gradient(#f4d98c,#eccb74); }
.room-bathroom .floor { background:linear-gradient(#d5f0fb,#bfe6f7); }
.room-bedroom .floor  { background:linear-gradient(#d3d9f2,#c3cbec); }
.room-garden .floor   { background:linear-gradient(#a6dc82,#8ecb6c); height:220px; }
.scene-decor { position:absolute; inset:0; z-index:4; pointer-events:none; overflow:hidden; }
.prop { position:absolute; line-height:1; filter:drop-shadow(0 5px 5px rgba(0,0,0,.14)); }
.rug { position:absolute; left:50%; bottom:150px; transform:translateX(-50%); width:min(80%,440px); height:170px;
  background:radial-gradient(ellipse at center, rgba(255,255,255,.6), rgba(255,255,255,0) 68%); z-index:6; pointer-events:none; }
.cloud { position:absolute; line-height:1; opacity:.95; animation:drift 34s ease-in-out infinite alternate; }
@keyframes drift { from { transform:translateX(-40px); } to { transform:translateX(50px); } }

/* roulette */
.roulette-grid { display:grid; grid-template-columns:repeat(5,1fr); gap:10px; margin:16px 0; }
.rslot { aspect-ratio:1; border-radius:16px; background:var(--card); box-shadow:var(--shadow);
  display:flex; align-items:center; justify-content:center; font-size:30px; }
.rslot.win { background:#ffe08a; outline:4px solid var(--orange); }
.rslot.lose { opacity:.4; }

.rps-choices { display:flex; gap:14px; justify-content:center; margin:18px 0; }
.rps-choices .c { font-size:46px; width:84px; height:84px; border-radius:20px; background:var(--card);
  box-shadow:var(--shadow); display:flex; align-items:center; justify-content:center; }
.rps-choices .c:active { transform:translateY(2px); }

.center-msg { text-align:center; padding:30px 10px; color:#9a8467; font-size:16px; }
.big-cta { width:100%; }

/* ---------- town (buildings / menus) ---------- */
.town-bg { position:absolute; inset:0; background:linear-gradient(#bfe5f5 0 52%, #a9dc86 52% 100%); }
.town-title { position:absolute; top:80px; left:0; right:0; text-align:center; z-index:20;
  font-size:22px; color:#fff; text-shadow:0 2px 5px rgba(0,0,0,.3); }
.town-grid { position:absolute; top:120px; bottom:14px; left:0; right:0; overflow-y:auto; z-index:10;
  display:grid; grid-template-columns:repeat(3,1fr); gap:22px 10px; padding:16px 16px 30px; align-content:start; }
.building { display:flex; flex-direction:column; align-items:center; cursor:pointer; transition:transform .1s; }
.building:active { transform:scale(.93); }
.building .broof { width:78px; height:20px; border-radius:11px 11px 4px 4px; box-shadow:0 2px 3px rgba(0,0,0,.25); }
.building .bbody { width:72px; height:58px; background:linear-gradient(#fff7e6,#ffe4b8); border:3px solid #efc978;
  border-top:none; border-radius:0 0 12px 12px; display:flex; align-items:center; justify-content:center; box-shadow:var(--shadow); }
.building .bic { font-size:32px; }
.building .blbl { margin-top:7px; font-size:12px; font-weight:900; color:var(--brown); background:#fff; border:2px solid #efc978;
  border-radius:999px; padding:2px 12px; box-shadow:0 2px 3px rgba(0,0,0,.14); white-space:nowrap; }

/* ---------- mobile / narrow screens ---------- */
@media (max-width: 480px) {
  .profile-chip { padding:4px 12px 4px 5px; gap:7px; }
  .profile-chip .avatar { width:40px; height:40px; }
  .profile-chip .pname { max-width:78px; font-size:13px; }
  .coinrow #coins { font-size:16px; }
  .icon-btn { width:44px; height:44px; font-size:21px; }
  .toolbar { right:6px; top:94px; gap:9px; padding:8px 6px; }
  .tool { width:44px; height:44px; font-size:22px; }
  .home-banner { top:70px; padding:6px 12px 8px; }
  .roomnav { gap:3px; padding:7px 8px; }
  .roomnav .rb { min-width:44px; padding:4px 6px; font-size:21px; }
  .roomnav .rb small { font-size:9px; }
  .pet .tag { font-size:14px; }
  .stage { top:150px; }
}
