:root {
  --ink: #4a3b35;
  --muted: #8f7b70;
  --card: #fffaf4;
  --card-2: #fff3e8;
  --line: #f1e0d0;
  --accent: #ff8a5c;
  --accent-dark: #ea6c3f;
  --gold: #ffc93c;
  --shadow: 0 8px 24px rgba(120, 70, 40, .16);
  --radius: 18px;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  font-family: 'Mali', system-ui, sans-serif;
  color: var(--ink);
  background: transparent; /* #sky (index.html, first child of body) paints the real background */
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  -webkit-user-select: none;
}

button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; }
button:disabled { cursor: not-allowed; opacity: .45; }

#scene { position: fixed; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }
#tags, #fx { position: fixed; inset: 0; pointer-events: none; overflow: hidden; }

/* ---------- pet name tags ---------- */
.tag {
  position: absolute; left: 0; top: 0;
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  white-space: nowrap; will-change: transform;
}
/* over the head, side by side (owner 2026-09-28): the lowest bar's icon once it is orange or worse — the same one as
   on its card (pet.js statWarn), just the icon, no badge (owner 2026-09-28) — then what it needs / does */
.tag .ic { display: flex; align-items: center; gap: 3px; }
.tag .ic:not(:has(> :not(:empty))) { display: none; }
.tag .stat { font-size: 20px; line-height: 1; filter: drop-shadow(0 2px 2px rgba(0,0,0,.15)); }
.tag .stat:empty { display: none; }
.tag .love { font-size: 20px; line-height: 1; animation: heartbeat 1s ease-in-out infinite; filter: drop-shadow(0 2px 2px rgba(0,0,0,.15)); }
.tag .love:empty { display: none; }
@keyframes heartbeat { 0%, 60%, 100% { transform: scale(1); } 20% { transform: scale(1.25); } 40% { transform: scale(.95); } }
.tag .need { font-size: 22px; line-height: 1; animation: bob 1.1s ease-in-out infinite; filter: drop-shadow(0 2px 2px rgba(0,0,0,.15)); }
.tag .need:empty { display: none; }
.tag .name {
  font-size: 12px; font-weight: 700;
  background: rgba(255, 255, 255, .88);
  padding: 1px 9px; border-radius: 999px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, .1);
}
.tag.sel .name { background: var(--accent); color: #fff; }
/* the name only over the selected pet (owner 2026-09-28) — the need icon stays on every pet, a wild visitor keeps its
   "ป่า ✨" · tapping the name deselects (main.js): a clear border widens the finger target, the shadow follows the pill */
.tag:not(.sel):not(.wild) .name { display: none; }
.tag.sel .name {
  pointer-events: auto; cursor: pointer;
  border: 8px solid transparent; margin: -8px; background-clip: padding-box;
  box-shadow: none; filter: drop-shadow(0 2px 3px rgba(0, 0, 0, .12));
}
@keyframes bob { 50% { transform: translateY(-4px); } }

.float {
  position: absolute; transform: translate(-50%, -50%);
  font-weight: 700; font-size: 16px; color: #fff;
  text-shadow: 0 2px 0 rgba(0,0,0,.2), 0 0 10px rgba(0,0,0,.25);
  animation: floatUp 1.4s ease-out forwards; white-space: nowrap;
}
.float.coin { color: #ffe066; }
.float.hp-down { color: #ffc2c2; }  /* 🍬 / 🟤 a lump of health going (docs/LIFE.md §4) */
.float.hp-up { color: #c6f7d8; }
.float.speech {
  background: #fff; color: var(--ink); padding: 4px 12px; border-radius: 14px;
  text-shadow: none; box-shadow: var(--shadow); font-size: 14px;
  animation-duration: 2s;
}
.float.big { font-size: 22px; color: #fff3a8; }
@keyframes floatUp {
  0% { opacity: 0; transform: translate(-50%, -20%) scale(.6); }
  15% { opacity: 1; transform: translate(-50%, -60%) scale(1.05); }
  70% { opacity: 1; }
  100% { opacity: 0; transform: translate(-50%, -190%) scale(1); }
}
.ripple {
  position: absolute; width: 34px; height: 34px; margin: -17px 0 0 -17px;
  border: 3px solid #fff; border-radius: 50%;
  animation: ripple .6s ease-out forwards;
  transform: scaleY(.55);
}
@keyframes ripple { from { opacity: .9; scale: .3; } to { opacity: 0; scale: 1.4; } }

/* ---------- HUD ---------- */
.hud {
  position: fixed; top: 12px; left: 16px; right: 16px;
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  pointer-events: none;
}
.hud > * { pointer-events: auto; }
.brand {
  display: flex; align-items: center; gap: 8px;
  background: var(--card); padding: 8px 16px 8px 10px; border-radius: 999px; box-shadow: var(--shadow);
  font-size: 17px;
}
.brand .logo { font-size: 22px; }
.hud-right { display: flex; align-items: center; gap: 8px; }
.coins {
  display: flex; align-items: center; gap: 6px;
  background: var(--card); padding: 8px 16px; border-radius: 999px; box-shadow: var(--shadow);
  font-weight: 700; font-size: 17px; min-width: 88px; justify-content: center;
}
.coins.bump { animation: bump .35s ease; }
@keyframes bump { 40% { transform: scale(1.15); } }
.icon-btn {
  width: 42px; height: 42px; border-radius: 50%;
  background: var(--card); box-shadow: var(--shadow); font-size: 18px;
  transition: transform .15s;
}
.icon-btn:hover { transform: translateY(-2px); }
/* 🆕 a new deploy is out (js/update.js) */
#btn-settings { position: relative; }
#btn-settings.has-update::after {
  content: ''; position: absolute; top: 1px; right: 1px; width: 11px; height: 11px; border-radius: 50%;
  background: #e35d5d; border: 2px solid var(--card); animation: update-dot 1.6s ease-in-out infinite;
}
@keyframes update-dot { 50% { transform: scale(1.25); } }
.btn.update-btn { background: #4fb477; border-color: #368a57; }
.icon-btn:active { transform: scale(.92); }

/* ---------- pet list: one column of round avatars + names, on every screen (owner 2026-09-27) ---------- */
.pet-list {
  position: fixed; top: 72px; left: 10px; width: 78px;
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  max-height: calc(100% - 96px); overflow-y: auto; overflow-x: hidden; padding: 6px 0;
  scrollbar-width: none;
}
.pet-list::-webkit-scrollbar { display: none; }
.pet-card {
  display: flex; flex-direction: column; align-items: center; gap: 2px; width: 76px; flex: none;
  background: none; border: 0; box-shadow: none; padding: 0; position: relative;
  touch-action: manipulation; -webkit-tap-highlight-color: transparent;
}
.pc-av {
  position: relative; display: grid; place-items: center; width: 52px; height: 52px; border-radius: 50%;
  background: var(--card); border: 3px solid #fff; box-shadow: var(--shadow);
  transition: transform .15s, border-color .15s;
}
.pet-card img { width: 100%; height: 100%; object-fit: contain; border-radius: 50%; background: var(--card-2); }
.pet-card:hover .pc-av { transform: scale(1.06); }
.pet-card:active .pc-av { transform: scale(.94); }
/* 🦮 collared: a red-and-white striped ring outside the status ring, like a leash (owner 2026-09-30 — was a blue halo,
   2026-09-27 before that a red outline). Stripes = a masked conic gradient (a box-shadow can't be striped); the avatar
   keeps a 2px white gap, the stripe ring is 3px wide. The bottom right bubble (.cb-av) gets it the same way. */
.pet-card.collar .pc-av, .care-bubble.collar .cb-av { box-shadow: 0 0 0 2px #fff, var(--shadow); }
.pet-card.collar .pc-av::after, .care-bubble.collar .cb-av::after {
  content: ''; position: absolute; inset: -9px; border-radius: 50%; pointer-events: none;
  background: repeating-conic-gradient(#e0392b 0 15deg, #fff 0 30deg);
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 3px), #000 calc(100% - 3px));
  mask: radial-gradient(farthest-side, transparent calc(100% - 3px), #000 calc(100% - 3px));
}
/* status ring (owner 2026-09-27): the avatar ring = its lowest bar — --pct (0–100) of the ring in --ring (green → red),
   the rest a faint track; the bar's icon bottom left (.pc-stat). No orange "selected" ring: the name pill shows it.
   A card of a pet elsewhere (another world, left at home) rings its last known bars; one with none known keeps the
   plain white ring. */
.pc-av, .cb-av {
  border-color: transparent;
  background: linear-gradient(var(--card), var(--card)) padding-box,
    conic-gradient(var(--ring, #fff) calc(var(--pct, 100) * 1%), #5f5855 0) border-box;
}
.pc-av { border-width: 4px; }
.cb-av { border-width: 4px; box-shadow: var(--shadow); }
.pet-card.sel .pc-av { box-shadow: var(--shadow); }
.pet-card.collar.sel .pc-av { box-shadow: 0 0 0 2px #fff, var(--shadow); } /* keep the collar ring when selected */
.pc-stat {
  position: absolute; bottom: -6px; left: -7px; z-index: 1; font-size: 12px; line-height: 1; padding: 2px;
  border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .2);
}
.pc-stat:empty { display: none; }
/* the level on the avatar, a small pill on the bottom of the ring (owner 2026-09-27) */
.pc-lv {
  position: absolute; bottom: -5px; left: 50%; transform: translateX(-50%); z-index: 1; pointer-events: none;
  font-size: 9px; font-weight: 800; line-height: 1; padding: 2px 4px; border-radius: 999px; white-space: nowrap;
  color: #fff; background: rgba(60, 45, 40, .78); box-shadow: 0 1px 2px rgba(0, 0, 0, .2);
}
.pc-lv:empty { display: none; }
.pc-name {
  max-width: 76px; font-weight: 700; font-size: 11.5px; line-height: 1.25; padding: 1px 7px; border-radius: 999px;
  background: rgba(255, 255, 255, .88); box-shadow: 0 1px 3px rgba(0, 0, 0, .08);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.pet-card.sel .pc-name { background: var(--accent); color: #fff; }
.pc-need { position: absolute; top: -7px; right: -8px; font-size: 16px; animation: bob 1.1s ease-in-out infinite; }
.pc-need:empty { display: none; }
/* ❤️ top left while a heart bar of its goes up (owner 2026-09-29, main.js paintLoveMark) — wherever the pet is; next to
   the 🤝 / owner badge when it has one */
.pc-love {
  position: absolute; top: -8px; left: -8px; z-index: 2; font-size: 15px; line-height: 1; pointer-events: none;
  animation: heartbeat 1s ease-in-out infinite; filter: drop-shadow(0 1px 2px rgba(0, 0, 0, .2));
}
.pc-av[data-badge] .pc-love { left: 12px; }
.pc-love:empty { display: none; }
.add-card { font-weight: 700; color: var(--accent-dark); }
/* mine · 🤝 รับฝาก · 👥 คนอื่น: the last two groups each under a text label (owner 2026-09-28, main.js LIST_LABELS — was a
   line), in the colours of the badges on their avatars */
.pc-group {
  flex: none; max-width: 100%; margin: 4px 0 1px; padding: 2px 7px; border-radius: 999px;
  font-size: 10px; font-weight: 800; line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  border: 1.5px solid #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .15);
}
.pc-group.g1 { background: #fff1d6; color: #9a6a00; }
.pc-group.g2 { background: #eaf1ff; color: #3c5a86; }
.add-card .pc-av { background: rgba(255, 250, 244, .8); border: 2px dashed #f4b99e; box-shadow: none; font-size: 20px; }
/* n/cap under ➕ รับเลี้ยง (js/petcaps.js — our own ≤ 4 × rooms) · full: greyed, a tap says why */
.add-card .add-count { font-size: 11px; font-weight: 700; color: var(--muted); line-height: 1; }
.add-card.full { opacity: 0.55; filter: grayscale(0.7); }
/* 🐾 ไปหาน้อง beside the tapped avatar of a pet that is not here (owner 2026-09-28, main.js showGoTip — placed in px:
   the first button level with the avatar) · 🏠 เรียกเข้าบ้าน under it while that pet is in the garden (owner 2026-09-28) */
.go-tip {
  position: fixed; z-index: 30; display: flex; flex-direction: column; align-items: flex-start; gap: 6px;
  animation: go-tip-in .16s ease-out;
}
.go-tip[hidden] { display: none; }
.go-tip button {
  position: relative; white-space: nowrap;
  font-family: inherit; font-weight: 700; font-size: 13px; line-height: 1; padding: 8px 12px; border-radius: 999px;
  background: var(--accent); color: #fff; border: 2px solid var(--accent-dark); box-shadow: var(--shadow);
  touch-action: manipulation; -webkit-tap-highlight-color: transparent;
}
#go-tip-go small { display: block; font-size: .72em; opacity: .75; line-height: 1.1; }
.go-tip button[hidden] { display: none; }
.go-tip button:active { transform: scale(.94); }
#go-tip-go::before { /* a little arrow pointing at the avatar */
  content: ''; position: absolute; left: -8px; top: 50%; transform: translateY(-50%);
  border: 6px solid transparent; border-right-color: var(--accent-dark); border-left: 0;
}
#go-tip-in { background: #fff; color: var(--accent-dark); }
/* it says where it goes (owner 2026-09-30, js/golabel.js) — a long home owner's name ends in … (the arrow stays) */
#go-tip-go span { display: block; max-width: min(60vw, 260px); overflow: hidden; text-overflow: ellipsis; line-height: 1.2; }
/* 🎾 with no toy here: beside the button, arrow pointing at it (owner 2026-10-01, main.js noToyTip) */
.fetch-tip {
  position: fixed; z-index: 30; font-weight: 700; font-size: 13px; line-height: 1.2; padding: 8px 12px; border-radius: 14px;
  background: var(--accent); color: #fff; border: 2px solid var(--accent-dark); box-shadow: var(--shadow);
  max-width: min(60vw, 240px); animation: go-tip-in .16s ease-out;
}
.fetch-tip[hidden] { display: none; }
.fetch-tip small { display: block; font-size: .8em; opacity: .85; margin-top: 2px; }
.fetch-tip::after {
  content: ''; position: absolute; right: -8px; top: 50%; transform: translateY(-50%);
  border: 6px solid transparent; border-left-color: var(--accent-dark); border-right: 0;
}
@keyframes go-tip-in { from { opacity: 0; transform: translateX(-6px); } }

/* ---------- the pet's ℹ️ sheet (#detail-modal > .sheet#care — owner 2026-09-30: the panel that floated at the bottom is
   its ข้อมูล tab now, one page) ---------- */
.care-top { display: flex; align-items: center; gap: 12px; }
.care-avatar { width: 56px; height: 56px; object-fit: contain; background: var(--card-2); border-radius: 16px; }
.care-id { flex: 1; min-width: 0; }
.care-name { font-size: 19px; font-weight: 700; display: flex; align-items: center; gap: 4px; }
.care-name span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.care-sub { font-size: 13px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.xp { height: 6px; background: var(--line); border-radius: 3px; margin-top: 5px; overflow: hidden; }
.xp i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, #b690ff, #ff8fc7); transition: width .3s; }
.mini { width: 30px; height: 30px; border-radius: 50%; font-size: 14px; flex: none; }
.mini:hover { background: var(--card-2); }
.care-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 18px; margin: 12px 0; }
.care-stats .stat .sn { width: 30px; text-align: right; font-weight: 700; font-size: 12.5px; color: var(--muted); }
.stat { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.stat .si { font-size: 16px; width: 20px; text-align: center; }
.stat .sl { width: 52px; color: var(--muted); }
.stat .sb { flex: 1; height: 10px; background: var(--line); border-radius: 5px; overflow: hidden; }
.stat .sb i { display: block; height: 100%; border-radius: 5px; transition: width .3s; }
.stat.low .sb i { animation: blink 1s infinite; }
.stat.crit .sb i { background: #e35d5d !important; }
/* สุขภาพ: the lump still flowing (pale: about to go / to come) and where it is heading (docs/CARE_PANEL.md § Health) */
.stat .sb { position: relative; }
.stat .sb i.lump, .lf-bar i.lump { position: absolute; top: 0; bottom: 0; left: 0; width: 0; border-radius: 0; animation: none; }
.stat .sb i.lump.down, .lf-bar i.lump.down { background: #f4a3a3 !important; }
.stat .sb i.lump.up, .lf-bar i.lump.up { background: #a8e6bf !important; }
.stat .tr { width: 16px; flex: none; font-size: 10px; font-weight: 800; text-align: center; letter-spacing: -2px; }
.stat .tr.up, .lf-trend.up { color: #2fa36b; }
.stat .tr.down, .lf-trend.down { color: #d64545; }
@keyframes blink { 50% { opacity: .45; } }
/* a pet that is not here (owner 2026-09-27 — sat by a friend, left at home while we are out, out with another device,
   a sit waiting for its answer): #care.remote = its portrait, where it is (#care-where), its last known bars (read-only)
   and 🐾 ไปหาน้อง / ↩️ ยกเลิกการฝาก (#care-go) + the sit controls — none of the commands that need the pet here */
.care-where, .care-go, .care-nobars { display: none; }
.care.remote .care-where {
  display: block; margin-top: 3px; font-size: 13px; font-weight: 700; color: #7a5a48;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.care.remote .care-go { display: flex; gap: 6px; flex-wrap: wrap; }
.care.remote.nobars .care-stats { display: none; }
.care.remote.nobars .care-nobars { display: block; margin: 12px 0 4px; font-size: 13px; color: var(--muted); }
.care.remote :is(#btn-rename, .care-age-wrap, .xp, #btn-focus,
  #care-trait, #care-abilities, #care-actions, #care-ill, .dt-tabs, .dt-more) { display: none !important; }
.care.remote .care-avatar, .care-bubble.remote .cb-av img { filter: grayscale(.5) opacity(.75); }
.care-go .go-btn { font-size: 14px; padding: 5px 14px; background: var(--accent); border-color: var(--accent-dark); color: #fff; }
.care-go .go-btn.cancel { background: var(--card-2); border-color: #f0b4b4; color: #b84343; }


/* ---------- hint & toasts ---------- */
.hint {
  position: fixed; left: 16px; bottom: 16px; max-width: 250px;
  font-size: 12px; color: var(--muted); background: rgba(255, 250, 244, .8);
  padding: 8px 12px; border-radius: 14px; line-height: 1.5;
  pointer-events: none; transition: opacity 1s;
}
.hint.gone { opacity: 0; }
.toasts {
  position: fixed; top: 72px; left: 50%; transform: translateX(-50%);
  display: flex; flex-direction: column; align-items: center; gap: 6px; pointer-events: none; z-index: 45; /* over the modals: the ℹ️ sheet's buttons answer here */
}
.toast {
  background: var(--ink); color: #fff; padding: 8px 18px; border-radius: 999px;
  font-size: 14px; box-shadow: var(--shadow);
  animation: toastIn .25s ease, toastOut .35s ease 2.4s forwards;
}
.toast.good { background: #43b581; }
.toast.gold { background: linear-gradient(90deg, #ff9a5c, #ff6fa0); }
@keyframes toastIn { from { opacity: 0; transform: translateY(-10px); } }
@keyframes toastOut { to { opacity: 0; transform: translateY(-10px); } }

/* ---------- modals ---------- */
.modal {
  position: fixed; inset: 0; z-index: 40;
  display: grid; place-items: center; padding: 16px;
  background: rgba(74, 59, 53, .35); backdrop-filter: blur(3px);
}
.modal[hidden] { display: none; }
.sheet {
  width: min(640px, 100%); max-height: calc(100% - 32px); overflow-y: auto;
  background: var(--card); border-radius: 26px; padding: 20px; box-shadow: var(--shadow);
  animation: pop .25s ease;
}
.sheet.small { width: min(380px, 100%); }
/* 📸 ถ่ายรูปหมู่ (js/photo-ui.js): the picture in a box · the flash */
.photo-modal { z-index: 60; }
.photo-sheet { position: relative; display: flex; flex-direction: column; gap: 12px; }
.photo-sheet img { width: 100%; max-height: 62vh; object-fit: contain; border-radius: 14px; box-shadow: 0 4px 14px rgba(74, 59, 53, .25); background: #fff8ef; }
.photo-x { position: absolute; top: 12px; right: 14px; width: 34px; height: 34px; border-radius: 50%; background: var(--line); font-size: 16px; }
.photo-acts { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.photo-btn {
  display: inline-flex; align-items: center; gap: 6px; padding: 10px 18px; border-radius: 999px;
  background: var(--accent, #ff8fab); color: #fff; font-weight: 700; text-decoration: none;
}
.photo-flash { position: fixed; inset: 0; z-index: 70; background: #fff; pointer-events: none; animation: photoFlash .45s ease-out forwards; }
@keyframes photoFlash { from { opacity: .95; } to { opacity: 0; } }
/* 3 · 2 · 1 above the pets (they stand low on the screen) — not in the picture (only the 3D canvas is) */
.photo-count {
  position: fixed; left: 50%; top: 34%; z-index: 65; pointer-events: none;
  font: 800 clamp(72px, 22vw, 150px)/1 Mali, sans-serif; color: #fff;
  text-shadow: 0 4px 0 #ff8fab, 0 8px 22px rgba(74, 59, 53, .35);
  animation: photoCount .95s ease-out forwards;
}
@keyframes photoCount {
  from { opacity: 0; transform: translate(-50%, -50%) scale(1.6); }
  25% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
  to { opacity: 0; transform: translate(-50%, -50%) scale(.8); }
}
@keyframes pop { from { opacity: 0; transform: scale(.94); } }
.sheet-head { display: flex; align-items: center; justify-content: space-between; }
.sheet h2 { margin: 0; font-size: 22px; }
.sheet-sub { margin: 4px 0 14px; color: var(--muted); font-size: 14px; }
.species-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 10px; }
.sp-card {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  background: #fff; border: 2px solid var(--line); border-radius: 18px; padding: 8px 6px 10px;
  transition: transform .15s, border-color .15s;
}
.sp-card:hover:not(:disabled) { transform: translateY(-3px); border-color: var(--accent); }
.sp-card img { width: 84px; height: 84px; object-fit: contain; }
.sp-card b { font-size: 15px; }
.sp-card .price { font-size: 13px; color: var(--accent-dark); font-weight: 700; }
.sp-card .price.free { color: #2fa36b; }
.name-step { display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 6px 0; }
.sheet.wide { width: min(1080px, 100%); }
/* รับเลี้ยง: the five rolled picks, big and alive (js/main.js renderLookPicks · js/adoptstage.js) */
.look-hint { margin: 0; text-align: center; }
.look-picks { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; width: 100%; }
.look-pick {
  position: relative; flex: 1 1 140px; max-width: 200px; min-width: 0;
  display: flex; flex-direction: column; align-items: center; gap: 2px; cursor: pointer;
  background: #fff; border: 3px solid var(--line); border-radius: 20px; padding: 4px 6px 10px; font-weight: 600;
  transition: border-color .15s, background .15s, transform .15s;
}
.look-pick canvas, .look-pick img { display: block; width: 100%; aspect-ratio: 1 / 1.08; object-fit: contain; cursor: grab; touch-action: none; }
.look-pick canvas:active { cursor: grabbing; }
.look-pick span { line-height: 1.25; text-align: center; max-width: 100%; overflow-wrap: anywhere; }
.look-pick .lp-kind { font-size: 13px; }
.look-pick .lp-look { font-size: 11px; font-weight: 500; color: var(--muted); }
.look-pick .lp-trait { margin-top: 4px; font-size: 15px; font-weight: 700; }
.look-pick .lp-desc { font-size: 11px; font-weight: 500; color: var(--muted); }
.look-pick .lp-sex { margin-top: 4px; font-size: 14px; font-weight: 700; padding: 1px 10px; border-radius: 999px; }
.look-pick .lp-sex.f { background: #ffe3ef; color: #d2477f; }
.look-pick .lp-sex.m { background: #e0efff; color: #3a78c4; }
.look-pick .lp-rare { position: absolute; top: 6px; left: 8px; font-style: normal; font-size: 11px; background: #fff6d6; border-radius: 999px; padding: 1px 8px; }
.look-pick.on { border-color: var(--accent); background: #fff1e8; transform: translateY(-2px); }
.look-pick.on::after { content: '✓'; position: absolute; top: 4px; right: 8px; font-size: 18px; color: var(--accent-dark); }
.reroll-btn { font-size: 16px; }
/* the chosen species framed · the random ones marked · their price (js/main.js renderLookPicks) */
.look-pick.chosen { border-color: #ffc93c; box-shadow: 0 0 0 3px #ffe9a8, 0 6px 16px rgba(255, 170, 40, .25); background: #fffaf0; }
.look-pick.chosen.on { border-color: var(--accent); }
.look-pick .lp-badge { position: absolute; top: 6px; left: 8px; font-style: normal; font-size: 11px; font-weight: 700; background: #ffe9a8; border-radius: 999px; padding: 1px 8px; }
.look-pick .lp-badge.rnd { background: #e8f1ff; color: #3a6fb0; }
.look-pick .lp-price { font-size: 13px; color: var(--accent-dark); }
.look-pick .lp-price s { color: var(--muted); font-weight: 500; font-size: 11px; }
/* 🎨 the buttons that re-roll all five (js/main.js renderAdoptMix) */
.adopt-mix { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; width: 100%; }
.adopt-mix .mix-hint { flex-basis: 100%; text-align: center; font-size: 12px; color: var(--muted); font-weight: 600; }
.adopt-mix .chip-btn { flex: none; background: var(--card-2, #fff7ef); border-radius: 999px; padding: 5px 11px; font-size: 13px; font-weight: 600; border: 2px solid transparent; }
.adopt-mix .chip-btn:active { transform: scale(.94); }
.adopt-mix .chip-btn:disabled { opacity: .45; }
.reroll-btn .price { margin-left: 6px; color: var(--accent-dark); }
.name-step label { display: flex; flex-direction: column; gap: 6px; font-weight: 600; width: min(300px, 100%); }
input {
  font: inherit; font-size: 18px; padding: 10px 14px; border-radius: 14px;
  border: 2px solid var(--line); background: #fff; color: var(--ink); width: 100%;
  user-select: text; -webkit-user-select: text;
}
input:focus { outline: none; border-color: var(--accent); }
.row { display: flex; gap: 10px; justify-content: center; margin-top: 12px; }
.btn {
  background: var(--accent); color: #fff; font-weight: 700; padding: 10px 22px; border-radius: 999px;
  border-bottom: 3px solid var(--accent-dark); font-size: 16px;
}
.btn:hover { filter: brightness(1.05); }
.btn.ghost { background: var(--card-2); color: var(--ink); border-color: var(--line); }
.btn.danger { background: #e35d5d; border-color: #b84343; }

/* ---------- loading ---------- */
.loading {
  position: fixed; inset: 0; z-index: 50; display: grid; place-items: center;
  background: linear-gradient(180deg, #5ec2f2 0%, #bdeaff 55%, #ffe9b0 100%); transition: opacity .5s;
}
.loading.done { opacity: 0; pointer-events: none; }
.loading-card { text-align: center; font-size: 17px; font-weight: 600; }
.loading-pets { font-size: 44px; animation: bob 1s infinite; margin-bottom: 8px; }
.loading .bar { width: 220px; height: 10px; background: #fff; border-radius: 5px; margin: 12px auto 0; overflow: hidden; }
.loading .bar i { display: block; height: 100%; width: 0; background: var(--accent); transition: width .2s; }

/* ---------- mobile ---------- */
@media (max-width: 760px) {
  .hud { top: 8px; left: 8px; right: 8px; }
  .brand { font-size: 14px; padding: 6px 12px 6px 8px; }
  .brand b { display: none; }
  .coins { font-size: 15px; padding: 6px 12px; min-width: 70px; }
  .icon-btn { width: 36px; height: 36px; font-size: 15px; }
  .pet-list { top: 56px; left: 4px; width: 66px; max-height: calc(100% - 64px); }
  .pet-card { width: 64px; }
  .pc-av { width: 44px; height: 44px; }
  .pc-name { max-width: 64px; font-size: 10.5px; padding: 1px 5px; }
  .pc-group { font-size: 9.5px; padding: 1px 5px; }
  .pet-card:hover .pc-av { transform: none; }
  .care-top { gap: 8px; }
  .care-avatar { width: 44px; height: 44px; }
  .cb-av { width: 56px; height: 56px; }
  .care-name { font-size: 16px; }
  .care-stats { gap: 4px 12px; margin: 8px 0; }
  .stat .sl { display: none; }
  .hint { display: none; }
  .toasts { top: 104px; }
}

/* ============================================================
   v2: modes, abilities, throw pad, photo, night, safe areas
   ============================================================ */
body.night .hint, body.night .brand, body.night .coins, body.night .icon-btn, body.night .mode-chip { box-shadow: 0 6px 18px rgba(0,0,0,.35); }

.hud { top: max(12px, env(safe-area-inset-top)); left: max(16px, env(safe-area-inset-left)); right: max(16px, env(safe-area-inset-right)); }
.mode-chip {
  display: flex; align-items: center; gap: 4px; height: 42px; padding: 0 14px;
  background: var(--card); border-radius: 999px; box-shadow: var(--shadow); font-size: 15px;
}
.mode-chip:active { transform: scale(.95); }

/* ---------- places (docs/PLACES.md): 🚪 ไปไหนดี picker, 🦮 collar, pets at home / in the other area ---------- */
.place-list { display: flex; flex-direction: column; gap: 8px; }
.place-card {
  display: flex; align-items: center; gap: 12px; text-align: left; width: 100%;
  background: var(--card-2); border: 2px solid var(--line); border-radius: 16px; padding: 10px 14px;
}
.place-card .pl-e { font-size: 30px; line-height: 1; }
.place-card .pl-body { display: flex; flex-direction: column; min-width: 0; }
.place-card b { font-size: 16px; }
.place-card small { color: var(--muted); font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; }
.place-card:not(:disabled):active { transform: scale(.98); }
.place-card.here { border-color: var(--accent); background: #fff1e8; opacity: 1; }
.act-chip.collar-chip.on { background: #ffe3dc; border-color: var(--accent); color: var(--accent-dark); }
.pet-card .pc-where { position: absolute; bottom: -5px; right: -7px; font-size: 13px; }
.pet-card .pc-where:empty { display: none; }
/* a pet not in the area this device looks at (the other home area, left at home, in another world): only its picture
   is dimmed — the status ring, badges and name stay clear (owner 2026-09-27) */
.pet-card.elsewhere img { filter: grayscale(.6) opacity(.65); }
#toy-pet { background: #eaf7ee; border-color: #9fd6b0; }
/* ✨ thriving (docs/ECONOMY.md): the only coin income */

.tag.wild .name { background: #fff3c4; border: 1px dashed #e8b949; }
/* another player's pet in a shared world (docs/WORLDS_PROTOCOL.md): "ชื่อ · ของ <owner>" */
.tag.foreign .name { background: rgba(236, 244, 255, .92); color: #3c5a86; font-weight: 600; }
.tag.foreign.sel .name { background: #5b86c4; color: #fff; }
.pet-card.foreign { opacity: .85; }
.pet-card.foreign .pc-name { color: #3c5a86; }

/* care panel additions */
.care-top .mini { align-self: flex-start; }
.care-traits { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-top: 10px; }
.care-acts { display: flex; gap: 6px; }
.act-chip {
  font-size: 12px; font-weight: 700; padding: 4px 10px; border-radius: 999px;
  background: var(--card-2); border: 2px solid var(--line);
}
.act-chip span { margin-right: 2px; }
.act-chip:active { transform: scale(.95); }
body.carrying .care { display: none; } /* a pet being dragged: nothing in the way */
.trait {
  background: #f3e8ff; color: #6b46b6; font-weight: 700; font-size: 13px;
  padding: 4px 10px; border-radius: 999px;
}
.abilities { display: flex; gap: 6px; flex-wrap: wrap; }
.ab {
  display: flex; align-items: center; gap: 4px; font-size: 12.5px; font-weight: 600;
  background: #eef6ff; color: #2e6aa3; padding: 4px 10px 4px 7px; border-radius: 999px;
  border: 2px solid transparent; transition: transform .12s;
}
.ab .ab-i { font-size: 15px; }
.ab .ab-lv { font-size: 11px; opacity: .75; }
.ab.usable { background: #dff5e6; color: #217a48; border-color: #8ad3a6; animation: glow 1.6s ease-in-out infinite; }
.ab:active { transform: scale(.94); }
@keyframes glow { 50% { box-shadow: 0 0 0 4px rgba(138, 211, 166, .35); } }
.care-bubble {
  position: fixed; right: max(12px, env(safe-area-inset-right)); bottom: max(14px, env(safe-area-inset-bottom)); z-index: 6;
  display: flex; align-items: flex-end; gap: 8px; max-width: calc(100vw - 24px); animation: pop .2s ease;
}
.care-bubble[hidden] { display: none; }
/* the bubble's box spans the whole corner (the 👍/👎 stack is up to 380px wide) — its empty parts let taps through to
   the scene; only what shows takes a tap (owner 2026-10-01: "ขวาล่าง ประมาณ 1/3 ของจอ มันคลิ๊กไม่ได้") */
.care-bubble, .cm-recent, .cm-recent .tr-stack, .cm-pet, .cm-acts { pointer-events: none; }
.care-bubble :is(button, .tr-row, .cm-ill, .cm-love) { pointer-events: auto; }
/* what it did: a stack, newest on top (owner 2026-09-28) — each frame as wide as its words, 👍 ชม / 👎 ดุ in it right
   after them; the frames' right ends line up by the avatar */
.cm-recent {
  min-width: 0; max-width: min(380px, calc(100vw - 132px)); margin-bottom: 18px;
  display: flex; flex-direction: column; align-items: flex-end; gap: 6px;
}
.cm-recent:empty { display: none; }
.cm-recent .tr-stack { align-self: stretch; align-items: flex-end; }
.cm-recent .tr-row { margin: 0; max-width: 100%; background: var(--card); box-shadow: var(--shadow); }
.cm-recent .tr-main { flex: 0 1 auto; }
.cm-recent .tr-row.special { background: linear-gradient(135deg, #fff7dc, #ffecc0); }
/* no result line here: under the stack it would lift every row above it (the pet's reaction shows in the scene) */
.cm-recent .tr-lesson { display: none; }
.cm-pet { display: flex; flex-direction: column; align-items: center; gap: 4px; flex: none; }
/* ✕ deselect, on top of the column (owner 2026-09-28) — as big as the round buttons under it (👒 🎾) and red so it stands out
   (owner 2026-09-30) */
.cm-close {
  flex: none; align-self: flex-end; /* at the right edge, over the icon column (owner 2026-09-29) */ width: 38px; height: 38px; border-radius: 50%; padding: 0;
  display: grid; place-items: center; border: 2px solid #c93b3b;
  background: #e35d5d; color: #fff; font-size: 18px; font-weight: 800; line-height: 1; box-shadow: var(--shadow);
  touch-action: manipulation; -webkit-tap-highlight-color: transparent;
}
.cm-close:hover { background: #d64545; }
.cm-close:active { transform: scale(.92); }
/* the column over the avatar (owner 2026-09-29), bottom up: ℹ️ ข้อมูล (small, right on the avatar) · then round
   icon-only buttons at the right edge (owner 2026-09-29, 2nd round: no words, smaller)
   🦮 ปลอกคอ · 🌳 ไปสวน / 🏠 เข้าบ้าน · 🎾 คาบของเล่นมาให้ · 👒 แต่งตัว */
.cm-acts { display: flex; flex-direction: column; align-items: flex-end; align-self: flex-end; gap: 5px; }
.cm-acts:not(:has(> :not([hidden]))) { display: none; }
/* no pet selected (owner 2026-09-30): only 🎾 คาบของเล่นมาให้ is left of the bubble — alone at the corner */
.care-bubble.bare .cm-recent, .care-bubble.bare .cm-pet > :not(.cm-acts) { display: none; }
.cm-open, .cm-act {
  border-radius: 999px; font-weight: 700; white-space: nowrap;
  background: var(--card); color: var(--accent-dark); border: 2px solid #f4c8b3; box-shadow: var(--shadow);
  touch-action: manipulation; -webkit-tap-highlight-color: transparent;
}
.cm-open { height: 28px; padding: 0 12px; font-size: 13px; }
.cm-act {
  display: grid; place-items: center; width: 38px; height: 38px; padding: 0;
}
.cm-act span { font-size: 19px; line-height: 1; }
.cm-act[hidden] { display: none; }
/* 🦮 green while it wears the collar (the tap takes it off) */
.cm-collar.on { background: #dff5e6; color: #217a48; border-color: #8ad3a6; }
/* ❤️ under its name: its strongest heart bar — the other pet's name, how full (owner 2026-09-29: no owner's name) */
.cm-love {
  max-width: 120px; padding: 2px 8px; border-radius: 999px; font-size: 12px; font-weight: 700; white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis; background: #ffe6ee; color: #c23f6b; border: 2px solid #ffc2d4; box-shadow: var(--shadow);
}
.cm-open:active, .cm-act:active { transform: scale(.95); }
/* 🤒 at the top of the column while sick (owner 2026-09-29): the recovery bar and the care buttons */
.cm-ill {
  display: flex; flex-direction: column; align-items: stretch; gap: 5px; width: 138px; padding: 6px;
  border-radius: 16px; background: #fff1f1; box-shadow: var(--shadow); color: #8f3434;
}
.cm-ill[hidden] { display: none; }
.cm-ill.severe { background: #ffe6e0; }
.cm-ill-bar { display: flex; align-items: center; gap: 4px; font-size: 12px; cursor: pointer; }
.cm-ill-bar .il-bar { min-width: 0; }
.cm-ill-bar b { min-width: 30px; text-align: right; font-weight: 700; }
.cm-ill-ring { font-size: 11px; font-weight: 700; text-align: center; color: #b86a6a; }
.cm-ill-ring.on { color: #2c8a4e; }
.cm-ill-ring:empty { display: none; }
.cm-care {
  height: 38px; padding: 0 8px; border-radius: 999px; font-size: 14.5px; font-weight: 700; white-space: nowrap;
  background: #fff; color: var(--ink); border: 2px solid #f3c6c6; box-shadow: var(--shadow);
  touch-action: manipulation; -webkit-tap-highlight-color: transparent;
}
.cm-care small { font-size: 11px; font-weight: 600; color: var(--accent-dark); }
.cm-care:active:not(:disabled) { transform: scale(.95); }
.cm-care:disabled { opacity: .55; }
.cm-care[hidden] { display: none; }
.cm-care.cm-vet { background: #e8f3ff; color: #1f5f9e; }
.cm-care.cm-vet small { color: #1f5f9e; }
.cm-av {
  display: flex; flex-direction: column; align-items: center; gap: 3px; background: none; border: 0; padding: 0;
  touch-action: manipulation; -webkit-tap-highlight-color: transparent;
}
.cb-av {
  position: relative; display: block; width: 64px; height: 64px; border-radius: 50%;
  border: 4px solid transparent; box-shadow: var(--shadow); /* its ring colour: the status ring rule above (.pc-av, .cb-av) */
}
.cb-av img { width: 100%; height: 100%; object-fit: contain; border-radius: 50%; background: var(--card-2); }
.cb-av {
  background: linear-gradient(var(--card), var(--card)) padding-box,
    conic-gradient(var(--ring, #fff) calc(var(--pct, 100) * 1%), #5f5855 0) border-box;
}
.cb-need { position: absolute; top: -6px; right: -6px; font-size: 18px; animation: bob 1.1s ease-in-out infinite; }
.cb-need:empty { display: none; }
.cb-name {
  max-width: 96px; font-weight: 700; font-size: 12px; padding: 2px 9px; border-radius: 999px; color: #fff;
  background: var(--accent); box-shadow: var(--shadow); overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
/* 🍖 💖 ⚡ 🧼 thin bars left of the name (owner 2026-10-01, main.js paintMiniBars) — narrow for a phone held upright */
/* the bars hang left of the name, outside the column: the avatar and 👍/👎 stay where they were (owner 2026-10-01) */
.cb-row { position: relative; display: flex; }
.cb-bars {
  position: absolute; right: calc(100% + 4px); top: 50%; transform: translateY(-50%); white-space: nowrap;
  display: flex; align-items: center; gap: 3px; padding: 2px 5px; border-radius: 999px;
  background: #fff; box-shadow: var(--shadow);
}
.cb-bars > span { display: flex; align-items: center; gap: 1px; }
.cb-bars > span[hidden] { display: none; }
.cb-bars em { font-style: normal; font-size: 8px; line-height: 1; }
.cb-bars i { display: block; width: 24px; height: 3px; border-radius: 2px; background: #d9d2cc; overflow: hidden; }
.cb-bars b { display: block; height: 100%; border-radius: 2px; }
.cm-av:active .cb-av { transform: scale(.94); }


/* flash + transition veil */
.veil {
  position: fixed; inset: 0; z-index: 55; display: grid; place-items: center;
  background: radial-gradient(circle, #ffd9b8 0%, #ffb88a 100%);
  clip-path: circle(0% at 50% 50%);
}
.veil.close { animation: irisIn .5s ease-in forwards; }
.veil.open { animation: irisOut .5s ease-out forwards; }
@keyframes irisIn { from { clip-path: circle(0% at 50% 50%); } to { clip-path: circle(80% at 50% 50%); } }
@keyframes irisOut { from { clip-path: circle(80% at 50% 50%); } to { clip-path: circle(0% at 50% 50%); } }
.veil-text { font-size: 24px; font-weight: 700; color: #fff; text-shadow: 0 2px 0 rgba(0,0,0,.15); }

/* modals additions */
a.btn { text-decoration: none; display: inline-block; }
.col { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
.col .btn { text-align: center; }
/* ⚙️ ออกจากระบบ at the very bottom of settings (js/auth-ui.js logoutHost) · 🔄 the type-to-confirm reset */
.logout-slot { margin-top: 14px; display: flex; flex-direction: column; }
.reset-word { width: 100%; box-sizing: border-box; font: inherit; font-size: 16px; padding: 10px 12px; margin: 4px 0 12px; border: 2px solid var(--muted); border-radius: 12px; text-align: center; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; }
.chip { background: #eef6ff; color: #2e6aa3; padding: 4px 10px; border-radius: 999px; font-size: 13px; font-weight: 600; }
.pack-head { grid-column: 1 / -1; font-weight: 700; color: var(--muted); font-size: 13px; margin-top: 6px; }
.sp-card { position: relative; }
.sp-card .abil { font-size: 13px; letter-spacing: 2px; }
/* 🌟 a wild visitor: try to adopt it (js/main.js openWild) */
.wild-pic { display: block; width: 132px; height: 132px; margin: 4px auto 0; object-fit: contain; }
/* its sex / habit / abilities, then our pets in the garden, each with 🌟 ไปชวน (owner 2026-09-30) */
.wild-facts { display: flex; flex-direction: column; gap: 8px; align-items: center; margin: 6px 0 2px; }
.wild-abs { display: flex; flex-direction: column; align-items: center; gap: 4px; font-size: 13px; }
.wild-wear { display: flex; flex-direction: column; align-items: center; gap: 2px; text-align: center; }
.wild-wear small { color: var(--muted, #8a7a86); font-size: 12px; line-height: 1.35; }
.wild-h { font-size: 15px; margin: 10px 0 6px; }
.wild-pets { display: flex; flex-direction: column; gap: 6px; max-height: 42vh; overflow-y: auto; }
.wild-pet { display: flex; align-items: center; gap: 10px; padding: 6px 8px; border-radius: 14px; background: #fff8e6; }
.wild-pet .wp-pic { width: 48px; height: 48px; object-fit: contain; flex: none; }
.wild-pet .wp-who { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.wild-pet .wp-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wild-pet .wp-odds { font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 5px; }
.wild-pet .wp-odds::before { content: ''; width: 10px; height: 10px; border-radius: 50%; background: var(--ring, #ccc); flex: none; }
.wild-pet .wp-go { flex: none; padding: 8px 12px; font-size: 14px; }
.wild-pet .wp-go:disabled { opacity: 0.45; filter: grayscale(0.6); }
.wild-none { text-align: center; color: var(--muted); font-size: 14px; margin: 8px 0; }
/* 🏡 our own pets fill the house (js/petcaps.js ownCap — 4 × rooms): why, how many at most, how many now */
.wild-full { margin: 10px 0 2px; padding: 10px 12px; border-radius: 14px; background: #ffecec; border: 2px dashed #f0a0a0; text-align: center; display: flex; flex-direction: column; gap: 4px; }
.wild-full .wf-head { font-size: 16px; color: #c0392b; }
.wild-full p { margin: 0; font-size: 14px; }
.wild-full .wf-now { font-weight: 700; }
.wild-full .wf-tip { font-size: 12px; color: var(--muted); }

/* phones */
@media (max-width: 760px) {
  .desk { display: none; }
  .mode-chip { height: 36px; padding: 0 10px; font-size: 13px; }
  .hud-right { gap: 6px; }
  .care-traits { margin-top: 6px; }
  .ab .ab-n { display: none; }
  .ab { padding: 4px 8px; }
}
@media (max-width: 440px) {
  /* narrow phones: the 🛒 button needs the room — icon-only mode chip, tighter coins */
  .mode-chip b { display: none; }
  .coins { min-width: 0; padding: 6px 10px; }
  .hud-right { gap: 5px; }
  .hud { left: max(10px, env(safe-area-inset-left)); right: max(10px, env(safe-area-inset-right)); }
  .icon-btn { width: 34px; height: 34px; }
}
@media (max-width: 380px) {
  .brand:has(.net-pill:not([hidden])) .logo { display: none; }
  .brand:has(.net-pill:not([hidden])) { padding: 6px 8px; }
  .icon-btn { width: 32px; height: 32px; font-size: 14px; }
  .hud-right { gap: 4px; }
}
@media (min-width: 761px) and (max-width: 800px) and (min-height: 501px) { .brand b { display: none; } }
/* phone held sideways: very little height, keep everything compact */
@media (max-height: 500px) and (orientation: landscape) {
  .hud { top: max(6px, env(safe-area-inset-top)); }
  .brand b { display: none; }
  .pet-list { top: 52px; left: max(4px, env(safe-area-inset-left)); width: 60px; max-height: calc(100% - 58px); gap: 4px; }
  .pet-card { width: 58px; }
  .pc-av { width: 38px; height: 38px; border-width: 3px; }
  .pc-name { max-width: 58px; font-size: 10px; }
  .pc-group { font-size: 9px; padding: 1px 4px; }
  .cm-ill { width: 124px; gap: 3px; padding: 4px 5px; }
  .cm-care { height: 28px; font-size: 12.5px; }
  .care-top { gap: 6px; }
  .care-avatar { width: 36px; height: 36px; border-radius: 10px; }
  .cm-pet, .cm-acts { gap: 3px; }
  /* ✕ beside the column's top, not on it: a sick pet's column needs the whole height */
  .cm-pet { position: relative; }
  .cm-close { position: absolute; top: 0; left: -32px; width: 26px; height: 26px; font-size: 12px; }
  .cm-act { width: 30px; height: 30px; }
  .cm-act span { font-size: 15px; }
  .cb-av { width: 48px; height: 48px; }
  .care-name { font-size: 13.5px; gap: 2px; }
  .xp { margin-top: 2px; }
  .care-recent { margin-top: 3px; }
  .care-traits { margin-top: 2px; gap: 2px; }
  .care .trait, .care .ab, .care .act-chip { padding: 1px 6px; font-size: 10.5px; }
  .care .ab .ab-i { font-size: 12px; }
  .care-acts { gap: 3px; }
  .care-stats { margin: 2px 0; gap: 1px 8px; }
  .stat { font-size: 11px; gap: 4px; }
  .stat .si { font-size: 12px; width: 14px; }
  .stat .sb { height: 5px; }
  .stat .sl { display: none; }
  .ab .ab-n { display: none; }
  .hint { display: none; }
  .desk { display: none; }
}

/* ============================================================
   accounts: connection pill, offline banner, settings section
   ============================================================ */
.net-pill {
  display: inline-flex; align-items: center; gap: 4px; margin-left: 4px;
  font-size: 12px; font-weight: 700; padding: 3px 9px; border-radius: 999px;
  background: #e9f8ef; color: #217a48; white-space: nowrap;
}
.net-pill[data-st="connecting"] { background: #fff4d6; color: #9a6a00; }
.net-pill[data-st="offline"] { background: #ffe3e3; color: #b84343; }
.net-pill .np-ico { font-size: 10px; }
.net-pill .np-txt { white-space: pre; }
.net-banner {
  position: fixed; top: 64px; left: 50%; transform: translateX(-50%); z-index: 31;
  background: #b84343; color: #fff; font-size: 13px; font-weight: 600;
  padding: 7px 16px; border-radius: 999px; box-shadow: var(--shadow);
  pointer-events: none; white-space: nowrap; max-width: calc(100% - 24px); overflow: hidden; text-overflow: ellipsis;
}
.account-box { margin-top: 12px; padding: 12px; border-radius: 16px; background: var(--card-2); }
.veil.shut { clip-path: circle(80% at 50% 50%); }
.loading .boot-guest { margin-top: 14px; font-size: 14px; }
@media (max-width: 760px) {
  .brand:has(.net-pill:not([hidden])) { padding-right: 8px; }
  .net-pill { margin-left: 0; padding: 2px 6px; gap: 2px; }
  .net-pill .np-txt { display: none; }
  .net-banner { top: 100px; font-size: 12px; }
}
@media (max-height: 500px) and (orientation: landscape) {
  .net-pill .np-txt { display: none; }
  .net-banner { top: 56px; }
}

/* furniture / toy toolbar (floats above the thing, kept on screen: main.js placePopover) — a narrow vertical list with
   small text (owner 2026-09-27: the long row ran off a phone's screen) */
.furn-tools {
  position: fixed; left: 0; top: 0; z-index: 25;
  display: flex; flex-direction: column; align-items: stretch; gap: 4px;
  width: max-content; max-width: min(200px, calc(100vw - 16px));
  background: var(--card); padding: 6px; border-radius: 14px; box-shadow: var(--shadow);
  will-change: transform;
}
.furn-tools .furn-name {
  font-weight: 700; font-size: 12px; line-height: 1.25; padding: 2px 6px; color: var(--muted); text-align: center;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.furn-tools button {
  font-weight: 700; font-size: 12.5px; line-height: 1.2; padding: 6px 10px; border-radius: 10px; text-align: center;
  background: var(--card-2); border-bottom: 3px solid #f3d6bf; white-space: nowrap;
}
/* the lamp's 🔅 ●●●○ 🔆 stay on one line */
.furn-row { display: flex; align-items: center; gap: 4px; }
.furn-row[hidden] { display: none; }
.furn-row button { flex: 1; padding: 6px 0; }
.furn-tools button:active { transform: translateY(1px); border-bottom-width: 1px; }
#toy-throw { background: var(--accent); color: #fff; border-color: var(--accent-dark); }
/* the toy menu's ✕: a small round button on the top right corner */
.toy-menu { padding-top: 8px; }
.toy-menu .toy-close {
  position: absolute; top: -8px; right: -8px; width: 26px; height: 26px; padding: 0; border-radius: 50%;
  font-size: 12px; border-bottom-width: 0; box-shadow: var(--shadow);
}
.aim-bar {
  position: fixed; z-index: 30; left: 50%; transform: translateX(-50%); top: calc(max(12px, env(safe-area-inset-top)) + 58px);
  display: flex; align-items: center; gap: 8px; max-width: calc(100vw - 24px);
  background: var(--accent); color: #fff; font-weight: 700; font-size: 14px; padding: 6px 6px 6px 14px;
  border-radius: 999px; box-shadow: var(--shadow);
}
.aim-bar #aim-cancel { background: rgba(255, 255, 255, .25); color: #fff; width: 30px; height: 30px; border-radius: 50%; flex: none; }
body.aiming #scene { cursor: crosshair; }
.furn-tools .furn-lvl { font-size: 10px; letter-spacing: 1px; color: #f0a830; padding: 0 2px; flex: none; }
/* the light's colour: ⚪ ขาว / 🟡 เหลือง side by side, the one in use filled */
.furn-tint button { padding: 6px 4px; font-size: 12px; }
.furn-tint button.on { background: #fff3c4; border-color: #f0cf5c; box-shadow: inset 0 0 0 2px #f0cf5c; }
.furn-tint #furn-white.on { background: #fff; border-color: #cfd6de; box-shadow: inset 0 0 0 2px #cfd6de; }
.furn-tools button:disabled { opacity: .4; }
/* ความทนทาน (js/wear.js hpLabel): the % over a bar filled to --hp */
.furn-tools .furn-state {
  --hp: 100%; --hpc: #5cb85c;
  font-size: 11px; font-weight: 700; color: var(--muted); text-align: center; padding: 2px 6px 5px; border-radius: 8px;
  background: linear-gradient(var(--hpc), var(--hpc)) no-repeat left bottom / var(--hp) 3px, var(--card-2);
}
.furn-tools .furn-state[hidden] { display: none; }
.furn-tools .furn-state.mid { --hpc: #f0ad4e; }
.furn-tools .furn-state.low { --hpc: #e8763a; color: #c2562a; }
.furn-tools .furn-state.broken { --hpc: #d9534f; color: #d9534f; }
#furn-fix { background: #fff3c4; border-color: #f0cf5c; }

/* ---------- camera buttons (js/view.js) ---------- */
#btn-focus.on { background: var(--accent); color: #fff; }

/* ---------- shop ---------- */
.shop-coins { display: flex; align-items: center; gap: 6px; font-weight: 700; font-size: 16px; }
/* wrap, don't scroll: a hidden-scrollbar strip can't be scrolled with a mouse and the tabs past the edge were unreachable */
.shop-tabs { display: flex; flex-wrap: wrap; gap: 6px; padding-bottom: 4px; }
.shop-tab {
  display: flex; align-items: center; gap: 5px; flex: none;
  background: var(--card-2); padding: 8px 14px; border-radius: 999px;
  font-weight: 700; font-size: 14px;
}
.shop-tab .st-e { font-size: 16px; }
.shop-tab.on { background: var(--accent); color: #fff; }
.shop-tab.off { opacity: .4; cursor: not-allowed; } /* 🎒 a tab that doesn't work here (ของ in a public place) */
.shop-tab .st-badge {
  background: var(--accent-dark); color: #fff; font-size: 11px; min-width: 17px; height: 17px;
  border-radius: 999px; display: inline-grid; place-items: center; padding: 0 4px;
}
.shop-tab.on .st-badge { background: rgba(255, 255, 255, .3); }

.shop-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 10px; margin-top: 12px; }
.shop-card {
  display: flex; flex-direction: column; align-items: center; gap: 4px; text-align: center;
  background: #fff; border: 2px solid var(--line); border-radius: 18px; padding: 10px 8px;
}
.sc-pic { width: 64px; height: 64px; display: grid; place-items: center; font-size: 34px; background: var(--card-2); border-radius: 14px; }
.sc-pic img { width: 100%; height: 100%; object-fit: contain; }
.sc-body { display: flex; flex-direction: column; gap: 1px; }
.sc-body b { font-size: 14px; }
.sc-body small { color: var(--muted); font-size: 11px; line-height: 1.3; }
.sc-price { color: var(--accent-dark); font-weight: 700; font-size: 13px; }
.sc-own { color: var(--muted); font-size: 12px; }
/* the third wave: who a piece is special to (js/shop.js fansLine) */
.sc-fans { display: flex; flex-wrap: wrap; align-items: center; gap: 3px; font-size: 11px; color: var(--muted); margin: 2px 0; }
.sc-fans i { font-style: normal; background: #eef7ff; color: #2f6ea3; border-radius: 8px; padding: 1px 6px; }
.sc-fans em { font-style: normal; background: #fff4cf; color: #9a6a00; border-radius: 8px; padding: 1px 6px; font-weight: 700; }
.sc-buy {
  width: 100%; margin-top: 4px; background: var(--accent); color: #fff; font-weight: 700;
  padding: 7px; border-radius: 999px; border-bottom: 3px solid var(--accent-dark); font-size: 13px;
}
.sc-buy:disabled { background: var(--card-2); color: var(--muted); border-color: var(--line); }
.shop-empty { grid-column: 1 / -1; text-align: center; color: var(--muted); font-size: 14px; padding: 30px 10px; }

/* bowl menu: popover that floats above the tapped bowl, like .furn-tools
   .bm-foods is a fixed 4-col grid (not a horizontal scroller) so every food is reachable without swiping;
   if it ever grows taller than the screen, .bowl-menu itself scrolls with a normal (visible) scrollbar,
   and its max-height keeps the whole popover — not just the food list — inside the viewport. */
.bm-dump { display: block; width: 100%; margin: 0 0 8px; padding: 7px 10px; border-radius: 12px; font-weight: 700; font-size: 13px; background: #fff0ee; color: #c2410c; border: 1.5px solid #f7c4b8; }
.bm-dump:hover { background: #ffe1da; }
.bowl-menu {
  position: fixed; left: 0; top: 0; z-index: 26; width: min(320px, calc(100vw - 24px));
  max-height: calc(100vh - 16px); max-height: calc(100dvh - 16px); overflow-y: auto; -webkit-overflow-scrolling: touch;
  background: var(--card); border-radius: 20px; padding: 10px 12px 12px; box-shadow: var(--shadow);
  will-change: transform;
}
.bm-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.bm-title { font-weight: 700; font-size: 15px; }
.bm-status { margin: 4px 0 8px; font-size: 12.5px; color: var(--muted); }
.bm-foods { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
.bm-food {
  min-height: 44px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px;
  background: #fff; border: 2px solid var(--line); border-radius: 14px; padding: 8px 3px; font-size: 11px; font-weight: 600;
}
.bm-food:hover:not(:disabled) { border-color: var(--accent); }
.bm-food .bf-e { font-size: 22px; width: 30px; height: 30px; display: grid; place-items: center; }
.bm-food .bf-e img { width: 100%; height: 100%; object-fit: contain; }
.bm-food .bf-p { color: var(--accent-dark); }
.bm-food .bf-note { color: var(--muted); font-size: 9.5px; line-height: 1.2; white-space: normal; }

@media (max-width: 760px) {
  .shop-grid { grid-template-columns: repeat(auto-fill, minmax(108px, 1fr)); gap: 8px; }
  .sc-pic { width: 52px; height: 52px; font-size: 28px; }
}
@media (max-height: 500px) and (orientation: landscape) {
  #shop-modal .sheet { max-height: calc(100% - 16px); padding: 12px 14px; }
  .shop-tabs { gap: 4px; }
  .shop-tab { padding: 5px 11px; font-size: 13px; }
  .shop-grid { grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 6px; margin-top: 8px; }
  .sc-pic { width: 44px; height: 44px; font-size: 22px; }
  .sc-body b { font-size: 12px; }
  .sc-body small, .bm-food .bf-note { display: none; }
  /* .bowl-menu's own max-height + overflow-y (base rule) is the only scroll fallback needed here —
     an inner max-height on .bm-foods used to force a scrollbar even for the normal 8-food/2-row case */
  .bowl-menu { padding: 8px 10px 10px; width: min(300px, calc(100vw - 16px)); max-height: calc(100vh - 12px); max-height: calc(100dvh - 12px); }
  .bm-food { min-height: 40px; padding: 6px 3px; }
}

/* ---------- development (พัฒนาการ: weight / fitness / speed / sickness — js/dev.js) — lives in #detail-modal ---------- */
.care-dev {
  display: flex; align-items: center; flex-wrap: wrap; gap: 4px 12px;
  margin: 4px 0 14px; font-size: 12.5px;
}
.care-dev .dv { display: flex; align-items: center; gap: 4px; white-space: nowrap; min-width: 0; }
.care-dev .dv b { font-weight: 700; }
.dv-bar { position: relative; width: 56px; height: 8px; border-radius: 4px; background: var(--line); overflow: hidden; }
/* weight: a marker on a bar whose green middle is the healthy 40–60 zone */
.dv-bar.w { overflow: visible; background: linear-gradient(90deg, #ffe0cc 0 40%, #bfe8cf 40% 60%, #ffd0c2 60% 100%); }
.dv-bar.w i { position: absolute; top: -2px; left: 50%; width: 4px; height: 12px; margin-left: -2px; border-radius: 2px; background: var(--ink); transition: left .3s; }
.dv-bar.fit i { display: block; height: 100%; width: 0; border-radius: 4px; background: linear-gradient(90deg, #7fd6a4, #2fa36b); transition: width .3s; }
.dv-spd small { color: var(--muted); font-size: 11.5px; overflow: hidden; text-overflow: ellipsis; max-width: 130px; }
.dv-spd small:empty { display: none; }
.care-dev.sick .dv-spd b { color: #b84343; }
@media (max-width: 760px) {
  .dv-spd small { max-width: 80px; }
}

/* ---------- รายละเอียด sheet (docs/CARE_PANEL.md): exact numbers the compact panel no longer shows ---------- */
.dt-body { display: flex; flex-direction: column; }
.dt-info { display: flex; flex-direction: column; gap: 6px; margin: 2px 0 12px; }
.dt-line { margin: 0; font-size: 13.5px; line-height: 1.6; }
.dt-line.muted { color: var(--muted); }
.dt-h { margin: 4px 0 8px; font-size: 13px; font-weight: 700; color: var(--muted); }
/* 💬 คำพูดย้อนหลัง · 👍 ชม/ดุย้อนหลัง (owner 2026-09-30) */
.dt-logs { display: flex; gap: 8px; margin: 4px 0 12px; }
.dt-logs .btn { flex: 1; min-width: 0; padding: 8px 10px; font-size: 13.5px; white-space: nowrap; }
.said-sub { margin: 2px 2px 8px; font-size: 12.5px; }
.said-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.said-item { display: flex; align-items: baseline; gap: 8px; padding: 6px 10px; border-radius: 12px; background: var(--card-2); font-size: 14px; line-height: 1.5; }
.said-text { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.said-age { flex: none; font-size: 11.5px; color: var(--muted); white-space: nowrap; }
.said-empty { padding: 16px 6px; text-align: center; color: var(--muted); font-weight: 600; }
#rename-modal { z-index: 41; } /* ✏️ from inside the ℹ️ sheet: on top of it */
.dt-release { color: #b84343; border-color: #f3c6c6; width: 100%; }
/* Detail tabs and read-only learning cards (js/development-ui.js). Keep navigation
   outside the scroll area, including on a short landscape phone. */
#detail-modal .sheet { display: flex; flex-direction: column; overflow: hidden; max-height: calc(100dvh - 48px); }
#detail-modal .sheet-head { flex: none; gap: 12px; }
#detail-modal .sheet-head h2 { min-width: 0; overflow-wrap: anywhere; font-size: 20px; line-height: 1.45; }
#detail-modal .sheet-head .close { width: 40px; height: 40px; }
#detail-modal .dt-body { min-height: 0; overflow-y: auto; overscroll-behavior: contain; overflow-anchor: none; padding: 2px 3px 4px; }
.dt-tabs { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); flex: none; gap: 4px; padding: 4px; margin: 12px 0; border-radius: 15px; background: var(--card-2); }
.dt-tabs button { min-height: 42px; padding: 7px 4px; border-radius: 11px; font-size: 14px; font-weight: 700; }
.dt-tabs button[aria-selected="true"] { background: #fff; color: #a63f1e; box-shadow: 0 2px 6px rgba(120, 70, 40, .1); }
.dt-tabs button:focus-visible, .dt-panel:focus-visible, .dt-skill summary:focus-visible, .dt-lessons-toggle:focus-visible, #dt-lessons-title:focus-visible, #detail-modal .close:focus-visible { outline: 2px solid var(--accent-dark); outline-offset: 2px; }
.dt-panel { flex: none; min-width: 0; }
.dt-bond { display: flex; flex-wrap: wrap; align-items: center; gap: 3px 10px; padding: 10px 13px; margin-bottom: 9px; border-radius: 17px; background: #fff0eb; }
.dt-bond-icon { font-size: 25px; }
.dt-bond > div { flex: 1; min-width: 0; }
.dt-bond h3 { margin: 0 0 3px; font-size: 13px; color: #99503c; }
.dt-bond p { margin: 0; font-size: 15px; font-weight: 700; line-height: 1.5; }
.dt-progress { display: block; height: 5px; border-radius: 5px; background: var(--line); overflow: hidden; }
.dt-progress i { display: block; height: 100%; border-radius: inherit; background: #82bda0; }
.dt-bond-progress { flex-basis: 100%; margin-top: 5px; background: #f7d9cf; }
.dt-bond-progress i { background: #e88e8e; }
.dt-readiness { margin: 0 2px 12px; font-size: 13px; color: #79675a; line-height: 1.6; }
.dt-personality { margin: 0 2px 12px; font-size: 13px; line-height: 1.7; overflow-wrap: anywhere; }
.dt-skills { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; gap: 10px; }
.dt-skill { min-width: 0; border: 1px solid var(--line); border-radius: 16px; background: #fff; }
.dt-skill summary { position: relative; display: block; padding: 12px; cursor: pointer; border-radius: 15px; list-style: none; }
.dt-skill summary::-webkit-details-marker { display: none; }
.dt-skill summary::after { content: '⌄'; position: absolute; top: 10px; right: 12px; color: #79675a; font-weight: 700; }
.dt-skill[open] summary::after { content: '⌃'; }
.dt-skill-heading { display: grid; grid-template-columns: 20px minmax(0, 1fr); align-items: start; gap: 6px; padding-right: 12px; margin-bottom: 10px; }
.dt-skill-icon { font-size: 19px; line-height: 1.2; }
.dt-skill-title { font-size: 13px; font-weight: 700; line-height: 1.6; overflow-wrap: anywhere; }
.dt-stage { font-size: 11px; color: #346b4a; background: #eaf4ec; border-radius: 7px; padding: 2px 6px; }
.dt-skill-heading .dt-stage { grid-column: 1 / -1; justify-self: start; }
.dt-skill-summary { display: block; font-size: 13px; line-height: 1.65; margin: 7px 0 10px; overflow-wrap: anywhere; }
.dt-skill-more { border-top: 1px solid var(--line); padding: 9px 12px 12px; font-size: 12.5px; line-height: 1.65; }
.dt-skill-more p { margin: 0 0 7px; overflow-wrap: anywhere; }
.dt-skill-more p:last-child { margin-bottom: 0; }
.dt-skill-more strong { font-weight: 700; }
.dt-skill-value { font-size: 11.5px; color: #79675a; }
.dt-dev-section { margin-top: 20px; }
.dt-dev-section h3 { margin: 0 0 9px; font-size: 14px; }
.dt-dev-section h3 small { display: block; margin-top: 2px; font-size: 11.5px; color: #79675a; font-weight: 400; }
.dt-dev-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 9px; }
.dt-dev-list li { display: flex; gap: 9px; align-items: flex-start; font-size: 13px; line-height: 1.55; }
.dt-list-icon { flex: none; width: 20px; text-align: center; }
.dt-list-body { min-width: 0; overflow-wrap: anywhere; }
.dt-list-body > span { display: block; }
.dt-list-body small { display: block; font-size: 11.5px; color: #79675a; margin-top: 2px; }
.dt-dev-list .dt-lesson { padding: 10px 11px; gap: 8px; border: 1px solid var(--line); border-radius: 13px; background: #fff; }
.dt-lesson .dt-list-icon { font-size: 17px; line-height: 1.4; }
.dt-lesson .dt-list-body { flex: 1; }
.dt-lesson-label { font-weight: 700; }
.dt-lesson-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 3px 8px; margin-top: 5px; }
.dt-lesson-meta small { margin: 0; }
.dt-list-body .dt-lesson-enjoyment { margin-top: 5px; color: #906445; }
.dt-lessons-toggle { display: block; min-height: 40px; width: 100%; padding: 7px 12px; margin-top: 6px; border-radius: 10px; color: #99503c; font-size: 12.5px; font-weight: 700; }
.dt-lessons-toggle:hover { background: var(--card-2); }
.dt-empty { margin: 0; color: #79675a; font-size: 12.5px; line-height: 1.7; }
.dt-likes-note { margin-bottom: 12px; }
@media (max-width: 520px) {
  #detail-modal { padding: 10px; }
  #detail-modal .sheet { padding: 14px; max-height: calc(100dvh - 24px); border-radius: 22px; }
  .dt-tabs { margin: 9px 0; }
  .dt-tabs button { font-size: 13px; }
  .dt-skills { gap: 8px; }
  .dt-skill summary { padding: 10px; }
  .dt-skill summary::after { top: 8px; right: 9px; }
  .dt-skill-heading { grid-template-columns: minmax(0, 1fr); gap: 4px; padding-right: 11px; }
  .dt-skill-heading .dt-skill-icon { display: none; }
  .dt-skill-more { padding: 9px 10px 10px; font-size: 12px; }
  .dt-skill[open] { grid-column: 1 / -1; }
}
@media (max-height: 500px) and (orientation: landscape) {
  #detail-modal { padding: 8px; }
  #detail-modal .sheet { max-height: calc(100dvh - 16px); padding: 10px 14px; }
  #detail-modal .sheet-head h2 { font-size: 17px; }
  #detail-modal .sheet-head .close { width: 34px; height: 34px; }
  .dt-tabs { margin: 5px 0 8px; }
  .dt-tabs button { min-height: 36px; padding: 4px; font-size: 13px; }
}

/* ---------- sickness v2 (docs/SICKNESS.md): recovery bar, doses, 💤, the two-step vet — only while sick ---------- */
.care-ill {
  background: #fff1f1; border-radius: 14px; padding: 7px 10px 8px; margin: -4px 0 10px;
  display: flex; flex-direction: column; gap: 6px; font-size: 12.5px; color: #8f3434;
}
.care-ill.severe { background: #ffe6e0; }
.il-row { display: flex; align-items: center; gap: 5px; white-space: nowrap; cursor: pointer; min-width: 0; }
.il-row b { font-weight: 700; }
.il-row small { color: #b86a6a; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.il-bar { position: relative; flex: 1; min-width: 60px; max-width: 180px; height: 10px; border-radius: 5px; background: #f6d3d3; overflow: hidden; }
.il-bar i { position: absolute; left: 0; top: 0; bottom: 0; width: 0; border-radius: 5px; transition: width .3s; }
.il-bar .il-flow { background: #b7e7c8; }                                   /* the dose still flowing in */
.il-bar .il-rec { background: linear-gradient(90deg, #7fd6a4, #2fa36b); }
#ill-pct { min-width: 32px; }
.il-acts { display: flex; align-items: center; flex-wrap: wrap; gap: 5px 6px; }
.il-btn {
  background: #fff; color: var(--ink); font-weight: 700; font-size: 12px;
  padding: 3px 10px; border-radius: 999px; border-bottom: 2px solid #f3c6c6; white-space: nowrap;
}
.il-btn small { color: var(--accent-dark); font-weight: 600; }
.il-btn.il-vet { background: #e8f3ff; color: #1f5f9e; border-bottom-color: #b9d6f3; }
.il-btn.il-care { background: #fff7e6; color: #8a5a00; border-bottom-color: #f1d9a6; } /* 🥄 ป้อนอาหาร · 🤚 ลูบหัว */
.il-ring { margin: 0; font-size: 11.5px; font-weight: 600; color: #b86a6a; }       /* 💚 the ring green: faster */
.il-ring.on { color: #2c8a4e; }
.il-btn.il-vet small { color: #1f5f9e; }
.il-btn:active:not(:disabled) { transform: translateY(1px); border-bottom-width: 1px; }
.il-btn:disabled { opacity: .5; }
.il-wait, .il-sev, .il-treat { font-weight: 700; white-space: nowrap; padding: 3px 4px; }
.il-wait { color: #9a6a00; font-variant-numeric: tabular-nums; }
.il-sev { color: #1f5f9e; }
.il-treat { color: #1f5f9e; font-variant-numeric: tabular-nums; }
@media (max-width: 760px) {
  .care-ill { margin: -2px 0 8px; padding: 6px 8px 7px; gap: 5px; font-size: 12px; }
}
@media (max-height: 500px) and (orientation: landscape) {
  .care-ill { margin: -2px 0 6px; padding: 5px 8px 6px; gap: 4px; font-size: 11.5px; }
  .il-bar { height: 8px; }
  .il-btn { padding: 2px 7px; font-size: 11.5px; }
}

/* ---------- 💤 a newborn's hatch bar · ❤️ the strongest heart bar (docs/BREEDING.md §2, js/love.js) ---------- */
.care-hatch {
  display: flex; align-items: center; gap: 6px; white-space: nowrap; min-width: 0;
  background: #fff0f5; border-radius: 14px; padding: 7px 10px; margin: -4px 0 10px; font-size: 12.5px; color: #9a3f63;
}
.care-hatch b { font-weight: 700; }
.care-hatch small { color: #b8668a; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.hatch-bar { position: relative; flex: 1; min-width: 60px; max-width: 180px; height: 10px; border-radius: 5px; background: #ffd9e6; overflow: hidden; }
.hatch-bar i { position: absolute; left: 0; top: 0; bottom: 0; width: 0; border-radius: 5px; background: linear-gradient(90deg, #ffb3cb, #ff6f91); transition: width .3s; }
#hatch-pct { min-width: 32px; }
.care.newborn .care-acts, .care.newborn .abilities { display: none; } /* it only sleeps: nothing to ask of it yet */
.love-note { color: #b0456f; font-size: 11.5px; font-weight: 600; line-height: 1.5; margin: 3px 0 5px; cursor: pointer; }
@media (max-width: 760px) {
  .care-hatch { margin: -2px 0 8px; padding: 6px 8px; font-size: 12px; }
}

/* ---------- sky ----------
   #sky (index.html, first child of body, below #scene) cross-fades 3 full-bleed gradient
   layers by opacity. js/engine.js applyDaylight() sets --sky-day/--sky-dusk/--sky-night
   (0..1) on #sky every ~30s; the transition here is what makes that a smooth fade. */
#sky {
  position: fixed; inset: 0; overflow: hidden; pointer-events: none;
  --sky-day: 1; --sky-dusk: 0; --sky-night: 0;
}
#sky > div { position: absolute; inset: 0; }

.sky-day {
  /* vivid but soft sky-blue, warm glow near the ground */
  background: linear-gradient(180deg, #4fb6f2 0%, #8adcf6 35%, #d9f6ff 65%, #ffe7ab 100%);
}
body[data-mode="garden"] .sky-day, body[data-out="1"] .sky-day {
  background: linear-gradient(180deg, #4fb6f2 0%, #8adcf6 35%, #ddf8e0 65%, #eaffb6 100%);
}
body[data-mode="beach"] .sky-day {
  background: linear-gradient(180deg, #3fb0f0 0%, #7fd8f7 35%, #d6f7ff 65%, #fff1c2 100%);
}
.sky-dusk {
  /* warm sunset/sunrise, fades in and back out around the dawn/dusk ramps */
  background: linear-gradient(180deg, #423a7a 0%, #a8558f 30%, #ff7d6b 55%, #ffb37a 78%, #ffe0a3 100%);
  opacity: var(--sky-dusk);
  transition: opacity 3.5s ease;
}
.sky-night {
  /* friendly lighter indigo/violet, never near-black */
  background: linear-gradient(180deg, #232a6b 0%, #4b3f92 45%, #7a5aa8 80%, #b481b8 100%);
  opacity: var(--sky-night);
  transition: opacity 3.5s ease;
}
.sky-clouds { opacity: var(--sky-day); transition: opacity 3.5s ease; }

.cloud {
  position: absolute; border-radius: 50%;
  background: radial-gradient(ellipse at center, rgba(255,255,255,.95) 0%, rgba(255,255,255,.6) 55%, rgba(255,255,255,0) 78%);
  animation: sky-drift linear infinite;
}
.cloud.c1 { width: 200px; height: 50px; top: 12%; left: -25%; animation-duration: 100s; }
.cloud.c2 { width: 140px; height: 36px; top: 24%; left: -35%; animation-duration: 135s; animation-delay: -45s; }
.cloud.c3 { width: 110px; height: 30px; top: 8%; left: -20%; animation-duration: 80s; animation-delay: -20s; }
@keyframes sky-drift { from { transform: translateX(0); } to { transform: translateX(150vw); } }

.sky-moon {
  position: absolute; top: 12%; right: 16%; width: 52px; height: 52px; border-radius: 50%;
  background: radial-gradient(circle at 36% 34%, #fffef2 0%, #fff3c2 55%, #ffe38f 100%);
  box-shadow: 0 0 28px 10px rgba(255, 240, 180, .4);
}
.sky-stars {
  animation: sky-twinkle 4s ease-in-out infinite alternate;
}
.sky-stars.a {
  background-image:
    radial-gradient(1.6px 1.6px at 10% 18%, #fff, transparent),
    radial-gradient(1.4px 1.4px at 22% 42%, #fff, transparent),
    radial-gradient(1.8px 1.8px at 35% 12%, #fff, transparent),
    radial-gradient(1.3px 1.3px at 48% 30%, #fff, transparent),
    radial-gradient(1.6px 1.6px at 62% 8%, #fff, transparent),
    radial-gradient(1.4px 1.4px at 75% 36%, #fff, transparent),
    radial-gradient(1.7px 1.7px at 85% 15%, #fff, transparent),
    radial-gradient(1.3px 1.3px at 92% 46%, #fff, transparent);
}
.sky-stars.b {
  animation-delay: -2s;
  background-image:
    radial-gradient(1.3px 1.3px at 16% 30%, #fff, transparent),
    radial-gradient(1.5px 1.5px at 30% 22%, #fff, transparent),
    radial-gradient(1.3px 1.3px at 42% 45%, #fff, transparent),
    radial-gradient(1.6px 1.6px at 56% 18%, #fff, transparent),
    radial-gradient(1.4px 1.4px at 70% 40%, #fff, transparent),
    radial-gradient(1.7px 1.7px at 80% 25%, #fff, transparent),
    radial-gradient(1.3px 1.3px at 95% 32%, #fff, transparent);
}
@keyframes sky-twinkle { from { opacity: .35; } to { opacity: 1; } }

@media (prefers-reduced-motion: reduce) {
  .cloud, .sky-stars.a, .sky-stars.b { animation: none; opacity: .8; }
}

/* ---------- ครอบครัว tab · 🍼 born (js/family-ui.js, docs/BREEDING.md) ---------- */
.dt-tabs:has(#dt-tab-family) { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.dt-family { display: flex; flex-direction: column; gap: 10px; }
.fam-card { padding: 10px 13px; border-radius: 17px; background: #fff; border: 1px solid var(--line); }
.fam-card:empty { display: none; }
.fam-card .dt-h { margin: 0 0 6px; }
.fam-card h4 { margin: 8px 0 3px; font-size: 12.5px; color: var(--muted); }
.fam-big { margin: 0 0 6px; font-size: 15px; font-weight: 700; line-height: 1.5; }
.fam-muted { color: var(--muted); }
.fam-soon { color: #8a5aa8; font-weight: 600; }
.fam-why { color: #b0603b; font-weight: 600; }
.fam-card a { color: var(--accent-dark); }
.fam-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.fam-sex { font-size: 15px; }
.fam-sex.f { color: #d05a8a; }
.fam-sex.m { color: #3f7fc9; }
.fam-btn {
  padding: 7px 12px; border-radius: 14px; font-weight: 700; font-size: 13.5px;
  background: linear-gradient(135deg, #ff9ab8, #ff7a90); color: #fff; box-shadow: 0 2px 6px rgba(200, 80, 110, .25);
}
.fam-btn.off { background: var(--card-2); color: var(--ink); box-shadow: none; border: 1px solid var(--line); }
.fam-btn.sex-f { background: #ffe1ec; color: #b8456f; box-shadow: none; }
.fam-btn.sex-m { background: #deecff; color: #2f68ad; box-shadow: none; }
/* the life stages: a bar of the five stages, a mark where it is (never its last day) */
.fam-stages { position: relative; display: flex; height: 9px; margin: 2px 0 8px; border-radius: 5px; overflow: visible; background: var(--line); }
.fam-stages i { display: block; height: 100%; opacity: .45; }
.fam-stages i.on { opacity: 1; }
.fam-stages i:first-child { border-radius: 5px 0 0 5px; }
.fam-stages i:last-of-type { border-radius: 0 5px 5px 0; }
.fam-stages .st-baby { background: #ffd1dc; } .fam-stages .st-teen { background: #ffe08a; } .fam-stages .st-adult { background: #9bd65a; }
.fam-stages .st-senior { background: #f0b27a; } .fam-stages .st-elder { background: #b9a6dd; }
.fam-stages b { position: absolute; top: -4px; width: 5px; height: 17px; margin-left: -2px; border-radius: 3px; background: var(--ink); }
.fam-progress { height: 7px; border-radius: 4px; background: var(--line); overflow: hidden; margin: 0 0 4px; }
.fam-progress i { display: block; height: 100%; background: linear-gradient(90deg, #ff9ab8, #ff6f91); transition: width .3s; }
.love-list { list-style: none; margin: 4px 0 6px; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.love-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(70px, 1.3fr) auto; align-items: center; gap: 2px 8px; font-size: 13px; }
.love-who { display: flex; flex-direction: column; min-width: 0; }
.love-who b, .love-who small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.love-who small { color: var(--muted); font-size: 11.5px; }
.love-bar { height: 9px; border-radius: 5px; background: #ffe1ea; overflow: hidden; }
.love-bar i { display: block; height: 100%; background: linear-gradient(90deg, #ff9ab8, #ff4f7e); transition: width .3s; }
.love-v { font-variant-numeric: tabular-nums; min-width: 38px; text-align: right; }
.bond-bar { background: #fff1cc; }
.bond-bar i { background: linear-gradient(90deg, #ffd66b, #ffad1f); }
.love-trend { grid-column: 2 / 4; font-size: 11px; color: var(--muted); }
.love-trend:empty { display: none; }
.love-trend.up { color: #d0507a; font-weight: 700; }
.fam-mates { list-style: none; margin: 0 0 4px; padding: 0; display: flex; flex-direction: column; gap: 3px; font-size: 12.5px; }
.fam-genes { list-style: none; margin: 0 0 4px; padding: 0; display: flex; flex-direction: column; gap: 3px; font-size: 13px; }
.fam-genes li { display: flex; flex-wrap: wrap; gap: 2px 8px; align-items: baseline; }
.fam-genes li span { width: 88px; color: var(--muted); flex: none; }
.fam-genes li small { color: var(--muted); }
.birth-list { display: flex; flex-direction: column; gap: 10px; }
.birth-card { display: flex; gap: 10px; align-items: center; padding: 8px 10px; border-radius: 18px; background: #fff; border: 2px solid #ffd6e2; }
.birth-card img { width: 72px; height: 72px; object-fit: contain; flex: none; }
.birth-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.birth-info small { font-size: 12px; line-height: 1.45; }
.birth-info input { margin-top: 3px; padding: 6px 10px; border-radius: 12px; border: 2px solid var(--line); font: inherit; font-size: 14px; }
.pet-card.foster { opacity: .75; }
.fam-tree-btn { margin-top: 6px; }
@media (max-width: 420px) {
  .dt-tabs button { font-size: 12px; }
}

/* ---------- 🌳 the family tree (js/family-ui.js · js/familytree.js) ----------
   grandparents → parents → their babies (it among them) → its own babies by the other parent. The lines are borders
   of the rows themselves (an org chart): no measuring, any number of brothers / sisters; wider than the screen = the
   tree scrolls sideways (opened with it in the middle). */
.ft-sheet { width: min(780px, 100%); }
.ft-scroll { overflow-x: auto; overflow-y: hidden; margin: 0 -12px; padding: 2px 0 8px; overscroll-behavior-x: contain; }
.ft-tree {
  --nw: 78px; --gap: 6px; --tl: #e3c4b1; --drop: 16px;
  display: flex; flex-direction: column; align-items: center; width: max-content; min-width: 100%; padding: 4px 12px; box-sizing: border-box;
}
.ft-node {
  position: relative; z-index: 1; width: var(--nw); box-sizing: border-box; display: flex; flex-direction: column; align-items: center;
  gap: 1px; padding: 4px 3px 6px; border-radius: 16px; background: #fff; border: 2px solid var(--line); color: var(--ink);
  font: inherit; text-align: center; line-height: 1.25;
}
button.ft-node { cursor: pointer; transition: transform .12s, border-color .12s; }
button.ft-node:hover { border-color: #ffb3c7; transform: translateY(-1px); }
.ft-node img, .ft-node .ft-q { width: 46px; height: 46px; object-fit: contain; }
.ft-node .ft-q { display: grid; place-items: center; font-size: 22px; font-weight: 700; color: var(--muted); }
.ft-rel { font-size: 11px; font-weight: 700; color: #b0603b; }
.ft-name { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12.5px; }
.ft-meta { display: flex; gap: 3px; justify-content: center; font-size: 11px; }
.ft-meta .f { color: #d05a8a; font-weight: 700; }
.ft-meta .m { color: #3f7fc9; font-weight: 700; }
.ft-where, .ft-gen { font-size: 10.5px; color: var(--muted); }
.ft-gen { font-weight: 700; color: #b0603b; }
.ft-node.gone { opacity: .55; filter: grayscale(.6); border-style: dashed; }
.ft-node.empty { opacity: .5; border-style: dashed; }
.ft-node.small img, .ft-node.small .ft-q { width: 38px; height: 38px; }
.ft-node.me { width: calc(var(--nw) + 16px); border-color: #ff9ab8; background: #fff6f9; box-shadow: 0 3px 10px rgba(255, 122, 144, .25); }
.ft-node.me img { width: 58px; height: 58px; }
/* ปู่ ย่า over พ่อ · ตา ยาย over แม่: fixed-width columns, so the brackets meet the middle of each face */
.ft-anc { position: relative; display: grid; grid-template-columns: repeat(2, calc(var(--nw) * 2 + var(--gap))); column-gap: 18px; align-items: end; padding-bottom: var(--drop); }
.ft-side { display: flex; flex-direction: column; align-items: center; }
.ft-gps { position: relative; display: flex; gap: var(--gap); padding-bottom: 18px; }
.ft-gps::after { content: ''; position: absolute; left: calc(var(--nw) / 2); right: calc(var(--nw) / 2); bottom: 8px; height: 10px; border: 2px solid var(--tl); border-top: 0; border-radius: 0 0 10px 10px; }
.ft-gps::before { content: ''; position: absolute; left: 50%; bottom: 0; height: 8px; border-left: 2px solid var(--tl); }
.ft-origin { margin-bottom: 6px; font-size: 11px; color: var(--muted); }
.ft-anc::after { content: ''; position: absolute; left: calc(var(--nw) + var(--gap) / 2); right: calc(var(--nw) + var(--gap) / 2); bottom: 0; height: var(--drop); border: 2px solid var(--tl); border-top: 0; border-radius: 0 0 12px 12px; }
/* a row of babies under one parent (or two): each hangs from a bar that runs from the first to the last */
.ft-row { position: relative; display: flex; justify-content: center; margin: 0; padding: var(--drop) 0 0; list-style: none; }
.ft-row::before { content: ''; position: absolute; top: 0; left: 50%; height: var(--drop); border-left: 2px solid var(--tl); }
.ft-row li { position: relative; display: flex; flex-direction: column; align-items: center; padding: var(--drop) 4px 0; }
.ft-row li::before, .ft-row li::after { content: ''; position: absolute; top: 0; right: 50%; width: 50%; height: var(--drop); border-top: 2px solid var(--tl); }
.ft-row li::after { right: auto; left: 50%; border-left: 2px solid var(--tl); }
.ft-row li:only-child { padding-top: 0; }
.ft-row li:only-child::before, .ft-row li:only-child::after { display: none; }
.ft-row li:first-child::before, .ft-row li:last-child::after { border: 0; }
.ft-row li:last-child::before { border-right: 2px solid var(--tl); border-radius: 0 10px 0 0; }
.ft-row li:first-child::after { border-radius: 10px 0 0 0; }
.ft-tree:not(.has-anc) > .ft-sibs { padding-top: 0; }
.ft-tree:not(.has-anc) > .ft-sibs::before { display: none; }
.ft-mate {
  position: relative; z-index: 1; display: inline-flex; gap: 4px; align-items: center; padding: 3px 10px; border-radius: 12px;
  background: #ffe8ef; border: 1px solid #ffc9d8; color: #b8456f; font: inherit; font-size: 12px; white-space: nowrap;
}
button.ft-mate { cursor: pointer; }
.ft-mate.gone { opacity: .6; filter: grayscale(.5); }
.ft-half { margin-top: 8px; padding: 8px 10px; border-radius: 16px; background: var(--card-2); }
.ft-half h4 { margin: 0 0 6px; font-size: 12.5px; color: var(--muted); }
.ft-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.ft-foot:has(#tree-back[hidden]) { display: none; }
.ft-legend { margin: 8px 0 0; font-size: 12px; color: var(--muted); text-align: center; }
@media (max-width: 420px) { .ft-tree { --nw: 66px; padding: 4px 8px; } .ft-anc { column-gap: 12px; } } /* (4 grandparents fit a 360-px phone) */

/* ---------- likes & age (js/likes.js, js/age.js) — now shown inline in the รายละเอียด sheet ---------- */
.mini.subtle { width: 24px; height: 24px; font-size: 12px; opacity: .5; }
.mini.subtle:hover { opacity: 1; background: #ffe3e3; }
#care-age { white-space: nowrap; }
.likes-list { display: flex; flex-direction: column; gap: 12px; margin-top: 6px; }
.likes-list:empty::before { content: 'ยังไม่รู้ใจ ลองให้เล่นให้กินดูนะ 🐾'; color: var(--muted); font-size: 13px; }
.like-row { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.like-row .lr-e { font-size: 18px; width: 22px; text-align: center; flex: none; }
.like-row .lr-th { width: 92px; flex: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lr-bar {
  position: relative; flex: 1; height: 8px; border-radius: 4px;
  background: linear-gradient(90deg, #e35d5d 0%, var(--line) 50%, #2fa36b 100%);
}
.lr-bar i { position: absolute; top: -3px; left: 50%; width: 4px; height: 14px; margin-left: -2px; border-radius: 2px; background: var(--ink); transition: left .3s; }

/* ---------- health (สุขภาพ), time away report, memorial (docs/LIFE.md) — care-dev/-life now live in #detail-modal ---------- */
.care-life {
  display: flex; align-items: center; flex-wrap: wrap; gap: 4px 12px;
  margin: 4px 0 14px; font-size: 12.5px;
}
.care-life .lf { display: flex; align-items: center; gap: 4px; white-space: nowrap; }
.care-life .lf b { font-weight: 700; min-width: 20px; }
.lf-bar { position: relative; width: 72px; height: 8px; border-radius: 4px; background: var(--line); overflow: hidden; }
.lf-bar i { display: block; height: 100%; width: 100%; border-radius: 4px; background: linear-gradient(90deg, #ff9fb3, #e8456b); transition: width .3s; }
.care-life.weak .lf-bar i { background: linear-gradient(90deg, #ffc27a, #ff9f5a); }
.care-life.crit .lf-bar i { background: #e35d5d; animation: blink 1s infinite; }
.lf-full { color: var(--muted); }
.lf-trend { font-weight: 800; font-size: 12px; white-space: nowrap; }
.lf-trend small { font-weight: 600; }
.life-why { flex-basis: 100%; display: flex; flex-direction: column; gap: 2px; font-size: 12px; color: var(--muted); white-space: normal; }
.life-why b { color: var(--ink); font-weight: 700; }
.life-why .lw-risk.hi { color: #b84343; }
.lf-state { background: #fff1d6; color: #9a6a00; padding: 1px 8px; border-radius: 999px; font-weight: 700; }
.care-life.crit .lf-state { background: #ffe3e3; color: #b84343; }
.lf-vet {
  background: #e8f3ff; color: #1f5f9e; font-weight: 700; font-size: 12px;
  padding: 3px 10px; border-radius: 999px; border-bottom: 2px solid #b9d6f3;
}
.lf-vet small { font-weight: 600; }
.lf-vet:active:not(:disabled) { transform: translateY(1px); border-bottom-width: 1px; }
@media (max-height: 500px) and (orientation: landscape) {
  .lf-vet { padding: 2px 7px; font-size: 11.5px; }
}

/* "ระหว่างที่ไม่อยู่ 🕐" */
.report-list { display: flex; flex-direction: column; gap: 10px; max-height: 58vh; overflow-y: auto; margin-top: 2px; }
.rp-pet { background: var(--card-2); border-radius: 16px; padding: 10px 12px; }
.rp-pet.gone { background: linear-gradient(135deg, #2e2a5c, #5b4a8f); color: #fff; }
.rp-head { display: flex; align-items: center; gap: 8px; }
.rp-head img { width: 36px; height: 36px; object-fit: contain; border-radius: 10px; background: #fff; flex: none; }
.rp-head small { color: var(--muted); }
.rp-pet.gone .rp-head small, .rp-pet.gone li time { color: #d9ccff; }
.rp-bye { margin: 6px 0 0; font-size: 13px; line-height: 1.55; }
.rp-stats { display: flex; flex-wrap: wrap; gap: 3px 10px; font-size: 12px; margin-top: 6px; }
.rp-stats .down { color: #c2493d; }
.rp-stats .up { color: #2f8f5b; }
.rp-pet ul { list-style: none; margin: 6px 0 0; padding: 0; display: flex; flex-direction: column; gap: 2px; font-size: 13px; }
.rp-pet li { display: flex; justify-content: space-between; gap: 8px; }
.rp-pet li time { color: var(--muted); font-size: 12px; white-space: nowrap; }
.rp-calm { color: var(--muted); }
.rp-acts { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.rp-acts button { background: #fff; font-weight: 700; font-size: 13px; padding: 5px 12px; border-radius: 999px; border-bottom: 2px solid var(--line); }
.rp-acts button:active { transform: translateY(1px); }
.report .row { flex-wrap: wrap; }

/* settings → ⭐ ความทรงจำ */
.memorial { margin-top: 12px; padding: 10px 12px; border-radius: 16px; background: linear-gradient(135deg, #2e2a5c, #5b4a8f); color: #fff; }
.memorial h3 { margin: 0 0 6px; font-size: 15px; }
.memorial-list { display: flex; flex-direction: column; gap: 6px; max-height: 30vh; overflow-y: auto; }
.mem-row { display: flex; gap: 8px; align-items: flex-start; font-size: 13px; }
.mem-row small { display: block; color: #d9ccff; font-size: 11.5px; line-height: 1.4; }
.mem-row .mem-tree { margin-left: auto; background: rgba(255, 255, 255, .14); color: #fff; }

/* one named star per memorial, inside .sky-night (so only at night) */
.sky-memorial { position: absolute; inset: 0; }
.mem-star { position: absolute; transform: translate(-50%, -50%); display: flex; flex-direction: column; align-items: center; gap: 1px; }
.mem-star i {
  font-style: normal; font-size: 21px; line-height: 1; color: #fff6c8;
  text-shadow: 0 0 8px rgba(255, 240, 170, .95), 0 0 18px rgba(255, 220, 120, .6);
  animation: mem-glow 3s ease-in-out infinite alternate;
}
.mem-star small { font-size: 10px; color: rgba(255, 255, 255, .85); text-shadow: 0 1px 2px rgba(0, 0, 0, .45); white-space: nowrap; }
@keyframes mem-glow { from { opacity: .7; transform: scale(.9); } to { opacity: 1; transform: scale(1.1); } }
@media (prefers-reduced-motion: reduce) { .mem-star i { animation: none; } }

/* ---- inventory (js/inventory.js) ---- */
/* #inv-modal is built at runtime by js/inventory.js — it reuses .modal/.sheet/.shop-tabs/.shop-grid/
   .shop-card (js/shop.js's classes) so it looks like the shop by construction; only the bits that
   module doesn't have already (the tab tip line, short-landscape sizing) live here. */
.inv-tip { margin: 2px 0 10px; white-space: pre-line; line-height: 1.55; }
.sc-buy.alt { background: #fff; color: var(--accent-dark); border: 2px solid var(--accent); } /* ของเล่น: วางไว้ในบ้าน */
/* 🎒 → ของใส่: 👒 แต่งตัว for the selected pet on top (owner 2026-10-01) — none selected: greyed, why under it */
.inv-dress { grid-column: 1 / -1; display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 2px 0 8px; }
.inv-dress .sc-buy { min-width: 180px; }
.inv-dress .sc-buy.off { background: var(--card-2); color: var(--muted); border-color: var(--line); }
.inv-dress small { color: var(--muted); text-align: center; }
@media (max-height: 500px) and (orientation: landscape) {
  #inv-modal .sheet { max-height: calc(100% - 16px); padding: 12px 14px; }
  .inv-tip { margin: 0 0 6px; }
}

/* ============================================================
   friends · mail · pet-sitting (js/social.js) — BEGIN
   Everything is built at runtime by js/social.js: 👫 HUD button (.soc-hud), #social-modal, #sit-modal,
   #soc-confirm and the care-panel controls (.sit-ctl). Reuses .modal/.sheet/.shop-tabs/.act-chip/.btn.
   ============================================================ */
.soc-hud { position: relative; }
.soc-badge {
  position: absolute; top: -5px; right: -5px; min-width: 19px; height: 19px; padding: 0 5px;
  border-radius: 999px; background: #e35d5d; color: #fff; font-size: 11px; font-weight: 700; line-height: 19px;
  text-align: center; box-shadow: 0 0 0 2px var(--card); pointer-events: none; animation: soc-pop .3s ease;
}
@keyframes soc-pop { from { transform: scale(.4); } }
.soc-modal button:focus-visible, .sit-ctl button:focus-visible, .soc-hud:focus-visible { outline: 2px solid var(--accent-dark); outline-offset: 2px; }
#sit-modal { z-index: 41; }
#soc-confirm { z-index: 42; }

/* the friends modal: fixed header + tabs, the list scrolls */
.soc-sheet {
  width: min(520px, 100%); height: min(600px, calc(100% - 32px));
  display: flex; flex-direction: column; overflow: hidden;
}
.soc-tabs { flex: none; margin-top: 10px; }
.soc-tabs .shop-tab { flex: 1 1 0; justify-content: center; min-width: max-content; padding: 8px 10px; }
.shop-tab .soc-hot { background: #e35d5d; }
.soc-flash {
  flex: none; margin: 8px 0 0; padding: 7px 12px; border-radius: 12px; text-align: center;
  background: #e9f8ef; color: #217a48; font-size: 13px; font-weight: 600; animation: pop .2s ease;
}
.soc-flash.err { background: #ffe3e3; color: #b84343; }
.soc-body {
  flex: 1; min-height: 0; overflow-y: auto; -webkit-overflow-scrolling: touch;
  display: flex; flex-direction: column; margin: 10px -4px 0; padding: 0 4px 6px;
}
.soc-h { display: flex; align-items: center; flex-wrap: wrap; gap: 0 6px; margin: 14px 2px 6px; font-size: 13.5px; font-weight: 700; color: var(--muted); }
.soc-body > .soc-h:first-child, .soc-sit .soc-h { margin-top: 4px; }
.soc-h small { font-size: 11.5px; font-weight: 600; }
.soc-h-n, .soc-count {
  display: inline-grid; place-items: center; min-width: 18px; height: 18px; padding: 0 5px;
  border-radius: 999px; background: #e35d5d; color: #fff; font-size: 11px; font-weight: 700;
}
.soc-list { display: flex; flex-direction: column; gap: 8px; }
.soc-row {
  display: flex; align-items: center; flex-wrap: wrap; gap: 8px 10px; width: 100%; min-height: 58px;
  padding: 8px 10px; text-align: left; background: var(--card-2); border-radius: 16px;
}
button.soc-row { transition: transform .12s, background-color .12s; }
button.soc-row:hover { background: #ffecdc; }
button.soc-row:active { transform: scale(.985); }
.soc-row.soc-dim { opacity: .82; }
.soc-ava {
  position: relative; flex: none; width: 42px; height: 42px; border-radius: 50%;
  display: grid; place-items: center; font-size: 22px; line-height: 1;
  background: hsl(var(--h, 25) 85% 90%); box-shadow: inset 0 0 0 2px rgba(255, 255, 255, .7);
}
.soc-ava.big { width: 56px; height: 56px; font-size: 30px; }
.soc-ava[data-on]::after {
  content: ''; position: absolute; right: -1px; bottom: -1px; width: 12px; height: 12px;
  border-radius: 50%; background: #43b581; box-shadow: 0 0 0 2px var(--card-2);
}
.soc-pet { flex: none; width: 44px; height: 44px; object-fit: contain; border-radius: 12px; background: #fff; }
.soc-pet-e { display: grid; place-items: center; font-size: 24px; }
.soc-main { flex: 1 1 120px; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.soc-main b { font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.soc-main small { font-size: 12px; line-height: 1.4; color: var(--muted); }
.soc-count { flex: none; min-width: 22px; height: 22px; font-size: 12px; }
.soc-chev { flex: none; margin-left: -4px; color: var(--muted); font-size: 22px; line-height: 1; }
/* buttons at the end of a row: they wrap under the name on narrow phones */
.soc-acts { flex: none; display: flex; align-items: center; gap: 6px; margin-left: auto; }
.soc-acts button, .soc-btn {
  min-height: 36px; padding: 6px 12px; border-radius: 999px; white-space: nowrap;
  font-weight: 700; font-size: 13px; background: #fff; color: var(--ink); border-bottom: 2px solid var(--line);
}
.soc-acts button:active:not(:disabled), .soc-btn:active { transform: translateY(1px); border-bottom-width: 1px; }
.soc-acts .yes { background: #43b581; color: #fff; border-color: #2f8f5b; }
.soc-acts .no { color: #b84343; border-color: #f3c6c6; }
.soc-acts .add { background: var(--accent); color: #fff; border-color: var(--accent-dark); }
.soc-pill { font-size: 12px; font-weight: 700; padding: 4px 10px; border-radius: 999px; background: #fff1d6; color: #9a6a00; white-space: nowrap; }
.soc-pill.ok { background: #e9f8ef; color: #217a48; }
.soc-note { margin: 0 2px; font-size: 12.5px; font-weight: 600; color: #b84343; }
.soc-tip { margin: 0 2px 10px; font-size: 13px; }
.soc-empty {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: 28px 16px; text-align: center; color: var(--muted);
}
.soc-empty-e { font-size: 44px; line-height: 1.15; }
.soc-empty b { color: var(--ink); font-size: 16px; }
.soc-empty p { margin: 2px 0 6px; max-width: 340px; font-size: 13.5px; line-height: 1.6; }
.soc-empty-sm { padding: 10px; background: var(--card-2); border-radius: 16px; }
.soc-error {
  display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px;
  padding: 6px 6px 6px 14px; border-radius: 14px; background: #ffe3e3; color: #b84343; font-size: 13px; font-weight: 600;
}
/* one friend */
.soc-back { align-self: flex-start; padding: 4px 10px 4px 4px; border-radius: 999px; font-weight: 700; font-size: 14px; color: var(--accent-dark); }
.soc-back:hover { background: var(--card-2); }
.soc-head { display: flex; align-items: center; gap: 12px; padding: 6px 2px 0; }
.soc-head .soc-main b { font-size: 18px; }
.soc-foot { display: flex; justify-content: center; margin-top: 18px; }
.soc-remove { padding: 7px 16px; border-radius: 999px; font-weight: 700; font-size: 13px; color: #b84343; background: #ffeaea; }
.soc-remove:hover { background: #ffdcdc; }

/* 🤝 ฝากเลี้ยง dialog */
.sheet.soc-sit { width: min(420px, 100%); }
.soc-sit-name { display: none; }
.soc-sit-pet { display: flex; align-items: center; gap: 10px; margin: 10px 0 6px; padding: 8px 10px; border-radius: 16px; background: var(--card-2); }
.soc-sit-grid { display: flex; flex-direction: column; gap: 6px; }
.soc-pick { display: flex; flex-direction: column; gap: 6px; max-height: 34vh; overflow-y: auto; padding: 2px; }
.soc-pick-item {
  display: flex; align-items: center; gap: 10px; width: 100%; min-height: 54px; padding: 6px 10px; text-align: left;
  background: #fff; border: 2px solid var(--line); border-radius: 14px;
}
.soc-pick-item[aria-checked="true"] { border-color: var(--accent); background: #fff4ec; }
.soc-pick-item:disabled { opacity: .55; }
.soc-radio { flex: none; width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--line); background: #fff; }
.soc-pick-item[aria-checked="true"] .soc-radio { border-color: var(--accent); background: radial-gradient(circle, var(--accent) 0 42%, #fff 47%); }
.soc-dep { display: flex; align-items: center; gap: 10px; }
.soc-dep input { width: 130px; padding: 8px 10px; text-align: center; font-weight: 700; }
.soc-have { font-size: 14px; font-weight: 600; color: var(--muted); }
.soc-quick { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.soc-quick .act-chip { min-height: 34px; padding: 5px 12px; font-size: 13px; }
.soc-quick .act-chip.on { background: var(--accent); border-color: var(--accent-dark); color: #fff; }
.soc-msg { min-height: 20px; margin: 10px 0 0; text-align: center; font-size: 13px; color: var(--muted); }
.soc-msg.err { color: #b84343; font-weight: 700; }
.soc-sit .row { margin-top: 6px; }
.soc-confirm .sheet-sub { margin: 10px 0 4px; line-height: 1.6; }

/* care panel (after #care-actions): "🤝 ฝากเลี้ยง" / "🏠 ของ <owner>" + "เลิกรับฝาก" */
.sit-ctl { display: inline-flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.sit-owner {
  max-width: 170px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  padding: 4px 10px; border-radius: 999px; background: #fff1d6; color: #9a6a00; font-size: 12px; font-weight: 700;
}
.sit-ctl .sit-end { color: #b84343; }
.sit-ctl .sit-back { color: #2f7a45; border-color: #9fd6b0; background: #eaf7ee; }
/* pet list badge top-left of the avatar (main.js renderPetList): 🤝 a sat pet · another player's pet: its owner's initial */
.pc-av[data-badge]::before {
  content: attr(data-badge); position: absolute; top: -6px; left: -7px; z-index: 1;
  min-width: 18px; height: 18px; padding: 0 3px; display: grid; place-items: center; border-radius: 999px;
  font-size: 10.5px; font-weight: 700; line-height: 1; background: #eaf1ff; color: #3c5a86; border: 1.5px solid #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .15);
}
.pet-card.sat .pc-av[data-badge]::before { background: #fff1d6; color: #9a6a00; font-size: 11px; }

@media (max-width: 760px) {
  .soc-modal { padding: 10px; }
  .soc-modal .sheet { padding: 16px 14px; }
  .soc-sheet { height: min(640px, calc(100% - 20px)); max-height: calc(100% - 20px); }
}
@media (max-height: 500px) and (orientation: landscape) {
  .soc-modal { padding: 8px; }
  .soc-modal .sheet { max-height: calc(100% - 16px); padding: 10px 14px 12px; }
  .soc-modal .sheet h2 { font-size: 18px; }
  .soc-sheet { width: min(620px, 100%); height: calc(100% - 16px); }
  .soc-tabs { margin-top: 6px; }
  .soc-tabs .shop-tab { padding: 5px 12px; font-size: 13px; }
  .soc-body { margin-top: 6px; }
  .soc-row { min-height: 48px; padding: 6px 8px; }
  .soc-ava { width: 36px; height: 36px; font-size: 19px; }
  .soc-ava.big { width: 44px; height: 44px; font-size: 24px; }
  .soc-pet { width: 38px; height: 38px; }
  .soc-empty { padding: 10px 16px; }
  .soc-empty-e { font-size: 30px; }
  .sheet.soc-sit { width: min(660px, 100%); }
  .soc-sit-pet { display: none; }
  .soc-sit-name { display: inline; }
  .soc-sit-grid { display: grid; grid-template-columns: 1.15fr 1fr; gap: 14px; }
  .soc-pick { max-height: 150px; }
  .soc-pick-item { min-height: 46px; padding: 4px 8px; }
  .soc-msg { margin-top: 4px; }
}

/* home visits (docs/WORLDS_PROTOCOL.md § Invites): invite buttons, the incoming card, the visit banner */
.soc-invite { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; margin: 10px 2px 0; }
.soc-invite button {
  min-height: 36px; padding: 6px 14px; border-radius: 999px; white-space: nowrap;
  font-weight: 700; font-size: 13px; background: #fff; color: var(--ink); border-bottom: 2px solid var(--line);
}
.soc-invite .go { background: #e8f3ff; color: #1f5f9e; border-color: #b9d6f3; }
.soc-invite .no { color: #b84343; border-color: #f3c6c6; }
.soc-invite button:active { transform: translateY(1px); border-bottom-width: 1px; }
.soc-muted { font-size: 12.5px; font-weight: 600; color: var(--muted); }
.soc-pop {
  position: fixed; z-index: 35; left: 50%; transform: translateX(-50%);
  top: calc(max(12px, env(safe-area-inset-top)) + 56px); width: min(420px, calc(100vw - 20px));
  animation: soc-drop .3s ease;
}
@keyframes soc-drop { from { opacity: 0; transform: translate(-50%, -14px); } }
.soc-pop-card {
  display: flex; align-items: center; flex-wrap: wrap; gap: 8px 10px; padding: 10px 8px 10px 12px;
  background: var(--card); border: 2px solid #ffd2b3; border-radius: 20px; box-shadow: var(--shadow);
}
.soc-pop-card .soc-main { flex: 1 1 160px; }
.soc-pop-card .soc-main b { white-space: normal; }
.soc-pop-card .close { align-self: flex-start; }
.soc-pop-acts { flex: 1 1 100%; justify-content: flex-end; margin: 0 4px 0 0; }
.visit-banner {
  position: fixed; z-index: 24; left: 50%; transform: translateX(-50%);
  top: calc(max(12px, env(safe-area-inset-top)) + 56px); width: max-content; max-width: calc(100vw - 20px);
  display: flex; align-items: center; flex-wrap: wrap; gap: 6px; padding: 5px 5px 5px 14px;
  background: var(--card); border-radius: 999px; box-shadow: var(--shadow); font-size: 13.5px; font-weight: 700;
}
.visit-banner.host { padding-left: 12px; }
.vb-t { white-space: nowrap; }
.vb-home {
  padding: 5px 14px; border-radius: 999px; font-weight: 700; font-size: 13px;
  background: var(--accent); color: #fff; border-bottom: 2px solid var(--accent-dark);
}
.vb-guest { display: inline-flex; align-items: center; gap: 2px; padding: 2px 2px 2px 10px; border-radius: 999px; background: var(--card-2); }
.vb-guest b { max-width: 110px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.vb-x { width: 26px; height: 26px; border-radius: 50%; font-size: 12px; color: #b84343; }
.vb-x:hover { background: #ffe3e3; }
.visit-banner button:focus-visible, .soc-pop button:focus-visible { outline: 2px solid var(--accent-dark); outline-offset: 2px; }
body:has(#visit-banner) .soc-pop { top: calc(max(12px, env(safe-area-inset-top)) + 102px); } /* below the banner */
@media (max-width: 760px) {
  /* under the HUD + the row of pet cards */
  .soc-pop, .visit-banner { top: calc(max(8px, env(safe-area-inset-top)) + 104px); }
  body:has(#visit-banner) .soc-pop { top: calc(max(8px, env(safe-area-inset-top)) + 150px); }
}
@media (max-height: 500px) and (orientation: landscape) {
  .soc-pop, .visit-banner { top: calc(max(6px, env(safe-area-inset-top)) + 46px); }
  body:has(#visit-banner) .soc-pop { top: calc(max(6px, env(safe-area-inset-top)) + 90px); }
  .soc-pop { width: min(460px, calc(100vw - 20px)); }
  .soc-pop-card { padding: 6px 6px 6px 10px; gap: 4px 8px; }
  .soc-pop-acts { flex: none; margin-left: auto; }
}
/* friends · mail · pet-sitting (js/social.js) — END */

/* ---- training (js/train-ui.js) ---- */
/* the "ล่าสุด" row: what the pet just did · 👍 ชม / 👎 ดุ · ▾ the last 5 · the lesson's result line (docs/TRAINING.md) */
.care-recent { margin-top: 10px; }
/* what it did lately, newest on top: stays until it has done nothing new for TEACH.hold s (js/train.js stackOf) */
.tr-stack { display: flex; flex-direction: column; gap: 6px; }
.tr-new { animation: trIn .25s ease; }
.tr-row {
  position: relative; display: flex; align-items: center; gap: 8px; min-height: 46px;
  padding: 5px 5px 5px 10px; border-radius: 16px; overflow: hidden;
  background: var(--card-2); border: 2px solid var(--line);
}
.tr-e { position: relative; flex: none; width: 26px; text-align: center; font-size: 22px; line-height: 1; }
.tr-sp { position: absolute; top: -7px; right: -4px; font-size: 11px; }
.tr-main { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.3; }
.tr-th { font-weight: 700; font-size: 14px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tr-meta { font-size: 11.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tr-n { font-weight: 700; color: var(--accent-dark); flex: none; }
.tr-acts { display: flex; align-items: center; gap: 5px; flex: none; }
.tr-btn, .tr-ico { border-radius: 999px; font-weight: 700; border-bottom: 2px solid; white-space: nowrap; }
.tr-btn { min-height: 34px; padding: 0 12px; font-size: 13px; }
.tr-ico { width: 34px; height: 30px; font-size: 14px; }
.tr-btn.good, .tr-ico.good { background: #dff5e6; color: #217a48; border-color: #8ad3a6; }
.tr-btn.bad, .tr-ico.bad { background: #ffe3e3; color: #b84343; border-color: #f3c6c6; }
.tr-btn:active:not(:disabled), .tr-ico:active:not(:disabled) { transform: translateY(1px); border-bottom-width: 1px; }
.tr-btn.on, .tr-ico.on { opacity: 1; animation: blink .8s infinite; }
.tr-btn:focus-visible, .tr-ico:focus-visible { outline: 2px solid var(--accent-dark); outline-offset: 2px; }
.tr-done { font-size: 12px; font-weight: 700; padding: 4px 10px; border-radius: 999px; background: #fff; white-space: nowrap; }
.tr-done.praise { color: #217a48; }
.tr-done.scold { color: #b84343; }
.tr-row.special { background: linear-gradient(135deg, #fff7dc, #ffecc0); border-color: #ffd66b; }
.tr-row.special .tr-th { color: #8a5a00; }
.tr-row.old .tr-e, .tr-row.old .tr-main { opacity: .55; }
.tr-row.empty .tr-e { opacity: .6; }
.tr-row.empty .tr-th { font-weight: 600; color: var(--muted); }
.tr-item { display: flex; align-items: center; gap: 7px; min-height: 36px; padding: 2px 4px 2px 6px; border-radius: 11px; font-size: 13px; }
.tr-item .tr-e { width: 22px; font-size: 17px; }
.tr-item .tr-sp { top: -6px; right: -4px; font-size: 10px; }
.tr-item .tr-th { flex: 0 1 auto; font-weight: 600; font-size: 13px; }
.tr-item .tr-n { font-size: 11.5px; }
.tr-item .tr-age { margin-left: auto; flex: none; font-size: 11.5px; color: var(--muted); white-space: nowrap; }
.tr-item.special { background: #fff1c9; }
.tr-item.special .tr-th { color: #8a5a00; }
.tr-item.old .tr-e, .tr-item.old .tr-th, .tr-item.old .tr-n { opacity: .5; }
.tr-lesson { margin: 6px 4px 0; font-size: 12.5px; font-weight: 700; line-height: 1.4; animation: trIn .25s ease; }
.tr-lesson.good { color: #217a48; }
.tr-lesson.scold { color: #2e6aa3; }
.tr-lesson.meh { color: var(--muted); }
.tr-lesson.bad { color: #b84343; }
@keyframes trIn { from { opacity: 0; transform: translateY(-3px); } }
/* ! at the row's left → the dialog of the last 20 things it did, which were praised / scolded (owner 2026-09-28) */
.tr-row.hist { padding-left: 6px; }
.tr-hist-btn {
  flex: none; width: 28px; height: 28px; padding: 0; border-radius: 50%;
  background: #fff; color: var(--accent-dark); border: 2px solid var(--line);
  font-size: 15px; font-weight: 800; line-height: 1;
}
.tr-hist-btn:hover { border-color: var(--accent); }
.tr-hist-btn:active { transform: translateY(1px); }
.tr-hist-btn:focus-visible { outline: 2px solid var(--accent-dark); outline-offset: 2px; }
.sheet.tr-hist-sheet { padding: 14px 14px 12px; }
.tr-hist-sheet h2 { font-size: 18px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tr-hist-sub { margin: 2px 2px 8px; font-size: 12.5px; line-height: 1.35; }
.tr-hist-key { white-space: nowrap; }
.tr-hist-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.tr-hist-list .tr-item { min-height: 28px; padding: 1px 4px 1px 6px; gap: 6px; }
.tr-hist-list .tr-item .tr-e { font-size: 16px; }
.tr-end { margin-left: auto; flex: none; display: flex; align-items: center; gap: 6px; }
.tr-hist-list .tr-age { margin-left: 0; min-width: 3.3em; text-align: right; }
.tr-tag { font-size: 11.5px; font-weight: 700; padding: 1px 8px; border-radius: 999px; white-space: nowrap; line-height: 1.6; }
.tr-tag.praise { background: #dff5e6; color: #217a48; }
.tr-tag.scold { background: #ffe3e3; color: #b84343; }
/* how much it likes each (owner 2026-09-28): the likes sheet's bar, small — dislike ← → like; never tried = faded, no marker */
.tr-like {
  position: relative; flex: none; width: 46px; height: 6px; border-radius: 3px;
  background: linear-gradient(90deg, #e35d5d 0%, var(--line) 50%, #2fa36b 100%);
}
.tr-like i { position: absolute; top: -3px; left: 50%; width: 3px; height: 12px; margin-left: -1.5px; border-radius: 2px; background: var(--ink); transition: left .3s; }
.tr-like.none { opacity: .3; }
.tr-like.none i { display: none; }
.tr-hist-empty { padding: 16px 6px; text-align: center; color: var(--muted); font-weight: 600; }
@media (max-width: 760px) {
  .care-recent { margin-top: 8px; }
  .tr-row { gap: 6px; padding: 4px 4px 4px 8px; }
  .tr-btn { padding: 0 10px; font-size: 12.5px; }
}
@media (max-width: 400px) {
  /* narrow phones: the act may take two lines rather than hide behind "…" */
  .tr-row .tr-th { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; font-size: 13px; line-height: 1.25; }
  .tr-btn { padding: 0 8px; }
  .tr-ico { width: 32px; }
  .tr-row.hist { padding-left: 4px; }
  .tr-hist-btn { width: 26px; height: 26px; font-size: 14px; }
}
@media (max-height: 500px) and (orientation: landscape) {
  .care-recent { margin-top: 6px; }
  .tr-row { min-height: 40px; padding: 3px 4px 3px 8px; border-radius: 14px; }
  .tr-e { font-size: 19px; width: 22px; }
  .tr-th { font-size: 13px; }
  .tr-meta { font-size: 11px; }
  .tr-btn { min-height: 30px; padding: 0 9px; font-size: 12px; }
  .tr-item { min-height: 32px; }
  .tr-ico { height: 28px; width: 32px; font-size: 13px; }
  .tr-lesson { margin-top: 4px; font-size: 12px; }
  .tr-hist-btn { width: 26px; height: 26px; font-size: 14px; }
  /* a short landscape phone: the history in two columns (newest first, top to bottom) */
  .sheet.tr-hist-sheet { width: min(680px, 100%); padding: 10px 12px; }
  .tr-hist-list { display: block; columns: 2; column-gap: 12px; }
  .tr-hist-list .tr-item { break-inside: avoid; margin-bottom: 2px; min-height: 26px; }
}
@media (prefers-reduced-motion: reduce) { .tr-lesson, .tr-new, .tr-btn.on, .tr-ico.on { animation: none; } }
/* ---- training (js/train-ui.js) — END ---- */
/* Explain the upper happiness bar; the pet sheet has the full outing context. */
.outing-note { color: #766755; font-size: 11px; line-height: 1.5; margin: 5px 0; }
.outing-detail { white-space: pre-line; font-size: 12px; }
/* a row of what the pet just did: tap its words = it goes, neither praised nor scolded (owner 2026-09-29, js/train-ui.js) */
.tr-row[title] .tr-main, .tr-row[title] > .tr-e { cursor: pointer; }
#reset-yes:disabled { opacity: .45; cursor: not-allowed; }
