* {
  margin: 0; padding: 0; box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
  /* Dragging the bowl/toy must never start a native text selection of the UI. */
  user-select: none; -webkit-user-select: none; -moz-user-select: none;
  -webkit-touch-callout: none; -webkit-user-drag: none;
}

html, body {
  height: 100%;
  background: #2a1a0e;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  font-family: 'Nunito', 'Mali', 'Segoe UI', sans-serif;
}

/* ─── GAME WRAPPER ─── */
/* Desktop mode: the 390×700 design frame is scaled up to fill the viewport via
   --mct-scale (set by JS). The map, stations, HUD and popups all grow with it;
   only the cats are counter-scaled (in Phaser) so they keep their size. */
#game-wrap {
  position: relative;
  width: 390px;
  height: 700px;
  overflow: hidden;
  border-radius: 20px;
  box-shadow: 0 12px 48px rgba(0,0,0,0.7);
  transform: scale(var(--mct-scale, 1));
  transform-origin: top left;
}

#game-wrap canvas:not(.rive-cat) {
  position: absolute !important;
  top: 0; left: 0;
  width: 390px !important;
  height: 700px !important;
  border-radius: 20px;
  touch-action: none;   /* drags don't scroll/select on the canvas */
}

/* ─── UI OVERLAY ─── */
#ui {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 10;
  border-radius: 20px;
  overflow: hidden;
}
#ui button, #ui nav, #ui .left-panel, #ui .right-panel,
#ui .event-banner, #ui .btm-chrome {
  pointer-events: auto;
}
/* The cat popup takes input ONLY while it's open. It used to be listed above,
   and `#ui #cat-popup` (two IDs) outranked the base `#cat-popup {pointer-events:
   none}`, so the popup kept swallowing touches while sitting invisible
   (opacity:0) right on top of the churu/toy stations — which is why those two
   could never be dragged on a phone while the bowl beside them could.
   (owner 2026-07-24: "ลากไปหาแมวไม่ได้บนมือถือ/iPad") */
#ui #cat-popup { pointer-events: none; }
#ui #cat-popup.show { pointer-events: auto; }
/* Steal-mode picker + its backdrop: the option rows are <div>s (not buttons),
   so they need pointer-events explicitly or clicks fall through. (#pvp-challenge
   manages its own pointer-events via .open, so it's intentionally excluded.) */
#ui #sp-overlay, #ui #steal-picker, #ui #steal-picker .sp-option,
#ui #steal-warn-banner, #ui #steal-warn-banner .swb-cancel {
  pointer-events: auto;
}
/* Map picker overlay + panel */
#ui #map-overlay, #ui #map-panel, #ui .map-close, #ui .map-use {
  pointer-events: auto;
}
/* Cat Market overlay + its interactive children */
#ui #cm-overlay.show, #ui #cat-market.show,
#ui #cat-market .cm-buy, #ui #cat-market .cm-close {
  pointer-events: auto;
}
/* Streak calendar overlay + panel */
#ui #streak-overlay, #ui #streak-panel, #ui .sk-close {
  pointer-events: auto;
}
/* Mission+Event combined panel */
#ui #me-overlay, #ui #me-panel, #ui .me-tab, #ui .me-body,
#ui .mc-claim, #ui .me-tabs, #ui #me-nav-btn {
  pointer-events: auto;
}
/* Starter pick + cat naming + owner naming modals (buttons are covered by
   the #ui button rule; the panel shells + text input need it explicitly) */
#ui #starter-panel, #ui #namecat-panel, #ui #owner-panel, #ui .nc-input {
  pointer-events: auto;
}
/* Neighbor chat input (the send button is covered by the #ui button rule) */
#ui #chat-input-row, #ui #chat-input {
  pointer-events: auto;
}
/* Panel SHELLS need pointer-events too — without it a click on the panel's
   body falls through to the overlay behind, which closes the popup. */
#ui .settings-panel, #ui #neighbor-panel {
  pointer-events: auto;
}
/* CRITICAL: containers hidden via opacity (not display:none) stay in the
   hit-test tree, and the `#ui button` catch-all re-enables their CHILD
   buttons — leaving invisible tap-catchers floating over the game. This
   swallowed the 📖 guide button on phones (closed PvP panel's buttons) and
   closed the PopCat battle mid-countdown (hidden result panel's ปิด button).
   Force the whole hidden subtree tap-transparent. */
#ui #pvp-challenge:not(.open), #ui #pvp-challenge:not(.open) *,
#ui .pvp-result:not(.show), #ui .pvp-result:not(.show) *,
#ui #cat-market:not(.show), #ui #cat-market:not(.show) * {
  pointer-events: none !important;
}

/* ══════════════════════════════════
   TOP BAR  — height 46px
══════════════════════════════════ */
.top-bar {
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 46px;
  background: linear-gradient(to bottom, rgba(255,246,210,0.97) 0%, rgba(244,226,162,0.96) 100%);
  border-bottom: 2px solid #c89e2c;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 6px;
  gap: 1px;
  backdrop-filter: blur(8px);
  box-shadow: 0 3px 12px rgba(120,72,0,0.22);
  overflow: hidden;
}

/* Level block */
.level-block { display: flex; align-items: center; gap: 5px; flex-shrink: 0; }

