/* ── Google Fonts ─────────────────────────────────────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@400;500;600;700;800&family=DM+Sans:wght@400;500;600;700&display=swap');

/* ── Design Tokens (dark default) ────────────────────────────────────────── */
:root {
  --bg:       #0B1120;
  --bg-s:     #131E35;
  --bg-e:     #1B2944;
  --bg-h:     #1F3254;
  --border:   rgba(255,255,255,0.08);
  --border-s: rgba(255,255,255,0.14);
  --accent:   #4A8CF7;
  --accent-d: rgba(74,140,247,0.18);
  --red:      #FF4F4F;
  --green:    #2DD984;
  --gold:     #FFB800;
  --t1:       #E8EFF8;
  --t2:       #7A91B0;
  --t3:       #3E5472;
  --r:        12px;
  --r-lg:     18px;
  --nav-h:    56px;
  --bnav-h:   60px;
  --font-d:   'Outfit', 'Nunito', system-ui, sans-serif;
  --font-b:   'DM Sans', 'Inter', system-ui, sans-serif;
}

[data-theme="light"] {
  --bg:       #F0F4FC;
  --bg-s:     #FFFFFF;
  --bg-e:     #EAF0FB;
  --bg-h:     #DDE8F8;
  --border:   rgba(0,0,0,0.08);
  --border-s: rgba(0,0,0,0.14);
  --t1:       #0D1B33;
  --t2:       #4A5E78;
  --t3:       #8FA3C0;
}

[data-theme="amoled"] {
  --bg:   #000000;
  --bg-s: #0A0A0A;
  --bg-e: #111111;
  --bg-h: #1A1A1A;
}

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

html { font-size: 16px; -webkit-text-size-adjust: 100%; }

body {
  font-family: var(--font-b);
  background: var(--bg);
  color: var(--t1);
  min-height: 100vh;
  overscroll-behavior: none;
}

img { display: block; max-width: 100%; }
button { cursor: pointer; border: none; background: none; font-family: inherit; }
input, textarea, select { font-family: inherit; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Typography helpers ──────────────────────────────────────────────────── */
.font-d { font-family: var(--font-d); }
.t1 { color: var(--t1); }
.t2 { color: var(--t2); }
.t3 { color: var(--t3); }
.accent { color: var(--accent); }

/* ── Layout ──────────────────────────────────────────────────────────────── */
.page-wrap {
  padding-top: var(--nav-h);
  padding-bottom: calc(var(--bnav-h) + 8px);
  min-height: 100vh;
}

@media (min-width: 768px) {
  .page-wrap { padding-bottom: 24px; }
}

.container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 16px;
}

/* ── Top Nav ─────────────────────────────────────────────────────────────── */
.top-nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--nav-h);
  background: rgba(11,17,32,0.85);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
  z-index: 100;
  display: flex;
  align-items: center;
  padding: 0 16px;
  gap: 8px;
}

[data-theme="light"] .top-nav { background: rgba(240,244,252,0.85); }
[data-theme="amoled"] .top-nav { background: rgba(0,0,0,0.92); }

.nav-logo {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-d);
  font-size: 18px;
  font-weight: 800;
  color: var(--t1);
  text-decoration: none;
  flex-shrink: 0;
}

.nav-logo .ball {
  width: 20px; height: 20px;
  background: var(--accent);
  border-radius: 50%;
  flex-shrink: 0;
}

.nav-logo .go { color: var(--accent); }

.nav-links {
  display: none;
  list-style: none;
  gap: 2px;
  margin-left: 16px;
  flex: 1;
}

@media (min-width: 768px) {
  .nav-links { display: flex; }
}

.nav-links a {
  display: flex;
  align-items: center;
  padding: 6px 12px;
  border-radius: var(--r);
  font-size: 14px;
  font-weight: 500;
  color: var(--t2);
  text-decoration: none;
  transition: background 0.15s, color 0.15s;
}

.nav-links a:hover,
.nav-links a.active {
  background: var(--accent-d);
  color: var(--accent);
}

