/* ---------- PixelmonMMO Pokedex ---------- */

:root {
  --dex-card-bg: #ffffff;
  --dex-card-border: #d7dce1;
  --dex-card-hover: #eef4f4;
  --dex-muted: #6b7680;
  --dex-accent: #009485;
  --dex-bar-track: #e4e8ec;
  --dex-img-bg: #212429; /* matches the model render background */
}
[data-md-color-scheme="slate"] {
  --dex-card-bg: #1e222a;
  --dex-card-border: #3a404d;
  --dex-card-hover: #262c37;
  --dex-muted: #9aa4b2;
  --dex-accent: #4fd8c7;
  --dex-bar-track: #343a46;
}

/* ---------- search ---------- */
.dex-search { position: relative; margin: 0.6rem 0 1rem; max-width: 34rem; }
.dex-search input {
  width: 100%; padding: 0.55rem 0.9rem; font-size: 0.8rem;
  border: 2px solid var(--dex-card-border); border-radius: 0.4rem;
  background: var(--dex-card-bg); color: var(--md-typeset-color);
}
.dex-search input:focus { outline: none; border-color: var(--dex-accent); }
.dex-search-results {
  position: absolute; z-index: 50; left: 0; right: 0; top: 100%;
  background: var(--dex-card-bg); border: 1px solid var(--dex-card-border);
  border-radius: 0.3rem; box-shadow: 0 6px 18px rgba(0,0,0,0.35);
  max-height: 22rem; overflow-y: auto; display: none;
}
.dex-search-results.open { display: block; }
.dex-search-results a, .dex-search-results span.dex-soon {
  display: flex; align-items: center; gap: 0.6rem;
  padding: 0.3rem 0.7rem; font-size: 0.75rem; color: var(--md-typeset-color);
}
.dex-search-results a:hover { background: var(--dex-card-hover); }
.dex-search-results img { width: 32px; height: 32px; image-rendering: pixelated; }
.dex-search-results .dex-num { color: var(--dex-muted); min-width: 3.2em; }
.dex-search-results .dex-soon { opacity: 0.5; cursor: default; }
.dex-search-results .dex-soon em { margin-left: auto; font-size: 0.65rem; }

/* ---------- gen picker ---------- */
.dex-gengrid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(9.5rem, 1fr));
  gap: 0.6rem; margin: 1rem 0;
}
.dex-genbtn {
  display: flex; flex-direction: column; align-items: center; gap: 0.2rem;
  padding: 0.8rem 0.4rem; border: 2px solid var(--dex-card-border);
  border-radius: 0.5rem; background: var(--dex-card-bg);
  color: var(--md-typeset-color) !important; text-align: center;
  font-weight: 700; transition: border-color 0.15s, transform 0.15s;
}
.dex-genbtn:hover { border-color: var(--dex-accent); transform: translateY(-2px); }
.dex-genbtn img { width: 56px; height: 56px; image-rendering: pixelated; }
.dex-genbtn small { color: var(--dex-muted); font-weight: 400; }

