/* Soul link deck — Pokémon-adjacent styling; soft/cute, not official assets */

@import url("https://fonts.googleapis.com/css2?family=Nunito:wght@400;600;700;800&family=JetBrains+Mono:wght@400;600&display=swap");

:root {
  /* Warm “three brothers” palette: ginger / ember, water, grass */
  --cream: #fff6ee;
  --cream-dark: #f2e4d4;
  --ink: #2a1f28;
  --ink-soft: #5c4a52;
  --accent: #e85d2c;
  --accent-2: #2a8fbd;
  --danger: #d94a5c;
  --card: rgba(255, 255, 255, 0.82);
  --card-edge: rgba(90, 78, 120, 0.12);
  --shadow: 0 8px 32px rgba(42, 36, 56, 0.12);
  --shadow-nav: 0 4px 24px rgba(42, 36, 56, 0.08);
  --radius: 18px;
  --radius-sm: 12px;
  --font: "Nunito", system-ui, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, monospace;
  --touch-min: 44px;
  --nav-sticky-offset: max(0.5rem, env(safe-area-inset-top, 0px));

  --t-normal: #a8a878;
  --t-fire: #f08030;
  --t-water: #6890f0;
  --t-electric: #f8d030;
  --t-grass: #78c850;
  --t-ice: #98d8d8;
  --t-fighting: #c03028;
  --t-poison: #a040a0;
  --t-ground: #e0c068;
  --t-flying: #a890f0;
  --t-psychic: #f85888;
  --t-bug: #a8b820;
  --t-rock: #b8a038;
  --t-ghost: #705898;
  --t-dragon: #7038f8;
  --t-dark: #705848;
  --t-steel: #b8b8d0;
}

[data-theme="dark"] {
  /* Slate-blue dark palette matching three brothers glow */
  --cream: #0b0f19;
  --cream-dark: #121824;
  --ink: #f1f5f9;
  --ink-soft: #94a3b8;
  --card: rgba(18, 24, 38, 0.85);
  --card-edge: rgba(255, 255, 255, 0.08);
  --shadow: 0 8px 32px rgba(0, 0, 0, 0.35);
  --shadow-nav: 0 4px 24px rgba(0, 0, 0, 0.25);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  font-size: 16px;
  color-scheme: light;
}

[data-theme="dark"] {
  color-scheme: dark;
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  font-family: var(--font);
  color: var(--ink);
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  background: var(--cream);
  background-image:
    radial-gradient(ellipse 110% 70% at 8% -5%, rgba(232, 93, 44, 0.16), transparent 52%),
    radial-gradient(ellipse 90% 55% at 96% 5%, rgba(42, 143, 189, 0.14), transparent 48%),
    radial-gradient(circle at 48% 102%, rgba(104, 168, 72, 0.12), transparent 42%),
    repeating-linear-gradient(
      -8deg,
      transparent,
      transparent 12px,
      rgba(90, 60, 50, 0.028) 12px,
      rgba(90, 60, 50, 0.028) 13px
    );
  transition: background-color 0.3s ease, color 0.3s ease;
}

[data-theme="dark"] body {
  background-image:
    radial-gradient(ellipse 110% 70% at 8% -5%, rgba(232, 93, 44, 0.25), transparent 52%),
    radial-gradient(ellipse 90% 55% at 96% 5%, rgba(42, 143, 189, 0.22), transparent 48%),
    radial-gradient(circle at 48% 102%, rgba(104, 168, 72, 0.18), transparent 42%),
    repeating-linear-gradient(
      -8deg,
      transparent,
      transparent 12px,
      rgba(255, 255, 255, 0.015) 12px,
      rgba(255, 255, 255, 0.015) 13px
    );
}


a {
  color: var(--accent-2);
  font-weight: 600;
}

a:focus-visible,
button:focus-visible,
select:focus-visible,
textarea:focus-visible,
summary:focus-visible {
  outline: 2px solid var(--accent-2);
  outline-offset: 2px;
}

.deck-wrap {
  max-width: 72rem;
  width: 100%;
  margin: 0 auto;
  padding-right: max(1rem, env(safe-area-inset-right));
  padding-bottom: calc(3rem + env(safe-area-inset-bottom));
  padding-left: max(1rem, env(safe-area-inset-left));
  padding-top: calc(max(1rem, env(safe-area-inset-top)) + 3rem);
}

@media (min-width: 900px) {
  .deck-wrap {
    padding-left: max(1.5rem, env(safe-area-inset-left));
    padding-right: max(1.5rem, env(safe-area-inset-right));
    padding-top: calc(max(1.25rem, env(safe-area-inset-top)) + 3rem);
  }
}

/* Data source + .sav upload — matches .deck-nav / .pill theming (frosted strip, mono data, gradient CTA) */
.deck-source-bar {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin-bottom: 0.85rem;
  padding: 0;
  background: transparent;
  border: none;
  border-radius: 0;
  box-shadow: none;
  font-family: var(--font);
  font-size: 0.875rem;
}

.deck-import-toolbar-label {
  margin: 0;
  font-size: 0.62rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-weight: 800;
  color: var(--ink-soft);
  line-height: 1;
}

.deck-upload-toolbar-heading {
  margin-bottom: 0.3rem;
}

.deck-dev-chip {
  margin: 0 0 0.45rem;
  padding: 0.35rem 0.55rem;
  border-radius: var(--radius-sm);
  font-size: 0.72rem;
  font-weight: 600;
  color: #2a4a6b;
  background: rgba(90, 159, 212, 0.14);
  border: 1px solid rgba(74, 139, 194, 0.25);
  max-width: 42rem;
  line-height: 1.35;
}

.deck-upload-shell {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  max-width: 100%;
  padding: 0.35rem 0.45rem;
  gap: 0.35rem 0.55rem;
  background: rgba(255, 255, 255, 0.72);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-radius: 999px;
  border: 1px solid var(--card-edge);
  box-shadow: var(--shadow-nav);
}

@media (max-width: 719px) {
  .deck-upload-shell {
    width: 100%;
    border-radius: var(--radius-sm);
    justify-content: flex-start;
  }
}

.deck-upload-primary {
  display: contents;
}

.deck-upload-source-group {
  display: inline-flex;
  flex-direction: row;
  align-items: center;
  gap: 0.35rem;
}

.deck-upload-sav-group,
.deck-upload-sync-group {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 0.5rem;
}

.deck-upload-sync-save {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.deck-upload-folder-icon {
  flex-shrink: 0;
  opacity: 0.92;
}

.deck-upload-single-sav {
  min-height: 34px;
  padding: 0.28rem 0.7rem;
  border-radius: 999px;
  border: 1px solid var(--card-edge);
  font-family: var(--font);
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.9);
}

.deck-upload-single-sav:hover {
  border-color: rgba(124, 108, 240, 0.35);
}

