/* ==========================================================================
   Primoria – Wiki (only loaded on /wiki.html and /en/wiki.html)
   ========================================================================== */

[hidden] {
  display: none !important;
}
.r-uncommon {
  color: #a8e66f;
}
.wiki .section {
  padding: clamp(48px, 7vw, 90px) 0;
}
.wiki .whero {
  padding-bottom: 10px;
}
.wspoiler {
  display: inline-block;
  margin: 6px 0 0;
  padding: 6px 14px;
  border-radius: 999px;
  border: 1px solid rgba(255, 210, 122, 0.35);
  background: rgba(255, 210, 122, 0.06);
  color: var(--gold-2);
  font-size: 0.85rem;
}
.wstats {
  list-style: none;
  margin: 0 auto 26px;
  padding: 0;
  max-width: 760px;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}
.wstats li {
  text-align: center;
  padding: 18px 10px;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: rgba(22, 24, 80, 0.55);
}
.wstats strong {
  display: block;
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(1.8rem, 4vw, 2.6rem);
  line-height: 1.1;
  color: var(--gold);
}
.wstats span {
  font-size: 0.85rem;
  color: var(--ink-3);
}
.wjump {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
}
.wjump .btn {
  min-height: 42px;
  padding: 0 18px;
  font-size: 0.92rem;
}

/* ---------- Chips ---------- */

.wchip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px 3px 3px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.04);
  color: var(--ink);
  font: 500 0.86rem/1.2 var(--font-body);
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition: border-color 0.2s ease, background 0.2s ease;
}
.wchip:hover,
.wchip:focus-visible,
.wchip.is-active {
  border-color: var(--line-strong);
  background: rgba(255, 210, 122, 0.1);
}
.wchip img {
  width: 24px;
  height: 24px;
  flex: none;
  border-radius: 7px;
}
.wop,
.wlist i {
  font: 600 1.05rem/1 var(--font-body);
  font-style: normal;
  color: var(--gold);
}
.wnote {
  margin: 8px 0 0;
  font-size: 0.86rem;
  font-style: italic;
  color: var(--ink-3);
}

/* ---------- Combination finder ---------- */

.wfinder-wrap {
  display: grid;
  grid-template-columns: 1.35fr 1fr;
  gap: clamp(18px, 3vw, 32px);
  align-items: start;
}
.wfinder,
.wrules {
  padding: clamp(22px, 3vw, 34px);
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--glass);
}
.wfinder {
  border-color: var(--line-strong);
}
.wfinder h2,
.wrules h2 {
  font-size: clamp(1.7rem, 3vw, 2.3rem);
}
.wfinder .lead {
  font-size: 1rem;
}
.wfinder-row {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 12px;
  align-items: end;
}
.wfinder-row .field {
  margin: 0;
}
.wfinder-row .wop {
  font-size: 1.5rem;
  padding-bottom: 12px;
}
.wfinder-out {
  display: flex;
  align-items: center;
  gap: 16px;
  min-height: 104px;
  margin-top: 18px;
  padding: 16px;
  border-radius: 16px;
  border: 1px dashed var(--line);
  background: rgba(6, 8, 34, 0.45);
}
.wfinder-out .wnote {
  margin: 0;
}
.wfinder-out.is-hit {
  border-style: solid;
  border-color: var(--line-strong);
  box-shadow: 0 0 40px rgba(255, 200, 90, 0.12);
}
.wfinder-out img {
  width: 72px;
  height: 72px;
  flex: none;
}
.wfinder-out strong {
  display: block;
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 1.6rem;
  line-height: 1.15;
}
.wfinder-out a {
  color: var(--gold);
  font-size: 0.9rem;
}
.wfinder-partners p {
  margin: 16px 0 8px;
  font-size: 0.88rem;
  color: var(--ink-3);
}
.wfinder-partners ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.wrules ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 14px;
}
.wrules li {
  position: relative;
  display: grid;
  gap: 2px;
  padding-left: 20px;
}
.wrules li::before {
  content: '✦';
  position: absolute;
  left: 0;
  top: 2px;
  font-size: 0.8rem;
  color: var(--gold);
}
.wrules span {
  font-size: 0.95rem;
  line-height: 1.5;
  color: var(--ink-2);
}

/* ---------- Toolbar ---------- */

.wtools {
  position: sticky;
  top: 76px;
  z-index: 50;
  padding: 12px 0;
  border-block: 1px solid var(--line);
  background: rgba(8, 7, 30, 0.84);
  backdrop-filter: blur(14px) saturate(140%);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
}
.no-js .wtools {
  display: none;
}
.wtools-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 14px;
}
.wtools input {
  flex: 1 1 220px;
  max-width: 320px;
  padding: 10px 16px;
  border-radius: 999px;
  border: 1px solid rgba(160, 175, 255, 0.28);
  background: rgba(6, 8, 34, 0.7);
  color: var(--ink);
  font: 400 1rem/1.3 var(--font-body);
}
.wtools input:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(255, 210, 122, 0.18);
}
.wfilters {
  display: flex;
  gap: 6px;
  flex: 1 1 300px;
  min-width: 0;
  overflow-x: auto;
  scrollbar-width: none;
}
.wfilters::-webkit-scrollbar {
  display: none;
}
.wfilter {
  flex: none;
  padding: 8px 13px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.04);
  color: var(--ink-2);
  font: 500 0.85rem/1 var(--font-body);
  cursor: pointer;
}
.wfilter:hover {
  color: var(--ink);
  border-color: var(--line-strong);
}
.wfilter[aria-pressed='true'] {
  border-color: var(--gold);
  background: var(--gold);
  color: #1d1230;
}
.wcount {
  margin: 0;
  font-size: 0.82rem;
  color: var(--ink-3);
  white-space: nowrap;
}

