/*
 * 海界 Wiki(2026-12-04)。疊在官網 /style.css 後面:色票(:root)、字型(俐方體11號)、導覽列、按鈕、頁尾都是官網那一套,這裡只寫 Wiki 自己的版面。
 * 像素框跟官網一樣用 /assets/ui/*.png 的 9 宮格(1 倍畫、放大 2 倍);圖示用官網 16×16 那套,整數倍放大 + pixelated。
 * 用戶 10-15 不要遊戲 GUI 風、要傳統網站:內文 Noto Sans TC、白底紙面,像素只用在標題、框、圖示這些點綴。
 */

.wk {
  background: var(--sand);
}

.wk-shell {
  display: grid;
  grid-template-columns: 252px minmax(0, 1fr);
  gap: 24px;
  width: min(1260px, 100%);
  margin-inline: auto;
  padding: 24px 20px 56px;
}

/* ── 側欄:搜尋 + 目錄 ── */
.wk-side {
  position: sticky;
  top: calc(var(--nav-h) + 16px);
  align-self: start;
  max-height: calc(100vh - var(--nav-h) - 32px);
  overflow-y: auto;
  scrollbar-width: thin;
}

.wk-search {
  position: relative;
  margin: 0 0 14px;
}

.wk-search input {
  display: block;
  width: 100%;
  margin: 0;
  padding: 8px 10px 8px 34px;
  border: 0;
  border-radius: 0;
  font: inherit;
  font-size: 0.98rem;
  color: var(--ink);
  background: var(--paper) url('/assets/icons/map.png') 8px 50% / 18px 18px no-repeat;
  image-rendering: auto;
  box-shadow:
    inset 2px 2px 0 #e2c394,
    0 0 0 2px var(--outline);
}

.wk-search input::placeholder {
  color: #a98a6c;
}

.wk-search input:focus-visible {
  outline: 3px solid var(--sea-2);
  outline-offset: 3px;
}

.wk-results {
  position: absolute;
  z-index: 30;
  left: 0;
  right: 0;
  top: calc(100% + 6px);
  margin: 0;
  padding: 4px 0;
  list-style: none;
  background: var(--paper);
  box-shadow:
    inset 0 -3px 0 #e2c394,
    0 0 0 2px var(--outline),
    0 8px 18px rgba(42, 22, 17, 0.25);
  max-height: 60vh;
  overflow-y: auto;
}

.wk-results a {
  display: block;
  padding: 5px 12px;
  color: var(--ink);
  text-decoration: none;
  line-height: 1.45;
}

.wk-results a small {
  display: block;
  font-size: 0.78rem;
  color: var(--ink-soft);
}

.wk-results a:hover,
.wk-results a.is-on {
  background: var(--gold);
}

.wk-results .none {
  padding: 6px 12px;
  color: var(--ink-soft);
  font-size: 0.9rem;
}

.wk-toc {
  border: 12px solid transparent;
  border-image: url('/assets/ui/cream.png') 6 fill / 12px / 0 stretch;
  image-rendering: pixelated;
  padding: 2px 2px 6px;
}

.wk-toc > summary {
  list-style: none;
  cursor: pointer;
  font-family: var(--pixel);
  font-size: 1.15rem;
  color: #3a2014;
  padding: 0 6px 4px;
}

.wk-toc > summary::-webkit-details-marker {
  display: none;
}

.wk-toc > summary::after {
  content: '▾';
  float: right;
  color: #8a5a20;
}

.wk-toc:not([open]) > summary::after {
  content: '▸';
}

.wk-toc nav {
  image-rendering: auto;
}

.wk-toc .grp {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 8px 0 2px;
  padding: 2px 6px;
  font-family: var(--pixel);
  font-size: 1.02rem;
  color: #8a5a20;
  text-decoration: none;
  letter-spacing: 0.04em;
}

.wk-toc .grp img {
  width: 20px;
  height: 20px;
  image-rendering: pixelated;
}

.wk-toc .grp.is-on {
  color: #3a2014;
}

.wk-toc ul {
  list-style: none;
  margin: 0 0 2px;
  padding: 0 0 0 34px;
}

.wk-toc li a {
  display: block;
  padding: 1px 8px;
  font-size: 0.92rem;
  line-height: 1.6;
  color: var(--ink);
  text-decoration: none;
}

