/* Wiki — ธีมเดียวกับเกม (สีจาก dev/css/style.css) · หัวข้อแบบเกม (monospace ตัวหนา) · เนื้อหาฟอนต์อ่านง่าย */
:root {
  --bg-top: #0c1020; --bg-bottom: #1a1830;
  --panel: #182032; --panel-2: #212a3e; --line: #34405a;
  --frame-dark: #080a12; --frame-hi: #52617f;
  --text: #e4ecf4; --muted: #8794ab; --gold: #e0b24c; --ice: #9fd8e0; --bad: #d9704f;
  --head: ui-monospace, "Cascadia Mono", Consolas, "Courier New", monospace;
  --body: "Segoe UI", "Noto Sans Thai", "Leelawadee UI", Tahoma, system-ui, sans-serif;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; color: var(--text); font: 15px/1.6 var(--body);
  background: radial-gradient(ellipse 80% 40% at 50% 0%, rgba(120,150,210,.10), transparent 70%),
              linear-gradient(180deg, var(--bg-top), var(--bg-bottom));
  background-attachment: fixed; min-height: 100vh;
}
a { color: var(--ice); }
h1, h2, nav, .lang, .pill, .filters, .nm, .crumb, .stats th { font-family: var(--head); }
h1 { font-size: 22px; letter-spacing: 1px; margin: 4px 0 12px; }
h2 { font-size: 13px; letter-spacing: 2px; text-transform: uppercase; color: var(--gold); margin: 20px 0 8px; }
.muted { color: var(--muted); }

/* สองภาษา */
html[lang="en"] [lang="th"], html[lang="th"] [lang="en"] { display: none; }
html[lang="th"] body { font-size: 15.5px; }
span[lang="th"] { font-family: var(--body); letter-spacing: 0; }   /* ไทยในฟอนต์ monospace อ่านยาก */

