/*
@title        Scaledex - shared styles
@author       La Gia Huy
@since        2026-11-14
@updated      2026-11-26
@about        Pokémon GO Pokédex-inspired look, scoped under .swdex so it can
              live inside Obsidian as well as the standalone PWA.
*/

.swdex {
  --sw-bg-top: #b4eaf0;
  --sw-bg-bottom: #dff6f3;
  --sw-card: rgba(255, 255, 255, 0.62);
  --sw-card-solid: #f4fcfd;
  --sw-card-line: rgba(255, 255, 255, 0.9);
  --sw-ink: #1d6f8f;
  --sw-ink-strong: #12597a;
  --sw-ink-soft: #4f8ea6;
  --sw-accent: #1b86b6;
  --sw-accent-ink: #ffffff;
  --sw-owned: #27a35b;
  --sw-wish: #e0527a;
  --sw-shadow: 0 2px 10px rgba(20, 90, 120, 0.12);
  --sw-tile: rgba(255, 255, 255, 0.55);
  --sw-sheet: #f2fbfc;
  --sw-chip: rgba(255, 255, 255, 0.85);
  --sw-radius: 18px;
  --sw-font: "Nunito", ui-rounded, "SF Pro Rounded", "Hiragino Maru Gothic ProN",
    "Segoe UI", system-ui, -apple-system, sans-serif;

  position: relative;
  height: 100%;
  min-height: 100%;
  overflow: hidden;
  font-family: var(--sw-font);
  color: var(--sw-ink);
  background: linear-gradient(180deg, var(--sw-bg-top), var(--sw-bg-bottom));
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  -webkit-user-select: none;
}

.swdex.sw-dark {
  --sw-bg-top: #0f3443;
  --sw-bg-bottom: #12272f;
  --sw-card: rgba(255, 255, 255, 0.08);
  --sw-card-solid: #173a47;
  --sw-card-line: rgba(255, 255, 255, 0.14);
  --sw-ink: #9fdcef;
  --sw-ink-strong: #d3f2fb;
  --sw-ink-soft: #79b5c8;
  --sw-accent: #2aa3d6;
  --sw-shadow: 0 2px 10px rgba(0, 0, 0, 0.35);
  --sw-tile: rgba(255, 255, 255, 0.07);
  --sw-sheet: #12303b;
  --sw-chip: rgba(30, 70, 85, 0.92);
}

.swdex *, .swdex *::before, .swdex *::after { box-sizing: border-box; }
/* Reset host button styles too (Obsidian gives every button a fixed height, inline-flex row, nowrap, shadow). */
.swdex button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; padding: 0;
  height: auto; min-height: 0; box-shadow: none; white-space: normal; line-height: inherit; text-align: inherit; }
.swdex img { -webkit-user-drag: none; }

.swdex .sw-scroll {
  position: absolute;
  inset: 0;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  padding: calc(env(safe-area-inset-top, 0px) + 14px) 14px calc(env(safe-area-inset-bottom, 0px) + 170px);  /* clear of the search + menu buttons */
}
.swdex .sw-wrap { max-width: 760px; margin: 0 auto; }

/* ---------- header ---------- */
.swdex .sw-top {
  display: flex; align-items: baseline; justify-content: space-between;
  padding: 18px 8px 16px; font-weight: 800; letter-spacing: 0.02em; gap: 10px;
}
.swdex .sw-top h1 { margin: 0; font-size: 21px; font-weight: 800; text-transform: uppercase; color: var(--sw-ink);
  display: flex; align-items: center; gap: 9px; }
.swdex .sw-logo { width: 30px; height: 30px; flex: 0 0 auto; display: block; box-shadow: 0 2px 6px rgba(0,0,0,0.18); border-radius: 7px; }
.swdex .sw-top .sw-count { font-size: 18px; }
.swdex .sw-top-end { display: flex; align-items: center; gap: 8px; align-self: center; white-space: nowrap; }
.swdex .sw-top-end .sw-count { margin-right: 4px; }
.swdex .sw-theme {
  width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center; padding: 0;
  background: var(--sw-chip); border: 2px solid var(--sw-card-line); box-shadow: var(--sw-shadow); color: var(--sw-ink-strong);
}
.swdex .sw-theme svg { width: 22px; height: 22px; }
.swdex .sw-lang { font: inherit; font-size: 14px; font-weight: 800; letter-spacing: 0.04em; }
.swdex .sw-sub { font-size: 12px; font-weight: 700; color: var(--sw-ink-soft); margin: -10px 8px 14px; }