.deck-upload-filename {
  font-family: var(--mono);
  font-size: 0.62rem;
  font-weight: 600;
  color: var(--ink-soft);
  max-width: 11rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.deck-upload-save-picker {
  min-height: 38px;
  padding: 0.32rem 0.85rem;
  border-radius: 999px;
  border: none;
  font-family: var(--font);
  font-size: 0.82rem;
  font-weight: 800;
  cursor: pointer;
  color: #fff;
  background: linear-gradient(135deg, var(--accent-2), #9b8cff);
  box-shadow: 0 4px 14px rgba(124, 108, 240, 0.32);
  transition: filter 0.15s, box-shadow 0.15s;
}

.deck-upload-save-picker:hover {
  filter: brightness(1.05);
  box-shadow: 0 5px 18px rgba(124, 108, 240, 0.38);
}

.deck-upload-folder-name {
  font-family: var(--mono);
  font-size: 0.62rem;
  font-weight: 600;
  color: var(--ink-soft);
  max-width: 10rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.deck-upload-save-picker:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  filter: none;
  box-shadow: none;
}

.deck-source-select {
  min-height: 38px;
  padding: 0.28rem 0.55rem;
  border-radius: 999px;
  border: 1px solid var(--card-edge);
  font-family: var(--mono);
  font-weight: 600;
  font-size: 0.68rem;
  background: rgba(255, 255, 255, 0.92);
  color: var(--ink);
  max-width: min(100%, 19rem);
  box-shadow: 0 2px 8px rgba(42, 36, 56, 0.06);
}

.deck-import-form {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.35rem;
  width: 100%;
}

.deck-import-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}

.deck-import-row input[type="file"] {
  max-width: min(100%, 13rem);
  font-size: 0.72rem;
  font-family: var(--mono);
  color: var(--ink-soft);
}

.deck-import-advanced {
  font-size: 0.8125rem;
  margin: 0;
  padding: 0 0.15rem;
}

.deck-import-advanced summary {
  cursor: pointer;
  font-family: var(--font);
  font-weight: 700;
  font-size: 0.78rem;
  color: var(--ink-soft);
  user-select: none;
  list-style-position: outside;
}

.deck-import-advanced summary:hover {
  color: var(--ink);
}

.deck-import-advanced-body {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin-top: 0.35rem;
  padding: 0.55rem 0.65rem;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.45);
  border: 1px dashed rgba(90, 78, 120, 0.18);
}

.deck-import-hint {
  margin: 0;
  font-family: var(--font);
  font-size: 0.65rem;
  line-height: 1.35;
  color: var(--ink-soft);
}

.deck-import-field-label {
  display: block;
  margin: 0;
  font-family: var(--font);
  font-weight: 800;
  font-size: 0.62rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--ink-soft);
}

.deck-import-base-json {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  font-family: var(--mono);
  font-size: 0.68rem;
  padding: 0.35rem 0.45rem;
  border-radius: 8px;
  border: 1px solid var(--card-edge);
  resize: vertical;
  min-height: 4rem;
  background: rgba(255, 255, 255, 0.75);
  color: var(--ink);
}

.deck-import-row-options {
  align-items: flex-start;
}

.deck-import-rom-select {
  min-height: 38px;
  padding: 0.28rem 0.55rem;
  border-radius: 999px;
  border: 1px solid var(--card-edge);
  font-family: var(--mono);
  font-weight: 600;
  font-size: 0.68rem;
  background: rgba(255, 255, 255, 0.92);
  color: var(--ink);
  box-shadow: 0 2px 8px rgba(42, 36, 56, 0.06);
}

.deck-import-checkbox-label {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-family: var(--font);
  font-weight: 700;
  font-size: 0.76rem;
  color: var(--ink-soft);
  cursor: pointer;
  flex: 1 1 10rem;
}

.deck-import-checkbox-label input {
  accent-color: var(--accent-2);
}

.deck-source-bar .deck-import-status {
  flex: 1 1 9rem;
  min-width: min(100%, 7rem);
  max-width: 100%;
  font-family: var(--mono);
  font-size: 0.65rem;
  font-weight: 600;
  line-height: 1.35;
  color: var(--ink-soft);
}

.deck-import-status.is-error {
  color: var(--danger);
  font-weight: 700;
}

/* Fixed “dodiesworld home” chip — matches main site layout.tsx treatment, tuned for light deck background */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.dw-home-link {
  position: fixed;
  left: 1rem;
  top: max(1rem, env(safe-area-inset-top));
  z-index: 50;
  display: inline-flex;
  align-items: center;
  border-radius: 9999px;
  border: 1px solid rgba(255, 255, 255, 0.35);
  background: rgba(255, 246, 238, 0.94);
  padding: 0.45rem 1rem;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--ink);
  box-shadow: var(--shadow), 0 4px 24px rgba(42, 36, 56, 0.18);
  backdrop-filter: blur(10px);
  text-decoration: none;
  transition:
    border-color 0.2s ease,
    background-color 0.2s ease,
    box-shadow 0.2s ease;
}

.dw-home-link:hover {
  border-color: rgba(42, 143, 189, 0.55);
  background: rgba(255, 255, 255, 0.98);
}

.dw-home-link-logo-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
  height: 2rem;
}

.dw-home-link-glow {
  position: absolute;
  inset: -6px -10px;
  border-radius: 9999px;
  background: rgba(255, 246, 238, 0.95);
  filter: blur(6px);
  opacity: 0.65;
  transition: opacity 0.2s ease;
  pointer-events: none;
}

.dw-home-link:hover .dw-home-link-glow {
  opacity: 1;
}

.dw-home-link-logo {
  position: relative;
  z-index: 1;
  display: block;
  height: 2rem;
  width: auto;
  filter: drop-shadow(0 0 6px rgba(255, 255, 255, 0.9));
}

@media (min-width: 640px) {
  .dw-home-link {
    left: 2rem;
    top: max(2rem, env(safe-area-inset-top));
  }
}

.deck-placeholder-banner {
  margin-bottom: 1rem;
  padding: 0.85rem 1.1rem;
  border-radius: var(--radius-sm);
  background: rgba(255, 193, 77, 0.22);
  border: 1px solid rgba(200, 150, 40, 0.35);
  color: #5a4510;
  font-size: 0.9rem;
  font-weight: 700;
  line-height: 1.45;
}

.deck-topbar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem 1.5rem;
  margin-bottom: 1.25rem;
}

@media (min-width: 640px) {
  .deck-topbar {
    align-items: center;
  }
}