.wk-toc li a:hover,
.wk-toc .grp:hover {
  color: var(--sea-2);
}

.wk-toc li a.is-on {
  background: var(--gold);
  box-shadow: 0 0 0 2px var(--outline);
  color: var(--ink);
}

/* ── 內文 ── */
.wk-main {
  min-width: 0;
}

.wk-crumbs {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 8px;
  margin: 0 0 10px;
  font-size: 0.88rem;
  color: var(--ink-soft);
}

.wk-crumbs a {
  color: var(--sea-2);
  text-decoration: none;
}

.wk-crumbs a:hover {
  text-decoration: underline;
}

.wk-crumbs .sep {
  color: #b49c7a;
}

.wk-art {
  border: 12px solid transparent;
  border-image: url('/assets/ui/cream.png') 6 fill / 12px / 0 stretch;
  image-rendering: pixelated;
  padding: 6px 18px 22px;
  overflow-wrap: anywhere;
}

.wk-art > * {
  image-rendering: auto;
}

.wk-art::after {
  content: '';
  display: block;
  clear: both;
}

.wk-h1 {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 6px 0 4px;
  font-family: var(--pixel);
  font-weight: 400;
  font-size: clamp(1.6rem, 3vw, 2.1rem);
  line-height: 1.3;
  color: #3a2014;
  letter-spacing: 0.04em;
}

.wk-h1 img {
  width: 32px;
  height: 32px;
  image-rendering: pixelated;
  flex-shrink: 0;
}

.wk-sub {
  margin: 0 0 16px;
  color: var(--ink-soft);
}

.wk-art h2 {
  display: flex;
  align-items: center;
  gap: 12px;
  clear: none;
  margin: 28px 0 10px;
  font-family: var(--pixel);
  font-weight: 400;
  font-size: 1.4rem;
  color: #8a5a20;
  letter-spacing: 0.05em;
}

.wk-art h2::after {
  content: '';
  flex: 1;
  min-width: 24px;
  height: 2px;
  background: repeating-linear-gradient(to right, #c9a27a 0 8px, transparent 8px 14px);
}

.wk-art h3 {
  margin: 20px 0 6px;
  font-family: var(--pixel);
  font-weight: 400;
  font-size: 1.18rem;
  color: #3a2014;
}

.wk-art h4 {
  margin: 14px 0 4px;
  font-size: 1rem;
  color: #3a2014;
}

.wk-art p {
  margin: 0 0 10px;
}

.wk-art ul,
.wk-art ol {
  margin: 0 0 12px;
  padding-left: 1.4em;
}

.wk-art li {
  margin-bottom: 3px;
}

.wk-art a {
  color: var(--sea-2);
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
}

.wk-art a:hover {
  color: #0f2c49;
}

.wk-art code,
.cmd {
  font-family: var(--pixel);
  font-size: 0.95em;
  white-space: nowrap;
  background: var(--paper);
  box-shadow: 0 0 0 2px #8a5a44;
  padding: 0 5px;
  margin: 0 2px;
  color: #3a2014;
}

.wk-lead {
  font-size: 1.03rem;
}

.wk-note {
  margin: 12px 0;
  padding: 8px 12px;
  font-size: 0.93rem;
  line-height: 1.65;
  background: var(--sand);
  box-shadow: inset 0 0 0 2px #d9b98a;
}

.wk-note b {
  font-family: var(--pixel);
  font-weight: 400;
  color: #8a5a20;
  margin-right: 6px;
}

.muted {
  color: var(--ink-soft);
}

.small {
  font-size: 0.88rem;
}

.nowrap {
  white-space: nowrap;
}

/* 組合鍵:左 / 右 一格一個小鍵帽 */
.keys {
  display: inline-flex;
  gap: 3px;
  vertical-align: middle;
}

.keys i {
  display: inline-grid;
  place-items: center;
  width: 1.55em;
  height: 1.55em;
  font-style: normal;
  font-family: var(--pixel);
  font-size: 0.85rem;
  line-height: 1;
  color: var(--cream);
  background: var(--wood-2);
  box-shadow:
    inset 2px 2px 0 #8a5536,
    inset -2px -2px 0 #4e2c1f,
    0 0 0 2px var(--outline);
}

.keys i.r {
  background: var(--sea-2);
  box-shadow:
    inset 2px 2px 0 #3b6a96,
    inset -2px -2px 0 #16304c,
    0 0 0 2px var(--outline);
}

/* 稀有度 / 小標籤 */
.rar,
.chip {
  display: inline-block;
  padding: 0 7px;
  font-family: var(--pixel);
  font-size: 0.86rem;
  line-height: 1.55;
  white-space: nowrap;
  color: #2a1611;
  background: var(--paper);
  box-shadow: 0 0 0 2px var(--outline);
  vertical-align: 1px;
}

.chip {
  background: var(--sand-2);
}

.chip.gold {
  background: var(--gold);
}

.chip.sea {
  background: #bfe0ea;
}

.chip.green {
  background: #a9e0a0;
}

.chip.red {
  background: #f2b7a3;
}

/* ── 表格 ── */
.wk-scroll {
  overflow-x: auto;
  margin: 0 0 14px;
  padding: 2px;
}

.wk-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  background: var(--paper);
  box-shadow:
    inset 0 -3px 0 #e2c394,
    0 0 0 2px #8a5a44;
  font-size: 0.93rem;
  line-height: 1.55;
}