/* ---------- gen listing ---------- */
.dex-cardgrid {
  display: grid; grid-template-columns: repeat(10, minmax(0, 1fr));
  gap: 0.4rem; margin: 1rem 0;
}
@media screen and (max-width: 59.9em) {
  .dex-cardgrid { grid-template-columns: repeat(auto-fill, minmax(6rem, 1fr)); }
}
.dex-card {
  display: flex; flex-direction: column; align-items: center; min-width: 0;
  padding: 0.5rem 0.25rem 0.4rem; border: 1px solid var(--dex-card-border);
  border-radius: 0.45rem; background: var(--dex-card-bg);
  color: var(--md-typeset-color) !important; font-size: 0.72rem; text-align: center;
}
.dex-card > span:last-child {
  max-width: 100%; padding: 0 0.25rem;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
a.dex-card:hover { border-color: var(--dex-accent); background: var(--dex-card-hover); }
/* type filter row on the dex index */
.dex-typefilter { display: flex; flex-wrap: wrap; gap: 0.3rem; margin: 0.6rem 0 0.2rem; }
.dex-typebtn { border: 2px solid transparent; cursor: pointer; }
.dex-typebtn:hover { filter: brightness(1.15); }
.dex-typebtn.active { border-color: #fff; box-shadow: 0 0 0 1px rgba(0,0,0,0.35); }
.dex-card img { width: 48px; height: 48px; image-rendering: pixelated; }
.dex-card .dex-num { color: var(--dex-muted); font-size: 0.62rem; }
.dex-card.dex-card-soon { opacity: 0.45; }

/* ---------- species page layout ---------- */
body:has(.dex-page) .md-grid { max-width: 82rem; }
.dex-page { display: grid; grid-template-columns: minmax(0, 1fr) 17.5rem; gap: 1.2rem; }
@media (max-width: 76em) { .dex-page { grid-template-columns: 1fr; } .dex-side { order: -1; } }
.dex-side { min-width: 0; }
.dex-main { min-width: 0; }

/* form tabs */
.dex-formtabs { display: flex; flex-wrap: wrap; gap: 0.35rem; margin: 0.8rem 0; }
.dex-w-forms { margin: 0.55rem 0 0.2rem; }
.dex-w-forms > b { font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.04em; opacity: 0.75; }
.dex-w-forms .dex-formtabs { margin: 0.3rem 0 0; gap: 0.25rem; }
.dex-w-forms .dex-formtab { font-size: 0.6rem; padding: 0.12rem 0.45rem; }
.dex-formtab {
  padding: 0.3rem 0.75rem; font-size: 0.72rem; font-weight: 700;
  border: 2px solid var(--dex-card-border); border-radius: 1rem;
  background: var(--dex-card-bg); color: var(--md-typeset-color); cursor: pointer;
}
.dex-formtab.active { border-color: var(--dex-accent); color: var(--dex-accent); }
.dex-formpane[hidden] { display: none; }

/* ---------- right widget ---------- */
.dex-widget {
  position: sticky; top: 4.4rem;
  max-height: calc(100vh - 5.2rem); overflow-y: auto;
  border: 1px solid var(--dex-card-border); border-radius: 0.6rem;
  background: var(--dex-card-bg); padding: 0.65rem; font-size: 0.7rem;
}
.dex-widget-title {
  display: flex; align-items: center; gap: 0.45rem;
  font-size: 0.85rem; font-weight: 700; margin-bottom: 0.45rem;
}
.dex-widget-title img { width: 32px; height: 32px; image-rendering: pixelated; }
.dex-turntable {
  position: relative; border-radius: 0.45rem; overflow: hidden;
  background: var(--dex-img-bg); cursor: grab; user-select: none;
  touch-action: pan-y;
}
.dex-turntable:active { cursor: grabbing; }
.dex-turntable img {
  display: block; width: 100%; aspect-ratio: 1/1; pointer-events: none;
  position: relative; z-index: 1;
}
.dex-turntable canvas.dex-fx {
  position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none;
  z-index: 2;
}
.dex-turntable .dex-tt-nav { z-index: 3; }
.dex-turntable .dex-hint {
  position: absolute; bottom: 0.3rem; right: 0.55rem;
  font-size: 0.6rem; color: #cfd6dd; opacity: 0.65; pointer-events: none;
}
.dex-tt-nav {
  position: absolute; top: 50%; transform: translateY(-50%);
  width: 1.9rem; height: 1.9rem; border-radius: 50%;
  border: none; background: rgba(0,0,0,0.45); color: #fff;
  font-size: 1rem; line-height: 1; cursor: pointer;
}
.dex-tt-nav:hover { background: rgba(0,0,0,0.7); }
.dex-tt-prev { left: 0.4rem; } .dex-tt-next { right: 0.4rem; }
.dex-palette-dots { display: flex; flex-wrap: wrap; gap: 0.25rem; justify-content: center; margin-top: 0.45rem; }
.dex-palette-dots button {
  padding: 0.12rem 0.5rem; font-size: 0.62rem; border-radius: 0.8rem;
  border: 1px solid var(--dex-card-border); background: none;
  color: var(--dex-muted); cursor: pointer;
}
.dex-palette-dots button.active { border-color: var(--dex-accent); color: var(--dex-accent); }

.dex-widget-info { margin-top: 0.7rem; }
.dex-gender-m { color: #6ec6e8; font-weight: 700; }
.dex-gender-f { color: #f08bb7; font-weight: 700; }
.dex-widget-desc {
  margin: 0.55rem 0 0.2rem; font-size: 0.68rem; line-height: 1.45;
  color: var(--dex-muted); font-style: italic;
}
.dex-widget-evos { margin-top: 0.45rem; border-top: 1px solid var(--dex-card-border); padding-top: 0.35rem; }
.dex-widget-evo { font-size: 0.68rem; padding: 0.12rem 0; }
.dex-widget-evo .dex-num { color: var(--dex-muted); font-size: 0.62rem; }
.dex-evo-item { width: 20px; height: 20px; image-rendering: pixelated; vertical-align: middle; }
/* breeding-parent sprites on move pages: rows of 10 */
.dex-parent-grid {
  display: grid; grid-template-columns: repeat(10, 30px); gap: 2px;
  justify-items: center; align-items: center;
}
.dex-parent-grid img { width: 28px; height: 28px; image-rendering: pixelated; }
.dex-parent-grid a { border-radius: 0.25rem; }
.dex-parent-grid a:hover { background: var(--dex-card-hover); }
/* "Species that learn X" chart */
.dex-learners td { vertical-align: middle; }
.dex-learners td:first-child { white-space: nowrap; min-width: 11rem; }
.dex-learners td:first-child a { color: var(--md-typeset-color); }
.dex-learners td:nth-child(2), .dex-learners td:nth-child(3),
.dex-learners td:nth-child(5) { text-align: center; white-space: nowrap; }
.dex-learners th:nth-child(2), .dex-learners th:nth-child(3),
.dex-learners th:nth-child(5) { text-align: center; }
.dex-learners tbody tr:nth-child(even) { background: rgba(128,128,160,0.06); }
.dex-learners tbody tr:hover { background: var(--dex-card-hover); }
.dex-widget-info .dex-row { display: flex; justify-content: space-between; gap: 0.5rem; padding: 0.22rem 0; border-top: 1px solid var(--dex-card-border); }
.dex-widget-info .dex-row b { color: var(--dex-muted); font-weight: 600; }

/* evolution line */
.dex-evoline { display: flex; flex-wrap: wrap; align-items: center; gap: 0.15rem; margin-top: 0.7rem; justify-content: center; }
.dex-evoline .dex-evo {
  display: flex; flex-direction: column; align-items: center;
  padding: 0.3rem 0.35rem; border-radius: 0.4rem; font-size: 0.62rem;
  color: var(--md-typeset-color) !important; text-align: center; border: 2px solid transparent;
}
.dex-evoline .dex-evo img { width: 36px; height: 36px; image-rendering: pixelated; }
.dex-evoline .dex-evo.current { border-color: var(--dex-accent); background: var(--dex-card-hover); }
.dex-evoline a.dex-evo:hover { background: var(--dex-card-hover); }
.dex-evoline .dex-evo-arrow { color: var(--dex-muted); font-size: 0.62rem; text-align: center; }
/* branched evolution lines: root on top, one row per branch */
.dex-evoline .dex-evo-root { flex-basis: 100%; display: flex; justify-content: center; margin-bottom: 0.2rem; }
.dex-evoline .dex-evo-branch {
  flex-basis: 100%; display: flex; flex-wrap: wrap; align-items: center;
  justify-content: center; gap: 0.15rem;
}
.dex-evoline .dex-evo-branch .dex-num { font-size: 0.58rem; color: var(--dex-muted); }

/* ---------- type badges ---------- */
.dex-type {
  display: inline-block; padding: 0.1rem 0.55rem; border-radius: 0.8rem;
  color: #fff; font-size: 0.62rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.03em; text-shadow: 0 1px 1px rgba(0,0,0,0.4);
  white-space: nowrap;
}

/* ---------- stat bars ---------- */
.dex-stats { width: 100%; max-width: 30rem; border-collapse: collapse; }
.dex-stats td { padding: 0.14rem 0.4rem; font-size: 0.72rem; border: none; }
.dex-stats td:first-child { width: 5.2rem; color: var(--dex-muted); font-weight: 600; }
.dex-stats td:nth-child(2) { width: 2.6rem; text-align: right; font-variant-numeric: tabular-nums; }
.dex-statbar { display: flex; height: 0.65rem; border-radius: 0.35rem; background: var(--dex-bar-track); overflow: hidden; }
.dex-statbar span { display: block; flex: none; height: 100%; }
/* shadow-tier stat gains: one animated segment per tier */
.dex-statseg {
  background-size: 200% 100%;
  animation: dexSegSweep 2.2s linear infinite;
}
@keyframes dexSegSweep {
  from { background-position: 0% 0; }
  to { background-position: 200% 0; }
}
.dex-seg-shadow { background-image: linear-gradient(90deg, #7b2fbe, #b06ae8, #7b2fbe); }
.dex-seg-corrupt { background-image: linear-gradient(90deg, #2f9e2f, #6ee86e, #2f9e2f); }
.dex-seg-void { background-image: linear-gradient(90deg, #1fb8ac, #5ff0e2, #1fb8ac); }
.dex-seg-abyss { background-image: linear-gradient(90deg, #c02020, #f06a5a, #c02020); }
.dex-seg-eternal { background-image: linear-gradient(90deg, #d8a020, #ffe27a, #d8a020); }
.dex-seg-infinity {
  background-image: linear-gradient(90deg, #ff4040, #ffa640, #ffe440, #4be04b,
                    #4bb8ff, #b06aff, #ff4040);
  background-size: 300% 100%;
  animation-duration: 3s;
}

/* ---------- type effectiveness ---------- */
.dex-eff { display: flex; flex-wrap: wrap; gap: 0.3rem 0.35rem; align-items: center; margin: 0.3rem 0 0.8rem; }
.dex-eff .dex-mult { font-size: 0.68rem; color: var(--dex-muted); margin-right: 0.15rem; font-weight: 700; }

/* ---------- data tables ---------- */
.dex-formpane table.dex-table { display: table; width: 100%; border-collapse: collapse; font-size: 0.72rem; margin: 0.5rem 0 1rem; }
.dex-table th { text-align: left; padding: 0.3rem 0.5rem; border-bottom: 2px solid var(--dex-card-border); }
.dex-table td { padding: 0.28rem 0.5rem; border-bottom: 1px solid var(--dex-card-border); }
.dex-table tr:hover td { background: var(--dex-card-hover); }
.dex-table .dex-num { color: var(--dex-muted); font-variant-numeric: tabular-nums; }
.dex-formpane details { margin: 0.4rem 0 0.9rem; border: 1px solid var(--dex-card-border); border-radius: 0.4rem; padding: 0.4rem 0.7rem; }
.dex-formpane details summary { cursor: pointer; font-weight: 700; font-size: 0.75rem; }
.dex-formpane h2 { margin-top: 1.6rem; }
.dex-spawn-note { font-size: 0.7rem; color: var(--dex-muted); margin: 0.2rem 0 0.8rem; }

/* ---------- boxed category cards ---------- */
.dex-box {
  border: 1px solid var(--dex-card-border); border-radius: 0.55rem;
  background: var(--dex-card-bg); margin: 0.9rem 0; overflow: hidden;
}
.dex-box-head {
  display: flex; align-items: center; gap: 0.5rem;
  padding: 0.45rem 0.75rem; background: var(--dex-card-hover);
  border-bottom: 1px solid var(--dex-card-border);
  font-weight: 700; font-size: 0.8rem;
}
.dex-box-head img { width: 22px; height: 22px; image-rendering: pixelated; }
.dex-box-body { padding: 0.45rem 0.75rem 0.6rem; font-size: 0.72rem; }
.dex-box-body h4 {
  margin: 0.8rem 0 0.2rem; font-size: 0.74rem; color: var(--dex-muted);
  text-transform: uppercase; letter-spacing: 0.05em;
}
.dex-box-body h4:first-child { margin-top: 0.2rem; }
.dex-box-body table.dex-table { margin: 0.3rem 0 0.5rem; }
.dex-icell { display: inline-flex; align-items: center; gap: 0.45rem; }
.dex-icell img { width: 22px; height: 22px; image-rendering: pixelated; flex: none; }
.dex-psprite { width: 40px; height: 40px; image-rendering: pixelated; display: block; }
.dex-applist { list-style: none; margin: 0.3rem 0; padding: 0; display: flex; flex-direction: column; gap: 0.35rem; }
.dex-applist li {
  display: flex; gap: 0.55rem; align-items: center;
  padding: 0.4rem 0.55rem; border: 1px solid var(--dex-card-border);
  border-radius: 0.45rem;
}
.dex-applist img { width: 24px; height: 24px; image-rendering: pixelated; flex: none; }

/* ---------- NPC portrait card ---------- */
.dex-npc-portrait {
  float: right; width: 200px; max-width: 40%;
  margin: 0 0 0.8rem 1rem; padding: 0.4rem;
  border: 1px solid var(--dex-card-border); border-radius: 0.55rem;
  background: var(--dex-img-bg); image-rendering: pixelated;
}
/* right-side zone box: screenshot on top, contents section below */
.dex-zone-box {
  float: right; width: 320px; max-width: 45%;
  margin: 0 0 0.8rem 1rem;
  border: 1px solid var(--dex-card-border); border-radius: 0.55rem;
  background: var(--dex-card-bg); overflow: hidden;
}
.dex-zone-box img { width: 100%; display: block; }
.dex-zone-box .dex-zone-contents {
  padding: 0.5rem 0.8rem 0.7rem;
  border-top: 1px solid var(--dex-card-border); font-size: 0.72rem;
}
.dex-zone-box .dex-zone-contents b {
  display: block; margin-bottom: 0.3rem; font-size: 0.78rem;
}
.dex-zone-box .dex-zone-contents ul { margin: 0; padding-left: 1.1rem; }
.dex-zone-box .dex-zone-contents li { margin: 0.15rem 0; }
.dex-box-slideshow { position: relative; }
.dex-box-slideshow .dex-slide-cap {
  position: absolute; left: 0; right: 0; bottom: 0;
  padding: 0.15rem 0.5rem; font-size: 0.62rem; color: #fff;
  background: rgba(0, 0, 0, 0.55); text-align: center;
}
/* skill page title icon */
.dex-skill-icon {
  width: 34px; height: 34px; image-rendering: pixelated;
  vertical-align: middle; margin-right: 0.4rem;
}
/* expandable drop charts */
details.dex-drop { margin: 0.45rem 0; }
details.dex-drop > summary {
  cursor: pointer; font-weight: 600; padding: 0.45rem 0.7rem;
  background: var(--md-code-bg-color); border-radius: 6px;
  list-style-position: inside;
}
details.dex-drop[open] > summary { border-radius: 6px 6px 0 0; }
details.dex-drop > .dex-drop-body {
  border: 1px solid var(--md-default-fg-color--lightest); border-top: none;
  padding: 0.5rem 0.7rem; border-radius: 0 0 6px 6px;
}
details.dex-drop .dex-drop-body details.dex-drop > summary { font-weight: 500; }
.dex-drop .dex-table td:first-child { white-space: nowrap; }
.dex-item-sprite {
  width: 28px; height: 28px; image-rendering: pixelated;
  vertical-align: middle; margin-right: 0.25rem;
}
/* --- page aesthetics: logo, panels, scenery background ------------------ */
.dex-page-bg {
  position: fixed;
  inset: 0;
  z-index: -1;
  background-position: center;
  background-size: cover;
  background-repeat: no-repeat;
}
.dex-page-bg::after {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
}
body { background-color: transparent; }
.md-header__button.md-logo img {
  image-rendering: pixelated;
  height: 2.2rem;
  width: 2.2rem;
}
.md-header__button.md-logo { padding: 0.2rem; margin: 0.1rem; }

/* home page feature box with separators; server IP lives in the top banner */
.dex-feature-box { border-radius: 10px; margin: 1rem 0; }
[data-md-color-scheme="slate"] .dex-feature-box { background-color: #101a30; }
[data-md-color-scheme="default"] .dex-feature-box { background-color: #f7f8fa; }
.dex-feature { padding: 0.75rem 1rem; margin: 0; }
.dex-feature p { margin: 0; }
.dex-feature + .dex-feature { border-top: 1px solid rgba(127, 127, 127, 0.3); }
.dex-chipgrid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 0.45rem;
  margin: 0.9rem 0 1.2rem;
}
.dex-chip {
  display: flex;
  align-items: center;
  padding: 0.5rem 0.65rem;
  border-radius: 8px;
  font-size: 0.68rem;
  font-weight: 600;
  line-height: 1.3;
  transition: transform 0.12s, box-shadow 0.12s;
}
.dex-chip:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.3);
}
[data-md-color-scheme="slate"] .dex-chip {
  background-color: #101a30;
  border: 1px solid rgba(120, 150, 220, 0.25);
  color: var(--md-default-fg-color);
}
[data-md-color-scheme="default"] .dex-chip {
  background-color: #f7f8fa;
  border: 1px solid rgba(0, 0, 0, 0.1);
  color: var(--md-default-fg-color);
}
.md-banner { text-align: center; }
.dex-ip-banner {
  font-size: 0.85rem;
  letter-spacing: 0.02em;
  line-height: 2;
}

/* middle + right informational panels */
[data-md-color-scheme="slate"] .md-content,
[data-md-color-scheme="slate"] .md-sidebar--secondary .md-sidebar__inner {
  background-color: rgba(13, 20, 42, 0.9);
  border-radius: 10px;
}
[data-md-color-scheme="default"] .md-content,
[data-md-color-scheme="default"] .md-sidebar--secondary .md-sidebar__inner {
  background-color: rgba(255, 255, 255, 0.92);
  border-radius: 10px;
}
/* gradient exists ONLY in a 1px masked ring, never behind the text */
.md-content, .md-sidebar--secondary .md-sidebar__inner, .dex-feature-box {
  position: relative;
}
.md-content::before,
.md-sidebar--secondary .md-sidebar__inner::before,
.dex-feature-box::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 10px;
  padding: 1px;
  background: linear-gradient(135deg, rgba(45, 212, 191, 0.8),
              rgba(99, 102, 241, 0.8), rgba(168, 85, 247, 0.8));
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  mask-composite: exclude;
  pointer-events: none;
}
.md-content,
.md-sidebar--secondary .md-sidebar__inner {
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.25);
}
.md-content { padding: 0.2rem 1rem 1rem; margin: 0.8rem 0; }
.md-sidebar--secondary .md-sidebar__inner { padding: 0.4rem 0.6rem; }

/* header and footer tie into the glass look */
[data-md-color-scheme="slate"] .md-header {
  background-color: rgba(10, 16, 34, 0.85);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
[data-md-color-scheme="slate"] .md-footer,
[data-md-color-scheme="slate"] .md-footer-meta {
  background-color: rgba(10, 16, 34, 0.88);
}

/* left drawer: dark gray */
[data-md-color-scheme="slate"] .md-sidebar--primary {
  background-color: #26262b !important;
}
[data-md-color-scheme="default"] .md-sidebar--primary {
  background-color: #ececef !important;
}

/* --- navigation drawer at every screen size ---------------------------- */
/* Material only uses the slide-out drawer below 76.25em; these rules extend
   the same drawer behavior to desktop widths so the nav is always an
   expandable overlay and the content gets the full page width. */
@media screen and (min-width: 76.25em) {
  .md-header__button.md-icon[for="__drawer"] { display: inline-block; }

  /* drawer interior: no title bar (the header already names the site),
     comfortable padding, rounded hover/active rows */
  .md-nav--primary > .md-nav__title { display: none; }
  .md-sidebar--primary .md-sidebar__inner { padding: 0.9rem 0.7rem 1.4rem; }
  .md-sidebar--primary .md-nav__link {
    padding: 0.26rem 0.55rem;
    margin: 0.06rem 0;
    border-radius: 6px;
  }
  .md-sidebar--primary .md-nav__item { padding: 0; }
  .md-sidebar--primary .md-nav__list .md-nav__list { padding-left: 0.6rem; }
  [data-md-color-scheme="slate"] .md-sidebar--primary .md-nav__link:hover {
    background: rgba(255, 255, 255, 0.08);
  }
  [data-md-color-scheme="default"] .md-sidebar--primary .md-nav__link:hover {
    background: rgba(0, 0, 0, 0.07);
  }
  .md-sidebar--primary .md-nav__link--active {
    background: rgba(0, 150, 136, 0.22);
    font-weight: 600;
  }
  /* expanded sections: highlight the opened label and tint its children */
  [data-md-color-scheme="slate"] .md-sidebar--primary
    .md-nav__toggle:checked ~ label.md-nav__link {
    background: rgba(255, 255, 255, 0.1);
    font-weight: 600;
  }
  [data-md-color-scheme="default"] .md-sidebar--primary
    .md-nav__toggle:checked ~ label.md-nav__link {
    background: rgba(0, 0, 0, 0.09);
    font-weight: 600;
  }
  [data-md-color-scheme="slate"] .md-sidebar--primary
    .md-nav__toggle:checked ~ .md-nav {
    background: rgba(255, 255, 255, 0.04);
    border-left: 2px solid rgba(45, 212, 191, 0.55);
    border-radius: 0 6px 6px 0;
    margin: 0.1rem 0 0.2rem 0.25rem;
  }
  [data-md-color-scheme="default"] .md-sidebar--primary
    .md-nav__toggle:checked ~ .md-nav {
    background: rgba(0, 0, 0, 0.04);
    border-left: 2px solid rgba(13, 148, 136, 0.55);
    border-radius: 0 6px 6px 0;
    margin: 0.1rem 0 0.2rem 0.25rem;
  }
  [data-md-color-scheme="slate"] .md-sidebar--primary {
    border-right: 1px solid rgba(255, 255, 255, 0.07);
  }
  [data-md-color-scheme="default"] .md-sidebar--primary {
    border-right: 1px solid rgba(0, 0, 0, 0.1);
  }
  .md-sidebar--primary {
    display: block;
    position: fixed;
    top: 0;
    left: -18.1rem;
    width: 18.1rem;
    height: 100vh;
    margin: 0;
    padding: 0.6rem 0;
    background-color: var(--md-default-bg-color);
    z-index: 5;
    transform: translateX(0);
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.25s;
  }
  [data-md-toggle="drawer"]:checked ~ .md-container .md-sidebar--primary {
    transform: translateX(18.1rem);
    box-shadow: var(--md-shadow-z3);
  }
  .md-sidebar--primary .md-sidebar__scrollwrap {
    height: 100% !important;
    max-height: none;
    margin: 0;
    overflow-y: auto;
  }
  /* Material only styles .md-overlay below its mobile breakpoint, so the
     click-outside-to-close geometry must be recreated here for desktop */
  .md-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 0;
    height: 0;
    opacity: 0;
    background-color: rgba(0, 0, 0, 0.54);
    z-index: 4;
    transition: width 0ms 0.25s, height 0ms 0.25s, opacity 0.25s;
  }
  [data-md-toggle="drawer"]:checked ~ .md-overlay {
    width: 100%;
    height: 100%;
    opacity: 1;
    transition: width 0ms, height 0ms, opacity 0.25s;
  }
}

/* image lightbox: consistent enlarged view + thumbnail picker */
.dex-lightbox {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(0, 0, 0, 0.86);
  display: none; flex-direction: column;
  align-items: center; justify-content: center; gap: 1.2rem;
}
.dex-lightbox.open { display: flex; }
.dex-lb-main { position: relative; display: flex; align-items: center; gap: 0.8rem; }
.dex-lb-img {
  width: min(70vmin, 640px); height: min(70vmin, 640px);
  object-fit: contain;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 10px;
}
.dex-lb-nav {
  width: 2.4rem; height: 2.4rem; border-radius: 50%; border: none;
  background: rgba(255, 255, 255, 0.12); color: #fff;
  font-size: 1.5rem; line-height: 1; cursor: pointer;
}
.dex-lb-nav:hover { background: rgba(255, 255, 255, 0.25); }
.dex-lb-x {
  position: absolute; top: -2.4rem; right: 0;
  width: 2rem; height: 2rem; border-radius: 50%; border: none;
  background: rgba(255, 255, 255, 0.12); color: #fff;
  font-size: 1.2rem; cursor: pointer;
}
.dex-lb-cap {
  position: absolute; bottom: -1.7rem; left: 0; right: 0;
  text-align: center; color: #eee; font-size: 0.75rem;
}
.dex-lb-thumbs {
  display: flex; gap: 6px; max-width: 90vw;
  overflow-x: auto; padding: 6px; margin-top: 0.9rem;
}
.dex-lb-thumbs img {
  width: 56px; height: 56px; flex: none; object-fit: contain;
  background: rgba(255, 255, 255, 0.07);
  border: 2px solid transparent; border-radius: 6px;
  cursor: pointer; image-rendering: pixelated;
}
.dex-lb-thumbs img.active { border-color: #2dd4bf; }

/* coordinate chip: little highlighted box for x, y, z positions */
.dex-coord {
  font-family: var(--md-code-font-family, monospace);
  font-size: 0.72em;
  background: rgba(45, 212, 191, 0.12);
  border: 1px solid rgba(45, 212, 191, 0.35);
  border-radius: 5px;
  padding: 0 0.35em;
  white-space: nowrap;
}

/* segmented matrix chart: every cell its own box */
table.dex-matrix { border-collapse: separate; border-spacing: 3px; }
table.dex-matrix th, table.dex-matrix td {
  border: 1px solid rgba(127, 127, 127, 0.35);
  border-radius: 6px;
  text-align: center;
  vertical-align: middle;
  padding: 0.35rem 0.5rem;
  background: rgba(127, 127, 127, 0.06);
}
table.dex-matrix td:first-child { text-align: left; }

/* Pixelmon GUI type icons */
.dex-type-icon {
  width: 14px; height: 14px; vertical-align: -2px; margin-right: 4px;
}
.dex-type-title-icon {
  width: 34px; height: 34px; vertical-align: middle; margin-right: 0.3rem;
}

/* quest expanders on storyline pages */
details.dex-quest {
  border: 1px solid var(--dex-card-border); border-radius: 0.5rem;
  background: var(--dex-card-bg); margin: 0.45rem 0; padding: 0.45rem 0.75rem;
}
details.dex-quest summary { cursor: pointer; }
details.dex-quest[open] { padding-bottom: 0.65rem; }

/* prev / next dex nav */
.dex-prevnext { display: flex; justify-content: space-between; gap: 1rem; font-size: 0.72rem; margin: 0.4rem 0 0.2rem; color: var(--dex-muted); }

/* cursor-following tooltip (ability descriptions etc.) */
.dex-tooltip {
  position: fixed; z-index: 200; max-width: 20rem; display: none;
  padding: 0.45rem 0.6rem; border-radius: 0.4rem; font-size: 0.68rem;
  line-height: 1.4; pointer-events: none;
  background: rgba(18, 20, 28, 0.96); color: #e8e8f0;
  border: 1px solid rgba(255,255,255,0.18);
  box-shadow: 0 4px 14px rgba(0,0,0,0.45);
}
.dex-tooltip.open { display: block; }
.dex-tip { text-decoration: underline dotted; text-underline-offset: 3px; }