.nav-right {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

.nav-icon-btn {
  width: 36px; height: 36px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: var(--t2);
  transition: background 0.15s, color 0.15s;
  position: relative;
}

.nav-icon-btn:hover { background: var(--bg-h); color: var(--t1); }

.notif-badge {
  position: absolute;
  top: 4px; right: 4px;
  width: 8px; height: 8px;
  background: var(--red);
  border-radius: 50%;
}

.notif-badge.has-count {
  width: auto; min-width: 16px; height: 16px;
  padding: 0 4px;
  font-size: 10px;
  font-weight: 700;
  line-height: 16px;
  border-radius: 8px;
  text-align: center;
  color: #fff;
  top: 2px; right: 2px;
}

.avatar-btn {
  width: 32px; height: 32px;
  border-radius: 50%;
  overflow: hidden;
  background: var(--bg-h);
  display: flex; align-items: center; justify-content: center;
  color: var(--t2);
  font-weight: 600;
  font-size: 13px;
}

.avatar-btn img { width: 100%; height: 100%; object-fit: cover; }

/* ── Bottom Nav (mobile) ─────────────────────────────────────────────────── */
.bottom-nav {
  display: flex;
  position: fixed;
  bottom: 0; left: 0; right: 0;
  height: var(--bnav-h);
  background: var(--bg-s);
  border-top: 1px solid var(--border);
  z-index: 100;
  padding-bottom: env(safe-area-inset-bottom);
}

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

.bnav-tab {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  color: var(--t3);
  font-size: 10px;
  font-weight: 500;
  position: relative;
  transition: color 0.15s;
}

.bnav-tab svg { width: 22px; height: 22px; }

.bnav-tab.active { color: var(--accent); }

.bnav-tab.active::before {
  content: '';
  position: absolute;
  top: -1px; left: 50%; transform: translateX(-50%);
  width: 20px; height: 3px;
  background: var(--accent);
  border-radius: 0 0 3px 3px;
}

/* ── Cards ───────────────────────────────────────────────────────────────── */
.card {
  background: var(--bg-s);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 20px;
}

/* ── Buttons ─────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 40px;
  padding: 0 18px;
  border-radius: var(--r);
  font-size: 14px;
  font-weight: 700;
  transition: opacity 0.15s, transform 0.1s;
  white-space: nowrap;
}

.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.45; pointer-events: none; }

.btn-primary {
  background: var(--accent);
  color: #fff;
}

.btn-primary:hover { opacity: 0.88; }

.btn-ghost {
  background: transparent;
  color: var(--t2);
  border: 1.5px solid var(--border-s);
}

.btn-ghost:hover { color: var(--t1); border-color: var(--border-s); }

.btn-sm { height: 32px; padding: 0 12px; font-size: 13px; }
.btn-lg { height: 48px; padding: 0 24px; font-size: 15px; }

/* ── Form elements ───────────────────────────────────────────────────────── */
.input {
  width: 100%;
  height: 40px;
  padding: 0 12px;
  background: var(--bg-e);
  border: 1.5px solid var(--border);
  border-radius: var(--r);
  color: var(--t1);
  font-size: 14px;
  outline: none;
  transition: border-color 0.15s;
}

.input:focus { border-color: var(--accent); }
.input::placeholder { color: var(--t3); }

.input-sm { height: 36px; font-size: 13px; }

textarea.input {
  height: auto;
  min-height: 76px;
  padding: 10px 12px;
  resize: vertical;
}

/* Search input with icon */
.search-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.search-wrap .search-icon {
  position: absolute;
  left: 10px;
  color: var(--t3);
  pointer-events: none;
}

.search-wrap .input { padding-left: 34px; }

/* ── Pill / filter chips ─────────────────────────────────────────────────── */
.pill {
  display: inline-flex;
  align-items: center;
  height: 32px;
  padding: 0 12px;
  border-radius: 16px;
  font-size: 13px;
  font-weight: 500;
  background: var(--bg-h);
  color: var(--t2);
  border: 1px solid transparent;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s, color 0.15s;
  user-select: none;
}

.pill:hover { background: var(--bg-h); color: var(--t1); }

.pill.active {
  background: var(--accent);
  color: #fff;
}

.pill.pill-sm { height: 26px; padding: 0 10px; font-size: 11px; }

/* ── Progress bar ────────────────────────────────────────────────────────── */
.progress-bar-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
}

.progress-bar {
  flex: 1;
  height: 3px;
  background: var(--bg-h);
  border-radius: 2px;
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), #7eb3ff);
  border-radius: 2px;
  transition: width 0.6s cubic-bezier(0.4,0,0.2,1);
}

.progress-label {
  font-size: 12px;
  color: var(--t2);
  white-space: nowrap;
  flex-shrink: 0;
}

/* ── Progress Ring (SVG) ─────────────────────────────────────────────────── */
.progress-ring { position: relative; display: inline-block; }

.progress-ring svg { transform: rotate(-90deg); }

.progress-ring .ring-bg { fill: none; stroke: var(--bg-h); }
.progress-ring .ring-fill { fill: none; transition: stroke-dashoffset 0.6s cubic-bezier(0.4,0,0.2,1); }

.progress-ring .ring-label {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-family: var(--font-d);
}

/* ── Pokémon Grid ────────────────────────────────────────────────────────── */
.dex-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr); /* overridden by JS per user preference */
  gap: 8px;
  padding: 12px 0;
}

@media (min-width: 768px)  { .dex-grid { gap: 10px; } }

/* ── Columns-per-row control ─────────────────────────────────────────────── */
.cols-ctrl {
  display: flex;
  align-items: center;
  gap: 1px;
  background: var(--bg-e);
  border: 1.5px solid var(--border);
  border-radius: var(--r);
  height: 36px;
  padding: 0 4px;
  flex-shrink: 0;
}

.cols-btn {
  width: 22px;
  height: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--t2);
  font-size: 17px;
  line-height: 1;
  border-radius: 4px;
  transition: color 0.15s;
}
.cols-btn:hover:not(:disabled) { color: var(--t1); }
.cols-btn:disabled { opacity: 0.35; }