/* ---------- Lexicon ---------- */

.wcat {
  margin-bottom: clamp(30px, 5vw, 52px);
}
.wcat-title {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 18px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
  font-size: clamp(1.6rem, 3vw, 2.1rem);
}
.wcat-title small,
.wel h4 small {
  font: 600 0.8rem/1 var(--font-body);
  letter-spacing: 0;
  color: var(--ink-3);
}
.wgrid {
  columns: 3 300px;
  column-gap: 14px;
}
.wel {
  display: inline-block;
  width: 100%;
  margin: 0 0 14px;
  padding: 16px;
  break-inside: avoid;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: rgba(22, 24, 80, 0.55);
  scroll-margin-top: 180px;
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
}
.wel.is-epic {
  border-color: rgba(196, 139, 255, 0.35);
}
.wel.is-legendary {
  border-color: rgba(255, 211, 107, 0.5);
  box-shadow: 0 0 30px rgba(255, 200, 90, 0.1);
}
.wel:target {
  border-color: var(--gold);
  box-shadow: 0 0 0 1px var(--gold), 0 0 44px rgba(255, 200, 90, 0.22);
}
.wel header {
  display: grid;
  grid-template-columns: 72px 1fr;
  gap: 14px;
  align-items: center;
  margin-bottom: 10px;
}
.wel header img {
  width: 72px;
  height: 72px;
}
.wel h3 {
  margin: 0 0 6px;
  font-size: 1.3rem;
}
.wmeta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 10px;
  margin: 0;
  font-size: 0.8rem;
  color: var(--ink-3);
}
.wmeta .rarity {
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid currentColor;
  background: rgba(255, 255, 255, 0.04);
  font-size: 0.68rem;
  font-weight: 600;
}
.wdesc {
  margin: 0 0 4px;
  font-size: 0.92rem;
  line-height: 1.5;
  color: var(--ink-2);
}
.wel h4 {
  margin: 14px 0 8px;
  font: 600 0.72rem/1 var(--font-body);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--gold);
}
.wlist {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 6px;
}
.wlist li {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}
.wnothing {
  padding: 30px 0;
  text-align: center;
  font-size: 1rem;
}

/* ---------- Recipe table ---------- */

.wtable-wrap {
  overflow-x: auto;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: rgba(22, 24, 80, 0.45);
}
.wtable {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}
.wtable th {
  padding: 14px 12px;
  text-align: left;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--gold);
  border-bottom: 1px solid var(--line-strong);
}
.wtable td {
  padding: 7px 12px;
  border-bottom: 1px solid rgba(160, 175, 255, 0.08);
  vertical-align: middle;
}
.wtable tbody tr:hover {
  background: rgba(255, 255, 255, 0.03);
}
.wtable td:nth-child(-n + 3) {
  width: 33%;
}
.wtable .wchip {
  vertical-align: middle;
}
.wtable .wop {
  display: inline-block;
  vertical-align: middle;
  width: 1.1em;
  margin-right: 8px;
  text-align: center;
}
.wtable .wtier {
  width: 1%;
  text-align: right;
  white-space: nowrap;
  color: var(--ink-3);
}

/* ---------- Responsive ---------- */

@media (max-width: 860px) {
  .wfinder-wrap {
    grid-template-columns: 1fr;
  }
}
@media (max-width: 620px) {
  .wstats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .wfinder-row {
    grid-template-columns: 1fr;
    gap: 8px;
  }
  .wfinder-row .wop {
    padding: 0;
  }
  .wtools {
    padding: 10px 0;
  }
  .wtools input {
    max-width: none;
    flex-basis: 100%;
  }
  .wcount {
    display: none;
  }
  .wel {
    scroll-margin-top: 190px;
  }
  .wtable {
    font-size: 0.8rem;
  }
  .wtable td {
    padding: 6px 4px;
  }
  .wtable .wop {
    margin-right: 2px;
  }
  .wtable .wchip {
    white-space: normal;
    padding-right: 8px;
    font-size: 0.78rem;
  }
  .wtable .wchip img {
    width: 20px;
    height: 20px;
  }
  .wtable td:nth-child(-n + 2) .wchip img {
    display: none;
  }
  .wtable td:nth-child(-n + 2) .wchip {
    padding-left: 9px;
  }
  .wtable .wtier {
    display: none;
  }
}
@media (prefers-reduced-motion: reduce) {
  .wel,
  .wchip {
    transition: none;
  }
}