.deck-brand {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.deck-brand-trio {
  display: flex;
  align-items: flex-end;
  gap: 0;
  flex-shrink: 0;
  padding: 0.15rem 0.35rem 0.05rem;
  border-radius: 16px;
  background: linear-gradient(
    145deg,
    rgba(232, 93, 44, 0.2),
    rgba(42, 143, 189, 0.16) 48%,
    rgba(104, 168, 72, 0.18)
  );
  border: 1px solid rgba(90, 60, 50, 0.12);
  box-shadow: var(--shadow);
}

.deck-brand-trio-sprite {
  width: 40px;
  height: 40px;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  margin: 0 -0.12rem;
  filter: drop-shadow(0 2px 2px rgba(42, 31, 40, 0.12));
}

.deck-brand h1 {
  margin: 0;
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.deck-brand p {
  margin: 0;
  font-size: 0.82rem;
  color: var(--ink-soft);
  font-weight: 600;
}

.deck-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.pill {
  font-family: var(--mono);
  font-size: 0.68rem;
  font-weight: 600;
  padding: 0.35rem 0.65rem;
  border-radius: 999px;
  background: var(--card);
  border: 1px solid var(--card-edge);
  color: var(--ink-soft);
  box-shadow: 0 2px 8px rgba(42, 36, 56, 0.06);
}

.pill strong {
  color: var(--ink);
}

.pill.run-active {
  border-color: rgba(62, 207, 142, 0.45);
  color: #1a7a52;
  background: rgba(62, 207, 142, 0.12);
}

.pill.run-lost {
  border-color: rgba(255, 92, 122, 0.45);
  color: #b22a40;
}

.deck-nav {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.45rem;
  margin-bottom: 1.75rem;
  padding: 0.55rem;
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-radius: var(--radius);
  border: 1px solid var(--card-edge);
  width: 100%;
  max-width: 100%;
  box-shadow: var(--shadow-nav), 0 0 0 1px rgba(124, 108, 240, 0.05);
}

@media (max-width: 719px) {
  .deck-nav {
    position: sticky;
    top: var(--nav-sticky-offset);
    z-index: 20;
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scroll-snap-type: x proximity;
    scrollbar-width: thin;
    gap: 0.4rem;
    padding: 0.45rem;
    box-shadow: var(--shadow-nav), 0 1px 0 rgba(90, 78, 120, 0.06);
  }

  .deck-nav a {
    flex: 1 1 0;
    min-width: 5.35rem;
    scroll-snap-align: start;
  }
}

.deck-nav a {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.38rem;
  text-decoration: none;
  color: var(--ink-soft);
  font-weight: 800;
  font-size: 0.78rem;
  line-height: 1.15;
  padding: 0.75rem 0.45rem;
  min-height: 4.75rem;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  text-align: center;
  transition: background 0.15s, color 0.15s, box-shadow 0.15s, border-color 0.15s, transform 0.12s;
  touch-action: manipulation;
}

.deck-nav-icon {
  display: grid;
  place-items: center;
  width: 2.65rem;
  height: 2.65rem;
  border-radius: 12px;
  background: radial-gradient(circle at 50% 68%, rgba(124, 108, 240, 0.14), rgba(255, 255, 255, 0.72));
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.95),
    0 2px 8px rgba(42, 36, 56, 0.06);
}

.deck-nav-sprite {
  width: 1.75rem;
  height: 1.75rem;
  object-fit: contain;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  filter: drop-shadow(0 2px 3px rgba(42, 36, 56, 0.14));
}

.deck-nav-label {
  max-width: 100%;
  padding: 0 0.15rem;
}

@media (min-width: 720px) {
  .deck-nav a {
    min-height: 5.35rem;
    padding: 0.95rem 0.55rem;
    font-size: 0.86rem;
  }

  .deck-nav-icon {
    width: 3rem;
    height: 3rem;
  }

  .deck-nav-sprite {
    width: 2rem;
    height: 2rem;
  }
}

.deck-nav a:hover {
  color: var(--ink);
  background: rgba(255, 255, 255, 0.96);
  border-color: rgba(124, 108, 240, 0.14);
}

@media (hover: none) {
  .deck-nav a:active {
    color: var(--ink);
    background: rgba(255, 255, 255, 0.92);
    transform: scale(0.98);
  }
}

.deck-nav a.is-active {
  color: #fff;
  background: linear-gradient(145deg, var(--accent-2), #7c6cf0 52%, #9b8cff);
  border-color: rgba(255, 255, 255, 0.22);
  box-shadow: 0 6px 18px rgba(124, 108, 240, 0.38);
}

.deck-nav a.is-active .deck-nav-icon {
  background: rgba(255, 255, 255, 0.2);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.35);
}

.deck-nav a.is-active .deck-nav-sprite {
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.22));
}

.panel {
  display: none;
  animation: deckFade 0.35s ease;
  scroll-margin-top: calc(var(--nav-sticky-offset) + 3.5rem);
}

.panel.is-visible {
  display: block;
}

