.trainer-card {
  font-family: var(--font-sans, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif);
  background: var(--bg-panel, #111827);
  color: var(--text-primary, #f8fafc);
  border-radius: 12px;
  padding: 16px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05), 0 10px 26px rgba(0, 0, 0, 0.36);
  border: 1.5px solid var(--border-subtle, #263248);
  max-width: 420px;
  margin: 0 auto;
}

.trainer-card-header {
  text-align: center;
  border-bottom: 1px solid var(--border-subtle, #263248);
  padding-bottom: 12px;
  margin-bottom: 16px;
}

.tc-title {
  margin: 0;
  font-family: var(--font-display, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif);
  font-size: 0.92rem;
  font-weight: 900;
  color: var(--text-secondary, #cbd5e1);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.tc-handle {
  font-family: var(--font-display, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif);
  font-size: 1.48rem;
  font-weight: 900;
  letter-spacing: -0.02em;
  color: var(--text-primary, #f8fafc);
  margin-top: 4px;
}

.tc-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  text-align: center;
  margin-bottom: 20px;
}

.tc-stat {
  display: flex;
  flex-direction: column;
  background: var(--bg-card, #182235);
  padding: 9px 4px;
  border-radius: 8px;
  border: 1px solid var(--border-subtle, #263248);
}

.tc-val {
  font-family: var(--font-display, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif);
  font-size: 1.24rem;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
  color: var(--color-bench, #38bdf8);
}

.tc-lbl {
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--text-secondary, #cbd5e1);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-top: 4px;
}

.tc-badges {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  justify-items: center;
  margin-bottom: 20px;
}

/* Pokédex meter: distinct Pokémon drafted on this device */
.tc-dex {
  margin: -6px 0 18px;
}

.tc-dex-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}

.tc-dex-label {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-secondary, #cbd5e1);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.tc-dex-val {
  font-family: var(--font-display, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif);
  font-size: 0.96rem;
  font-weight: 900;
  color: var(--color-bench, #38bdf8);
  font-variant-numeric: tabular-nums;
}

.tc-dex-track {
  height: 9px;
  margin-top: 6px;
  border-radius: 99px;
  background: var(--bg-arena, #090d16);
  border: 1px solid var(--border-subtle, #263248);
  overflow: hidden;
}

.tc-dex-fill {
  height: 100%;
  border-radius: 99px;
  background: linear-gradient(90deg, var(--color-bench, #38bdf8) 0%, var(--color-starter, #34d399) 60%, var(--color-legend, #facc15) 100%);
  transition: width 0.6s ease;
}

.tc-dex-sub {
  margin-top: 5px;
  font-size: 0.75rem;
  color: var(--text-secondary, #cbd5e1);
}

.tc-badge-wrap {
  width: 50px;
  height: 50px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--bg-arena, #090d16);
  border: 2px solid var(--border-subtle, #263248);
  cursor: pointer;
  transition: transform 0.14s ease, border-color 0.16s ease, box-shadow 0.16s ease;
}

.tc-badge-wrap:hover {
  transform: translateY(-2px);
  border-color: var(--color-bench, #38bdf8);
}

.tc-badge-wrap:focus-visible {
  outline: 3px solid var(--color-legend, #facc15);
  outline-offset: 2px;
  box-shadow: 0 0 0 5px #090d16;
}

.tc-badge-wrap.unlocked {
  background: var(--bg-card-elevated, #1e2a40);
  border-color: rgba(56, 189, 248, 0.58);
  box-shadow: 0 0 12px rgba(56, 189, 248, 0.24);
}

.tc-badge-wrap.locked {
  opacity: 0.36;
  filter: grayscale(100%);
}

.tc-badge-icon {
  width: 32px;
  height: 32px;
}

.tc-medals-title {
  margin: 0 0 12px 0;
  font-family: var(--font-display, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif);
  font-size: 0.9rem;
  font-weight: 900;
  letter-spacing: 0.06em;
  color: var(--text-secondary, #cbd5e1);
  text-transform: uppercase;
  border-bottom: 1px solid var(--border-subtle, #263248);
  padding-bottom: 5px;
}

.tc-medals {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tc-medal-wrap {
  display: inline-flex;
  align-items: center;
  padding: 5px 11px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
  background: var(--bg-card, #182235);
  color: var(--text-primary, #f8fafc);
  border: 1px solid var(--border-subtle, #263248);
}

.tc-tier-bronze {
  border-color: #d97706;
  background: rgba(180, 83, 9, 0.24);
}

.tc-tier-silver {
  border-color: #94a3b8;
  background: rgba(148, 163, 184, 0.22);
}

.tc-tier-gold {
  border-color: var(--color-legend, #facc15);
  background: rgba(250, 204, 21, 0.2);
  color: #fef08a;
}

/* Floating achievement toast container (desktop bottom-right avoids overlapping .court-footer-bar) */
.ach-toast-wrap {
  position: fixed;
  bottom: 24px;
  right: 20px;
  left: auto;
  transform: none;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: min(360px, calc(100vw - 24px));
  pointer-events: none;
}

@media (max-width: 820px) {
  .ach-toast-wrap {
    left: 50%;
    right: auto;
    bottom: 18px;
    transform: translateX(-50%);
    max-width: calc(100vw - 24px);
  }
}

.ach-toast {
  background: var(--bg-panel, #111827);
  border: 2px solid var(--color-legend, #facc15);
  border-radius: 10px;
  padding: 12px 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.52);
  animation: ach-toast-in 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards, ach-toast-out 0.3s ease-in 4.7s forwards;
  min-width: 260px;
  max-width: calc(100vw - 24px);
  pointer-events: auto;
}

/* Inline recap unlocks stay visible for the entire results view */
.ach-toast.is-persistent,
#recap-achievements-slot .ach-toast {
  animation: ach-toast-in 0.25s ease forwards;
  opacity: 1;
}

@keyframes ach-toast-in {
  from { opacity: 0; transform: translateY(16px) scale(0.94); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes ach-toast-out {
  from { opacity: 1; transform: translateY(0) scale(1); }
  to { opacity: 0; transform: translateY(16px) scale(0.94); }
}

.ach-toast-badge {
  width: 40px;
  height: 40px;
  flex-shrink: 0;
}

.ach-toast-medal {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 2px solid transparent;
  flex-shrink: 0;
}

.ach-toast-text {
  flex-grow: 1;
  min-width: 0;
}

.ach-toast-name {
  font-family: var(--font-display, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif);
  font-weight: 800;
  font-size: 0.98rem;
  color: var(--text-primary, #f8fafc);
}

.ach-toast-desc {
  font-size: 0.8rem;
  line-height: 1.35;
  color: var(--text-secondary, #cbd5e1);
  margin-top: 2px;
}

@media (prefers-reduced-motion: reduce) {
  .tc-dex-fill,
  .tc-badge-wrap {
    transition: none;
  }

  .ach-toast {
    animation: none;
    opacity: 1;
  }
}