.cols-val {
  font-size: 13px;
  font-weight: 600;
  color: var(--t1);
  min-width: 22px;
  text-align: center;
  user-select: none;
}

/* ── Pokémon Card ────────────────────────────────────────────────────────── */
.poke-card {
  position: relative;
  background: var(--bg-s);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 6px 6px 7px;
  cursor: pointer;
  user-select: none;
  transition: border-color 0.15s, transform 0.1s;
  overflow: hidden;
  min-height: 130px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.poke-card:hover { transform: translateY(-1px); }
.poke-card:active { transform: scale(0.96); }
.poke-card:focus, .poke-row:focus { outline: 2px solid var(--accent); outline-offset: 2px; }

.poke-card.caught { /* type-color applied inline via JS */ }
.poke-card.selected { border-color: var(--accent) !important; }

.poke-dex-no {
  position: absolute;
  top: 4px; left: 4px;
  font-size: 9px;
  color: var(--t3);
  line-height: 1;
}

.poke-sprite {
  width: 64px; height: 64px;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  flex-shrink: 0;
}

.poke-card.uncaught .poke-sprite {
  filter: grayscale(1) opacity(0.3);
}

.poke-name {
  font-size: 12px;
  font-weight: 600;
  text-align: center;
  color: var(--t1);
  width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  margin-top: 2px;
}

.poke-shiny-icon {
  position: absolute;
  top: 3px; right: 4px;
  font-size: 10px;
  line-height: 1;
}

.poke-types {
  display: flex;
  gap: 3px;
  flex-wrap: wrap;
  justify-content: center;
}

.poke-types .type-badge { font-size: 9px; height: 15px; padding: 0 5px; }

.poke-indicators {
  display: flex;
  gap: 2px;
  flex-wrap: wrap;
  justify-content: center;
  font-size: 11px;
  min-height: 14px;
  line-height: 1;
}

/* Shadow overlay */
.poke-card.shadow-form::after {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at center, transparent 40%, rgba(80,40,120,0.45) 100%);
  pointer-events: none;
}

/* Just-caught ring pulse */
@keyframes catch-ring {
  0%   { opacity: 0.7; transform: scale(0.8); }
  100% { opacity: 0;   transform: scale(2.2); }
}

.catch-ring {
  position: absolute;
  inset: 0;
  border-radius: var(--r);
  border: 2px solid var(--accent);
  animation: catch-ring 0.6s ease-out forwards;
  pointer-events: none;
}

/* Inline spinner */
@keyframes dtgo-spin {
  to { transform: rotate(360deg); }
}

.spinner {
  display: inline-block;
  width: 12px; height: 12px;
  border: 2px solid var(--t3);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: dtgo-spin 0.7s linear infinite;
  vertical-align: middle;
  margin-right: 6px;
  flex-shrink: 0;
}

/* Skeleton shimmer */
@keyframes shimmer {
  0%   { background-position: -400px 0; }
  100% { background-position:  400px 0; }
}

.skeleton {
  background: linear-gradient(90deg, var(--bg-s) 25%, var(--bg-h) 50%, var(--bg-s) 75%);
  background-size: 800px 100%;
  animation: shimmer 1.4s infinite linear;
}

.poke-card.skeleton-card {
  background: var(--bg-s);
  border-color: var(--border);
}

.poke-card.skeleton-card .poke-sprite {
  width: 56px; height: 56px;
  border-radius: 50%;
}

/* ── List view ───────────────────────────────────────────────────────────── */
.dex-list { display: flex; flex-direction: column; gap: 4px; padding: 8px 0; }

.poke-row {
  display: flex;
  align-items: center;
  height: 52px;
  background: var(--bg-s);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 0 12px;
  gap: 10px;
  cursor: pointer;
  transition: background 0.12s;
}

.poke-row:hover { background: var(--bg-h); }

.poke-row .poke-sprite { width: 40px; height: 40px; image-rendering: pixelated; }
.poke-row .poke-info { flex: 1; min-width: 0; }
.poke-row .poke-info .name { font-size: 14px; font-weight: 600; }
.poke-row .poke-info .types { display: flex; gap: 4px; margin-top: 2px; }
.poke-row .row-flags { display: flex; gap: 3px; align-items: center; flex-wrap: wrap; max-width: 120px; }
.poke-row .row-flag-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--accent);
}
.poke-row .row-flag-emoji { font-size: 13px; line-height: 1; }

/* ── Type badges ─────────────────────────────────────────────────────────── */
.type-badge {
  display: inline-flex;
  align-items: center;
  height: 18px;
  padding: 0 7px;
  border-radius: 9px;
  font-size: 10px;
  font-weight: 600;
  color: #fff;
  text-shadow: 0 1px 2px rgba(0,0,0,0.4);
}

