/* ==========================================================
   PokéTracker — Estilos
   Diseño iOS-inspired + acentos gaming
   ========================================================== */

:root {
  /* Colores claros (default) */
  --bg:           #f5f5f7;
  --bg-2:         #ffffff;
  --bg-3:         #ebebef;
  --surface:      rgba(255,255,255,0.78);
  --surface-2:    rgba(255,255,255,0.92);
  --border:       rgba(0,0,0,0.08);
  --border-strong:rgba(0,0,0,0.14);

  --text:         #0b0c10;
  --text-soft:    #4b5563;
  --text-muted:   #8a8a8e;

  --accent:        #ef4444;
  --accent-soft:   #fee2e2;
  --accent-2:      #3b82f6;
  --accent-2-soft: #dbeafe;
  --success:       #10b981;
  --success-soft:  #d1fae5;
  --warning:       #f59e0b;
  --gold:          #FFD700;
  --legendary:     linear-gradient(135deg,#a855f7,#ec4899,#f59e0b);
  --platinum:      linear-gradient(135deg,#60a5fa,#c084fc);
  --gold-grad:     linear-gradient(135deg,#fbbf24,#f59e0b);
  --silver:        linear-gradient(135deg,#cbd5e1,#94a3b8);
  --bronze:        linear-gradient(135deg,#fb923c,#a16207);

  --shadow-sm:    0 1px 2px rgba(0,0,0,0.06);
  --shadow-md:    0 8px 24px rgba(0,0,0,0.08);
  --shadow-lg:    0 24px 48px rgba(0,0,0,0.12);
  --shadow-glow:  0 0 0 4px rgba(239,68,68,0.18);

  --r-sm: 10px;
  --r-md: 16px;
  --r-lg: 22px;
  --r-xl: 28px;

  --font:        'Outfit', -apple-system, BlinkMacSystemFont, "SF Pro Display", system-ui, sans-serif;
  --font-mono:   'JetBrains Mono', ui-monospace, "SF Mono", monospace;

  --header-h: 64px;
  --bottom-h: 72px;
}

[data-theme="dark"] {
  --bg:           #0a0a0f;
  --bg-2:         #14141c;
  --bg-3:         #1c1c26;
  --surface:      rgba(28,28,38,0.72);
  --surface-2:    rgba(28,28,38,0.92);
  --border:       rgba(255,255,255,0.08);
  --border-strong:rgba(255,255,255,0.14);

  --text:         #f5f5f7;
  --text-soft:    #c7c7cc;
  --text-muted:   #8e8e93;

  --accent-soft:   rgba(239,68,68,0.18);
  --accent-2-soft: rgba(59,130,246,0.18);
  --success-soft:  rgba(16,185,129,0.18);

  --shadow-sm:    0 1px 2px rgba(0,0,0,0.4);
  --shadow-md:    0 8px 24px rgba(0,0,0,0.45);
  --shadow-lg:    0 24px 48px rgba(0,0,0,0.6);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
}

body {
  min-height: 100vh;
  background:
    radial-gradient(at 0% 0%, rgba(239,68,68,0.07) 0%, transparent 40%),
    radial-gradient(at 100% 0%, rgba(59,130,246,0.07) 0%, transparent 40%),
    radial-gradient(at 100% 100%, rgba(168,85,247,0.05) 0%, transparent 40%),
    var(--bg);
}

button { font: inherit; cursor: pointer; border: none; background: none; color: inherit; }
input, select, textarea { font: inherit; color: inherit; }
img { display: block; max-width: 100%; }
.hidden { display: none !important; }

/* ============ AUTH SCREEN ============ */
.auth-screen {
  position: fixed; inset: 0;
  display: grid; place-items: center;
  padding: 24px;
  overflow: hidden;
  z-index: 100;
}
.auth-bg { position: absolute; inset: 0; overflow: hidden; z-index: 0; }
.auth-blob { position: absolute; border-radius: 50%; filter: blur(80px); opacity: 0.5; }
.blob-1 { width: 500px; height: 500px; background: #ef4444; top: -120px; left: -120px; animation: float 18s ease-in-out infinite; }
.blob-2 { width: 460px; height: 460px; background: #3b82f6; bottom: -100px; right: -120px; animation: float 22s ease-in-out infinite reverse; }
.blob-3 { width: 360px; height: 360px; background: #a855f7; top: 40%; left: 50%; transform: translateX(-50%); animation: float 26s ease-in-out infinite; }

@keyframes float {
  0%,100% { transform: translate(0,0) scale(1); }
  33%     { transform: translate(60px,-40px) scale(1.08); }
  66%     { transform: translate(-40px,30px) scale(0.94); }
}

.auth-card {
  position: relative; z-index: 1;
  width: 100%; max-width: 420px;
  background: var(--surface-2);
  backdrop-filter: blur(40px) saturate(180%);
  -webkit-backdrop-filter: blur(40px) saturate(180%);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  padding: 40px 32px 28px;
  box-shadow: var(--shadow-lg);
}
.auth-logo { text-align: center; margin-bottom: 28px; }
.auth-logo svg { margin: 0 auto 12px; filter: drop-shadow(0 6px 12px rgba(239,68,68,0.3)); }
.auth-logo h1 { font-size: 30px; font-weight: 800; letter-spacing: -0.02em; }
.auth-logo p { font-size: 14px; color: var(--text-muted); margin-top: 4px; }

.auth-tabs {
  display: flex; gap: 4px;
  background: var(--bg-3);
  padding: 4px; border-radius: 12px;
  margin-bottom: 22px;
}
.tab-btn {
  flex: 1; padding: 10px;
  border-radius: 9px;
  font-weight: 600; font-size: 14px;
  color: var(--text-muted);
  transition: all 0.2s;
}
.tab-btn.active {
  background: var(--bg-2);
  color: var(--text);
  box-shadow: var(--shadow-sm);
}

.auth-form { display: none; flex-direction: column; gap: 14px; }
.auth-form.active { display: flex; }
.auth-form label { display: flex; flex-direction: column; gap: 6px; }
.auth-form label span {
  font-size: 12px; font-weight: 600;
  color: var(--text-soft); text-transform: uppercase; letter-spacing: 0.04em;
}
.auth-form input {
  padding: 13px 14px;
  background: var(--bg-3);
  border: 1px solid transparent;
  border-radius: 12px;
  font-size: 15px;
  transition: all 0.2s;
}
.auth-form input:focus {
  outline: none;
  border-color: var(--accent);
  background: var(--bg-2);
  box-shadow: var(--shadow-glow);
}

.btn-primary {
  margin-top: 8px;
  padding: 14px;
  background: linear-gradient(135deg, var(--accent), #dc2626);
  color: white;
  border-radius: 14px;
  font-weight: 700; font-size: 15px;
  letter-spacing: 0.01em;
  transition: transform 0.15s, box-shadow 0.2s;
  box-shadow: 0 8px 20px rgba(239,68,68,0.35);
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 12px 28px rgba(239,68,68,0.45); }
.btn-primary:active { transform: translateY(0); }

.form-error { color: var(--accent); font-size: 13px; text-align: center; min-height: 18px; margin-top: 4px; }

.auth-foot { display: flex; justify-content: center; margin-top: 20px; }
.lang-toggle {
  padding: 8px 14px; border-radius: 999px;
  background: var(--bg-3); color: var(--text-soft);
  font-size: 13px; font-weight: 600;
  transition: all 0.2s;
}
.lang-toggle:hover { background: var(--bg-2); color: var(--text); }

/* ============ APP HEADER ============ */
.app { min-height: 100vh; padding-bottom: var(--bottom-h); }

.app-header {
  position: sticky; top: 0; z-index: 50;
  background: var(--surface);
  backdrop-filter: blur(28px) saturate(180%);
  -webkit-backdrop-filter: blur(28px) saturate(180%);
  border-bottom: 1px solid var(--border);
}
.header-inner {
  max-width: 1280px; margin: 0 auto;
  height: var(--header-h);
  display: flex; align-items: center; gap: 24px;
  padding: 0 20px;
}
.logo-btn {
  display: flex; align-items: center; gap: 10px;
  font-weight: 800; font-size: 17px; letter-spacing: -0.01em;
  color: var(--text);
}
.logo-btn svg { color: var(--text); }

.header-nav { display: flex; gap: 4px; margin-left: 24px; }
.nav-link {
  padding: 8px 14px; border-radius: 10px;
  font-size: 14px; font-weight: 500;
  color: var(--text-soft);
  transition: all 0.2s;
}
.nav-link:hover { background: var(--bg-3); color: var(--text); }
.nav-link.active { background: var(--accent); color: white; }

.header-actions { margin-left: auto; display: flex; align-items: center; gap: 10px; }

.icon-btn {
  width: 38px; height: 38px;
  border-radius: 50%;
  display: grid; place-items: center;
  background: var(--bg-3);
  transition: all 0.2s;
}
.icon-btn:hover { background: var(--accent); color: white; }
.icon-btn .icon-moon { display: none; }
[data-theme="dark"] .icon-btn .icon-sun { display: none; }
[data-theme="dark"] .icon-btn .icon-moon { display: block; }

.user-pill {
  display: flex; align-items: center; gap: 8px;
  padding: 4px 12px 4px 4px;
  border-radius: 999px;
  background: var(--bg-3);
  font-size: 14px; font-weight: 600;
  transition: all 0.2s;
}
.user-pill:hover { background: var(--accent); color: white; }
.avatar-mini {
  width: 30px; height: 30px; border-radius: 50%;
  background: var(--bg-2); overflow: hidden;
  display: grid; place-items: center;
}
.avatar-mini img { width: 100%; height: 100%; object-fit: cover; }

/* ============ MAIN ============ */
.app-main {
  max-width: 1280px;
  margin: 0 auto;
  padding: 28px 20px 40px;
}

.page-header {
  margin-bottom: 26px;
}
.page-title {
  font-size: clamp(28px, 4vw, 40px);
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.1;
  margin-bottom: 6px;
}
.page-subtitle {
  color: var(--text-muted);
  font-size: 15px;
}

/* ============ HOME ============ */
.welcome-card {
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(at 100% 0%, rgba(239,68,68,0.25) 0%, transparent 50%),
    radial-gradient(at 0% 100%, rgba(59,130,246,0.18) 0%, transparent 50%),
    var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  padding: 28px 28px;
  margin-bottom: 28px;
  box-shadow: var(--shadow-md);
}
.welcome-card::after {
  content: '';
  position: absolute; inset: 0;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='60' height='60' viewBox='0 0 60 60'%3E%3Cg fill-rule='evenodd'%3E%3Cg fill='%23000000' fill-opacity='0.025'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
  pointer-events: none;
}
.welcome-greeting { font-size: 13px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.08em; font-weight: 600; }
.welcome-name {
  font-size: clamp(28px, 4vw, 38px);
  font-weight: 800; letter-spacing: -0.02em;
  margin-top: 4px;
}
.welcome-stats {
  display: flex; gap: 24px; margin-top: 18px; flex-wrap: wrap;
}
.welcome-stat {
  display: flex; flex-direction: column; gap: 2px;
}
.welcome-stat-value {
  font-family: var(--font);
  font-size: 26px; font-weight: 800;
  letter-spacing: -0.02em;
}
.welcome-stat-label {
  font-size: 12px; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: 0.06em; font-weight: 600;
}

.level-bar {
  margin-top: 22px;
  background: var(--bg-3);
  border-radius: 999px;
  height: 12px;
  overflow: hidden;
  position: relative;
}
.level-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--warning));
  border-radius: 999px;
  transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
}
.level-bar-fill::after {
  content: '';
  position: absolute; inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.4), transparent);
  animation: shimmer 2.4s linear infinite;
}
@keyframes shimmer { 0% { transform: translateX(-100%); } 100% { transform: translateX(100%); } }

.level-meta {
  display: flex; justify-content: space-between; margin-top: 8px;
  font-size: 12px; color: var(--text-muted); font-weight: 600;
}

.section-title {
  display: flex; align-items: baseline; justify-content: space-between;
  margin: 32px 0 16px;
}
.section-title h2 {
  font-size: 22px; font-weight: 800; letter-spacing: -0.01em;
}
.section-title a {
  font-size: 13px; font-weight: 600; color: var(--accent);
}

/* ============ SET CARDS ============ */
.set-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 18px;
}

.set-card {
  position: relative;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  overflow: hidden;
  transition: transform 0.2s, box-shadow 0.25s, border-color 0.2s;
  cursor: pointer;
}
.set-card:hover {
  transform: translateY(-4px);
  border-color: var(--border-strong);
  box-shadow: var(--shadow-lg);
}

.set-card-header {
  padding: 18px 18px 14px;
  display: flex; gap: 14px; align-items: center;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(to bottom, var(--bg-3), transparent);
}
.set-card-logo {
  width: 60px; height: 60px;
  display: grid; place-items: center;
  flex-shrink: 0;
}
.set-card-logo img { max-width: 100%; max-height: 100%; object-fit: contain; }

.set-card-info { flex: 1; min-width: 0; }
.set-card-name {
  font-size: 16px; font-weight: 700;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  letter-spacing: -0.01em;
}
.set-card-series {
  font-size: 12px; color: var(--text-muted);
  margin-top: 2px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.set-card-body {
  padding: 16px 18px 18px;
}
.set-card-progress {
  display: flex; flex-direction: column; gap: 10px;
}
.progress-row {
  display: flex; align-items: center; gap: 10px;
  font-size: 13px;
}
.progress-row-label {
  flex: 1;
  font-weight: 600; color: var(--text-soft);
}
.progress-row-value {
  font-family: var(--font-mono);
  font-size: 12px; color: var(--text-muted);
}
.progress-bar {
  height: 8px;
  background: var(--bg-3);
  border-radius: 999px;
  overflow: hidden;
  margin-top: 4px;
}
.progress-bar-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--accent-2), var(--accent));
  transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}
.progress-bar-fill.master {
  background: var(--legendary);
}
.progress-bar-fill.complete {
  background: linear-gradient(90deg, var(--success), #34d399);
}

.set-card-badge {
  position: absolute; top: 14px; right: 14px;
  padding: 4px 10px; border-radius: 999px;
  font-size: 11px; font-weight: 700;
  letter-spacing: 0.04em; text-transform: uppercase;
}
.set-card-badge.subscribed {
  background: var(--accent-2-soft); color: var(--accent-2);
}
.set-card-badge.complete {
  background: var(--success-soft); color: var(--success);
}

/* ============ SETS PAGE FILTERS ============ */
.filter-bar {
  display: flex; gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 22px;
  padding: 6px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 14px;
}
.filter-chip {
  padding: 8px 14px;
  border-radius: 9px;
  font-size: 13px; font-weight: 600;
  color: var(--text-soft);
  transition: all 0.2s;
}
.filter-chip.active {
  background: var(--accent); color: white;
}
.filter-chip:hover:not(.active) { background: var(--bg-3); color: var(--text); }

.search-bar {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 14px;
  margin-bottom: 16px;
}
.search-bar input {
  flex: 1; background: transparent; border: none; outline: none;
  font-size: 14px;
}

/* ============ SET DETAIL ============ */
.set-detail-header {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 24px;
  padding: 28px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  margin-bottom: 24px;
  box-shadow: var(--shadow-md);
}
.set-detail-logo {
  width: 140px; height: 140px;
  display: grid; place-items: center;
  background: var(--bg-3);
  border-radius: var(--r-md);
  padding: 16px;
}
.set-detail-logo img { max-width: 100%; max-height: 100%; }
.set-detail-info h1 {
  font-size: clamp(24px, 3vw, 34px);
  font-weight: 800; letter-spacing: -0.02em;
}
.set-detail-meta {
  display: flex; gap: 16px; flex-wrap: wrap;
  color: var(--text-muted); font-size: 14px;
  margin-top: 6px;
}
.set-detail-actions {
  margin-top: 16px; display: flex; gap: 10px; flex-wrap: wrap;
}
.btn-sub, .btn-secondary {
  padding: 10px 18px;
  border-radius: 12px;
  font-size: 14px; font-weight: 600;
  transition: all 0.2s;
}
.btn-sub {
  background: var(--accent); color: white;
  box-shadow: 0 4px 12px rgba(239,68,68,0.3);
}
.btn-sub:hover { transform: translateY(-1px); }
.btn-sub.subscribed { background: var(--bg-3); color: var(--text); box-shadow: none; }
.btn-secondary {
  background: var(--bg-3); color: var(--text);
}
.btn-secondary:hover { background: var(--border-strong); }

.set-progress-block {
  margin-top: 18px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
.progress-card {
  background: var(--bg-3);
  border-radius: var(--r-md);
  padding: 14px 16px;
}
.progress-card-label {
  display: flex; justify-content: space-between; align-items: baseline;
  margin-bottom: 8px;
}
.progress-card-label strong {
  font-size: 13px; text-transform: uppercase; letter-spacing: 0.05em;
  color: var(--text-soft);
}
.progress-card-label span {
  font-family: var(--font-mono); font-size: 13px;
  color: var(--text-muted);
}
.progress-card-percent {
  font-size: 24px; font-weight: 800;
  letter-spacing: -0.02em;
  margin-top: 8px;
}

/* ============ CARDS GRID ============ */
.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 14px;
}

.card-tile {
  position: relative;
  border-radius: var(--r-md);
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
  background: var(--bg-3);
  aspect-ratio: 2.5 / 3.5;
}
.card-tile:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
}
.card-tile img {
  width: 100%; height: 100%;
  object-fit: cover;
  transition: filter 0.25s;
}
.card-tile.not-owned img { filter: grayscale(1) brightness(0.5); }
.card-tile-overlay {
  position: absolute; inset: 0;
  background: linear-gradient(to top, rgba(0,0,0,0.7) 0%, transparent 50%);
  display: flex; align-items: flex-end;
  padding: 8px 10px;
  opacity: 0; transition: opacity 0.2s;
}
.card-tile:hover .card-tile-overlay { opacity: 1; }
.card-tile-number {
  position: absolute; top: 8px; left: 8px;
  background: rgba(0,0,0,0.7); color: white;
  font-family: var(--font-mono); font-size: 11px; font-weight: 600;
  padding: 3px 7px; border-radius: 6px;
  backdrop-filter: blur(6px);
}
.card-tile-check {
  position: absolute; top: 8px; right: 8px;
  width: 24px; height: 24px; border-radius: 50%;
  background: var(--success); color: white;
  display: grid; place-items: center;
  box-shadow: 0 2px 8px rgba(16,185,129,0.5);
}
.card-tile.not-owned .card-tile-check { display: none; }

.card-tile-variants {
  position: absolute; bottom: 8px; left: 8px; right: 8px;
  display: flex; gap: 4px; flex-wrap: wrap;
}
.variant-dot {
  width: 14px; height: 14px; border-radius: 50%;
  border: 2px solid white;
  box-shadow: 0 1px 3px rgba(0,0,0,0.3);
}
.variant-dot.normal     { background: #94a3b8; }
.variant-dot.holo       { background: linear-gradient(135deg,#fbbf24,#ec4899); }
.variant-dot.reverse_holo { background: linear-gradient(135deg,#60a5fa,#34d399); }
.variant-dot.special_illustration { background: linear-gradient(135deg,#a855f7,#ec4899); }
.variant-dot.hyper_rare { background: linear-gradient(135deg,#fbbf24,#dc2626); }
.variant-dot.full_art   { background: linear-gradient(135deg,#3b82f6,#8b5cf6); }
.variant-dot.owned { box-shadow: 0 0 0 2px var(--success), 0 1px 3px rgba(0,0,0,0.3); }

/* ============ BADGES PAGE ============ */
.badges-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
}
.badge-card {
  position: relative;
  padding: 22px 20px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  text-align: center;
  transition: transform 0.2s, box-shadow 0.25s;
  cursor: pointer;
}
.badge-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); }
.badge-card.locked { opacity: 0.55; filter: grayscale(0.8); }

.badge-icon {
  width: 72px; height: 72px; border-radius: 50%;
  margin: 0 auto 14px;
  display: grid; place-items: center;
  position: relative;
  color: white;
}
.badge-icon svg { width: 36px; height: 36px; }
.badge-icon.bronze    { background: var(--bronze); }
.badge-icon.silver    { background: var(--silver); }
.badge-icon.gold      { background: var(--gold-grad); }
.badge-icon.platinum  { background: var(--platinum); }
.badge-icon.legendary { background: var(--legendary); animation: legendary-spin 6s linear infinite; }
@keyframes legendary-spin {
  0% { filter: hue-rotate(0deg); }
  100% { filter: hue-rotate(360deg); }
}
.badge-icon::after {
  content: '';
  position: absolute; inset: -6px;
  border-radius: 50%;
  background: inherit;
  opacity: 0.15;
  z-index: -1;
  filter: blur(8px);
}

.badge-name { font-size: 16px; font-weight: 700; letter-spacing: -0.01em; }
.badge-desc { font-size: 12px; color: var(--text-muted); margin-top: 4px; line-height: 1.4; }
.badge-xp {
  margin-top: 10px;
  display: inline-block;
  padding: 3px 10px; border-radius: 999px;
  background: var(--bg-3);
  font-family: var(--font-mono); font-size: 11px; font-weight: 600;
  color: var(--text-soft);
}
.badge-xp.unlocked { background: var(--accent-soft); color: var(--accent); }

.badge-tier-tag {
  position: absolute; top: 12px; right: 12px;
  font-size: 10px; font-weight: 700;
  letter-spacing: 0.06em; text-transform: uppercase;
  padding: 3px 8px; border-radius: 999px;
  background: var(--bg-3); color: var(--text-muted);
}

/* ============ PROFILE PAGE ============ */
.profile-hero {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 28px;
  padding: 32px;
  background:
    radial-gradient(at 100% 0%, rgba(168,85,247,0.18) 0%, transparent 50%),
    radial-gradient(at 0% 100%, rgba(239,68,68,0.15) 0%, transparent 50%),
    var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  margin-bottom: 24px;
  box-shadow: var(--shadow-md);
}
.profile-avatar-wrap {
  position: relative;
  width: 140px; height: 140px;
}
.profile-avatar {
  width: 100%; height: 100%; border-radius: 50%;
  background: var(--bg-3);
  border: 4px solid var(--bg-2);
  box-shadow: 0 8px 24px rgba(0,0,0,0.15);
  overflow: hidden;
  display: grid; place-items: center;
}
.profile-avatar img { width: 100%; height: 100%; }
.profile-edit-avatar {
  position: absolute; bottom: 4px; right: 4px;
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--accent); color: white;
  display: grid; place-items: center;
  box-shadow: 0 4px 12px rgba(239,68,68,0.4);
  transition: transform 0.2s;
}
.profile-edit-avatar:hover { transform: scale(1.1); }

.profile-username {
  font-size: 28px; font-weight: 800; letter-spacing: -0.02em;
}
.profile-email { color: var(--text-muted); font-size: 14px; }
.profile-level-row {
  display: flex; align-items: center; gap: 14px; margin-top: 16px;
}
.profile-level-pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 14px; border-radius: 999px;
  background: var(--accent); color: white;
  font-weight: 700; font-size: 14px;
}

.profile-showcase {
  display: flex; gap: 12px; flex-wrap: wrap; margin-top: 18px;
}
.showcase-slot {
  width: 60px; height: 60px;
  border-radius: 50%;
  border: 2px dashed var(--border-strong);
  display: grid; place-items: center;
  color: var(--text-muted);
}
.showcase-slot.filled { border: none; }

.profile-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
  margin-bottom: 28px;
}
.stat-card {
  padding: 20px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
}
.stat-card-label {
  font-size: 12px; font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase; letter-spacing: 0.06em;
}
.stat-card-value {
  font-size: 32px; font-weight: 800; letter-spacing: -0.02em;
  margin-top: 6px;
}

.settings-block {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 8px;
  margin-bottom: 16px;
}
.setting-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 14px;
  border-radius: 12px;
}
.setting-row + .setting-row { border-top: 1px solid var(--border); border-radius: 0; }
.setting-row:hover { background: var(--bg-3); }
.setting-row-label { font-weight: 500; }
.setting-row-control { display: flex; gap: 6px; }
.toggle-segment {
  display: flex; gap: 2px;
  background: var(--bg-3); padding: 3px; border-radius: 10px;
}
.toggle-segment button {
  padding: 6px 14px; border-radius: 8px;
  font-size: 13px; font-weight: 600;
  color: var(--text-muted);
}
.toggle-segment button.active {
  background: var(--bg-2); color: var(--text);
  box-shadow: var(--shadow-sm);
}

.logout-btn {
  width: 100%;
  padding: 14px;
  border-radius: var(--r-md);
  background: var(--accent-soft); color: var(--accent);
  font-weight: 700;
  transition: all 0.2s;
}
.logout-btn:hover { background: var(--accent); color: white; }

/* ============ MODAL ============ */
.modal {
  position: fixed; inset: 0; z-index: 200;
  display: grid; place-items: center;
  padding: 20px;
}
.modal-backdrop {
  position: absolute; inset: 0;
  background: rgba(0,0,0,0.55);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  animation: fadeIn 0.2s;
}
.modal-content {
  position: relative;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  width: 100%; max-width: 520px;
  max-height: 90vh; overflow-y: auto;
  box-shadow: var(--shadow-lg);
  animation: scaleIn 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes scaleIn { from { opacity: 0; transform: scale(0.92); } to { opacity: 1; transform: scale(1); } }

.modal-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
}
.modal-header h3 { font-size: 18px; font-weight: 700; }
.modal-close {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--bg-3);
  display: grid; place-items: center;
  transition: all 0.2s;
}
.modal-close:hover { background: var(--accent); color: white; }
.modal-body { padding: 22px 24px; }

/* Card detail modal */
.card-modal-img {
  width: 100%;
  max-width: 280px;
  margin: 0 auto;
  display: block;
  border-radius: var(--r-md);
  box-shadow: var(--shadow-md);
}
.variant-list {
  margin-top: 22px;
  display: flex; flex-direction: column; gap: 10px;
}
.variant-row {
  display: flex; align-items: center; gap: 14px;
  padding: 14px;
  background: var(--bg-3);
  border-radius: var(--r-md);
  cursor: pointer;
  transition: all 0.2s;
  border: 2px solid transparent;
}
.variant-row:hover { background: var(--border-strong); }
.variant-row.owned {
  background: var(--success-soft);
  border-color: var(--success);
}
.variant-row-label {
  flex: 1; font-weight: 600; font-size: 14px;
}
.variant-row-control { display: flex; align-items: center; gap: 8px; }
.qty-btn {
  width: 30px; height: 30px; border-radius: 50%;
  background: var(--bg-2);
  display: grid; place-items: center;
  font-weight: 700;
  transition: all 0.2s;
}
.qty-btn:hover { background: var(--accent); color: white; }
.qty-value {
  min-width: 28px; text-align: center;
  font-family: var(--font-mono); font-weight: 700;
}

/* Avatar picker */
.avatar-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-top: 12px;
}
.avatar-option {
  aspect-ratio: 1;
  border-radius: 50%;
  background: var(--bg-3);
  cursor: pointer;
  overflow: hidden;
  border: 3px solid transparent;
  transition: all 0.2s;
}
.avatar-option:hover { transform: scale(1.05); }
.avatar-option.selected { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.avatar-option img { width: 100%; height: 100%; }

/* ============ TOAST ============ */
.toast-container {
  position: fixed; bottom: 90px; right: 20px;
  display: flex; flex-direction: column; gap: 10px;
  z-index: 300;
  pointer-events: none;
}
.toast {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-left: 4px solid var(--accent);
  padding: 14px 18px;
  border-radius: var(--r-md);
  box-shadow: var(--shadow-lg);
  min-width: 280px; max-width: 380px;
  display: flex; align-items: center; gap: 12px;
  animation: toastIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  pointer-events: all;
}
.toast.success { border-left-color: var(--success); }
.toast.badge {
  border-left-color: var(--gold);
  background: linear-gradient(135deg, var(--bg-2), rgba(255,215,0,0.06));
}
.toast-icon {
  width: 36px; height: 36px; border-radius: 50%;
  display: grid; place-items: center; flex-shrink: 0;
  color: white;
}
.toast.success .toast-icon { background: var(--success); }
.toast.badge .toast-icon { background: var(--gold-grad); }
.toast.error .toast-icon { background: var(--accent); }
.toast-text { flex: 1; font-size: 14px; }
.toast-title { font-weight: 700; }
.toast-desc { font-size: 12px; color: var(--text-muted); }
@keyframes toastIn {
  from { opacity: 0; transform: translateX(100%); }
  to { opacity: 1; transform: translateX(0); }
}

/* ============ BOTTOM NAV (mobile) ============ */
.bottom-nav {
  display: none;
  position: fixed; bottom: 0; left: 0; right: 0;
  height: var(--bottom-h);
  background: var(--surface-2);
  backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  border-top: 1px solid var(--border);
  padding-bottom: env(safe-area-inset-bottom);
  z-index: 50;
}
.bn-btn {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 4px;
  color: var(--text-muted);
  font-size: 11px; font-weight: 600;
  transition: color 0.2s;
}
.bn-btn svg { width: 24px; height: 24px; }
.bn-btn.active { color: var(--accent); }

/* ============ LOADING ============ */
.skeleton {
  background: linear-gradient(90deg, var(--bg-3) 0%, var(--border-strong) 50%, var(--bg-3) 100%);
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.5s linear infinite;
  border-radius: var(--r-md);
}
@keyframes skeleton-shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

.spinner {
  width: 36px; height: 36px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 40px auto;
}
@keyframes spin { to { transform: rotate(360deg); } }

.empty-state {
  text-align: center; padding: 60px 20px;
}
.empty-state-icon {
  font-size: 56px; margin-bottom: 12px; opacity: 0.5;
}
.empty-state-title { font-size: 18px; font-weight: 700; margin-bottom: 4px; }
.empty-state-desc { color: var(--text-muted); font-size: 14px; margin-bottom: 20px; }

/* ============ RESPONSIVE ============ */
@media (max-width: 768px) {
  .header-nav { display: none; }
  .header-actions .user-pill span { display: none; }
  .app-main { padding: 18px 14px 24px; }
  .bottom-nav { display: flex; }
  .app { padding-bottom: var(--bottom-h); }

  .welcome-card { padding: 22px 20px; }
  .profile-hero {
    grid-template-columns: 1fr;
    text-align: center;
    padding: 24px 20px;
  }
  .profile-avatar-wrap { margin: 0 auto; }
  .profile-showcase { justify-content: center; }
  .set-detail-header {
    grid-template-columns: 1fr;
    text-align: center;
    padding: 22px;
  }
  .set-detail-logo { margin: 0 auto; }
  .set-detail-actions { justify-content: center; }

  .cards-grid {
    grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
    gap: 10px;
  }
  .set-progress-block { grid-template-columns: 1fr; }
}

@media (max-width: 480px) {
  .badges-grid { grid-template-columns: repeat(2, 1fr); }
  .badge-card { padding: 18px 12px; }
  .badge-icon { width: 60px; height: 60px; }
}

@media (min-width: 769px) {
  .bottom-nav { display: none !important; }
}
