/* (หัวเว็บ / ฟุตเตอร์ / .wimg พื้นฐาน ย้ายไปอยู่ใน site.css ที่ใช้ร่วมกัน) */

/* =====================================================================
   สไตล์พื้นฐานที่หน้าจำลองต้องใช้ (สำเนาจาก personal.css / site.css ซึ่งไม่ได้อยู่ในเว็บสาธารณะ)
   — หน้าต่างลอย (เลือกตัวละคร), ช่องค้นหา, หัวหน้า, ช่องตัวเลขสรุป
   ===================================================================== */
@keyframes zoom-in-95 { from { opacity: 0; transform: scale(.95); } to { opacity: 1; transform: none; } }
.mx-overlay { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 18px; background: rgba(0, 0, 0, .75); backdrop-filter: blur(4px); animation: fade .2s ease-out both; }
.mx-card { width: min(460px, 100%); max-height: 88vh; overflow-y: auto; border-radius: 18px; background: var(--panel); border: 1px solid var(--line-2); box-shadow: 0 30px 80px rgba(0, 0, 0, .6); animation: zoom-in-95 .2s ease-out both; }
.search { display: flex; align-items: center; gap: 8px; max-width: 260px; margin: 6px 0 12px; padding: 7px 10px; border-radius: 9px; background: var(--panel-2); border: 1px solid var(--line); }
.search input { flex: 1; background: none; border: 0; outline: 0; color: var(--text); font: inherit; font-size: 13px; }
.dash-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 14px; flex-wrap: wrap; margin: 6px 0 16px; }
.dash-head h1 { font-size: 28px; font-weight: 900; }
.stat-tiles { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 6px 0 14px; }
.stat-tiles div { padding: 10px 12px; border-radius: 12px; background: var(--panel-2); border: 1px solid var(--line); display: grid; }
.stat-tiles span { font-size: 11px; color: var(--muted); }
.stat-tiles b { font-size: 20px; font-weight: 800; }
@media (max-width: 760px) { .stat-tiles { grid-template-columns: repeat(2, 1fr); } }

/* =====================================================================
   ไอคอน trait จาก wiki (หน้า /trait)
   ===================================================================== */