@keyframes deckFade {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.section-title {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-weight: 800;
  color: var(--ink-soft);
  margin: 0 0 1rem;
}

.section-head-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

.section-head-row .section-title {
  margin: 0;
  flex: 1;
  min-width: min(240px, 100%);
}

.deck-pokemon-pc {
  margin-top: 2.25rem;
  padding-top: 1.75rem;
  border-top: 1px solid var(--card-edge);
}

.link-band {
  margin-bottom: 1.75rem;
}

.link-band-head {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.link-heart {
  font-size: 1rem;
}

.link-ball-icon {
  width: 22px;
  height: 22px;
  flex-shrink: 0;
  object-fit: contain;
  display: block;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

.link-band-head span {
  font-weight: 800;
  font-size: 0.95rem;
  color: var(--ink);
}

.link-trio {
  display: grid;
  gap: 1rem;
}

@media (min-width: 720px) {
  .link-trio {
    grid-template-columns: repeat(3, 1fr);
  }
}

.mon-card {
  background: var(--card);
  border-radius: var(--radius);
  border: 1px solid var(--card-edge);
  box-shadow: var(--shadow);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

@media (hover: hover) and (pointer: fine) {
  .mon-card:hover {
    border-color: rgba(124, 108, 240, 0.28);
    box-shadow: 0 12px 36px rgba(42, 36, 56, 0.14);
  }
}

.mon-card-head {
  padding: 0.5rem 0.85rem;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.95), var(--cream-dark));
  border-bottom: 1px solid var(--card-edge);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
}

.mon-card-head-start {
  min-width: 0;
  flex: 1;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
}

.mon-card-head-end {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.35rem;
  flex-shrink: 0;
}

.mon-player {
  font-size: 0.7rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--accent-2);
}

.mon-lv {
  font-family: var(--mono);
  font-size: 0.76rem;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: 0.03em;
  line-height: 1.25;
}

.mon-exp {
  font-family: var(--mono);
  font-size: 0.66rem;
  font-weight: 600;
  color: var(--ink-soft);
  line-height: 1.28;
}

.mon-card-head-lv-stack {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.06rem;
  min-width: 0;
}

.mon-sprite-wrap {
  flex: 1;
  display: grid;
  place-items: center;
  padding: 0.25rem;
  min-height: 130px;
  background: radial-gradient(circle at 50% 70%, rgba(124, 108, 240, 0.08), transparent 65%);
}

.mon-sprite {
  width: 130px;
  height: 130px;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  filter: drop-shadow(0 6px 12px rgba(42, 36, 56, 0.15));
  margin: -10px 0;
}

.mon-sprite.is-fallback {
  width: 80px;
  height: 80px;
  opacity: 0.35;
}

.mon-body {
  padding: 0.85rem 1rem 1rem;
}

.mon-names .nick {
  font-size: 1.15rem;
  font-weight: 800;
  margin: 0;
  letter-spacing: -0.02em;
  overflow-wrap: anywhere;
  word-break: break-word;
  hyphens: auto;
}

.mon-names .species {
  font-family: var(--mono);
  font-size: 0.8rem;
  color: var(--ink-soft);
  margin: 0.15rem 0 0;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.types-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: 0.65rem;
}

.type-pill {
  font-family: var(--mono);
  font-size: 0.62rem;
  font-weight: 700;
  padding: 0.2rem 0.45rem;
  border-radius: 6px;
  color: #fff;
  text-shadow: 0 1px 1px rgba(0, 0, 0, 0.25);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.type-normal {
  background: var(--t-normal);
}
.type-fire {
  background: var(--t-fire);
}
.type-water {
  background: var(--t-water);
}
.type-electric {
  background: var(--t-electric);
  color: #4a4020 !important;
  text-shadow: none;
}
.type-grass {
  background: var(--t-grass);
}
.type-ice {
  background: var(--t-ice);
  color: #305050 !important;
  text-shadow: none;
}
.type-fighting {
  background: var(--t-fighting);
}
.type-poison {
  background: var(--t-poison);
}
.type-ground {
  background: var(--t-ground);
  color: #4a4020 !important;
  text-shadow: none;
}
.type-flying {
  background: var(--t-flying);
}
.type-psychic {
  background: var(--t-psychic);
}
.type-bug {
  background: var(--t-bug);
  color: #303010 !important;
  text-shadow: none;
}
.type-rock {
  background: var(--t-rock);
  color: #303010 !important;
  text-shadow: none;
}
.type-ghost {
  background: var(--t-ghost);
}
.type-dragon {
  background: var(--t-dragon);
}
.type-dark {
  background: var(--t-dark);
}
.type-steel {
  background: var(--t-steel);
  color: #383850 !important;
  text-shadow: none;
}

.mon-meta-line {
  margin-top: 0.5rem;
  font-size: 0.8rem;
  color: var(--ink-soft);
}

.mon-meta-line--sub {
  margin-top: 0.25rem;
  font-size: 0.72rem;
}

.mon-detail-row {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.35rem 0.5rem;
  margin-top: 0.45rem;
  font-size: 0.8rem;
}

.mon-detail-k {
  font-weight: 800;
  font-size: 0.62rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-soft);
  min-width: 3.5rem;
}

.mon-detail-v {
  font-weight: 700;
  color: var(--ink);
}

.mon-detail-sub {
  font-weight: 600;
  color: var(--ink-soft);
  font-size: 0.76rem;
}

.tab-detail-note {
  margin: -0.35rem 0 0.85rem;
  font-size: 0.76rem;
  line-height: 1.45;
  color: var(--ink-soft);
  font-weight: 500;
}

.stats-ev-iv-note {
  margin: 0.65rem 0 0;
  font-size: 0.72rem;
  line-height: 1.4;
  color: var(--ink-soft);
  font-family: var(--mono);
}

.move-g3-cat {
  text-align: center;
}

.move-cat {
  display: inline-grid;
  place-items: center;
  min-width: 1.35rem;
  height: 1.35rem;
  padding: 0 0.25rem;
  border-radius: var(--radius-sm);
  font-size: 0.65rem;
  font-weight: 900;
  font-family: var(--mono);
  letter-spacing: -0.02em;
}

.move-cat--physical {
  background: rgba(232, 124, 90, 0.22);
  color: #9a3e28;
  border: 1px solid rgba(232, 124, 90, 0.35);
}

.move-cat--special {
  background: rgba(124, 108, 240, 0.15);
  color: #4b3e9a;
  border: 1px solid rgba(124, 108, 240, 0.28);
}

.move-pow {
  font-family: var(--mono);
  font-size: 0.75rem;
  font-weight: 600;
  text-align: right;
  color: var(--ink);
}

.split-grid {
  display: grid;
  gap: 1.25rem;
}

@media (min-width: 900px) {
  .split-grid {
    grid-template-columns: 1fr 1fr;
  }
}

.moves-stats-body {
  display: grid;
  gap: 1.25rem;
  align-items: start;
}

.moves-stats-moves {
  min-width: 0;
}

@media (min-width: 900px) {
  .moves-stats-body {
    grid-template-columns: minmax(0, 1fr) minmax(14rem, 20rem);
    gap: 1.35rem;
  }
}

.moves-stats-chart {
  min-width: 0;
}

.stats-radar-host {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.stats-radar-svg {
  width: 100%;
  max-width: 20rem;
  height: auto;
  display: block;
}

/* Fill / stroke come from the SVG (type-colored gradient + outline). */
.stats-radar-polygon {
  stroke-linejoin: round;
}

.stats-radar-dot {
  pointer-events: none;
}

.stats-radar-scale-note {
  margin: 0.45rem 0 0;
  font-size: 0.68rem;
  line-height: 1.4;
  color: var(--ink-soft);
  font-weight: 500;
  max-width: 19rem;
}

.stats-radar-lbl {
  font-family: var(--font);
  font-size: 11px;
  font-weight: 800;
  fill: var(--ink-soft);
  pointer-events: none;
}

.stats-radar-lbl-k {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.stats-radar-lbl-v {
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 700;
  fill: var(--ink);
}

.stats-radar-empty {
  margin: 0;
}

@media (min-width: 900px) {
  .stats-radar-empty {
    max-width: 18rem;
  }
}

.card-block {
  background: var(--card);
  border-radius: var(--radius);
  border: 1px solid var(--card-edge);
  box-shadow: var(--shadow);
  padding: 1.1rem 1.2rem;
}

.move-table-wrap {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: 0 -0.15rem;
  padding: 0 0.15rem;
}

.move-table {
  width: 100%;
  min-width: 420px;
  border-collapse: collapse;
  font-size: 0.85rem;
}

.move-table th {
  text-align: left;
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-soft);
  padding: 0.35rem 0.5rem 0.5rem 0;
  border-bottom: 1px solid var(--card-edge);
}

.move-table td {
  padding: 0.45rem 0.5rem 0.45rem 0;
  border-bottom: 1px solid rgba(90, 78, 120, 0.08);
  vertical-align: middle;
}

.move-table tr:last-child td {
  border-bottom: none;
}

.move-table--cols {
  table-layout: fixed;
}

.move-table--cols col.move-col-move {
  width: 30%;
}

.move-table--cols col.move-col-type {
  width: 24%;
}

.move-table--cols col.move-col-g3 {
  width: 2.85rem;
}

.move-table--cols col.move-col-pow {
  width: 2.75rem;
}

.move-table--cols col.move-col-acc {
  width: 3rem;
}

.move-table--cols col.move-col-pp {
  width: 4rem;
}

.move-table--cols th.move-col-g3,
.move-table--cols td.move-g3-cat {
  text-align: center;
  padding-left: 0.2rem;
  padding-right: 0.35rem;
}

.move-table--cols th.move-col-pow,
.move-table--cols td.move-col-pow {
  text-align: right;
}

.move-table--cols th.move-col-acc,
.move-table--cols td.move-col-acc {
  text-align: right;
  white-space: nowrap;
}

.move-table--cols th.move-col-pp,
.move-table--cols td.move-col-pp {
  text-align: right;
}

.move-table--cols th.move-col-type,
.move-table--cols td.move-col-type {
  padding-right: 0.35rem;
}

.move-name {
  font-weight: 700;
}

.move-acc {
  font-family: var(--mono);
  font-size: 0.73rem;
  font-weight: 600;
  color: var(--ink);
}

.move-pp {
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--ink-soft);
  text-align: right;
}

.mon-picker {
  margin-bottom: 1rem;
}

.mon-picker label {
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-soft);
  display: block;
  margin-bottom: 0.35rem;
}

