/* pets.css — ระบบสัตว์เลี้ยง (pets_ui.js · 18 ต.ค. 2026 · 19 ต.ค. หน้าตาใหม่ตามม็อกอัพ tools/mockup/pets_ui) · เดิม: ภาพการ์ดชั่วคราว รอภาพ Gemini + การ์ด 3D */

/* ---------- แท็บคอลัมน์ขวาเป็นไอคอนล้วน (จ๊อบ 18 ต.ค.) ชื่อขึ้นตอนชี้ ---------- */
body[data-zone] #col-people .tabs.icon-tabs .tab { min-width: 44px; padding-left: 8px !important; padding-right: 8px !important; }
body[data-zone] #col-people .tabs.icon-tabs .tab .ico,
body[data-zone] #col-people .tabs.icon-tabs .tab .twi { display: inline-block !important; width: 20px; height: 20px; opacity: 1; image-rendering: pixelated; }
/* 19 ต.ค. ไอคอนแท็บเป็นภาพพิกเซล assets/icons/pets.png (จ๊อบเลือกรอยเท้าเบอร์ 5 · tools/pets_tab_icon/) แทนอิโมจิ 🐾 */
body[data-zone] #col-people .tabs.icon-tabs .tab .tl { display: none !important; }

/* ---------- การ์ด 92×124 (ภาพห้อง holo-card · 19 ต.ค. จ๊อบ: ตัดการ์ดเล็กออก เหลือการ์ดกลาง + การ์ดใหญ่ 3D) ---------- */
.pcd { position: relative; width: 92px; height: 124px; flex: none; cursor: pointer; transition: transform .15s; }
.pcd img { width: 100%; height: 100%; display: block; }
.pcd:hover { transform: translateY(-3px); }
.pcd-lv { position: absolute; left: 7px; top: 6px; font-size: 11px; padding: 0 4px; background: rgba(0,0,0,.65); border-radius: 3px; color: #fff; }
.pcd-new { position: absolute; top: -7px; left: 50%; transform: translateX(-50%); font-size: 9px; padding: 1px 4px; background: #e0453a; color: #fff; border-radius: 3px; }
.pcd.ghost { cursor: default; }
.pcd.ghost img { filter: grayscale(1) brightness(.28); }
.pcd.ghost:hover, .pcd.empty:hover, .pcd.back:not(.hi):hover { transform: none; }
.pcd.sel { outline: 2px solid #e8c27a; outline-offset: 2px; }
.pcd.empty { border: 2px dashed rgba(255,255,255,.18); border-radius: 8px; cursor: default; }
.pcd.back { cursor: default; }
.pcd.back.hi { cursor: pointer; }

/* ---------- แท็บ Pets · หมวดต่างกันแยกด้วยเส้น (19 ต.ค. จ๊อบ) ---------- */
.pets { display: flex; flex-direction: column; }
.pt-teams { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }   /* 3 พ.ย. ช่องที่ 4 Training */
.pt-slot { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.pt-slot .n { display: inline-flex; align-items: center; gap: 3px; font-size: 12px; opacity: .8; }
.pt-slot .ico { width: 12px; height: 12px; }
.pt-slot.locked .pcd { opacity: .7; }
.pt-sep { height: 0; border-top: 1px solid rgba(255,255,255,.12); margin: 12px 4px; }
.pd { display: flex; gap: 12px; align-items: flex-start; }
.pd-body { flex: 1; min-width: 0; }
/* ชื่อเด่นด้วยแถบป้าย ไม่ใช่ตัวใหญ่ · ระดับ/เลเวลเป็นเม็ด · spare จาง (19 ต.ค. จ๊อบ) */
.pd-plate { padding: 4px 10px 5px 11px; font-size: 16px; line-height: 1.15; color: #fff; text-shadow: 0 1px 0 #000;
  border-left: 3px solid var(--tc); background: linear-gradient(90deg, color-mix(in srgb, var(--tc) 38%, transparent), color-mix(in srgb, var(--tc) 6%, transparent) 85%);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.08); }
.pd-pills { display: flex; align-items: center; gap: 6px; margin: 6px 0; }
.pd-pill { font-size: 12px; line-height: 1; padding: 3px 8px; border: 1px solid var(--tc); border-radius: 10px; color: var(--tc); background: rgba(0,0,0,.35); }
.pd-pill.lv { color: #f1e9e4; border-color: rgba(255,255,255,.35); cursor: help; }
.pd-pill.star { color: #ffe08a; border-color: #ffe08a; cursor: help; }   /* ดาว Celestial (19 ต.ค.) โชว์แค่ในแผงรายละเอียด */
.pd-spare { font-size: 11px; opacity: .5; }
.pd-line { padding: 2px 0; font-size: 12px; opacity: .8; border-bottom: 1px dashed rgba(255,255,255,.08); cursor: help; }
.pd-btns { display: flex; gap: 6px; margin-top: 8px; }
.pd-btns .job { flex: 1; min-width: 0; }
.pd-teams { display: flex; gap: 4px; margin-top: 6px; }
.pd-teams .job { flex: 1; min-width: 0; }
.pd-empty { text-align: center; padding: 10px; }
.pt-main { display: flex; justify-content: center; gap: 12px; }
.pt-main .job { width: 170px; }
.pt-grid { display: grid; grid-template-columns: repeat(4, 92px); gap: 8px; justify-content: center; }
.pt-col { text-align: center; font-size: 12px; opacity: .85; margin-top: 10px; cursor: help; }

/* ---------- หน้าต่าง Summon / Fuse / Level Up = โครงหน้าต่างตีบวก ฉากสูงกว่า (การ์ด ×11 ต้องมีที่) ---------- */
.modal-box.pet-box { width: min(540px, 100%); }
body[data-zone] .rf.pet-box .rf-scene { width: auto; height: 440px; }
body[data-zone] .rf.pet-box .rf-bg { width: 100%; height: 100%; object-fit: cover; image-rendering: auto; }
.pp-stage { position: absolute; z-index: 1; inset: 30px 0 0; display: flex; flex-wrap: wrap; align-content: center; justify-content: center; gap: 8px; padding: 10px 14px; }
.pp-stage.fuse { display: grid; grid-template-columns: repeat(2, 92px); align-content: center; gap: 10px; }
.pp-rates { position: absolute; left: 0; right: 0; top: 8px; z-index: 2; display: flex; justify-content: center; gap: 10px; font-size: 14px; text-shadow: 0 1px 2px #000, 0 0 6px #000; cursor: help; }
.pp-go { margin-left: auto; min-width: 140px; }
.pp-go + .pp-go { margin-left: 0; }
.reveal .pcd { animation: pp-flip .45s ease-out both; }
@keyframes pp-flip { from { transform: rotateY(90deg) scale(.8); opacity: 0; } }
/* ทอง/แดงคว่ำ: แสงขาวใต้การ์ด คลิกเปิด */
.pcd.back.hi::before { content: ''; position: absolute; left: -16px; right: -16px; bottom: -18px; height: 38px; border-radius: 50%; z-index: -1;
  background: radial-gradient(ellipse at 50% 50%, var(--glow), transparent 70%); animation: pp-hi-pulse 1.4s ease-in-out infinite; }
@keyframes pp-hi-pulse { 50% { opacity: .5; transform: scaleX(.88); } }
.reveal .pcd.back.hi { animation-name: pp-flip, pp-hi-glow; animation-duration: .45s, 1.4s; animation-iteration-count: 1, infinite; animation-timing-function: ease-out, ease-in-out; }
@keyframes pp-hi-glow { 0%, 100% { filter: drop-shadow(0 0 4px rgba(255,250,235,.55)); } 50% { filter: drop-shadow(0 0 12px rgba(255,250,235,.95)); } }
.pcd.opening { animation: pp-open 1.1s ease-out both !important; }
@keyframes pp-open { 0% { transform: rotateY(90deg) scale(1.12); } 60% { transform: rotateY(-8deg) scale(1.04); } 100% { transform: none; } }
/* ผสมแดง → Celestial: แผ่นเหล็กตกพื้นเหล็ก (กระแทก มุมกระดกสลับ เด้งเบาลง สั่นถี่จนนิ่ง) + แสงแดงสลับรุ้งฟุ้ง */
.pcd.charging { animation: pp-clang 1.7s linear forwards !important; z-index: 3; }
@keyframes pp-clang {
  0%   { transform: translateY(-16px) rotate(-5deg) scale(1.04); transform-origin: 0% 100%; }
  9%   { transform: translateY(0) rotate(0) scale(1); transform-origin: 0% 100%; }
  15%  { transform: translateY(-5px) rotate(4deg); transform-origin: 0% 100%; }
  21%  { transform: translateY(0) rotate(0); transform-origin: 100% 100%; }
  27%  { transform: translateY(-3px) rotate(-2.6deg); transform-origin: 100% 100%; }
  33%  { transform: translateY(0) rotate(0); transform-origin: 0% 100%; }
  38%  { transform: translateY(-1.6px) rotate(1.6deg); transform-origin: 0% 100%; }
  43%  { transform: translateY(0) rotate(0); transform-origin: 100% 100%; }
  47%  { transform: rotate(-.9deg); transform-origin: 100% 100%; }
  51%  { transform: rotate(0); transform-origin: 50% 100%; }
  54%  { transform: translateX(.8px) rotate(.5deg); }
  57%  { transform: translateX(-.8px) rotate(-.4deg); }
  60%  { transform: translateX(.6px) rotate(.3deg); }
  63%  { transform: translateX(-.5px) rotate(-.25deg); }
  67%  { transform: translateX(.4px) rotate(.15deg); }
  71%  { transform: translateX(-.3px) rotate(-.1deg); }
  76%  { transform: translateX(.2px); }
  82%, 100% { transform: none; } }
.pcd.charging::after { content: ''; position: absolute; inset: -10px; border-radius: 16px; z-index: -1; pointer-events: none;
  background: radial-gradient(circle, rgba(255,60,60,.9), rgba(255,60,60,0) 70%); animation: pp-burst 1.8s ease-in forwards; }
@keyframes pp-burst {
  0%   { transform: scale(.6); opacity: .3; filter: hue-rotate(0deg); }
  25%  { filter: hue-rotate(0deg); }
  35%  { filter: hue-rotate(200deg) saturate(2); }
  50%  { filter: hue-rotate(0deg); }
  65%  { filter: hue-rotate(120deg) saturate(2); }
  80%  { filter: hue-rotate(260deg) saturate(2); }
  100% { transform: scale(3.2); opacity: 0; filter: hue-rotate(360deg) saturate(2); } }
/* ได้ Celestial: แสงวาบทั้งฉาก · วงรุ้งฟุ้ง · เส้นแสงสาดยาวไม่เท่ากันยืดหด · ประกายพุ่ง */
.cel-flash { position: absolute; inset: 0; z-index: 4; pointer-events: none; background: radial-gradient(circle at 50% 50%, #fff 0%, rgba(255,255,255,.85) 25%, rgba(255,255,255,0) 70%); animation: cel-flash .9s ease-out forwards; }
@keyframes cel-flash { 0% { opacity: 0; } 12% { opacity: 1; } 100% { opacity: 0; } }
.pcd.cel-win { z-index: 3; }
.pcd.cel-win::before { content: ''; position: absolute; left: 50%; top: 50%; width: 230px; height: 230px; margin: -115px 0 0 -115px; z-index: -1; pointer-events: none; border-radius: 50%;
  background: conic-gradient(from 0deg, rgba(255,110,110,.6), rgba(255,210,110,.5), rgba(120,235,150,.55), rgba(110,180,255,.55), rgba(200,130,255,.6), rgba(255,110,110,.6));
  -webkit-mask: radial-gradient(circle, #000 0%, rgba(0,0,0,.85) 40%, transparent 72%); mask: radial-gradient(circle, #000 0%, rgba(0,0,0,.85) 40%, transparent 72%);
  filter: blur(10px); animation: cel-spin 6s linear infinite, cel-in .8s ease-out both; }
.cel-rays { position: absolute; left: 50%; top: 50%; width: 0; height: 0; z-index: -1; pointer-events: none; animation: cel-spin 14s linear infinite; }
.cel-ray { position: absolute; left: 0; top: 0; height: var(--w); margin-top: calc(var(--w) / -2); width: var(--len); transform-origin: 0 50%; border-radius: 50%;
  transform: rotate(var(--a)); filter: blur(2.5px);
  background: linear-gradient(90deg, rgba(255,255,255,0) 0 18%, hsla(var(--h), 100%, 88%, .6) 32%, hsla(var(--h), 100%, 74%, .35) 60%, hsla(var(--h), 100%, 65%, 0));
  animation: cel-ray var(--t) ease-in-out infinite alternate, cel-in .7s ease-out both; }
@keyframes cel-ray { from { transform: rotate(var(--a)) scaleX(var(--s0)); opacity: .55; } to { transform: rotate(var(--a)) scaleX(var(--s1)); opacity: 1; } }
@keyframes cel-spin { to { transform: rotate(360deg); } }
@keyframes cel-in { from { opacity: 0; transform: scale(.3); } }
.cel-spark { position: absolute; left: 50%; top: 50%; width: 6px; height: 6px; margin: -3px; z-index: 5; pointer-events: none; border-radius: 1px;
  background: hsl(var(--h), 100%, 75%); box-shadow: 0 0 6px hsl(var(--h), 100%, 70%); animation: cel-spark 1.3s cubic-bezier(.15,.6,.35,1) forwards; }
@keyframes cel-spark { 0% { transform: rotate(var(--a)) translateX(0) scale(1.4); opacity: 1; } 100% { transform: rotate(var(--a)) translateX(var(--d)) scale(.2); opacity: 0; } }
/* Fuse: ปุ่มระดับมีจำนวนใบสำรองมุมปุ่ม · "15% success" แบบตัวหนังสือ (ไม่มีเกจ) · ตัวเลือกรอบ 1–10 */
.pp-tiers { display: flex; gap: 4px; margin: 6px 0 8px; }
.pp-tiers .job { flex: 1; position: relative; padding-left: 2px; padding-right: 2px; }
.pp-tiers .job .c { position: absolute; right: 3px; top: -8px; font-size: 10px; padding: 0 4px; border-radius: 6px; background: #000c; color: #fff; }
.pp-odds { text-align: center; font-size: 15px; margin: 2px 0 4px; }
.pp-odds b { font-size: 22px; color: #ffd27a; }
.pp-odds .pity { opacity: .6; margin-left: 8px; cursor: help; }
.pp-rpity { opacity: .6; cursor: help; font-size: 13px; }   /* การันตีแดงซัมมอน X/300 (23 ต.ค.) */
.pp-reroll { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; }
.pp-reroll:empty { display: none; }
.pp-reroll .job { min-width: 210px; }   /* รีโรลรุ้ง (23 ต.ค.) ขนาดคงที่ */
.pp-step { display: flex; align-items: center; gap: 2px; }
.pp-step span { width: 34px; text-align: center; font-size: 15px; }
/* Level Up: ปุ่มระดับ 3 บรรทัด กด 1 ครั้ง = 1 ใบ */
.pp-lvhead { text-align: center; font-size: 14px; margin-bottom: 6px; }
.pp-lvhead b { color: #9fe08a; }
.pp-waste { color: #ff7a6e; cursor: help; }
.pp-feed { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.pp-feed .job { display: flex !important; flex-direction: column; align-items: center; justify-content: center; gap: 2px; padding: 6px 2px 7px !important; height: auto !important; min-height: 62px; position: relative; line-height: 1.15; }
.pp-feed .job .tn { font-size: 13px; }
.pp-feed .job .have { font-size: 11px; opacity: .75; }
.pp-feed .job .ex { font-size: 11px; color: #ffd27a; }
.pp-feed .job .pick { position: absolute; right: -6px; top: -9px; min-width: 18px; font-size: 11px; padding: 1px 5px; border-radius: 8px; background: #2f8a4a; color: #fff; cursor: pointer; pointer-events: auto; z-index: 2; }
.pp-feed .job.off { filter: grayscale(.8) brightness(.6); cursor: not-allowed; }
.pp-feed .job .pick:hover { background: #c0453a; }   /* กดเลขเขียว = เอาออก 1 ใบ (ปุ่มที่ปิดอยู่ก็ยังกดเลขนี้ได้) */

@media (max-width: 760px) {
  .pt-grid { grid-template-columns: repeat(4, minmax(0, 92px)); }
  .pt-grid .pcd, .pt-teams .pcd { width: 100%; max-width: 92px; height: auto; aspect-ratio: 92 / 124; }
  .pp-stage .pcd { width: 72px; height: 97px; }
  .pp-stage.fuse { grid-template-columns: repeat(2, 72px); }
  .pt-main .job { width: auto; flex: 1; }
}

/* ลอยตามหลังคนสุดท้ายบนฉาก · ขึ้นลงช้าๆ · แสงตามระดับแบบออร่าตัวละคร */
.pet-float { position: absolute; transform: translate(-50%, -100%); pointer-events: auto; transition: left .12s linear, top .12s linear; }
.pet-float { animation: pet-bob 2.4s ease-in-out infinite; }
/* ท่าบินวน (แผ่นเฟรมแนวนอน มังกร 6 เฟรม ตัวอื่น 4) · กลับด้านเมื่อทีมหันซ้าย */
.pet-float .pf { display: block; width: var(--fw); background-repeat: no-repeat; background-size: calc(var(--fw) * var(--n, 4)) 100%;
  image-rendering: pixelated; animation: pet-fly var(--ms, 600ms) steps(var(--n, 4)) infinite; }
.pet-float.face-left .pf { transform: scaleX(-1); }
@keyframes pet-fly { from { background-position: 0 0; } to { background-position: calc(var(--fw) * var(--n, 4) * -1) 0; } }
@keyframes pet-bob { 0%, 100% { margin-top: 0; } 50% { margin-top: -3px; } }
.pet-float::after { content: ''; position: absolute; left: 50%; bottom: -10px; width: 16px; height: 5px; margin-left: -8px; border-radius: 50%;
  background: radial-gradient(ellipse at center, rgba(0,0,0,.35) 0%, transparent 70%); }
.pet-float.pa2 .pf { filter: drop-shadow(0 0 2px rgba(140,190,255,.95)); }
.pet-float.pa3 .pf { filter: drop-shadow(0 0 2px rgba(224,178,76,1)); }
.pet-float.pa4 .pf { filter: drop-shadow(0 0 2px rgba(230,60,50,1)); }
.pet-float.pa5 .pf { filter: drop-shadow(0 0 2px #c59bff) drop-shadow(0 0 3px #7fb2ff); }
.pet-float.pa2::after { background: radial-gradient(ellipse at center, rgba(140,190,255,.7) 0%, transparent 70%); }
.pet-float.pa3::after { background: radial-gradient(ellipse at center, rgba(224,178,76,.8) 0%, transparent 70%); }
.pet-float.pa4::after { background: radial-gradient(ellipse at center, rgba(230,60,50,.8) 0%, transparent 70%); }
.pet-float.pa5::after { background: radial-gradient(ellipse at center, rgba(197,155,255,.85) 0%, transparent 70%); }

/* 18 ต.ค. จ๊อบ: แท็บแรกชิดซ้ายสุดของกรอบ ไม่ให้เห็นมุมเล็กๆ โผล่ทางซ้าย */
body[data-zone] #col-people .tabs.icon-tabs { padding-left: 0 !important; }
body[data-zone] #col-people .tabs.icon-tabs .tab:first-child.on::before { display: none; }
body[data-zone] #col-people .tabs.icon-tabs .tab:first-child.on { position: relative; z-index: 2; border-left-width: 6px; }

/* ---------- หน้าต่างการ์ดสัตว์ (19 ต.ค. จ๊อบ ตามม็อกอัพ cards.html) ----------
   การ์ด 3D ซ้าย (ผืนวาด 325×448 = การ์ด 260×400 + ที่เอียง) · แผงขวาสูงเท่าการ์ด 400 */
body[data-zone] .pcv .cv-box { align-items: center; }
body[data-zone] .pcv .cv-cardslot { width: 325px; height: 448px; display: flex; align-items: center; justify-content: center; margin: 0 -18px 0 -32px; will-change: auto; }
body[data-zone] .pcv .cv-panel { height: 400px; max-height: none; display: flex; flex-direction: column; }
.pcv .pd-pills { margin-bottom: 2px; }
.pcv .pcv-fx { margin-top: 4px; }
.pcv .pcv-fx .pd-line { font-size: 12px; padding: 3px 0; border-bottom: 1px dashed rgba(255,255,255,.08); cursor: help; }
.pcv .pcv-lv { display: flex; justify-content: space-between; font-size: 12px; }
.pcv .pcv-team { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; }
.pcv .pcv-team .job.on { box-shadow: inset 0 0 0 2px #7fc45a; }
.pcv .pcv-team .job.on::after { content: ' ✓'; color: #7fc45a; }
.pcv .pcv-foot { display: flex; gap: 6px; margin-top: auto; padding-top: 10px; }
.pcv .pcv-foot .job { flex: 1; }
#tab-pets .pt-grid.drop-ok, #tab-pets .pt-grid.drop-bad { outline-offset: 4px; }
body.m-mode .pcv .cv-cardslot { zoom: .8; margin: 0; }
body.m-mode .pcv .cv-panel { height: auto; }