.ti { position: relative; display: inline-grid; place-items: center; width: 1em; height: 1em; vertical-align: middle; flex-shrink: 0; }
.ti .wimg { width: 100%; height: 100%; filter: drop-shadow(0 2px 4px rgba(0, 0, 0, .5)); }
.ti .wimg.fb { font-size: .8em; filter: none; }
.ti-tier { position: absolute; right: -.08em; bottom: -.12em; padding: 0 .18em; border-radius: .18em; font-size: .3em; font-style: normal; font-weight: 900; line-height: 1.25; color: #fff; background: rgba(0, 0, 0, .75); border: 1px solid rgba(255, 255, 255, .25); }
.tr-slot .tr-slot-ico { font-size: 84px; }
.tr-slot .tr-slot-ico2 { position: absolute; right: 4px; bottom: 4px; font-size: 42px; }
.tr-name .tr-name-ico { font-size: 40px; }
.tr-chip .ti { font-size: 22px; }
.tr-cell .ti { font-size: 26px; }
.tr-cell .ti .ti-tier { font-size: 9px; }
.chance-ico .ti { font-size: 32px; }
.ti.ti-sm { font-size: 16px; }
/* trait ที่ผู้ใช้สร้าง (🎨 Custom): อีโมจิบนพื้น gradient */
.ti.ti-c { border-radius: .22em; border: .06em solid #16121f; background: var(--tg); overflow: hidden; }
.ti.ti-c em { font-style: normal; font-size: .62em; line-height: 1; filter: drop-shadow(0 .03em 0 #0008); }
.ti.ti-c.g-flow { animation: cu-flow var(--gs, 2s) linear infinite; }
.ti.ti-c.g-glow { box-shadow: 0 0 .25em var(--gc); }
.mr1-slot:not(.got) .ti-c { filter: grayscale(1) brightness(.45); }
.mr1-cu { display: block; padding: 8px 10px; border-radius: 10px; background: #ffffff0d; color: #ffd84d; font-weight: 700; font-size: 13px; text-decoration: none; }
.gs-ch-cu { float: right; margin: 2px 0 0 6px; }
.ti.ti-sm .ti-tier { display: none; }
.tr-token-ico { width: 64px; height: 64px; display: grid; place-items: center; font-size: 44px; }
.tr-token-ico .wimg { width: 64px; height: 64px; filter: drop-shadow(0 4px 10px rgba(167, 139, 250, .5)); }

/* =====================================================================
   รูป / ช่องตัวละคร
   ===================================================================== */
.unit-img { width: 100%; height: 100%; object-fit: contain; display: block; }
.unit-img.fb, .unit-ph { display: grid; place-items: center; font-size: 34px; font-weight: 900; color: var(--muted); }
.tr-unitbox { display: grid; justify-items: center; gap: 6px; }
.tr-slot.tr-unit { cursor: pointer; padding: 8px; border-color: color-mix(in srgb, var(--u, #334155) 70%, transparent); background: radial-gradient(circle at 50% 35%, color-mix(in srgb, var(--u, #334155) 35%, transparent), #0d141c 75%); transition: transform .15s, border-color .15s; }
.tr-slot.tr-unit:hover { transform: translateY(-2px); }
.tr-slot.tr-unit.filled { border-color: var(--c); }

/* กรอบตัวละครตามระดับ (แบบในเกม): Mythic = รุ้ง, Secret = แดง, Legendary = ทอง, Epic = ม่วง, Rare = ฟ้า
   ใช้ data-rar บนช่องตัวละคร (หน้าสุ่ม Trait / สุ่ม Stat / ย้าย Stat) และการ์ดในหน้าต่างเลือกตัวละคร — กรอบนิ่ง ไม่หมุน (ไม่กินเครื่อง) */
[data-rar] { --rc: #8a96a8; --rframe: linear-gradient(160deg, #b7c1cf, #5b6577); }
[data-rar="secret"] { --rc: #ff3030; --rframe: linear-gradient(160deg, #ff7a6b, #ff2323 45%, #b30f0f); }
[data-rar="exclusive"] { --rc: #ff3b5c; --rframe: linear-gradient(160deg, #ffd36b, #ff3b5c 50%, #a3102a); }
[data-rar="mythic"] { --rc: #c25cff; --rframe: conic-gradient(from 200deg, #ff4d4d, #ffa64d, #fff04d, #5dff7a, #4dd8ff, #6b7bff, #e14dff, #ff4d4d); }
[data-rar="legendary"] { --rc: #ffc21a; --rframe: linear-gradient(160deg, #fff09a, #ffc21a 45%, #c98300); }
[data-rar="epic"] { --rc: #b15cff; --rframe: linear-gradient(160deg, #e2b6ff, #a54bff 45%, #6a1fd1); }
[data-rar="rare"] { --rc: #3d9bff; --rframe: linear-gradient(160deg, #a6d4ff, #3d9bff 45%, #155fd6); }
.tr-slot.tr-unit[data-rar]:not([data-rar=""]), .up-unit[data-rar]:not([data-rar=""]) {
  border: 4px solid transparent;
  background: radial-gradient(circle at 50% 32%, color-mix(in srgb, var(--rc) 42%, #0b1020), #0b1020 78%) padding-box, var(--rframe) border-box;
  box-shadow: 0 0 0 2px #0c0d0f, 0 0 16px color-mix(in srgb, var(--rc) 45%, transparent);
}
.up-unit[data-rar]:not([data-rar=""]):hover { border-color: transparent; box-shadow: 0 0 0 2px #0c0d0f, 0 0 22px color-mix(in srgb, var(--rc) 70%, transparent); }
.tr-unit-img { width: 100%; height: 100%; display: grid; place-items: center; }
.tr-unit-img .unit-img { filter: drop-shadow(0 4px 8px rgba(0, 0, 0, .5)); }
/* ป้าย trait มุมซ้ายบน: ได้ 2 trait = ไอคอนที่สองอยู่ใต้อันแรก ขนาดเท่ากัน */
.tr-badge { position: absolute; top: 4px; left: 4px; z-index: 2; display: flex; flex-direction: column; gap: 2px; min-width: 40px; }
.tr-slot .tr-badge .tr-slot-ico, .tr-slot .tr-badge .tr-slot-ico2 { position: static; font-size: 40px; }
.tr-slot.spin .tr-badge .ti { filter: blur(.6px); }
.tr-unit-name { max-width: 150px; font-size: 12px; text-align: center; line-height: 1.3; min-height: 16px; }

/* =====================================================================
   หน้าต่างเลือกตัวละคร
   ===================================================================== */
.up-card { width: min(760px, 100%); max-height: 88vh; display: flex; flex-direction: column; padding: 16px; overflow: hidden; }
.up-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.up-head h3 { font-size: 18px; font-weight: 900; }
.up-tools { display: flex; gap: 8px; flex-wrap: wrap; }
.up-tools .search { flex: 1; max-width: none; margin: 0; }
.up-tools .btn { padding: 8px 12px; font-size: 13px; }
.up-rar { display: flex; gap: 6px; flex-wrap: wrap; margin: 10px 0; }
.chip { cursor: pointer; padding: 4px 10px; border-radius: 999px; font-size: 12px; background: var(--panel-2); border: 1px solid var(--line); }
.chip b { color: var(--accent-2); margin-left: 4px; }
.up-rar .chip { color: var(--muted); }
.up-rar .chip.on { color: var(--text); border-color: var(--c); background: color-mix(in srgb, var(--c) 18%, var(--panel-2)); }
.up-form { display: grid; grid-template-columns: 1.4fr 1fr 1.6fr auto auto; gap: 8px; margin-bottom: 10px; padding: 10px; border-radius: 12px; background: var(--panel-2); border: 1px solid var(--line); }
.up-form[hidden] { display: none; }
.up-form input, .up-form select { min-width: 0; padding: 8px 10px; border-radius: 9px; background: #0b1017; border: 1px solid var(--line-2); color: var(--text); font: inherit; font-size: 13px; }
.up-form .btn { padding: 8px 12px; font-size: 13px; }
.up-file { cursor: pointer; }
.up-grid { flex: 1; min-height: 200px; overflow-y: auto; display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; align-content: start; padding: 2px; }
.up-unit { position: relative; display: grid; grid-template-rows: 78px auto; gap: 4px; padding: 6px; border-radius: 12px; text-align: center; background: linear-gradient(180deg, color-mix(in srgb, var(--c) 22%, #121a24), #121a24 80%); border: 1px solid color-mix(in srgb, var(--c) 45%, var(--line)); transition: transform .15s, border-color .15s; }
.up-unit:hover { transform: translateY(-2px); border-color: var(--c); }
.up-unit .unit-img { width: 100%; height: 78px; }
.up-name { font-size: 10.5px; font-weight: 700; line-height: 1.25; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.up-del { position: absolute; top: 4px; right: 4px; width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; font-size: 10px; font-style: normal; background: rgba(0, 0, 0, .6); color: #f87171; }
.up-more { grid-column: 1 / -1; text-align: center; padding: 8px; }
.up-credit { margin-top: 8px; text-align: right; }
.up-credit a { color: var(--accent-2); }

/* =====================================================================
   แอนิเมชันได้ Unique (เลียนแบบในเกม)
   ===================================================================== */
.uq-ov { position: fixed; inset: 0; z-index: 300; overflow: hidden; cursor: pointer; pointer-events: auto; }
.uq-tint { position: absolute; inset: 0; opacity: 0; background: radial-gradient(circle at 50% 45%, hsla(var(--h, 220), 100%, 65%, .85), hsla(var(--h, 220), 90%, 35%, .9) 55%, hsla(var(--h, 220), 80%, 15%, .92)); }
.uq-rays { position: absolute; left: 50%; top: 45%; width: 220vmax; height: 220vmax; margin: -110vmax 0 0 -110vmax; opacity: 0;
  background: repeating-conic-gradient(from 0deg, rgba(255, 255, 255, .32) 0 3deg, transparent 5deg 16deg);
  mask-image: radial-gradient(circle, #000 0, rgba(0, 0, 0, .6) 30%, transparent 65%); -webkit-mask-image: radial-gradient(circle, #000 0, rgba(0, 0, 0, .6) 30%, transparent 65%); }
.uq-stars i { position: absolute; left: 50%; top: 45%; font-style: normal; font-size: 5vmin; color: #fff; opacity: 0; text-shadow: 0 0 12px #fff; }
.uq-center { position: absolute; left: 50%; top: 45%; transform: translate(-50%, -50%); display: grid; justify-items: center; gap: 1vmin; pointer-events: none; }
.uq-crown { width: 34vmin; height: 34vmin; display: grid; place-items: center; opacity: 0; transform-origin: 50% 50%; will-change: transform; }
.uq-crown .uq-crown-img { width: 100%; height: 100%; object-fit: contain; filter: drop-shadow(0 0 3vmin rgba(255, 255, 255, .85)) drop-shadow(0 0 7vmin hsl(var(--h, 0), 100%, 60%)); }
.uq-crown .uq-crown-img.fb { font-size: 26vmin; }
.uq-text { font-size: 11vmin; font-weight: 900; letter-spacing: .02em; opacity: 0; line-height: 1;
  background: linear-gradient(90deg, #ff4d4d, #ffb84d, #fff04d, #5dff7a, #4dd8ff, #6b6bff, #e14dff, #ff4d4d); background-size: 200% 100%; -webkit-background-clip: text; background-clip: text; color: transparent;
  -webkit-text-stroke: .35vmin #1a1033; filter: drop-shadow(0 .6vmin 0 #1a1033); }

/* 1) แฟลช */
.uq-ov.p1 .uq-tint { animation: uq-tint-in .25s ease-out forwards, uq-hue-blue .65s linear forwards; }
.uq-ov.p1 .uq-rays { animation: uq-rays-in .5s cubic-bezier(.2, .8, .2, 1) forwards, uq-spin 6s linear infinite; }
.uq-ov.p1 .uq-stars i { animation: uq-star 1.4s ease-out var(--d) forwards; }
@keyframes uq-tint-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes uq-rays-in { from { opacity: 0; transform: scale(.4); } to { opacity: .9; transform: scale(1); } }
@keyframes uq-spin { to { rotate: 360deg; } }
@keyframes uq-hue-blue { from { --h: 215; } 50% { --h: 265; } to { --h: 315; } }
@keyframes uq-star { 0% { opacity: 0; transform: translate(-50%, -50%) rotate(var(--a)) translateY(0) scale(.3); } 25% { opacity: 1; } 100% { opacity: 0; transform: translate(-50%, -50%) rotate(var(--a)) translateY(calc(var(--r) * -1)) scale(1.2); } }
/* 2) มงกุฎ + ข้อความ + วนสีรุ้ง */
.uq-ov.p2 .uq-tint, .uq-ov.p2 .uq-crown { animation: uq-tint-in .1s forwards, uq-rainbow 1.6s linear infinite; }
.uq-ov.p2 .uq-crown { animation: uq-crown-pop .5s cubic-bezier(.2, 1.6, .4, 1) forwards, uq-rainbow 1.6s linear infinite; }
.uq-ov.p2 .uq-text { animation: uq-text-pop .45s cubic-bezier(.2, 1.6, .4, 1) .15s forwards, uq-text-flow 1.2s linear infinite; }
@property --h { syntax: "<number>"; inherits: true; initial-value: 220; }
@keyframes uq-rainbow { from { --h: 0; } to { --h: 360; } }
@keyframes uq-crown-pop { 0% { opacity: 0; transform: scale(.2) rotate(-10deg); } 70% { opacity: 1; transform: scale(1.12) rotate(3deg); } 100% { opacity: 1; transform: scale(1) rotate(0); } }
@keyframes uq-text-pop { from { opacity: 0; transform: translateY(3vmin) scale(.6); } to { opacity: 1; transform: none; } }
@keyframes uq-text-flow { to { background-position: -200% 0; } }
.uq-ov.p2 .uq-crown-img { animation: uq-crown-hue 1.6s linear infinite; }
@keyframes uq-crown-hue { to { filter: hue-rotate(360deg) drop-shadow(0 0 3vmin rgba(255, 255, 255, .85)); } }
/* 3) บินไปที่ช่อง → พื้นหลังจางหาย */
.uq-ov.p3 { pointer-events: none; }
.uq-ov.p3 .uq-tint, .uq-ov.p3 .uq-rays { transition: opacity .5s ease-in; opacity: 0 !important; }
.uq-ov.p3 .uq-text { transition: opacity .25s; opacity: 0 !important; }
/* 4) ประกาย + กรอบสีรุ้ง */
.uq-spark { position: fixed; z-index: 310; pointer-events: none; font-style: normal; font-size: calc(18px * var(--s)); color: hsl(var(--h), 100%, 75%); text-shadow: 0 0 8px hsl(var(--h), 100%, 60%); transform: translate(-50%, -50%); animation: uq-spark 1.1s cubic-bezier(.2, .8, .3, 1) both; }
@keyframes uq-spark { 0% { opacity: 0; transform: translate(-50%, -50%) scale(.2); } 20% { opacity: 1; } 100% { opacity: 0; transform: translate(calc(-50% + var(--dx)), calc(-50% + var(--dy))) scale(1) rotate(180deg); } }
.uq-land { animation: uq-land 2.4s ease-out; }
@keyframes uq-land {
  0% { box-shadow: 0 0 0 0 #fff, 0 0 40px 10px hsl(0, 100%, 60%); }
  25% { box-shadow: 0 0 0 3px hsl(90, 100%, 60%), 0 0 40px 8px hsl(90, 100%, 60%); }
  50% { box-shadow: 0 0 0 3px hsl(200, 100%, 60%), 0 0 34px 6px hsl(200, 100%, 60%); }
  75% { box-shadow: 0 0 0 3px hsl(290, 100%, 65%), 0 0 26px 4px hsl(290, 100%, 65%); }
  100% { box-shadow: 0 0 0 0 transparent, 0 0 0 0 transparent; }
}

/* =====================================================================
   คัตซีน Unique v5 (ใช้จริง) — ลำดับเหมือนเดิม (แสงจากจุดกลางจุดเดียว → พื้นสีวน → มงกุฎ → บินลงป้าย → ประกายฟ้า)
   ทุกชั้นขยับด้วย transform / opacity / filter เท่านั้น (การ์ดจอทำ ไม่ต้องวาดใหม่ทุกเฟรม)
   v5 แก้ช่วงเปิด: v4 วนสีด้วยแถบสีกว้าง 8 เท่าของจอ (ต้องวาดภาพใหญ่มากตอนเด้งขึ้น = เฟรมแรกสะดุด)
   → v5 ใช้วงกลมชั้นเดียวแล้วหมุนเฉดสีด้วย filter: hue-rotate + ทยอยใส่ชั้นต่างๆ + อุ่นเครื่องไว้ก่อน (Uniq.warm)
   ===================================================================== */
/* คัตซีน Unique v6 — ตำแหน่ง/หน้าตาคงที่อยู่ที่นี่, การเคลื่อนไหวทั้งหมดอยู่ใน js/unique.js (Web Animations นาฬิกาเดียวกัน) */
.uq6 { position: fixed; inset: 0; z-index: 300; overflow: hidden; cursor: pointer; contain: strict; }
.uq6 > *, .uq6 i, .uq6 b { will-change: transform, opacity; }
.uq6-dim { position: absolute; inset: 0; opacity: 0; background: radial-gradient(circle at var(--cx) var(--cy), rgba(10, 6, 30, .15), rgba(5, 3, 18, .55) 70%); }
/* พื้นสี: วงกลมเดียว ขยายจากจุดกลาง แล้วหมุนเฉดสี (hue-rotate บนชั้นนี้ชั้นเดียว) */
.uq6-bgw { position: absolute; inset: 0; opacity: 0; }
.uq6-bg { position: absolute; left: var(--cx); top: var(--cy); width: calc(var(--R) * 2); height: calc(var(--R) * 2); margin: calc(var(--R) * -1) 0 0 calc(var(--R) * -1); border-radius: 50%; transform: scale(.02); will-change: transform, filter;
  background: radial-gradient(circle, rgba(255, 255, 255, .7) 0, rgba(255, 255, 255, .18) 15%, transparent 32%, rgba(0, 0, 0, .3) 70%), radial-gradient(circle, #7fe6ff 0, #3a9cff 36%, #2c55ea 70%, #1f2fa8 100%); }
/* ลำแสง 2 ชั้น หมุนสวนทาง (ขอบนุ่มด้วยสีไล่ ไม่ใช้ blur) */
.uq6-raysw { position: absolute; left: var(--cx); top: var(--cy); width: 124vmax; height: 124vmax; margin: -62vmax 0 0 -62vmax; opacity: 0; }
.uq6-rays { width: 100%; height: 100%; -webkit-mask: radial-gradient(circle, #000 4%, rgba(0, 0, 0, .55) 32%, transparent 78%); mask: radial-gradient(circle, #000 4%, rgba(0, 0, 0, .55) 32%, transparent 78%);
  background: repeating-conic-gradient(from 0deg, rgba(255, 255, 255, .36) 0deg, rgba(255, 255, 255, .16) 2.2deg, rgba(255, 255, 255, 0) 5deg 15deg); }
.uq6-raysw.b .uq6-rays { background: repeating-conic-gradient(from 7deg, rgba(255, 245, 210, .22) 0deg, rgba(255, 245, 210, .08) 4deg, rgba(255, 245, 210, 0) 8deg 26deg); }
/* แกนแสง (ชาร์จ → ระเบิด), วงคลื่นกระแทก, แสงหนามฟ้า */
.uq6-core { position: absolute; left: var(--cx); top: var(--cy); width: 30vmin; height: 30vmin; margin: -15vmin 0 0 -15vmin; border-radius: 50%; opacity: 0; transform: scale(.02);
  background: radial-gradient(circle, #fff 0 18%, #d6fdff 30%, rgba(120, 240, 255, .55) 50%, transparent 70%); }
.uq6-shock { position: absolute; left: var(--cx); top: var(--cy); width: 200px; height: 200px; margin: -100px 0 0 -100px; border-radius: 50%; opacity: 0;
  border: 5px solid rgba(255, 255, 255, .9); box-shadow: 0 0 18px #9ff6ff, inset 0 0 14px #9ff6ff; }
.uq6-burst { position: absolute; left: var(--cx); top: var(--cy); width: 46vmin; height: 46vmin; margin: -23vmin 0 0 -23vmin; border-radius: 50%; opacity: 0;
  background: radial-gradient(circle, #fff 0 12%, #8ff6ff 20%, transparent 46%), repeating-conic-gradient(from 7deg, rgba(126, 243, 255, .95) 0 5deg, transparent 5deg 17deg);
  -webkit-mask: radial-gradient(circle, #000 25%, transparent 70%); mask: radial-gradient(circle, #000 25%, transparent 70%); }
/* ดาว 4 แฉก: กล่องนอก = ลอย/หมุน (เร็วคงที่), ข้างใน = ขยาย/จาง */
.uq6-star { position: absolute; width: var(--s); height: var(--s); margin: calc(var(--s) / -2) 0 0 calc(var(--s) / -2); }
.uq6-star b { display: block; width: 100%; height: 100%; opacity: 0; }
.uq6-star svg, .uq6-orbit svg { display: block; width: 100%; height: 100%; fill: var(--c, #fff); }
/* ฮาโลหลังมงกุฎ + ประกายวนรอบ */
.uq6-halo { position: absolute; left: var(--cx); top: var(--cy); width: calc(var(--sz) * 2); height: calc(var(--sz) * 2); margin: calc(var(--sz) * -1) 0 0 calc(var(--sz) * -1); border-radius: 50%; opacity: 0;
  background: radial-gradient(circle, rgba(255, 255, 255, .95) 0, rgba(210, 250, 255, .75) 22%, rgba(150, 225, 255, .3) 42%, transparent 66%); }
.uq6-orbit { position: absolute; left: var(--cx); top: var(--cy); width: calc(var(--sz) * 1.55); height: calc(var(--sz) * 1.55); margin: calc(var(--sz) * -.775) 0 0 calc(var(--sz) * -.775); opacity: 0; }
.uq6-orbit i { position: absolute; left: 50%; top: 50%; width: 22px; height: 22px; margin: -11px; transform: rotate(var(--a)) translateY(calc(var(--sz) * -.775)) rotate(calc(var(--a) * -1)); }
.uq6-orbit i:nth-child(odd) { width: 14px; height: 14px; margin: -7px; }
.uq6-orbit b { display: block; width: 100%; height: 100%; --c: #fffbe0; filter: drop-shadow(0 0 4px #fff); }
/* มงกุฎ: ขอบดำ + เรืองแสง (filter คงที่ → วาดครั้งเดียว), ข้างในมีแสงวาบพาดผ่าน */
.uq6-crown, .uq6-ghost { position: absolute; left: var(--cx); top: var(--cy); width: var(--sz); height: var(--sz); margin: calc(var(--sz) / -2) 0 0 calc(var(--sz) / -2); opacity: 0; }
/* ขอบดำ + เรืองแสงอยู่ชั้นล่าง (รูปทรงมงกุฎสีเข้ม) — filter คงที่ วาดครั้งเดียว ไม่ต้องวาดใหม่ตอนสีรุ้งหมุน */
.uq6-outline > i { position: absolute; inset: 0; background: #140b22; -webkit-mask: var(--img) center / contain no-repeat; mask: var(--img) center / contain no-repeat; }
/* filter อยู่ที่กล่องนอก (mask อยู่ข้างใน) — ถ้าอยู่ชั้นเดียวกัน mask จะตัดขอบ/แสงที่ filter สร้างทิ้ง */
.uq6-outline { position: absolute; inset: 0;
  filter: drop-shadow(4px 0 0 #140b22) drop-shadow(-4px 0 0 #140b22) drop-shadow(0 4px 0 #140b22) drop-shadow(0 -4px 0 #140b22) drop-shadow(0 4px 6px rgba(0, 0, 0, .35)); }
.uq6-crown .uq6-mask { position: absolute; inset: 0; }
.uq6-mask { position: relative; width: 100%; height: 100%; overflow: hidden; -webkit-mask: var(--img) center / contain no-repeat; mask: var(--img) center / contain no-repeat; }
/* สีในมงกุฎ (ตามคลิปในเกม): ไล่ 2 สีที่อยู่ติดกันในรุ้ง ซ้ายบน → ขวาล่าง แล้วสีค่อยๆ วนไปเรื่อยๆ
   เขียว → ฟ้า → น้ำเงิน → ม่วง → ชมพู → แดง → ส้ม → เหลือง → เขียว (สีไหลจากมุมขวาล่างขึ้นไปซ้ายบน)
   ทำด้วยแถบรุ้งเอียง 45° ช่วงยาว 4 เท่าของมงกุฎ (มงกุฎเห็นทีละราว 2 สี) เลื่อนทีละ 1 รอบ — transform บนการ์ดจอ */
.uq6-fill, .uq6-rglow > i { --p: calc(var(--sz) * 4);
  background: repeating-linear-gradient(315deg, #4dff5e 0, #ffe23a calc(var(--p) * .125), #ff9a2e calc(var(--p) * .25), #ff3d4d calc(var(--p) * .375), #ff3dbe calc(var(--p) * .5), #a23dff calc(var(--p) * .625), #3d6bff calc(var(--p) * .75), #2fd8ff calc(var(--p) * .875), #4dff5e var(--p));
  animation: uq6-flow 1.6s linear infinite; will-change: transform; }
.uq6-fill { position: absolute; left: -300%; top: -300%; width: 700%; height: 700%; }
@keyframes uq6-flow { from { transform: translate(0, 0); } to { transform: translate(calc(var(--p) * -.7071), calc(var(--p) * -.7071)); } }
/* แสงเรืองรอบมงกุฎ = สีเดียวกับมงกุฎ ณ ตอนนั้น (ใช้แถบรุ้งชุดเดียวกัน วางตรงตำแหน่งเดียวกัน แล้วเฟดเป็นวงกลมนุ่มๆ) */
.uq6-rglow { position: absolute; left: -60%; top: -60%; width: 220%; height: 220%; pointer-events: none;
  -webkit-mask: radial-gradient(circle, #000 26%, rgba(0, 0, 0, .7) 38%, transparent 66%); mask: radial-gradient(circle, #000 26%, rgba(0, 0, 0, .7) 38%, transparent 66%); }
.uq6-rglow > i { position: absolute; left: calc(var(--sz) * -2.4); top: calc(var(--sz) * -2.4); width: calc(var(--sz) * 7); height: calc(var(--sz) * 7); }
.uq6-gloss { position: absolute; inset: 0; background: radial-gradient(circle at 30% 22%, rgba(255, 255, 255, .38), transparent 40%); pointer-events: none; }
.uq6-shine { position: absolute; top: -10%; bottom: -10%; left: 0; width: 55%; transform: translateX(-130%) skewX(-18deg); background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .85) 50%, transparent); }
.uq6-ghost .uq6-fill { animation: none; inset: 0; left: 0; top: 0; width: 100%; height: 100%; background: linear-gradient(120deg, #ff4d6d, #ffb84d, #fff04d, #5dff7a, #4dd8ff, #6b7bff, #e14dff); opacity: .85; } /* เงาตามหลังไม่หมุน (หมุนพร้อมกัน 3 ชั้นทำให้กระตุก) */
/* ตัวอักษร Unique เด้งทีละตัว สีรุ้งต่อเนื่องกันทั้งคำ */
.uq6-text { position: absolute; left: var(--cx); top: calc(var(--cy) + var(--sz) * .62); transform: translateX(-50%); display: flex; font-size: clamp(30px, 6vmin, 64px); font-weight: 900; line-height: 1; white-space: nowrap; font-family: "Fredoka", "Noto Sans Thai", system-ui, sans-serif; }
/* แต่ละตัว: ชั้นล่าง = ขอบดำหนา, ::after = สีรุ้งวางทับพอดี + เว้นระยะระหว่างตัว → ขอบของตัวถัดไปไม่ทับตัวก่อนหน้า */
.uq6-text { gap: .06em; }
.uq6-text span { position: relative; display: inline-block; opacity: 0; color: #140b22; -webkit-text-stroke: 6px #140b22; paint-order: stroke fill; filter: drop-shadow(0 3px 0 #140b22); }
.uq6-text span::after { content: attr(data-c); position: absolute; left: 0; top: 0; -webkit-text-stroke: 0; color: transparent;
  background: linear-gradient(90deg, #ff4d4d, #ffb84d, #fff04d, #5dff7a, #4dd8ff, #6b6bff, #e14dff) calc(var(--i) * 20%) 0 / 600% 100%; -webkit-background-clip: text; background-clip: text; }
.uq6-skip { position: absolute; right: 18px; bottom: 18px; padding: 8px 14px; border-radius: 10px; font-weight: 800; color: #fff; background: rgba(0, 0, 0, .45); border: 1px solid rgba(255, 255, 255, .3); opacity: 0; }
/* อุ่นเครื่อง: เล่นทุกชั้นแบบมองไม่เห็นครั้งเดียวตอนเปิดหน้า */
.uq6.uq6-warm { inset: auto; left: 0; top: 0; width: 64px; height: 64px; opacity: .01; pointer-events: none; z-index: -1; }

/* ตอนมงกุฎลงที่ป้าย: แสงวาบ + วงแสงฟ้า 2 วง + ประกายเด้งออกนุ่มๆ */
.uq3-flash, .uq3-ring, .uq3-part { position: fixed; z-index: 310; pointer-events: none; transform: translate(-50%, -50%); }
.uq3-flash { width: 110px; height: 110px; border-radius: 50%; background: radial-gradient(circle, #fff 0 15%, rgba(126, 243, 255, .85) 35%, transparent 70%); animation: uq3-flash .45s ease-out both; }
@keyframes uq3-flash { 0% { opacity: 0; transform: translate(-50%, -50%) scale(.3); } 25% { opacity: 1; } 100% { opacity: 0; transform: translate(-50%, -50%) scale(1.4); } }
.uq3-ring { width: 60px; height: 60px; border-radius: 50%; border: 2.5px solid #9ff8ff; box-shadow: 0 0 12px #5ee9ff, inset 0 0 8px #5ee9ff; animation: uq3-ring .7s cubic-bezier(.16, 1, .3, 1) both; }
@keyframes uq3-ring { 0% { opacity: .95; transform: translate(-50%, -50%) scale(.25); } 100% { opacity: 0; transform: translate(-50%, -50%) scale(2.6); } }
.uq3-part { font-style: normal; font-weight: 900; font-size: calc(15px * var(--s)); line-height: 1; color: var(--c); text-shadow: 0 0 6px var(--c), 0 0 12px #3fd8ff, 0 0 1px #000;
  animation: uq3-part var(--dur) cubic-bezier(.16, 1, .3, 1) var(--dl) both; will-change: transform, opacity; }
/* ประกายแบบภาพ (วาดตัวอักษรเรืองแสงลงภาพไว้แล้ว) — ขนาดเท่าตัวอักษรเดิม */
.uq3-part.img { width: calc(32px * var(--s)); height: calc(32px * var(--s)); background-position: center; background-size: contain; background-repeat: no-repeat; text-shadow: none; }
@keyframes uq3-part {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(.2) rotate(0); }
  10% { opacity: 1; }
  65% { opacity: .95; }
  100% { opacity: 0; transform: translate(calc(-50% + var(--dx)), calc(-50% + var(--dy))) scale(var(--s)) rotate(var(--r)); }
}
/* ป้าย Unique ที่มุมช่อง เด้งขึ้นตอนมงกุฎลง */
.uq3-badge-pop { animation: uq3-badge 0.5s cubic-bezier(.3, 1.7, .5, 1) both; }
@keyframes uq3-badge { 0% { transform: scale(1.5); filter: brightness(2.2) drop-shadow(0 0 10px #7ef3ff); } 100% { transform: none; filter: none; } }

/* หลังได้ Unique: กรอบแผงเป็นนีออนสีรุ้ง 5 วิ — ชั้นแยก (::after) หมุนสีด้วย filter: hue-rotate (การ์ดจอทำ) แทนการวาดแผงใหม่ทุกเฟรม */
.uq-glow::after { content: ""; position: absolute; inset: -4px; z-index: 5; border-radius: inherit; padding: 4px; pointer-events: none;
  background: linear-gradient(90deg, #ff4d4d, #ffd84d, #5dff7a, #4dd8ff, #b44dff, #ff4d4d);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor; mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0);
  box-shadow: 0 0 22px rgba(180, 120, 255, .55); will-change: filter, opacity;
  animation: uq-glow-hue 1.6s linear infinite, uq-glow-fade 5s ease-in forwards; }
@keyframes uq-glow-hue { to { filter: hue-rotate(360deg); } }
@keyframes uq-glow-fade { 0%, 75% { opacity: 1; } 100% { opacity: 0; } }

/* ชื่อผลลัพธ์ Unique เป็นสีรุ้ง */
.tr-name.is-unique { color: transparent; background: linear-gradient(90deg, #ff4d4d, #ffb84d, #fff04d, #5dff7a, #4dd8ff, #b44dff, #ff4d4d) 0 0 / 200% 100%; -webkit-background-clip: text; background-clip: text; text-shadow: none; animation: uq-text-flow 2s linear infinite; }

/* ขอบดำรอบไอคอน trait (ขนาดตามไอคอน) เหมือนในเกม */
.ti .wimg:not(.fb) { filter: drop-shadow(.05em 0 0 #120a1e) drop-shadow(-.05em 0 0 #120a1e) drop-shadow(0 .05em 0 #120a1e) drop-shadow(0 -.05em 0 #120a1e) drop-shadow(0 .06em .1em rgba(0, 0, 0, .55)); }
.ti.ti-sm .wimg:not(.fb) { filter: drop-shadow(1px 0 0 #120a1e) drop-shadow(-1px 0 0 #120a1e) drop-shadow(0 1px 0 #120a1e) drop-shadow(0 -1px 0 #120a1e); }
.tr-cell:not(.got) .ti .wimg:not(.fb) { filter: grayscale(1) brightness(.45) drop-shadow(.05em 0 0 #000) drop-shadow(-.05em 0 0 #000) drop-shadow(0 .05em 0 #000) drop-shadow(0 -.05em 0 #000); }
.tr-cell:not(.got) .ti { filter: none; }
.tr-cell .ti { filter: none !important; }

/* ปุ่ม "หยุด" ระหว่างสุ่มจนได้ */
.tr-btn.running { background: linear-gradient(180deg, #f87171, #dc2626) !important; animation: run-pulse 1s ease-in-out infinite; }
@keyframes run-pulse { 50% { filter: brightness(1.15); } }
.tr-btn:disabled { opacity: .55; }
select:disabled { opacity: .55; }

/* =====================================================================
   เกรด Stat (SSS ... C-)
   ===================================================================== */
.sg { display: inline-grid; place-items: center; min-width: 38px; padding: 2px 7px; border-radius: 8px; font-size: 13px; font-weight: 900; color: var(--g); background: color-mix(in srgb, var(--g) 16%, #0b1017); border: 1px solid color-mix(in srgb, var(--g) 60%, transparent); font-style: italic; }
.sg-sss { color: transparent; border-color: #fff4; background: linear-gradient(90deg, #ff4d4d, #ffd84d, #5dff7a, #4dd8ff, #b44dff, #ff4d4d) 0 0 / 200% 100%; -webkit-background-clip: border-box; position: relative; animation: uq-text-flow 1.6s linear infinite; }
.sg-sss::after { content: "SSS"; position: absolute; inset: 0; display: grid; place-items: center; color: #fff; text-shadow: 0 1px 2px #000, 0 0 6px #000; }

/* =====================================================================
   หน้าสุ่ม Stat
   ===================================================================== */
.st-grid { display: grid; grid-template-columns: 1fr 330px; gap: 14px; align-items: start; }
.st-top { display: flex; gap: 20px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.st-opts { flex: 1; min-width: 240px; display: grid; gap: 12px; }
.st-worth { display: grid; gap: 6px; font-size: 13px; color: var(--muted); }
.st-worth b { color: var(--text); }
.st-worth input { accent-color: var(--accent); width: 100%; }
.st-cubes { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.st-cube { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 12px; text-align: left; background: var(--panel-2); border: 1px solid var(--line); transition: border-color .15s, background .15s; }
.st-cube.on { border-color: var(--accent); background: var(--accent-bg); }
.st-cube span { display: grid; }
.st-cube small { font-size: 11px; color: var(--muted); }
.st-cube-img { width: 38px; height: 38px; object-fit: contain; flex-shrink: 0; }
span.st-cube-img.fb { display: grid; place-items: center; font-size: 26px; }
.st-rows { display: grid; gap: 8px; margin-bottom: 14px; }
.st-row { display: grid; grid-template-columns: 32px 1fr auto 52px; align-items: center; gap: 10px; padding: 12px 14px; border-radius: 12px; text-align: left; background: var(--panel-2); border: 1px solid var(--line); cursor: default; }
.st-row.pickable { cursor: pointer; }
.st-row.pickable:hover { border-color: var(--line-2); }
.st-row.sel { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.st-row.flash { animation: st-flash .6s ease-out; }
@keyframes st-flash { from { background: color-mix(in srgb, var(--accent) 25%, var(--panel-2)); } }
.st-ico { font-size: 20px; text-align: center; }
.st-label { font-weight: 700; }
.st-val { font-size: 20px; font-weight: 900; font-variant-numeric: tabular-nums; min-width: 84px; text-align: right; }
.st-row .sg { justify-self: end; }
.st-targets { display: grid; gap: 8px; }
.st-target { display: grid; grid-template-columns: 70px 1fr; align-items: center; gap: 8px; font-size: 13px; font-weight: 700; }
.st-target select { appearance: none; padding: 8px 10px; border-radius: 9px; background: var(--panel-2); border: 1px solid var(--line-2); color: var(--text); font: inherit; font-size: 13px; }
.st-used { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 12px; }
.st-used div { display: grid; padding: 8px 10px; border-radius: 10px; background: var(--panel-2); border: 1px solid var(--line); }
.st-used span { display: flex; align-items: center; gap: 6px; font-size: 11px; color: var(--muted); }
.st-used b { font-size: 18px; }
.st-mini { width: 18px; height: 18px; object-fit: contain; }
span.st-mini.fb { display: inline-grid; font-size: 13px; }
.st-side .tr-log { max-height: 300px; }
.st-side .tr-log-row { flex-wrap: wrap; align-items: center; }
.st-side .tr-log-row .sg { min-width: 30px; font-size: 11px; padding: 0 5px; }
/* แสงรุ้งตอนได้ SSS — ใช้ชั้นแยก (::after) ไม่แตะแอนิเมชันของการ์ด */
.st-main { position: relative; }
.sss-flash::after { content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none; animation: sss-flash 1.4s ease-out forwards; }
@keyframes sss-flash { 0% { box-shadow: 0 0 0 2px #ff4d4d, 0 0 50px #ff4d4d; } 33% { box-shadow: 0 0 0 2px #5dff7a, 0 0 50px #5dff7a; } 66% { box-shadow: 0 0 0 2px #4dd8ff, 0 0 40px #b44dff; } 100% { box-shadow: none; } }
.shake { animation: shake .4s; }
@keyframes shake { 20%, 60% { transform: translateX(-5px); } 40%, 80% { transform: translateX(5px); } }

/* =====================================================================
   หน้าย้าย Stat
   ===================================================================== */
.tf-stage { display: grid; grid-template-columns: 1fr auto 1fr; gap: 14px; align-items: start; margin-bottom: 14px; }
.tf-side { display: grid; justify-items: center; gap: 8px; padding: 14px; border-radius: 14px; background: var(--panel-2); border: 1px solid var(--line); min-height: 280px; }
.tf-title { font-weight: 700; }
.tf-mid { display: grid; justify-items: center; gap: 10px; align-self: center; }
.tf-arrows { transform: scaleX(-1); }
.tf-stats-list { display: grid; gap: 6px; width: 100%; }
.tf-stat { display: grid; grid-template-columns: auto 1fr auto auto; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 10px; background: #0d141c; border: 1px solid var(--line); font-size: 13px; }
.tf-stat input[type=checkbox] { accent-color: var(--accent); width: 16px; height: 16px; }
.tf-stat[data-side="dst"] { grid-template-columns: 1fr auto auto; }
.tf-stat b { font-variant-numeric: tabular-nums; }
.tf-nostat { text-align: center; line-height: 2; }
.tf-nostat a { color: var(--accent-2); }
.tf-rand { padding: 4px 10px; font-size: 12px; }
.tf-gone { filter: grayscale(1) brightness(.5); }
.tf-x { position: absolute; inset: 0; display: grid; place-items: center; font-style: normal; font-size: 64px; color: #f87171; text-shadow: 0 2px 10px #000; animation: pop .35s cubic-bezier(.3, 1.6, .5, 1) both; }
.tf-refill { padding: 6px 12px; font-size: 12px; }
.tf-chip { position: fixed; z-index: 250; pointer-events: none; padding: 6px 12px; border-radius: 999px; font-size: 13px; font-weight: 800; background: var(--accent); color: #062420; box-shadow: 0 6px 20px rgba(0, 0, 0, .5); white-space: nowrap; }
.tf-chip.ok { background: #22c55e; color: #052e16; }
.tf-chip.bad { background: #ef4444; color: #fff; }
.tf-stats { margin-top: 14px; }
/* เลือก stat: ทั้งแถวเป็นปุ่ม · ที่เลือกไว้ไฮไลต์ · ปลายทางโชว์ค่าที่จะได้ */
.tf-pick-h { font-size: 11px; color: var(--muted); text-align: center; }
.tf-stat { cursor: pointer; transition: border-color .15s, background .15s; }
.tf-stat[data-side="src"].on { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 12%, #0d141c); }
.tf-stat[data-side="dst"].on { border-color: color-mix(in srgb, var(--accent) 55%, transparent); }
.tf-stat[data-side="dst"] { cursor: default; }
.tf-next { grid-column: 1 / -1; display: flex; align-items: center; gap: 6px; font-size: 11px; color: var(--accent-2); }
.tf-next .sg { font-size: 10px; min-width: 0; padding: 1px 5px; }
.tf-gone-note { text-align: center; }
.tf-swap { width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--line-2); background: var(--panel-2); color: var(--text); font-size: 20px; font-weight: 800; cursor: pointer; transition: transform .2s; }
.tf-swap:hover { transform: rotate(180deg); border-color: var(--accent); }
/* แถบปุ่ม: ข้อมูลค่าใช้จ่าย + คำแนะนำ/ผลล่าสุด + ปุ่ม */
.tf-dock { display: grid; gap: 8px; }
.tf-dock .tr-actions { margin-top: 0; }
.tf-dock-info { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 12px; font-size: 13px; color: var(--muted); }
.tf-msg { font-weight: 700; color: var(--text); }
.tf-msg.hint { color: #fbbf24; } .tf-msg.ok { color: #4ade80; } .tf-msg.bad { color: #f87171; }
.tf-dock .tr-btn:disabled { opacity: .45; filter: grayscale(.5); cursor: not-allowed; }
@media (max-width: 760px) {
  /* มือถือ: ต้นทาง-ปลายทางวางคู่กัน + แถบปุ่มลอยเหนือเมนูล่าง */
  .tf-main { padding: 10px; }
  .tf-stage { grid-template-columns: minmax(0, 1fr) 30px minmax(0, 1fr); gap: 4px; margin-bottom: 0; }
  .tf-side { min-height: 0; padding: 8px 6px; gap: 6px; }
  .tf-mid { align-self: start; padding-top: 52px; }
  .tf-arrows { display: none; }
  .tf-swap { width: 30px; height: 30px; font-size: 15px; }
  .tf-page .tr-slot.tr-unit { width: 84px; height: 84px; }
  .tf-page .tr-unit-name { max-width: 100%; font-size: 11px; }
  .tf-stats-list { gap: 4px; }
  .tf-stat { grid-template-columns: auto minmax(0, 1fr) auto; gap: 2px 6px; padding: 6px 7px; font-size: 12px; }
  .tf-stat > b { grid-column: 1 / -1; order: 5; font-size: 13px; }
  .tf-stat[data-side="dst"] { grid-template-columns: minmax(0, 1fr) auto; }
  .tf-stat[data-side="dst"] > b { grid-column: 1 / -1; }
  .tf-stat .sg { font-size: 11px; min-width: 0; padding: 1px 6px; }
  .tf-next { order: 6; }
  .tf-dock { position: fixed; left: 8px; right: 8px; bottom: calc(80px + env(safe-area-inset-bottom)); z-index: 19; padding: 8px 10px 10px; border-radius: 16px;
    background: rgba(17, 24, 33, .96); border: 1px solid var(--line-2); box-shadow: 0 10px 30px rgba(0, 0, 0, .55); gap: 6px; }
  .tf-dock-info { font-size: 11.5px; }
  .tf-dock .tr-btn { padding: 11px 8px; font-size: 15px; }
  body[data-page="transfer"] { padding-bottom: 200px; }
}
.tf-stats .tr-log { margin-top: 10px; }

@media (max-width: 900px) {
  .st-grid { grid-template-columns: 1fr; }
  .up-form { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 560px) {
  .st-cubes { grid-template-columns: 1fr; }
  .st-row { grid-template-columns: 26px 1fr auto 44px; padding: 10px; }
  .st-val { font-size: 16px; min-width: 64px; }
  .up-grid { grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); }
}

/* ปุ่มเปลี่ยนภาษา TH / EN มุมขวาบน */
.lang-btn { display: inline-flex; align-items: center; gap: 2px; padding: 3px; border-radius: 999px; background: var(--panel); border: 1px solid var(--line); cursor: pointer; font: 800 12px/1 inherit; color: var(--muted); flex-shrink: 0; }
.lang-btn b, .lang-btn span { padding: 6px 9px; border-radius: 999px; }
.lang-btn b { background: var(--accent-bg); color: var(--accent-2); box-shadow: inset 0 0 0 1px rgba(45, 212, 191, .35); }
.lang-btn:hover span { color: var(--text); }

/* ผล trait: ได้ 2 อัน = 2 คอลัมน์ ชื่ออยู่แถวเดียวกัน คำอธิบายอยู่ใต้ชื่อของตัวเอง */
.tr-res-row { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 4px 22px; align-items: start; justify-items: center; width: 100%; }
.tr-res { display: grid; justify-items: center; gap: 2px; min-width: 0; }

/* ===== ปุ่ม/หน้าต่างแชร์ผลสุ่ม (js/share.js) ===== */
.tr-share, .sm4-share { padding: 6px 14px; border-radius: 10px; font: 700 15px var(--gs-font, inherit); color: #fff; cursor: pointer; border: 3px solid #ffffff55;
  background: linear-gradient(180deg, #6c7bff, #4a4fe0); box-shadow: 0 4px 0 #0008, 0 0 0 2px #0c0d0f; -webkit-text-stroke: 4px #16121f; paint-order: stroke fill; transition: transform .1s, filter .15s; }
.tr-share:hover, .sm4-share:hover { filter: brightness(1.1); } .tr-share:active, .sm4-share:active { transform: translateY(3px); box-shadow: 0 1px 0 #0008, 0 0 0 2px #0c0d0f; }
.game-skin .gs-panel .tr-banner { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.game-skin .gs-panel .tr-share { position: relative; z-index: 1; }
.sm4-hero { position: relative; }
/* ปุ่มมุมขวาบนของกรอบผลลัพธ์: ล้างสถิติ (แดง) + แชร์ (ม่วง) */
.sm4-acts { grid-column: 1 / -1; display: flex; justify-content: flex-end; gap: 8px; margin-bottom: -6px; }
.sm4-share, .sm4-reset { font-size: 14px; padding: 5px 12px; }
.sm4-reset { border-radius: 10px; font-weight: 700; font-family: var(--gs-font, inherit); color: #fff; cursor: pointer; border: 3px solid #ffd0d0; background: linear-gradient(180deg, #ff7a7a, #d83030);
  box-shadow: 0 4px 0 #0008, 0 0 0 2px #0c0d0f; -webkit-text-stroke: 4px #16121f; paint-order: stroke fill; transition: transform .1s, filter .15s; }
.sm4-reset:hover { filter: brightness(1.1); } .sm4-reset:active { transform: translateY(3px); box-shadow: 0 1px 0 #0008, 0 0 0 2px #0c0d0f; }
.sm4-reset:disabled { filter: grayscale(.7) brightness(.7); cursor: default; }
.shr-ov { position: fixed; inset: 0; z-index: 400; display: grid; place-items: center; padding: 16px; background: #000b; backdrop-filter: blur(4px); animation: fade .2s both; }
.shr-card { width: min(640px, 100%); max-height: 92vh; overflow: auto; display: grid; gap: 10px; padding: 14px; border-radius: 18px; background: #151619; border: 4px solid #0c0d0f; box-shadow: 0 20px 60px #000c, inset 0 0 0 2px #2a2c31; font-family: var(--gs-font, inherit); }
.shr-head { display: flex; justify-content: space-between; align-items: center; } .shr-head b { font-size: 20px; color: #fff; }
.shr-x { width: 36px; height: 34px; border-radius: 9px; color: #fff; font-weight: 700; cursor: pointer; border: 2px solid #ffd0d0; background: linear-gradient(180deg, #ff6b6b, #e02424); }
.shr-prev { aspect-ratio: 1200 / 630; border-radius: 12px; overflow: hidden; background: #0e0f14; display: grid; place-items: center; }
.shr-prev img { width: 100%; height: 100%; display: block; }
.shr-wait { color: #a8a3b8; font-size: 14px; }
.shr-text { width: 100%; resize: none; padding: 8px 10px; border-radius: 10px; border: 2px solid #2a2c31; background: #0f1012; color: #e8e6ef; font: 600 13px var(--gs-font, inherit); }
.shr-btns { display: flex; flex-wrap: wrap; gap: 8px; }
.shr-b { flex: 1 1 140px; padding: 10px 12px; border-radius: 11px; font: 700 15px var(--gs-font, inherit); color: #fff; cursor: pointer; border: 2px solid #ffffff33; background: linear-gradient(180deg, #4a4e57, #33363d); box-shadow: 0 3px 0 #0008; }
.shr-b.main { background: linear-gradient(180deg, #74f06c, #34c23e); }
.shr-b[hidden] { display: none; }
.shr-st { min-height: 18px; font-size: 13px; color: #74f06c; text-align: center; }

/* เมนูล่างบนมือถือมี 5 หน้า: ปุ่มกระชับขึ้น และเลื่อนซ้ายขวาได้ถ้าจอแคบมาก */
@media (max-width: 900px) {
  /* เต็มความกว้างจอ ปัดซ้าย-ขวาได้ + ขอบจางบอกว่ายังมีเมนูต่อ (คลาส more-l / more-r ตั้งจาก router.js) */
  .nav { left: 8px; right: 8px; transform: none; max-width: none; justify-content: flex-start; overflow-x: auto; overscroll-behavior-x: contain; scroll-snap-type: x proximity;
    scrollbar-width: none; -webkit-overflow-scrolling: touch; touch-action: pan-x; --fl: 0px; --fr: 0px;
    -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 var(--fl), #000 calc(100% - var(--fr)), transparent 100%); mask-image: linear-gradient(90deg, transparent 0, #000 var(--fl), #000 calc(100% - var(--fr)), transparent 100%); }
  .nav.more-l { --fl: 28px; } .nav.more-r { --fr: 28px; }
  .nav::-webkit-scrollbar { display: none; }
  .nav-item { flex: none; padding: 6px 11px; font-size: 10.5px; scroll-snap-align: center; }
  .nav-item[hidden] { display: none; }
}
.uq6-text.long { font-size: clamp(22px, 4.2vmin, 44px); white-space: nowrap; }
/* คอม: เมนูบนมีหลายหน้า → ถ้าจอแคบให้เลื่อนซ้าย-ขวาได้ แทนการล้นจอ (ขอบจางจาก router.js) */
@media (min-width: 901px) {
  .topbar .nav { min-width: 0; flex: 0 1 auto; overflow-x: auto; scrollbar-width: none; overscroll-behavior-x: contain; --fl: 0px; --fr: 0px;
    -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 var(--fl), #000 calc(100% - var(--fr)), transparent 100%); mask-image: linear-gradient(90deg, transparent 0, #000 var(--fl), #000 calc(100% - var(--fr)), transparent 100%); }
  .topbar .nav::-webkit-scrollbar { display: none; }
  .topbar .nav.more-l { --fl: 26px; } .topbar .nav.more-r { --fr: 26px; }
  .topbar .nav-item { flex: none; }
  .topbar .brand, .topbar .lang-btn { flex: none; }
}

/* ย้าย Stat: ตัวเลข % แตะแล้วพิมพ์เองได้ */
.tf-val { display: inline-flex; align-items: center; gap: 5px; padding: 3px 6px; margin: -3px 0; border-radius: 8px; border: 1px dashed transparent; background: none; color: var(--text); font: inherit; font-weight: 800; font-variant-numeric: tabular-nums; cursor: text; }
.tf-val i { display: inline-grid; font-style: normal; opacity: .35; transition: opacity .15s; }
.tf-val .ic { width: 12px; height: 12px; }
.tf-val:hover, .tf-val:focus-visible { border-color: var(--line-2); background: #ffffff0a; outline: none; }
.tf-val:hover i { opacity: .9; }
.tf-val-in { width: 92px; height: auto; min-height: 30px; box-sizing: border-box; padding: 4px 8px; margin: -4px 0; border-radius: 8px; border: 2px solid var(--accent); background: #0d141c; color: var(--text); font: inherit; font-weight: 800; text-align: right; }
.tf-val-in:focus { outline: none; box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 30%, transparent); }
@media (max-width: 760px) {
  .tf-stat > :is(.tf-val, .tf-val-in) { grid-column: 1 / -1; order: 5; justify-self: start; font-size: 13px; }
  .tf-val-in { width: 100%; text-align: left; }
}