.mon-picker select {
  width: 100%;
  max-width: 22rem;
  min-height: var(--touch-min);
  font-family: var(--font);
  font-size: 1rem;
  font-weight: 600;
  padding: 0.55rem 0.75rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--card-edge);
  background: #fff;
  color: var(--ink);
  touch-action: manipulation;
}

.moves-stats-mon-select optgroup {
  font-family: var(--font);
  font-weight: 800;
  font-size: 0.62rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

.moves-stats-mon-select option {
  font-weight: 600;
  font-size: 0.92rem;
  letter-spacing: normal;
  text-transform: none;
  color: var(--ink);
}

@media (min-width: 600px) {
  .mon-picker select {
    font-size: 0.95rem;
    min-height: 0;
  }
}

.stats-grid {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 0.35rem 0.65rem;
  align-items: center;
  font-size: 0.82rem;
}

.stats-grid dt {
  font-weight: 700;
  color: var(--ink-soft);
  font-variant: small-caps;
}

.stats-grid dd {
  margin: 0;
  height: 8px;
  background: var(--cream-dark);
  border-radius: 99px;
  overflow: hidden;
}

.stats-grid dd span {
  display: block;
  height: 100%;
  border-radius: 99px;
  background: linear-gradient(90deg, var(--accent-2), var(--accent));
}

.stats-grid .val {
  font-family: var(--mono);
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--ink);
}

.progress-hero {
  background: linear-gradient(135deg, rgba(124, 108, 240, 0.12), rgba(255, 107, 157, 0.1));
  border-radius: var(--radius);
  padding: 1.25rem 1.35rem;
  border: 1px solid var(--card-edge);
  margin-bottom: 1rem;
}

@media (min-width: 900px) {
  .progress-hero {
    padding: 1.35rem 1.5rem;
  }
}

.progress-hero h2 {
  margin: 0 0 0.35rem;
  font-size: clamp(1.05rem, 1rem + 0.5vw, 1.35rem);
  font-weight: 800;
  line-height: 1.25;
}

.progress-hero .loc {
  margin: 0;
  font-size: 0.9rem;
  color: var(--ink-soft);
  font-weight: 600;
}

.progress-loc-eyebrow {
  margin: 0 0 0.25rem;
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.progress-badge-meter {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 0.35rem;
  margin: 0.85rem 0 0.65rem;
}

.progress-badge-meter-seg {
  height: 6px;
  border-radius: 99px;
  background: rgba(42, 36, 56, 0.12);
  border: 1px solid var(--card-edge);
}

.progress-badge-meter-seg.is-earned {
  background: linear-gradient(90deg, #66bb6a, #43a047);
  border-color: #2e7d32;
  box-shadow: 0 1px 0 rgba(27, 94, 32, 0.35);
}

.progress-badge-meter-seg.is-next {
  background: linear-gradient(90deg, #ffee58, #fdd835);
  border-color: #f9a825;
  animation: progress-meter-pulse 1.4s ease-in-out infinite;
}

@keyframes progress-meter-pulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.72;
  }
}

.progress-story-override {
  margin: 0 0 0.5rem;
  font-size: 0.82rem;
  line-height: 1.45;
  color: var(--ink-soft);
  font-style: italic;
}

.badge-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-top: 1rem;
}

.badge-dot {
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 0.65rem;
  font-weight: 800;
  font-family: var(--mono);
  border: 2px solid var(--card-edge);
  background: #fff;
  color: var(--ink-soft);
}

.mon-card--nav {
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.mon-card--nav:focus-visible {
  outline: 2px solid var(--accent-2);
  outline-offset: 3px;
}

.moves-mon-preview {
  margin: 0.85rem 0 0.5rem;
}

.moves-mon-preview-inner {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: start;
  gap: 1rem 0.85rem;
  padding: 0.65rem 0.85rem;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.95), rgba(240, 230, 216, 0.5));
  border: 1px solid var(--card-edge);
}

/* Fixed learnset column so long nicknames/meta don't shove or resize the chip rail between Pokémon. */
.moves-mon-preview-inner--with-learnset {
  grid-template-columns: auto minmax(0, 1fr) 12.75rem;
}

@media (max-width: 520px) {
  .moves-mon-preview-inner--with-learnset {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .moves-mon-preview-inner--with-learnset .moves-mon-preview-next-stack {
    grid-column: 1 / -1;
    max-width: none;
    align-self: stretch;
  }
}

.moves-mon-preview-next-stack {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  align-self: center;
  min-width: 0;
  width: 100%;
}

.moves-mon-preview-sprite {
  flex-shrink: 0;
  width: 88px;
  height: 88px;
  display: grid;
  place-items: center;
  background: radial-gradient(circle at 50% 75%, rgba(124, 108, 240, 0.1), transparent 70%);
  border-radius: 14px;
}

.moves-mon-preview-sprite-stack {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.4rem;
  flex-shrink: 0;
  width: 88px;
}

.moves-mon-preview-xpbar {
  flex-shrink: 0;
  height: 5px;
  border-radius: 999px;
  background: rgba(42, 36, 56, 0.11);
  overflow: hidden;
  width: 100%;
  box-shadow: inset 0 1px 2px rgba(42, 36, 56, 0.06);
}

.moves-mon-preview-xpbar-fill {
  height: 100%;
  min-width: 0;
  border-radius: inherit;
  background: linear-gradient(90deg, rgba(124, 108, 240, 0.88), rgba(72, 186, 150, 0.82));
  transition: width 0.18s ease-out;
}

.moves-mon-preview-sprite img {
  width: 80px;
  height: 80px;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  filter: drop-shadow(0 6px 10px rgba(42, 36, 56, 0.12));
}

.moves-mon-preview-fallback {
  font-size: 1.75rem;
  font-weight: 800;
  color: var(--ink-soft);
  opacity: 0.5;
}

.moves-mon-preview-cap {
  min-width: 0;
}

.moves-mon-preview-next {
  align-self: flex-start;
  min-width: 0;
  padding-left: 0.25rem;
  text-align: left;
}

.moves-mon-preview-next-line {
  margin: 0 0 0.35rem;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--ink-soft);
  opacity: 0.85;
}