/* ---------- region cards (home) ---------- */
.swdex .sw-region {
  position: relative; display: block; width: 100%; text-align: left;
  height: 150px; margin: 0 0 12px; border-radius: 24px; overflow: hidden;
  background: var(--sw-card-solid);
  border: 4px solid var(--sw-card-line);
  box-shadow: var(--sw-shadow);
  container-type: inline-size;  /* cqw below = card width, to keep the text left of the slanted art edge */
}
.swdex .sw-region.is-complete { border-color: #d9dde0; box-shadow: 0 0 0 2px #b9c2c7 inset, var(--sw-shadow); }
.swdex .sw-region-art {
  position: absolute; top: 0; right: 0; bottom: 0; width: 64%;
  clip-path: polygon(22% 0, 100% 0, 100% 100%, 0 100%);
  /* pastel base so multiply-blended renders keep their own colours */
  background-color: color-mix(in srgb, var(--rc, #2aa6dc) 32%, #ffffff);
  background-image:
    linear-gradient(115deg, var(--rc, #2aa6dc) 0 8%, rgba(255,255,255,0.9) 8% 10%, transparent 10%),
    repeating-linear-gradient(0deg, color-mix(in srgb, var(--rc, #2aa6dc) 18%, transparent) 0 6px, transparent 6px 12px),
    repeating-linear-gradient(90deg, color-mix(in srgb, var(--rc, #2aa6dc) 18%, transparent) 0 6px, transparent 6px 12px);
}
/* landscape photo (LANDSCAPES in dex.js) instead of pattern + figure row; white behind it */
.swdex .sw-region-art.is-photo {
  /* capped width on wide screens: a less letterbox-shaped panel crops less off the photo's top and bottom */
  width: min(64%, 420px);
  /* --y: which part survives when the panel is wider than the photo (0% top .. 100% feet) */
  background: #fff center var(--y, 92%) / cover no-repeat;
}
.swdex .sw-region[data-id="all"] .sw-region-art.is-photo { --y: 100%; }
.swdex .sw-region[data-id="kanto"] .sw-region-art.is-photo { --y: 50%; }
.swdex .sw-region[data-id="johto"] .sw-region-art.is-photo { --y: 45%; }
/* trainer right, two Pokémon to its left, evenly spaced and standing on one baseline */
.swdex .sw-region-figs {
  position: absolute; left: 16%; right: 2%; top: 10%; bottom: 7%;
  display: flex; flex-direction: row-reverse; justify-content: space-evenly; align-items: flex-end; gap: 2%;
}
.swdex .sw-region-fig { flex: 1 1 0; min-width: 0; height: 100%; display: flex; align-items: flex-end; justify-content: center; }
.swdex .sw-region-fig img { display: block; max-width: 100%; max-height: 100%; object-fit: contain; object-position: bottom; }
/* blend every figure into the pattern: white (photo backgrounds, display bases, floor shadows) disappears */
.swdex .sw-region-fig img { mix-blend-mode: multiply; }
.swdex .sw-region-art { isolation: isolate; }
/* hand-picked row (REGION_PICKS): every card shares one scale. --H = height of a full-size
   figure: the row height, or less when the home screen's widest row (--sum, in row heights)
   would not fit the width. Each figure: --u (its size, 0..1) and --r (photo width / height). */
.swdex .sw-region-figs.is-row {
  flex-direction: row; left: 18%; right: 2%; gap: 0; justify-content: space-evenly; container-type: size;
}
.swdex .sw-region-figs.is-row .sw-region-fig {
  --H: min(100cqh, calc(92cqw / var(--sum)));
  flex: none; height: calc(var(--u) * var(--H)); width: calc(var(--u) * var(--H) * var(--r));
}
.swdex .sw-region-figs.is-row .sw-region-fig img { width: 100%; height: 100%; max-width: none; }
.swdex .sw-region-text { position: relative; z-index: 1; padding: 20px 22px; }
.swdex .sw-region-name { font-size: 28px; font-weight: 800; text-transform: uppercase; color: var(--sw-ink);
  line-height: 30px; height: 30px; white-space: nowrap;  /* fixed px: the text below stays put when the language (font size) changes */
  /* room left of the art edge at the name's baseline (art = 64% wide, slant = 22% of it; ~35% down the card);
     fitRegionNames() in dex.js shrinks the font of a name wider than this */
  max-width: calc(100cqw - 0.857 * 64cqw - 36px); }
.swdex .sw-region-ja { font-size: 12px; font-weight: 700; color: var(--sw-ink-soft); margin-top: 2px; }
.swdex .sw-region-progress { font-size: 22px; font-weight: 800; margin-top: 8px; color: var(--sw-ink); }
.swdex .sw-bar { width: min(150px, calc(100cqw - 0.91 * 64cqw - 30px)); height: 9px; border-radius: 9px; background: rgba(27,134,182,0.18); margin-top: 8px; overflow: hidden; }
.swdex .sw-bar > i { display: block; height: 100%; background: var(--sw-accent); border-radius: 9px; }
.swdex .sw-done { font-size: 15px; font-weight: 700; color: var(--sw-ink); margin-top: 4px; }

/* ---------- grid header card ---------- */
.swdex .sw-statcard {
  background: var(--sw-card); border: 2px solid var(--sw-card-line); border-radius: 26px;
  padding: 16px 18px 14px; margin: 4px 0 14px; box-shadow: var(--sw-shadow);
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
}
.swdex .sw-stat-head { display: flex; align-items: center; gap: 10px; }
.swdex .sw-back { flex: 0 0 auto; width: 52px; height: 52px; border-radius: 50%; display: grid; place-items: center; color: var(--sw-ink-strong);
  background: var(--sw-chip); border: 2px solid var(--sw-card-line); box-shadow: var(--sw-shadow); }
.swdex .sw-back svg { width: 26px; height: 26px; }
.swdex .sw-stat-head { flex-wrap: wrap; padding-right: 100px; min-height: 42px; }
/* language + theme, top right of the card (like the figure page's top bar) */
.swdex .sw-statcard { position: relative; }
.swdex .sw-grid-tools { position: absolute; top: 12px; right: 12px; display: flex; gap: 8px; }
.swdex .sw-stat-title { font-weight: 800; font-size: 19px; text-transform: uppercase; flex: 1 1 auto; min-width: min-content; line-height: 1.15; }
.swdex .sw-stat-filter { color: var(--sw-ink-soft); white-space: nowrap; }
/* phone: region name on one line (fitTitle() shrinks it if it doesn't fit), filter on the next, no separator */
@media (max-width: 640px) {
  .swdex .sw-stat-title { min-width: 0; }
  .swdex .sw-stat-name { display: block; white-space: nowrap; }
  .swdex .sw-stat-filter { display: block; }
  .swdex .sw-stat-sep { display: none; }
}
.swdex .sw-pill { background: var(--sw-accent); color: var(--sw-accent-ink); font-weight: 800; font-size: 20px; padding: 3px 18px; border-radius: 30px; white-space: nowrap; }
/* five across when there is room, else wrap into rows (narrow phone + rail) */
.swdex .sw-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(70px, 1fr)); row-gap: 10px; margin-top: 14px; text-align: center; }
.swdex .sw-stats span { display: block; line-height: 1.2; }
.swdex .sw-stats b { display: block; font-size: 24px; font-weight: 800; line-height: 1.1; }
.swdex .sw-stats span { font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.02em; }

/* ---------- tiles ---------- */
.swdex .sw-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 9px; }
@media (max-width: 380px) { .swdex .sw-grid { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 640px) { .swdex .sw-grid { grid-template-columns: repeat(5, 1fr); } }
.swdex .sw-tile {
  position: relative; aspect-ratio: 3 / 4; border-radius: 14px;
  background: var(--sw-tile); border: 2px solid var(--sw-card-line);
  display: flex; flex-direction: column; align-items: center; justify-content: flex-end;
  padding: 6px 4px 7px; overflow: hidden;
}
.swdex .sw-tile:active { transform: scale(0.97); }
/* light: an opaque tile (about the see-through one over the page gradient), so the multiply-blended
   render has a solid backdrop in its own layer. Over a see-through one, iOS Safari (which composites
   the scroller separately) keeps the photo's white box. */
.swdex:not(.sw-dark) .sw-tile { background: #e8f8f9; }
/* panel box (radius, margin) the same in both themes, so switching theme doesn't resize the picture */
.swdex .sw-tile-img { flex: 1; width: 100%; min-height: 0; display: flex; align-items: center; justify-content: center; border-radius: 10px; margin-bottom: 4px; }
.swdex .sw-tile-img img { max-width: 92%; max-height: 92%; object-fit: contain; mix-blend-mode: multiply; }
/* dark: renders sit on white, so give every tile the same white panel */
.swdex.sw-dark .sw-tile-img { background: #f3f8f9; }
.swdex.sw-dark .sw-hero img { mix-blend-mode: normal; border-radius: 18px; background: #fff; }
.swdex .sw-tile-no { font-size: 17px; font-weight: 600; color: var(--sw-ink); line-height: 1.1; }
.swdex .sw-tile-name { font-size: 12px; font-weight: 800; color: var(--sw-ink); line-height: 1.1; text-align: center; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.swdex .sw-tile-badges { position: absolute; top: 5px; left: 5px; right: 5px; display: flex; justify-content: space-between; pointer-events: none; }
.swdex .sw-dot { min-width: 20px; height: 20px; border-radius: 10px; font-size: 11px; font-weight: 800; display: grid; place-items: center; padding: 0 5px; color: #fff; }
.swdex .sw-dot.own { background: var(--sw-owned); }
.swdex .sw-dot.part { background: #f0a432; }
.swdex .sw-dot.wish { background: var(--sw-wish); }
.swdex .sw-dot.multi { background: rgba(27,134,182,0.8); }
.swdex.sw-dim .sw-tile.is-missing .sw-tile-img img { filter: grayscale(1) opacity(0.45); }
.swdex .sw-section { font-weight: 800; font-size: 13px; text-transform: uppercase; letter-spacing: 0.05em; margin: 18px 6px 8px; color: var(--sw-ink-soft); }
.swdex .sw-empty { text-align: center; padding: 40px 10px; font-weight: 700; color: var(--sw-ink-soft); }

/* ---------- bottom bar ---------- */
.swdex .sw-bottom {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 5;
  padding: 0 12px calc(env(safe-area-inset-bottom, 0px) + 12px);
  pointer-events: none;
}
.swdex .sw-chips { display: flex; gap: 8px; overflow-x: auto; pointer-events: auto; padding: 4px 2px 10px; }
.swdex .sw-chips::-webkit-scrollbar { display: none; }
.swdex .sw-chip {
  flex: 0 0 auto; padding: 11px 22px; border-radius: 30px; font-weight: 800; font-size: 15px;
  text-transform: uppercase; background: var(--sw-chip); color: var(--sw-ink-soft);
  box-shadow: var(--sw-shadow); border: 2px solid var(--sw-card-line);
}
.swdex .sw-chip.on { background: var(--sw-accent); color: var(--sw-accent-ink); border-color: rgba(255,255,255,0.7); }
/* filters as a rail of 56px icon circles on the left, above search / menu and the same width,
   so they never cover the tiles; the name is the tooltip and, for the active one, in the header card */
.swdex.has-rail .sw-chips {
  position: absolute; left: 12px; bottom: calc(env(safe-area-inset-bottom, 0px) + 144px);
  flex-direction: column; width: 56px; overflow: visible; padding: 0; gap: 8px;
}
.swdex.has-rail .sw-chip { width: 56px; height: 56px; padding: 0; border-radius: 50%; display: grid; place-items: center; }
.swdex .sw-chip-ico svg { width: 24px; height: 24px; display: block; }
/* back button: top of the left rail, outside the header, always in reach */
.swdex .sw-nav { position: absolute; z-index: 6; top: calc(env(safe-area-inset-top, 0px) + 18px); left: 12px; }
.swdex .sw-nav .sw-back { width: 56px; height: 56px; }
.swdex.has-rail .sw-wrap { padding-left: 76px; }
@media (max-width: 640px) { .swdex.has-rail .sw-grid { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 330px) { .swdex.has-rail .sw-grid { grid-template-columns: repeat(2, 1fr); } }
/* short screens (iPhone SE): smaller circles so the rail clears the back button */
@media (max-height: 700px) {
  .swdex.has-rail .sw-chips { gap: 6px; }
  .swdex.has-rail .sw-chip { width: 48px; height: 48px; margin-left: 4px; }
  .swdex.has-rail .sw-chip-ico svg { width: 22px; height: 22px; }
}
/* search over menu, both on the left edge; the search field opens to the right of its button */
.swdex .sw-fabs { display: flex; flex-direction: column; align-items: flex-start; gap: 10px; pointer-events: none; padding: 0; }
.swdex .sw-fab-row { display: flex; align-items: center; width: 100%; max-width: 560px; }
.swdex .sw-fab {
  pointer-events: auto; width: 56px; height: 56px; border-radius: 50%;
  background: var(--sw-chip); border: 2px solid var(--sw-card-line); box-shadow: var(--sw-shadow);
  display: grid; place-items: center; color: var(--sw-ink-strong);
}
.swdex .sw-fab svg { width: 26px; height: 26px; }
.swdex .sw-search {
  pointer-events: auto; flex: 0 1 250px; margin: 0 10px; height: 50px; border-radius: 30px; padding: 0 18px;
  border: 2px solid var(--sw-card-line); background: var(--sw-chip); color: var(--sw-ink-strong);
  font: 700 16px var(--sw-font); box-shadow: var(--sw-shadow); outline: none; min-width: 0;
  user-select: text; -webkit-user-select: text;
}

/* ---------- detail sheet ---------- */
.swdex .sw-sheet {
  position: absolute; inset: 0; z-index: 10; background: var(--sw-sheet);
  overflow-y: auto; -webkit-overflow-scrolling: touch;
  animation: sw-up 0.22s ease-out;
  padding-bottom: calc(env(safe-area-inset-bottom, 0px) + 30px);
  user-select: text; -webkit-user-select: text;
}
@keyframes sw-up { from { transform: translateY(24px); opacity: 0; } to { transform: none; opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .swdex .sw-sheet { animation: none; } }
.swdex .sw-hero {
  position: relative; height: 300px;
  background: radial-gradient(circle at 50% 60%, #ffffff 0, #e4f7fa 55%, #c9eef4 100%);
  display: flex; align-items: center; justify-content: center;
  padding-top: env(safe-area-inset-top, 0px);
}
.swdex.sw-dark .sw-hero { background: radial-gradient(circle at 50% 60%, #2b5868 0, #173a47 70%); }
/* padding in both themes (dark shows it as a white frame), so switching theme doesn't resize the picture */
.swdex .sw-hero img { max-height: 240px; max-width: 82%; object-fit: contain; mix-blend-mode: multiply; padding: 10px; }
/* sheet top bar: language, theme, close */
.swdex .sw-sheet-tools { display: flex; align-items: center; gap: 8px; }
.swdex .sw-hero .sw-sheet-tools { position: absolute; top: calc(env(safe-area-inset-top, 0px) + 12px); right: 14px; z-index: 1; }
.swdex .sw-close {
  flex: 0 0 auto; width: 44px; height: 44px; border-radius: 50%; background: rgba(255,255,255,0.85);
  box-shadow: var(--sw-shadow); display: grid; place-items: center; color: #1d6f8f; font-size: 24px; font-weight: 700;
}
/* prev / next character (the grid's order), at the sides of the hero picture */
.swdex .sw-step {
  position: absolute; top: 55%; transform: translateY(-50%); z-index: 1;
  width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center;
  background: rgba(255,255,255,0.85); box-shadow: var(--sw-shadow); color: #1d6f8f;
}
.swdex .sw-step svg { width: 22px; height: 22px; }
.swdex .sw-step.prev { left: 12px; }
.swdex .sw-step.next { right: 12px; }
.swdex .sw-step[disabled] { opacity: 0.3; cursor: default; }
.swdex .sw-step:not([disabled]):active { transform: translateY(-50%) scale(0.94); }
.swdex .sw-hero-no { position: absolute; left: 18px; top: calc(env(safe-area-inset-top, 0px) + 16px); font-weight: 800; font-size: 18px; color: var(--sw-ink-soft); }
.swdex .sw-body { max-width: 720px; margin: 0 auto; padding: 0 16px; }
.swdex .sw-name { text-align: center; margin: 14px 0 0; font-size: 30px; font-weight: 800; color: var(--sw-ink-strong); line-height: 1.1; }
.swdex .sw-name-ja { text-align: center; font-size: 15px; font-weight: 700; color: var(--sw-ink-soft); margin-top: 4px; }
.swdex .sw-romaji { font-weight: 600; font-style: italic; }
.swdex .sw-types { display: flex; justify-content: center; gap: 8px; margin-top: 10px; }
.swdex .sw-type { background: var(--tc); color: #fff; font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.04em;
  padding: 4px 14px; border-radius: 20px; text-shadow: 0 1px 1px rgba(0,0,0,0.35); }
.swdex .sw-types { flex-wrap: wrap; }
.swdex button.sw-type { cursor: pointer; }
.swdex button.sw-type:active { transform: scale(0.96); }
.swdex .sw-status { text-transform: none; letter-spacing: 0.01em; font-size: 13px; }
.swdex .sw-status.st-legendary { --tc: #c99a12; }
.swdex .sw-status.st-mythical { --tc: #d1497a; }
.swdex .sw-status.st-powerhouse { --tc: #3d7fa6; }
.swdex .sw-role { --tc: #5f7d8c; text-transform: none; letter-spacing: 0.01em; font-size: 13px; }
.swdex .sw-role.role-protagonist { --tc: #1b86b6; }
.swdex .sw-role.role-rival { --tc: #c8553d; }
.swdex .sw-role.role-champion { --tc: #c99a12; }
.swdex .sw-role.role-professor { --tc: #3c9a6b; }
.swdex .sw-role.role-boss { --tc: #4a3b5c; }
.swdex .sw-role.role-teammz { --tc: #d1497a; }
.swdex .sw-tile-role { font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.03em; color: var(--sw-ink-soft);
  line-height: 1.2; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-bottom: 1px; }
/* evolution line */
.swdex .sw-evos { display: flex; align-items: center; gap: 4px; overflow-x: auto; padding: 12px 10px; }
.swdex .sw-evos::-webkit-scrollbar { display: none; }
.swdex .sw-evo-stage { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; flex: 0 1 auto; min-width: 76px; max-width: 100%; }
.swdex .sw-evo-arrow { flex: 0 0 auto; font-size: 24px; font-weight: 800; color: var(--sw-ink-soft); padding: 0 2px; }
.swdex .sw-evo { width: 76px; display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 5px 3px;
  border-radius: 14px; border: 2px solid transparent; text-align: center; }
.swdex .sw-evo.on { border-color: var(--sw-accent); }
.swdex .sw-evo-img { width: 60px; height: 60px; border-radius: 12px; background: #fff; display: grid; place-items: center; overflow: hidden;
  font-size: 22px; font-weight: 800; color: #b9c2c7; }
/* px, not %: a % max-size doesn't stop the grid track growing to the photo's natural size, which then gets clipped */
.swdex .sw-evo-img img { display: block; max-width: 54px; max-height: 54px; object-fit: contain; }
.swdex .sw-evo-name { font-size: 11px; font-weight: 800; line-height: 1.15; color: var(--sw-ink); }
.swdex .sw-evo.is-none { opacity: 0.45; }
.swdex.sw-dark .sw-evo-img { background: #f3f8f9; }
.swdex .sw-figtabs { display: flex; gap: 8px; overflow-x: auto; padding: 14px 2px 6px; }
.swdex .sw-figtabs::-webkit-scrollbar { display: none; }
/* centred rows that still scroll from the first item when they overflow (auto margins, unlike justify-content) */
.swdex .sw-figtabs > :first-child, .swdex .sw-evos > :first-child { margin-left: auto; }
.swdex .sw-figtabs > :last-child, .swdex .sw-evos > :last-child { margin-right: auto; }
.swdex .sw-figtab {
  flex: 0 0 auto; width: 74px; border-radius: 14px; background: var(--sw-card);
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  border: 2px solid transparent; padding: 4px 4px 5px; text-align: center; font-size: 10px; font-weight: 800; position: relative;
}
.swdex .sw-figtab.on { border-color: var(--sw-accent); background: #fff; }
.swdex.sw-dark .sw-figtab.on { background: rgba(255,255,255,0.12); }
.swdex .sw-figtab img { width: 100%; height: 56px; object-fit: contain; mix-blend-mode: multiply; display: block; }
.swdex.sw-dark .sw-figtab img { mix-blend-mode: normal; }
.swdex .sw-figtab .sw-dot { position: absolute; top: 3px; right: 3px; min-width: 14px; height: 14px; font-size: 9px; padding: 0 3px; }

.swdex .sw-card { background: var(--sw-card); border: 2px solid var(--sw-card-line); border-radius: var(--sw-radius); padding: 14px 16px; margin: 12px 0; box-shadow: var(--sw-shadow); }
/* menu: keyboard shortcut list; not on touch-only devices */
.swdex .sw-keylist { display: grid; gap: 6px; font-size: 13px; font-weight: 700; color: var(--sw-ink); }
.swdex .sw-keylist > div { display: flex; align-items: center; gap: 10px; }
.swdex .sw-keylist kbd { flex: 0 0 auto; min-width: 74px; text-align: center; font: 800 12px/1 ui-monospace, monospace; padding: 5px 6px;
  border-radius: 7px; background: var(--sw-chip); border: 1px solid var(--sw-card-line); color: var(--sw-ink-strong); }
@media (hover: none) and (pointer: coarse) { .swdex .sw-keys { display: none; } }
/* menu: donation QR (DONATE_QR); white tile so the code scans in dark mode too */
.swdex .sw-donate { text-align: center; }
.swdex .sw-donate img { display: block; width: min(240px, 100%); margin: 2px auto 10px; padding: 10px; background: #fff; border-radius: 14px; }
.swdex .sw-donate .sw-note { margin-top: 4px; }
/* Ko-fi button (KOFI_URL), Ko-fi's own coral so it reads as their button */
.swdex .sw-kofi { display: inline-block; margin: 14px auto 0; padding: 9px 18px; border-radius: 999px; background: #ff5e5b; color: #fff; font-weight: 800; font-size: 14px; text-decoration: none; }
.swdex .sw-kofi:hover { filter: brightness(1.06); }
.swdex .sw-facts { display: grid; grid-template-columns: repeat(3, 1fr); text-align: center; gap: 4px; }
.swdex .sw-facts b { display: block; font-size: 19px; font-weight: 800; color: var(--sw-ink-strong); }
.swdex .sw-facts span { font-size: 11px; font-weight: 800; text-transform: uppercase; color: var(--sw-ink-soft); }
.swdex .sw-label { text-align: center; font-weight: 800; font-size: 14px; color: var(--sw-ink); margin: 2px 0 10px; }
.swdex .sw-toggles { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 12px; }
.swdex .sw-toggle {
  border-radius: 30px; padding: 12px 10px; font-weight: 800; font-size: 15px; text-transform: uppercase;
  background: rgba(27,134,182,0.10); color: var(--sw-ink); border: 2px solid transparent; text-align: center;
}
.swdex .sw-toggle.own.on { background: var(--sw-owned); color: #fff; }
.swdex .sw-toggle.wish.on { background: var(--sw-wish); color: #fff; }
.swdex .sw-h { font-size: 13px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.05em; color: var(--sw-ink-soft); margin: 20px 4px 4px; }

.swdex .sw-rel { display: flex; gap: 12px; align-items: flex-start; padding: 12px 0; border-top: 1px solid rgba(27,134,182,0.14); }
.swdex .sw-rel:first-of-type { border-top: 0; }
.swdex .sw-rel-img { flex: 0 0 76px; width: 76px; height: 76px; border-radius: 12px; overflow: hidden; background: #fff; }
.swdex .sw-rel-img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.swdex .sw-rel-main { flex: 1; min-width: 0; }
.swdex .sw-rel-name { font-weight: 800; font-size: 14px; color: var(--sw-ink-strong); line-height: 1.25; }
.swdex .sw-rel-ja { font-size: 12px; font-weight: 600; color: var(--sw-ink-soft); margin-top: 2px; line-height: 1.3; }
.swdex .sw-rel-meta { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 7px; align-items: center; }
.swdex .sw-tag { font-size: 11px; font-weight: 800; padding: 3px 9px; border-radius: 20px; background: rgba(27,134,182,0.12); color: var(--sw-ink); white-space: nowrap; }
/* a long tag ("Supermarkets & mass retailers (candy aisle)") wraps instead of running off a phone screen */
.swdex .sw-rel-meta .sw-tag { white-space: normal; max-width: 100%; overflow-wrap: anywhere; }
.swdex .sw-tag.price { background: #fff3d6; color: #8a5a00; }
.swdex.sw-dark .sw-tag.price { background: #4a3a14; color: #ffd98a; }
.swdex .sw-tag.re { background: #fde3ea; color: #b2264f; }
.swdex .sw-tag.soon { background: #ffe6d3; color: #a84a10; }
.swdex.sw-dark .sw-tag.soon { background: #52301a; color: #ffc79e; }
.swdex.sw-dark .sw-tag.re { background: #4d1d2b; color: #ffadc4; }
.swdex .sw-tag.ch-pbandai, .swdex .sw-tag.ch-pbandai_std { background: #e9e3ff; color: #4b33a8; }
.swdex .sw-tag.ch-supermarket { background: #dff5e6; color: #1d7a42; }
.swdex .sw-tag.ch-convenience { background: #fff0dc; color: #9a5300; }
.swdex .sw-tag.ch-hobby, .swdex .sw-tag.ch-pokecen { background: #ffe3e0; color: #a3291b; }
.swdex.sw-dark .sw-tag[class*="ch-"] { background: rgba(255,255,255,0.1); color: var(--sw-ink-strong); }
.swdex .sw-rel a { color: var(--sw-accent); font-size: 12px; font-weight: 800; text-decoration: none; margin-right: 12px; }
.swdex .sw-note { font-size: 11px; font-weight: 600; color: var(--sw-ink-soft); margin-top: 6px; line-height: 1.4; }

/* ---------- menu ---------- */
.swdex .sw-menu { display: grid; gap: 8px; }
.swdex .sw-menu button, .swdex .sw-menu label {
  display: flex; justify-content: space-between; align-items: center; width: 100%;
  padding: 13px 16px; border-radius: 14px; background: var(--sw-card); border: 2px solid var(--sw-card-line);
  font-weight: 800; font-size: 15px; color: var(--sw-ink-strong); text-align: left; cursor: pointer;
}
.swdex .sw-menu input[type="checkbox"] { width: 20px; height: 20px; accent-color: var(--sw-accent); }
.swdex .sw-sort { display: flex; gap: 6px; flex-wrap: wrap; }
.swdex .sw-sort button { padding: 8px 14px; border-radius: 20px; background: var(--sw-card); font-weight: 800; font-size: 13px; border: 2px solid var(--sw-card-line); }
.swdex .sw-sort button.on { background: var(--sw-accent); color: #fff; }
