/* Wiki ของเกม — ใช้ทั้งหน้าต่าง Wiki ในเกม (#wiki-root ใน win-wiki) และเว็บ Wiki (wiki.html) */
.wk {
  --wk-bg: #f8f0dc;
  --wk-line: #d3bd8f;
  --wk-ink: #3b2c1a;
  --wk-sub: #6b5a42;
  --wk-link: #2e5fb8;
  color: var(--wk-ink);
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 0;
}
.wk-head { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.wk-back, .wk-open-web {
  width: 32px;
  height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  border: 1px solid #5c6b86;
  background: #e8edf7;
  color: #2b3a66;
  font: inherit;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
}
.wk-back:disabled { opacity: 0.4; cursor: default; }
.wk-tabs { display: flex; }
.wk-tabs button {
  padding: 6px 14px;
  border: 1px solid #2c3f6e;
  background: linear-gradient(#26396e, #1b2a54);
  color: #dfe7f7;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}
.wk-tabs button:first-child { border-radius: 6px 0 0 6px; }
.wk-tabs button:last-child { border-radius: 0 6px 6px 0; }
.wk-tabs button.active { background: linear-gradient(#3a64c4, #2a4d9e); border-color: #c9a24a; color: #fff; }
.wk-search {
  flex: 1;
  min-width: 140px;
  padding: 6px 10px;
  border-radius: 6px;
  border: 1px solid #c9b58a;
  background: #fffaf0;
  color: var(--wk-ink);
  font: inherit;
}
.wk-body { display: grid; grid-template-columns: 240px 1fr; gap: 10px; min-height: 0; flex: 1; }
.wk-list, .wk-detail {
  border-radius: 8px;
  border: 1px solid var(--wk-line);
  background: var(--wk-bg);
  overflow-y: auto;
  min-height: 0;
}
.wk-list { display: flex; flex-direction: column; padding: 4px; gap: 2px; }
.wk-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 6px;
  border-radius: 6px;
  border: 1px solid transparent;
  background: none;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.wk-row:hover { background: rgba(255, 255, 255, 0.6); }
.wk-row.selected { background: #fff; border-color: #4aa3ff; }
.wk-row-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
.wk-row-text b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wk-row-text small { color: var(--wk-sub); font-size: 11px; }
.wk-ico { width: 32px; height: 32px; flex-shrink: 0; border-radius: 6px; border: 2px solid #cdb78a; background-color: #fffaf0; }
.wk-emoji { display: inline-flex; align-items: center; justify-content: center; font-size: 18px; border: 0; background: none; }
.wk-portrait { background-size: contain; background-repeat: no-repeat; background-position: center; image-rendering: pixelated; }
.wk-blob { border-radius: 50%; border: 2px solid rgba(0, 0, 0, 0.35); }
.wk-mini { display: inline-block; width: 22px; height: 22px; vertical-align: middle; margin-right: 4px; border-radius: 4px; }
.wk-detail { padding: 12px 16px; }
.wk-title-row { display: flex; align-items: center; gap: 12px; }
.wk-big { width: 72px; height: 72px; flex-shrink: 0; border-radius: 10px; border: 2px solid #cdb78a; background-color: #fffaf0; font-size: 40px; }
.wk-title-row h2 { margin: 0; font-size: 22px; }
.wk-sub { color: var(--wk-sub); font-size: 13px; }
.wk-sub code, .wk code { font-size: 11px; background: rgba(0, 0, 0, 0.06); padding: 0 4px; border-radius: 3px; }
.wk-chips { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.wk-chip { padding: 1px 7px; border-radius: 10px; background: #1d2a57; color: #fff; font-size: 12px; font-weight: 700; }
.wk-desc { margin: 10px 0; color: var(--wk-ink); }
.wk-sec { margin-top: 12px; }
.wk-sec-title { font-weight: 700; color: #1d2a57; border-bottom: 2px solid #c9a24a; padding-bottom: 2px; margin-bottom: 6px; }
.wk-kv { display: grid; grid-template-columns: max-content 1fr; gap: 3px 16px; font-size: 13px; }
.wk-kv span { color: var(--wk-sub); }
.wk-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.wk-table th { text-align: left; color: var(--wk-sub); font-weight: 700; border-bottom: 1px solid var(--wk-line); padding: 3px 6px; }
.wk-table td { border-bottom: 1px solid rgba(0, 0, 0, 0.06); padding: 4px 6px; vertical-align: middle; }
.wk-link { color: var(--wk-link); font-weight: 700; text-decoration: none; }
.wk-link:hover { text-decoration: underline; }
.wk-rate { color: #9c3d0a; }
.wk-none, .wk-empty { color: var(--wk-sub); font-style: italic; padding: 6px 0; }
.wk-empty { padding: 20px; text-align: center; }
.wk-el {
  display: inline-block;
  padding: 0 6px;
  border-radius: 8px;
  border: 1px solid var(--el);
  background: color-mix(in srgb, var(--el) 22%, white);
  color: #2b2012;
  font-size: 11px;
  font-weight: 700;
}
.wk-vs { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 3px 0; font-size: 13px; }
.wk-vs > span:first-child { color: var(--wk-sub); min-width: 80px; }
.wk-mapimg { position: relative; margin: 8px 0; border-radius: 8px; overflow: hidden; border: 1px solid var(--wk-line); background: #0b1226; }
.wk-mapimg img { display: block; width: 100%; image-rendering: pixelated; }
.wk-marker {
  position: absolute;
  transform: translate(-50%, -50%);
  width: 26px;
  height: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.92);
  border: 2px solid #2e5fb8;
  font-size: 14px;
  text-decoration: none;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.5);
}
.wk-town { position: absolute; border: 2px dashed #f5c451; background: rgba(245, 196, 81, 0.15); pointer-events: none; }
.wk-town em { position: absolute; top: -20px; left: 0; font-style: normal; font-weight: 700; font-size: 12px; color: #f5d98a; text-shadow: 0 1px 2px #000; white-space: nowrap; }

/* ในหน้าต่างเกม: ความสูงคงที่ ลิสต์/รายละเอียดเลื่อนเอง */
.wiki-win-body #wiki-root { height: min(560px, calc(100vh - 140px)); }

@media (max-width: 700px) {
  .wk-body { grid-template-columns: 1fr; }
  .wk-list { max-height: 180px; }
}