.wk-table th {
  padding: 6px 10px;
  text-align: left;
  font-family: var(--pixel);
  font-weight: 400;
  font-size: 0.95rem;
  color: var(--cream);
  background: var(--wood-2);
  white-space: nowrap;
}

.wk-table td {
  padding: 6px 10px;
  vertical-align: top;
  border-top: 2px dashed #e2c394;
}

.wk-table tr:first-child td {
  border-top: 0;
}

.wk-table td.num,
.wk-table th.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.wk-table td.ico {
  width: 40px;
  padding-right: 0;
}

.wk-table td.ico img {
  width: 32px;
  height: 32px;
  image-rendering: pixelated;
  display: block;
}

.wk-table .name {
  font-weight: 700;
  text-decoration: none;
}

.wk-table .name:hover {
  text-decoration: underline;
}

.wk-table ul {
  margin: 0;
  padding-left: 1.1em;
}

/* 列表上的篩選鈕(照職業 / 部位) */
.wk-filter {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 4px 2px 14px;
}

.wk-filter button {
  border: 0;
  font: inherit;
  font-family: var(--pixel);
  font-size: 0.95rem;
  padding: 2px 12px 4px;
  cursor: pointer;
  color: #3a2014;
  background: var(--paper);
  box-shadow:
    inset 0 -3px 0 #e2c394,
    0 0 0 2px #8a5a44;
}

.wk-filter button[aria-pressed='true'] {
  background: var(--gold);
  box-shadow:
    inset 0 -3px 0 var(--gold-2),
    0 0 0 2px var(--outline);
}

.wk-filter button:focus-visible {
  outline: 3px solid var(--sea-2);
  outline-offset: 3px;
}

/* ── 資訊框(物品 / 寵物 / 副本頁右邊那塊) ── */
.wk-box {
  float: right;
  width: 300px;
  margin: 8px 0 16px 22px;
  background: var(--paper);
  box-shadow:
    inset 0 -3px 0 #e2c394,
    0 0 0 2px #8a5a44;
  font-size: 0.92rem;
}

.wk-box-title {
  margin: 0;
  padding: 6px 12px 7px;
  text-align: center;
  font-family: var(--pixel);
  font-weight: 400;
  font-size: 1.2rem;
  line-height: 1.35;
  color: var(--cream);
  text-shadow: 1px 1px 0 var(--outline);
  background: #3a2014 url('/assets/ui/planks.png') repeat;
  background-size: 96px 96px;
  background-blend-mode: multiply;
}

.wk-box-art {
  display: grid;
  place-items: center;
  padding: 14px 10px;
  background: #23170f;
}

.wk-box-art.light {
  background: var(--sand-2);
}

.wk-box-art img {
  max-width: 100%;
  height: auto;
  max-height: 260px;
  image-rendering: pixelated;
}

.wk-box-art img.icon {
  width: 96px;
  height: 96px;
}

.wk-box dl {
  margin: 0;
  padding: 6px 12px 10px;
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  gap: 4px 12px;
}

.wk-box dt {
  color: var(--ink-soft);
  white-space: nowrap;
}

