/* ============================================================
   CoachGG — Super Smash Bros Ultimate Player Analysis
   ============================================================ */

/* ── Reset & Base ─────────────────────────────────────────── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --bg-primary:      #07090f;
  --bg-secondary:    #0d1117;
  --bg-card:         rgba(15, 20, 35, 0.85);
  --bg-card-hover:   rgba(22, 30, 50, 0.95);
  --border-subtle:   rgba(255,255,255,0.07);
  --border-accent:   rgba(139, 92, 246, 0.4);
  --accent-purple:   #8b5cf6;
  --accent-pink:     #ec4899;
  --accent-cyan:     #06b6d4;
  --accent-gradient: linear-gradient(135deg, #8b5cf6, #ec4899);
  --text-primary:    #f1f5f9;
  --text-secondary:  #94a3b8;
  --text-muted:      #475569;
  --win-high:        #10b981;
  --win-mid:         #f59e0b;
  --win-low:         #ef4444;
  --glow-purple:     0 0 20px rgba(139, 92, 246, 0.3);
  --glow-green:      0 0 15px rgba(16, 185, 129, 0.4);
  --glow-red:        0 0 15px rgba(239, 68, 68, 0.4);
}

html {
  scroll-behavior: smooth;
  max-width: 100%;
  overflow-x: hidden;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
}

/* ── Animated Background ──────────────────────────────────── */
.bg-gradient-mesh {
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(ellipse at 20% 50%, rgba(139, 92, 246, 0.08) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 20%, rgba(236, 72, 153, 0.06) 0%, transparent 50%),
    radial-gradient(ellipse at 50% 80%, rgba(6, 182, 212, 0.05) 0%, transparent 50%),
    #07090f;
  animation: meshShift 20s ease-in-out infinite alternate;
}

@keyframes meshShift {
  0%   { filter: hue-rotate(0deg); }
  100% { filter: hue-rotate(30deg); }
}

/* ── Utility ──────────────────────────────────────────────── */
.hidden { display: none !important; }

.container {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 24px;
}

.studio-wordmark {
  position: absolute;
  top: 28px;
  left: 28px;
  z-index: 2;
  display: inline-flex;
  flex-direction: column;
  color: var(--text-primary);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.2em;
  line-height: 1.05;
  text-decoration: none;
  text-transform: uppercase;
}

.studio-wordmark span:last-child {
  color: var(--text-secondary);
  font-size: 0.56rem;
  letter-spacing: 0.16em;
  transition: color 0.2s ease;
}

.studio-wordmark:hover span:last-child {
  color: var(--text-primary);
}

/* ── Hero / Header ────────────────────────────────────────── */
.hero {
  min-height: 52vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 60px 24px 48px;
  text-align: center;
  transition: min-height 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.hero.compact {
  min-height: auto;
  padding: 24px;
}

.hero-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 32px;
  width: 100%;
  max-width: 640px;
}

.brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.logo {
  font-size: 4.5rem;
  font-weight: 800;
  letter-spacing: -2px;
  line-height: 1;
  background: linear-gradient(135deg, #8b5cf6 0%, #ec4899 60%, #f97316 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  filter: drop-shadow(0 0 32px rgba(139, 92, 246, 0.35));
  transition: font-size 0.4s;
}

.hero.compact .logo { font-size: 2.5rem; }

.tagline {
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--text-secondary);
  letter-spacing: 0.02em;
  text-transform: uppercase;
  opacity: 0.85;
}