/* ── Bottom Sheet ────────────────────────────────────────────────────────── */
.sheet-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.55);
  z-index: 200;
  opacity: 0;
  transition: opacity 0.3s;
  pointer-events: none;
}

.sheet-overlay.open { opacity: 1; pointer-events: auto; }

.bottom-sheet {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  max-height: 80vh;
  background: var(--bg-s);
  border-radius: var(--r-lg) var(--r-lg) 0 0;
  z-index: 201;
  display: flex;
  flex-direction: column;
  transform: translateY(100%);
  transition: transform 0.3s ease;
}

.bottom-sheet.open { transform: translateY(0); }

.sheet-handle {
  width: 40px; height: 4px;
  background: var(--border-s);
  border-radius: 2px;
  margin: 10px auto 0;
  flex-shrink: 0;
}

.sheet-header {
  padding: 12px 16px 12px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  position: relative;
}

.sheet-close {
  position: absolute;
  top: 10px; right: 12px;
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--bg-h);
  display: flex; align-items: center; justify-content: center;
  color: var(--t2);
  font-size: 16px;
  transition: background 0.15s;
}

.sheet-close:hover { background: var(--bg-e); color: var(--t1); }

.sheet-body {
  overflow-y: auto;
  flex: 1;
  padding: 16px;
  overscroll-behavior: contain;
}

.sheet-pokemon-header {
  display: flex;
  align-items: flex-start;
  gap: 14px;
}

.sheet-sprite {
  width: 80px; height: 80px;
  image-rendering: pixelated;
  flex-shrink: 0;
}

.sheet-info { flex: 1; }

.sheet-dex-no { font-size: 10px; color: var(--t3); }

.sheet-name {
  font-family: var(--font-d);
  font-size: 20px;
  font-weight: 700;
}

.sheet-types { display: flex; gap: 5px; margin-top: 4px; }

.sheet-tags { display: flex; gap: 4px; margin-top: 4px; flex-wrap: wrap; }

.sheet-tag {
  display: inline-flex;
  align-items: center;
  height: 18px;
  padding: 0 7px;
  border-radius: 9px;
  font-size: 10px;
  font-weight: 600;
  background: var(--bg-h);
  color: var(--t2);
}

/* ── Flag grid ───────────────────────────────────────────────────────────── */
.flag-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
}

.flag-btn {
  width: calc(25% - 6px);
  min-width: 68px;
  height: 64px;
  border-radius: var(--r);
  background: var(--bg-e);
  border: 1.5px solid var(--border);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  font-size: 10px;
  color: var(--t2);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
  position: relative;
  user-select: none;
}

@media (min-width: 400px) { .flag-btn { width: calc(20% - 7px); } }

.flag-btn .flag-icon { font-size: 18px; }

.flag-btn.on {
  /* type color applied inline */
}

.flag-btn.locked {
  opacity: 0.35;
  pointer-events: none;
}

.flag-btn .flag-check {
  position: absolute;
  top: 4px; right: 4px;
  width: 14px; height: 14px;
  border-radius: 50%;
  background: var(--green);
  color: #fff;
  font-size: 9px;
  display: flex; align-items: center; justify-content: center;
}

/* ── Notes section ───────────────────────────────────────────────────────── */
.notes-section { margin-top: 20px; }

.notes-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
  font-size: 13px;
  font-weight: 600;
}

.notes-counter {
  font-size: 12px;
  color: var(--t2);
}

.notes-counter.warn { color: var(--red); }

/* ── Filter bar ──────────────────────────────────────────────────────────── */
.filter-bar {
  position: sticky;
  top: var(--nav-h);
  z-index: 50;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  padding: 8px 12px;
}

.filter-bar-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.filter-pills {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 2px;
  scrollbar-width: none;
}

.filter-pills::-webkit-scrollbar { display: none; }

.have-need-toggle {
  display: flex;
  height: 32px;
  background: var(--bg-h);
  border-radius: 16px;
  padding: 2px;
  gap: 2px;
  flex-shrink: 0;
}

.have-need-toggle button {
  height: 28px;
  padding: 0 12px;
  border-radius: 14px;
  font-size: 13px;
  font-weight: 500;
  color: var(--t2);
  transition: background 0.15s, color 0.15s;
}

.have-need-toggle button.active {
  background: var(--accent);
  color: #fff;
}

.gen-pills {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  scrollbar-width: none;
  padding: 4px 0 0;
}

.gen-pills::-webkit-scrollbar { display: none; }

/* ── Undo Toast ──────────────────────────────────────────────────────────── */
.undo-toast {
  position: fixed;
  bottom: calc(var(--bnav-h) + 12px);
  left: 50%; transform: translateX(-50%) translateY(20px);
  background: var(--bg-h);
  border: 1px solid var(--border-s);
  border-radius: 24px;
  padding: 10px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 14px;
  white-space: nowrap;
  z-index: 300;
  opacity: 0;
  transition: opacity 0.3s, transform 0.3s;
  pointer-events: none;
  box-shadow: 0 4px 24px rgba(0,0,0,0.4);
}

