/* ==========================================================================
   技能百科 · wiki layer
   Loaded after site.css (a copy of ablazeaqzl.cn/css/styles.css), so the page
   keeps the exact same palette, pixel font, navbar and page background.
   Layout: skill list on the left, archive on the right.
   ========================================================================== */

@font-face {
  font-family: 'Fusion Pixel';
  src: url('../fonts/fusion-pixel-subset.woff2') format('woff2');
  font-weight: normal;
  font-style: normal;
  font-display: swap;
}

:root {
  --nav-h: 84px;
  --wiki-ink: #1a3a52;
  --wiki-panel: rgba(240, 249, 255, 0.94);
  --wiki-gold: #ffd86a;
  --wire: #9baebe;
  --wire-dim: #5e7182;
}

body {
  padding-top: var(--nav-h);
  overflow: hidden;
}

.nav-menu a[aria-current="page"] .nav-icon {
  filter: drop-shadow(0 0 6px rgba(59, 157, 255, 0.85));
}

/* ------------------------------------------------------------------ shell */

.wiki-app {
  display: grid;
  grid-template-columns: 372px minmax(0, 1fr);
  gap: 1.1rem;
  padding: 1.1rem;
  max-width: 1760px;
  margin: 0 auto;
  height: calc(100vh - var(--nav-h));
  box-sizing: border-box;
}