/* ── Search ───────────────────────────────────────────────── */
.search-container {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.search-form-wrap {
  position: relative;
  width: 100%;
  max-width: 600px;
}

.search-form {
  display: flex;
  gap: 8px;
  width: 100%;
}

.search-input-wrap {
  flex: 1;
  position: relative;
  display: flex;
  align-items: center;
}

.search-icon {
  position: absolute;
  left: 16px;
  font-size: 1.1rem;
  color: var(--text-muted);
  pointer-events: none;
  z-index: 1;
}

.search-input-wrap input {
  width: 100%;
  padding: 14px 16px 14px 46px;
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  color: var(--text-primary);
  font-size: 1rem;
  font-family: inherit;
  font-weight: 500;
  outline: none;
  transition: border-color 0.2s, background 0.2s, box-shadow 0.2s;
  backdrop-filter: blur(12px);
}

.search-input-wrap input::placeholder {
  color: var(--text-muted);
  font-weight: 400;
}

.search-input-wrap input:focus {
  border-color: var(--accent-purple);
  background: rgba(139, 92, 246, 0.06);
  box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.15), var(--glow-purple);
}

.btn-analyze {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 14px 24px;
  background: var(--accent-gradient);
  border: none;
  border-radius: 12px;
  color: white;
  font-size: 1rem;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s, opacity 0.2s;
  white-space: nowrap;
  box-shadow: 0 4px 20px rgba(139, 92, 246, 0.35);
  letter-spacing: 0.02em;
}

.btn-analyze:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 28px rgba(139, 92, 246, 0.5);
}

.btn-analyze:active { transform: translateY(0); }

.btn-analyze.loading {
  opacity: 0.65;
  pointer-events: none;
}

.btn-arrow {
  font-size: 1.2rem;
  transition: transform 0.2s;
}

.btn-analyze:hover .btn-arrow { transform: translateX(3px); }

.search-hint {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.search-hint strong {
  color: var(--text-secondary);
}

/* ── Progress Section ─────────────────────────────────────── */
.progress-section {
  padding: 20px 0 28px;
  background: rgba(13, 17, 23, 0.6);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border-subtle);
  position: sticky;
  top: 0;
  z-index: 50;
  animation: fadeSlideDown 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes fadeSlideDown {
  from { opacity: 0; transform: translateY(-12px); }
  to   { opacity: 1; transform: translateY(0); }
}

.progress-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.live-indicator {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--win-high);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.pulse-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--win-high);
  display: inline-block;
  animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% {
    opacity: 1;
    transform: scale(1);
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.4);
  }
  50% {
    opacity: 0.8;
    transform: scale(1.2);
    box-shadow: 0 0 0 6px rgba(16, 185, 129, 0);
  }
}

.progress-text {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.progress-track {
  height: 6px;
  background: rgba(255,255,255,0.06);
  border-radius: 100px;
  overflow: hidden;
  position: relative;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent-purple), var(--accent-pink), var(--accent-cyan));
  background-size: 200% 100%;
  border-radius: 100px;
  transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1);
  animation: shimmerSlide 2s linear infinite;
}

@keyframes shimmerSlide {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.progress-stats {
  margin-top: 14px;
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
}

.progress-stat-pill {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border-subtle);
  border-radius: 100px;
  font-size: 0.8rem;
  color: var(--text-secondary);
  font-weight: 500;
}

.progress-stat-pill strong {
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
}

/* ── Summary Bar ──────────────────────────────────────────── */
.results-section {
  padding: 32px 0 80px;
  animation: fadeIn 0.5s ease;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.summary-bar {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 16px;
  margin-bottom: 32px;
  padding: 24px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 20px;
  backdrop-filter: blur(12px);
}

.summary-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  text-align: center;
}

.summary-value {
  font-size: 1.8rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  line-height: 1;
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.summary-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 600;
}

.summary-bar.celebrate {
  animation: celebrate 0.8s ease-out;
}

@keyframes celebrate {
  0%   { box-shadow: 0 0 0 0 rgba(250, 204, 21, 0.5), var(--glow-purple); }
  30%  { box-shadow: 0 0 40px 8px rgba(250, 204, 21, 0.3), 0 0 60px 16px rgba(139, 92, 246, 0.2); }
  100% { box-shadow: none; }
}

/* ── Tabs ─────────────────────────────────────────────────── */
.tabs-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 28px;
}

.tabs {
  display: flex;
  gap: 4px;
  padding: 4px;
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--border-subtle);
  border-radius: 14px;
  width: fit-content;
}

