/* char-page.css — หน้าตัวละคร (Code/Characters/char-page.js) แบบหน้าตัวละคร Arknights: Endfield ในธีมซากุระ
   หน่วยเป็น vh ทั้งหมด เพราะเกมเป็นจอแนวนอน (สูงคงที่ กว้างเปลี่ยนตามเครื่อง)
   ป๊อปอัปใช้เนื้อหาเดิมของ char-level.js (.cl) และ skills.js (.ck) — สไตล์ข้างในเป็นของไฟล์เหล่านั้น */
/* ตัวหนังสือมีขั้นต่ำเป็น px — max(ขั้นต่ำ, เดิม vh) (Beta 0.21.1): บนมือถือแนวนอนจอสูงราว 360px ขนาด vh ล้วนเหลือ 5–8px อ่านไม่ออก · จอใหญ่ขนาดเท่าเดิม */
.cp {
  --cp-ink: #3b4255;
  --cp-soft: #6b7285;
  --cp-pink: #e86a92;
  --cp-gold: #c9962e;
  position: fixed;
  inset: 0;
  overflow: hidden;
  color: var(--cp-ink);
  font-family: Mali, Sarabun, sans-serif;
  background:
    repeating-linear-gradient(90deg, #3b425508 0 1px, transparent 1px 12vh),
    repeating-linear-gradient(0deg, #3b425508 0 1px, transparent 1px 12vh),
    linear-gradient(160deg, #fbf6f1, #efe7ea 60%, #e9e3ea); /* พื้นทึบ — ไม่ให้พื้นหลังหน้าอื่นโผล่ */
}
.cp button {
  font: inherit;
  cursor: pointer;
}
.cp svg {
  width: 55%;
  height: 55%;
}

/* ---------- ฉาก: แถบเฉียงชมพู (แทนแถบเหลือง Endfield) · ภาพจาง · ภาพเต็มตัว ---------- */
.cp-band {
  position: absolute;
  right: -12vh;
  top: -20vh;
  width: 62vh;
  height: 150vh;
  background: linear-gradient(180deg, #f6b7cb, #ec86a8);
  transform: rotate(28deg);
  opacity: 0.9;
  pointer-events: none;
}
.cp-band-txt {
  position: absolute;
  right: 47vh; /* ซ้ายของแผงขวา (กว้าง 42vh + ขอบ 4vh) — ไม่ซ้อนหลังช่องชุดแต่ง */
  bottom: 3vh;
  writing-mode: vertical-rl;
  font: 900 max(17px, 10vh)/1 Georgia, serif;
  letter-spacing: 0.04em;
  color: #ffffffb3;
  pointer-events: none;
}
.cp-ghost {
  position: absolute;
  left: 14vh;
  top: 2vh;
  height: 115vh;
  opacity: 0.09;
  filter: grayscale(1);
  pointer-events: none;
}
.cp-hero {
  position: absolute;
  left: 50%;
  bottom: -6vh;
  height: 104vh;
  transform: translateX(-52%);
  filter: drop-shadow(0 1vh 2vh #0003);
  pointer-events: none;
}

/* ---------- แถบบน ---------- */
.cp-top {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 12vh;
  display: flex;
  align-items: center;
  gap: 2vh;
  padding: 0 2.4vh;
  background: linear-gradient(#fffaf2f0, #fffaf200);
  z-index: 2;
}
.cp-back,
.cp-x {
  flex: none;
  width: 5vh;
  height: 5vh;
  border: 0;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: var(--cp-ink);
  background: url(../../Assets/UI/Assets/kit3/btn-round.webp) center / 100% 100% no-repeat;
}
.cp-crumb {
  flex: none;
  font: 800 max(13px, 2.4vh)/1 Mali, sans-serif;
  white-space: nowrap;
}
.cp-crumb small {
  margin-left: 0.6vh;
  font-weight: 700;
  color: var(--cp-soft);
}
.cp-roster {
  flex: 1;
  min-width: 0;
  display: flex;
  justify-content: center;
  gap: 1.4vh;
  overflow-x: auto;
  padding: 1vh 0.6vh 1.6vh; /* เผื่อเส้นใต้ตัวที่เลือก + ขอบเรือง */
  scrollbar-width: none;
}
.cp-face {
  position: relative;
  flex: none;
  width: 8.6vh; /* ใหญ่ขึ้นจาก 6.4vh (เจ้าของขอ · 0.20.1) */
  height: 8.6vh;
  padding: 0;
  border-radius: 50%;
  border: 0.4vh solid #fff;
  background: #f2e9ee;
  box-shadow: 0 0.4vh 0.8vh #0003;
}
.cp-face > i {
  /* จุดสีบอกเรท */
  position: absolute;
  right: -0.3vh;
  top: -0.3vh;
  width: 2.2vh;
  height: 2.2vh;
  border-radius: 50%;
  border: 0.3vh solid #fff;
  background: #9aa3b5;
}
.cp-face.r-rare > i {
  background: #9b6be0;
}
.cp-face.r-sr > i {
  background: #e0a521;
}
.cp-face.r-ssr > i {
  background: conic-gradient(#ff9ac0, #ffd36b, #8fe3ff, #c7a2ff, #ff9ac0);
}
.cp-face.on {
  outline: 0.4vh solid var(--cp-pink);
  outline-offset: 0.3vh;
}
.cp-face.on::after {
  content: '';
  position: absolute;
  left: 20%;
  right: 20%;
  bottom: -1.4vh;
  height: 0.5vh;
  border-radius: 9px;
  background: var(--cp-pink);
}

/* ---------- ซ้าย ---------- */
.cp-left {
  position: absolute;
  left: 3vh;
  top: 15vh;
  width: 44vh;
  z-index: 1;
}
.cp-name {
  display: flex;
  align-items: center;
  gap: 1.4vh;
  padding: 1vh 1.4vh;
  color: #fff;
  border-radius: 1vh 0 0 1vh;
  background: linear-gradient(90deg, #3b4255, #3b4255d0 70%, #3b425500);
}
.cp-name b {
  display: block;
  font: 900 max(17px, 4vh)/1.05 Mali, sans-serif;
}
.cp-name small {
  display: block;
  font: 700 max(12px, 1.8vh)/1.2 Sarabun, sans-serif;
  color: #ffd6e4;
}
.cp-rar {
  flex: none;
  width: 7vh;
  height: 7vh;
  border-radius: 1.2vh;
  display: grid;
  place-items: center;
  font: 900 max(13px, 2.2vh)/1 Georgia, serif;
  color: #fff;
  background: #7d8597;
  box-shadow: inset 0 0 0 0.35vh #fff8;
  text-shadow: 0 0.2vh 0.4vh #0006;
}
.cp-rar.r-rare {
  background: linear-gradient(135deg, #b48cf0, #7a4fd0);
}
.cp-rar.r-sr {
  background: linear-gradient(135deg, #ffd36b, #d99a12);
}
.cp-rar.r-ssr {
  background: conic-gradient(from 200deg, #ff9ac0, #ffd36b, #8fe3ff, #c7a2ff, #ff9ac0);
}
.cp-stars {
  display: block;
  margin-top: 0.4vh;
  font-size: max(13px, 2.2vh);
  letter-spacing: 0.2vh;
}
.cp-stars i {
  font-style: normal;
  color: #ffffff40;
}
.cp-stars i.on {
  color: #ffd36b;
}
.cp-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.8vh;
  margin: 1.2vh 0 1.8vh;
}
.cp-tags span {
  padding: 0.5vh 1.4vh;
  border-radius: 0.6vh;
  background: #ffffffd0;
  box-shadow: 0 0.2vh 0.5vh #0001;
  font: 700 max(12px, 1.7vh)/1.3 Sarabun, sans-serif;
}
.cp-sec {
  padding: 0.6vh 1.2vh;
  border-radius: 0.6vh 0.6vh 0 0;
  background: var(--cp-ink);
  color: #fff;
  font: 800 max(12px, 1.9vh)/1.2 Mali, sans-serif;
}
.cp-skill {
  display: flex;
  align-items: center;
  gap: 1.4vh;
  padding: 1.4vh 1.2vh;
  border-radius: 0 0 0.8vh 0.8vh;
  background: #ffffffc8;
}
.cp-skic {
  flex: none;
  width: 8vh;
  height: 8vh;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: var(--cp-pink);
  background: radial-gradient(circle at 50% 35%, #fff, #f6d9e4);
  box-shadow:
    0 0 0 0.4vh var(--cp-gold),
    0 0.5vh 1vh #0003;
}
.cp-skill b {
  font: 800 max(13px, 2.3vh)/1.2 Mali, sans-serif;
}
.cp-skill p {
  margin: 0.3vh 0 0;
  font: 600 max(12px, 1.6vh)/1.35 Sarabun, sans-serif;
  color: var(--cp-soft);
}
.cp-tier {
  margin-left: 0.6vh;
  padding: 0.1vh 0.8vh;
  border-radius: 0.5vh;
  font: 800 max(11px, 1.4vh)/1.4 Sarabun, sans-serif;
  font-style: normal;
  color: #fff;
  vertical-align: middle;
  background: #7d8597;
}
.cp-tier.rare {
  background: #9b6be0;
}
.cp-tier.sr {
  background: #d99a12;
}
.cp-tier.ssr {
  background: linear-gradient(90deg, #ff9ac0, #c7a2ff);
}
.cp-unlocks {
  display: flex;
  flex-wrap: wrap;
  gap: 0.8vh;
  margin-top: 1.4vh;
}
.cp-unlocks span {
  display: inline-flex;
  align-items: center;
  gap: 0.6vh;
  padding: 0.5vh 1.2vh;
  border-radius: 99px;
  background: #ffffffd0;
  font: 700 max(12px, 1.6vh)/1.3 Sarabun, sans-serif;
}
.cp-unlocks b {
  color: var(--cp-gold);
}
.cp-unlocks .lock {
  background: #3b42551a;
  color: #3b425599;
}

/* ---------- ขวา ---------- */
.cp-right {
  position: absolute;
  right: 4vh;
  top: 14vh;
  width: 42vh;
  z-index: 1;
}
.cp-lv {
  display: flex;
  align-items: flex-end;
  gap: 1.4vh;
}
.cp-lv > b {
  font: 900 max(17px, 11vh)/0.85 Georgia, serif;
  text-shadow: 0 0.3vh 0 #fff;
}
.cp-lv > span {
  padding-bottom: 0.8vh;
  font: 800 max(13px, 2vh)/1.3 Sarabun, sans-serif;
}
.cp-lv small {
  display: block;
  font-weight: 700;
  color: #fff;
  text-shadow: 0 0.1vh 0.3vh #0006;
}
.cp-exp {
  height: 1vh;
  margin: 1vh 0 1.2vh;
  border-radius: 9px;
  overflow: hidden;
  background: #3b425533;
}
.cp-exp i {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, #ff9cc2, var(--cp-pink));
}
.cp-ups {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1vh;
}
.cp-up {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.2vh 1.4vh;
  border: 0;
  border-radius: 0.8vh;
  text-align: left;
  color: #fff;
  background: #3b4255e8;
  font: 800 max(13px, 2vh)/1.2 Mali, sans-serif !important;
}
.cp-up small {
  display: block;
  font: 600 max(11px, 1.4vh)/1.2 Sarabun, sans-serif;
  color: #ffd6e4;
}
.cp-up i {
  flex: none;
  width: 3.2vh;
  height: 3.2vh;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--cp-pink);
}
.cp-up:active,
.cp-slot:active,
.cp-face:active {
  transform: scale(0.97);
}
.cp-slots {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1vh;
  margin-top: 1.6vh;
}
.cp-slot {
  height: 10vh;
  display: flex;
  align-items: center;
  gap: 1vh;
  padding: 1vh;
  border: 0;
  border-radius: 0.8vh;
  text-align: left;
  color: var(--cp-ink);
  background: #ffffffd8;
  box-shadow: inset 0 0 0 0.25vh #3b425522;
}
.cp-slot.lock {
  background: #3b425514;
  cursor: default;
}
.cp-slpv {
  position: relative;
  flex: none;
  width: 6.4vh;
  height: 8vh;
  display: grid;
  place-items: center;
  overflow: hidden;
  border-radius: 0.5vh;
}
.cp-slpv > span:not(.cp-slic) {
  /* รูปตัวอย่างจาก prevBox() (Shop/shop.js) ให้เต็มช่องเล็ก */
  position: absolute;
  inset: 0;
  width: 100% !important;
  height: 100% !important;
}
.cp-slic {
  width: 5vh;
  height: 5vh;
  display: grid;
  place-items: center;
  color: #3b425577;
}
.cp-slot b {
  display: block;
  font: 800 max(12px, 1.7vh)/1.2 Mali, sans-serif;
}
.cp-slot small {
  display: block;
  font: 600 max(11px, 1.4vh)/1.2 Sarabun, sans-serif;
  color: var(--cp-soft);
}
.cp-dupe {
  display: flex;
  align-items: center;
  gap: 1.2vh;
  margin-top: 1.4vh;
  padding: 1vh 1.4vh;
  border-radius: 0.8vh;
  background: #ffffffd0;
  font: 700 max(12px, 1.7vh)/1.3 Sarabun, sans-serif;
}
.cp-dupe > b {
  font: 900 max(17px, 3.6vh)/1 Georgia, serif;
  color: var(--cp-pink);
}
.cp-dupe > span {
  flex: 1;
}
.cp-dupe small {
  display: block;
  font-weight: 600;
  color: var(--cp-soft);
}
.cp-dupe button {
  padding: 0.8vh 1.4vh;
  border: 0;
  border-radius: 0.6vh;
  color: #fff;
  background: var(--cp-ink);
  font: 800 max(12px, 1.6vh)/1.2 Mali, sans-serif;
}

/* ---------- ล่าง ---------- */
.cp-count {
  position: absolute;
  left: 3vh;
  bottom: 3vh;
  padding: 1.6vh 1.8vh;
  border-radius: 0.8vh;
  background: #ffffffd0;
  box-shadow: 0 0.3vh 0.6vh #0002;
  font: 800 max(12px, 1.8vh)/1 Mali, sans-serif;
  z-index: 1;
}
.cp-equip {
  position: absolute;
  right: 3vh;
  bottom: 2.6vh;
  width: 38vh;
  height: 10vh;
  display: grid;
  place-items: center;
  padding: 0;
  background: none;
  border-style: solid;
  border-color: transparent;
  border-width: 0 8.8vh 0 7.6vh;
  border-image: url(../../Assets/UI/Assets/kit3/btn-gold.webp) 0 72 0 62 fill / 0 8.8vh 0 7.6vh stretch;
  color: #6b3f12;
  font: 900 max(17px, 4.2vh)/1 Mali, sans-serif !important;
  filter: drop-shadow(0 0.8vh 1.2vh #0004);
  z-index: 1;
}
.cp-equip.on {
  filter: grayscale(0.6) opacity(0.8);
  cursor: default;
}
.cp-none {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font: 800 max(15px, 2.6vh)/1 Mali, sans-serif;
  color: var(--cp-soft);
}

/* ---------- ป๊อปอัป ---------- */
.cp-pop {
  position: absolute;
  inset: 0;
  z-index: 10;
  display: grid;
  place-items: center;
  background: #2a304088;
}
.cp-pop-box {
  position: relative;
  width: min(92vw, 78vh);
  max-height: 88vh;
  overflow-y: auto;
  padding: 2.4vh;
  border-radius: 2vh;
  background: #fffaf2;
  box-shadow: 0 1.6vh 4vh #0006;
}
.cp-pop-box h3 {
  margin: 0 0 1.6vh;
  font: 900 max(15px, 2.8vh)/1.2 Mali, sans-serif;
}
.cp-pop-x {
  position: absolute;
  right: 1.6vh;
  top: 1.6vh;
  width: 4.6vh;
  height: 4.6vh;
  border: 0;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: var(--cp-ink);
  background: #3b42551a;
}
.cp-pop-empty {
  font: 700 max(12px, 1.9vh)/1.4 Sarabun, sans-serif;
  color: var(--cp-soft);
}

@media (prefers-reduced-motion: reduce) {
  .cp-up:active,
  .cp-slot:active,
  .cp-face:active {
    transform: none;
  }
}

/* ---------- จอเตี้ย (มือถือแนวนอน) — ตัวหนังสือมีขั้นต่ำ px แผงจึงต้องกว้าง/ยืดได้ (Beta 0.21.1) ---------- */
.cp-left {
  width: max(44vh, 240px);
  max-height: calc(100vh - 15vh - 13vh); /* เหนือปุ่มนับจำนวนด้านล่าง — เกินให้เลื่อนในแผง */
  overflow-y: auto;
  scrollbar-width: none;
}
.cp-right {
  width: max(42vh, 250px);
  max-height: calc(100vh - 14vh - 14vh); /* เหนือปุ่ม "ใช้ตัวนี้" */
  overflow-y: auto;
  scrollbar-width: none;
}
.cp-slot {
  height: auto;
  min-height: 10vh;
}
.cp-slpv {
  height: max(8vh, 40px);
  width: max(6.4vh, 32px);
}