.wk-box dd {
  margin: 0;
  font-weight: 500;
  min-width: 0;
}

.wk-box .rule {
  grid-column: 1 / -1;
  border-top: 2px dashed #e2c394;
  margin: 2px 0;
}

/* ── 圖 ── */
.wk-fig {
  margin: 6px 0 16px;
}

.wk-fig .frame {
  display: block;
  border: 12px solid transparent;
  border-image: url('/assets/ui/wood.png') 6 fill / 12px / 0 stretch;
  image-rendering: pixelated;
  background: none;
}

.wk-fig .frame img {
  display: block;
  width: 100%;
  height: auto;
  background: #1f2329;
  image-rendering: pixelated;
}

.wk-fig figcaption {
  padding: 6px 4px 0;
  font-size: 0.88rem;
  color: var(--ink-soft);
}

.wk-fig.half {
  max-width: 560px;
}

/* ── 卡片(首頁分類、分類首頁的子頁) ── */
.wk-cards {
  list-style: none;
  padding: 0;
  margin: 8px 0 18px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(232px, 1fr));
  gap: 12px;
}

.wk-art ul.wk-cards {
  padding-left: 0;
}

.wk-card {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  height: 100%;
  padding: 10px 12px 12px;
  color: var(--ink);
  text-decoration: none;
  background: var(--paper);
  box-shadow:
    inset 0 -3px 0 #e2c394,
    0 0 0 2px #8a5a44;
  transition: transform 0.12s;
}

.wk-art a.wk-card {
  color: var(--ink);
  text-decoration: none;
}

.wk-card:hover {
  transform: translateY(-2px);
  box-shadow:
    inset 0 -3px 0 #e2c394,
    0 0 0 2px var(--outline);
}

.wk-card img {
  width: 32px;
  height: 32px;
  flex-shrink: 0;
  margin-top: 2px;
  image-rendering: pixelated;
}

.wk-card b {
  display: block;
  font-family: var(--pixel);
  font-weight: 400;
  font-size: 1.12rem;
  color: #3a2014;
  line-height: 1.4;
}

.wk-card span {
  display: block;
  font-size: 0.88rem;
  line-height: 1.55;
  color: var(--ink-soft);
}

/* 寵物 / 副本那種有大圖的卡片 */
.wk-gallery {
  list-style: none;
  padding: 0;
  margin: 8px 0 18px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 12px;
}

.wk-art ul.wk-gallery {
  padding-left: 0;
}

.wk-gallery a {
  display: flex;
  flex-direction: column;
  align-items: center;
  height: 100%;
  padding: 10px 8px 10px;
  text-align: center;
  text-decoration: none;
  color: var(--ink);
  background: var(--paper);
  box-shadow:
    inset 0 -3px 0 #e2c394,
    0 0 0 2px #8a5a44;
}

.wk-gallery a:hover {
  box-shadow:
    inset 0 -3px 0 #e2c394,
    0 0 0 2px var(--outline);
}

.wk-gallery .pic {
  display: grid;
  place-items: center;
  width: 100%;
  height: 130px;
  margin-bottom: 6px;
  background: #23170f;
}

.wk-gallery .pic img {
  max-width: 92%;
  max-height: 120px;
  image-rendering: pixelated;
}

.wk-gallery .pic.none {
  background: var(--sand-2);
}

.wk-gallery b {
  font-family: var(--pixel);
  font-weight: 400;
  font-size: 1.08rem;
  color: #3a2014;
}

.wk-gallery span {
  font-size: 0.84rem;
  color: var(--ink-soft);
  line-height: 1.5;
}

/* 來源 / 用途清單 */
.wk-src {
  list-style: none;
  margin: 0 0 12px;
  padding: 0;
}

.wk-art ul.wk-src {
  padding-left: 0;
}

.wk-src li {
  display: flex;
  gap: 10px;
  align-items: baseline;
  padding: 5px 0;
  border-top: 2px dashed #e2c394;
}

.wk-src li:first-child {
  border-top: 0;
}

.wk-src .chip {
  flex-shrink: 0;
}

/* 物品說明框文字(遊戲裡說明框那幾行) */
.wk-lore {
  margin: 0 0 14px;
  padding: 10px 14px;
  font-size: 0.93rem;
  line-height: 1.7;
  color: #e8dcc6;
  background: #2b1d17;
  box-shadow:
    inset 0 0 0 2px #5a3a2c,
    0 0 0 2px var(--outline);
}

