/* หน้า Stat Check — โทนเดียวกับหน้าอื่น (แผงมืด ขอบดำหนา ตัวหนังสือ Fredoka) */
.sc-page { font-family: var(--gs-font, "Fredoka", "Noto Sans Thai", system-ui, sans-serif); display: grid; gap: 16px; }
.sc-panel, .sc-how { background: #151619; border: 4px solid #0c0d0f; border-radius: 20px; box-shadow: 0 16px 36px #000a, inset 0 0 0 2px #2a2c31; }
.sc-page :is(.sc-head h2, .sc-big, .sc-how summary b, .sc-pct) { -webkit-text-stroke: var(--sw, 5px) var(--gs-ink, #16121f); paint-order: stroke fill; }
/* วิธีใช้ (พับได้) */
.sc-how { padding: 12px 16px; }
.sc-how summary { display: flex; align-items: baseline; gap: 10px; cursor: pointer; list-style: none; }
.sc-how summary::after { content: "▾"; margin-left: auto; color: #a8a3b8; transition: transform .2s; }
.sc-how[open] summary::after { transform: rotate(180deg); }
.sc-how summary b { font-size: 22px; color: #fff; }
.sc-how summary span { color: #a8a3b8; font-size: 13px; }
.sc-how-body { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-top: 10px; }
.sc-how ol { margin: 0; padding-left: 22px; display: grid; gap: 4px; color: #d7d2e2; font-size: 14px; }
.sc-how ol b { color: #fff3a6; }
.sc-btn { padding: 10px 18px; border-radius: 12px; font: 700 16px var(--gs-font, inherit); color: #fff; cursor: pointer; border: 3px solid #ffffff44; box-shadow: 0 4px 0 #0008, 0 0 0 2px #0c0d0f;
  background: linear-gradient(180deg, #6c7bff, #4a4fe0); -webkit-text-stroke: 4px #16121f; paint-order: stroke fill; transition: transform .1s; }
.sc-btn:active { transform: translateY(3px); box-shadow: 0 1px 0 #0008, 0 0 0 2px #0c0d0f; }

.sc-grid { display: grid; grid-template-columns: minmax(300px, 400px) minmax(0, 1fr); gap: clamp(14px, 2vw, 26px); align-items: start; }
.sc-panel { padding: 16px; }
.sc-head { display: flex; justify-content: space-between; align-items: center; }
.sc-head h2 { font-size: 26px; color: #fff; }
.sc-clear { background: none; border: 0; color: #a8a3b8; font: 600 14px var(--gs-font, inherit); text-decoration: underline; cursor: pointer; }
.sc-note { margin: 6px 0 12px; font-size: 13px; color: #b8b3c6; line-height: 1.45; }
.sc-note.small { font-size: 12px; margin: 12px 0 0; color: #8b8796; }
.sc-note b { color: #fff; }
/* ปุ่มเลือกตัวละคร (กรอบสีตามระดับ) */
.sc-unit { width: 100%; display: grid; grid-template-columns: 64px minmax(0, 1fr); gap: 12px; align-items: center; padding: 8px; border-radius: 14px; cursor: pointer; text-align: left; color: #fff;
  border: 3px solid transparent; background: linear-gradient(#0f1012, #0f1012) padding-box, var(--rframe, linear-gradient(#2a2c31, #2a2c31)) border-box; transition: transform .15s; }
.sc-unit:hover { transform: translateY(-2px); }
.sc-uimg { width: 64px; height: 64px; border-radius: 10px; overflow: hidden; display: grid; place-items: center; background: #0b0c10; font-size: 26px; color: #8b8796; }
.sc-uimg .unit-img { width: 100%; height: 100%; object-fit: cover; }
.sc-uimg.big { width: 88px; height: 88px; border-radius: 14px; }
.sc-uname b { display: block; font-size: 17px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sc-uname small { color: #a8a3b8; font-size: 12px; }
/* ช่องกรอก 3 ค่า */
.sc-rows { display: grid; gap: 8px; margin-top: 12px; }
.sc-row { display: grid; grid-template-columns: 34px minmax(0, 1fr) 108px; gap: 8px; align-items: end; padding: 8px; border-radius: 12px; background: #0f1012; }
.sc-ico { font-size: 22px; text-align: center; padding-bottom: 6px; }
.sc-row label { display: grid; gap: 4px; font-size: 12px; font-weight: 600; color: #a8a3b8; min-width: 0; }
.sc-page input, .sc-page select { width: 100%; min-width: 0; padding: 8px 10px; border-radius: 10px; border: 2px solid #2a2c31; background: #17181c; color: #fff; font: 700 16px var(--gs-font, inherit); }
.sc-page input:focus, .sc-page select:focus { outline: none; border-color: #6c7bff; }
/* คำสาป */
.sc-tg { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 12px; padding: 8px 10px; border-radius: 12px; background: #0f1012; cursor: pointer; font-weight: 600; color: #d7d2e2; }
.sc-tg small { color: #8b8796; font-weight: 500; }
.sc-tg input { display: none; }
.sc-tg i { position: relative; width: 44px; height: 24px; border-radius: 12px; background: #2c2f37; flex-shrink: 0; transition: background .2s; }
.sc-tg i::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; transition: transform .2s; }
.sc-tg input:checked + i { background: linear-gradient(90deg, #a23dff, #ff3dbe); } .sc-tg input:checked + i::after { transform: translateX(20px); }
.sc-curse { display: grid; gap: 6px; margin-top: 6px; }
.sc-curse[hidden] { display: none; }
.sc-cl { display: grid; grid-template-columns: minmax(0, 1fr) 100px auto; gap: 6px; align-items: center; color: #a8a3b8; font-weight: 700; }

/* ผลลัพธ์ (ขวา): กรอบรุ้งแบบการ์ดหายาก */
.sc-out { position: relative; border: 4px solid transparent; background: linear-gradient(#151619, #151619) padding-box, linear-gradient(135deg, #4dd8ff, #b44dff, #ff3dbe, #ffb84d) border-box; }
.sc-big { font-size: clamp(28px, 3.4vw, 44px); line-height: 1.05; color: #fff; --sw: 7px; margin: 0; }
.sc-out-h { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 14px; align-items: center; margin-bottom: 14px; }
.sc-out-h p { margin: 6px 0 0; color: #b8b3c6; font-size: 13px; font-weight: 600; }
.sc-rar { color: var(--c); font-weight: 700; margin-right: 6px; -webkit-text-stroke: 3px #16121f; paint-order: stroke fill; font-size: 16px; }
.sc-cursed { color: #ff8ad8 !important; }
.sc-stats { display: grid; gap: 10px; }
.sc-stat { display: grid; gap: 4px; padding: 10px 12px; border-radius: 14px; background: #0f1012; border: 2px solid #ffffff0d; }
.sc-stat.ok { border-color: #6c7bff55; }
.sc-stat.ok[data-top="1"] { border-color: #ff3dbe77; box-shadow: 0 0 18px #ff3dbe22; }
.sc-stat.bad { border-color: #ff3b3b66; }
.sc-stat-h { font-size: 13px; font-weight: 600; color: #a8a3b8; }
.sc-stat-b { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.sc-pct { font-size: clamp(24px, 2.8vw, 34px); color: #9ff6ff; --sw: 6px; }
.sc-stat.wait .sc-pct, .sc-stat.bad .sc-pct { font-size: 20px; color: #a8a3b8; }
.sc-stat.bad .sc-pct { color: #ff8a8a; }
.sc-g { display: flex; align-items: center; gap: 4px; }
.sc-g .sg, .sc-stat-b > .sg { min-width: 56px; padding: 4px 10px; font-size: 20px; }
.sc-dash { color: #8b8796; }
.sc-stat small { font-size: 12px; color: #8b8796; }
.sc-warn { margin: 14px 0 0; padding-top: 12px; border-top: 1px solid #ffffff14; font-size: 12px; color: #a8a3b8; line-height: 1.5; }
.sc-warn b { color: #fff; }
@media (max-width: 860px) {
  .sc-grid { grid-template-columns: 1fr; }
  .sc-row { grid-template-columns: 30px minmax(0, 1fr) 92px; }
}

/* แถบเลือกตัวละคร (ใช้ร่วม 2 แท็บ) + แท็บ */
.sc-unitbar { display: grid; grid-template-columns: minmax(260px, 400px) minmax(0, 1fr); gap: clamp(14px, 2vw, 26px); align-items: center; }
.sc-tabs { display: flex; gap: 8px; flex-wrap: wrap; }
.sc-tabs button { padding: 10px 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; }
.sc-tabs button.on { background: linear-gradient(180deg, #74f06c, #34c23e); border-color: #a8ffa0; }
.sc-tabs button:active { transform: translateY(3px); }
/* เลือกรูปแบบตัวเลข: ปัดเศษ / ทศนิยม 2 ตำแหน่ง */
.sc-dec { display: inline-flex; align-items: center; gap: 4px; padding: 4px; border-radius: 12px; background: #0f1012; border: 2px solid #2a2c31; font-size: 13px; color: #a8a3b8; font-weight: 700; }
.sc-dec span { padding: 0 6px; }
.sc-dec button { padding: 6px 12px; border-radius: 9px; border: 0; background: none; color: #d7d2e2; font: 700 13px var(--gs-font, inherit); cursor: pointer; }
.sc-dec button.on { background: linear-gradient(180deg, #6c7bff, #4a4fe0); color: #fff; }
.sc-unitbar .sc-dec { grid-column: 2; justify-self: start; }
@media (max-width: 860px) { .sc-unitbar .sc-dec { grid-column: auto; } }
[data-view][hidden] { display: none !important; }
/* สลับแท็บ */
.sc-in-l { animation: sc-in-l .38s cubic-bezier(.2, .8, .2, 1) both; } .sc-in-r { animation: sc-in-r .38s cubic-bezier(.2, .8, .2, 1) both; }
.sc-grid.sc-in-l > :nth-child(2), .sc-grid.sc-in-r > :nth-child(2) { animation: sc-fade .45s .08s cubic-bezier(.2, .8, .2, 1) both; }
@keyframes sc-in-l { from { opacity: 0; transform: translateX(-24px); } } @keyframes sc-in-r { from { opacity: 0; transform: translateX(24px); } }
@keyframes sc-fade { from { opacity: 0; transform: translateY(10px); } }
/* ผลคำนวณเปลี่ยน → ตัวเลขเด้งเบาๆ */
.sc-calc-v b.bump { animation: sc-bump .3s ease-out; }
@keyframes sc-bump { 40% { transform: scale(1.08); } }
/* เครื่องคำนวณ */
.sc-lv, .sc-pot { display: grid; gap: 6px; padding: 10px; border-radius: 12px; background: #0f1012; margin-top: 10px; }
.sc-lv label { font-weight: 700; color: #d7d2e2; } .sc-lv label b { font-size: 22px; color: #fff3a6; margin-left: 6px; }
.sc-lv small { color: #8b8796; font-size: 12px; }
.sc-lvrow { display: grid; grid-template-columns: minmax(0, 1fr) 96px; gap: 10px; align-items: center; }
.sc-page input[type=range] { padding: 0; border: 0; background: none; accent-color: #74f06c; height: 28px; }
.sc-pin { display: flex; align-items: center; gap: 4px; color: #a8a3b8; font-weight: 700; }
.sc-presets { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 10px; font-size: 13px; color: #a8a3b8; }
.sc-presets button { padding: 5px 10px; border-radius: 9px; font: 700 13px var(--gs-font, inherit); color: #fff; cursor: pointer; border: 2px solid #ffffff22; background: #24262c; }
.sc-presets button:hover { background: #2f3239; }
.sc-pots { display: grid; gap: 0; }
.sc-pot-h { display: flex; justify-content: space-between; align-items: center; font-weight: 600; color: #d7d2e2; font-size: 14px; }
.sc-pot-g .sg { min-width: 44px; font-size: 14px; }
.sc-calc-row { padding: 10px 12px; border-radius: 14px; background: #0f1012; border: 2px solid #6c7bff44; }
.sc-calc-t { font-size: 13px; font-weight: 700; color: #a8a3b8; margin-bottom: 6px; }
.sc-calc-v { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.sc-calc-v div { display: grid; gap: 1px; min-width: 0; }
.sc-calc-v span { font-size: 12px; color: #a8a3b8; }
.sc-calc-v b { font-size: clamp(18px, 2.2vw, 26px); color: #9ff6ff; -webkit-text-stroke: 5px #16121f; paint-order: stroke fill; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sc-calc-v small { font-size: 11px; color: #6f6b7c; }
@media (max-width: 860px) { .sc-unitbar { grid-template-columns: 1fr; } .sc-calc-v { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
/* % ที่ผู้ใช้กำหนดเองนอกช่วงที่เกมสุ่มได้ */
.sc-out-tag { display: inline-block; padding: 2px 8px; border-radius: 8px; font-size: 12px; font-weight: 700; color: #16121f; background: linear-gradient(90deg, #ffd84d, #ff8ad8); }
.sc-pot.free { box-shadow: inset 0 0 0 2px #ff8ad855; }
.sc-pot.free input[type=range] { opacity: .45; }
.sc-free-hint { margin: 10px 0 0 !important; }