.moves-mon-preview-next-rolodex {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 0.3rem;
}

.moves-mon-preview-next-chip {
  flex: 0 0 auto;
  padding: 0.2rem 0.45rem;
  border-radius: 999px;
  font-family: var(--mono);
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--ink-soft);
  background: rgba(255, 255, 255, 0.55);
  border: 1px solid var(--card-edge);
  line-height: 1.2;
}

.moves-mon-preview-next-chip--next {
  background: rgba(124, 108, 240, 0.14);
  border-color: rgba(124, 108, 240, 0.35);
  color: var(--ink);
}

.moves-mon-preview-nick {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.moves-mon-preview-species {
  margin: 0.15rem 0 0;
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--ink-soft);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.moves-mon-preview-meta-block {
  margin: 0.35rem 0 0;
  display: flex;
  flex-direction: column;
  gap: 0.12rem;
  min-width: 0;
}

.moves-mon-preview-meta-line {
  margin: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.moves-mon-meta-lv {
  font-family: var(--mono);
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--ink);
}

.moves-mon-meta-exp {
  font-family: var(--mono);
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--ink-soft);
}

.moves-mon-meta-box {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--ink-soft);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.showdown-stack {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.showdown-pane {
  background: var(--card);
  border-radius: var(--radius-sm);
  border: 1px solid var(--card-edge);
  padding: 1rem 1.1rem 1.1rem;
  box-shadow: 0 4px 14px rgba(42, 36, 56, 0.06);
}

.showdown-pane.compact {
  padding: 0.85rem 1rem;
}

.showdown-pane .section-title {
  margin-top: 0;
  margin-bottom: 0.5rem;
  font-size: 0.95rem;
}

.badge-dot.earned {
  background: linear-gradient(145deg, #66bb6a, #43a047);
  border-color: #2e7d32;
  color: #fff;
  text-shadow: 0 1px 1px rgba(0, 0, 0, 0.2);
  box-shadow: 0 3px 0 #1b5e20;
}

.badge-dot.current {
  background: linear-gradient(145deg, #ffee58, #fdd835);
  border-color: #f9a825;
  color: #5d4000;
  box-shadow: 0 3px 0 #f57f17;
}

.badge-dot--btn {
  cursor: pointer;
  padding: 0;
  margin: 0;
  font: inherit;
  line-height: inherit;
  appearance: none;
  -webkit-appearance: none;
  touch-action: manipulation;
  position: relative;
  width: 2.65rem;
  height: 2.65rem;
}

.badge-btn-visual {
  position: relative;
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
}

.badge-btn-sprite {
  width: 1.9rem;
  height: 1.9rem;
  object-fit: contain;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.12));
}

.badge-btn-num {
  position: absolute;
  right: -1px;
  bottom: -3px;
  font-size: 0.52rem;
  font-weight: 900;
  font-family: var(--mono);
  line-height: 1;
  color: rgba(42, 36, 56, 0.88);
  text-shadow:
    0 0 3px #fff,
    0 0 3px #fff,
    0 1px 0 #fff;
}

.badge-dot.earned .badge-btn-num {
  color: rgba(255, 255, 255, 0.98);
  text-shadow:
    0 0 3px rgba(0, 60, 0, 0.35),
    0 1px 2px rgba(0, 0, 0, 0.35);
}

.badge-dot.current .badge-btn-num {
  color: rgba(60, 45, 0, 0.95);
  text-shadow:
    0 0 3px #fff8e1,
    0 1px 1px rgba(0, 0, 0, 0.15);
}

.badge-btn-fallback {
  font-size: 0.72rem;
  font-weight: 900;
  font-family: var(--mono);
}

.badge-btn-sr {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.badge-dot--btn:focus-visible {
  outline: 2px solid var(--accent-2);
  outline-offset: 3px;
}

.badge-dot--btn.is-selected {
  outline: 2px solid rgba(124, 108, 240, 0.85);
  outline-offset: 3px;
}

.progress-gym-hint {
  margin: 0.5rem 0 0;
  font-size: 0.76rem;
  line-height: 1.45;
  color: var(--ink-soft);
}

.gym-roster-panel {
  margin-top: 1rem;
  padding: 1rem 1.1rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--card-edge);
  background: rgba(255, 255, 255, 0.65);
}

.gym-roster-head {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 0.75rem;
}

.gym-leader-sprite {
  flex-shrink: 0;
  width: 72px;
  height: 72px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: linear-gradient(145deg, rgba(124, 108, 240, 0.08), rgba(255, 107, 157, 0.06));
  border: 1px solid var(--card-edge);
}

.gym-leader-sprite img {
  width: 64px;
  height: 64px;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

.gym-roster-title {
  min-width: 0;
}

.gym-roster-leader {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 800;
}

.gym-roster-city {
  margin: 0.2rem 0 0;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--ink-soft);
}

.gym-roster-gate {
  margin: 0 0 0.75rem;
  font-size: 0.78rem;
  color: var(--ink-soft);
  font-weight: 600;
}

.gym-team-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.gym-team-chip {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.15rem;
  min-width: 4.5rem;
  padding: 0.45rem 0.4rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--card-edge);
  background: #fff;
}

.gym-team-chip--locked {
  background: rgba(90, 78, 120, 0.06);
}

.gym-team-sprite {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
}

.gym-team-sprite img {
  width: 44px;
  height: 44px;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

.gym-team-silhouette {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: rgba(90, 78, 120, 0.12);
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--ink-soft);
  opacity: 0.55;
}

.gym-team-name {
  font-size: 0.62rem;
  font-weight: 700;
  text-align: center;
  max-width: 5.5rem;
  overflow-wrap: anywhere;
}

.gym-team-lv {
  font-size: 0.58rem;
  font-family: var(--mono);
  font-weight: 700;
  color: var(--ink-soft);
}

.run-card--full {
  grid-template-columns: 1fr;
}

.run-card--full .run-tag {
  justify-self: start;
}

.run-party-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.8rem 0.65rem;
  margin: 0.5rem 0 0;
  width: 100%;
}

@media (min-width: 520px) {
  .run-party-strip {
    grid-template-columns: repeat(6, minmax(0, 1fr));
  }
}

.run-party-chip {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.45rem;
  min-width: 0;
  width: 100%;
}

.run-party-sprite {
  width: 56px;
  height: 56px;
  flex-shrink: 0;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  filter: drop-shadow(0 3px 6px rgba(42, 36, 56, 0.12));
}