@media (min-width: 768px) {
  .undo-toast { bottom: 24px; }
}

.undo-toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
  pointer-events: auto;
}

.undo-btn {
  color: var(--accent);
  font-weight: 700;
  font-size: 14px;
}

/* ── Offline banner ──────────────────────────────────────────────────────── */
.offline-banner {
  position: fixed;
  top: var(--nav-h);
  left: 0; right: 0;
  background: var(--gold);
  color: #000;
  text-align: center;
  font-size: 13px;
  font-weight: 600;
  padding: 8px;
  z-index: 90;
  transform: translateY(-100%);
  transition: transform 0.3s;
}

.offline-banner.show { transform: translateY(0); }

/* ── Modal ───────────────────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.6);
  z-index: 400;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}

.modal-overlay.open { opacity: 1; pointer-events: auto; }

.modal {
  width: 100%;
  max-width: 400px;
  background: var(--bg-s);
  border-radius: var(--r-lg);
  padding: 28px;
  position: relative;
  transform: scale(0.95);
  transition: transform 0.2s;
}

.modal-overlay.open .modal { transform: scale(1); }

.modal-close {
  position: absolute;
  top: 14px; right: 14px;
  width: 28px; height: 28px;
  border-radius: 50%;
  background: var(--bg-h);
  display: flex; align-items: center; justify-content: center;
  color: var(--t2);
}

.modal-title {
  font-family: var(--font-d);
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 20px;
}

/* ── Auth Modal ──────────────────────────────────────────────────────────── */
.auth-modal { max-width: 400px; }

.auth-back-btn {
  color: var(--t3);
  font-size: 14px;
  margin-bottom: 16px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  text-decoration: underline;
  text-underline-offset: 2px;
  transition: color 0.15s;
}
.auth-back-btn:hover { color: var(--t2); }

.auth-logo {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: 24px;
  gap: 6px;
}

.auth-logo .ball-lg {
  width: 48px; height: 48px;
  background: var(--accent);
  border-radius: 50%;
}

.auth-logo .logo-name {
  font-family: var(--font-d);
  font-size: 22px;
  font-weight: 800;
}

.google-btn {
  width: 100%;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: var(--bg-e);
  border: 1.5px solid var(--border-s);
  border-radius: var(--r);
  font-size: 14px;
  font-weight: 600;
  color: var(--t1);
  transition: background 0.15s;
}

.google-btn:hover { background: var(--bg-h); }

.divider {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 16px 0;
  color: var(--t3);
  font-size: 12px;
}

.divider::before, .divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* OTP inputs */
.otp-inputs {
  display: flex;
  gap: 8px;
  justify-content: center;
  margin: 20px 0;
}

.otp-digit {
  width: 44px;
  height: 52px;
  background: var(--bg-e);
  border: 1.5px solid var(--border);
  border-radius: 14px;
  font-family: var(--font-d);
  font-size: 22px;
  font-weight: 700;
  text-align: center;
  color: var(--t1);
  outline: none;
  transition: border-color 0.15s;
}

.otp-digit:focus { border-color: var(--accent); }

/* ── Step indicator ──────────────────────────────────────────────────────── */
.step-indicator {
  display: flex;
  align-items: center;
  gap: 0;
  margin-bottom: 24px;
}

.step-circle {
  width: 24px; height: 24px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px;
  font-weight: 700;
  flex-shrink: 0;
  transition: background 0.2s, color 0.2s;
}

.step-circle.done { background: var(--green); color: #fff; }
.step-circle.active { background: var(--accent); color: #fff; }
.step-circle.upcoming { background: var(--bg-h); color: var(--t3); }

.step-line {
  flex: 1;
  height: 2px;
  background: var(--bg-h);
}

.step-line.done { background: var(--green); }

/* ── Dashboard stats ─────────────────────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

@media (min-width: 400px) { .stats-grid { grid-template-columns: repeat(4, 1fr); } }
@media (min-width: 768px) { .stats-grid { grid-template-columns: repeat(5, 1fr); } }

.stat-chip {
  background: var(--bg-s);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 12px 8px;
  text-align: center;
}

.stat-chip .stat-count {
  font-family: var(--font-d);
  font-size: 22px;
  font-weight: 700;
  color: var(--t1);
}

.stat-chip .stat-label {
  font-size: 11px;
  color: var(--t3);
  margin-top: 2px;
}

/* Gen rings row */
.gen-rings {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  scrollbar-width: none;
  padding-bottom: 4px;
}

.gen-rings::-webkit-scrollbar { display: none; }

.gen-ring-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.gen-ring-label {
  font-size: 11px;
  color: var(--t2);
  text-align: center;
}

/* Activity feed */
.activity-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
}

.activity-row:last-child { border-bottom: none; }

.activity-sprite {
  width: 40px; height: 40px;
  image-rendering: pixelated;
  flex-shrink: 0;
}

.activity-info { flex: 1; }
.activity-info .activity-name { font-size: 13px; font-weight: 600; }
.activity-info .activity-flag { font-size: 12px; color: var(--t2); }
.activity-time { font-size: 11px; color: var(--t3); }

/* Heatmap */
.heatmap { overflow-x: auto; }
.heatmap-grid { display: flex; flex-direction: column; gap: 2px; }
.heatmap-week { display: flex; gap: 2px; }

.heatmap-cell {
  width: 12px; height: 12px;
  border-radius: 2px;
  background: var(--bg-h);
  flex-shrink: 0;
}

.heatmap-cell.l1 { background: rgba(74,140,247,0.4); }
.heatmap-cell.l2 { background: rgba(74,140,247,0.7); }
.heatmap-cell.l3 { background: var(--accent); }

/* Milestones */
.milestone-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}

