/* ระดับฝีมือ + สถานะพิเศษของของคราฟ (craft-quality.js · CRAFT_RANDOM_PLAN.md ข้อ 2)
   ชุดสีเดียวกับหน้าต่างช่างคราฟ/การ์ดไอเทม: กระดาษครีม · ขอบทอง 2 ชั้น · teal ประจำเกม
   ปกติ = ครีม #fff4d8 · ประณีต = teal #2f6f73 · ชั้นครู = ทอง #e8b64a · ชิ้นเอก = ทอง + แสงวิ่งบนขอบ
   ⚠️ แสงทุกชิ้นเป็นสีทึบ/โปร่งบางแบบ normal-blend (ไม่ใช้แสงบวก ไม่ขาวจ้า — กฎสไตล์ข้อ 2)
   ภาพ Astra (ใบ 41): assets/ui/craft/tier_*.webp วางทับตรา CSS · reveal_rays.webp แทนแสงหมุน CSS */

:root {
  --cq-std: #fff4d8; --cq-std-ink: #6b4a14; --cq-std-line: #d9c497;
  --cq-fine: #2f6f73; --cq-fine-hi: #4a9a9c; --cq-fine-line: #24585b;
  --cq-gold: #e8b64a; --cq-gold-hi: #f6d77e; --cq-gold-line: #a8781a; --cq-gold-ink: #4a300a;
  --cq-paper: linear-gradient(#fffaf0, #f8eed8);
}

/* ── ป้าย "⚒ ระดับ" ── */
.cq-badge { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px 2px 3px; border-radius: 999px; vertical-align: middle;
  font: 700 12.5px/1.25 var(--font-head, inherit); white-space: nowrap; border: 1.5px solid var(--cq-std-line);
  background: var(--cq-std); color: var(--cq-std-ink); box-shadow: inset 0 1px 0 #ffffffaa, 0 1px 0 #0000001a; }
.cq-badge b { font: inherit; }
.cq-em { position: relative; display: inline-grid; place-items: center; width: 18px; height: 18px; flex: none; }
.cq-em::before { content: ''; width: 11px; height: 11px; transform: rotate(45deg); border-radius: 3px;
  background: linear-gradient(135deg, #fffdf4, #e6d2a2); border: 1.5px solid var(--cq-std-line); box-shadow: inset 0 -2px 0 #0000001a; }
.cq-em img { position: absolute; inset: -3px; width: calc(100% + 6px); height: calc(100% + 6px); object-fit: contain; }
.cq-em:has(img)::before { display: none; }
.cq-badge.cq-fine { background: linear-gradient(#4a9396, #2b686c); border-color: var(--cq-fine-line); color: #fffdf4; text-shadow: 0 1px 0 #0003; }
.cq-badge.cq-fine .cq-em::before { background: linear-gradient(135deg, #d8f2ef, #6cb3b0); border-color: #1d4c4f; }
.cq-badge.cq-master, .cq-badge.cq-masterpiece { background: linear-gradient(#f7d885, #e0a93a); border-color: var(--cq-gold-line); color: var(--cq-gold-ink); }
.cq-badge.cq-master .cq-em::before, .cq-badge.cq-masterpiece .cq-em::before { background: linear-gradient(135deg, #fff6d2, #e8b64a); border-color: #8a5f10; }
.cq-badge.cq-masterpiece { position: relative; overflow: hidden; box-shadow: 0 0 0 2px #fff4d8, 0 0 0 3.5px var(--cq-gold-line), inset 0 1px 0 #fff8; }
.cq-badge.cq-masterpiece::after { content: ''; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(105deg, transparent 35%, #fffbe9cc 50%, transparent 65%); background-size: 260% 100%; animation: cq-sheen 2.6s ease-in-out infinite; }
@keyframes cq-sheen { 0% { background-position: 130% 0; } 60%, 100% { background-position: -130% 0; } }
.cq-badge.cq-sm { font-size: 11.5px; padding: 1px 7px 1px 2px; }
.cq-badge.cq-sm .cq-em { width: 15px; height: 15px; }
.cq-badge.cq-sm .cq-em::before { width: 9px; height: 9px; }
.cq-badge.cq-lg { font-size: 17px; padding: 4px 16px 4px 6px; gap: 8px; }
.cq-badge.cq-lg .cq-em { width: 34px; height: 34px; }
.cq-badge.cq-lg .cq-em::before { width: 20px; height: 20px; border-radius: 5px; border-width: 2px; }

/* ── แถบ % ของเพดาน ── */
.cq-bar { display: block; height: 6px; border-radius: 6px; background: #efe2c4; box-shadow: inset 0 1px 1px #0000001f; overflow: hidden; }
.cq-bar u { display: block; height: 100%; border-radius: inherit; background: linear-gradient(#e7cf96, #caa45e); text-decoration: none; }
.cq-fine .cq-bar u { background: linear-gradient(#5aa7a8, #2f6f73); }
:is(.cq-master, .cq-masterpiece) .cq-bar u { background: linear-gradient(#f6d77e, #d39a2c); }
li.max .cq-bar u { background: linear-gradient(90deg, #e8b64a, #f9e7a8, #e8b64a); }

/* ── กล่อง "สถานะพิเศษ" ในการ์ดไอเทม ── */
.cq-box { flex: none; margin: 8px 0; border-radius: 13px; background: var(--cq-paper); border: 1.5px solid var(--cq-std-line); box-shadow: 0 0 0 3px #f3e3bd inset; overflow: hidden; color: #3e2c16; }
.cq-box.cq-fine { border-color: var(--cq-fine); box-shadow: 0 0 0 3px #d9efec inset; }
.cq-box.cq-master, .cq-box.cq-masterpiece { border-color: var(--cq-gold); box-shadow: 0 0 0 3px #fbecc4 inset; }
.cq-box > header { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 7px 10px 6px;
  font: 700 13.5px/1.2 var(--font-head, inherit); color: #6b4a14; border-bottom: 1px dashed #e3d2a8; }
.cq-box.cq-fine > header { background: linear-gradient(#eef8f6, #ffffff00); }
.cq-box:is(.cq-master, .cq-masterpiece) > header { background: linear-gradient(#fff2cc, #ffffff00); }
.cq-lines { list-style: none; margin: 0; padding: 6px 10px; display: grid; gap: 6px; }
.cq-lines li { display: grid; grid-template-columns: minmax(0, 1fr) 92px; align-items: center; gap: 10px; }
.cq-ln { display: grid; min-width: 0; }
.cq-ln small { font-size: 11.5px; color: #8a7350; line-height: 1.2; }
.cq-ln b { font-size: 14px; line-height: 1.3; color: #3e2c16; }
.cq-ln em { font-style: normal; color: #2b686c; font-weight: 800; }
.cq-box:is(.cq-master, .cq-masterpiece) .cq-ln em { color: #9a6410; }
.cq-cap { display: grid; gap: 2px; text-align: right; }
.cq-cap small { font-size: 11px; color: #8a7350; }
.cq-box > footer { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 5px 10px 8px; font-size: 12px; color: #7a6548; }
.cq-box > footer > :first-child { margin-right: auto; }
.cq-by { font-style: italic; color: #7a5a2a; }
.cq-bound { padding: 1px 7px; border-radius: 999px; background: #fbe3d6; color: #8a3a1a; border: 1px solid #e8b49a; font-weight: 700; }
.cq-odds-btn { min-height: 28px; padding: 2px 12px; border-radius: 999px; border: 1px solid #285d61; color: #fffdf4; font: 700 12px/1 var(--font-head, inherit);
  background: linear-gradient(#3f8588, #2b686c); cursor: pointer; box-shadow: inset 0 1px 0 #ffffff44, 0 1px 0 #1f4a4d; }
.cq-legacy { flex: none; margin: 6px 0; padding: 7px 10px; border-radius: 10px; background: #fff4d8; border: 1px dashed #d9b56a; font-size: 12.5px; color: #6b4a14; }

/* ── ป้ายย่อในแถวตลาด/แลกเปลี่ยน/ช่างคราฟ ── */
.cq-row { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-top: 3px; font-size: 12px; color: #4a3520; line-height: 1.3; }
.cq-row .cq-txt { min-width: 0; color: #2b686c; font-weight: 700; }
.cq-row.master .cq-txt, .cq-row.masterpiece .cq-txt { color: #9a6410; }
/* ไอคอนในกระเป๋า/ตลาด: ขีดสีที่มุมล่างขวาบอกระดับฝีมือ (เห็นได้โดยไม่ต้องเปิดการ์ด) */
.cq-pip { position: absolute; right: 2px; bottom: 2px; width: 12px; height: 12px; transform: rotate(45deg); border-radius: 3px; pointer-events: none;
  border: 1.5px solid #fff8; box-shadow: 0 1px 2px #0005; background: var(--cq-std); }
.cq-pip.cq-fine { background: var(--cq-fine); }
.cq-pip.cq-master, .cq-pip.cq-masterpiece { background: linear-gradient(135deg, #fff1b8, var(--cq-gold)); }
.cq-pip.cq-masterpiece { box-shadow: 0 0 0 1.5px var(--cq-gold-line), 0 0 6px #e8b64a; }

/* ════════════ ฉากเผย (ชั้น Popup 300) ════════════ */
.cq-layer { position: fixed; inset: 0; z-index: var(--z-popup, 300); display: grid; place-items: center; align-content: center; gap: 10px;
  padding: max(10px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) max(10px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left)); }
.cq-dim { position: absolute; inset: 0; background: radial-gradient(ellipse at 50% 45%, #1b2a2fcc, #0e161ee6); animation: cq-fade .25s ease-out both; }
@keyframes cq-fade { from { opacity: 0; } }
.cq-card { position: relative; width: min(400px, 100%); max-height: calc(100dvh - 90px); overflow: auto; overscroll-behavior: contain; scrollbar-width: none;
  padding: 18px 20px 16px; border-radius: 22px; text-align: center; color: #3e2c16;
  background: radial-gradient(ellipse at 50% 0%, #fffdf6 0%, #fbf1d9 55%, #f3e3bd 100%);
  border: 2px solid var(--np-gold, #d9b56a); box-shadow: 0 0 0 4px #f3e3bd, 0 0 0 5.5px #caa45e, 0 18px 40px #0008;
  animation: cq-pop .42s cubic-bezier(.2, 1.4, .4, 1) both; isolation: isolate; }
@keyframes cq-pop { from { transform: translateY(18px) scale(.86); opacity: 0; } }
.cq-kicker { margin: 0 0 2px; font: 700 13px/1.2 var(--font-head, inherit); letter-spacing: .08em; color: #8a6a2a; text-transform: uppercase; }
.cq-card.cq-masterpiece .cq-kicker { font-size: 16px; color: #a8781a; letter-spacing: .04em; }
.cq-card.cq-master .cq-kicker { color: #9a6410; }
.cq-card h3 { margin: 6px 0 2px; font: 800 21px/1.25 var(--font-head, inherit); color: #5a3a0e; }
.cq-sub { margin: 0 0 6px; font-size: 13px; color: #7a6548; }
/* ไอคอนกลางวงทอง + แสงหลังของ */
.cq-item { position: relative; width: 104px; height: 104px; margin: 6px auto 0; display: grid; place-items: center; z-index: 1;
  border-radius: 50%; background: radial-gradient(circle at 50% 40%, #fffef8, #efe0bd); border: 3px solid #d9b56a;
  box-shadow: 0 0 0 5px #fff6dc, 0 0 0 6.5px #caa45e, inset 0 -6px 0 #0000000f; animation: cq-bob .5s .1s cubic-bezier(.3, 1.6, .5, 1) both; }
.cq-item.sm { width: 72px; height: 72px; }
@keyframes cq-bob { from { transform: scale(.4) rotate(-12deg); opacity: 0; } }
.cq-ic { display: grid; place-items: center; width: 78%; height: 78%; font-size: 44px; }
.cq-item.sm .cq-ic { font-size: 30px; }
.cq-ic img { width: 100%; height: 100%; object-fit: contain; filter: drop-shadow(0 2px 2px #0003); }
.cq-rays { position: absolute; left: 50%; top: 18px; width: 300px; height: 300px; margin-left: -150px; z-index: 0; pointer-events: none; opacity: 0; }
.cq-rays-art { width: 100%; height: 100%; object-fit: contain; }
.cq-rays:not(:has(img)) { border-radius: 50%;
  background: repeating-conic-gradient(from 0deg, #f6d77e66 0deg 9deg, #ffffff00 9deg 22.5deg);
  -webkit-mask: radial-gradient(circle, #000 18%, #0000 68%); mask: radial-gradient(circle, #000 18%, #0000 68%); }
.cq-t-fine .cq-rays:not(:has(img)) { background: repeating-conic-gradient(#6cb3b055 0deg 9deg, #ffffff00 9deg 22.5deg); }
.cq-t-fine .cq-rays, .cq-t-master .cq-rays, .cq-t-masterpiece .cq-rays { animation: cq-rays-in .6s .35s ease-out forwards, cq-spin 14s linear infinite; }
.cq-t-fine .cq-rays { --ro: .55; }
.cq-t-master .cq-rays, .cq-t-masterpiece .cq-rays { --ro: 1; }
@keyframes cq-rays-in { to { opacity: var(--ro, 1); } }
@keyframes cq-spin { to { transform: rotate(360deg); } }
/* ตราระดับตอกลงหลังของปรากฏ */
.cq-stamp { position: relative; z-index: 1; margin: 10px 0 4px; animation: cq-stamp .42s .55s cubic-bezier(.2, 1.6, .4, 1) both; }
@keyframes cq-stamp { from { transform: scale(2.4); opacity: 0; } 60% { opacity: 1; } }
/* บรรทัดเลื่อนขึ้นทีละบรรทัด */
.cq-rl { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 7px; text-align: left; position: relative; z-index: 1; }
.cq-rl li { display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: 'n n' 'v m' 'b b'; align-items: baseline; gap: 1px 8px; padding: 7px 11px 9px;
  border-radius: 12px; background: #fffdf7; border: 1.5px solid #ecdcb6; animation: cq-line .38s var(--d, .9s) ease-out both; }
.cq-rl li small { grid-area: n; font-size: 11.5px; color: #8a7350; }
.cq-rl li b { grid-area: v; font-size: 15.5px; }
.cq-rl li b em { font-style: normal; font-weight: 800; color: #2b686c; }
.cq-rl li .cq-mx { grid-area: m; font-size: 11.5px; color: #8a7350; }
.cq-rl li .cq-bar { grid-area: b; margin-top: 4px; }
.cq-rl li.max { border-color: var(--cq-gold); background: linear-gradient(#fff8e2, #fffdf7); }
@keyframes cq-line { from { transform: translateY(10px); opacity: 0; } }
.cq-card > .cq-by { margin: 10px 0 0; font-size: 12.5px; font-style: italic; color: #7a5a2a; animation: cq-fade .4s 1.8s both; }
/* สีการ์ดตามระดับ */
.cq-card.cq-fine { border-color: var(--cq-fine); box-shadow: 0 0 0 4px #d9efec, 0 0 0 5.5px var(--cq-fine), 0 18px 40px #0008; }
.cq-card.cq-fine .cq-item { border-color: var(--cq-fine); box-shadow: 0 0 0 5px #e6f5f2, 0 0 0 6.5px var(--cq-fine), inset 0 -6px 0 #0000000f; }
.cq-card.cq-master, .cq-card.cq-masterpiece { border-color: var(--cq-gold); box-shadow: 0 0 0 4px #fff0c2, 0 0 0 6px var(--cq-gold-line), 0 18px 40px #0008; }
.cq-card:is(.cq-master, .cq-masterpiece) .cq-item { border-color: var(--cq-gold); box-shadow: 0 0 0 5px #fff4d0, 0 0 0 7px var(--cq-gold), inset 0 -6px 0 #0000000f; }
.cq-card:is(.cq-master, .cq-masterpiece) .cq-rl li b em { color: #9a6410; }
/* ชิ้นเอก: แสงวิ่งรอบขอบ (กรอบหมุน conic ใต้การ์ด — ทึบ อ่านออก) + ปริกกี้ท่า wow ที่มุม */
@property --cq-a { syntax: '<angle>'; inherits: false; initial-value: 0deg; }
.cq-card.cq-masterpiece { border: 3px solid transparent;
  background: radial-gradient(ellipse at 50% 0%, #fffdf6 0%, #fbf1d9 55%, #f3e3bd 100%) padding-box,
    conic-gradient(from var(--cq-a), #a8781a, #f6d77e, #fff6d2, #e8b64a, #a8781a 40%, #e8b64a 60%, #fff6d2 75%, #a8781a) border-box;
  animation: cq-pop .42s cubic-bezier(.2, 1.4, .4, 1) both, cq-run 3s linear infinite; }
@keyframes cq-run { to { --cq-a: 360deg; } }
.cq-pricky { position: absolute; right: -6px; top: -4px; width: 92px; z-index: 2; pointer-events: none; animation: cq-pricky .5s 1.3s cubic-bezier(.2, 1.5, .4, 1) both; }
@keyframes cq-pricky { from { transform: translate(30px, -10px) rotate(14deg) scale(.6); opacity: 0; } }
/* ปุ่มใต้การ์ด */
.cq-acts { position: relative; display: flex; gap: 10px; justify-content: center; animation: cq-fade .3s 1.2s both; }
.cq-btn { min-height: 46px; min-width: 132px; padding: 0 18px; border-radius: 14px; font: 700 15px/1 var(--font-head, inherit); cursor: pointer;
  border: 1.5px solid #d8c49a; background: linear-gradient(#fffaf0, #f6ebd0); color: #4a3520; box-shadow: inset 0 1px 0 #fff, 0 2px 0 #b89a62; }
.cq-btn.main { border-color: #b88a1e; background: linear-gradient(#f4c85c, #e8b64a); color: #3b2a08; box-shadow: inset 0 1px 0 #fff6, 0 2px 0 #9a6f14; }
.cq-btn:active { transform: translateY(1px); }

/* ── หลอมใหม่: ของเดิม ↔ ผลใหม่ ── */
.cq-card.cq-rf { width: min(620px, 100%); }
.cq-vs { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: stretch; gap: 8px; margin-top: 8px; }
.cq-vs-x { align-self: center; font-style: normal; font-size: 20px; color: #a8781a; }
.cq-pick { display: grid; align-content: start; gap: 7px; padding: 10px; border-radius: 15px; text-align: left; font: inherit; color: inherit; cursor: pointer;
  background: #fffdf7; border: 2px solid #ecdcb6; box-shadow: 0 2px 0 #d8c49a; transition: transform .12s, box-shadow .12s; }
.cq-pick:hover:not(:disabled) { transform: translateY(-2px); box-shadow: 0 4px 0 #d8c49a; }
.cq-pick.cq-fine { border-color: #8cc3c0; } .cq-pick:is(.cq-master, .cq-masterpiece) { border-color: var(--cq-gold); }
.cq-pick.up { background: linear-gradient(#fff8e2, #fffdf7); }
.cq-pick .cq-badge { justify-self: start; }
.cq-pick-h { font: 700 12.5px/1 var(--font-head, inherit); color: #8a6a2a; letter-spacing: .05em; }
.cq-pick ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 5px; }
.cq-pick li { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 6px; font-size: 13px; }
.cq-pick li b { color: #2b686c; } .cq-pick:is(.cq-master, .cq-masterpiece) li b { color: #9a6410; }
.cq-pick li .cq-bar { grid-column: 1 / -1; height: 5px; }
.cq-pick-go { margin-top: auto; padding: 9px 6px; border-radius: 11px; text-align: center; font: 700 14px/1 var(--font-head, inherit);
  background: linear-gradient(#fffaf0, #f6ebd0); border: 1.5px solid #d8c49a; color: #4a3520; }
.cq-pick[data-pick="new"] .cq-pick-go { background: linear-gradient(#f4c85c, #e8b64a); border-color: #b88a1e; color: #3b2a08; }
.cq-pick:disabled { opacity: .6; cursor: default; }
.cq-timer { margin: 10px 0 0; font-size: 12.5px; color: #7a6548; }

/* ── ดูโอกาส (แผ่น) ── */
.cq-sheet { width: min(640px, calc(100vw - 24px)); }
.cq-fsheet .cq-filter { max-height: calc(100dvh - 120px); overflow: auto; overscroll-behavior: contain; }
.cq-sheet-head { display: grid; gap: 2px; margin-bottom: 8px; }
.cq-sheet-head b { font: 800 19px/1.2 var(--font-head, inherit); color: #5a3a0e; }
.cq-sheet-head small { font-size: 12.5px; color: #7a6548; }
.cq-sheet-body { max-height: calc(100dvh - 190px); overflow: auto; overscroll-behavior: contain; }
.cq-odds { display: grid; gap: 6px; color: #3e2c16; font-size: 13.5px; }
.cq-odds h5 { margin: 8px 0 2px; font: 700 14px/1.3 var(--font-head, inherit); color: #6b4a14; }
.cq-odds-lead { margin: 0; padding: 8px 10px; border-radius: 10px; background: #eef8f6; border: 1px solid #b7dcd8; color: #24585b; font-size: 12.5px; line-height: 1.45; }
.cq-art { font-style: normal; margin-left: 6px; padding: 1px 8px; border-radius: 999px; background: #2f6f73; color: #fff; font-size: 11.5px; }
.cq-t { width: 100%; border-collapse: separate; border-spacing: 0 3px; }
.cq-t th, .cq-t td { padding: 5px 8px; background: #fffdf7; border-top: 1px solid #ecdcb6; border-bottom: 1px solid #ecdcb6; text-align: left; font-weight: 400; }
.cq-t tr > :first-child { border-left: 1px solid #ecdcb6; border-radius: 9px 0 0 9px; }
.cq-t tr > :last-child { border-right: 1px solid #ecdcb6; border-radius: 0 9px 9px 0; }
.cq-t td b { color: #2b686c; }
.cq-two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.cq-pool { padding: 6px 10px; border-radius: 10px; background: #fffdf7; border: 1px solid #ecdcb6; }
.cq-pool h6 { margin: 0 0 4px; font-size: 12.5px; color: #8a6a2a; }
.cq-pool p { margin: 0; display: flex; flex-wrap: wrap; gap: 4px 6px; }
.cq-pool span { padding: 2px 8px; border-radius: 999px; background: #fbf3e0; border: 1px solid #e2cc98; font-size: 12px; }
.cq-pool span b { color: #2b686c; }

/* ── ตัวกรองสถานะพิเศษในกระดานตลาด ── */
.cq-filter { display: grid; gap: 6px; padding: 8px 10px; border-radius: 13px; background: var(--cq-paper); border: 1.5px solid #e6d3a6; box-shadow: 0 0 0 3px #f6ead0 inset; }
.cq-filter-h { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font: 700 13px/1.2 var(--font-head, inherit); color: #6b4a14; }
.cq-filter-h > span { margin-right: auto; }
.cq-chips { display: flex; flex-wrap: wrap; gap: 5px; }
.cq-chip { min-height: 30px; padding: 3px 11px; border-radius: 999px; font: 600 12.5px/1 var(--font-head, inherit); cursor: pointer;
  color: #7a5a2a; background: #fbf3e0; border: 1px solid #e2cc98; }
.cq-chip.on { color: #fffdf4; background: linear-gradient(#3f8588, #2b686c); border-color: #285d61; box-shadow: inset 0 1px 0 #ffffff44; }
.cq-filter-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: 12.5px; color: #7a6548; }
.cq-step { display: inline-flex; align-items: center; gap: 0; border-radius: 999px; border: 1px solid #e2cc98; background: #fffdf7; overflow: hidden; }
.cq-step button { min-width: 30px; min-height: 30px; border: 0; background: #fbf3e0; color: #6b4a14; font: 700 15px/1 inherit; cursor: pointer; }
.cq-step b { min-width: 34px; text-align: center; color: #2b686c; }
html body .win .mkb-tabs button.cq-ftog { margin-left: auto; color: #6b4a14; background: linear-gradient(#fff6dc, #fbe9bb); border-color: #d9b56a; }
html body .win .mkb-tabs button.cq-ftog.on { color: #4a300a; background: linear-gradient(#f7d885, #e0a93a); border-color: #a8781a; }
html body .win .mkb-tabs button.cq-ftog b { display: inline-grid; place-items: center; min-width: 18px; height: 18px; margin-left: 4px; border-radius: 9px; background: #2f6f73; color: #fff; font-size: 11px; }
.cq-filter-row > small { min-width: 64px; font-weight: 700; color: #8a6a2a; }
.mkb .stv-row .cq-row { margin-top: 4px; }
.cq-step button:disabled { opacity: .4; cursor: default; }
.cq-filter .cq-clear { min-height: 28px; padding: 2px 10px; border-radius: 999px; border: 1px solid #d8c49a; background: #fffaf0; color: #7a5a2a; font: 600 12px/1 inherit; cursor: pointer; }

/* ── ช่างคราฟ: แถบ "ลุ้นระดับฝีมือ" ใต้สูตร + แท็บหลอมใหม่ ── */
.cq-craft-note { flex: none; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 7px 10px; border-radius: 11px; font-size: 12.5px; color: #24585b;
  background: linear-gradient(90deg, #eef8f6, #fff8e6); border: 1px solid #b7dcd8; }
.cq-craft-note > span { margin-right: auto; }
.cq-craft-note .cq-tiers { display: inline-flex; gap: 3px; flex-wrap: wrap; }
:is(.cw-ic, .slot, .mk-line-ic, .tw-ic, .np-ic, .eq2s .ic, .stv-ic, .mk-slot):has(> .cq-pip) { position: relative; }
.win[data-win="craft"] .cw-sub-h { margin: 8px 2px 2px; padding-top: 8px; border-top: 1px dashed #e3d2a8; font: 700 12.5px/1.2 var(--font-head, inherit); color: #6b4a14; }
.win[data-win="craft"] .cw-item.rf .cw-tx > span { display: flex; align-items: center; gap: 4px; }
html body .win[data-win="craft"] .cw-go.free { border-color: #a8781a; background: linear-gradient(#f3cf6a, #e0a93a); color: #4a300a; }

/* ── มือถือแนวนอน / จอเตี้ย: การ์ดเผยวางสองคอลัมน์ (ไอเทม+ตรา | บรรทัด) ไม่ต้องเลื่อน ── */
@media (max-height: 560px) {
  .cq-layer { grid-auto-flow: column; align-items: center; gap: 12px; }
  .cq-card:not(.cq-rf) { width: min(620px, calc(100vw - 190px)); display: grid; grid-template-columns: 170px minmax(0, 1fr); column-gap: 14px; text-align: center;
    max-height: calc(100dvh - 20px); padding: 12px 14px; }
  .cq-card:not(.cq-rf) > :not(.cq-rl):not(.cq-rays):not(.cq-pricky) { grid-column: 1; }
  .cq-card:not(.cq-rf) .cq-rl { grid-column: 2; grid-row: 1 / span 6; align-self: center; margin: 0; }
  .cq-card:not(.cq-rf) .cq-rays { left: 85px; top: -40px; }
  .cq-item { width: 84px; height: 84px; }
  .cq-card.cq-masterpiece .cq-kicker { font-size: 16px; color: #a8781a; letter-spacing: .04em; }
.cq-card.cq-master .cq-kicker { color: #9a6410; }
.cq-card h3 { font-size: 17px; }
  .cq-badge.cq-lg { font-size: 15px; }
  .cq-badge.cq-lg .cq-em { width: 28px; height: 28px; }
  .cq-acts { flex-direction: column; }
  .cq-card.cq-rf { max-height: calc(100dvh - 20px); padding: 10px 14px; }
  .cq-rf .cq-item.sm { display: none; }
  .cq-pricky { width: 72px; right: auto; left: 110px; }
}
@media (max-width: 520px) { .cq-two { grid-template-columns: 1fr; } .cq-vs { grid-template-columns: 1fr; } .cq-vs-x { display: none; } }
@media (prefers-reduced-motion: reduce) {
  .cq-card, .cq-item, .cq-stamp, .cq-rl li, .cq-acts, .cq-pricky, .cq-rays, .cq-badge.cq-masterpiece::after { animation: none !important; opacity: 1; }
}
