/* Thư viện tướng (trang riêng /trang-chu/thu-vien.html) — dữ liệu thu-vien-tuong.json do cong-cu/xuat-thu-vien.mjs xuất.
   Bố cục học mục «Đặc sắc tướng» của 3qgoituongdi.vn nhưng KHÔNG dùng ảnh của trang đó: nền vẽ bằng CSS,
   ảnh tướng + icon kỹ năng là ảnh thật trong client game. Tiền tố lớp: .tv- */
.tv-trang { position: relative; overflow: hidden; padding: 40px 0 70px; min-height: calc(100vh - 70px);
  background:
    radial-gradient(ellipse 60% 45% at 50% 55%, #ff6a1a33, transparent 70%),
    radial-gradient(ellipse 40% 60% at 10% 100%, #b3150f55, transparent 70%),
    radial-gradient(ellipse 40% 60% at 90% 0%, #b3150f44, transparent 70%),
    linear-gradient(#0d0806, #1c0b06 40%, #160805 70%, #0d0806); }
.tv-trang .tieu-de { position: relative; z-index: 2; padding: 0 16px; }
.tv-tan { position: absolute; inset: 0; pointer-events: none; z-index: 0; }
.tv-tan i { position: absolute; bottom: -10px; width: 4px; height: 4px; border-radius: 50%; background: #ffb347; box-shadow: 0 0 8px 2px #ff7a1a;
  opacity: 0; animation: tv-tan 9s linear infinite; }
@keyframes tv-tan { 0% { transform: translate(0, 0); opacity: 0; } 10% { opacity: .9; } 80% { opacity: .5; } 100% { transform: translate(60px, -900px); opacity: 0; } }

.tv { position: relative; z-index: 1; max-width: 1180px; margin: 0 auto; padding: 0 16px; }
.tv-tai { text-align: center; padding: 120px 0; color: var(--chu-nhat); }

/* ---------- phe (cột trái, nghiêng như thẻ lụa) ---------- */
.tv-phe { list-style: none; margin: 0; padding: 0; position: absolute; left: 0; top: 70px; z-index: 5; display: flex; flex-direction: column; gap: 14px; }
.tv-phe button { --lech: 0px; margin-left: var(--lech); width: 96px; height: 44px; border: 0; cursor: pointer; transform: skewX(-14deg); position: relative;
  background: linear-gradient(#7d7d7d, #3d3d3d); box-shadow: 0 0 0 2px #1a1a1a, 0 0 0 4px #b9b9b9, 4px 6px 0 2px #6d0b07, 0 8px 14px #000a;
  color: #fff; font: italic 700 20px/44px "Segoe UI", Tahoma, sans-serif; text-shadow: 0 2px 2px #000; transition: transform .15s, filter .15s; }
.tv-phe button span { display: inline-block; transform: skewX(14deg); }
.tv-phe button:hover { filter: brightness(1.2); transform: skewX(-14deg) translateX(4px); }
.tv-phe button[aria-selected="true"] { background: linear-gradient(#ffe27a, #c48a14); color: #fff; box-shadow: 0 0 0 2px #3a2200, 0 0 0 4px #ffe9a8, 4px 6px 0 2px #6d0b07, 0 0 22px #ffb34799; }
.tv-phe li:nth-child(1) button { --lech: 64px; } .tv-phe li:nth-child(2) button { --lech: 44px; } .tv-phe li:nth-child(3) button { --lech: 26px; }
.tv-phe li:nth-child(4) button { --lech: 16px; } .tv-phe li:nth-child(5) button { --lech: 8px; } .tv-phe li:nth-child(6) button { --lech: 0px; }

/* ---------- sân khấu: cuộn giấy ---------- */
.tv-san { position: relative; margin-left: 190px; min-height: 560px; border-radius: 18px; padding: 34px 34px 26px 40px;
  display: grid; grid-template-columns: 240px minmax(0, 1fr) 290px; grid-template-rows: 1fr auto; gap: 8px 10px;
  background:
    radial-gradient(ellipse 34% 30% at 50% 66%, #fff4c8 0%, #ffd77a55 45%, transparent 75%),
    radial-gradient(ellipse 80% 75% at 50% 50%, #f3d79c 0%, #e2b56a 55%, #b8772f 100%);
  box-shadow: inset 0 0 0 2px #7a3b10, inset 0 0 60px #6b2a0a99, 0 24px 50px #000c, 0 0 0 6px #2a0d05, 0 0 0 8px #d9a44166; }
.tv-san::before, .tv-san::after { content: ""; position: absolute; top: -14px; bottom: -14px; width: 26px; border-radius: 14px; z-index: 2;
  background: linear-gradient(90deg, #4a0c06, #b3150f 30%, #ff5a3c 48%, #b3150f 66%, #3a0904); box-shadow: 0 6px 14px #000b, inset 0 0 0 2px #1a0402; }
.tv-san::before { left: -14px; } .tv-san::after { right: -14px; }
.tv-van { position: absolute; inset: 0; border-radius: 18px; pointer-events: none; opacity: .18;
  background: repeating-linear-gradient(95deg, transparent 0 22px, #7a3b1033 22px 23px), repeating-linear-gradient(5deg, transparent 0 40px, #7a3b1022 40px 41px); }

/* chữ tên */
.tv-trai { align-self: center; position: relative; z-index: 40; } /* chữ nằm trên tướng (tướng z 30 tràn ra khung) */
.tv-ten { margin: 0; font: italic 900 48px/1.02 "Segoe UI", Tahoma, sans-serif; text-transform: uppercase; color: #fff; letter-spacing: -.5px;
  text-shadow: 0 0 1px #5a1a05, 2px 2px 0 #7a2a0a, -1px -1px 0 #7a2a0a, 1px -1px 0 #7a2a0a, -1px 1px 0 #7a2a0a, 4px 6px 10px #5a1a0599; overflow-wrap: anywhere; }
.tv-ten.dai { font-size: 36px; }
.tv-phe-nho { display: inline-block; margin-bottom: 10px; padding: 3px 12px; border-radius: 3px; background: var(--do); color: var(--vang); font-weight: 700; font-size: 14px; box-shadow: 0 2px 0 #5a0b07; }
.tv-vai { margin-top: 22px; display: inline-block; font: 700 24px/1.2 "Segoe UI", Tahoma, sans-serif; color: #8b5a12; border-bottom: 2px solid #8b5a1299; padding: 0 4px 2px; }
.tv-he { margin-top: 6px; color: #2a1206; font-weight: 600; font-size: 16px; }
.tv-sao { margin-top: 8px; color: #e79b00; font-size: 20px; letter-spacing: 2px; text-shadow: 0 1px 0 #6b3a00, 0 0 6px #fff6; }

/* tướng ở giữa trên đài sáng */
.tv-giua { position: relative; display: flex; align-items: flex-end; justify-content: center; min-height: 540px; }
.tv-mo-hinh { position: absolute; left: -180px; right: -180px; top: -220px; bottom: 26px; width: calc(100% + 360px); height: calc(100% + 194px); z-index: 30; display: block; pointer-events: none; filter: drop-shadow(0 8px 10px #5a1a0566); }
.tv-mo-hinh[hidden], .tv-anh[hidden] { display: none; }
.tv-mo-hinh.vao { animation: tv-vao .45s ease-out; }
.tv-dang-tai { position: absolute; left: 0; right: 0; bottom: 120px; z-index: 3; text-align: center; color: #7a3b10; font-weight: 700; font-style: italic; animation: tv-nhap 1s ease-in-out infinite; }
@keyframes tv-nhap { 50% { opacity: .35; } }
.tv-thu-lai { margin-left: 8px; padding: 6px 14px; border-radius: 4px; border: 1px solid #ffcf7a; background: var(--do); color: #fff; cursor: pointer; }
.tv-dai { position: absolute; left: 50%; bottom: 6px; width: 340px; height: 96px; transform: translateX(-50%); border-radius: 50%;
  background: radial-gradient(ellipse at center, #fff9e0 0%, #ffd36b 30%, #e89a2a88 55%, transparent 72%); }
.tv-dai::before, .tv-dai::after { content: ""; position: absolute; inset: 8px 22px; border-radius: 50%; border: 2px solid #fff3c0cc; box-shadow: 0 0 12px #ffd36b; }
.tv-dai::after { inset: -8px -16px; border: 2px dashed #b8772faa; box-shadow: none; animation: tv-tho 3.2s ease-in-out infinite; }
@keyframes tv-tho { 50% { transform: scale(1.06); opacity: .55; } }
@keyframes tv-xoay { to { transform: rotate(360deg); } }
.tv-hao { position: absolute; left: 50%; bottom: 40px; width: 420px; height: 420px; transform: translateX(-50%); border-radius: 50%; pointer-events: none;
  background: repeating-conic-gradient(from 0deg, #fff6d000 0deg 9deg, #fff6d044 9deg 12deg); mask: radial-gradient(circle, #000 0 30%, transparent 70%);
  -webkit-mask: radial-gradient(circle, #000 0 30%, transparent 70%); animation: tv-xoay 60s linear infinite; }
.tv-anh { position: relative; z-index: 2; height: 400px; width: auto; max-width: 100%; object-fit: contain; margin-bottom: 30px; image-rendering: auto;
  -webkit-mask: linear-gradient(#000 78%, transparent 99%), linear-gradient(90deg, transparent 0, #000 14%, #000 86%, transparent 100%); -webkit-mask-composite: source-in;
  mask: linear-gradient(#000 78%, transparent 99%) intersect, linear-gradient(90deg, transparent 0, #000 14%, #000 86%, transparent 100%); filter: drop-shadow(0 10px 16px #5a1a0588); }
.tv-anh.vao { animation: tv-vao .45s ease-out; }
@keyframes tv-vao { from { opacity: 0; transform: translateY(18px) scale(.96); } to { opacity: 1; transform: none; } }
.tv-ten-mo { position: absolute; left: 0; right: 0; top: 18%; text-align: center; font: italic 900 92px/1 "Segoe UI", Tahoma, sans-serif; text-transform: uppercase;
  color: transparent; -webkit-text-stroke: 1px #8b5a1240; z-index: 1; white-space: nowrap; overflow: hidden; pointer-events: none; }

/* cột phải: tiểu sử + chi tiết kỹ năng */
.tv-phai { align-self: center; display: flex; flex-direction: column; gap: 12px; position: relative; z-index: 40; }
.tv-hop { position: relative; background: #4a0d07e6; color: #f6e7cf; padding: 14px 16px; border-radius: 4px; font-size: 14px; line-height: 1.6;
  box-shadow: inset 0 0 0 1px #ff8a3c55, 0 8px 18px #0008; }
.tv-hop::before, .tv-hop::after { content: ""; position: absolute; width: 14px; height: 14px; border: 2px solid #ff9a3c; }
.tv-hop::before { left: -4px; top: -4px; border-right: 0; border-bottom: 0; } .tv-hop::after { right: -4px; bottom: -4px; border-left: 0; border-top: 0; }
.tv-hop h3 { margin: 0 0 6px; color: var(--vang); font-size: 15px; display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; }
.tv-hop h3 small { font-weight: 600; font-size: 12px; color: #ffb38a; }
.tv-hop p { margin: 0; }
.tv-cuon { max-height: 150px; overflow-y: auto; padding-right: 6px; scrollbar-width: thin; scrollbar-color: #ff9a3c66 transparent; }
.tv-kn-chi .tv-cuon { max-height: 190px; }
.tv-buff { margin-top: 8px; padding-top: 8px; border-top: 1px dashed #ff9a3c55; color: #ffd8b0; font-size: 13px; white-space: pre-line; }

/* bộ kỹ năng */
.tv-kn { grid-column: 1 / 3; display: flex; align-items: center; gap: 18px; z-index: 3; }
.tv-kn-nhan { font: italic 900 24px/1 "Segoe UI", Tahoma, sans-serif; color: #b3150f; text-transform: uppercase; white-space: nowrap; text-shadow: 0 1px 0 #fff8; }
.tv-kn-ds { display: flex; gap: 14px; flex-wrap: wrap; }
.tv-kn-ds button { width: 92px; border: 0; background: none; padding: 0; cursor: pointer; text-align: center; color: #fff; font: 700 13px/1.15 "Segoe UI", Tahoma, sans-serif;
  text-shadow: 0 0 2px #3a1206, 1px 1px 0 #3a1206, -1px -1px 0 #3a1206, 1px -1px 0 #3a1206, -1px 1px 0 #3a1206; }
.tv-kn-ds .vong { display: block; position: relative; width: 72px; height: 72px; margin: 0 auto 13px; border-radius: 50%; padding: 4px;
  background: linear-gradient(145deg, #fff3c0, #c8902c 45%, #7a4a10); box-shadow: 0 4px 10px #5a1a0599; transition: transform .15s, box-shadow .15s; }
.tv-kn-ds img { width: 100%; height: 100%; border-radius: 50%; display: block; background: #1a2a4a; object-fit: cover; }
.tv-kn-ds .loai { position: absolute; left: 50%; bottom: -6px; transform: translateX(-50%); padding: 0 6px; border-radius: 8px; font-size: 10px; line-height: 16px;
  background: #5a2a0a; color: #ffe3a6; text-shadow: none; white-space: nowrap; box-shadow: 0 0 0 1px #d9a441; }
.tv-kn-ds .loai.bd { background: #2a3a5a; }
.tv-kn-ds button:hover .vong { transform: translateY(-3px); }
.tv-kn-ds button[aria-pressed="true"] .vong { box-shadow: 0 0 0 3px #fff, 0 0 18px 4px #ffb347; }

/* ---------- dải chọn tướng ---------- */
.tv-chon { margin: 26px 0 0 190px; display: flex; align-items: center; gap: 10px; }
.tv-mui { flex: none; width: 52px; height: 52px; border-radius: 50%; border: 0; cursor: pointer; color: #fff; font-size: 22px;
  background: radial-gradient(circle at 40% 35%, #fff3c0, #d9a441 45%, #6b3a0a); box-shadow: 0 0 0 2px #3a1a04, 0 0 0 4px #d9a44188, 0 6px 12px #000a; text-shadow: 0 1px 2px #000; }
.tv-mui:hover { filter: brightness(1.15); }
.tv-ds { flex: 1; display: flex; gap: 10px; overflow-x: auto; scroll-snap-type: x mandatory; scroll-behavior: smooth; padding: 6px 4px 10px; scrollbar-width: thin; scrollbar-color: #d9a44166 transparent; }
.tv-ds button { flex: none; scroll-snap-align: start; width: 96px; border: 0; cursor: pointer; padding: 6px 4px 8px; border-radius: 6px; text-align: center;
  background: linear-gradient(#5a5a5a, #2a2a2a); box-shadow: inset 0 0 0 2px #9a9a9a; color: #eee; font: 700 12px/1.2 "Segoe UI", Tahoma, sans-serif; filter: saturate(.55);
  transition: filter .15s, transform .15s; }
.tv-ds button img { display: block; width: 64px; height: 64px; margin: 0 auto 6px; border-radius: 50%; background: #0006; box-shadow: 0 0 0 2px #0008; }
.tv-ds button:hover { filter: none; transform: translateY(-2px); }
.tv-ds button[aria-selected="true"] { filter: none; background: linear-gradient(#e9c24a, #8a6a10); box-shadow: inset 0 0 0 2px #fff0b0, 0 0 16px #ffb34799; color: #fff; text-shadow: 0 1px 2px #000; }
.tv-dem { text-align: center; margin: 8px 0 0 190px; color: var(--chu-nhat); font-size: 13px; }


/* ---------- màn vừa ---------- */
/* màn vừa (máy tính bảng ngang, cửa sổ hẹp): nút phe thành một hàng trên đầu — xếp chéo bên trái không đủ chỗ */
@media (max-width: 1180px) {
  .tv-phe { position: static; flex-direction: row; justify-content: center; flex-wrap: wrap; gap: 12px 18px; margin: 0 0 22px; }
  .tv-phe li button { --lech: 0px !important; }
  .tv-san { margin-left: 0; }
  .tv-chon, .tv-dem { margin-left: 0; }
}
@media (max-width: 1100px) {
  .tv-san { grid-template-columns: 220px minmax(0, 1fr) 260px; padding: 28px 26px 22px 30px; }
  .tv-ten { font-size: 40px; }
  .tv-anh { height: 350px; } .tv-giua { min-height: 460px; }
}
/* ---------- điện thoại / máy tính bảng dọc ---------- */
@media (max-width: 860px) {
  .tv { padding: 0 16px; }
  .tv-phe { position: static; flex-direction: row; flex-wrap: wrap; justify-content: center; gap: 10px 12px; margin: 0 0 18px; }
  .tv-phe { display: grid; grid-template-columns: repeat(3, 84px); justify-content: center; gap: 12px 16px; }
  .tv-phe li button { --lech: 0px !important; width: 84px; height: 34px; font-size: 16px; line-height: 34px; }
  .tv-san { margin: 0 6px; grid-template-columns: 1fr; grid-template-rows: auto; padding: 22px 16px 18px; min-height: 0; text-align: center; }
  .tv-san::before, .tv-san::after { width: 16px; left: -8px; } .tv-san::after { left: auto; right: -8px; }
  .tv-trai { order: 1; } .tv-giua { order: 2; min-height: 360px; } .tv-mo-hinh { top: -110px; height: calc(100% + 84px); left: -120px; right: -120px; width: calc(100% + 240px); } .tv-kn { order: 3; grid-column: auto; flex-direction: column; gap: 10px; } .tv-phai { order: 4; text-align: left; }
  .tv-ten, .tv-ten.dai { font-size: 30px; } .tv-vai { margin-top: 10px; font-size: 19px; } .tv-ten-mo { display: none; }
  .tv-anh { height: 280px; margin-bottom: 22px; } .tv-dai { width: 260px; height: 74px; } .tv-hao { width: 300px; height: 300px; }
  .tv-kn-ds { justify-content: center; gap: 4px; flex-wrap: nowrap; } .tv-kn-ds button { width: 70px; font-size: 11.5px; } .tv-kn-ds .vong { width: 54px; height: 54px; }
  .tv-chon, .tv-dem { margin-left: 0; }
  .tv-mui { width: 40px; height: 40px; font-size: 18px; }
  .tv-ds button { width: 80px; } .tv-ds button img { width: 54px; height: 54px; }
}
@media (prefers-reduced-motion: reduce) { .tv-tan i, .tv-dai::after, .tv-hao, .tv-anh.vao { animation: none; } .tv-ds { scroll-behavior: auto; } }
