/* หน้า Tier List + ตัวจัด tier (ใช้ร่วมกับหลังบ้าน) — โทนเดียวกับหน้าอื่น */
.tl-page { font-family: var(--gs-font, "Fredoka", "Noto Sans Thai", system-ui, sans-serif); display: grid; gap: 12px; }
.tl-top { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 10px; }
.tl-tabs, .tl-acts { display: flex; gap: 8px; flex-wrap: wrap; }
.tl-tabs button, .tl-btn { padding: 9px 16px; border-radius: 12px; font: 700 16px var(--gs-font, inherit); color: #fff; cursor: pointer; border: 3px solid #ffffff22;
  background: linear-gradient(180deg, #4a4e57, #33363d); box-shadow: 0 4px 0 #0008, 0 0 0 2px #0c0d0f; -webkit-text-stroke: 4px #16121f; paint-order: stroke fill; transition: transform .1s; }
.tl-tabs button.on { background: linear-gradient(180deg, #74f06c, #34c23e); border-color: #a8ffa0; }
.tl-btn.share { background: linear-gradient(180deg, #6c7bff, #4a4fe0); border-color: #aab3ff66; }
.tl-tabs button:active, .tl-btn:active { transform: translateY(3px); box-shadow: 0 1px 0 #0008, 0 0 0 2px #0c0d0f; }
.tl-help { margin: 0; font-size: 13px; color: #a8a3b8; line-height: 1.5; }
.tl-src { margin: 4px 0 0; font-size: 12px; color: #6f6b7c; }
.tl-src a { color: #a8a3b8; }
.tl-shared { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 10px 14px; border-radius: 14px; background: #1d2240; border: 2px solid #6c7bff66; color: #dfe3ff; font-size: 14px; font-weight: 600; }
.tl-shared span { flex: 1 1 260px; }
.tl-shared .tl-btn { font-size: 14px; padding: 7px 12px; }

/* ---------- ตัวจัด tier ---------- */
.te { --ts: 64px; display: grid; gap: 10px; font-family: var(--gs-font, "Fredoka", "Noto Sans Thai", system-ui, sans-serif); }
.te-tiers { display: grid; gap: 4px; padding: 4px; border-radius: 16px; background: #0c0d0f; border: 4px solid #0c0d0f; box-shadow: 0 16px 36px #000a, inset 0 0 0 2px #2a2c31; }
.te-row { display: grid; grid-template-columns: 150px minmax(0, 1fr); min-height: calc(var(--ts) + 12px); }
.te-label { position: relative; display: grid; place-items: center; padding: 8px 22px 8px 8px; border: 0; border-radius: 10px 0 0 10px; cursor: pointer; background: var(--c);
  font: 700 17px var(--gs-font, inherit); line-height: 1.15; text-align: center; overflow-wrap: break-word; min-width: 0; }
.te-label i { position: absolute; right: 6px; top: 6px; font-style: normal; font-size: 12px; opacity: .55; }
.te-label:hover i { opacity: 1; }
.te-drop { display: flex; flex-wrap: wrap; align-content: flex-start; gap: 6px; padding: 6px; min-height: calc(var(--ts) + 12px); background: #17181c; border-radius: 0 10px 10px 0; transition: background .15s, box-shadow .15s; }
.te-drop.over { background: #20232c; box-shadow: inset 0 0 0 2px #6c7bff; }
.te-empty { align-self: center; color: #4d4a57; font-size: 13px; padding-left: 6px; pointer-events: none; }
.te-u { position: relative; width: var(--ts); height: var(--ts); border-radius: 10px; border: 3px solid var(--rc); background: #0b0c10; overflow: hidden; cursor: grab; flex: none;
  display: grid; place-items: center; color: #8b8796; font-size: 24px; touch-action: manipulation; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; transition: transform .12s; }
.te-u img { width: 100%; height: 100%; object-fit: cover; pointer-events: none; }
.te-emo { width: 100%; height: 100%; display: grid; place-items: center; font-style: normal; font-size: calc(var(--ts) * .55); pointer-events: none; }
.te-card-h em.te-ph { font-style: normal; font-size: 30px; }
.te-cu { position: absolute; left: 1px; top: 0; font-style: normal; font-size: 11px; pointer-events: none; filter: drop-shadow(0 1px 1px #000); }
.te-u:hover { transform: translateY(-2px); }
.te-u.te-dragging { opacity: .25; }
.te-u.te-lift { transform: scale(1.08); }
.te-ghost { position: fixed; left: 0; top: 0; z-index: 9999; pointer-events: none; opacity: .92; box-shadow: 0 10px 24px #000c; cursor: grabbing; transition: none; }
.te-ph-slot { width: var(--ts); height: var(--ts); border-radius: 10px; border: 2px dashed #6c7bff; background: #6c7bff22; flex: none; }
body.te-busy, body.te-busy * { cursor: grabbing !important; user-select: none; }
.te-add { justify-self: start; padding: 7px 14px; border-radius: 10px; border: 2px dashed #ffffff33; background: none; color: #d7d2e2; font: 700 14px var(--gs-font, inherit); cursor: pointer; }
.te-add:hover { border-color: #ffffff66; color: #fff; }
.te-bar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between; }
/* สวิตช์ "ใส่ตัวซ้ำได้" */
.te-dup { display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px 6px 8px; border-radius: 12px; background: #151619; border: 2px solid #2a2c31; color: #d7d2e2; font: 700 14px var(--gs-font, inherit); cursor: pointer; user-select: none; }
.te-dup input { display: none; }
.te-dup i { position: relative; width: 40px; height: 22px; border-radius: 11px; background: #2c2f37; flex: none; transition: background .2s; }
.te-dup i::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform .2s; }
.te-dup input:checked + i { background: linear-gradient(90deg, #34c23e, #74f06c); } .te-dup input:checked + i::after { transform: translateX(18px); }
.te-dup:has(input:checked) { border-color: #74f06c88; color: #fff; }
/* จำนวนที่ใช้แล้ว (กล่องรวมตอนเปิดตัวซ้ำ) */
.te-cnt { position: absolute; right: 2px; bottom: 2px; z-index: 1; padding: 0 5px; border-radius: 6px; background: #16121fdd; color: #74f06c; font: 700 11px/16px var(--gs-font, inherit); font-style: normal; pointer-events: none; }
/* กล่องแก้ tier */
.te-pop { display: grid; gap: 10px; padding: 12px; margin: 2px 0 6px; border-radius: 12px; background: #1e2026; border: 2px solid #ffffff1a; }
.te-pop label { display: grid; gap: 4px; font-size: 12px; font-weight: 600; color: #a8a3b8; }
.te-pop input.te-name { padding: 8px 10px; border-radius: 10px; border: 2px solid #2a2c31; background: #17181c; color: #fff; font: 700 16px var(--gs-font, inherit); max-width: 360px; }
.te-sw { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.te-sw button { width: 30px; height: 30px; border-radius: 8px; border: 2px solid #0008; cursor: pointer; }
.te-sw button.on { outline: 3px solid #fff; outline-offset: 1px; }
.te-cp { position: relative; display: grid !important; place-items: center; width: 34px; height: 30px; border-radius: 8px; background: #2a2c31; cursor: pointer; font-size: 16px !important; }
.te-cp input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.te-pop-b { display: flex; flex-wrap: wrap; gap: 6px; }
.te-pop-b button { padding: 6px 12px; border-radius: 9px; border: 2px solid #ffffff22; background: #2a2c31; color: #fff; font: 700 14px var(--gs-font, inherit); cursor: pointer; }
.te-pop-b button:disabled { opacity: .35; cursor: default; }
.te-pop-b .del { color: #ff9a9a; }
.te-pop-b .ok { margin-left: auto; background: #34c23e; }
/* กล่องตัวที่ยังไม่ได้จัด */
.te-pool { display: grid; gap: 8px; padding: 12px; border-radius: 16px; background: #151619; border: 4px solid #0c0d0f; box-shadow: inset 0 0 0 2px #2a2c31; }
.te-pool-h { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.te-pool-h b { color: #fff; font-size: 18px; margin-right: auto; }
.te-pool-h small { color: #8b8796; font-size: 13px; }
.te-pool-h input, .te-pool-h select { padding: 7px 10px; border-radius: 10px; border: 2px solid #2a2c31; background: #17181c; color: #fff; font: 600 14px var(--gs-font, inherit); }
.te-pool-h input { width: min(240px, 100%); }
.te-pool-drop { border-radius: 10px; max-height: 420px; overflow-y: auto; }
.te-more { align-self: center; padding: 8px 12px; border-radius: 10px; border: 2px solid #ffffff22; background: #24262c; color: #fff; font: 700 13px var(--gs-font, inherit); cursor: pointer; }
/* การ์ดข้อมูล */
.te-card { position: fixed; z-index: 9998; width: min(320px, calc(100vw - 16px)); padding: 12px; border-radius: 14px; background: #1b1c22f5; border: 2px solid #ffffff22; box-shadow: 0 14px 32px #000c;
  color: #d7d2e2; font: 500 13px var(--gs-font, "Fredoka", "Noto Sans Thai", system-ui, sans-serif); pointer-events: none; animation: te-in .14s ease-out; }
.te-card.sheet { pointer-events: auto; left: 8px !important; right: 8px; width: auto; top: auto !important; bottom: calc(10px + env(safe-area-inset-bottom)); max-height: 70vh; overflow-y: auto; }
@keyframes te-in { from { opacity: 0; transform: translateY(4px); } }
.te-card-h { display: grid; grid-template-columns: 52px minmax(0, 1fr) auto; gap: 10px; align-items: center; }
.te-card-h img, .te-ph { width: 52px; height: 52px; border-radius: 10px; object-fit: cover; background: #0b0c10; display: grid; place-items: center; }
.te-card-h b { display: block; color: #fff; font-size: 16px; }
.te-card-h span { font-weight: 700; font-size: 13px; }
.te-x { width: 34px; height: 34px; border-radius: 10px; border: 0; background: #2a2c31; color: #fff; font-size: 16px; cursor: pointer; }
.te-st { display: flex; flex-wrap: wrap; gap: 6px 12px; margin-top: 8px; color: #9ff6ff; font-weight: 700; }
.te-desc { margin: 8px 0 0; white-space: pre-line; line-height: 1.45; max-height: 210px; overflow: hidden; }
.te-card.sheet .te-desc { max-height: none; }
.te-hint { display: block; margin-top: 8px; color: #8b8796; font-size: 11px; }
.te-wiki { display: block; margin-top: 10px; padding: 10px; border-radius: 10px; text-align: center; background: #6c7bff; color: #fff; font-weight: 700; text-decoration: none; }
.te-moves { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 10px; }
.te-moves span { width: 100%; font-weight: 600; color: #a8a3b8; }
.te-moves button { padding: 7px 10px; border-radius: 9px; border: 2px solid #0006; background: var(--c, #2a2c31); color: #fff; font: 700 13px var(--gs-font, inherit); cursor: pointer; }
@media (max-width: 760px) {
  .te { --ts: 46px; }
  .te-row { grid-template-columns: 78px minmax(0, 1fr); }
  .tl-help { font-size: 12px; }
  .te-label { font-size: 12px; padding: 6px 4px 14px; }
  .te-label i { top: auto; bottom: 2px; right: 4px; font-size: 10px; }
  .te-drop { gap: 4px; padding: 4px; }
  .te-u { border-width: 2px; border-radius: 8px; }
  .te-pool-drop { max-height: 300px; }
  .tl-tabs button, .tl-btn { font-size: 14px; padding: 7px 11px; }
}
/* ทรานซิชัน: แถว tier ไหลเข้าทีละแถว (เปิดหน้า/สลับรายการ) */
.te-in { animation: te-in-row .42s cubic-bezier(.2, .8, .2, 1) var(--d, 0ms) both; }
@keyframes te-in-row { from { opacity: 0; transform: translate(var(--dx, 0), var(--dy, 12px)); } }
.te-row.te-in { --dy: 0px; }
.te-row .te-label { transition: filter .15s; } .te-row .te-label:hover { filter: brightness(1.08); }
@media (prefers-reduced-motion: reduce) { .te-in, .sc-in-l, .sc-in-r { animation: none !important; } }
