:root {
  --sts2-ink: #19161f;
  --sts2-muted: #6f6878;
  --sts2-panel: #ffffff;
  --sts2-panel-soft: #f6f0e8;
  --sts2-line: rgba(55, 43, 69, 0.14);
  --sts2-accent: #b76524;
  --sts2-focus: #6540a8;
}

[data-md-color-scheme="slate"] {
  --sts2-ink: #f8f2e8;
  --sts2-muted: #c5b8ca;
  --sts2-panel: #211b29;
  --sts2-panel-soft: #18131f;
  --sts2-line: rgba(243, 226, 198, 0.14);
  --sts2-accent: #f0a24a;
  --sts2-focus: #b89cff;
}

.md-header,
.md-tabs {
  background: #22132f;
}

.md-typeset h1,
.md-typeset h2 {
  font-weight: 760;
  letter-spacing: 0;
}

.md-typeset h1 {
  color: var(--sts2-ink);
}

.md-typeset a {
  color: var(--sts2-focus);
}

.md-typeset table:not([class]) {
  border-radius: 8px;
  box-shadow: 0 0 0 1px var(--sts2-line);
  overflow: hidden;
}

.md-typeset table:not([class]) th {
  background: var(--sts2-panel-soft);
  color: var(--sts2-ink);
}

.md-typeset table:not([class]) td,
.md-typeset table:not([class]) th {
  border-color: var(--sts2-line);
  vertical-align: top;
}

.wiki-image {
  display: block;
  max-width: none;
  margin: 0 auto;
  object-fit: contain;
  object-position: center;
}

.wiki-image-link {
  display: block;
  width: fit-content;
  margin: 0 auto;
  cursor: zoom-in;
}

.wiki-image--card {
  width: 108px;
  min-width: 108px;
  height: 150px;
}

.wiki-image--relic {
  width: 72px;
  min-width: 72px;
  height: 72px;
}

.wiki-image--enemy {
  width: 112px;
  min-width: 112px;
  height: 112px;
}

.md-typeset .wiki-image--character-thumb {
  width: 176px;
  min-width: 176px;
  height: 110px;
}

.wiki-image-link:has(.wiki-image--character-thumb),
.wiki-image-link:has(.wiki-image--character),
.wiki-image-link:has(.wiki-image--character-detail) {
  overflow: hidden;
  border: 1px solid var(--sts2-line);
  border-radius: 6px;
  background: #17111e;
}

.wiki-image-link:has(.wiki-image--character-thumb) {
  width: 176px;
}

.wiki-character {
  display: grid;
  grid-template-columns: minmax(180px, 260px) minmax(0, 1fr);
  align-items: center;
  gap: 1.5rem;
  margin: 0 0 1.25rem;
  padding: 1rem;
  border-block: 1px solid var(--sts2-line);
}

.wiki-character > .wiki-image-link {
  width: 100%;
}

.wiki-image--character {
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 10;
}

.wiki-character__copy {
  color: var(--sts2-muted);
  font-size: 1rem;
  line-height: 1.65;
}

.wiki-entity-hero {
  display: grid;
  grid-template-columns: minmax(180px, 260px) minmax(0, 1fr);
  align-items: start;
  gap: 1.5rem;
  margin: 1rem 0 2rem;
  padding-block: 1rem 1.5rem;
  border-bottom: 1px solid var(--sts2-line);
}

.wiki-entity-hero > .wiki-image-link {
  width: 100%;
}

.wiki-image--card-detail {
  width: min(220px, 100%);
  max-height: 320px;
  object-fit: contain;
}

.wiki-image--relic-detail,
.wiki-image--enemy-detail {
  width: min(240px, 100%);
  height: 240px;
}

.wiki-image--character-detail {
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 10;
}

.wiki-entity-hero__details {
  min-width: 0;
  color: var(--sts2-muted);
  line-height: 1.65;
}

.wiki-browser {
  margin: 1.25rem 0 1.5rem;
  padding: 0.9rem;
  border-block: 1px solid var(--sts2-line);
  background: var(--sts2-panel-soft);
}

.wiki-browser__controls {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 0.65rem;
}

.wiki-browser__field {
  display: grid;
  flex: 1 1 110px;
  min-width: 0;
  gap: 0.25rem;
  color: var(--sts2-muted);
  font-size: 0.68rem;
  font-weight: 700;
}

.wiki-browser__field:first-child {
  flex: 2 1 180px;
}

.wiki-browser__field input,
.wiki-browser__field select,
.wiki-browser__reset {
  width: 100%;
  min-height: 40px;
  margin: 0;
  padding: 0.45rem 0.6rem;
  border: 1px solid var(--sts2-line);
  border-radius: 6px;
  background: var(--sts2-panel);
  color: var(--sts2-ink);
  font: inherit;
  font-size: 0.78rem;
}

.wiki-browser__field input:focus,
.wiki-browser__field select:focus,
.wiki-browser__reset:focus-visible {
  border-color: var(--sts2-focus);
  outline: 2px solid color-mix(in srgb, var(--sts2-focus), transparent 70%);
  outline-offset: 1px;
}

.wiki-browser__reset {
  width: auto;
  padding-inline: 0.85rem;
  cursor: pointer;
  font-weight: 700;
}

.wiki-browser__reset:disabled {
  cursor: default;
  opacity: 0.45;
}

