/* สมุดผจญภัย (codex.js) — หนังสือกระดาษครีม ขอบทองบาง ใบไม้เล็กน้อย · ไม่ใช่แดชบอร์ด
   คอม: เมนูหมวดซ้าย (แถบหนังสือ) · หน้ากระดาษขวา = ค้นหา + ตัวกรอง + การ์ด + รายละเอียด
   มือถือ: เมนูหมวดเป็นแถบเลื่อนแนวนอน · แตะการ์ด = รายละเอียดเต็มหน้า (ปุ่มกลับ)
   ⚠️ ตัวอักษรขั้นต่ำ 13px · ปุ่มบนจอสัมผัส ≥ 44px */
/* เร็ว ๆ นี้: การ์ดโปร่งเส้นประ ป้ายส้ม — แยกจากของจริงชัด ไม่ให้ผู้เล่นคิดว่าไปได้แล้ว */
.cx-card.soon { border-style: dashed; background: #f6efdc; }
.cx-card.soon .cx-emo { filter: grayscale(.35); opacity: .85; }
.cx-soon { position: absolute; top: 5px; right: 5px; padding: 0 6px; border-radius: 999px; background: #f0a04a; color: #fff; font: 700 13px/1.5 inherit; font-style: normal; }
.cx-tag.soon { background: #f0a04a; color: #fff; }
.cx-divider { grid-column: 1 / -1; margin: 6px 0 0; padding-top: 6px; border-top: 1px dashed #d9c092; font: 700 13px var(--font-head, inherit); color: #8a5a10; }
.cx-colcard.soonrow { border-style: dashed; background: #fbf3e0; grid-template-columns: auto 1fr auto; }
.cx-colcard.soonrow .cx-n { color: #c8701a; }
#windows .win[data-win="codex"] { width: min(96vw, 1040px); height: min(90vh, 680px); max-height: none; display: flex; flex-direction: column; }
#windows .win[data-win="codex"] > .body { flex: 1; min-height: 0; max-height: none; overflow: hidden; padding: 0; }
html[data-skin="wood"] body .win[data-win="codex"] > .body { max-height: none; }
#windows .win[data-win="codex"] > .foot { display: none; }

.cx { --ink: #3e2c16; --mute: #7a6548; --gold: #e8b64a; --line: #e3d2a8; --teal: #2f6f73; --leaf: #3f8f4e;
  height: 100%; display: grid; grid-template-columns: 172px minmax(0, 1fr); color: var(--ink); background: #f3e6c8; }

/* เมนูหมวด — สันหนังสือ */
.cx-nav { display: flex; flex-direction: column; gap: 5px; padding: 10px 8px; overflow-y: auto;
  background: linear-gradient(90deg, #e6d2a6, #efe0bd 85%, #d9c092); border-right: 2px solid #c9a86a; }
.cx-nav button { display: flex; align-items: center; gap: 9px; min-height: 44px; padding: 5px 10px 5px 6px; border-radius: 11px; cursor: pointer; text-align: left;
  border: 1px solid transparent; background: transparent; color: #5a4630; font: 700 14.5px/1.2 var(--font-head, inherit); }
.cx-nav button img { width: 32px; height: 32px; object-fit: contain; flex: none; filter: saturate(.8) brightness(.97); }
.cx-nav button:hover { background: #fff6e033; }
.cx-nav button.on { background: linear-gradient(#fff4d2, #f6dd95); border-color: #d9a93a; color: #3e2c16; box-shadow: inset 4px 0 0 var(--leaf), 0 2px 6px #8a5a1a26; }
.cx-nav button.on img { filter: none; transform: scale(1.06); }

/* หน้ากระดาษ */
.cx-main { min-width: 0; min-height: 0; display: flex; flex-direction: column; gap: 8px; padding: 10px 12px 10px;
  background: radial-gradient(circle at 100% 0, #fffaf0, #fbf3df 55%, #f5e8c8); position: relative; }
.cx-main::after { content: '🍃'; position: absolute; right: 10px; bottom: 6px; font-size: 16px; opacity: .45; pointer-events: none; }
.cx-top { display: flex; align-items: center; gap: 12px; }
.cx-title { flex: 1; min-width: 0; display: grid; }
.cx-title b { font: 700 20px/1.2 var(--font-head, inherit); color: #6b4510; }
.cx-title small { font-size: 13px; color: var(--mute); }
.cx-search { display: flex; align-items: center; gap: 6px; width: min(300px, 46%); padding: 0 10px; min-height: 38px; border-radius: 999px; border: 1.5px solid var(--line); background: #fffdf6; }
.cx-search input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; font: 500 14px var(--font, inherit); color: var(--ink); }
.cx-search:focus-within { border-color: var(--gold); box-shadow: 0 0 0 3px #e8b64a33; }

.cx-chips { display: flex; flex-wrap: wrap; align-items: center; gap: 5px; }
.cx-chips > button { min-height: 32px; padding: 2px 12px; border-radius: 999px; border: 1px solid #dcc898; background: #fbf4e2; color: #6b5530; font: 700 13px var(--font-head, inherit); cursor: pointer; }
.cx-chips > button.on { background: var(--teal); border-color: var(--teal); color: #fff; }
.cx-chips > button { flex: none; white-space: nowrap; }
.cx-tools { display: flex; gap: 5px; align-items: center; flex-wrap: wrap; justify-content: flex-end; margin-top: -3px; }
.cx-tools select { min-height: 32px; padding: 0 8px; border-radius: 9px; border: 1px solid #dcc898; background: #fffdf6; color: var(--ink); font: 600 13px var(--font, inherit); }
.cx-view { min-height: 32px; padding: 2px 12px; border-radius: 9px; border: 1px solid #c8901a; background: linear-gradient(#fff4d2, #f6dd95); color: #6b4510; font: 700 13px var(--font-head, inherit); cursor: pointer; }
.cx-view.on { background: var(--teal); border-color: var(--teal); color: #fff; }

.cx-body { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr) minmax(280px, 42%); gap: 10px; }
.cx-body.wide { display: block; overflow: auto; }
.cx-grid { min-height: 0; overflow: auto; display: grid; grid-template-columns: repeat(auto-fill, minmax(102px, 1fr)); align-content: start; gap: 7px; padding: 2px 4px 8px 2px; }
.cx-empty { grid-column: 1 / -1; margin: 18px 0; text-align: center; color: #a8957a; font-size: 14px; }

.cx-card { position: relative; display: grid; justify-items: center; gap: 3px; padding: 8px 5px 7px; border-radius: 12px; cursor: pointer;
  border: 1.5px solid #e6d6b0; background: linear-gradient(#fffdf8, #fbf1dc); color: var(--ink); text-align: center; }
.cx-card:hover { border-color: #d9b56a; }
.cx-card.on { border-color: var(--gold); background: linear-gradient(#fff8e2, #fbe9b8); box-shadow: 0 0 0 2px #e8b64a55, 0 3px 8px #8a5a1a22; }
.cx-card.dim { opacity: .6; }
.cx-card b { font: 700 13px/1.2 var(--font-head, inherit); overflow-wrap: anywhere; }
.cx-card small { font-size: 13px; color: var(--mute); }
.cx-card.r-good { border-bottom: 3px solid #2f8ae0; } .cx-card.r-rare { border-bottom: 3px solid #9a4ae8; } .cx-card.r-epic { border-bottom: 3px solid #e8a82a; }
.cx-got { position: absolute; top: 4px; right: 5px; width: 18px; height: 18px; display: grid; place-items: center; border-radius: 50%; background: var(--leaf); color: #fff; font: 900 11px/1 inherit; font-style: normal; }
.cx-ic { width: 52px; height: 52px; display: grid; place-items: center; font-size: 26px; border-radius: 10px; overflow: hidden; }
.cx-ic img, .cx-ic .ic3d { width: 100%; height: 100%; object-fit: contain; }
.cx-ic.sm { width: 26px; height: 26px; font-size: 15px; border-radius: 7px; background: #f3e9cf; }
.cx-thumb { width: 100%; height: 100%; object-fit: cover; border-radius: 8px; }
.cx-card .cx-ic:has(.cx-thumb) { width: 86px; height: 52px; }
.cx-mob { width: 100%; height: 100%; object-fit: contain; }
.cx-mob.sm { width: 26px; height: 26px; }
.cx-emo { font-size: 30px; line-height: 1; font-family: 'Noto Color Emoji', 'Apple Color Emoji', 'Segoe UI Emoji', sans-serif; }

/* รายละเอียด */
.cx-detail { min-height: 0; overflow: auto; padding: 10px 12px; border-radius: 14px; border: 1px solid var(--line); background: #fffdf7; box-shadow: inset 0 0 0 3px #fbf3df; }
.cx-back { display: none; }
.cx-dhead { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 12px; align-items: center; }
.cx-big { width: 84px; height: 84px; display: grid; place-items: center; font-size: 40px; border-radius: 14px; background: radial-gradient(circle at 50% 40%, #fff8de, #f1e2bd); overflow: hidden; }
.cx-big:empty { display: none; }
.cx-big img, .cx-big .ic3d { width: 100%; height: 100%; object-fit: contain; }
.cx-dname { display: block; font: 700 19px/1.25 var(--font-head, inherit); color: #3b3320; }
.cx-tags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.cx-tag { padding: 0 9px; border-radius: 999px; font: 700 13px/1.6 inherit; font-style: normal; background: #efe4c8; color: #6b5530; }
.cx-tag.ok { background: #dcefd6; color: #2f6f3c; }
.cx-tag.boss { background: #fbe3b0; color: #8a5a10; }
.cx-tag.r-good { background: #2f8ae0; color: #fff; } .cx-tag.r-rare { background: #9a4ae8; color: #fff; } .cx-tag.r-epic { background: linear-gradient(#f2c14e, #d99a26); color: #4a3008; }
.cx-desc { margin: 6px 0 0; font-size: 13.5px; line-height: 1.5; color: #5b4f38; }
.cx-hero { display: block; width: 100%; height: 120px; object-fit: cover; border-radius: 11px; margin-bottom: 8px; }
.cx-stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 4px; margin-top: 10px; }
.cx-stats span { display: flex; justify-content: space-between; gap: 6px; padding: 4px 9px; border-radius: 8px; background: #f6efdc; font-size: 13px; }
.cx-stats i { font-style: normal; color: var(--mute); }
.cx-stats b { color: #2f5a3c; display: flex; align-items: center; gap: 4px; }
.cx-el { width: 16px; height: 16px; }
.cx-sec { margin-top: 10px; padding: 8px 10px; border-radius: 11px; background: #fbf5e6; border: 1px solid #efe2c2; }
.cx-sec h5 { margin: 0 0 6px; font: 700 14px var(--font-head, inherit); color: #6b4510; }
.cx-p { margin: 3px 0; font-size: 13.5px; line-height: 1.5; }
.cx-p.mute { color: #a8957a; }
.cx-kv { display: grid; grid-template-columns: auto 1fr; gap: 3px 12px; margin: 0; font-size: 13.5px; }
.cx-kv dt { color: var(--mute); } .cx-kv dd { margin: 0; font-weight: 700; }
.cx-rows { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.cx-rows li { display: grid; grid-template-columns: 18px minmax(0, 1fr) auto; gap: 7px; align-items: center; padding: 4px 6px; border-radius: 8px; background: #fffdf6; }
.cx-ri svg { width: 15px; height: 15px; fill: none; stroke: #c8901a; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.cx-rt { min-width: 0; display: grid; font-size: 13.5px; } .cx-rt small { font-size: 13px; color: var(--mute); overflow-wrap: anywhere; }
.cx-go { min-height: 32px; padding: 0 12px; border-radius: 9px; border: 1px solid #2f6f3c; background: linear-gradient(#5cb86a, #3f8f4e); color: #fff; font: 700 13px var(--font-head, inherit); cursor: pointer; white-space: nowrap; }
.cx-go.wide { width: 100%; min-height: 38px; }
.cx-acts { margin-top: 10px; }
/* ภาพฉากเควสต์ที่ผ่านแล้ว (ย้อนอ่านเนื้อเรื่อง 2 ต.ค.) — 2:1 กว้างเต็มแผง */
.cx-scene { display: flex; align-items: flex-start; width: 100%; max-width: 300px; aspect-ratio: 2 / 1; margin: 8px 0 0; padding: 0; border: 2px solid #e8b64a; border-radius: 10px;
  background: #efe3c8 center / cover no-repeat; cursor: pointer; overflow: hidden; font: inherit; }
.cx-scene span { width: 100%; padding: 5px 8px; background: rgba(47, 111, 115, .88); color: #fff; font-weight: 700; font-size: 13px; text-align: center; }
.cx-scene:hover { border-color: #2f6f73; }
.cx-chipwrap { display: flex; flex-wrap: wrap; gap: 5px; }
.cx-chip-it { display: inline-flex; align-items: center; gap: 5px; min-height: 32px; padding: 2px 9px 2px 3px; border-radius: 9px; border: 1px solid #e3d4ae; background: #fffdf6; color: var(--ink); font: 600 13px var(--font, inherit); cursor: pointer; }
.cx-chip-it small { color: var(--mute); font-size: 13px; }
.cx-chip-it.boss { border-color: #e8b64a; background: #fff6dc; }
.cx-mats { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.cx-mats li { display: grid; grid-template-columns: 26px minmax(0, 1fr) auto; gap: 8px; align-items: center; padding: 3px 7px; border-radius: 8px; background: #fdf0ec; font-size: 13.5px; }
.cx-mats li.ok { background: #eef7ea; } .cx-mats li b { color: #c8423a; } .cx-mats li.ok b { color: #2f6f3c; }
.cx-article { font-size: 14px; line-height: 1.6; } .cx-article p { margin: 8px 0; } .cx-article h4 { margin: 0 0 8px; font: 700 16px var(--font-head, inherit); color: #6b4510; }

/* เส้นทาง Rank (gear-book.js) ในหมวดอุปกรณ์ */
.cx-ladder .gb { padding: 0; }

/* คอลเลกชัน */
.cx-col { display: grid; gap: 12px; padding: 2px; }
.cx-colhead { display: grid; grid-template-columns: 1fr auto; gap: 4px 10px; padding: 12px 14px; border-radius: 14px; background: linear-gradient(#fff6dc, #f6e3b0); border: 1.5px solid var(--gold); }
.cx-colhead b { font: 700 17px var(--font-head, inherit); color: #6b4510; } .cx-colhead > span { font: 700 20px var(--font-head, inherit); color: var(--teal); }
.cx-colhead .cx-bar, .cx-colhead small { grid-column: 1 / -1; } .cx-colhead small { font-size: 13px; color: #8a5a10; }
.cx-bar { height: 9px; border-radius: 99px; background: #eadfc2; overflow: hidden; } .cx-bar i { display: block; height: 100%; border-radius: 99px; background: linear-gradient(90deg, #5cb86a, var(--teal)); }
.cx-colgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 8px; }
.cx-colcard { display: grid; grid-template-columns: auto 1fr auto; grid-template-rows: auto auto; gap: 4px 8px; align-items: center; padding: 10px 12px; border-radius: 13px; cursor: pointer; text-align: left;
  border: 1.5px solid #e6d6b0; background: linear-gradient(#fffdf8, #fbf1dc); color: var(--ink); font: 600 13.5px var(--font, inherit); }
.cx-colcard .cx-emo { grid-row: 1 / 3; font-size: 28px; } .cx-colcard .cx-bar { grid-column: 2 / 4; } .cx-colcard .cx-n { font: 700 14px var(--font-head, inherit); color: var(--teal); }
.cx-colcard.full { border-color: var(--gold); background: linear-gradient(#fff8e2, #fbe9b8); }

/* จอกลาง: รายละเอียดแคบลง */
@media (max-width: 980px) { .cx { grid-template-columns: 150px minmax(0, 1fr); } .cx-body { grid-template-columns: minmax(0, 1fr) minmax(250px, 46%); } }
/* จอแคบ/มือถือ: เมนูหมวดเป็นแถบเลื่อนด้านบน · รายละเอียดแทนที่ตาราง */
@media (max-width: 760px) {
  html body #windows .win[data-win="codex"] { height: min(700px, calc(100dvh - 130px)); }
  .cx { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr); }
  .cx-nav { flex-direction: row; overflow-x: auto; padding: 6px; border-right: 0; border-bottom: 2px solid #c9a86a; background: linear-gradient(#e6d2a6, #efe0bd); }
  .cx-nav button { flex: none; flex-direction: column; gap: 2px; min-width: 64px; padding: 4px 6px; font-size: 13px; text-align: center; }
  .cx-nav button img { width: 28px; height: 28px; }
  .cx-nav button.on { box-shadow: inset 0 -3px 0 var(--leaf); }
  .cx-top { flex-wrap: wrap; } .cx-search { width: 100%; }
  .cx-title small { display: none; }
  .cx-body { grid-template-columns: minmax(0, 1fr); }
  .cx-grid { grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); }
  .cx .cx-detail { display: none; }
  .cx.show-detail .cx-detail { display: block; } .cx.show-detail .cx-grid { display: none; }
  .cx-back { display: inline-block; min-height: 44px; margin-bottom: 6px; padding: 0 14px; border-radius: 10px; border: 1px solid #dcc898; background: #fbf4e2; color: #6b5530; font: 700 14px var(--font-head, inherit); }
  .cx-tools { justify-content: flex-start; margin-top: 0; }
  .cx-chips { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 2px; } .cx-chips > button { flex: none; min-height: 40px; }
  .cx-go { min-height: 44px; }
}
/* ── ตามพื้นที่จริงของหน้าต่าง (container query · 1 ต.ค.) — ไม่ย่อทั้งก้อน แต่เปลี่ยนรูปแบบ ─────────────────
 *   กว้าง (> 1000 · คอม/iPad): 3 ส่วนแบบเดิม · กลาง (860–1000): แถบหมวดแคบ รายละเอียดแคบ
 *   แคบ (≤ 860 · มือถือแนวนอนทุกรุ่น): แถบหมวดเป็นไอคอนซ้าย + ตาราง · แตะการ์ด = รายละเอียดแทนที่ตาราง มีปุ่มกลับ
 *   ขั้นต่ำที่ห้ามหดกว่า: ตัวอักษร 13px · การ์ด 96px · ปุ่ม 44px (จอสัมผัส) — พื้นที่ไม่พอ = เปลี่ยนรูปแบบ ไม่ใช่ย่อ
 *   กรอบหน้าต่างบนจอสัมผัส = Screen Shell (ui-touch.css) — ไฟล์นี้ไม่ตั้งตำแหน่ง/ขนาดหน้าต่างเอง */
#windows .win[data-win="codex"] > .body { container: cxw / inline-size; }
@container cxw (max-width: 1000px) {
  .cx { grid-template-columns: 150px minmax(0, 1fr); }
  .cx-body { grid-template-columns: minmax(0, 1fr) minmax(250px, 44%); }
}
/* ตัวกรอง (ชิปหมวด + ตัวเลือกระดับ/อาชีพ/เส้นทาง) — กว้าง: แสดงเหมือนเดิม (กล่องนี้ไม่มีตัวตน) */
.cx-filter { display: contents; }
@container cxw (max-width: 860px) {
  /* แถวเดียว: [ค้นหาแคบ] [ชิป + ตัวเลือก เลื่อนข้าง] — เดิมสามแถว (ค้นหา · ชิป · ตัวเลือก) กินที่จนเห็นการ์ดแถวเดียว (ผู้ใช้ 1 ต.ค.) */
  .cx-main { display: grid; grid-template-columns: auto minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr); column-gap: 8px; }
  .cx-main > .cx-top { grid-column: 1; grid-row: 1; }
  .cx-main > .cx-filter { grid-column: 2; grid-row: 1; display: flex; align-items: center; gap: 5px; overflow-x: auto; scrollbar-width: none; min-width: 0; }
  .cx-main > .cx-filter::-webkit-scrollbar { display: none; }
  .cx-main > .cx-filter > :is(.cx-chips, .cx-tools) { display: contents; }
  .cx-main > .cx-filter :is(button, select) { flex: none; }
  .cx-main > .cx-body { grid-column: 1 / -1; grid-row: 2; min-height: 0; }
  .cx-search { width: 150px !important; min-height: 40px; }
  .cx { grid-template-columns: 62px minmax(0, 1fr); grid-template-rows: none; }
  .cx-nav { flex-direction: column; overflow-y: auto; overflow-x: hidden; padding: 6px 4px; border-bottom: 0; border-right: 2px solid #c9a86a; }
  .cx-nav button { justify-content: center; min-width: 0; min-height: 44px; padding: 4px; }
  .cx-nav button span { display: none; }
  .cx-nav button img { width: 30px; height: 30px; }
  .cx-main { padding: 6px 8px; gap: 5px; }
  .cx-title { display: none; }
  .cx-top { flex-wrap: nowrap; }
  .cx-chips { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 2px; } .cx-chips > button { flex: none; min-height: 40px; }
  .cx-body { grid-template-columns: minmax(0, 1fr); }
  .cx-grid { grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); }
  .cx .cx-detail { display: none; }
  .cx.show-detail .cx-detail { display: block; animation: cxSlide .18s ease-out; } .cx.show-detail .cx-grid { display: none; }
  .cx-back { display: inline-block; min-height: 44px; margin-bottom: 6px; padding: 0 14px; border-radius: 10px; border: 1px solid #dcc898; background: #fbf4e2; color: #6b5530; font: 700 14px var(--font-head, inherit); }
  .cx-go { min-height: 44px; }
}
@keyframes cxSlide { from { transform: translateX(24px); opacity: 0; } to { transform: none; opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .cx.show-detail .cx-detail { animation: none; } }

/* ── รูปโหลดทีละช่อง: skeleton ขนาดเท่ารูปจริง (ไม่กระโดด) · โหลดไม่ได้ = "?" ─────────────────────────── */
.cx img.cx-wait { opacity: 0; }
.cx :is(.cx-ic, .cx-big, .cx-thumb-wrap):has(> img.cx-wait), .cx img.cx-wait + .cx-sk { background: linear-gradient(100deg, #efe4c9 30%, #f8f0dc 50%, #efe4c9 70%) 0 0 / 300% 100%; animation: cxShimmer 1.1s linear infinite; border-radius: 10px; }
.cx img.cx-thumb.cx-wait, .cx img.cx-hero.cx-wait { opacity: 1; background: linear-gradient(100deg, #efe4c9 30%, #f8f0dc 50%, #efe4c9 70%) 0 0 / 300% 100%; animation: cxShimmer 1.1s linear infinite; color: transparent; }
@keyframes cxShimmer { to { background-position: -150% 0; } }
@media (prefers-reduced-motion: reduce) { .cx :is(.cx-ic, .cx-big):has(> img.cx-wait) { animation: none; } }
.cx img.cx-fail { opacity: 0; }
.cx :is(.cx-ic, .cx-big):has(> img.cx-fail) { position: relative; background: #efe6d2; border-radius: 10px; }
.cx :is(.cx-ic, .cx-big):has(> img.cx-fail)::after { content: '?'; position: absolute; inset: 0; display: grid; place-items: center; font: 800 22px var(--font-head, inherit); color: #b39a6a; }
/* แถบเตรียมภาพเบื้องหลัง (โผล่เฉพาะเมื่อนานเกิน 0.4 วิ) — ข้อมูลรอง ไม่บังการใช้งาน */
.cx { position: relative; }
.cx-prep { position: absolute; z-index: 3; bottom: 6px; right: 10px; display: flex; white-space: nowrap; align-items: center; gap: 6px; padding: 3px 9px; border-radius: 999px; background: #fffaf0e6; border: 1px solid #e2cc98; font: 700 12.5px var(--font-head, inherit); color: #6b5530; pointer-events: none; }
.cx-prep[hidden] { display: none; }
.cx-prep i { display: block; flex: none; width: 0; height: 5px; max-width: 60px; border-radius: 3px; background: linear-gradient(90deg, #5cb86a, var(--teal)); }
.cx-prep small { font-size: 12px; font-weight: 600; opacity: .8; }

/* ปุ่มในหน้าต่างของสกินไม้ถูกตั้งสูง 28px ทั้งเกม — การ์ด/ปุ่มในสมุดต้องสูงตามเนื้อหา */
html body #windows .win[data-win="codex"] .cx button:is(.cx-card, .cx-colcard, .cx-chip-it) { height: auto; }
html body #windows .win[data-win="codex"] .cx-nav button { height: auto; }
/* แถวตารางต้องสูงตามการ์ด (ปุ่มที่ display:grid ถูก Chrome คิดความสูงขั้นต่ำเป็น min-height 28px ของสกิน) */
html body #windows .win[data-win="codex"] .cx-grid { grid-auto-rows: max-content; }
html body #windows .win[data-win="codex"] .cx-card { min-height: 112px; }

/* หน้าโหลดครั้งแรก (codex.js prepare) — หนังสือ + แถบทอง-เขียว บนกระดาษครีม */
#windows .win[data-win="codex"] .cx-loading { height: 100%; display: grid; place-content: center; justify-items: center; gap: 10px; padding: 24px; text-align: center;
  color: #6b4510; background: radial-gradient(circle at 50% 40%, #fffaf0, #f3e6c8); }
.cx-loading img { width: 88px; height: 88px; object-fit: contain; animation: cxBob 1.6s ease-in-out infinite; filter: drop-shadow(0 4px 6px #8a5a1a33); }
.cx-loading b { font: 700 18px var(--font-head, inherit); }
.cx-loading .cx-bar { width: min(320px, 70vw); height: 12px; border: 1px solid #d9b56a; background: #efe2c2; }
.cx-loading .cx-bar i { transition: width .15s linear; }
.cx-loading .cx-pct { font: 700 14px var(--font-head, inherit); color: #2f6f73; }
.cx-loading small { max-width: 340px; font-size: 13px; color: #8a7650; line-height: 1.5; }
@keyframes cxBob { 50% { transform: translateY(-5px) rotate(-3deg); } }
/* ภาพมอนที่ยังวาดไม่เสร็จ: วงครีมจาง ๆ แทนช่องว่าง */
.cx-mob[src^="data:image/gif"] { border-radius: 50%; background: radial-gradient(circle, #efe2c2 40%, transparent 42%); }

/* ── ส่วนเพิ่ม 29 ก.ย. รอบ 2: เทียบของที่ใส่อยู่ · ทำได้ · ล็อก · แพ้ทาง · ตารางธาตุ ── */
.cx-tag.bad { background: #f6dcd6; color: #a8322a; } .cx-tag.warn { background: #fbecc8; color: #8a5a10; }
.cx-cmp { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; margin-top: 8px; padding: 6px 9px; border-radius: 9px; border: 1px solid #e3d2a8; background: #fffaf0; font-size: 13px; }
.cx-cmp b { flex-basis: 100%; font: 700 13px var(--font-head, inherit); color: #6b5530; }
.cx-cmp.up { border-color: #9fcf8f; background: #f1f9ec; } .cx-cmp.down { border-color: #e8b8a8; background: #fdf3ef; }
.cx-cmp span { padding: 0 7px; border-radius: 999px; font-weight: 700; } .cx-cmp span.up { background: #dcefd6; color: #2f6f3c; } .cx-cmp span.down { background: #f6dcd6; color: #a8322a; }
.cx-up { font-style: normal; color: #2f8f4e; font-weight: 900; }
.cx-can { font-style: normal; color: #2f8f4e; font-weight: 700; }
.cx-lock { margin: 8px 0 0; padding: 6px 10px; border-radius: 9px; background: #f4ead4; border: 1px dashed #c9a86a; font-size: 13.5px; color: #6b4510; }
.cx-p.warn { color: #a8322a; font-weight: 700; } .cx-p.ok { color: #2f6f3c; font-weight: 700; }
.cx-el-chip { display: inline-flex; align-items: center; gap: 3px; padding: 0 7px; margin: 2px 2px 0 0; border-radius: 999px; background: #eef4ef; font-size: 13px; font-weight: 700; color: #2c5a3c; }
.cx-etable { overflow-x: auto; margin-top: 6px; }
.cx-etable table { border-collapse: separate; border-spacing: 2px; font: 700 13px var(--font-head, inherit); }
.cx-etable th { padding: 2px 4px; color: #6b5530; white-space: nowrap; text-align: left; }
.cx-etable th span { margin-left: 4px; font-size: 13px; }
.cx-etable td { min-width: 28px; padding: 3px 1px; border-radius: 6px; text-align: center; background: #f6efdc; color: #7a6548; }
.cx-etable td.g1 { background: #dcefd6; color: #2f6f3c; } .cx-etable td.g2 { background: #9fd08f; color: #1f4f2c; }
.cx-etable td.r1 { background: #f6dcd6; color: #a8322a; } .cx-etable td.r2 { background: #e8b8a8; color: #7a1f18; }
.cx-statlist { list-style: none; margin: 4px 0; padding: 0; display: grid; gap: 4px; }
.cx-statlist li { display: grid; grid-template-columns: 48px 1fr; gap: 8px; align-items: center; padding: 5px 9px; border-radius: 8px; background: #fbf5e6; font-size: 13.5px; }
.cx-statlist b { font: 700 14px var(--font-head, inherit); color: #2f6f73; }
.cx-etable table { margin: 0 auto; }
.cx-elegend { display: flex; flex-wrap: wrap; gap: 4px 10px; font-size: 13px; color: #6b5530; }
.cx-elegend span { display: inline-flex; align-items: center; gap: 3px; }
.cx-card .cx-emo .cx-qi { width: 40px; height: 40px; object-fit: contain; }

/* แท็บอุปกรณ์: จำนวนชิ้นที่เห็นได้ตามตัวกรอง · 0 = จาง (อาชีพนี้ใส่ไม่ได้/ไม่มีในช่วงเลเวลนี้) — 1 ต.ค. */
.cx-chips button .cx-cnt { margin-left: 5px; font-style: normal; font-size: 12px; opacity: .7; }
.cx-chips button.zero:not(.on) { opacity: .45; }
.cx-empty .cx-go { margin-top: 8px; }
/* ภาพมาแล้วค่อย ๆ จางเข้า — ไม่เด้งโผล่ทีละช่อง (ผู้ใช้ 2 ต.ค.: "ดูไม่ smooth") */
.cx img { transition: opacity .2s ease-out; }