/* แถบบน */
.top {
  position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 16px;
  padding: 8px 16px; background: rgba(8,10,18,.92); border-bottom: 2px solid var(--frame-dark);
  box-shadow: 0 1px 0 var(--frame-hi);
}
.logo { display: flex; align-items: center; gap: 8px; text-decoration: none; }
.logo img { height: 30px; image-rendering: pixelated; }
.logo span { font: bold 11px var(--head); letter-spacing: 3px; color: var(--gold); border: 1px solid var(--gold); padding: 1px 5px; }
nav { display: flex; gap: 4px; flex: 1; min-width: 0; overflow-x: auto; }
nav a { color: var(--muted); text-decoration: none; font-size: 13px; padding: 4px 8px; white-space: nowrap; }
nav a.on, nav a:hover { color: var(--text); background: var(--panel-2); }
.lang { display: flex; border: 1px solid var(--line); }
.lang button { background: none; border: 0; color: var(--muted); font: bold 12px var(--head); padding: 4px 8px; cursor: pointer; }
html[lang="en"] .lang [data-set="en"], html[lang="th"] .lang [data-set="th"] { background: var(--gold); color: #1a1408; }

main { max-width: 980px; margin: 0 auto; padding: 18px 16px 40px; }
footer { text-align: center; color: var(--muted); font-size: 12px; padding: 20px 16px 30px; }
.crumb { font-size: 12px; color: var(--muted); margin: 0 0 8px; }

/* ป้ายเดียวกับในเกม */
.pill { display: inline-block; vertical-align: middle; font-size: 10px; letter-spacing: 1px; font-weight: normal;
        padding: 1px 6px; border: 1px solid var(--muted); color: var(--muted); white-space: nowrap; }
.pill.rare-foe { color: var(--gold); border-color: var(--gold); }
.pill.boss-foe { color: var(--bad); border-color: var(--bad); }

/* ปุ่มกรอง */
.filters { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.filters button { background: var(--panel); color: var(--muted); border: 1px solid var(--line); font: 12px var(--head);
                  padding: 5px 12px; cursor: pointer; }
.filters button.on { color: var(--text); border-color: var(--gold); box-shadow: inset 0 -2px 0 var(--gold); }

/* การ์ด */
.card { background: var(--panel); border: 2px solid var(--frame-dark); box-shadow: 0 0 0 1px var(--frame-hi) inset, 0 2px 0 rgba(0,0,0,.4); }
.card-art { display: flex; align-items: flex-end; justify-content: center; background: rgba(0,0,0,.25); }
.z-ice .card-art    { background: linear-gradient(180deg, rgba(60,90,140,.25), rgba(0,0,0,.3)); }
.z-desert .card-art { background: linear-gradient(180deg, rgba(150,100,50,.25), rgba(0,0,0,.3)); }
.z-south .card-art  { background: linear-gradient(180deg, rgba(40,110,120,.25), rgba(0,0,0,.3)); }

.zone h2 { border-bottom: 1px solid var(--line); padding-bottom: 4px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.card.mini { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 0 0 10px; color: var(--text); text-decoration: none; text-align: center; }
.card.mini:hover { box-shadow: 0 0 0 1px var(--gold) inset, 0 2px 0 rgba(0,0,0,.4); }
.card.mini .card-art { width: 100%; height: 110px; padding-bottom: 8px; overflow: hidden; }
.card.mini .nm { font-size: 12px; font-weight: bold; padding: 0 6px; }
.mini-stats { font-size: 11px; color: var(--muted); }
.card.mini.hide { display: none; }
.zone.empty { display: none; }

.card.big { display: grid; grid-template-columns: 260px 1fr; }
.card.big .card-art { min-height: 260px; padding: 20px; align-items: center; align-self: start; height: 300px; }
.card.big .card-body { padding: 16px 20px 20px; }
.card.big h1 { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 0; }
@media (max-width: 640px) {
  .card.big { grid-template-columns: 1fr; }
  .card.big .card-art { min-height: 200px; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); }
  .top { gap: 6px 10px; flex-wrap: wrap; }
  .top nav { order: 3; flex-basis: 100%; }
  .lang { margin-left: auto; }
}

.stats { border-collapse: collapse; margin-top: 12px; min-width: 240px; }
.stats th { text-align: left; font-size: inherit; color: var(--muted); font-weight: normal; padding: 3px 18px 3px 0; }
.stats td { font-weight: 600; padding: 3px 0; }
.stats tr + tr { border-top: 1px solid rgba(255,255,255,.05); }
.moves, .where { margin: 0; padding-left: 18px; }
.moves li, .where li { margin: 3px 0; }
a.todo { color: var(--text); text-decoration: underline dotted var(--muted); }
.note { margin-top: 24px; padding: 10px 14px; border-left: 3px solid var(--line); color: var(--muted); font-size: 14px; }

/* ภาพมอน: แผ่นภาพเดียวกับเกม แถวบน = ท่ายืน 4 เฟรม */
.spr { position: relative; }
.spr i { display: block; background-repeat: no-repeat; image-rendering: pixelated; animation: sprite-frames .8s steps(4) infinite; }
@keyframes sprite-frames { from { background-position-x: 0; } to { background-position-x: calc(var(--sheet-w) * -1); } }
.spr.special i { animation: sprite-frames .8s steps(4) infinite, special-glow 1.6s ease-in-out infinite; }
@keyframes special-glow {
  0%, 100% { filter: drop-shadow(0 0 1px #fff3c4) drop-shadow(0 0 3px rgba(159,216,224,.8)); }
  50%      { filter: drop-shadow(0 0 2px #fff3c4) drop-shadow(0 0 7px rgba(224,178,76,.95)); }
}
.spr.fx-boss-ice i  { animation: sprite-frames .8s steps(4) infinite, boss-glow-ice 1.8s ease-in-out infinite; }
.spr.fx-boss-sand i { animation: sprite-frames .8s steps(4) infinite, boss-glow-sand 1.8s ease-in-out infinite; }
@keyframes boss-glow-ice {
  0%, 100% { filter: drop-shadow(0 0 2px rgba(130,210,255,.85)) drop-shadow(0 0 6px rgba(60,170,255,.55)); }
  50%      { filter: drop-shadow(0 0 2px rgba(160,225,255,.95)) drop-shadow(0 0 9px rgba(60,170,255,.75)); }
}
@keyframes boss-glow-sand {
  0%, 100% { filter: drop-shadow(0 0 2px rgba(255,190,110,.85)) drop-shadow(0 0 6px rgba(255,130,30,.55)); }
  50%      { filter: drop-shadow(0 0 2px rgba(255,210,140,.95)) drop-shadow(0 0 9px rgba(255,130,30,.75)); }
}
/* ควันดำรอบตัว (ผีทะเลทราย / Warden / ตัวหลงถิ่น) */
.spr .smoke {
  position: absolute; left: 50%; bottom: 0; width: 150%; height: 200%; transform: translateX(-50%);
  background: radial-gradient(ellipse 40% 45% at 50% 70%, rgba(6,5,10,.6), transparent 70%),
              radial-gradient(ellipse 22% 28% at 40% 40%, rgba(6,5,10,.5), transparent 70%),
              radial-gradient(ellipse 22% 28% at 60% 35%, rgba(6,5,10,.5), transparent 70%);
  filter: blur(3px); animation: smoke-rise 1.3s ease-in-out infinite alternate; pointer-events: none;
}
@keyframes smoke-rise {
  0% { transform: translateX(-50%) scale(1, .94); }
  100% { transform: translateX(-48%) scale(1.07, 1.1) translateY(-3%); }
}
@media (prefers-reduced-motion: reduce) { .spr i, .spr .smoke { animation: none !important; } }

/* ===== การ์ดมอนมีกรอบ (8 ต.ค. จ๊อบ: กรอบเดียวกันทุกตัว ไม่แยกสี ให้ดูเป็นระเบียบ · ชื่อเด่น · เส้นแบ่งหัวข้อ) ===== */
.card.big { grid-template-columns: 300px 1fr; }
.card.big .card-art { display: none; }
.portrait {
  position: relative; width: 264px; margin: 18px; display: flex; flex-direction: column; align-self: start;
  border: 6px solid var(--frame-hi); background: var(--frame-dark);
  box-shadow: inset 0 0 0 2px var(--frame-dark), 0 0 0 2px var(--frame-dark), 0 4px 0 rgba(0,0,0,.5);
}
.portrait .win {
  height: 300px; display: flex; align-items: center; justify-content: center; overflow: hidden;
  margin: 4px 4px 0; background: radial-gradient(ellipse 70% 55% at 50% 70%, rgba(110,140,200,.22), transparent 70%), linear-gradient(180deg, #1d2538, #0d1220);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.08);
}
.card.big .portrait .plate {
  margin: 4px; padding: 14px 10px; border-top: 4px solid var(--frame-hi); display: block; background: linear-gradient(180deg, #1c2438, #10141f);
  text-align: center; font: bold 17px/1.2 var(--head); letter-spacing: 1px; color: #f3d27a;
  text-shadow: 0 2px 0 #000, 0 0 8px rgba(224,178,76,.35);
}
.sub { display: flex; align-items: center; gap: 10px; margin: 2px 0 0; }
/* เส้นแบ่งหัวข้อ */
.card.big .card-body h2 { border-top: 1px solid var(--line); padding-top: 14px; margin-top: 18px; }
.card.big .stats { margin-top: 14px; }
@media (max-width: 640px) {
  .card.big { grid-template-columns: 1fr; }
  .portrait { margin: 16px auto 4px; }
}

/* ===== ฟอนต์พิกเซลเดียวกับเกม (DotGothic16 · SIL OFL · assets/fonts/) ใช้กับหัวข้อ ===== */
@font-face { font-family: 'DotGothic16'; font-display: swap; src: url(../assets/fonts/DotGothic16-latin.woff2) format('woff2'); }
:root { --head: 'DotGothic16', ui-monospace, Consolas, monospace; }
h1, h2, .nm, .portrait .plate, .zn, .sn { font-weight: normal; }   /* ฟอนต์นี้ไม่มีตัวหนา */

.small { font-size: 13px; }
.dot { display: inline-block; width: 9px; height: 9px; margin-right: 6px; vertical-align: 0; box-shadow: 0 0 0 1px rgba(0,0,0,.6); }

/* หน้าแมพ */
.zone-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.zone-card { display: flex; flex-direction: column; gap: 2px; padding-bottom: 12px; color: var(--text); text-decoration: none; overflow: hidden; }
.zone-card img { width: 100%; height: 140px; object-fit: cover; image-rendering: pixelated; margin-bottom: 8px; }
.zone-card .zn { font-family: var(--head); font-size: 17px; color: #f3d27a; padding: 0 14px; }
.zone-card .muted { padding: 0 14px; font-size: 13px; }
.zone-card:hover { box-shadow: 0 0 0 1px var(--gold) inset; }

.scenes { display: flex; flex-direction: column; gap: 12px; margin-top: 14px; }
.scene { display: grid; grid-template-columns: 200px 1fr; gap: 0; scroll-margin-top: 70px; }   /* ความสูงเท่ากันทุกฉาก ตั้งใน wiki.js */
.scene:target { box-shadow: 0 0 0 2px var(--gold) inset; }
.scene-img { width: 176px; height: 176px; margin: 12px; object-fit: cover; image-rendering: pixelated; border: 2px solid var(--frame-dark); box-shadow: 0 0 0 1px var(--frame-hi); }
.scene-body { padding: 10px 16px 12px; }
.scene-body h2 { color: var(--text); text-transform: none; letter-spacing: 1px; font-size: 18px; margin: 0 0 4px; display: flex; align-items: center; gap: 10px; }
.sn { display: inline-flex; align-items: center; justify-content: center; min-width: 26px; height: 26px; font-size: 13px; color: var(--gold); border: 1px solid var(--gold); }
.tags { margin: 0 0 8px; font-size: 13px; color: var(--muted); display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.tags:empty { display: none; }
.foe { display: flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; margin-bottom: 8px; }
.foe-art { width: 64px; height: 56px; display: flex; align-items: flex-end; justify-content: center; overflow: hidden; background: rgba(0,0,0,.25); }
.foe:hover b { color: var(--gold); }
.drop p { margin: 0 0 4px; }
.rates { border-collapse: collapse; font-size: 14px; }
.rates th { text-align: left; color: var(--muted); font-weight: normal; font-size: 12px; padding: 2px 22px 2px 0; }
.rates td { padding: 2px 22px 2px 0; }
.rates td + td { text-align: right; font-weight: 600; }
.elite { margin: 8px 0 0; font-size: 14px; color: var(--muted); }
@media (max-width: 640px) {
  .scene { grid-template-columns: 1fr; }
  .scene { min-height: 0; }
  .scene-img { width: calc(100% - 24px); height: 160px; }
}

/* หน้าประเภทมอน */
.card.kind { display: flex; gap: 16px; padding: 4px 18px 10px; margin-bottom: 12px; scroll-margin-top: 70px; }
.card.kind h2 { color: var(--text); font-size: 17px; text-transform: none; letter-spacing: 1px; display: flex; align-items: center; gap: 10px; }
.card.kind p { margin: 6px 0; }
.card.kind ul { margin: 4px 0; padding-left: 20px; }
.kind-art { flex: none; width: 120px; display: flex; align-items: flex-end; justify-content: center; padding: 14px 0; }
.pill.stray-foe { color: var(--bad); border-color: var(--bad); }
.spr.stray .smoke { width: 180%; height: 235%; }

.rates { display: flex; flex-wrap: wrap; gap: 4px 16px; font-size: 14px; }
.rt b { font-weight: 600; }

/* ===== ตัวละคร ===== */
.spr.hero i { animation-duration: .9s; }
.portrait .win.heroes { gap: 4px; flex-wrap: wrap; align-content: center; }
.rates-t { border-collapse: collapse; font-size: 14px; margin: 4px 0; }
.rates-t th { text-align: left; color: var(--muted); font-weight: normal; font-size: 13px; padding: 3px 22px 3px 0; }
.rates-t td { padding: 3px 22px 3px 0; border-top: 1px solid rgba(255,255,255,.05); }
.skills { border-collapse: collapse; width: 100%; font-size: 14px; }
.skills td { padding: 8px 10px 8px 0; vertical-align: top; border-top: 1px solid rgba(255,255,255,.06); }
.skills td.lv { white-space: nowrap; color: var(--gold); font-family: var(--head); padding-top: 12px; }
.skills td.ic { width: 44px; }
.skills td.trg { color: var(--muted); font-size: 13px; width: 150px; }
.sk-ico { display: block; width: 40px; height: 40px; image-rendering: pixelated; background: rgba(0,0,0,.3); box-shadow: 0 0 0 1px var(--frame-hi); }
.starters { display: flex; flex-wrap: wrap; gap: 14px; }
.starter { display: flex; flex-direction: column; align-items: center; gap: 4px; font-family: var(--head); }
.hint { margin: 14px 0 0; padding: 10px 14px; font-style: italic; color: #b9b0d8; border-left: 3px solid #6f5fa8; background: rgba(111,95,168,.08); }
@media (max-width: 640px) { .skills td.trg { width: auto; } .skills tr { display: grid; grid-template-columns: auto 44px 1fr; } .skills td.trg { grid-column: 3; padding-top: 0; } }

/* ===== ไอเทม ===== */
.sub-nav { font-family: var(--head); margin: -4px 0 8px; }
.tbl-wrap { overflow-x: auto; }
.grid-t { border-collapse: collapse; font-size: 14px; min-width: 620px; }
.grid-t th, .grid-t td { padding: 5px 10px; border-top: 1px solid rgba(255,255,255,.06); text-align: center; white-space: nowrap; }
.grid-t th:first-child { text-align: left; color: var(--muted); font-weight: normal; }
.grid-t tr:first-child th { color: var(--text); font-weight: normal; border-top: 0; }
.grid-t td.lv { color: var(--gold); font-family: var(--head); }
.g-ico { display: inline-block; width: 36px; height: 36px; image-rendering: pixelated; vertical-align: middle; background: rgba(0,0,0,.3); box-shadow: 0 0 0 1px var(--frame-hi); }
.slots th { text-align: left; color: var(--muted); font-weight: normal; font-size: 13px; padding: 4px 10px 4px 0; }
.slots td:first-child { width: 46px; }
.weap-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.weap-list li { display: flex; align-items: center; gap: 10px; }
.set-icons { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0; }
.setb .setcol { text-align: left; font-family: var(--head); font-weight: normal; padding-top: 12px; }
.setb .setcol.gold { color: var(--gold); }
.setb .setcol.red { color: #e0453a; }
.card.kind.set { display: block; }

/* ===== วิธีเล่น ===== */
.guide { max-width: 760px; }
.guide h2 { margin-top: 24px; }
.guide p, .guide li { line-height: 1.7; }
h2 span[lang="th"] { font-size: 15px; letter-spacing: 0; }
.home-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; }
.home-card { display: flex; align-items: center; gap: 14px; padding: 14px 16px; color: var(--text); text-decoration: none; }
.home-card img { width: 48px; height: 48px; object-fit: contain; image-rendering: pixelated; flex: none; }
.home-card .zn { font-family: var(--head); font-size: 17px; color: #f3d27a; }
.home-card:hover { box-shadow: 0 0 0 1px var(--gold) inset; }
.r-ico { width: 16px; height: 16px; vertical-align: -3px; margin-right: 3px; image-rendering: pixelated; }
.grid-t.cost td { line-height: 1.5; }