.wiki-browser__status {
  display: block;
  margin-top: 0.65rem;
  color: var(--sts2-muted);
  font-size: 0.75rem;
}

.md-typeset__scrollwrap:has(.wiki-browser-table) {
  overflow-x: auto;
  overscroll-behavior-inline: contain;
  scrollbar-gutter: stable;
}

.wiki-browser-table th:nth-child(2),
.wiki-browser-table td:nth-child(2) {
  position: sticky;
  left: 0;
  z-index: 1;
  background: var(--sts2-panel);
  box-shadow: 1px 0 0 var(--sts2-line);
}

.wiki-browser-table th:nth-child(2) {
  z-index: 2;
  background: var(--sts2-panel-soft);
}

.sts2-home {
  margin-top: -1rem;
}

.sts2-hero {
  position: relative;
  min-height: 430px;
  display: grid;
  align-items: end;
  overflow: hidden;
  border-radius: 8px;
  background: #15101d url("/docs/images/hero.png") center / cover no-repeat;
  box-shadow: 0 24px 80px rgba(20, 14, 29, 0.28);
}

.sts2-hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, rgba(12, 8, 18, 0.88), rgba(12, 8, 18, 0.46) 52%, rgba(12, 8, 18, 0.15)),
    linear-gradient(0deg, rgba(12, 8, 18, 0.84), rgba(12, 8, 18, 0.06) 58%);
}

.sts2-hero__content {
  position: relative;
  max-width: 680px;
  padding: 3rem;
  color: #fff8ef;
}

.sts2-kicker {
  display: inline-flex;
  width: fit-content;
  margin-bottom: 1rem;
  padding: 0.35rem 0.65rem;
  border: 1px solid rgba(255, 222, 162, 0.34);
  border-radius: 6px;
  background: rgba(255, 231, 185, 0.1);
  color: #ffd78c;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.sts2-hero h1 {
  margin: 0;
  color: #fff8ef;
  font-size: 3rem;
  line-height: 1.03;
  text-shadow: 0 8px 30px rgba(0, 0, 0, 0.4);
}

.sts2-hero p {
  max-width: 560px;
  margin: 1rem 0 1.5rem;
  color: rgba(255, 248, 239, 0.82);
  font-size: 1.05rem;
  line-height: 1.65;
}

.sts2-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.sts2-button {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0.7rem 1rem;
  border-radius: 6px;
  border: 1px solid rgba(255, 248, 239, 0.2);
  background: rgba(255, 248, 239, 0.1);
  color: #fff8ef !important;
  font-weight: 760;
  text-decoration: none !important;
}

.sts2-button--primary {
  border-color: #d88a36;
  background: #d88a36;
  color: #170f1e !important;
}

.sts2-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 0.85rem;
  margin: 1.5rem 0 2rem;
}

.sts2-card {
  min-height: 138px;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  padding: 1rem;
  border: 1px solid var(--sts2-line);
  border-radius: 8px;
  background: var(--sts2-panel);
  color: var(--sts2-ink) !important;
  text-decoration: none !important;
  transition: border-color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
}

.sts2-card:hover {
  border-color: color-mix(in srgb, var(--sts2-accent), transparent 15%);
  box-shadow: 0 14px 34px rgba(26, 18, 36, 0.12);
  transform: translateY(-2px);
}

.sts2-card__eyebrow {
  color: var(--sts2-accent);
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.sts2-card__title {
  color: var(--sts2-ink);
  font-size: 1.05rem;
  font-weight: 760;
}

.sts2-card__desc {
  color: var(--sts2-muted);
  font-size: 0.78rem;
  line-height: 1.45;
}

.sts2-note {
  padding: 1rem 1.1rem;
  border-left: 4px solid var(--sts2-accent);
  border-radius: 0 8px 8px 0;
  background: var(--sts2-panel-soft);
  color: var(--sts2-muted);
}

@media (max-width: 44rem) {
  .wiki-browser {
    margin-inline: -0.8rem;
    padding-inline: 0.8rem;
  }

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

  .wiki-browser__field:first-child {
    grid-column: 1 / -1;
  }

  .wiki-browser__reset {
    align-self: end;
  }

  .wiki-image--card {
    width: 76px;
    min-width: 76px;
    height: 106px;
  }

  .wiki-image--enemy {
    width: 76px;
    min-width: 76px;
    height: 76px;
  }

  .md-typeset .wiki-image--character-thumb,
  .wiki-image-link:has(.wiki-image--character-thumb) {
    width: 144px;
    min-width: 144px;
  }

  .wiki-character {
    grid-template-columns: 1fr;
  }

  .wiki-entity-hero {
    grid-template-columns: 1fr;
  }

  .wiki-image--character {
    height: 260px;
  }

  .sts2-home {
    margin-top: 0;
  }

  .sts2-hero {
    min-height: 520px;
    border-radius: 0;
    margin-inline: -0.8rem;
  }

  .sts2-hero::before {
    background: linear-gradient(0deg, rgba(12, 8, 18, 0.9), rgba(12, 8, 18, 0.32));
  }

  .sts2-hero__content {
    padding: 1.35rem;
  }

  .sts2-hero h1 {
    font-size: 2.15rem;
  }

  .sts2-actions {
    flex-direction: column;
  }

  .sts2-button {
    justify-content: center;
    width: 100%;
  }
}