.run-party-sprite.is-fallback {
  width: 50px;
  height: 50px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: var(--cream-dark);
  font-weight: 800;
  font-size: 1rem;
  color: var(--ink-soft);
}

.run-party-name {
  font-size: 0.82rem;
  font-weight: 700;
  text-align: center;
  line-height: 1.25;
  width: 100%;
  max-width: 100%;
  color: var(--ink-soft);
  overflow-wrap: anywhere;
  word-break: break-word;
  hyphens: auto;
}

.batch-exports {
  margin-top: 0.25rem;
}

.showdown-export-ta {
  margin-top: 0.65rem;
}

.story-box {
  font-size: 0.92rem;
  line-height: 1.55;
  color: var(--ink);
}

.hall-of-fame {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.hall-history-import-row {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.45rem;
  margin-top: 0.15rem;
  padding: 0.55rem 0.65rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--card-edge);
  background: rgba(255, 255, 255, 0.55);
  max-width: 36rem;
}

.hall-history-import-btn {
  font-size: 0.84rem;
}

.hall-history-import-hint {
  margin: 0;
  font-size: 0.78rem;
  line-height: 1.45;
  color: var(--ink-soft);
  font-weight: 600;
}

.hall-view-row {
  display: flex;
  align-items: flex-end;
  justify-content: flex-start;
  gap: 0.75rem;
  margin-top: 0.25rem;
  flex-wrap: wrap;
}

.hall-view-picker {
  margin: 0;
}

.hall-view-select {
  position: relative;
  max-width: min(100%, 19rem);
}

.hall-view-trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.45rem;
  width: 100%;
  min-height: 38px;
  padding: 0.28rem 0.55rem;
  border-radius: 999px;
  border: 1px solid var(--card-edge);
  font-family: var(--mono);
  font-weight: 600;
  font-size: 0.68rem;
  background: rgba(255, 255, 255, 0.92);
  color: var(--ink);
  box-shadow: 0 2px 8px rgba(42, 36, 56, 0.06);
  cursor: pointer;
}

.hall-view-trigger:hover {
  border-color: rgba(124, 108, 240, 0.35);
}

.hall-view-trigger[aria-expanded="true"] {
  border-color: rgba(124, 108, 240, 0.45);
  box-shadow: 0 2px 12px rgba(124, 108, 240, 0.12);
}

.hall-view-option {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  min-width: 0;
}