.wiki-side,
.wiki-main {
  display: flex;
  flex-direction: column;
  min-height: 0;
  background-color: var(--wiki-panel);
  border: 2px solid var(--slime-blue, #3b9dff);
  border-radius: 0;
  box-shadow: none;
  overflow: hidden;
}

.wiki-main {
  overflow-y: auto;
  overscroll-behavior: contain;
  scroll-margin-top: calc(var(--nav-h) + 10px);
}

/* ------------------------------------------------------------- side panel */

.side-head {
  flex-shrink: 0;
  padding: 0.85rem 0.9rem 0.65rem;
  background: rgba(255, 255, 255, 0.62);
  border-bottom: 2px solid var(--border-color, #80c0ff);
}

.side-title-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.55rem;
}

.side-title {
  font-size: 1.15rem;
  color: var(--slime-blue, #3b9dff);
  text-shadow: 1px 1px 3px rgba(59, 157, 255, 0.28);
  line-height: 1.2;
}

.side-count {
  font-size: 0.76rem;
  color: var(--text-secondary, #2d5a7b);
  white-space: nowrap;
}

.wiki-search {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.28rem 0.5rem 0.28rem 0.7rem;
  background: #fff;
  border: 2px solid var(--border-color, #80c0ff);
  border-radius: 0;
  transition: border-color 0.2s ease;
}

.wiki-search:focus-within {
  border-color: var(--slime-blue, #3b9dff);
}

.wiki-search-icon {
  width: 17px;
  height: 17px;
  flex-shrink: 0;
  color: var(--slime-blue, #3b9dff);
}

.wiki-search input {
  flex: 1;
  min-width: 0;
  border: none;
  outline: none;
  background: transparent;
  font-family: inherit;
  font-size: 0.92rem;
  color: var(--wiki-ink);
  padding: 0.22rem 0;
}

.wiki-search input::placeholder {
  color: #7d9bb5;
}

.wiki-search kbd {
  font-family: inherit;
  font-size: 0.68rem;
  color: #557b98;
  border: 1px solid #a9cdec;
  border-bottom-width: 3px;
  border-radius: 0;
  padding: 0 5px;
  background: #eaf5ff;
}

.wiki-chips {
  margin-top: 0.55rem;
  display: flex;
  gap: 0.35rem;
  overflow-x: auto;
  padding-bottom: 0.15rem;
  scrollbar-width: thin;
  scrollbar-color: var(--border-color, #80c0ff) transparent;
}

.wiki-chips::-webkit-scrollbar {
  height: 5px;
}

.wiki-chips::-webkit-scrollbar-thumb {
  background: var(--border-color, #80c0ff);
  border-radius: 0;
}

.chip {
  flex-shrink: 0;
  border: 2px solid var(--border-color, #80c0ff);
  background: rgba(255, 255, 255, 0.9);
  color: var(--text-secondary, #2d5a7b);
  border-radius: 0;
  padding: 0.16rem 0.6rem;
  font-family: inherit;
  font-weight: bold;
  font-size: 0.76rem;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.chip:hover {
  border-color: var(--slime-blue, #3b9dff);
  color: var(--accent-hover, #2b8ae6);
  transform: translateY(-2px);
}

.chip.active {
  background: linear-gradient(135deg, var(--slime-blue, #3b9dff), var(--slime-light, #66b3ff));
  border-color: var(--slime-blue, #3b9dff);
  color: #fff;
}

.chip--typed {
  border-color: var(--badge-bd, #80c0ff);
  color: var(--badge-fg, #2d5a7b);
}

.chip--typed:hover {
  background: var(--badge-bg, rgba(59, 157, 255, 0.14));
  color: var(--badge-fg, #2d5a7b);
}

.chip--typed.active {
  background: var(--badge-bd, #3b9dff);
  border-color: var(--badge-bd, #3b9dff);
  color: #fff;
}

.chip .chip-n {
  opacity: 0.72;
  font-size: 0.7rem;
  margin-left: 0.22rem;
}

.chip:focus-visible,
.skill-row:focus-visible,
.tree-btn:focus-visible,
.mini-btn:focus-visible,
.welcome-skill:focus-visible {
  outline: 3px solid rgba(59, 157, 255, 0.5);
  outline-offset: 1px;
}

/* ---------------------------------------------------------------- rows */

.side-list {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: var(--border-color, #80c0ff) transparent;
}

.side-list::-webkit-scrollbar {
  width: 8px;
}

.side-list::-webkit-scrollbar-thumb {
  background: var(--border-color, #80c0ff);
  border-radius: 0;
}

.skill-row {
  display: block;
  padding: 0.5rem 0.9rem 0.5rem 0.85rem;
  border-left: 4px solid transparent;
  border-bottom: 1px dashed rgba(128, 192, 255, 0.45);
  text-decoration: none;
  color: inherit;
  cursor: pointer;
}

.skill-row:hover {
  background: rgba(59, 157, 255, 0.08);
}

.skill-row.is-active {
  background: linear-gradient(90deg, rgba(59, 157, 255, 0.2), rgba(59, 157, 255, 0.05));
  border-left-color: var(--slime-blue, #3b9dff);
}

.row-src {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.row-name {
  display: block;
  font-size: 0.95rem;
  font-weight: bold;
  color: var(--wiki-ink);
  line-height: 1.45;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.skill-row.is-active .row-src {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.row-name {
  color: var(--accent-hover, #2b8ae6);
}

.row-meta {
  display: flex;
  align-items: center;
  flex-wrap: nowrap;
  gap: 0.4rem;
  margin-top: 0.15rem;
  font-size: 0.72rem;
  color: #5b7a92;
}

.row-type {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  color: var(--badge-fg, #2d5a7b);
  background: var(--badge-bg, rgba(59, 157, 255, 0.14));
  border: 2px solid var(--badge-bd, #80c0ff);
  border-radius: 0;
  padding: 0 0.3rem;
  line-height: 1.5;
  white-space: nowrap;
}

.row-type.row-evo {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  flex-shrink: 0;
}

.row-evo svg {
  width: 11px;
  height: 11px;
}

/* --------------------------------------------------------------- badges */

.row-type .type-icon {
  width: 18px;
  height: 18px;
}

.chip .type-icon {
  width: 18px;
  height: 18px;
  margin-right: 3px;
  vertical-align: -3px;
}

.type-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.76rem;
  line-height: 1.6;
  padding: 0.05rem 0.5rem;
  border-radius: 0;
  border: 2px solid var(--badge-bd, #80c0ff);
  background: var(--badge-bg, rgba(59, 157, 255, 0.14));
  color: var(--badge-fg, #2d5a7b);
  white-space: nowrap;
}

.type-badge.is-strong {
  font-weight: bold;
}

/* colours follow the skill-type icons on tensura.wiki.gg/wiki/Abilities/Skills */

.t-ultimate {
  --badge-bg: rgba(192, 92, 240, 0.16);
  --badge-fg: #7a2ea6;
  --badge-bd: #c05cf0;
}

.t-unique {
  --badge-bg: rgba(31, 168, 168, 0.16);
  --badge-fg: #14706f;
  --badge-bd: #1fa8a8;
}

.t-intrinsic {
  --badge-bg: rgba(201, 123, 71, 0.18);
  --badge-fg: #8a4d24;
  --badge-bd: #c97b47;
}

.t-extra {
  --badge-bg: rgba(224, 160, 32, 0.18);
  --badge-fg: #8a5c10;
  --badge-bd: #e0a020;
}

.t-common {
  --badge-bg: rgba(76, 191, 76, 0.16);
  --badge-fg: #2f7a2f;
  --badge-bd: #4cbf4c;
}

.t-resistance {
  --badge-bg: rgba(143, 150, 158, 0.18);
  --badge-fg: #4a5560;
  --badge-bd: #8f969e;
}

.t-battlewill_art {
  --badge-bg: rgba(214, 168, 92, 0.22);
  --badge-fg: #7d5a1c;
  --badge-bd: #d3b17a;
}

.t-misc_magic {
  --badge-bg: rgba(150, 120, 235, 0.16);
  --badge-fg: #5b47a8;
  --badge-bd: #a99ae0;
}

.t-spiritual_magic {
  --badge-bg: rgba(120, 140, 235, 0.16);
  --badge-fg: #3f4fa0;
  --badge-bd: #98a6e6;
}

.t-aspectual_magic {
  --badge-bg: rgba(90, 170, 235, 0.18);
  --badge-fg: #2a6c9c;
  --badge-bd: #87c4ea;
}

.t-supplement {
  --badge-bg: rgba(206, 178, 106, 0.2);
  --badge-fg: #7a5a1f;
  --badge-bd: #d6bd85;
}

.src-chip {
  font-size: 0.74rem;
  color: #5b7a92;
  background: rgba(204, 231, 255, 0.7);
  border: 2px solid rgba(128, 192, 255, 0.75);
  border-radius: 0;
  padding: 0.04rem 0.42rem;
  white-space: nowrap;
}

mark.hl {
  background: rgba(255, 214, 102, 0.75);
  color: inherit;
  border-radius: 0;
  padding: 0 1px;
}

/* -------------------------------------------------------------- welcome */

.wiki-welcome {
  display: flex;
  flex: 1;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2.5rem 2rem;
  text-align: center;
}

.welcome-kicker {
  font-size: 0.85rem;
  letter-spacing: 0.42em;
  text-indent: 0.42em;
  color: var(--accent-hover, #2b8ae6);
  text-transform: uppercase;
}

.welcome-title {
  font-size: clamp(2rem, 4vw, 2.9rem);
  color: var(--slime-blue, #3b9dff);
  text-shadow: 2px 2px 4px rgba(59, 157, 255, 0.32);
  margin: 0.1rem 0 0.4rem;
}

.welcome-sub {
  font-size: 0.92rem;
  color: var(--text-secondary, #2d5a7b);
  margin-bottom: 1.3rem;
}

.welcome-search {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  width: min(560px, 100%);
  padding: 0.45rem 0.6rem 0.45rem 1rem;
  background: #fff;
  border: 2px solid var(--border-color, #80c0ff);
  border-radius: 0;
  transition: border-color 0.2s ease;
}

.welcome-search:focus-within {
  border-color: var(--slime-blue, #3b9dff);
}

.welcome-search .wiki-search-icon {
  width: 20px;
  height: 20px;
}

.welcome-search input {
  flex: 1;
  min-width: 0;
  border: none;
  outline: none;
  background: transparent;
  font-family: inherit;
  font-size: 1.02rem;
  color: var(--wiki-ink);
  padding: 0.3rem 0;
}

.welcome-suggest {
  margin-top: 1.4rem;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.4rem;
  max-width: 640px;
}

.welcome-suggest-label {
  width: 100%;
  font-size: 0.76rem;
  color: #6b8aa3;
  margin-bottom: 0.15rem;
  letter-spacing: 0.06em;
}

.welcome-skill {
  border: 2px solid var(--border-color, #80c0ff);
  background: rgba(255, 255, 255, 0.92);
  color: var(--text-secondary, #2d5a7b);
  border-radius: 0;
  padding: 0.2rem 0.7rem;
  font-family: inherit;
  font-weight: bold;
  font-size: 0.82rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.welcome-skill:hover {
  border-color: var(--slime-blue, #3b9dff);
  color: var(--accent-hover, #2b8ae6);
  transform: translateY(-1px);
}

.welcome-hint {
  margin-top: 1.5rem;
  font-size: 0.8rem;
  color: #6b8aa3;
}

/* --------------------------------------------------------------- detail */

.detail-head {
  position: relative;
  padding: 1.25rem 6.2rem 1.15rem 1.5rem;
  background-image: linear-gradient(135deg, rgba(18, 50, 76, 0.94), rgba(12, 34, 52, 0.97));
  border-bottom: 3px solid var(--slime-blue, #3b9dff);
  color: #fff;
  flex-shrink: 0;
}

.detail-type-tile {
  position: absolute;
  top: 1rem;
  right: 1.2rem;
  width: 58px;
  height: 58px;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  pointer-events: none;
  filter: drop-shadow(0 3px 6px rgba(0, 0, 0, 0.45));
}

.detail-head .card-top {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
  margin-bottom: 0.5rem;
}

.detail-head .src-chip {
  background: rgba(255, 255, 255, 0.16);
  border-color: rgba(180, 220, 255, 0.55);
  color: #d7ecff;
}

.detail-head .type-badge {
  background: rgba(8, 28, 44, 0.62);
  border-color: var(--badge-bd, #80c0ff);
  color: #eaf6ff;
}

.detail-head .type-badge.is-strong {
  background: rgba(8, 28, 44, 0.62);
  color: #fff;
}

.detail-title {
  font-size: 1.8rem;
  line-height: 1.25;
  text-shadow: 2px 2px 0 rgba(6, 20, 32, 0.55);
  word-break: break-word;
}

.detail-sub {
  margin-top: 0.2rem;
  font-size: 0.88rem;
  color: #b8d8f2;
  letter-spacing: 0.03em;
  word-break: break-word;
}

.detail-body {
  padding: 1.15rem 1.5rem 1.6rem;
}

.wiki-meta {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(132px, 190px));
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.wiki-meta div {
  background: rgba(255, 255, 255, 0.92);
  border: 2px solid var(--border-color, #80c0ff);
  border-radius: 0;
  padding: 0.4rem 0.6rem;
}

.wiki-meta span {
  display: block;
  font-size: 0.7rem;
  color: #6b8aa3;
  letter-spacing: 0.04em;
}

.wiki-meta strong {
  font-size: 0.9rem;
  color: var(--wiki-ink);
  font-weight: normal;
  word-break: break-all;
}

.block-title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 1rem;
  color: var(--accent-hover, #2b8ae6);
  margin: 0 0 0.7rem;
}

.block-title::before {
  content: '';
  width: 9px;
  height: 9px;
  background: var(--slime-blue, #3b9dff);
  box-shadow: 3px 3px 0 rgba(59, 157, 255, 0.35);
  flex-shrink: 0;
}

.desc-block,
.evo-block {
  background: rgba(255, 255, 255, 0.94);
  border: 2px solid rgba(128, 192, 255, 0.85);
  border-radius: 0;
  padding: 1rem 1.1rem;
  margin-bottom: 1rem;
}

.desc-note {
  font-size: 0.8rem;
  line-height: 1.6;
  color: #7a5a1f;
  background: rgba(255, 240, 200, 0.6);
  border: 1px dashed #d6bd85;
  border-radius: 0;
  padding: 0.35rem 0.55rem;
  margin-bottom: 0.6rem;
}

.desc-line {
  font-size: 0.93rem;
  line-height: 1.8;
  color: #21455f;
  word-break: break-word;
}

.desc-heading {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  margin: 0.9rem 0 0.35rem;
  padding-bottom: 0.22rem;
  border-bottom: 2px dashed rgba(128, 192, 255, 0.8);
  font-size: 0.98rem;
  color: var(--accent-hover, #2b8ae6);
  font-weight: bold;
}

.desc-heading:first-child {
  margin-top: 0;
}

.desc-heading::before {
  content: '';
  width: 7px;
  height: 7px;
  background: var(--slime-light, #66b3ff);
  flex-shrink: 0;
}

.ability {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  margin: 0.4rem 0;
}

.ability-tag {
  flex-shrink: 0;
  font-size: 0.73rem;
  line-height: 1.6;
  padding: 0.04rem 0.45rem;
  border-radius: 0;
  background: linear-gradient(135deg, #2b8ae6, #66b3ff);
  color: #fff;
  white-space: nowrap;
}

.ability-tag.is-passive {
  background: linear-gradient(135deg, #2fa8a0, #63cdc5);
}

.ability-text {
  font-size: 0.93rem;
  line-height: 1.7;
  color: #21455f;
  word-break: break-word;
}

.meta-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.35rem 0.9rem;
  margin: 0.5rem 0 0.2rem;
}

.meta-item {
  display: flex;
  gap: 0.35rem;
  font-size: 0.86rem;
  line-height: 1.6;
  border-left: 3px solid rgba(128, 192, 255, 0.9);
  padding-left: 0.5rem;
}

.meta-item .k {
  color: #6b8aa3;
  flex-shrink: 0;
}

.meta-item .v {
  color: #21455f;
  word-break: break-word;
}

/* ------------------------------------------------------------------ tree */

.evo-hint {
  font-size: 0.78rem;
  color: #6b8aa3;
  margin: -0.4rem 0 0.6rem;
}

.tree-shell {
  position: relative;
  height: 400px;
  border-radius: 0;
  overflow: hidden;
  background-color: #10283d;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.035) 1px, transparent 1px),
    radial-gradient(circle at 50% 40%, #1b4260 0%, #0e2334 70%);
  background-size: 24px 24px, 24px 24px, cover;
  border: 2px solid rgba(120, 180, 225, 0.6);
  cursor: grab;
  touch-action: none;
}

.tree-shell.dragging {
  cursor: grabbing;
}

.tree-shell svg {
  display: block;
  width: 100%;
  height: 100%;
  user-select: none;
}

.tree-node rect {
  fill: #17374f;
  stroke: rgba(155, 174, 190, 0.8);
  stroke-width: 1.5;
  transition: fill 0.15s ease, stroke 0.15s ease;
}

.tree-node text {
  fill: #dcecf8;
  font-family: 'Fusion Pixel', 'Microsoft YaHei', sans-serif;
  font-size: 12px;
  pointer-events: none;
}

.tree-node.is-focus rect {
  fill: #234b6e;
  stroke: var(--wiki-gold);
  stroke-width: 2.5;
}

.tree-node.is-focus text {
  fill: #ffffff;
}

.tree-node:hover rect {
  fill: #1f4a6d;
  stroke: #cfe9ff;
}

.tree-node {
  cursor: pointer;
}

.tree-edge {
  fill: none;
  stroke: var(--wire);
  stroke-width: 1.6;
  opacity: 0.75;
}

.tree-edge.is-focus {
  stroke: var(--wiki-gold);
  opacity: 1;
}

.tree-edge-hit {
  fill: none;
  stroke: transparent;
  stroke-width: 10;
  cursor: help;
}

.tree-tools {
  position: absolute;
  right: 8px;
  bottom: 8px;
  display: flex;
  gap: 4px;
}

.tree-btn {
  width: 26px;
  height: 26px;
  border-radius: 0;
  border: 2px solid rgba(160, 205, 240, 0.55);
  background: rgba(10, 30, 46, 0.72);
  color: #d7ecff;
  font-family: inherit;
  font-size: 0.85rem;
  line-height: 1;
  cursor: pointer;
}

.tree-btn:hover {
  background: rgba(59, 157, 255, 0.75);
}

.tree-tip {
  position: absolute;
  max-width: 260px;
  padding: 0.35rem 0.55rem;
  background: rgba(8, 24, 36, 0.94);
  border: 1px solid rgba(160, 205, 240, 0.45);
  border-radius: 0;
  color: #dcecf8;
  font-size: 0.76rem;
  line-height: 1.5;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.12s ease;
  z-index: 3;
}

.tree-tip.show {
  opacity: 1;
}

.evo-empty {
  font-size: 0.88rem;
  color: #6b8aa3;
  padding: 1.2rem 0;
  text-align: center;
}

/* --------------------------------------------------------------- buttons */

.mini-btn {
  border: 2px solid var(--border-color, #80c0ff);
  background: #fff;
  color: var(--text-secondary, #2d5a7b);
  border-radius: 0;
  padding: 0.3rem 0.9rem;
  font-family: inherit;
  font-weight: bold;
  font-size: 0.8rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.mini-btn:hover {
  border-color: var(--slime-blue, #3b9dff);
  background: var(--slime-blue, #3b9dff);
  color: #fff;
  transform: translateY(-2px);
}

/* ------------------------------------------------------------ responsive */

@media (max-width: 1100px) {
  .wiki-app {
    grid-template-columns: 320px minmax(0, 1fr);
  }
}

@media (max-width: 900px) {
  body {
    overflow: auto;
  }

  .wiki-app {
    grid-template-columns: 1fr;
    height: auto;
    padding: 0.8rem;
    gap: 0.8rem;
  }

  .wiki-side {
    max-height: 46vh;
  }

  .wiki-main {
    min-height: 62vh;
  }

  .wiki-welcome {
    padding: 2rem 1rem;
  }

  .detail-head {
    padding: 1rem 4.6rem 0.9rem 1.1rem;
  }

  .detail-type-tile {
    width: 44px;
    height: 44px;
    top: 0.9rem;
    right: 0.9rem;
  }

  .detail-title {
    font-size: 1.45rem;
  }

  .detail-body {
    padding: 0.9rem 1.1rem 1.4rem;
  }

  .tree-shell {
    height: 320px;
  }
}

@media (max-width: 640px) {
  .wiki-app {
    padding: 0.55rem;
  }

  .side-title {
    font-size: 1.05rem;
  }

  .wiki-chips {
    padding-bottom: 0.25rem;
  }

  .wiki-search kbd {
    display: none;
  }

  .welcome-title {
    font-size: 2rem;
  }

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

  .tree-shell {
    height: 280px;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}