/* ── Sort Toggle ──────────────────────────────────────────── */
.sort-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
}

.sort-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.sort-btn {
  padding: 7px 14px;
  background: transparent;
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  color: var(--text-muted);
  font-size: 0.82rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.18s;
  white-space: nowrap;
}

.sort-btn:hover {
  border-color: var(--accent);
  color: var(--text-secondary);
}

.sort-btn.active {
  background: var(--accent-gradient);
  border-color: transparent;
  color: white;
}

.tab {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 10px 22px;
  background: transparent;
  border: none;
  border-radius: 10px;
  color: var(--text-muted);
  font-size: 0.9rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: color 0.2s, background 0.2s;
  white-space: nowrap;
}

.tab:hover {
  color: var(--text-secondary);
  background: rgba(255,255,255,0.04);
}

.tab.active {
  background: var(--accent-gradient);
  color: white;
  box-shadow: 0 2px 16px rgba(139, 92, 246, 0.35);
}

.tab-icon { font-size: 1rem; }

.tab-content { display: none; }
.tab-content.active { display: block; }

/* ── Stage Cards ──────────────────────────────────────────── */
.stage-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
}

.stage-card {
  position: relative;
  border-radius: 16px;
  overflow: hidden;
  height: 180px;
  cursor: pointer;
  transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1),
              box-shadow 0.4s,
              border-color 0.4s;
  border: 1px solid var(--border-subtle);
}

.stage-card:hover {
  transform: scale(1.02) translateY(-4px);
  border-color: var(--border-accent);
  box-shadow: var(--glow-purple), 0 16px 48px rgba(0,0,0,0.5);
}

.stage-card:hover .stage-bg {
  filter: brightness(0.9) saturate(1.2);
}

.stage-bg {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  transition: filter 0.4s, transform 0.4s;
}

.stage-card:hover .stage-bg {
  transform: scale(1.04);
}

.stage-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to top,
    rgba(0,0,0,0.9) 0%,
    rgba(0,0,0,0.4) 45%,
    rgba(0,0,0,0.15) 100%
  );
}

.stage-info {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 16px 20px;
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
}

.stage-left {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.stage-name {
  font-size: 1.05rem;
  font-weight: 700;
  color: white;
  text-shadow: 0 2px 8px rgba(0,0,0,0.8);
  line-height: 1.2;
}

.stage-record {
  font-size: 0.78rem;
  color: rgba(255,255,255,0.65);
  font-weight: 500;
}

.stage-games {
  font-size: 0.72rem;
  color: rgba(255,255,255,0.45);
  font-weight: 400;
}

.stage-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
}

.stage-winrate {
  font-size: 2.6rem;
  font-weight: 800;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  text-shadow: 0 2px 12px rgba(0,0,0,0.6);
}

.low-data-badge {
  font-size: 0.65rem;
  padding: 2px 7px;
  background: rgba(255,255,255,0.15);
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 100px;
  color: rgba(255,255,255,0.6);
  backdrop-filter: blur(4px);
  white-space: nowrap;
}

/* ── Character Cards ──────────────────────────────────────── */
.char-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 16px;
}

.char-card {
  background: var(--bg-card);
  border-radius: 16px;
  border: 1px solid var(--border-subtle);
  padding: 20px 16px 16px;
  text-align: center;
  transition: transform 0.3s, box-shadow 0.3s, border-color 0.3s, background 0.3s;
  cursor: pointer;
  backdrop-filter: blur(8px);
}

.char-card:hover {
  transform: translateY(-6px) scale(1.03);
  border-color: var(--border-accent);
  box-shadow: var(--glow-purple);
  background: var(--bg-card-hover);
}

.portrait-wrap {
  position: relative;
  width: 80px;
  height: 80px;
  margin: 0 auto 12px;
}

.portrait-wrap svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
  border-radius: 50%;
}