.milestone-row.achieved { border-left: 3px solid var(--green); padding-left: 12px; }
.milestone-row:last-child { border-bottom: none; }
.milestone-icon { font-size: 26px; flex-shrink: 0; }
.milestone-info { flex: 1; }
.milestone-label { font-size: 14px; font-weight: 700; }
.milestone-sub { font-size: 12px; color: var(--t2); }
.milestone-status { font-size: 16px; }

/* ── Notification panel ──────────────────────────────────────────────────── */
.notif-panel {
  position: fixed;
  top: var(--nav-h);
  right: 12px;
  width: 320px;
  max-height: 480px;
  background: var(--bg-s);
  border: 1px solid var(--border-s);
  border-radius: var(--r-lg);
  z-index: 150;
  overflow-y: auto;
  box-shadow: 0 8px 32px rgba(0,0,0,0.4);
  display: none;
}

.notif-panel.open { display: block; }

.notif-panel-header {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  font-weight: 700;
  font-size: 15px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.notif-item {
  display: flex;
  gap: 10px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  cursor: pointer;
  transition: background 0.12s;
}

.notif-item:hover { background: var(--bg-h); }
.notif-item.unread { background: var(--accent-d); }
.notif-item:last-child { border-bottom: none; }

.notif-icon { font-size: 20px; flex-shrink: 0; }
.notif-text { flex: 1; }
.notif-time { font-size: 11px; color: var(--t3); margin-top: 2px; }

/* ── Compare view ────────────────────────────────────────────────────────── */
.compare-table { width: 100%; overflow-x: auto; }

.compare-table table {
  border-collapse: collapse;
  min-width: 500px;
  width: 100%;
}

.compare-table th, .compare-table td {
  padding: 8px 6px;
  text-align: center;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}

.compare-table th {
  background: var(--bg-s);
  position: sticky;
  top: 0;
  z-index: 1;
  font-weight: 700;
}

.compare-cell.has { color: var(--green); }
.compare-cell.missing { color: var(--red); }
.compare-cell.wishlist { color: var(--gold); }

/* ── Landing page ────────────────────────────────────────────────────────── */
.landing-hero {
  min-height: calc(100vh - var(--nav-h));
  display: flex;
  align-items: center;
  padding: 48px 0;
}

.hero-eyebrow {
  font-size: 12px;
  color: var(--t3);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 12px;
}

.hero-h1 {
  font-family: var(--font-d);
  font-size: 36px;
  font-weight: 800;
  line-height: 1.15;
  margin-bottom: 16px;
}

@media (min-width: 768px) { .hero-h1 { font-size: 52px; } }

.hero-sub {
  font-size: 15px;
  color: var(--t2);
  max-width: 420px;
  margin-bottom: 24px;
  line-height: 1.6;
}

.hero-pills {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 28px;
}

.hero-pill {
  background: var(--bg-e);
  border-radius: 12px;
  padding: 10px 14px;
  text-align: center;
}

.hero-pill .hp-value {
  font-family: var(--font-d);
  font-size: 22px;
  font-weight: 700;
  color: var(--t1);
}

.hero-pill .hp-label {
  font-size: 11px;
  color: var(--t3);
  margin-top: 2px;
}

.hero-ctas { display: flex; gap: 10px; flex-wrap: wrap; }

.features-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin: 48px 0;
}

@media (min-width: 768px) { .features-grid { grid-template-columns: repeat(4, 1fr); } }

.feature-card {
  background: var(--bg-s);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 24px;
}

.feature-icon { font-size: 28px; color: var(--accent); margin-bottom: 10px; }
.feature-title { font-family: var(--font-d); font-size: 15px; font-weight: 700; margin-bottom: 6px; }
.feature-desc { font-size: 13px; color: var(--t2); line-height: 1.5; }

/* ── Guest banner ────────────────────────────────────────────────────────── */
.guest-banner {
  background: var(--accent-d);
  border-top: 1px solid var(--border-s);
  padding: 10px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: var(--t1);
  /* Always pinned so it's visible without scrolling */
  position: fixed;
  bottom: 0;
  left: 0; right: 0;
  z-index: 95;
}

.guest-banner .banner-cta {
  margin-left: auto;
  flex-shrink: 0;
}