.level-circle {
  width: 36px; height: 36px;
  background: linear-gradient(145deg, #52cc56, #208828);
  border-radius: 50%;
  border: 3px solid #7edc80;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  box-shadow: 0 3px 8px rgba(16,80,16,0.42), inset 0 1px 0 rgba(255,255,255,0.28);
  line-height: 1; flex-shrink: 0;
}
.lv-paw { font-size: 7px; margin-bottom: 0; }
.lv-num { font-size: 14px; font-weight: 900; color: #fff; text-shadow: 0 1px 3px rgba(0,0,0,0.45); line-height: 1; }

.level-info { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.game-title { font-size: 9.5px; font-weight: 900; color: #5c3006; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 92px; letter-spacing: 0.3px; }
.exp-row { display: flex; align-items: center; gap: 3px; }
.exp-track { width: 38px; height: 6px; background: #d8b870; border-radius: 4px; overflow: hidden; border: 1px solid #a88030; flex-shrink: 0; }
.exp-fill { height: 100%; background: linear-gradient(to right, #f4c020, #d89010); border-radius: 4px; box-shadow: inset 0 1px 0 rgba(255,255,200,0.4); }
.exp-txt { font-size: 7px; color: #7a5010; white-space: nowrap; font-weight: 700; }

/* Currencies */
.cur-group { display: flex; align-items: center; gap: 3px; flex-shrink: 0; }

.cur-pill {
  display: flex; align-items: center; gap: 2px;
  padding: 2px 5px 2px 4px;
  border-radius: 20px;
  background: rgba(255,248,222,0.97);
  border: 1.5px solid #c09828;
  box-shadow: 0 1px 4px rgba(120,72,0,0.16), inset 0 1px 0 rgba(255,255,255,0.55);
}
.cur-pill.heart { border-color: #d86080; background: rgba(255,238,244,0.97); }
.cur-pill.gem   { border-color: #9068cc; background: rgba(244,238,255,0.97); }

.ci { font-size: 12px; line-height: 1; }
.cv { color: #422406; font-size: 10px; font-weight: 900; min-width: 20px; text-align: center; }

.cp {
  width: 14px; height: 14px;
  border-radius: 50%;
  background: linear-gradient(145deg, #f0a028, #c87010);
  border: 1.5px solid #985008;
  color: #fff;
  font-size: 11px; font-weight: 900;
  line-height: 1;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  padding: 0;
  box-shadow: 0 1px 3px rgba(0,0,0,0.22);
}
.cur-pill.heart .cp { background: linear-gradient(145deg, #f05070, #c02848); border-color: #901630; }
.cur-pill.gem   .cp { background: linear-gradient(145deg, #9060d0, #6030a8); border-color: #401890; }

.menu-btn {
  position: relative; flex-shrink: 0;
  width: 20px; height: 20px; border-radius: 50%;
  background: linear-gradient(145deg, #fff6d8, #f0dca0);
  border: 1.5px solid #c89e2c;
  font-size: 11px; line-height: 1; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 2px 5px rgba(120,72,0,0.22);
}
.menu-btn:active { transform: scale(0.92); }
.bell-dot {
  position: absolute; top: -1px; right: -1px;
  width: 7px; height: 7px; border-radius: 50%;
  background: #e64444; border: 1.5px solid #fff6d8;
}
/* Currency "+" shortcuts are redundant with the Shop button (right panel) —
   keep them out of the way on the tight top bar. */
#ui .cp { display: none; }

/* ══════════════════════════════════
   LEFT PANEL  — narrower + lower
══════════════════════════════════ */
.left-panel {
  position: absolute;
  top: 52px; left: 4px;
  display: flex; flex-direction: column; gap: 5px;
}

.lbtn {
  display: flex; align-items: center; gap: 4px;
  background: linear-gradient(145deg, #fffbf2, #f8e8c4);
  border: 2px solid #d8b048;
  border-radius: 14px;
  padding: 4px 7px;
  cursor: pointer;
  width: 66px;
  box-shadow: 0 3px 8px rgba(110,70,8,0.22), inset 0 1px 0 rgba(255,255,255,0.65);
  font-family: 'Nunito', 'Mali', sans-serif;
  transition: transform 0.1s;
}
.lbtn:active { transform: scale(0.93); }
.lbtn.starter { background: linear-gradient(145deg, #fff8c0, #ffe478); border-color: #d89810; box-shadow: 0 3px 8px rgba(180,140,0,0.28), inset 0 1px 0 rgba(255,255,255,0.65); }
.lbtn.daily   { background: linear-gradient(145deg, #eef8ea, #cceac6); border-color: #68b860; }
.lbtn.done    { background: linear-gradient(145deg, #d4f0d4, #b0dcb0); border-color: #48a048; }

.li { font-size: 18px; line-height: 1; flex-shrink: 0; }
.lb { display: flex; flex-direction: column; align-items: flex-start; }
.lt { font-size: 8px; font-weight: 900; color: #7a4518; line-height: 1.3; }
.ltimer { font-size: 7px; color: #e05010; font-weight: 700; margin-top: 1px; }
.lcheck { font-size: 13px; color: #4a9a4a; font-weight: 900; line-height: 1; }

/* ══════════════════════════════════
   EVENT BANNER  — compact pill
══════════════════════════════════ */
.event-banner {
  position: absolute;
  top: 48px;
  left: 50%; transform: translateX(-50%);
  background: linear-gradient(135deg, rgba(255,250,228,0.93), rgba(248,234,190,0.93));
  border: 1.5px solid #e8c868;
  border-radius: 20px;
  padding: 4px 10px 4px 6px;
  display: flex; align-items: center; gap: 4px;
  box-shadow: 0 2px 8px rgba(140,90,10,0.18);
  cursor: pointer;
  white-space: nowrap;
  backdrop-filter: blur(4px);
}
.event-banner:active { transform: translateX(-50%) scale(0.97); }

.ev-mascot { font-size: 18px; line-height: 1; }
.ev-name   { font-size: 9.5px; font-weight: 900; color: #8a3e12; }
.ev-timer  { font-size: 8.5px; font-weight: 700; color: #b05818; }

/* ══════════════════════════════════
   RIGHT PANEL  — narrower buttons
══════════════════════════════════ */
.right-panel {
  position: absolute;
  top: 100px; right: 4px;
  display: flex; flex-direction: column; gap: 5px;
}

.rbtn {
  width: 48px;
  background: linear-gradient(160deg, #fffef8, #f8e8c8);
  border: 2px solid #c8983c;
  border-radius: 14px;
  padding: 6px 3px 5px;
  cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  box-shadow: 0 3px 8px rgba(110,70,8,0.22), inset 0 1px 0 rgba(255,255,255,0.70);
  position: relative;
  font-family: 'Nunito', 'Mali', sans-serif;
  transition: transform 0.1s;
}
.rbtn:active { transform: scale(0.91); }

.ri { font-size: 18px; line-height: 1; }
.rl { font-size: 7.5px; font-weight: 800; color: #6a3e14; }

.badge-btn .bdot {
  position: absolute;
  top: -4px; right: -4px;
  width: 14px; height: 14px;
  background: #e83030;
  border: 1.5px solid #fff;
  border-radius: 50%;
  font-size: 8px; font-weight: 900; color: #fff;
  display: flex; align-items: center; justify-content: center;
}

/* ══════════════════════════════════
   CAT ACTION POPUP
══════════════════════════════════ */
#cat-popup {
  position: absolute;
  bottom: 76px; left: 50%; transform: translateX(-50%) translateY(16px);
  background: linear-gradient(145deg, #fffef8, #fef4d0);
  border: 2.5px solid #d4a82a;
  border-radius: 20px;
  padding: 10px 14px 10px;
  display: flex; flex-direction: column; align-items: center; gap: 7px;
  box-shadow: 0 8px 24px rgba(110,70,8,0.30), 0 2px 6px rgba(0,0,0,0.12);
  min-width: 210px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.22s, transform 0.22s cubic-bezier(0.34,1.56,0.64,1);
}
#cat-popup.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
  pointer-events: auto;
}

.pop-close {
  position: absolute; top: 6px; right: 8px;
  width: 22px; height: 22px;
  background: rgba(0,0,0,0.08); border: none;
  border-radius: 50%; font-size: 10px; color: #777;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  transition: background 0.1s;
}
.pop-close:hover { background: rgba(0,0,0,0.15); }

.pop-name { font-size: 13px; font-weight: 900; color: #6a3008; letter-spacing: 0.2px; }

.pop-happiness { display: flex; align-items: center; gap: 6px; width: 100%; }
.pop-hap-label { font-size: 9px; color: #8a5818; font-weight: 800; white-space: nowrap; }
.pop-hap-bar { flex: 1; height: 8px; background: #e4d0a0; border-radius: 5px; overflow: hidden; border: 1px solid #c0a040; box-shadow: inset 0 1px 3px rgba(0,0,0,0.12); }
.pop-hap-fill { height: 100%; border-radius: 5px; background: linear-gradient(to right, #52cc56, #38aa3c); transition: width 0.4s; box-shadow: inset 0 1px 0 rgba(255,255,255,0.35); }
.pop-hap-fill.critical { animation: hap-pulse 0.8s ease-in-out infinite; }
@keyframes hap-pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.4; } }
.pop-hap-val { font-size: 9px; font-weight: 900; color: #4a2808; white-space: nowrap; }
.pop-xp-row { display: flex; align-items: center; gap: 5px; margin-top: 5px; }
.pop-xp-label { font-size: 9px; color: #7040aa; font-weight: 800; white-space: nowrap; }
.pop-xp-bar { flex: 1; height: 6px; background: #e8d8f8; border-radius: 4px; overflow: hidden; border: 1px solid #c0a0e0; }
.pop-xp-fill { height: 100%; border-radius: 4px; background: linear-gradient(to right, #a060e0, #c080ff); transition: width 0.4s; }
.pop-xp-val { font-size: 9px; font-weight: 900; color: #5a3088; white-space: nowrap; }

.pop-actions { display: flex; gap: 7px; }

#pop-care-hint {
  display: flex; flex-direction: column; gap: 5px;
  width: 100%; margin: 2px 0 4px;
}
#pop-care-hint .care-row {
  background: #fff7e8;
  border: 1.5px solid #e6d6b0;
  border-radius: 10px;
  padding: 6px 10px;
  font-size: 12px;
  color: #5a4634;
  text-align: left;
}
#pop-care-hint .care-row b { color: #b5641a; }

.act {
  width: 56px; height: 56px;
  border-radius: 16px;
  border: 2px solid;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 3px;
  cursor: pointer; font-family: 'Nunito', 'Mali', sans-serif;
  transition: transform 0.1s, box-shadow 0.1s;
  box-shadow: 0 3px 7px rgba(0,0,0,0.13);
}
.act:active { transform: scale(0.88); }
.ai { font-size: 22px; line-height: 1; }
.al { font-size: 8.5px; font-weight: 900; line-height: 1; }

.act.feed      { background: linear-gradient(145deg, #f0fef0, #ccf2cc); border-color: #58c058; color: #1a6a1a; box-shadow: 0 3px 7px rgba(60,160,60,0.22); }
.act.play      { background: linear-gradient(145deg, #f4eeff, #e4ccf8); border-color: #9868d0; color: #5820a0; box-shadow: 0 3px 7px rgba(120,60,200,0.22); }
.act.clean     { background: linear-gradient(145deg, #e8f6ff, #c8e8f8); border-color: #4898d8; color: #0d4888; box-shadow: 0 3px 7px rgba(40,100,200,0.22); }
.act.bowl-prio { background: linear-gradient(145deg, #fff8e8, #ffecc0); border-color: #d4900a; color: #7a4a00; box-shadow: 0 3px 7px rgba(200,140,20,0.22); }

#bowl-prio-row { justify-content: center; margin-top: 4px; }

.pop-resources {
  font-size: 9.5px; font-weight: 700; color: #8a5818;
  background: rgba(210,168,68,0.14);
  padding: 3px 10px; border-radius: 9px;
  border: 1px solid rgba(190,148,48,0.30);
}

/* ══════════════════════════════════
   BOTTOM CHROME  — compact strip
══════════════════════════════════ */
.btm-chrome {
  position: absolute;
  bottom: 58px; left: 0; right: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 8px;
}

.cam-btn {
  width: 38px; height: 38px;
  background: rgba(255,252,235,0.92);
  border: 2px solid #c89838;
  border-radius: 50%;
  font-size: 18px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 3px 10px rgba(0,0,0,0.22), inset 0 1px 0 rgba(255,255,255,0.7);
  transition: transform 0.1s;
}
.cam-btn:active { transform: scale(0.9); }

.clean-btn {
  width: 38px; height: 38px;
  background: rgba(232,250,228,0.95);
  border: 2px solid #6aaa4a;
  border-radius: 50%;
  font-size: 18px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 3px 10px rgba(0,0,0,0.22), inset 0 1px 0 rgba(255,255,255,0.7);
  transition: transform 0.1s;
  pointer-events: auto;
}
.clean-btn:active { transform: scale(0.9); }


.fastfeed-btn {
  background: linear-gradient(145deg, #fffcf0, #f8e8b8);
  border: 2px solid #d0a030;
  border-radius: 14px;
  padding: 4px 7px;
  cursor: pointer;
  display: flex; align-items: center; gap: 4px;
  box-shadow: 0 3px 10px rgba(110,72,8,0.22), inset 0 1px 0 rgba(255,255,255,0.6);
  font-family: 'Nunito', 'Mali', sans-serif;
  transition: transform 0.1s;
}
.fastfeed-btn:active { transform: scale(0.94); }
.ff-face  { font-size: 22px; line-height: 1; }
.ff-label { font-size: 8px; font-weight: 700; color: #6a3610; line-height: 1.2; }
.ff-timer { font-size: 9px; font-weight: 900; color: #207818; line-height: 1.2; }
.ff-plus  {
  width: 16px; height: 16px;
  background: linear-gradient(145deg, #42b846, #268a2a);
  border-radius: 50%;
  font-size: 12px; font-weight: 900; color: #fff;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 1px 4px rgba(0,0,0,0.22);
}

/* ══════════════════════════════════
   BOTTOM NAV  — height 58px
══════════════════════════════════ */
.bottom-nav {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 58px;
  background: linear-gradient(to top, #fcecc4, #fef6e0);
  border-top: 2.5px solid #d4a82a;
  display: flex;
  align-items: center;
  justify-content: space-around;
  padding: 0 4px 3px;
  box-shadow: 0 -3px 12px rgba(120,80,10,0.18);
}

.ntab {
  flex: 1;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 1px;
  padding: 3px 2px;
  border: none; background: transparent;
  border-radius: 13px;
  cursor: pointer;
  position: relative;
  font-family: 'Nunito', 'Mali', sans-serif;
  transition: transform 0.1s;
}
.ntab:active { transform: scale(0.9); }

.ntab.active {
  background: linear-gradient(145deg, #94d858, #5aac28);
  box-shadow: 0 3px 9px rgba(60,130,10,0.36);
}
.ntab.active .nl { color: #fff; text-shadow: 0 1px 2px rgba(0,0,0,0.25); }

.ni { font-size: 18px; line-height: 1; }
.nl { font-size: 8px; font-weight: 800; color: #7a4010; line-height: 1; }
.ntab.active .ni { filter: drop-shadow(0 1px 2px rgba(0,0,0,0.25)); }

.nbadge {
  position: absolute; top: 1px; right: 8px;
  background: #e83030; color: #fff;
  border: 1.5px solid #fff;
  border-radius: 50%;
  width: 13px; height: 13px;
  font-size: 8px; font-weight: 900;
  display: flex; align-items: center; justify-content: center;
}

/* ══════════════════════════════════
   VISIT BANNER
══════════════════════════════════ */
#visit-banner {
  position: absolute;
  top: 48px; left: 50%;
  transform: translateX(-50%) translateY(-70px);
  background: linear-gradient(135deg, rgba(210,240,255,0.96), rgba(175,215,250,0.96));
  border: 1.5px solid #60a8e8;
  border-radius: 20px;
  padding: 4px 8px 4px 10px;
  display: flex; align-items: center; gap: 6px;
  box-shadow: 0 2px 10px rgba(40,80,160,0.22);
  white-space: nowrap;
  opacity: 0;
  transition: transform 0.35s cubic-bezier(0.34,1.56,0.64,1), opacity 0.25s;
  z-index: 25;
  pointer-events: none;
}
#visit-banner.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
  pointer-events: auto;
}
#vb-avatar { font-size: 18px; line-height: 1; }
#vb-name   { font-size: 10px; font-weight: 900; color: #1a4a88; flex: 1; }
.vb-home {
  background: linear-gradient(145deg, #4898e0, #2868b8);
  border: none; border-radius: 10px;
  color: #fff; font-size: 8.5px; font-weight: 800;
  padding: 4px 8px; cursor: pointer;
  font-family: 'Nunito', 'Mali', sans-serif;
  transition: transform 0.1s;
}
.vb-home:active { transform: scale(0.92); }

/* ══════════════════════════════════
   NOTIFICATION TOAST
══════════════════════════════════ */
#notif-toast {
  position: absolute;
  top: 52px; left: 8px; right: 8px;
  background: rgba(24,16,8,0.90);
  border: 1.5px solid #e8b840;
  border-radius: 13px;
  padding: 8px 12px;
  display: flex; align-items: center; gap: 8px;
  color: #fff8e8;
  font-size: 10px; font-weight: 700;
  font-family: 'Nunito', 'Mali', sans-serif;
  transform: translateY(-90px);
  opacity: 0;
  transition: transform 0.35s cubic-bezier(0.34,1.56,0.64,1), opacity 0.25s;
  z-index: 80;
  pointer-events: none;
}
#notif-toast.show {
  transform: translateY(0);
  opacity: 1;
}
#notif-icon { font-size: 18px; flex-shrink: 0; }

/* ══════════════════════════════════
   CAT POPUP — steal additions
══════════════════════════════════ */
#steal-row {
  display: none;
  align-items: center; gap: 10px;
  width: 100%;
  justify-content: center;
}
.act.steal {
  background: linear-gradient(145deg, #f5e8ff, #e0c8f8);
  border-color: #9848d8; color: #5a1898;
  width: 52px; height: 52px;
}
.steal-info {
  display: flex; flex-direction: column; align-items: center;
}
.si-pct   { font-size: 18px; font-weight: 900; color: #8830c0; line-height: 1; }
.si-label { font-size: 8px;  font-weight: 700; color: #9a6828; line-height: 1.3; text-align: center; }

/* ══════════════════════════════════
   NEIGHBOUR LIST PANEL
══════════════════════════════════ */
#neighbor-panel {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 370px;
  background: linear-gradient(to top, #fdf8f0 80%, rgba(253,248,240,0));
  border-radius: 22px 22px 0 0;
  border-top: 2px solid #e8cc80;
  box-shadow: 0 -4px 24px rgba(80,40,0,0.22);
  transform: translateY(100%);
  transition: transform 0.38s cubic-bezier(0.34,1.56,0.64,1);
  z-index: 60;
  display: flex; flex-direction: column;
}
#neighbor-panel.open { transform: translateY(0); }

.np-handle {
  width: 36px; height: 4px;
  background: #d8c090; border-radius: 2px;
  margin: 8px auto 0;
  flex-shrink: 0;
}
.np-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 6px 14px 4px;
  flex-shrink: 0;
}
.np-title { font-size: 14px; font-weight: 900; color: #7a4515; }
.np-close {
  width: 24px; height: 24px;
  background: rgba(0,0,0,0.07); border: none; border-radius: 50%;
  font-size: 11px; color: #888; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}

#neighbor-list {
  flex: 1; overflow-y: auto;
  padding: 4px 12px 12px;
  display: flex; flex-direction: column; gap: 8px;
}
#neighbor-list::-webkit-scrollbar { width: 4px; }
#neighbor-list::-webkit-scrollbar-thumb { background: #d8c090; border-radius: 2px; }

.neighbor-card {
  display: flex; align-items: center; gap: 10px;
  background: linear-gradient(145deg, #fffdf8, #f8f0dc);
  border: 1.5px solid #e8d090;
  border-radius: 14px;
  padding: 8px 10px;
  box-shadow: 0 2px 6px rgba(120,80,10,0.1);
}
.nc-status { font-size: 9px; font-weight: 800; border-radius: 8px; padding: 5px 8px; margin: 2px 2px 6px; line-height: 1.5; }
.nc-status.guest { background: #f3ead2; color: #8a6030; }
.nc-status.on { background: #d7f0cf; color: #2f7a2f; }
.nc-status.err { background: #f7dede; color: #a83a3a; }
.nc-status-detail { font-size: 8px; font-weight: 600; opacity: .85; }
.neighbor-card.real { border-color: #8fd06a; background: linear-gradient(145deg, #fbfff4, #eef8de); }
.nc-section { font-size: 10px; font-weight: 900; color: #4a7a2a; padding: 6px 4px 2px; }
.nc-hint-row { font-size: 9.5px; color: #9a6828; padding: 4px 6px 8px; line-height: 1.5; }
.nc-badge { font-size: 8px; font-weight: 800; color: #7a5a20; background: #f0e2b8; border-radius: 6px; padding: 1px 5px; margin-left: 2px; white-space: nowrap; }
.nc-badge.on { color: #2f7a2f; background: #d7f0cf; }
.nc-avatar { font-size: 28px; line-height: 1; flex-shrink: 0; }
.nc-info   { flex: 1; min-width: 0; }
.nc-name   { font-size: 11px; font-weight: 900; color: #5a3010; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nc-meta   { font-size: 8.5px; color: #9a6828; font-weight: 600; margin-top: 2px; }
.nc-visit  {
  background: linear-gradient(145deg, #78c848, #4a9820);
  border: none; border-radius: 10px;
  color: #fff; font-size: 9px; font-weight: 900;
  padding: 6px 10px; cursor: pointer; flex-shrink: 0;
  font-family: 'Nunito', 'Mali', sans-serif;
  box-shadow: 0 2px 6px rgba(60,120,20,0.3);
  transition: transform 0.1s;
}
.nc-visit:active { transform: scale(0.92); }

/* ══════════════════════════════════════════
   PROTECT ROW (home cat popup)
══════════════════════════════════════════ */
#pop-protect-row {
  display: flex; gap: 7px; justify-content: center;
  padding-top: 7px; border-top: 1px solid #f0e4cc;
  margin-top: 2px; flex-wrap: wrap;
}
.protect-btn {
  display: flex; align-items: center; gap: 4px;
  padding: 6px 11px; border-radius: 10px;
  border: 2px solid #ddd; background: #fdf8f0;
  font-size: 11px; font-weight: 800; color: #666;
  cursor: pointer; font-family: 'Nunito', 'Mali', sans-serif;
  transition: transform 0.1s;
}
.protect-btn:active { transform: scale(0.92); }
.protect-btn.caged  { background: #fff3e0; border-color: #ff9800; color: #e65100; }
.protect-btn.shielded { background: #e8f5e9; border-color: #4caf50; color: #2e7d32; }

/* ══════════════════════════════════════════
   STEAL MODE PICKER
══════════════════════════════════════════ */
#sp-overlay {
  position: absolute; inset: 0;
  background: rgba(40,24,8,.45);
  backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px);
  z-index: 69; display: none;
}
#sp-overlay.show { display: block; }

#steal-picker {
  position: absolute; bottom: 0; left: 0; right: 0;
  background: #fffdf7;
  border-radius: 22px 22px 0 0;
  padding: 18px 16px 24px;
  transform: translateY(100%);
  transition: transform 0.3s cubic-bezier(0.34,1.1,0.64,1);
  z-index: 70;
  box-shadow: 0 -4px 24px rgba(60,30,0,0.18);
}
#steal-picker.open { transform: translateY(0); }

.sp-title {
  font-size: 14px; font-weight: 900; color: #3a2a1a;
  margin-bottom: 14px; text-align: center;
}
.sp-option {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px; border-radius: 14px;
  border: 2px solid #e8dcc8; margin-bottom: 10px;
  cursor: pointer; background: #fdf6ec;
  transition: background 0.1s, transform 0.1s;
  user-select: none;
}
.sp-option:not(.disabled):active { background: #f0e4cc; transform: scale(0.98); }
.sp-option.disabled { opacity: 0.45; cursor: not-allowed; pointer-events: none; }
.sp-icon  { font-size: 28px; flex-shrink: 0; }
.sp-info  { flex: 1; }
.sp-name  { font-size: 13px; font-weight: 900; color: #3a2a1a; }
.sp-desc  { font-size: 10px; color: #8a6840; margin-top: 2px; }
.sp-badge {
  font-size: 10px; font-weight: 800; padding: 3px 8px;
  border-radius: 8px; white-space: nowrap; flex-shrink: 0;
}
.sp-badge.online       { background: #4caf50; color: #fff; }
.sp-badge.offline      { background: #999; color: #fff; }
.sp-badge.charges      { background: #ff9800; color: #fff; }
.sp-badge.no-charges   { background: #f44336; color: #fff; }
.sp-badge.offline-only { background: #7b68ee; color: #fff; font-size: 9px; }

/* ─── Steal-in-progress warning banner ─── */
#steal-warn-banner {
  position: absolute;
  bottom: 96px; left: 50%; transform: translateX(-50%);
  width: 310px;
  background: linear-gradient(135deg, #3a1a00, #5a2a00);
  border: 2px solid #ff9800; border-radius: 16px;
  padding: 10px 14px; z-index: 200;
  display: flex; align-items: center; gap: 10px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.5);
  animation: swb-slide-in 0.3s cubic-bezier(0.34,1.56,0.64,1);
}
@keyframes swb-slide-in {
  from { opacity: 0; transform: translateX(-50%) translateY(12px); }
  to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}
.swb-icon  { font-size: 24px; flex-shrink: 0; }
.swb-text  { flex: 1; }
.swb-title { font-size: 12px; font-weight: 900; color: #ffcc66; }
.swb-sub   { font-size: 11px; color: #ffaa44; margin-top: 2px; }
.swb-sub b { color: #ff6600; font-size: 14px; }
.swb-cancel {
  padding: 5px 10px; border-radius: 10px; border: 1.5px solid #ff9800;
  background: transparent; color: #ffcc66;
  font-size: 11px; font-weight: 800; cursor: pointer;
  font-family: 'Nunito', 'Mali', sans-serif; flex-shrink: 0;
}
.swb-cancel:active { background: rgba(255,152,0,0.2); }
.sp-cancel {
  width: 100%; padding: 11px; border: none;
  background: #f0e8d8; border-radius: 12px;
  color: #8a7060; font-size: 13px; font-weight: 800;
  cursor: pointer; font-family: 'Nunito', 'Mali', sans-serif;
  margin-top: 4px; transition: background 0.1s;
}
.sp-cancel:active { background: #e0d4b8; }

/* ══════════════════════════════════════════
   PVP TAP BATTLE MODAL
══════════════════════════════════════════ */
#pvp-challenge {
  position: absolute; inset: 0;
  background: linear-gradient(160deg, #0d0028 0%, #2a0860 60%, #1a0040 100%);
  z-index: 80; display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 6px;
  opacity: 0; pointer-events: none;
  transition: opacity 0.3s ease;
}
#pvp-challenge.open { opacity: 1; pointer-events: all; }

/* Incoming-challenge prompt (victim side) */
#challenge-overlay { position: absolute; inset: 0; background: rgba(30,10,50,.5); z-index: 194; opacity: 0; visibility: hidden; transition: opacity .2s; pointer-events: none; }
#challenge-overlay.show { opacity: 1; visibility: visible; pointer-events: auto; }
#challenge-prompt {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%,-50%) scale(.9);
  width: min(320px, 88%); background: linear-gradient(160deg,#3a1070,#22004a);
  border: 2px solid #7a4ad0; border-radius: 22px; padding: 20px 18px 16px;
  z-index: 195; text-align: center; color: #fff;
  font-family: 'Nunito','Mali',sans-serif; box-shadow: 0 16px 44px rgba(0,0,0,.5);
  opacity: 0; visibility: hidden; transition: opacity .2s, transform .2s; pointer-events: none;
}
#challenge-prompt.open { opacity: 1; visibility: visible; transform: translate(-50%,-50%) scale(1); pointer-events: auto; }
.chp-bell { font-size: 40px; line-height: 1; animation: landing-pulse 1s ease-in-out infinite; }
.chp-title { font-size: 18px; font-weight: 900; color: #ffd700; margin-top: 4px; }
.chp-body { font-size: 12px; line-height: 1.6; margin: 8px 4px 10px; color: #f0e8ff; }
.chp-timer { font-size: 11px; color: #c8b0f0; margin-bottom: 12px; }
.chp-actions { display: flex; gap: 8px; }
.chp-accept, .chp-decline { flex: 1; padding: 12px; border: none; border-radius: 14px; font-family: inherit; font-weight: 900; font-size: 13px; cursor: pointer; }
.chp-accept { background: linear-gradient(145deg,#ffcf3a,#f0a020); color: #4a2a00; box-shadow: 0 4px 0 #c07810; }
.chp-decline { background: rgba(255,255,255,.14); color: #e8d8ff; }

.pvp-title {
  font-size: 24px; font-weight: 900; color: #ffd700;
  text-shadow: 0 0 20px rgba(255,215,0,0.5);
  letter-spacing: 1px;
}
.pvp-vs { font-size: 12px; color: #c0a0e0; font-weight: 700; }

.pvp-scores {
  display: flex; gap: 44px; align-items: flex-start;
  margin: 4px 0;
}
.pvp-score-you, .pvp-score-them {
  display: flex; flex-direction: column; align-items: center;
  font-size: 11px; font-weight: 800; gap: 2px;
}
.pvp-score-you  { color: #66ff88; }
.pvp-score-them { color: #ff6688; }
.pvp-score-num  { font-size: 40px; font-weight: 900; line-height: 1; }

.pvp-timer-bar  { width: 220px; height: 8px; background: #2a1060; border-radius: 4px; overflow: hidden; }
.pvp-timer-fill { height: 100%; background: linear-gradient(90deg, #ff4477, #ff9900); border-radius: 4px; }

.pvp-countdown {
  font-size: 56px; font-weight: 900; color: #fff;
  text-shadow: 0 0 30px rgba(255,255,255,0.6);
  min-height: 68px; line-height: 1.1;
}
.pvp-countdown.go { color: #66ff88; font-size: 36px; }
.pvp-countdown.hidden { opacity: 0; min-height: 0; height: 0; }

.pvp-tap-btn {
  width: 155px; height: 155px; border-radius: 50%;
  border: 4px solid #ffd700;
  background: radial-gradient(circle at 40% 35%, #cc44ff, #5500cc);
  font-size: 60px; cursor: pointer;
  box-shadow: 0 0 40px rgba(200,100,255,0.5), 0 0 80px rgba(100,0,255,0.3);
  display: flex; align-items: center; justify-content: center;
  user-select: none; -webkit-user-select: none;
  transition: transform 0.06s;
  margin: 4px 0;
  font-family: 'Nunito', 'Mali', sans-serif;
  -webkit-tap-highlight-color: transparent;
}
.pvp-tap-btn:not(:disabled):active { transform: scale(0.88); }
.pvp-tap-btn:disabled { opacity: 0.4; cursor: not-allowed; box-shadow: none; }

.pvp-tap-hint { font-size: 11px; color: #9070c0; font-weight: 700; }

.pvp-result {
  position: absolute; inset: 0;
  background: rgba(0,0,0,0.82);
  display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 8px;
  opacity: 0; pointer-events: none;
  transition: opacity 0.35s;
}
.pvp-result.show { opacity: 1; pointer-events: all; }
.pvp-result-title {
  font-size: 48px; font-weight: 900;
  text-shadow: 0 0 30px currentColor;
}
.pvp-result-sub { font-size: 14px; color: #ccc; font-weight: 700; text-align: center; padding: 0 24px; }
.pvp-result-close {
  padding: 13px 36px; border-radius: 22px;
  background: #ffd700; color: #1a0040;
  font-size: 15px; font-weight: 900; border: none;
  cursor: pointer; font-family: 'Nunito', 'Mali', sans-serif;
  margin-top: 8px; box-shadow: 0 4px 16px rgba(255,215,0,0.4);
  transition: transform 0.1s;
}
.pvp-result-close:active { transform: scale(0.94); }

/* ══════════════════════════════════
   CAT MARKET (3×3 board, SVG portraits)
══════════════════════════════════ */
#cm-overlay {
  position: absolute; inset: 0; background: rgba(40,24,8,.45);
  backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px);
  opacity: 0; visibility: hidden; pointer-events: none; transition: opacity .2s; z-index: 60;
}
#cm-overlay.show { opacity: 1; visibility: visible; }
#cat-market {
  position: absolute; left: 50%; top: 50%;
  transform: translate(-50%,-46%) scale(.96);
  width: 350px; max-width: 93%; max-height: 90%; overflow-y: auto;
  background: #fdf5e0; border: 2.5px solid #e0b840; border-radius: 20px;
  box-shadow: 0 12px 38px rgba(0,0,0,.34); padding: 14px; z-index: 61;
  opacity: 0; pointer-events: none;
  transition: opacity .2s ease, transform .2s ease;
}
#cat-market.show { opacity: 1; transform: translate(-50%,-50%) scale(1); }
#cat-market .cm-head { position: relative; display: flex; justify-content: center; align-items: center; }
#cat-market .cm-title { font-weight: 800; color: #6a3008; font-size: 17px; }
#cat-market .cm-close {
  position: absolute; right: 0; top: -1px; width: 28px; height: 28px;
  border-radius: 50%; border: 2px solid #b05808; background: #e08020;
  color: #fff; font-weight: 700; font-size: 13px; cursor: pointer; line-height: 1;
}
#cat-market .cm-sub {
  display: flex; justify-content: space-between; align-items: center;
  margin: 7px 2px 10px; font-size: 11px; color: #9a6828; font-weight: 700;
}
#cat-market .cm-timer b { color: #c0392b; font-variant-numeric: tabular-nums; }
#cat-market .cm-grid { display: grid; grid-template-columns: repeat(3,1fr); gap: 8px; }
#cat-market .cm-card {
  background: #fff9ec; border: 2px solid var(--rar,#dcb858); border-radius: 14px;
  padding: 6px 5px 7px; display: flex; flex-direction: column; align-items: center;
}
#cat-market .cm-card.sold { opacity: .5; filter: grayscale(.55); }
#cat-market .cm-rar {
  font-size: 8px; font-weight: 800; color: #fff;
  padding: 1px 8px; border-radius: 8px; margin-bottom: 1px;
}
#cat-market .cm-portrait { width: 80px; height: 76px; }
#cat-market .cm-portrait svg { width: 100%; height: 100%; display: block; }
#cat-market .cm-label {
  font-size: 9.5px; font-weight: 700; color: #5a3010; text-align: center;
  line-height: 1.08; min-height: 22px; display: flex; align-items: center;
}
#cat-market .cm-buy {
  margin-top: 3px; width: 100%; border: none; border-radius: 9px;
  background: #e07818; color: #fff; font-weight: 800; font-size: 10px;
  padding: 5px 0; cursor: pointer; font-variant-numeric: tabular-nums;
}
#cat-market .cm-buy:disabled { background: #b0a48c; cursor: default; }
#cat-market .cm-note { margin-top: 10px; font-size: 8.5px; color: #a08868; text-align: center; line-height: 1.3; }

/* ══════════════════════════════════
   LAYOUT MODES — 📱 มือถือ / 🖥️ คอม
══════════════════════════════════ */
.app-shell { display: flex; align-items: center; justify-content: center; gap: 22px; }
.frame-sizer { flex: 0 0 auto; }

/* On narrow (real-phone) screens the frame fills the viewport, so this fixed
   chip lands ON TOP of the top-bar menu buttons (z 9999 swallowed their taps —
   the "book icon won't open on mobile" bug). Hide it there; the same switch
   lives as a row inside the ⚙️ settings panel. */
@media (max-width: 760px) {
  .layout-toggle { display: none; }
}
.layout-toggle {
  position: fixed; top: 14px; right: 16px; z-index: 9999;
  background: rgba(255,248,222,0.96); color: #6a3a12; font-weight: 800;
  font-family: 'Nunito', 'Mali', sans-serif; font-size: 13px;
  border: 2px solid #d8b048; border-radius: 20px; padding: 7px 14px; cursor: pointer;
  box-shadow: 0 4px 14px rgba(0,0,0,0.35);
}
.layout-toggle:active { transform: scale(0.95); }

/* rails are desktop-only */
.rail { display: none; }

/* ── DESKTOP = wide LANDSCAPE map (1100×620) ── */
body.layout-desktop { background: radial-gradient(circle at 50% -10%, #4a3420, #221505 72%); }
/* frame-sizer dims + --mct-scale are set by mctApplyScale() in JS (height-aware) */

/* The frame + Phaser canvas switch to the landscape resolution. */
body.layout-desktop #game-wrap { width: 1100px; height: 620px; }
body.layout-desktop #game-wrap canvas:not(.rive-cat) {
  width: 1100px !important; height: 620px !important;
}

/* Full-screen wide map: hide the side rails (nav lives in HUD + bottom-nav). */
body.layout-desktop .rail { display: none; }

/* legacy desktop rail styling (kept for reference; rails hidden above) */
body.layout-desktop .rail.__legacy {
  display: flex; flex-direction: column; gap: 14px;
  width: 204px; align-self: stretch; max-height: 826px;
  font-family: 'Nunito', 'Mali', sans-serif;
}
.rail-brand { display: flex; align-items: center; gap: 10px; padding: 4px 2px 2px; }
.rail-logo { font-size: 38px; line-height: 1; }
.rail-title { font-size: 20px; font-weight: 900; color: #ffd98a; line-height: 1.05; }
.rail-sub { font-size: 12px; font-weight: 800; color: #cdb88e; letter-spacing: 0.5px; }
.rail-card {
  background: rgba(255,248,228,0.07); border: 1.5px solid rgba(224,184,72,0.32);
  border-radius: 14px; padding: 12px 14px;
}
.rail-h { font-size: 11px; font-weight: 800; color: #e6c054; letter-spacing: 1px; margin-bottom: 9px; }
.rail-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 9px; }
.rail-list li { font-size: 12.5px; line-height: 1.3; color: #ece0c8; }
.rail-tip { font-size: 12.5px; font-weight: 800; color: #ffe6a0; text-align: center; }

.rail-right { justify-content: flex-start; }
.rail-right .rail-h { text-align: center; }
.rail-btn {
  display: flex; align-items: center; gap: 11px; width: 100%;
  background: linear-gradient(145deg, #fffaf0, #f6e6c4); color: #5a3410;
  border: 2px solid #d8b048; border-radius: 14px; padding: 13px 15px;
  font-family: 'Nunito', 'Mali', sans-serif; font-size: 22px; font-weight: 800;
  cursor: pointer; box-shadow: 0 3px 8px rgba(0,0,0,0.25); transition: transform .1s;
}
.rail-btn span { font-size: 14px; }
.rail-btn:hover { transform: translateX(3px); }
.rail-btn:active { transform: scale(0.96); }
.rail-btn.gems { background: linear-gradient(145deg, #efe2ff, #d8c2f6); color: #4a2a7a; border-color: #9068cc; }
.rail-btn.free { background: linear-gradient(145deg, #e2f0ff, #c2def6); color: #1a4a7a; border-color: #5a9fd6; }
.rail-btn.market { background: linear-gradient(145deg, #ffeede, #f8d6b0); color: #7a3e10; border-color: #e0902c; }

/* ─── Cat-popup hunger warning row ─── */
#cat-popup #hunger-warn-row {
  margin-top: 8px;
  background: #fff0e0; border: 1.5px solid #e06820; border-radius: 12px;
  padding: 8px 10px;
}
.hunger-warn-msg {
  text-align: center; font-size: 10px; font-weight: 700; color: #7a3000;
  line-height: 1.45; margin-bottom: 8px;
}
.hunger-warn-msg b { color: #cc2200; font-variant-numeric: tabular-nums; }
.hunger-warn-btns { display: flex; gap: 8px; justify-content: center; }
.act.hunger-em {
  background: linear-gradient(145deg, #fff0e0, #ffd8a0);
  border-color: #e06820; color: #7a3400;
  box-shadow: 0 3px 7px rgba(200,100,20,0.22);
  min-width: 80px;
}

/* ─── Cat-popup steal-shield row ─── */
#cat-popup #shield-row {
  align-items: center; gap: 6px;
  margin-top: 8px; padding: 6px 10px;
  background: #e8f0ff; border: 1.5px solid #6aa0e0; border-radius: 12px;
  font-size: 11px; color: #2a5494; font-weight: 700;
}
#cat-popup #shield-row .shield-ic { font-size: 15px; line-height: 1; }
#cat-popup #shield-row b { color: #1a4a94; font-variant-numeric: tabular-nums; }

/* ══════════════════════════════════════════
   STREAK BUTTON EXTRAS
══════════════════════════════════════════ */
.lstreak { font-size: 8px; color: #e05010; font-weight: 900; line-height: 1.2; }

/* ══════════════════════════════════════════
   STREAK CALENDAR POPUP
══════════════════════════════════════════ */
.streak-overlay {
  position: absolute; inset: 0; background: rgba(40,24,8,.45);
  backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px);
  z-index: 90; pointer-events: auto;
}
.streak-panel {
  position: absolute; left: 50%; top: 50%;
  transform: translate(-50%, -50%);
  width: 300px; background: #fffbf0;
  border: 2.5px solid #d8a030; border-radius: 18px;
  padding: 18px 16px 14px; z-index: 91;
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  pointer-events: auto;
  box-shadow: 0 8px 32px rgba(0,0,0,0.35);
}
.sk-title { font-size: 16px; font-weight: 900; color: #8a4a00; }
.sk-sub   { font-size: 12px; color: #5a3010; text-align: center; }
.sk-grid  { display: flex; gap: 6px; }
.sk-day {
  width: 36px; height: 44px; border-radius: 10px;
  background: #f0e8d8; border: 1.5px solid #d0b888;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 1px; position: relative; font-family: 'Nunito', 'Mali', sans-serif;
}
.sk-day.done    { background: #d4f0d4; border-color: #68b860; }
.sk-day.today   { border-color: #f0a030; border-width: 2.5px; background: #fff8e0; }
.sk-day.milestone { box-shadow: 0 0 0 2px #f0c040; }
.sk-dl  { font-size: 11px; font-weight: 900; color: #5a3010; }
.sk-check { font-size: 14px; color: #3a9a3a; line-height: 1; }
.sk-ms  { font-size: 11px; position: absolute; bottom: 2px; }
.sk-note { font-size: 11px; color: #6a5030; text-align: center; }
.sk-close {
  padding: 8px 28px; border-radius: 20px; border: none;
  background: linear-gradient(145deg, #f0a030, #d08010);
  color: white; font-size: 13px; font-weight: 900;
  cursor: pointer; font-family: 'Nunito', 'Mali', sans-serif;
}
.sk-close:active { opacity: 0.85; }

/* ══════════════════════════════════════════
   MISSIONS PANEL
══════════════════════════════════════════ */
/* ─── Combined Mission + Event Panel ─── */
#me-panel {
  position: absolute; top: 46px; bottom: 78px; left: 50%; transform: translateX(-50%);
  width: min(640px, calc(100% - 24px));
  background: #fdf6e8; z-index: 93;
  border: 2.5px solid #e8a030; border-radius: 18px;
  box-shadow: 0 10px 36px rgba(0,0,0,.35);
  display: flex; flex-direction: column; overflow: hidden; pointer-events: auto;
}
.me-tabs {
  display: flex; align-items: center; gap: 0;
  background: linear-gradient(to bottom, #fff8e0, #fdf6e8);
  border-bottom: 2px solid #e8d060; flex-shrink: 0; padding: 8px 10px 0;
}
.me-tab {
  flex: 1; padding: 8px 4px; background: none; border: none; border-bottom: 3px solid transparent;
  font-size: 12px; font-weight: 800; color: #9a7030; cursor: pointer;
  font-family: 'Nunito', 'Mali', sans-serif; border-radius: 0; transition: color 0.15s;
  position: relative;
}
.me-tab.active { color: #7a3800; border-bottom-color: #e07820; }
.me-tabs .rp-close { margin-left: auto; flex: 0; }
.me-body { flex: 1; overflow-y: auto; padding: 10px 12px 14px; display: flex; flex-direction: column; gap: 6px; }
.mp-section-label { font-size: 10px; font-weight: 900; color: #8a6020; text-transform: uppercase; letter-spacing: 0.5px; }
.mc-empty  { font-size: 11px; color: #aaa; padding: 4px 0; }
.evm-ev-title { font-size: 15px; font-weight: 900; color: #3a2808; text-align: center; padding: 4px 0; }

.mission-card {
  background: #fff8e8; border: 1.5px solid #e8d080;
  border-radius: 12px; padding: 9px 11px 7px;
  display: flex; flex-direction: column; gap: 5px;
}
.mission-card.done    { border-color: #88cc44; background: #f0fce8; }
.mission-card.claimed { border-color: #c8d0b8; background: #f4f4ec; opacity: 0.72; }

.mc-label { font-size: 12px; font-weight: 800; color: #3a2808; }
.mc-progress-bar { height: 6px; background: #e8dcc0; border-radius: 4px; overflow: hidden; }
.mc-bar-fill { height: 100%; border-radius: 4px; background: linear-gradient(to right, #f0a030, #e8c040); transition: width 0.4s; }
.mission-card.done    .mc-bar-fill { background: linear-gradient(to right, #66cc44, #44aa22); }
.mission-card.claimed .mc-bar-fill { background: #aabbaa; }

.mc-footer { display: flex; align-items: center; gap: 6px; }
.mc-prog   { font-size: 10px; color: #8a6030; font-weight: 700; white-space: nowrap; }
.mc-reward-pill {
  flex: 1; font-size: 10px; color: #6a4010; font-weight: 800;
  background: #f8ecd4; border-radius: 8px; padding: 2px 6px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.mc-claim {
  padding: 4px 10px; border-radius: 10px; border: none; cursor: pointer;
  background: linear-gradient(145deg, #68cc44, #44aa22);
  color: white; font-size: 11px; font-weight: 900; font-family: 'Nunito', 'Mali', sans-serif;
  white-space: nowrap; flex-shrink: 0;
}
.mc-claim.disabled { background: #c8c8c0; color: #888; cursor: default; }
.mc-claim:not(.disabled):active { opacity: 0.8; }

/* ═══════════════════════════════════════════
   ROOM UPGRADE PANEL
═══════════════════════════════════════════ */
#ui .room-overlay, #ui #room-panel, #ui .rp-close,
#ui .rp-tab, #ui .rp-upgrade-btn,
#ui .coll-overlay, #ui #coll-panel, #ui .cd-back, #ui .coll-card,
#ui .ev-overlay, #ui #ev-modal, #ui .evt-claim { pointer-events: auto; }

.room-overlay {
  position: absolute; inset: 0; background: rgba(40,24,8,.45);
  backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px);
  z-index: 90;
}
#room-panel {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%,-50%);
  width: 320px; background: #fffbf0; border: 2.5px solid #c0a030;
  border-radius: 18px; padding: 14px; z-index: 91;
  box-shadow: 0 8px 32px rgba(0,0,0,.35); max-height: 520px;
  overflow-y: auto; display: flex; flex-direction: column; gap: 10px;
}
.rp-header { display: flex; align-items: center; justify-content: space-between; }
.rp-title  { font-size: 15px; font-weight: 900; color: #3a2808; }
.rp-close  { background: none; border: none; font-size: 18px; cursor: pointer; color: #888; padding: 0 4px; }
.rp-tabs   { display: flex; gap: 6px; flex-wrap: wrap; }
.rp-tab {
  flex: 1; min-width: 80px; padding: 6px 8px; border-radius: 10px; border: 1.5px solid #d8c880;
  background: #fff8e8; font-size: 11px; font-weight: 800; cursor: pointer; color: #5a3a08;
  font-family: 'Nunito', 'Mali', sans-serif;
}
.rp-tab.active { background: #f0c030; border-color: #c09020; color: #3a2000; }
.rp-tab.locked { opacity: 0.5; cursor: default; }
.rp-stats  { display: flex; gap: 12px; font-size: 12px; color: #5a3a08; background: #fdf0c8; padding: 6px 10px; border-radius: 10px; }
.rp-done   { font-size: 11px; color: #44aa22; font-weight: 700; padding: 3px 0;
             display: flex; align-items: center; justify-content: space-between; gap: 8px; }
/* Per-upgrade switch: does this furniture show on the farm? */
.rp-fur-btn {
  font-family: inherit; font-size: 10px; font-weight: 800; cursor: pointer;
  border-radius: 999px; padding: 3px 9px; flex: none;
  border: 1.5px solid #c9c9bd; background: #f0f0e8; color: #8a8a7e;
}
.rp-fur-btn.on { border-color: #d4900a; background: #fff3d8; color: #8a5a00; }
.rp-fur-btn:active { transform: scale(0.94); }
.rp-next-card {
  background: #fff; border: 1.5px solid #e0c870; border-radius: 12px; padding: 10px 12px;
  display: flex; flex-direction: column; gap: 5px;
}
.rp-next-label { font-size: 10px; color: #8a6030; font-weight: 800; text-transform: uppercase; }
.rp-next-name  { font-size: 13px; font-weight: 900; color: #3a2808; }
.rp-next-fx    { font-size: 11px; color: #5a7030; font-weight: 700; }
.rp-upgrade-btn {
  margin-top: 4px; padding: 7px 12px; border-radius: 12px; border: none; cursor: pointer;
  background: linear-gradient(145deg, #f0c030, #d09020); color: #3a2000;
  font-size: 12px; font-weight: 900; font-family: 'Nunito', 'Mali', sans-serif;
}
.rp-upgrade-btn.disabled { background: #c8c8c0; color: #888; cursor: default; }
.rp-upgrade-btn:not(.disabled):active { opacity: 0.8; }
.rp-maxed { text-align: center; font-size: 13px; font-weight: 800; color: #c09020; padding: 10px; }

/* ═══════════════════════════════════════════
   CAT COLLECTION PANEL
═══════════════════════════════════════════ */
.coll-overlay {
  position: absolute; inset: 0; background: rgba(40,24,8,.45); z-index: 92;
  backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px);
}
/* Floating rounded card (same language as Shop/ev-modal) — the farm stays
   visible (blurred) behind it instead of a jarring full-screen takeover. */
#coll-panel {
  position: absolute; top: 46px; bottom: 78px; left: 50%; transform: translateX(-50%);
  width: min(640px, calc(100% - 24px));
  background: #fdf6e8; z-index: 93;
  border: 2.5px solid #e8a030; border-radius: 18px;
  box-shadow: 0 10px 36px rgba(0,0,0,.35);
  display: flex; flex-direction: column; overflow: hidden;
}
/* Header */
.coll-header {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 12px 8px; border-bottom: 1.5px solid #e8d880;
  background: linear-gradient(to bottom, #fff8e0, #fdf6e8);
  flex-shrink: 0;
}
.coll-title { flex: 1; font-size: 14px; font-weight: 900; color: #3a2808; }
.coll-counter-badge {
  background: #f0c840; color: #3a2000; font-size: 11px; font-weight: 900;
  border-radius: 20px; padding: 2px 9px; border: 1.5px solid #d4a820;
}
/* Grid */
.coll-grid {
  flex: 1; overflow-y: auto; display: grid;
  grid-template-columns: repeat(2, 1fr); grid-auto-rows: max-content;
  gap: 8px; padding: 10px; align-content: start;
}
.coll-card {
  background: #fff8e8; border: 2px solid #e8d880; border-radius: 14px;
  display: flex; flex-direction: row; align-items: center;
  gap: 0; cursor: default; position: relative; overflow: hidden;
  transition: border-color 0.15s, box-shadow 0.15s; height: 72px;
}
.coll-card.owned { border-color: #88cc44; background: #f4fce8; cursor: pointer; }
.coll-card.owned:active { box-shadow: 0 2px 10px rgba(80,180,20,.25); }
.coll-card:not(.owned)[onclick] { cursor: pointer; }
/* Rarity left stripe */
.coll-rar-stripe {
  width: 6px; align-self: stretch; flex-shrink: 0; border-radius: 12px 0 0 12px;
}
/* Portrait area */
.coll-portrait-wrap {
  width: 58px; flex-shrink: 0; display: flex; align-items: center; justify-content: center;
  padding: 6px 0;
}
.coll-portrait { width: 52px; height: 44px; object-fit: contain; }
.coll-unknown  { font-size: 28px; opacity: 0.25; }
/* Secret "coming soon" cat — golden locked teaser */
.coll-card.coll-secret {
  border-color: #e4a02a; cursor: default;
  background: repeating-linear-gradient(45deg, #fff5e0, #fff5e0 8px, #fdecc8 8px, #fdecc8 16px);
}
.coll-card.coll-secret .coll-unknown { opacity: 0.75; }
/* Info column */
.coll-info { flex: 1; padding: 8px 6px 8px 2px; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.coll-cname { font-size: 11px; font-weight: 900; color: #3a2808; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.coll-rar   { font-size: 9px; font-weight: 800; }
.coll-own-badge {
  position: absolute; top: 5px; right: 5px; background: #44aa22; color: #fff;
  font-size: 9px; font-weight: 900; border-radius: 6px; padding: 1px 4px;
}
.coll-lv-chip {
  display: inline-block; background: #e8f0e8; color: #338820; font-size: 9px;
  font-weight: 900; border-radius: 6px; padding: 1px 5px; margin-top: 1px;
}
/* Detail sheet */
.coll-detail {
  position: absolute; inset: 0; background: #fdf6e8; z-index: 94;
  display: flex; flex-direction: column; align-items: center;
  padding: 0; overflow-y: auto;
}
.cd-top { width: 100%; padding: 10px 12px 0; }
.cd-back { background: none; border: none; font-size: 13px; font-weight: 800; color: #7a5020; cursor: pointer; padding: 0; }
.cd-portrait-wrap {
  width: 100%; background: linear-gradient(to bottom, #fff8e0, #fdf6e8);
  display: flex; align-items: center; justify-content: center;
  padding: 16px 0 12px; border-bottom: 1.5px solid #e8d880;
}
.cd-img  { width: 130px; height: 110px; object-fit: contain; }
.cd-name { font-size: 20px; font-weight: 900; color: #3a2808; margin-top: 12px; }
.cd-rar-badge {
  font-size: 11px; font-weight: 900; padding: 2px 10px; border-radius: 12px;
  background: #f4e8d8; margin: 4px 0;
}
.cd-breed { font-size: 11px; color: #8a6030; margin-bottom: 6px; }
.cd-stats-grid {
  display: flex; gap: 10px; margin-bottom: 6px;
}
.cd-stat-item {
  display: flex; align-items: center; gap: 4px;
  background: #fff8e8; border: 1px solid #e8d880; border-radius: 10px; padding: 4px 10px;
}
.cd-stat-ic  { font-size: 13px; }
.cd-stat-val { font-size: 11px; font-weight: 700; color: #5a3808; }
.cd-personality { font-size: 11px; color: #6a5030; font-style: italic; padding: 0 16px; text-align: center; }
.cd-skill {
  font-size: 11px; color: #3070a0; font-weight: 700;
  background: #e8f0fc; border-radius: 8px; padding: 5px 12px;
  text-align: center; margin: 4px 16px;
}
.cd-own-row {
  display: flex; gap: 8px; margin-top: 6px; flex-wrap: wrap; justify-content: center;
}
.cd-own-chip {
  background: #e8fce8; border: 1.5px solid #88cc44; border-radius: 10px;
  padding: 4px 12px; font-size: 11px; font-weight: 800; color: #338820;
}

/* ═══════════════════════════════════════════
   EVENT MODAL
═══════════════════════════════════════════ */
.ev-overlay {
  position: absolute; inset: 0; background: rgba(40,24,8,.45);
  backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px);
  z-index: 94;
}
#ev-modal {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%,-50%);
  width: 320px; background: #fffbf0; border: 2.5px solid #e8a030;
  border-radius: 18px; padding: 14px; z-index: 95;
  box-shadow: 0 8px 32px rgba(0,0,0,.4); max-height: 540px;
  overflow-y: auto; display: flex; flex-direction: column; gap: 10px;
}
.evm-timer-row { font-size: 12px; color: #7a4010; font-weight: 700; text-align: center; background: #fdf0c8; padding: 5px 10px; border-radius: 10px; }
.evm-section   { font-size: 11px; font-weight: 900; color: #8a5020; text-transform: uppercase; letter-spacing: 0.5px; margin-top: 4px; }
.ev-mission {
  background: #fff8e8; border: 1.5px solid #e8d080; border-radius: 12px;
  padding: 8px 10px; display: flex; flex-direction: column; gap: 4px; margin-bottom: 6px;
}
.ev-mission.done { border-color: #88cc44; background: #f0fce8; }
.evm-label { font-size: 12px; font-weight: 800; color: #3a2808; }
.evm-bar-wrap { height: 6px; background: #e8dcc0; border-radius: 4px; overflow: hidden; }
.evm-bar-fill { height: 100%; border-radius: 4px; background: linear-gradient(to right, #f0a030, #e8c040); transition: width 0.4s; }
.ev-mission.done .evm-bar-fill { background: linear-gradient(to right, #66cc44, #44aa22); }
.evm-bar-row { display: flex; justify-content: space-between; font-size: 10px; color: #8a6030; font-weight: 700; }
.evm-reward { color: #7040c0; }
.ev-tier {
  display: flex; align-items: center; gap: 10px; background: #fff8e8;
  border: 1.5px solid #e8d080; border-radius: 12px; padding: 8px 10px; margin-bottom: 6px;
}
.ev-tier.ready  { border-color: #f0a020; background: #fff8d8; }
.ev-tier.claimed { border-color: #c8d0b8; background: #f4f4ec; opacity: 0.72; }
.evt-info  { flex: 1; display: flex; flex-direction: column; gap: 2px; }
.evt-label { font-size: 11px; font-weight: 800; color: #3a2808; }
.evt-reward { font-size: 11px; color: #7040c0; font-weight: 700; }
.evt-claim {
  padding: 5px 12px; border-radius: 10px; border: none; cursor: pointer;
  background: linear-gradient(145deg, #f0a030, #d08020); color: #3a2000;
  font-size: 11px; font-weight: 900; font-family: 'Nunito', 'Mali', sans-serif; white-space: nowrap;
}
.evt-claim.disabled { background: #c8c8c0; color: #888; cursor: default; }

/* ─── Settings Panel ─── */
.settings-panel {
  position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%);
  /* MUST sit above .ev-overlay (z 94) — below it, the overlay's blur washes
     out the panel itself (the top-bar popups looked unreadable). */
  z-index: 95; background: #fffaf0; border-radius: 20px;
  border: 2.5px solid #d4b870; box-shadow: 0 8px 32px rgba(80,40,0,0.22);
  /* Size in % of the GAME FRAME, never vw/vh — the frame is CSS-scaled, so
     viewport units come out wrong inside it (panels overflowed the frame on
     desktop and rendered off-screen on phones). */
  width: min(320px, 90%); max-height: 88%; padding: 0;
  display: flex; flex-direction: column;
}
.settings-body { padding: 6px 12px 14px; display: flex; flex-direction: column; gap: 10px; overflow-y: auto; min-height: 0; }
.settings-row {
  display: flex; align-items: center; gap: 12px;
  background: #fff8e8; border-radius: 12px; padding: 10px 12px;
  border: 1.5px solid #e8d080;
}
.settings-info { flex: 1; }
.settings-label { font-size: 13px; font-weight: 800; color: #3a2808; }
.settings-desc  { font-size: 10px; color: #8a6030; margin-top: 2px; }
.settings-toggle {
  padding: 6px 14px; border-radius: 20px; border: 2px solid #c8a840;
  background: #e8d080; color: #5a3800; font-size: 12px; font-weight: 800;
  font-family: 'Nunito', 'Mali', sans-serif; cursor: pointer; white-space: nowrap;
  transition: background 0.18s, color 0.18s;
}
.settings-toggle.on {
  background: linear-gradient(145deg, #66cc44, #44aa22);
  border-color: #388820; color: #fff;
}

/* ─── Save transfer (backup / restore code) ─── */
.settings-backup { padding-bottom: 8px; }
.backup-box {
  display: flex; flex-direction: column; gap: 8px;
  background: #fff8e8; border: 1.5px solid #e8d080; border-radius: 12px;
  padding: 10px 12px; margin-top: -2px;
}
.backup-textarea {
  width: 100%; box-sizing: border-box; resize: none; height: 60px;
  font-family: 'Menlo', 'Consolas', monospace; font-size: 10px; line-height: 1.4;
  color: #5a3800; background: #fffdf6; border: 1.5px solid #e0c880;
  border-radius: 8px; padding: 7px 9px; word-break: break-all;
}
.backup-textarea:focus { outline: none; border-color: #c8a840; }
.backup-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.backup-btn {
  flex: 1; min-width: 92px; padding: 7px 10px; border-radius: 10px;
  border: 2px solid #c8a840; background: #e8d080; color: #5a3800;
  font-family: 'Nunito', 'Mali', sans-serif; font-size: 11px; font-weight: 800;
  cursor: pointer; white-space: nowrap; transition: filter 0.15s;
}
.backup-btn:hover { filter: brightness(1.05); }
.backup-btn:active { filter: brightness(0.95); }
.backup-btn-import {
  flex-basis: 100%; background: linear-gradient(145deg, #ffb24d, #f5922a);
  border-color: #d47615; color: #fff;
}
.backup-msg { font-size: 10px; font-weight: 700; min-height: 13px; color: #8a6030; }
.backup-msg.ok  { color: #2f9e44; }
.backup-msg.err { color: #d43a3a; }

/* ─── Starter pick (choose 1 of 3 beginner cats) ─── */
.starter-panel { width: min(360px, 94%); }
.starter-sub {
  font-size: 11.5px; font-weight: 700; color: #8a6030;
  text-align: center; padding: 4px 14px 10px;
}
.starter-cards { display: flex; gap: 8px; padding: 0 12px 14px; }
.starter-card {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px;
  background: #fff8e8; border: 2px solid #e8d080; border-radius: 14px;
  padding: 10px 6px 9px; cursor: pointer;
  font-family: 'Nunito', 'Mali', sans-serif;
  transition: transform 0.15s, border-color 0.15s, box-shadow 0.15s;
}
.starter-card:hover {
  transform: translateY(-3px); border-color: #e8a030;
  box-shadow: 0 6px 16px rgba(200,130,30,.25);
}
.starter-card:active { transform: translateY(-1px) scale(0.98); }
.sc-portrait { width: 64px; height: 50px; }
.sc-portrait svg { width: 100%; height: 100%; }
.sc-name  { font-size: 13px; font-weight: 900; color: #3a2808; }
.sc-breed { font-size: 9.5px; font-weight: 700; color: #9a7030; }
.sc-perso { font-size: 9px; color: #8a6030; }

/* ─── First-time cat naming ─── */
.namecat-panel { width: min(300px, 92%); text-align: center; }
.nc-portrait { width: 96px; height: 74px; margin: 6px auto 0; }
.nc-portrait svg { width: 100%; height: 100%; }
.nc-hint { font-size: 10.5px; font-weight: 700; color: #b06a20; padding: 2px 14px 8px; }
.nc-input {
  display: block; width: calc(100% - 48px); margin: 0 auto;
  font-family: 'Nunito', 'Mali', sans-serif; font-size: 15px; font-weight: 800;
  color: #3a2808; text-align: center;
  background: #fffdf6; border: 2px solid #e0c880; border-radius: 12px;
  padding: 9px 10px;
}
.nc-input:focus { outline: none; border-color: #e8a030; }
.nc-actions { display: flex; gap: 8px; padding: 12px 14px 14px; }
.nc-btn {
  flex: 1; padding: 9px 10px; border-radius: 12px;
  border: 2px solid #c8a840; background: #e8d080; color: #5a3800;
  font-family: 'Nunito', 'Mali', sans-serif; font-size: 12.5px; font-weight: 800;
  cursor: pointer; transition: filter 0.15s;
}
.nc-btn:hover { filter: brightness(1.06); }
.nc-btn-ok {
  background: linear-gradient(145deg, #ffb24d, #f5922a);
  border-color: #d47615; color: #fff;
}
.nc-btn:disabled { opacity: 0.45; cursor: not-allowed; filter: none; }

/* ─── Account / Login Panel ─── */
.account-panel { width: min(320px, 90%); }
.acct-row {
  font-size: 13px; font-weight: 800; padding: 10px 12px;
  background: #fff2e0; border: 1.5px solid #e8c090; border-radius: 12px;
  color: #6a4a1a;
}
.acct-status.on { background: #eaf7e2; border-color: #a8d890; color: #2a6a1a; }
.acct-desc { font-size: 10.5px; color: #8a6030; line-height: 1.6; padding: 2px 4px; }
.acct-btn {
  width: 100%; padding: 10px; border-radius: 12px; border: 2px solid #d4b870;
  background: #fff8e8; color: #5a3a14; font-size: 12.5px; font-weight: 800;
  font-family: 'Nunito', 'Mali', sans-serif; cursor: pointer;
}
.acct-btn:disabled { opacity: 0.55; cursor: not-allowed; }
.acct-btn.danger { border-color: #d88a8a; background: #fdeeee; color: #a03a3a; }
.acct-msg { font-size: 10.5px; text-align: center; padding: 2px 4px; min-height: 0; color: #8a6030; }
.acct-msg.err { color: #b0483a; }

/* ─── Landing / Home (pre-game entry screen) ─── */
#landing {
  position: fixed; inset: 0; z-index: 300; pointer-events: auto;
  background: #7aac52;   /* shows while the video is still buffering */
  overflow: hidden;
}
#landing-video {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: cover; object-position: center;
}
.landing-stage {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
}
#landing-mute {
  position: absolute; top: 12px; right: 12px; z-index: 5;
  width: 42px; height: 42px; border-radius: 50%;
  background: rgba(255,255,255,.9); border: 2px solid rgba(120,80,10,.15);
  font-size: 20px; line-height: 1; cursor: pointer;
  box-shadow: 0 3px 10px rgba(40,24,8,.28);
  display: flex; align-items: center; justify-content: center;
}
#landing-mute.muted { background: rgba(230,220,205,.9); opacity: .85; }
#landing-mute:active { transform: scale(.92); }
/* Stage 1 — key art speaks for itself; only a tap prompt sits on top. */
#landing-stage1 { align-items: flex-end; cursor: pointer; }
/* A full-width fade bar rather than a floating pill: the key art already ends
   in a row of decorative badges, and a pill collides with them at some crop
   ratios. A bar pinned to the bottom edge reads as UI in every aspect. */
.landing-enter {
  width: 100%; padding: 38px 0 7px; text-align: center;
  background: linear-gradient(to top, rgba(255,252,244,.99) 38%, rgba(255,252,244,0));
  color: #4a7a2a; font-family: 'Nunito', 'Mali', sans-serif;
  font-size: 16px; font-weight: 900; letter-spacing: .3px;
  animation: landing-pulse 1.6s ease-in-out infinite;
}
@keyframes landing-pulse {
  0%,100% { opacity: .82; }
  50%     { opacity: 1; }
}
/* Stage 2 — dim the art so the choice card reads clearly. */
#landing-stage2 { background: rgba(30,18,6,.55); backdrop-filter: blur(2px); }
.landing-card {
  width: min(360px, 90%); background: #fffaf0;
  border: 3px solid #e6cf95; border-radius: 26px;
  box-shadow: 0 18px 48px rgba(40,24,8,.34);
  padding: 26px 22px 22px; text-align: center;
  font-family: 'Nunito', 'Mali', sans-serif;
  animation: landing-pop .32s cubic-bezier(.2,1.3,.5,1) both;
}
@keyframes landing-pop { from { transform: scale(.9); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.landing-title { font-size: 24px; font-weight: 900; color: #4a7a2a; letter-spacing: .5px; }
.landing-tag { font-size: 11.5px; color: #8a6030; margin: 8px 0 18px; line-height: 1.5; }
.landing-btn {
  width: 100%; padding: 13px; border-radius: 14px; cursor: pointer;
  font-family: 'Nunito', 'Mali', sans-serif; font-size: 14px; font-weight: 800;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  transition: transform .1s, filter .1s; border: 2px solid transparent;
}
.landing-btn:active { transform: scale(.97); }
.landing-btn:disabled { opacity: .6; cursor: default; }
.landing-google { background: #4285f4; color: #fff; box-shadow: 0 4px 0 #2f66c4; }
.landing-google:hover { filter: brightness(1.05); }
.landing-google .lg-ico { background: #fff; border-radius: 50%; width: 20px; height: 20px; display: inline-flex; align-items: center; justify-content: center; font-size: 12px; }
.landing-guest { background: #fff3d8; color: #6a4a1a; border-color: #e0c485; margin-top: 4px; }
.landing-guest:hover { filter: brightness(1.02); }
.landing-perk { font-size: 10.5px; color: #6a9a3a; margin: 6px 0 12px; font-weight: 700; }
.landing-perk.muted { color: #a89066; font-weight: 600; margin: 6px 0 0; }
.landing-msg { font-size: 11px; color: #b0483a; min-height: 0; margin-top: 8px; }
.acct-guest {
  text-align: center; font-size: 10.5px; color: #a89066;
  padding: 6px 4px 0;
}

/* ─── Guide / คู่มือ Panel ─── */
.guide-panel { width: min(360px, 92%); max-height: 84%; }
.guide-body { overflow-y: auto; min-height: 0; gap: 16px; }
.guide-section-title {
  font-size: 12.5px; font-weight: 900; color: #7a4515;
  margin-bottom: 6px; padding-left: 2px;
}
.guide-row {
  display: flex; align-items: flex-start; gap: 10px;
  background: #fff8e8; border-radius: 12px; padding: 9px 11px;
  border: 1.5px solid #e8d080; margin-bottom: 6px;
}
.guide-icon { font-size: 18px; line-height: 1.3; flex-shrink: 0; }
.guide-name { font-size: 12.5px; font-weight: 800; color: #3a2808; }
.guide-desc { font-size: 10.5px; color: #8a6030; margin-top: 2px; line-height: 1.5; }

/* ══════════════════════════════════════════
   MAP PICKER
══════════════════════════════════════════ */
#map-overlay {
  position: absolute; inset: 0; background: rgba(40,24,8,.45);
  backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px);
  z-index: 94;
}
#map-panel {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  width: 330px; max-width: 92%; max-height: 86%; overflow-y: auto;
  background: #fffaf0; border: 2.5px solid #d8a838; border-radius: 18px;
  padding: 16px 14px 14px; z-index: 95;
  box-shadow: 0 14px 44px rgba(0,0,0,0.5); font-family: 'Nunito', 'Mali', sans-serif;
}
.map-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.map-title { font-size: 16px; font-weight: 900; color: #7a4a10; }
.map-close {
  background: #f0e0c0; border: none; border-radius: 50%; width: 28px; height: 28px;
  font-size: 14px; font-weight: 900; color: #7a4a10; cursor: pointer;
}
#map-list { display: flex; flex-direction: column; gap: 12px; }
.map-card {
  display: flex; gap: 12px; align-items: center;
  background: #fff5e2; border: 2px solid #e8d4a8; border-radius: 14px; padding: 10px;
}
.map-card.is-active { border-color: #4caf50; background: #f0fbe8; }
.map-thumb {
  width: 78px; height: 110px; object-fit: cover; border-radius: 10px;
  border: 2px solid #d8b878; flex: 0 0 auto; background: #7aac52;
}
.map-info { flex: 1; min-width: 0; }
.map-name { font-size: 14px; font-weight: 900; color: #5a3a14; margin-bottom: 2px; }
.map-desc { font-size: 11px; color: #8a6838; line-height: 1.35; margin-bottom: 8px; }
.map-use {
  border: none; border-radius: 10px; padding: 7px 16px; cursor: pointer;
  font-family: 'Nunito', 'Mali', sans-serif; font-weight: 800; font-size: 12px;
  background: linear-gradient(145deg, #ffd24d, #f0a830); color: #5a3400;
  box-shadow: 0 3px 7px rgba(220,150,20,0.3);
}
.map-use.active { background: #cde8c0; color: #2a6a1a; box-shadow: none; cursor: default; }
.map-use.locked { background: linear-gradient(145deg, #e8d8b8, #d4b888); color: #6a4a20; }
.map-use.voucher { background: linear-gradient(145deg, #b8e890, #7ac858); color: #1a5a10; }
.map-use:active { transform: scale(0.95); }
/* Collection-voucher banner in the map picker */
.map-voucher {
  font-size: 11px; font-weight: 800; color: #8a6030;
  background: #fff8e8; border: 1.5px dashed #d4b870; border-radius: 12px;
  padding: 8px 12px; margin: 0 0 10px; line-height: 1.4;
}
.map-voucher.on { background: #eefadf; border-color: #7ac858; color: #2a6a1a; border-style: solid; }

/* ─── First-launch tutorial coach-marks ─── */
#tut-layer { position: absolute; inset: 0; z-index: 60; pointer-events: none; }
#tut-hole {
  position: absolute; width: 92px; height: 92px; border-radius: 50%;
  border: 3px dashed #ffd24d; pointer-events: none;
  box-shadow: 0 0 0 9999px rgba(24, 14, 4, 0.42);
  animation: tutPulse 1.3s ease-in-out infinite;
}
@keyframes tutPulse {
  0%, 100% { transform: scale(1); border-color: #ffd24d; }
  50% { transform: scale(1.08); border-color: #ffb020; }
}
@media (prefers-reduced-motion: reduce) { #tut-hole { animation: none; } }
#tut-card {
  position: absolute; left: 50%; transform: translateX(-50%); top: 82px;
  width: min(320px, 84%); pointer-events: auto; text-align: center;
  background: #fffdf6; border: 2.5px solid #c99a3f; border-radius: 16px;
  padding: 14px 16px 10px; box-shadow: 0 10px 28px rgba(40, 24, 6, 0.3);
}
#tut-msg { font-size: 13.5px; line-height: 1.55; color: #3a2a1a; font-weight: 600; }
.tut-btns { display: flex; justify-content: center; gap: 10px; margin-top: 10px; }
#tut-skip {
  border: none; background: none; color: #a89066; font-size: 12px;
  font-family: 'Nunito', 'Mali', sans-serif; font-weight: 700; cursor: pointer; padding: 7px 10px;
}
#tut-next {
  border: none; border-radius: 10px; padding: 7px 18px; cursor: pointer;
  font-family: 'Nunito', 'Mali', sans-serif; font-weight: 800; font-size: 13px;
  background: linear-gradient(145deg, #ffd24d, #f0a830); color: #5a3400;
  box-shadow: 0 3px 7px rgba(220, 150, 20, 0.35);
}
#tut-next:active { transform: scale(0.95); }
#tut-dots { display: flex; justify-content: center; gap: 5px; margin-top: 8px; }
#tut-dots i { width: 7px; height: 7px; border-radius: 50%; background: #e4d4b4; }
#tut-dots i.on { background: #c99a3f; }

/* ─── Neighbor feed tab ─── */
.np-tabs { display: flex; gap: 6px; padding: 0 14px 8px; }
.np-tab {
  flex: 1; border: none; border-radius: 10px; padding: 7px 0; cursor: pointer;
  font-family: 'Nunito', 'Mali', sans-serif; font-weight: 800; font-size: 12px;
  background: #f0e4cc; color: #8a6838;
}
.np-tab.on { background: linear-gradient(145deg, #ffd24d, #f0a830); color: #5a3400; }
#neighbor-feed { overflow-y: auto; padding: 0 14px 10px; flex: 1; }

/* ─── Neighbor chat (แชท) ─── */
.chat-row { display: flex; align-items: flex-end; gap: 7px; margin-bottom: 8px; }
.chat-row.me { justify-content: flex-end; }
.chat-avatar { font-size: 20px; flex-shrink: 0; line-height: 1; margin-bottom: 2px; }
.chat-bubble {
  max-width: 76%; background: #fff; border: 1.5px solid #eedca8;
  border-radius: 14px 14px 14px 4px; padding: 7px 11px 5px;
}
.chat-row.me .chat-bubble {
  background: #e7f4d9; border-color: #b8dc90;
  border-radius: 14px 14px 4px 14px;
}
.chat-name { font-size: 10px; font-weight: 800; color: #b07830; margin-bottom: 1px; }
.chat-text { font-size: 12.5px; color: #4a3416; line-height: 1.45; word-break: break-word; white-space: pre-wrap; }
.chat-ago  { font-size: 8.5px; color: #b8a888; text-align: right; margin-top: 2px; }
#chat-input-row {
  display: flex; gap: 8px; padding: 8px 12px 12px; flex-shrink: 0;
  border-top: 1.5px solid #f0e2b8; background: #fdf8f0;
}
#chat-input {
  flex: 1; font-family: 'Nunito', 'Mali', sans-serif; font-size: 13px; font-weight: 700;
  color: #4a3416; background: #fff; border: 2px solid #e8cc80; border-radius: 20px;
  padding: 8px 14px;
}
#chat-input:focus { outline: none; border-color: #e8a030; }
#chat-send {
  width: 40px; height: 40px; border-radius: 50%; border: 2px solid #d47615;
  background: linear-gradient(145deg, #ffb24d, #f5922a); color: #fff;
  font-size: 16px; font-weight: 900; cursor: pointer; flex-shrink: 0;
}
#chat-send:active { transform: scale(0.92); }
.feed-card {
  background: #fff8ec; border: 2px solid #e8d4a8; border-radius: 12px;
  padding: 10px 12px; margin-bottom: 8px;
}
.fc-head { display: flex; align-items: center; gap: 7px; margin-bottom: 4px; }
.fc-avatar { font-size: 18px; }
.fc-name { font-weight: 800; font-size: 12.5px; color: #5a3a14; }
.fc-on { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: #4caf50; }
.fc-ago { margin-left: auto; font-size: 10px; color: #b39a70; }
.fc-text { font-size: 12px; color: #6a4a24; line-height: 1.45; margin-bottom: 7px; }
.fc-like {
  border: 1.5px solid #e8c8a0; background: #fffdf6; border-radius: 99px;
  padding: 3px 12px; cursor: pointer; font-family: 'Nunito', 'Mali', sans-serif;
  font-weight: 800; font-size: 11.5px; color: #8a5a2a;
}
.fc-like.liked { background: #ffe8ee; border-color: #f0a0b8; color: #c04060; }
.fc-like:active { transform: scale(0.92); }

/* ─── Steal log (note-group) ─── */
.np-tab-dot {
  display: inline-block; width: 7px; height: 7px; border-radius: 50%;
  background: #e64444; margin-left: 4px; vertical-align: top;
}
#steal-log-list { overflow-y: auto; padding: 0 14px 16px; flex: 1; }
.log-empty {
  text-align: center; color: #a89066; font-size: 12.5px; line-height: 1.7;
  padding: 30px 10px;
}
.log-card {
  display: flex; align-items: flex-start; gap: 9px;
  background: #fff8ec; border: 2px solid #e8d4a8; border-radius: 12px;
  padding: 10px 12px; margin-bottom: 8px;
}
.log-card.log-in { background: #fdeeee; border-color: #f0b8b8; }
.log-card.log-new { background: #eef7ee; border-color: #b8e0b8; }
.log-card.log-warn { background: #fff3e0; border-color: #f0cc90; }
.log-icon { font-size: 18px; line-height: 1.3; }
.log-body { font-size: 12.5px; color: #5a3a14; line-height: 1.5; }
.log-in .log-body { color: #8a2a2a; }
.log-new .log-body { color: #2a6a2a; }
.log-warn .log-body { color: #9a5a10; }
.log-ago { display: block; font-size: 10px; color: #b39a70; margin-top: 2px; }
.log-in .log-ago { color: #c08a8a; }
.log-new .log-ago { color: #8ac08a; }
.log-warn .log-ago { color: #d0a860; }