.ring-bg {
  fill: none;
  stroke: rgba(255,255,255,0.06);
  stroke-width: 4;
}

.ring-fill {
  fill: none;
  stroke-width: 4;
  stroke-linecap: round;
  transition: stroke-dashoffset 0.7s cubic-bezier(0.4, 0, 0.2, 1), stroke 0.4s;
}

.portrait-img {
  position: absolute;
  inset: 8px;
  border-radius: 50%;
  object-fit: contain;
  background: var(--bg-secondary);
  image-rendering: -webkit-optimize-contrast;
}

.char-name {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 6px;
}

.char-winrate {
  font-size: 1.6rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  line-height: 1;
  margin-bottom: 4px;
}

.char-record {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 500;
}

.char-games {
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-top: 2px;
}

/* ── Matchup (Stage × Character) ─────────────────────────── */
.matchup-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.vschar-subtitle {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin: 0 0 16px 4px;
}

.matchup-row {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 16px;
  overflow: hidden;
  backdrop-filter: blur(8px);
  transition: border-color 0.3s;
}

.matchup-row:hover {
  border-color: var(--border-accent);
}

.matchup-header {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 20px;
  cursor: pointer;
  user-select: none;
  transition: background 0.2s;
}

.matchup-header:hover {
  background: rgba(255,255,255,0.02);
}

.matchup-portrait {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: contain;
  background: var(--bg-secondary);
  border: 2px solid var(--border-subtle);
  flex-shrink: 0;
}

.matchup-char-info {
  flex: 1;
  min-width: 0;
}

.matchup-char-name {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-primary);
}

.matchup-char-record {
  font-size: 0.78rem;
  color: var(--text-secondary);
}

.matchup-winrate {
  font-size: 1.6rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
}

.matchup-toggle {
  font-size: 0.75rem;
  color: var(--text-muted);
  transition: transform 0.3s;
  flex-shrink: 0;
}

.matchup-row.expanded .matchup-toggle {
  transform: rotate(180deg);
}

.matchup-stages {
  display: none;
  padding: 0 20px 16px;
  display: none;
  gap: 8px;
  flex-wrap: wrap;
}

.matchup-row.expanded .matchup-stages {
  display: flex;
}

.matchup-stage-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  font-size: 0.8rem;
  transition: border-color 0.2s;
}

.matchup-stage-chip:hover {
  border-color: var(--border-accent);
}

.vschar-chip {
  padding: 6px 12px;
}

.chip-char-portrait {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  object-fit: cover;
  background: rgba(255,255,255,0.08);
  flex-shrink: 0;
}

.chip-stage-name {
  color: var(--text-secondary);
  font-weight: 500;
}