/* On mobile, shift above the bottom nav */
@media (max-width: 767px) {
  .guest-banner { bottom: var(--bnav-h); }

  /* Extra breathing room so content isn't hidden behind both bars */
  body.is-guest .page-wrap {
    padding-bottom: calc(var(--bnav-h) + 48px + 8px);
  }
}

/* On desktop, ensure content isn't hidden behind the banner */
@media (min-width: 768px) {
  body.is-guest .page-wrap {
    padding-bottom: 56px;
  }
}

/* ── Wishlist ────────────────────────────────────────────────────────────── */
.wishlist-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 12px;
  padding: 12px 0;
}

.wishlist-card {
  background: var(--bg-s);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  text-align: center;
}

.wishlist-card img { width: 64px; height: 64px; image-rendering: pixelated; }

/* ── Settings ────────────────────────────────────────────────────────────── */
.settings-section {
  margin-bottom: 28px;
}

.settings-section-title {
  font-family: var(--font-d);
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 14px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

.settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
  gap: 12px;
}

.settings-row:last-child { border-bottom: none; }

.settings-row-info { flex: 1; }
.settings-row-info .sr-label { font-size: 14px; font-weight: 600; }
.settings-row-info .sr-desc  { font-size: 12px; color: var(--t2); margin-top: 2px; }

/* Toggle switch */
.toggle-switch {
  position: relative;
  width: 44px; height: 24px;
  flex-shrink: 0;
}

.toggle-switch input { opacity: 0; width: 0; height: 0; position: absolute; }

.toggle-track {
  position: absolute; inset: 0;
  background: var(--bg-h);
  border-radius: 12px;
  cursor: pointer;
  transition: background 0.2s;
}

.toggle-switch input:checked ~ .toggle-track { background: var(--accent); }

.toggle-track::after {
  content: '';
  position: absolute;
  top: 3px; left: 3px;
  width: 18px; height: 18px;
  background: #fff;
  border-radius: 50%;
  transition: transform 0.2s;
}

.toggle-switch input:checked ~ .toggle-track::after { transform: translateX(20px); }

/* ── Utilities ───────────────────────────────────────────────────────────── */
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); }

.skip-link:focus {
  position: fixed;
  top: 8px; left: 8px;
  width: auto; height: auto;
  overflow: visible;
  clip: auto;
  background: var(--accent);
  color: #fff;
  padding: 8px 16px;
  border-radius: var(--r);
  z-index: 9999;
  font-weight: 600;
  text-decoration: none;
}
.hidden  { display: none !important; }
.mt-4    { margin-top: 4px; }
.mt-8    { margin-top: 8px; }
.mt-12   { margin-top: 12px; }
.mt-16   { margin-top: 16px; }
.mt-24   { margin-top: 24px; }
.flex    { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.gap-8   { gap: 8px; }
.gap-12  { gap: 12px; }
.w-full  { width: 100%; }
.text-center { text-align: center; }

/* ── Context menu (right-click wishlist add) ─────────────────────────────── */
.context-menu {
  position: fixed;
  z-index: 1200;
  min-width: 180px;
  background: var(--bg-e);
  border: 1px solid var(--border-s);
  border-radius: var(--r);
  padding: 6px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.45);
  display: none;
}
.context-menu.open { display: block; }
.context-menu .ctx-title {
  font-size: 11px;
  color: var(--t2);
  padding: 4px 8px 6px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.context-menu button {
  display: block;
  width: 100%;
  text-align: left;
  padding: 8px 10px;
  border-radius: 8px;
  font-size: 13px;
  color: var(--t1);
  background: none;
  border: none;
  cursor: pointer;
}

/* ── Toast notifications ─────────────────────────────────────────────────── */
.toast-container {
  position: fixed;
  bottom: calc(var(--bnav-h) + 16px);
  right: 16px;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

@media (min-width: 768px) {
  .toast-container { bottom: 24px; }
}

.toast {
  padding: 12px 16px;
  border-radius: var(--r);
  font-size: 14px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 8px;
  pointer-events: auto;
  background: var(--bg-h);
  border: 1px solid var(--border-s);
  color: var(--t1);
  box-shadow: 0 4px 16px rgba(0,0,0,0.35);
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.25s, transform 0.25s;
  pointer-events: auto;
  max-width: 320px;
  word-break: break-word;
}

.toast.toast-visible { opacity: 1; transform: translateY(0); }
.toast-success { border-left: 3px solid var(--green); }
.toast-error   { border-left: 3px solid var(--red); }
.toast-info    { border-left: 3px solid var(--accent); }

.toast-close {
  flex-shrink: 0;
  color: var(--t3);
  font-size: 18px;
  line-height: 1;
  padding: 0 2px;
  margin-left: auto;
  transition: color 0.15s;
}
.toast-close:hover { color: var(--t1); }

/* Type filter pills */
.pill.type-pill {
  background: var(--tc);
  color: #fff;
  opacity: 0.55;
  transition: opacity 0.15s;
}
.pill.type-pill:hover { opacity: 0.8; }
.pill.type-pill.active { background: var(--tc); opacity: 1; outline: 2px solid rgba(255,255,255,0.5); }

.context-menu button:hover { background: var(--bg-h); }

/* ── Wishlist quick-add button on Pokémon cards ──────────────────────────── */
.card-wish-btn {
  position: absolute;
  bottom: 3px; right: 3px;
  width: 20px; height: 20px;
  border-radius: 50%;
  background: rgba(0,0,0,0.28);
  color: var(--gold);
  font-size: 11px;
  display: flex; align-items: center; justify-content: center;
  opacity: 0;
  transition: opacity 0.15s, background 0.15s;
  z-index: 2;
  padding: 0;
  line-height: 1;
}

.card-wish-btn:hover { background: rgba(0,0,0,0.5); opacity: 1; }

/* Always visible on touch devices */
@media (pointer: coarse) {
  .card-wish-btn { opacity: 0.65; }
}

/* Reveal on card hover for pointer devices */
@media (pointer: fine) {
  .poke-card:hover .card-wish-btn { opacity: 1; }
}

/* List-row variant */
.card-wish-btn-row {
  position: static;
  width: 28px; height: 28px;
  font-size: 14px;
  background: none;
  color: var(--gold);
  opacity: 0.4;
  flex-shrink: 0;
}

.poke-row:hover .card-wish-btn-row,
.card-wish-btn-row:hover { opacity: 1; background: none; }

@media (pointer: coarse) {
  .card-wish-btn-row { opacity: 0.65; }
}

/* ── Autocomplete dropdown (compare page) ────────────────────────────────── */
.autocomplete-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  left: 0; right: 0;
  background: var(--bg-s);
  border: 1px solid var(--border-s);
  border-radius: var(--r);
  z-index: 300;
  max-height: 240px;
  overflow-y: auto;
  box-shadow: 0 8px 24px rgba(0,0,0,0.3);
  display: none;
}

.autocomplete-dropdown.open { display: block; }

.autocomplete-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  font-size: 13px;
  cursor: pointer;
  transition: background 0.12s;
}