.hall-view-option-label {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.hall-view-sprite {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  object-fit: contain;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

.hall-view-chevron {
  flex-shrink: 0;
  font-size: 0.72rem;
  line-height: 1;
  color: var(--ink-soft);
}

.hall-view-menu {
  position: absolute;
  z-index: 20;
  top: calc(100% + 0.35rem);
  left: 0;
  min-width: 100%;
  margin: 0;
  padding: 0.35rem;
  list-style: none;
  border-radius: var(--radius-sm);
  border: 1px solid var(--card-edge);
  background: rgba(255, 255, 255, 0.98);
  box-shadow: var(--shadow);
}

.hall-view-menu-item {
  display: flex;
  align-items: center;
  padding: 0.42rem 0.55rem;
  border-radius: 999px;
  cursor: pointer;
  font-family: var(--mono);
  font-weight: 600;
  font-size: 0.68rem;
  color: var(--ink);
}

.hall-view-menu-item:hover,
.hall-view-menu-item.is-selected {
  background: linear-gradient(135deg, rgba(124, 108, 240, 0.14) 0%, rgba(155, 140, 255, 0.1) 100%);
}

.hall-prev-runs {
  margin-top: 0;
}

.run-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.run-card {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.5rem 1rem;
  align-items: start;
  padding: 1rem 1.1rem;
  background: var(--card);
  border-radius: var(--radius-sm);
  border: 1px solid var(--card-edge);
  box-shadow: 0 4px 16px rgba(42, 36, 56, 0.06);
}

.run-card h3 {
  margin: 0;
  font-size: 1rem;
  font-weight: 800;
}

.run-card .sub {
  grid-column: 1 / -1;
  margin: 0;
  font-size: 0.85rem;
  color: var(--ink-soft);
  line-height: 1.45;
}

.run-tag {
  font-family: var(--mono);
  font-size: 0.65rem;
  font-weight: 700;
  padding: 0.25rem 0.5rem;
  border-radius: 6px;
  text-transform: uppercase;
  white-space: nowrap;
}

.run-tag.active {
  background: rgba(124, 108, 240, 0.2);
  color: #4a3aa8;
}

.run-tag.won {
  background: rgba(62, 207, 142, 0.2);
  color: #1a7a52;
}

.run-tag.lost {
  background: rgba(255, 92, 122, 0.15);
  color: #b22a40;
}

.run-tag.abandoned {
  background: rgba(255, 193, 77, 0.25);
  color: #8a5a00;
}

.death-list {
  list-style: none;
  padding: 0;
  margin: 1rem 0 0;
}

.death-list li {
  padding: 0.65rem 0;
  border-bottom: 1px solid var(--card-edge);
  font-size: 0.88rem;
}

.death-list li:last-child {
  border-bottom: none;
}

.death-name {
  font-weight: 800;
  color: var(--danger);
}

.deck-footer {
  margin-top: 2.5rem;
  padding-top: 1rem;
  border-top: 1px dashed var(--card-edge);
  font-size: 0.78rem;
  color: var(--ink-soft);
  text-align: center;
}

.loading,
.error-banner {
  padding: 1.5rem;
  text-align: center;
  border-radius: var(--radius);
  background: var(--card);
  border: 1px solid var(--card-edge);
}

.error-banner {
  background: #fff0f3;
  border-color: #ffcdd6;
  color: #8b2940;
  font-weight: 600;
}

.showdown-export-ta {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  margin-top: 0.5rem;
  padding: 0.75rem;
  font-family: var(--mono);
  font-size: 0.8125rem;
  line-height: 1.45;
  border-radius: 8px;
  border: 1px solid var(--card-edge);
  background: rgba(255, 255, 255, 0.45);
  color: var(--ink);
  resize: vertical;
  min-height: 8rem;
}

@media (max-width: 599px) {
  .showdown-export-ta,
  .batch-sav-select {
    font-size: 16px;
  }
}

.copy-btn-row {
  margin-top: 0.5rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

.copy-paste-btn {
  font-family: var(--font);
  font-size: 0.88rem;
  font-weight: 700;
  padding: 0.55rem 1.1rem;
  min-height: var(--touch-min);
  border-radius: var(--radius-sm);
  border: 1px solid var(--card-edge);
  background: var(--card);
  color: var(--ink);
  cursor: pointer;
  touch-action: manipulation;
  transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
  box-shadow: 0 2px 8px rgba(42, 36, 56, 0.06);
}

@media (min-width: 600px) {
  .copy-paste-btn {
    min-height: 0;
    padding: 0.45rem 1rem;
    font-size: 0.82rem;
  }
}

.copy-paste-btn:hover {
  border-color: rgba(124, 108, 240, 0.5);
  background: #fff;
}

.copy-paste-btn:active {
  transform: translateY(1px);
  box-shadow: 0 1px 4px rgba(42, 36, 56, 0.08);
}

.copy-paste-btn--icon {
  padding: 0.35rem 0.45rem;
  min-width: 38px;
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

@media (min-width: 600px) {
  .copy-paste-btn--icon {
    min-height: 32px;
    min-width: 32px;
    padding: 0.28rem 0.4rem;
  }
}

.copy-paste-btn__glyph {
  font-size: 1rem;
  line-height: 1;
}

.mon-card--nav .copy-paste-btn:focus-visible {
  outline: 2px solid rgba(124, 108, 240, 0.85);
  outline-offset: 2px;
}

.batch-sav-label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  margin-top: 0.75rem;
}

.batch-sav-select {
  display: block;
  width: 100%;
  max-width: 28rem;
  margin: 0.35rem 0 0.5rem;
  padding: 0.55rem 0.65rem;
  min-height: var(--touch-min);
  border-radius: 8px;
  border: 1px solid var(--card-edge);
  font-size: 0.85rem;
  font-family: var(--font);
  font-weight: 600;
  background: #fff;
  color: var(--ink);
  touch-action: manipulation;
}

@media (min-width: 600px) {
  .batch-sav-select {
    min-height: 0;
    padding: 0.45rem 0.5rem;
  }
}

/* Floating Theme Toggle Switcher Button */
.theme-toggle-btn {
  position: fixed;
  right: 1rem;
  top: max(1rem, env(safe-area-inset-top));
  z-index: 50;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.75rem;
  height: 2.75rem;
  border-radius: 9999px;
  border: 1px solid rgba(255, 255, 255, 0.35);
  background: rgba(255, 246, 238, 0.94);
  color: var(--ink);
  box-shadow: var(--shadow), 0 4px 24px rgba(42, 36, 56, 0.18);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  cursor: pointer;
  font-size: 1.2rem;
  padding: 0;
  line-height: 1;
  transition: border-color 0.2s, background-color 0.2s, box-shadow 0.2s, transform 0.15s;
}

.theme-toggle-btn:hover {
  border-color: rgba(42, 143, 189, 0.55);
  background: rgba(255, 255, 255, 0.98);
  transform: scale(1.05);
}

@media (min-width: 640px) {
  .theme-toggle-btn {
    right: 2rem;
    top: max(2rem, env(safe-area-inset-top));
  }
}

/* Grayscale Contrast for Lost & Abandoned Runs */
.run-card--lost,
.run-card--abandoned {
  opacity: 0.65;
  filter: grayscale(0.35);
  transition: opacity 0.2s ease, filter 0.2s ease;
}

.run-card--lost:hover,
.run-card--abandoned:hover {
  opacity: 0.95;
  filter: grayscale(0);
}

/* Pixel-perfect Spinning Pokéball Loading Experience */
.pokeball-spinner {
  width: 18px;
  height: 18px;
  border: 2px solid var(--ink);
  border-radius: 50%;
  background: linear-gradient(to bottom, #ef4444 50%, #ffffff 50%);
  position: relative;
  animation: pokeball-spin 1s linear infinite;
  display: inline-block;
  vertical-align: middle;
  margin-right: 0.5rem;
  flex-shrink: 0;
}

.pokeball-spinner::before {
  content: "";
  position: absolute;
  height: 2px;
  width: 16px;
  background: var(--ink);
  top: 6px;
  left: -1px;
}

.pokeball-spinner::after {
  content: "";
  position: absolute;
  height: 6px;
  width: 6px;
  background: #ffffff;
  border: 2px solid var(--ink);
  border-radius: 50%;
  top: 4px;
  left: 4px;
}

@keyframes pokeball-spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Dark Theme Overrides for Core UI Elements */
[data-theme="dark"] .deck-source-select,
[data-theme="dark"] .deck-import-rom-select,
[data-theme="dark"] .deck-import-advanced-body,
[data-theme="dark"] .deck-import-base-json,
[data-theme="dark"] .deck-upload-shell,
[data-theme="dark"] .batch-sav-select,
[data-theme="dark"] .showdown-export-ta,
[data-theme="dark"] .mon-picker select {
  background: rgba(30, 41, 59, 0.85);
  color: var(--ink);
  border-color: rgba(255, 255, 255, 0.15);
}

[data-theme="dark"] .deck-nav {
  background: rgba(30, 41, 59, 0.85);
}

[data-theme="dark"] .deck-nav a:hover {
  background: rgba(255, 255, 255, 0.05);
}

[data-theme="dark"] .dw-home-link {
  background: rgba(30, 41, 59, 0.9);
  border-color: rgba(255, 255, 255, 0.15);
}

[data-theme="dark"] .dw-home-link-glow {
  background: rgba(30, 41, 59, 0.95);
}

[data-theme="dark"] .dw-home-link-logo {
  filter: invert(1) brightness(1.3);
}

[data-theme="dark"] .copy-paste-btn {
  background: rgba(255, 255, 255, 0.08);
  color: var(--ink);
}

[data-theme="dark"] .copy-paste-btn:hover {
  background: rgba(255, 255, 255, 0.15);
}

[data-theme="dark"] .mon-card-head {
  background: linear-gradient(180deg, rgba(30, 41, 59, 0.95), var(--cream-dark));
  border-bottom: 1px solid var(--card-edge);
}

[data-theme="dark"] .hall-history-import-row {
  background: rgba(30, 41, 59, 0.85);
  border-color: rgba(255, 255, 255, 0.15);
}

[data-theme="dark"] .hall-view-trigger {
  background: rgba(30, 41, 59, 0.85);
  color: var(--ink);
  border-color: rgba(255, 255, 255, 0.15);
}

[data-theme="dark"] .hall-view-menu {
  background: rgba(30, 41, 59, 0.95);
  border-color: rgba(255, 255, 255, 0.15);
}

[data-theme="dark"] .moves-mon-preview-inner {
  background: linear-gradient(135deg, rgba(30, 41, 59, 0.95), rgba(18, 24, 38, 0.6));
  border-color: rgba(255, 255, 255, 0.15);
}

[data-theme="dark"] .moves-mon-preview-next-chip {
  background: rgba(255, 255, 255, 0.08);
  color: var(--ink-soft);
  border-color: rgba(255, 255, 255, 0.1);
}

[data-theme="dark"] .progress-badge-meter-seg {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.12);
}

[data-theme="dark"] .gym-roster-panel {
  background: rgba(30, 41, 59, 0.85);
  border-color: rgba(255, 255, 255, 0.15);
}

[data-theme="dark"] .gym-team-chip {
  background: rgba(18, 24, 38, 0.9);
  border-color: rgba(255, 255, 255, 0.15);
  color: var(--ink);
}

[data-theme="dark"] .gym-team-chip--locked {
  background: rgba(255, 255, 255, 0.05);
}