.chip-winrate {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.chip-record {
  color: var(--text-muted);
  font-size: 0.72rem;
}

/* ── Animations ───────────────────────────────────────────── */
@keyframes cardIn {
  from {
    opacity: 0;
    transform: translateY(20px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.card-enter {
  animation: cardIn 0.4s cubic-bezier(0.4, 0, 0.2, 1) both;
}

@keyframes flashUpdate {
  0%   { background: rgba(139, 92, 246, 0.25); }
  100% { background: transparent; }
}

.flash-update {
  animation: flashUpdate 0.7s ease-out;
}

/* ── Error Toast ──────────────────────────────────────────── */
.error-toast {
  position: fixed;
  bottom: 32px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 24px;
  background: rgba(15, 5, 5, 0.95);
  border: 1px solid rgba(239, 68, 68, 0.4);
  border-radius: 14px;
  color: var(--text-primary);
  font-size: 0.9rem;
  font-weight: 500;
  backdrop-filter: blur(16px);
  box-shadow: 0 8px 32px rgba(0,0,0,0.5), 0 0 20px rgba(239, 68, 68, 0.15);
  z-index: 999;
  max-width: 90vw;
  animation: slideUp 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes slideUp {
  from { opacity: 0; transform: translateX(-50%) translateY(20px); }
  to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}

.error-icon {
  font-size: 1.2rem;
  flex-shrink: 0;
  color: var(--win-low);
}

.error-retry {
  padding: 6px 16px;
  background: rgba(239, 68, 68, 0.2);
  border: 1px solid rgba(239, 68, 68, 0.4);
  border-radius: 8px;
  color: var(--win-low);
  font-size: 0.82rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.2s;
  flex-shrink: 0;
}

.error-retry:hover {
  background: rgba(239, 68, 68, 0.35);
}

/* ── Win Rate Colors ──────────────────────────────────────── */
.wr-high { color: var(--win-high); }
.wr-mid  { color: var(--win-mid);  }
.wr-low  { color: var(--win-low);  }

/* ── Empty state ──────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}

.empty-state-icon {
  font-size: 3rem;
  margin-bottom: 16px;
  opacity: 0.4;
}

/* ── Scrollbar ────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 100px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.18); }

/* ── Responsive ───────────────────────────────────────────── */
@media (max-width: 768px) {
  /* Tighter tab labels on tablet */
  .tabs-bar {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }

  .sort-toggle {
    justify-content: flex-end;
  }
}

@media (max-width: 640px) {
  .studio-wordmark {
    top: 18px;
    left: 18px;
  }

  .logo { font-size: 3rem; }
  .hero.compact .logo { font-size: 1.9rem; }

  .hero {
    padding: 32px 16px 24px;
    min-height: 44vh;
  }

  .hero.compact {
    padding: 16px;
  }

  .container {
    padding: 0 12px;
  }

  .search-form {
    flex-direction: column;
  }

  .btn-analyze {
    justify-content: center;
  }

  /* Tab strip: full-width horizontal scroll, hidden scrollbar */
  .tabs-bar {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
    margin-bottom: 20px;
  }

  .tabs {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    scroll-snap-type: x proximity;
  }

  .tabs::-webkit-scrollbar {
    display: none;
  }

  .tab {
    flex-shrink: 0;
    padding: 9px 16px;
    font-size: 0.82rem;
    scroll-snap-align: start;
  }

  .sort-toggle {
    justify-content: flex-end;
  }

  .sort-label {
    display: none;
  }

  /* Summary bar: 2 columns */
  .summary-bar {
    grid-template-columns: repeat(2, 1fr);
    padding: 14px 12px;
    gap: 12px;
    margin-bottom: 20px;
  }

  .summary-value {
    font-size: 1.5rem;
  }

  /* Stage grid: single column */
  .stage-grid {
    grid-template-columns: 1fr;
    gap: 14px;
  }

  .stage-card {
    height: 160px;
  }

  .stage-winrate {
    font-size: 2.1rem;
  }

  /* Character grid: 2 columns minimum, allow 3 */
  .char-grid {
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 12px;
  }

  /* Matchup rows */
  .matchup-header {
    padding: 12px 14px;
    gap: 10px;
  }

  .matchup-winrate {
    font-size: 1.25rem;
  }

  .matchup-char-name {
    font-size: 0.88rem;
  }

  .matchup-char-record {
    font-size: 0.72rem;
  }

  .matchup-portrait {
    width: 34px;
    height: 34px;
  }

  .matchup-stages {
    padding: 0 12px 12px;
    gap: 6px;
  }

  .matchup-stage-chip {
    padding: 6px 10px;
    font-size: 0.75rem;
    gap: 6px;
  }

  .vschar-chip {
    padding: 5px 8px;
  }

  .chip-char-portrait {
    width: 22px;
    height: 22px;
  }

  /* Progress */
  .progress-section {
    padding: 14px 0 18px;
  }

  .progress-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
  }

  .progress-stats {
    gap: 6px;
  }

  .progress-stat-pill {
    padding: 3px 9px;
    font-size: 0.75rem;
  }

  /* Results */
  .results-section {
    padding: 20px 0 60px;
  }
}

@media (max-width: 400px) {
  .char-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .tab {
    padding: 8px 13px;
    font-size: 0.78rem;
  }
}