.autocomplete-item:hover,
.autocomplete-item.focused { background: var(--bg-h); }

.autocomplete-avatar {
  width: 26px; height: 26px;
  border-radius: 50%;
  background: var(--bg-h);
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700;
  color: var(--t2);
  overflow: hidden;
  flex-shrink: 0;
}

.autocomplete-avatar img { width: 100%; height: 100%; object-fit: cover; }

/* ── Quick-Tag mode ──────────────────────────────────────────────────────── */
.nav-icon-btn.qt-active {
  background: var(--accent-d);
  color: var(--accent);
}

.quick-tag-picker {
  position: fixed;
  z-index: 1200;
  width: 230px;
  background: var(--bg-e);
  border: 1px solid var(--border-s);
  border-radius: var(--r);
  padding: 8px;
  box-shadow: 0 12px 32px rgba(0,0,0,0.45);
  display: none;
  max-height: 360px;
  overflow-y: auto;
}
.quick-tag-picker.open { display: block; }

.qt-picker-title {
  font-size: 11px;
  color: var(--t2);
  padding: 2px 4px 8px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.qt-picker-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 5px;
}

.qt-picker-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 8px 4px;
  border-radius: 8px;
  background: var(--bg-h);
  border: 1.5px solid transparent;
  font-size: 10px;
  color: var(--t2);
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s, color 0.12s;
  line-height: 1.2;
  text-align: center;
}
.qt-picker-btn:hover { background: var(--bg-s); color: var(--t1); }
.qt-picker-btn.active {
  background: var(--accent-d);
  border-color: var(--accent);
  color: var(--accent);
}
.qt-picker-icon { font-size: 15px; }

/* Active chip inside filter bar */
.quick-tag-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 26px;
  padding: 0 8px 0 12px;
  border-radius: 13px;
  background: var(--accent-d);
  border: 1.5px solid var(--accent);
  color: var(--accent);
  font-size: 12px;
  font-weight: 600;
}
.quick-tag-chip button {
  background: none;
  border: none;
  color: var(--accent);
  cursor: pointer;
  font-size: 15px;
  line-height: 1;
  padding: 0;
  opacity: 0.7;
}
.quick-tag-chip button:hover { opacity: 1; }

/* Badge on each card showing current tag state */
.qt-badge {
  position: absolute;
  bottom: 3px;
  left: 3px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 1.5px solid var(--border-s);
  background: var(--bg-s);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 7px;
  font-weight: 700;
  color: var(--t3);
  line-height: 1;
  pointer-events: none;
}
.qt-badge--on {
  background: var(--green);
  border-color: var(--green);
  color: #fff;
}

/* List-row badge is inline, not absolute */
.poke-row .qt-badge {
  position: static;
  width: 16px;
  height: 16px;
  font-size: 8px;
  flex-shrink: 0;
}

/* Hover outline in quick-tag mode */
.dex-grid.qt-mode .poke-card:hover,
.dex-list.qt-mode .poke-row:hover {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}
