/* เทอร์ราพีเดีย — หน้าสารานุกรมบนเว็บ (ต่อยอดจาก css/site.css ใช้ตัวแปรสีชุดเดียวกัน)
   โทน/ปุ่ม/หัวข้อ ใช้ของ site.css หมด ไฟล์นี้เพิ่มเฉพาะของที่หน้านี้มีคนเดียว:
   แผนที่โลกมีหมุด · การ์ดมอน/แมป · แถบตัวกรอง · หน้าต่างรายละเอียด */

/* ── หัวหน้าเพจ ── */
.tp-hero { padding: 54px 0 34px; background: linear-gradient(#1b1712, var(--bg)); }
.tp-hero h1 { font-size: clamp(31px, 5.6vw, 47px); font-weight: 900; color: var(--cream);
  letter-spacing: 1.5px; margin-top: 4px; }
.tp-hero p { color: var(--dim); margin-top: 12px; max-width: 62ch; font-size: 15.5px; }
.tp-hero .facts { margin-top: 30px; padding-top: 22px; gap: 24px 38px; }

/* ── แผนที่โลก + หมุด (พิกัดหมุดมาจาก WORLD_PIN — ชุดเดียวกับมินิแมปในเกม) ── */
.tp-poster { position: relative; line-height: 0; border: 1px solid var(--line);
  border-radius: 16px; overflow: hidden; background: #22201c; }
.tp-poster img { width: 100%; height: auto; display: block; }
.tp-lines { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.tp-lines line { stroke: #ffeec2; stroke-width: 2; stroke-dasharray: 9 7; opacity: .55;
  vector-effect: non-scaling-stroke; }
.tp-lines line.dun { stroke: #c9a2ff; stroke-dasharray: 6 6; }

.tp-pin { position: absolute; transform: translate(-50%, -50%); padding: 0; background: none;
  border: 0; cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 3px;
  z-index: 1; font: inherit; }
.tp-pin i { width: 12px; height: 12px; border-radius: 50%; border: 2px solid #fffaf0;
  background: #8fb35e; box-shadow: 0 1px 5px #000b; transition: transform .12s; }
.tp-pin.city i { width: 15px; height: 15px; background: #f0c25a; }
.tp-pin.dungeon i { background: #b98ae8; border-style: dashed; }
.tp-pin span { padding: 2px 7px; border-radius: 5px; font-size: 11px; line-height: 1.5;
  white-space: nowrap; background: #12100de6; color: var(--cream); border: 1px solid #6b5828;
  font-weight: 600; }
.tp-pin:hover { z-index: 3; }
.tp-pin:hover i { transform: scale(1.3); }
.tp-pin:hover span { background: var(--gold); color: #241a03; border-color: var(--gold); }

.tp-legend { display: flex; flex-wrap: wrap; gap: 10px 22px; margin-top: 14px;
  color: var(--dim); font-size: 13px; }
.tp-legend span { display: inline-flex; align-items: center; gap: 7px; }
.tp-pindot { width: 11px; height: 11px; border-radius: 50%; border: 2px solid #fffaf0;
  background: #8fb35e; display: inline-block; }
.tp-pindot.city { background: #f0c25a; }
.tp-pindot.field { background: #8fb35e; }
.tp-pindot.dungeon { background: #b98ae8; border-style: dashed; }
.tp-dash { width: 22px; height: 0; border-top: 2px dashed #c9a2ff; display: inline-block; }

@media (max-width: 720px) {
  .tp-pin span { display: none; }
  .tp-pin i { width: 14px; height: 14px; }
}

/* ── แถบตัวกรอง ── */
.tp-filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 20px;
  position: sticky; top: 62px; z-index: 20; background: #171410f2; backdrop-filter: blur(8px);
  border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; }
.tp-filters input, .tp-filters select { background: var(--panel2); color: var(--tx);
  border: 1px solid #4a4238; border-radius: 10px; padding: 10px 12px; font: inherit; font-size: 14.5px; }
.tp-filters input { flex: 1 1 240px; min-width: 0; }
.tp-filters select { flex: 0 1 auto; max-width: 100%; }
.tp-filters input:focus, .tp-filters select:focus { outline: 0; border-color: var(--gold);
  box-shadow: 0 0 0 3px #e8b94c22; }
.tp-filters .btn { padding: 10px 18px; font-size: 14px; }
.tp-count { color: var(--dim); font-size: 13.5px; margin-left: auto; white-space: nowrap;
  font-variant-numeric: tabular-nums; }

/* ── การ์ด (มอน 1:1 · แมป 16:9) ── */
.tp-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(228px, 1fr)); gap: 15px; }
.tp-grid.maps { grid-template-columns: repeat(auto-fill, minmax(285px, 1fr)); }

.tp-card { position: relative; display: block; width: 100%; text-align: left; padding: 0;
  background: var(--panel); border: 1px solid var(--line); border-radius: 15px; overflow: hidden;
  color: inherit; font: inherit; cursor: pointer; transition: transform .16s, border-color .16s; }
.tp-card:hover { transform: translateY(-3px); border-color: #6b5828; }
.tp-card:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.tp-thumb { display: block; aspect-ratio: 1 / 1; background: #22201c; }
.tp-thumb.wide { aspect-ratio: 16 / 9; }
.tp-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.tp-cardin { display: block; padding: 12px 14px 14px; }
.tp-cardin b { display: block; font-size: 15.5px; color: var(--cream); line-height: 1.35; }
.tp-mini { display: block; font-size: 13px; color: #bcb2a2; margin-top: 5px;
  font-variant-numeric: tabular-nums; }
.tp-where { display: block; font-size: 12.5px; color: var(--dim); margin-top: 4px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.tp-lvpill { position: absolute; top: 10px; left: 10px; font-size: 11.5px; font-weight: 700;
  background: #12100dd9; border: 1px solid #6b5828; color: var(--gold); padding: 3px 10px;
  border-radius: 20px; }
.tp-lvpill.boss { border-color: #a3452e; color: #f0a08a; }
.tp-tag { display: inline-block; font-size: 11px; font-weight: 800; letter-spacing: .8px;
  padding: 2px 8px; border-radius: 20px; background: #a3452e; color: #ffe9df; }
.tp-tag.mvp { background: #6e4fd8; color: #ede6ff; }
.tp-card .tp-tag { position: absolute; top: 10px; right: 10px; }
.tp-tag.kind { background: #2f3a2a; color: #cfe4bd; border: 1px solid #4a5a42; letter-spacing: 0; }
.tp-tag.kind.city { background: #3a3218; color: #f3dda6; border-color: #6b5828; }
.tp-tag.kind.dungeon { background: #2f2740; color: #d9c6ff; border-color: #4e3f6e; }

/* ── ชิป/ป้ายเล็ก ── */
.tp-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 7px; }
.tp-chips i { font-style: normal; font-size: 11.5px; padding: 2px 9px; border-radius: 20px;
  border: 1px solid var(--line); background: var(--panel2); color: #cfc5b4; }
.tp-lvchip { font-weight: 700; color: var(--gold) !important; border-color: #6b5828 !important;
  background: #2b2413 !important; }
.tp-kindchip.city { color: #f3dda6 !important; border-color: #6b5828 !important; }
.tp-kindchip.dungeon { color: #d9c6ff !important; border-color: #4e3f6e !important; }
.tp-beh.shy { color: #9ad8c0 !important; }
.tp-el { font-style: normal; }
.el-neutral { color: #cdc3b3 !important; }
.el-water { color: #7fc7e8 !important; border-color: #2f5c74 !important; }
.el-earth { color: #b7d98a !important; border-color: #4a5f33 !important; }
.el-wind { color: #cfe0f2 !important; border-color: #4a5a6e !important; }
.el-fire { color: #ff9a5c !important; border-color: #7a3a1e !important; }
.el-poison { color: #c9a2ff !important; border-color: #4e3f6e !important; }
.el-undead { color: #9ad8c0 !important; border-color: #2f5f4c !important; }

.tp-gold { color: var(--gold); }
.tp-dim { color: var(--dim); }
.tp-empty { color: var(--dim); font-size: 15px; padding: 26px 0; grid-column: 1 / -1; }

/* ── หน้าต่างรายละเอียด ── */
body.tp-locked { overflow: hidden; }
.tp-modal { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 20px; }
.tp-modal[hidden] { display: none; }
.tp-back { position: absolute; inset: 0; background: #08070699; backdrop-filter: blur(3px); }
.tp-sheet { position: relative; width: min(880px, 100%); max-height: min(88vh, 900px);
  overflow: hidden; background: var(--panel); border: 1px solid #4a4235; border-radius: 18px;
  box-shadow: 0 26px 70px #000b; display: flex; flex-direction: column; }
.tp-sheetbody { overflow-y: auto; padding: 22px 24px 26px; -webkit-overflow-scrolling: touch; }
.tp-x { position: absolute; top: 12px; right: 12px; z-index: 2; width: 36px; height: 36px;
  border-radius: 50%; border: 1px solid #5a5344; background: #12100de6; color: var(--tx);
  font-size: 19px; line-height: 1; cursor: pointer; }
.tp-x:hover { background: var(--gold); color: #241a03; border-color: var(--gold); }

.tp-sheettop { display: grid; grid-template-columns: 210px 1fr; gap: 20px; align-items: start; }
.tp-sheettop.wide { grid-template-columns: 300px 1fr; }
.tp-hero-img { width: 100%; aspect-ratio: 1 / 1; object-fit: cover; border-radius: 13px;
  border: 1px solid var(--line); background: #22201c; }
.tp-hero-img.wide { aspect-ratio: 16 / 9; }
.tp-sheetmeta h2 { font-size: 23px; color: var(--cream); font-weight: 800; line-height: 1.3;
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.tp-mood { color: var(--dim); font-size: 14.5px; margin-top: 10px; }
@media (max-width: 640px) {
  .tp-sheettop, .tp-sheettop.wide { grid-template-columns: 1fr; }
  .tp-hero-img { max-width: 240px; }
  .tp-hero-img.wide { max-width: none; }
  .tp-sheetbody { padding: 18px 16px 22px; }
}

/* ตัวเลขสำคัญ */
.tp-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(92px, 1fr)); gap: 8px;
  margin-top: 14px; }
.tp-stat { background: var(--panel2); border: 1px solid var(--line); border-radius: 11px;
  padding: 9px 11px; }
.tp-stat span { display: block; font-size: 11.5px; color: var(--dim); }
.tp-stat b { display: block; font-size: 17px; color: var(--tx); font-variant-numeric: tabular-nums;
  margin-top: 2px; }
.tp-stat.gold b { color: var(--gold); }

/* บล็อกเนื้อหาในหน้าต่าง */
.tp-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 700px) { .tp-cols { grid-template-columns: 1fr; } }
.tp-block { margin-top: 22px; }
.tp-block h3 { font-size: 15px; color: var(--cream); font-weight: 800; margin-bottom: 10px;
  padding-bottom: 7px; border-bottom: 1px solid var(--line); }
.tp-block h3 ~ h3 { margin-top: 18px; }

.tp-kv { list-style: none; }
.tp-kv li { display: flex; gap: 12px; font-size: 14px; padding: 6px 0;
  border-bottom: 1px dashed #2c2823; }
.tp-kv li:last-child { border-bottom: 0; }
.tp-kv span { color: var(--dim); }
.tp-kv b { margin-left: auto; text-align: right; color: var(--tx); font-variant-numeric: tabular-nums; }

.tp-special { list-style: none; display: flex; flex-direction: column; gap: 9px; }
.tp-special li { background: #2a1f1a; border: 1px solid #573a2c; border-left: 3px solid #d85a4a;
  border-radius: 10px; padding: 10px 13px; font-size: 13.5px; color: #e8ddd0; }
.tp-special b { color: #ffc9a8; }

.tp-drops { list-style: none; display: flex; flex-direction: column; gap: 7px; }
.tp-drop { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; font-size: 14px;
  background: var(--panel2); border: 1px solid var(--line); border-radius: 10px; padding: 9px 12px; }
.tp-dname { color: var(--tx); }
.tp-drop b { font-variant-numeric: tabular-nums; }
.tp-dkind { flex: 1 0 100%; font-size: 11.5px; color: var(--dim); }
.tp-dot { width: 15px; height: 15px; border-radius: 3px; flex: 0 0 auto; display: inline-block;
  border: 1px solid #00000055; box-shadow: inset 0 1px 0 #ffffff50; }
/* สีวัตถุดิบชุดเดียวกับในเกม (css/ro-ui.css) — คนเล่นอยู่จะจำสีได้ทันที */
.m-jelly { background: #7cc94a; } .m-fang { background: #e8e0d0; }
.m-hide { background: #a9784f; } .m-silk { background: #cfd8e6; }
.m-bone { background: #f2efe4; } .m-ember { background: #ff8a3d; }
.m-core { background: #8ad8f0; }
.g-good { background: #c9a86a; }

.tp-note { font-size: 13px; color: var(--dim); background: #221f1a; border: 1px dashed #4a4235;
  border-radius: 10px; padding: 10px 13px; margin-top: 11px; line-height: 1.6; }
.tp-note b { color: var(--cream); }

.tp-places { list-style: none; margin-top: 11px; display: flex; flex-direction: column; gap: 6px; }
.tp-places li { font-size: 13.5px; color: #cfc5b4; }
.tp-places b { color: var(--cream); }

/* แถวกดได้ (มอนในแมป / แมปที่เจอมอน) */
.tp-row { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left;
  background: var(--panel2); border: 1px solid var(--line); border-radius: 12px; padding: 8px 12px;
  color: inherit; font: inherit; cursor: pointer; margin-bottom: 7px; transition: border-color .15s; }
.tp-row:hover { border-color: #6b5828; }
.tp-row img { width: 46px; height: 46px; border-radius: 9px; object-fit: cover; flex: 0 0 auto;
  background: #22201c; }
.tp-row img.wide { width: 76px; height: 44px; }
.tp-rowin { flex: 1; min-width: 0; }
.tp-rowin b { display: block; font-size: 14.5px; color: var(--cream); }
.tp-rowin .tp-dim { display: block; font-size: 12.5px; }
.tp-rowend { text-align: right; flex: 0 0 auto; }
.tp-rowend b { display: block; font-size: 16px; color: var(--gold); font-variant-numeric: tabular-nums; }
.tp-rowend .tp-dim { font-size: 11.5px; }

/* ทางเชื่อมระหว่างแมป */
.tp-portal { display: flex; align-items: center; gap: 12px; background: var(--panel2);
  border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; margin-bottom: 7px; }
.tp-dir { width: 26px; height: 26px; flex: 0 0 auto; border-radius: 50%; background: #33291399;
  border: 1px solid #6b5828; position: relative; }
.tp-dir::after { content: ''; position: absolute; inset: 0; margin: auto; width: 0; height: 0;
  border: 5px solid transparent; }
.tp-dir.n::after { border-bottom-color: var(--gold); margin-top: 3px; }
.tp-dir.s::after { border-top-color: var(--gold); margin-bottom: 3px; }
.tp-dir.w::after { border-right-color: var(--gold); margin-right: 3px; }
.tp-dir.e::after { border-left-color: var(--gold); margin-left: 3px; }
.tp-dir.down { border-color: #6e4fd8; }
.tp-dir.down::after { border-top-color: #c9a2ff; margin-bottom: 3px; }
.tp-dir.up { border-color: #6e4fd8; }
.tp-dir.up::after { border-bottom-color: #c9a2ff; margin-top: 3px; }
.tp-mini-btn { background: transparent; border: 1px solid #5a5344; color: var(--tx); font: inherit;
  font-size: 12.5px; padding: 6px 12px; border-radius: 9px; cursor: pointer; white-space: nowrap; }
.tp-mini-btn:hover { border-color: var(--gold); color: var(--gold); }
