/* PET CORNER — cozy cream theme (Cozy Cove series) */
* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; overflow: hidden; }
body {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: #fff6ec; color: #6b4f3f;
  user-select: none; -webkit-user-select: none; touch-action: manipulation;
}
#stage { position: fixed; inset: 0; }
#game { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }

/* ---------- sprites (CSS sheet slices) ---------- */
.spr-i { background-image: url('../assets/items-ui.webp');  background-size: 600% 600%; }
.spr-r { background-image: url('../assets/pets-rare.webp'); background-size: 400% 400%; }
.spr-p { background-image: url('../assets/pets-core.webp'); background-size: 600% 600%; }
.spr-e { background-image: url('../assets/pets-extra.webp');background-size: 600% 400%; }
.spr-i, .spr-p { background-position: calc(var(--c, 0) * 20%) calc(var(--r, 0) * 20%); }
.spr-r { background-position: calc(var(--c, 0) * 33.334%) calc(var(--r, 0) * 33.334%); }
.spr-e { background-position: calc(var(--c, 0) * 20%) calc(var(--r, 0) * 33.334%); }
.ic { display: inline-block; width: 22px; height: 22px; vertical-align: -5px; }

/* ---------- HUD ---------- */
#hud {
  position: absolute; top: 0; left: 0; right: 0; z-index: 20;
  display: flex; align-items: center; gap: 8px;
  padding: calc(8px + env(safe-area-inset-top)) 12px 8px;
  pointer-events: none;
}
#hud > * { pointer-events: auto; }
.hud-home {
  width: 38px; height: 38px; border-radius: 12px; display: flex; align-items: center; justify-content: center;
  background: #fffdf8; border: 2px solid #f0dcc8; color: #b08968; text-decoration: none; font-size: 19px;
  box-shadow: 0 3px 0 #f0dcc8;
}
.pill {
  background: #fffdf8; border: 2px solid #f0dcc8; border-radius: 999px;
  padding: 5px 12px 5px 8px; font-size: 15px; box-shadow: 0 3px 0 #f0dcc8;
  display: flex; align-items: center; gap: 5px;
}
.pill b { color: #a06a3f; }
.hud-spacer { flex: 1; }
.hud-btn {
  position: relative; width: 38px; height: 38px; border-radius: 12px; border: 2px solid #f0dcc8;
  background: #fffdf8; font-size: 17px; cursor: pointer; box-shadow: 0 3px 0 #f0dcc8; color: #a06a3f;
}
.hud-btn:active { transform: translateY(2px); box-shadow: 0 1px 0 #f0dcc8; }
.dot { position: absolute; top: -3px; right: -3px; width: 12px; height: 12px; border-radius: 50%;
  background: #f45b7a; border: 2px solid #fff; display: none; }
.dot.on { display: block; }

#mg-quit { position: absolute; top: calc(10px + env(safe-area-inset-top)); left: 12px; z-index: 30; display: none; }
#mg-quit.show { display: block; }

/* ---------- overlays & panels ---------- */
.ov {
  position: absolute; inset: 0; z-index: 40; display: none;
  align-items: center; justify-content: center;
  background: rgba(107, 79, 63, 0.35); backdrop-filter: blur(3px);
  padding: 14px;
}
.ov.show { display: flex; }
.pnl {
  position: relative; width: min(480px, 96vw); max-height: min(86vh, 700px); overflow-y: auto;
  background: #fffdf8; border: 2px solid #f3e0cd; border-radius: 22px;
  padding: 20px 18px; box-shadow: 0 16px 40px rgba(150, 100, 60, 0.25);
  scrollbar-width: thin;
}
.pnl.center { text-align: center; }
.pnl .x {
  position: absolute; top: 10px; right: 10px; width: 32px; height: 32px; border-radius: 50%;
  border: 2px solid #f0dcc8; background: #fff6ec; color: #b08968; font-size: 18px; cursor: pointer; line-height: 1;
}
.pnl-title { font-size: 21px; color: #8a5a3b; margin-bottom: 10px; letter-spacing: 0.5px; }
.soft { color: #b39179; font-size: 13px; }
.logo { font-size: 34px; letter-spacing: 3px; color: #8a5a3b; margin: 8px 0 2px; }
.logo span { color: #f78fb3; }
.tagline { color: #c99a72; margin-bottom: 16px; font-size: 14px; }

/* ---------- buttons ---------- */
.b-pri, .b-sec {
  border: none; border-radius: 14px; padding: 11px 20px; font-size: 15px; font-weight: 700;
  cursor: pointer; letter-spacing: 0.4px;
}
.b-pri { background: linear-gradient(180deg, #fda7c2, #f78fb3); color: #fff; box-shadow: 0 4px 0 #e0709a; }
.b-pri:active { transform: translateY(2px); box-shadow: 0 2px 0 #e0709a; }
.b-pri:disabled { filter: grayscale(0.7); opacity: 0.6; box-shadow: none; cursor: default; }
.b-sec { background: #fff6ec; color: #a06a3f; border: 2px solid #f0dcc8; box-shadow: 0 3px 0 #f0dcc8; }
.b-sec:active { transform: translateY(2px); box-shadow: 0 1px 0 #f0dcc8; }
.b-sec:disabled { opacity: 0.5; box-shadow: none; cursor: default; }
.b-pri.hero { font-size: 18px; padding: 14px 34px; margin: 6px 0 14px; }
.small { padding: 7px 12px; font-size: 13px; }
.row { display: flex; gap: 10px; justify-content: center; margin-top: 12px; flex-wrap: wrap; }

.howto { list-style: none; text-align: left; margin: 4px auto 12px; max-width: 330px; }
.howto li { display: flex; gap: 9px; align-items: flex-start; font-size: 13.5px; color: #9b7554; padding: 4px 0; }
.howto i { font-style: normal; }
.meta-row { margin-top: 6px; font-size: 13px; }
.meta-dot { margin: 0 7px; color: #d8bda0; }
.text-link { color: #e786ab; text-decoration: none; }

/* ---------- pet panel ---------- */
.pet-head { display: flex; gap: 14px; align-items: center; }
.portrait { width: 84px; height: 84px; border-radius: 20px; background-color: #fff1e0;
  border: 2px solid #f3e0cd; flex-shrink: 0; }
.portrait.sm { width: 52px; height: 52px; margin: 0 auto 2px; border-radius: 14px; }
.pet-name { font-size: 20px; color: #8a5a3b; font-weight: 800; }
.lvchip { display: inline-block; background: #ffe9f1; color: #e0709a; border-radius: 999px;
  padding: 2px 10px; font-size: 12px; font-weight: 700; margin-left: 6px; }
.bond-outer { margin-top: 6px; }
.bars { margin: 14px 0 10px; display: grid; gap: 8px; }
.bar-row { display: flex; align-items: center; gap: 8px; }
.bar-row .ic { width: 26px; height: 26px; }
.bar { flex: 1; height: 14px; border-radius: 999px; background: #f6e7d5; overflow: hidden; }
.bar .fill { height: 100%; border-radius: 999px; background: linear-gradient(90deg, #ffc9dd, #f78fb3); transition: width 0.3s; }
.bar .fill.low { background: linear-gradient(90deg, #ffd9a8, #f7a35c); }
.bar-v { width: 38px; text-align: right; font-size: 12px; color: #b39179; }
.act-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 10px 0; }
.picker { display: flex; gap: 8px; flex-wrap: wrap; margin: 10px 0; }
.pick {
  width: 64px; border: 2px solid #f0dcc8; border-radius: 14px; background: #fff6ec;
  padding: 6px 4px 4px; cursor: pointer; text-align: center;
}
.pick .ic { width: 34px; height: 34px; }
.pick small { display: block; font-size: 10.5px; color: #b39179; }
.pick:disabled { opacity: 0.4; cursor: default; }
.pick.sel { border-color: #f78fb3; background: #ffe9f1; }
.sect { border-top: 2px dashed #f3e0cd; margin-top: 12px; padding-top: 10px; }
.sect h3 { font-size: 14px; color: #a06a3f; margin-bottom: 6px; }
.nav-pets { position: absolute; top: 46%; width: 34px; height: 34px; border-radius: 50%;
  border: 2px solid #f0dcc8; background: #fff6ec; color: #b08968; cursor: pointer; font-size: 15px; }
.nav-prev { left: -6px; } .nav-next { right: -6px; }

/* ---------- shop / dex ---------- */
.tabs { display: flex; gap: 6px; margin-bottom: 12px; flex-wrap: wrap; }
.tab {
  border: 2px solid #f0dcc8; background: #fff6ec; color: #b08968; border-radius: 999px;
  padding: 6px 14px; font-size: 13px; font-weight: 700; cursor: pointer;
}
.tab.on { background: #f78fb3; border-color: #f78fb3; color: #fff; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 10px; }
.card-i {
  border: 2px solid #f0dcc8; border-radius: 16px; background: #fff; padding: 10px 6px 8px;
  text-align: center; position: relative;
}
.card-i .ic { width: 52px; height: 52px; }
.card-i .nm { font-size: 12px; font-weight: 700; color: #8a5a3b; margin: 3px 0 5px; min-height: 15px; }
.card-i .b-pri, .card-i .b-sec { width: 100%; padding: 6px 4px; font-size: 12px; border-radius: 10px; }
.card-i.locked { opacity: 0.92; }
.card-i .qty { position: absolute; top: 6px; right: 8px; font-size: 11px; color: #c99a72; font-weight: 700; }
.card-i.dim .ic { filter: grayscale(1) opacity(0.45); }
.owned-tag { font-size: 11px; color: #7dbb7d; font-weight: 700; }

/* ---------- tasks ---------- */
.task { display: flex; align-items: center; gap: 10px; border: 2px solid #f0dcc8;
  border-radius: 14px; padding: 10px 12px; margin-bottom: 8px; background: #fff; }
.task .tx { flex: 1; font-size: 13.5px; color: #8a5a3b; }
.task .prog { font-size: 12px; color: #b39179; }

/* ---------- result / boards ---------- */
.final-score { font-size: 44px; font-weight: 900; color: #f78fb3; margin: 4px 0; }
.submit-row { display: flex; gap: 8px; justify-content: center; margin: 12px 0 4px; }
.text-input {
  border: 2px solid #f0dcc8; border-radius: 12px; padding: 9px 12px; font-size: 14px;
  background: #fff; color: #6b4f3f; width: 170px; outline: none;
}
.board-card { border: 2px solid #f3e0cd; border-radius: 16px; padding: 10px 12px; margin: 12px 0 2px; background: #fff; }
.card-title { font-size: 13px; font-weight: 800; color: #a06a3f; margin-bottom: 6px; letter-spacing: 0.5px; }
.board-list { text-align: left; }
.board-row { display: flex; align-items: center; gap: 8px; padding: 5px 0; border-bottom: 1px dashed #f3e0cd; }
.board-row:last-child { border-bottom: none; }
.board-rank { width: 30px; color: #e0709a; font-weight: 800; font-size: 13px; }
.board-name { font-size: 13px; font-weight: 700; color: #8a5a3b; }
.board-meta { font-size: 11px; color: #c9a988; }
.board-score { margin-left: auto; font-weight: 800; color: #a06a3f; font-size: 14px; }
.board-empty { color: #c9a988; font-size: 12.5px; padding: 8px 0; }

/* ---------- toasts ---------- */
#toasts { position: absolute; bottom: 24px; left: 0; right: 0; z-index: 60;
  display: flex; flex-direction: column; align-items: center; gap: 6px; pointer-events: none; }
.toast {
  background: rgba(255, 253, 248, 0.96); border: 2px solid #f3e0cd; color: #8a5a3b;
  border-radius: 999px; padding: 8px 18px; font-size: 13.5px; font-weight: 700;
  box-shadow: 0 6px 18px rgba(150, 100, 60, 0.18);
  animation: toast-in 0.25s ease, toast-out 0.4s ease 2.4s forwards;
}
@keyframes toast-in { from { transform: translateY(14px); opacity: 0; } }
@keyframes toast-out { to { transform: translateY(8px); opacity: 0; } }

@media (max-width: 520px) {
  .pill { font-size: 13px; padding: 4px 9px 4px 6px; }
  .pnl { padding: 16px 12px; }
  .act-grid { grid-template-columns: repeat(2, 1fr); }
}