.wk-lore p {
  margin: 0;
}

/* 技能卡 */
.wk-skill {
  margin: 0 0 12px;
  padding: 10px 14px 8px;
  background: var(--paper);
  box-shadow:
    inset 0 -3px 0 #e2c394,
    0 0 0 2px #8a5a44;
}

.wk-skill h4 {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 10px;
  margin: 0 0 6px;
  font-family: var(--pixel);
  font-weight: 400;
  font-size: 1.15rem;
}

.wk-skill h4 .meta {
  margin-left: auto;
  font-family: var(--body);
  font-size: 0.85rem;
  color: var(--ink-soft);
}

.wk-skill ul {
  margin: 0 0 4px;
}

.wk-skill .var {
  margin: 6px 0 2px;
  padding: 6px 10px;
  background: var(--sand);
  box-shadow: inset 0 0 0 2px #d9b98a;
  font-size: 0.92rem;
}

.wk-skill .var b {
  font-family: var(--pixel);
  font-weight: 400;
  color: #8a5a20;
  margin-right: 6px;
}

/* 首頁 */
.wk-hero {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px 22px;
  margin: 4px 0 12px;
}

.wk-hero img {
  width: min(300px, 70%);
  height: auto;
  image-rendering: pixelated;
}

.wk-hero .wk-search {
  flex: 1 1 260px;
  margin: 0;
}

.wk-hero .wk-search input {
  font-size: 1.05rem;
  padding-block: 10px;
}

.wk-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
  margin: 0 0 6px;
  padding: 0;
  list-style: none;
  font-size: 0.92rem;
  color: var(--ink-soft);
}

.wk-art ul.wk-stats {
  padding-left: 0;
}

.wk-stats b {
  font-family: var(--pixel);
  font-weight: 400;
  font-size: 1.1rem;
  color: #3a2014;
  margin-right: 4px;
}

/* 常見問題 */
.wk-faq details {
  margin: 0 0 10px;
  background: var(--paper);
  box-shadow:
    inset 0 -3px 0 #e2c394,
    0 0 0 2px #8a5a44;
}

.wk-faq summary {
  cursor: pointer;
  padding: 8px 12px;
  font-family: var(--pixel);
  font-size: 1.08rem;
  color: #3a2014;
}

.wk-faq details > div {
  padding: 0 14px 10px;
}

.wk-updated {
  margin: 10px 4px 0;
  font-size: 0.8rem;
  color: #8a7258;
}

/* ── 窄螢幕 ── */
@media (max-width: 900px) {
  .wk-shell {
    grid-template-columns: 1fr;
    gap: 14px;
    padding: 14px 16px 40px;
  }

  .wk-side {
    position: static;
    max-height: none;
    overflow: visible;
  }

  .wk-box {
    float: none;
    width: auto;
    margin: 8px 0 16px;
  }
}

@media (max-width: 560px) {
  .wk-art {
    padding: 4px 6px 16px;
  }

  .wk-art h2 {
    font-size: 1.25rem;
  }

  .wk-table {
    font-size: 0.88rem;
  }

  .wk-table th,
  .wk-table td {
    padding: 5px 7px;
  }

  .wk-cards {
    grid-template-columns: 1fr;
  }

  .wk-gallery {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .wk-skill h4 .meta {
    margin-left: 0;
    width: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  .wk-card {
    transition: none;
  }
}

/* 首頁中間已經有一個大搜尋框,側欄那個藏起來 */
.wk-home .wk-side .wk-search {
  display: none;
}

/* 精英圖卡(沒有連結的那種,樣子跟 .wk-gallery a 一樣) */
.wk-gallery .wk-gcard {
  display: flex;
  flex-direction: column;
  align-items: center;
  height: 100%;
  padding: 10px 8px;
  text-align: center;
  background: var(--paper);
  box-shadow:
    inset 0 -3px 0 #e2c394,
    0 0 0 2px #8a5a44;
}

.wk-gallery .pic img {
  image-rendering: auto;
}

/* 模型渲染圖(寵物、首領)是平滑縮的,不用像素放大 */
.wk-box-art img:not(.icon) {
  image-rendering: auto;
}
