  :root {
    --bg: #0a0a0f;
    --surface: #12121a;
    --surface2: #1a1a28;
    --border: #2a2a3e;
    --text: #e8e8ff;
    --text-muted: #6666aa;
    --accent: #ff3d5a;
    --accent2: #ffcc00;
    --accent3: #00d4ff;
    --normal: #a8a878; --fire: #f08030; --water: #6890f0; --electric: #f8d030;
    --grass: #78c850; --ice: #98d8d8; --fighting: #c03028; --poison: #a040a0;
    --ground: #e0c068; --flying: #a890f0; --psychic: #f85888; --bug: #a8b820;
    --rock: #b8a038; --ghost: #705898; --dragon: #7038f8; --dark: #705848;
    --steel: #b8b8d0; --fairy: #ee99ac;
  }

  * { margin: 0; padding: 0; box-sizing: border-box; }

  body {
    font-family: 'Exo 2', sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    overflow-x: hidden;
  }

  /* Animated background */
  body::before {
    content: '';
    position: fixed;
    inset: 0;
    background: 
      radial-gradient(ellipse at 20% 50%, rgba(255,61,90,0.05) 0%, transparent 50%),
      radial-gradient(ellipse at 80% 20%, rgba(0,212,255,0.05) 0%, transparent 50%),
      radial-gradient(ellipse at 60% 80%, rgba(112,56,248,0.05) 0%, transparent 50%);
    pointer-events: none;
    z-index: 0;
  }

  /* HEADER */
  header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(10,10,15,0.95);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border);
    padding: 16px 24px;
    display: flex;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
  }

  .logo {
    font-family: 'Press Start 2P', monospace;
    font-size: 14px;
    color: var(--accent2);
    text-shadow: 0 0 20px rgba(255,204,0,0.5);
    white-space: nowrap;
  }

  .logo span { color: var(--accent); }

  .search-bar {
    flex: 1;
    min-width: 200px;
    position: relative;
  }

  .search-bar input {
    width: 100%;
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 10px 16px 10px 40px;
    color: var(--text);
    font-family: 'Exo 2', sans-serif;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
  }

  .search-bar input:focus { border-color: var(--accent3); }
  .search-bar::before {
    content: '🔍';
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 14px;
  }

  .gen-filters {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
  }

  .gen-btn {
    padding: 6px 12px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--surface2);
    color: var(--text-muted);
    cursor: pointer;
    font-size: 11px;
    font-family: 'Exo 2', sans-serif;
    font-weight: 600;
    transition: all 0.2s;
  }

  .gen-btn.active, .gen-btn:hover {
    background: var(--accent);
    border-color: var(--accent);
    color: white;
  }

  /* COMPARE BAR */
#compare-bar {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 200;

  display: flex; /* 👈 IMPORTANTE */

  align-items: center;
  justify-content: space-between;

  background: rgba(18,18,26,0.97);
  border-top: 2px solid var(--accent);
  padding: 12px 24px;
  gap: 16px;

  backdrop-filter: blur(20px);
}

  /* #compare-bar {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 200;
    background: rgba(18,18,26,0.97);
    border-top: 2px solid var(--accent);
    padding: 12px 24px;
    align-items: center;
    gap: 16px;
    backdrop-filter: blur(20px);
  } */
#compare-modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  justify-content: center;
  align-items: center;
  z-index: 9999;
}

#compare-modal {
  background: #111;
  border-radius: 12px;
  max-width: 900px;
  width: 95%;
  max-height: 90vh;
  overflow-y: auto;
  padding: 20px;
}
  #compare-bar.visible { display: flex; }

  .compare-slots {
    display: flex;
    gap: 12px;
    flex: 1;
  }

  .compare-slot {
    background: var(--surface2);
    border: 1px dashed var(--border);
    border-radius: 12px;
    padding: 8px 16px;
    flex: 1;
    min-width: 0;
    font-size: 13px;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 8px;
  }

  .compare-slot.filled {
    border-color: var(--accent);
    color: var(--text);
  }

  .compare-slot img { width: 32px; height: 32px; }

  .remove-compare {
    background: none;
    border: none;
    color: var(--accent);
    cursor: pointer;
    font-size: 16px;
    margin-left: auto;
  }

  .compare-now-btn {
    background: var(--accent);
    border: none;
    border-radius: 12px;
    padding: 10px 24px;
    color: white;
    font-family: 'Exo 2', sans-serif;
    font-weight: 700;
    font-size: 14px;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    white-space: nowrap;
  }

  .compare-now-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 20px rgba(255,61,90,0.4);
  }

  .compare-now-btn:disabled { opacity: 0.4; cursor: not-allowed; transform: none; }

  /* GRID */
  #grid-container {
    position: relative;
    z-index: 1;
    padding: 24px;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 16px;
    max-width: 1600px;
    margin: 0 auto;
    padding-bottom: 100px;
  }

  /* CARD */
  .poke-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 16px;
    cursor: pointer;
    transition: transform 0.2s, border-color 0.2s, box-shadow 0.2s;
    position: relative;
    overflow: hidden;
    text-align: center;
  }

  .poke-card::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, transparent 60%, rgba(255,255,255,0.03));
    pointer-events: none;
  }

  .poke-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 30px rgba(0,0,0,0.4);
  }

  .poke-card.in-compare {
    border-color: var(--accent);
    box-shadow: 0 0 20px rgba(255,61,90,0.3);
  }

  .poke-num {
    font-size: 10px;
    color: var(--text-muted);
    font-weight: 600;
    letter-spacing: 1px;
  }

  .poke-card img {
    width: 80px;
    height: 80px;
    object-fit: contain;
    image-rendering: pixelated;
    filter: drop-shadow(0 4px 8px rgba(0,0,0,0.4));
    transition: transform 0.3s;
  }

  .poke-card:hover img { transform: scale(1.1) translateY(-4px); }

  .poke-name {
    font-size: 13px;
    font-weight: 700;
    text-transform: capitalize;
    margin: 6px 0 8px;
    letter-spacing: 0.5px;
  }

  .type-badges {
    display: flex;
    gap: 4px;
    justify-content: center;
    flex-wrap: wrap;
  }

  .type-badge {
    padding: 2px 8px;
    border-radius: 20px;
    font-size: 9px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: white;
  }

  /* MODAL */
  #modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.85);
    z-index: 300;
    backdrop-filter: blur(8px);
    align-items: center;
    justify-content: center;
    padding: 20px;
  }

  #modal-overlay.visible { display: flex; }

  #modal {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 24px;
    max-width: 600px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    animation: modalIn 0.3s cubic-bezier(0.34,1.56,0.64,1);
  }

  @keyframes modalIn {
    from { opacity: 0; transform: scale(0.8) translateY(30px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
  }

  .modal-header {
    padding: 24px 24px 16px;
    position: relative;
    display: flex;
    align-items: flex-start;
    gap: 20px;
  }

  .modal-header-bg {
    position: absolute;
    inset: 0;
    border-radius: 24px 24px 0 0;
    opacity: 0.1;
  }

  .modal-sprite {
    width: 120px;
    height: 120px;
    object-fit: contain;
    image-rendering: pixelated;
    filter: drop-shadow(0 8px 16px rgba(0,0,0,0.5));
    position: relative;
    z-index: 1;
    flex-shrink: 0;
    animation: float 3s ease-in-out infinite;
  }

  @keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-8px); }
  }

  .modal-title-area {
    position: relative;
    z-index: 1;
    flex: 1;
    padding-top: 8px;
  }

  .modal-num { font-size: 12px; color: var(--text-muted); font-weight: 600; }

  .modal-name {
    font-size: 28px;
    font-weight: 900;
    text-transform: capitalize;
    line-height: 1;
    margin: 4px 0 8px;
  }

  .modal-genera { font-size: 13px; color: var(--text-muted); margin-bottom: 10px; }

  .close-btn {
    position: absolute;
    top: 16px;
    right: 16px;
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: 50%;
    width: 32px;
    height: 32px;
    color: var(--text);
    cursor: pointer;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    transition: background 0.2s;
  }

  .close-btn:hover { background: var(--accent); }

  .compare-btn-modal {
    background: transparent;
    border: 2px solid var(--accent);
    border-radius: 10px;
    padding: 7px 18px;
    color: var(--accent);
    font-family: 'Exo 2', sans-serif;
    font-weight: 700;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 6px;
  }

  .compare-btn-modal:hover, .compare-btn-modal.added {
    background: var(--accent);
    color: white;
  }

  .modal-body { padding: 0 24px 24px; }

  .section-title {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: var(--accent3);
    margin: 20px 0 12px;
    display: flex;
    align-items: center;
    gap: 8px;
  }

  .section-title::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border);
  }

  /* STATS */
  .stat-row {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 10px;
  }

  .stat-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    width: 80px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    flex-shrink: 0;
  }

  .stat-val {
    font-size: 13px;
    font-weight: 700;
    width: 36px;
    text-align: right;
    flex-shrink: 0;
  }

  .stat-bar {
    flex: 1;
    height: 8px;
    background: var(--surface2);
    border-radius: 4px;
    overflow: hidden;
  }

  .stat-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 0.8s cubic-bezier(0.34,1.56,0.64,1);
  }

  /* EVOLUTIONS */
  .evo-chain {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: center;
  }

  .evo-item {
    text-align: center;
    cursor: pointer;
    transition: transform 0.2s;
  }

  .evo-item:hover { transform: scale(1.05); }

  .evo-item img {
    width: 64px;
    height: 64px;
    object-fit: contain;
    image-rendering: pixelated;
    filter: drop-shadow(0 4px 8px rgba(0,0,0,0.4));
    display: block;
    margin: 0 auto 4px;
  }

  .evo-name {
    font-size: 11px;
    font-weight: 600;
    text-transform: capitalize;
  }

  .evo-arrow {
    display: flex;
    flex-direction: column;
    align-items: center;
    color: var(--text-muted);
    font-size: 10px;
    text-align: center;
    padding: 0 4px;
  }

  .evo-arrow-icon { font-size: 18px; color: var(--accent3); }

  /* LOCATIONS */
  .location-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
  }

  .location-tag {
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 6px 12px;
    font-size: 12px;
    color: var(--text-muted);
    text-transform: capitalize;
  }

  /* COMPARE MODAL */
  #compare-modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.9);
    z-index: 400;
    backdrop-filter: blur(10px);
    align-items: center;
    justify-content: center;
    padding: 20px;
  }

  #compare-modal-overlay.visible { display: flex; }

  #compare-modal {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 24px;
    max-width: 900px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    padding: 24px;
    animation: modalIn 0.3s cubic-bezier(0.34,1.56,0.64,1);
    position: relative;
  }

  .compare-title {
    font-family: 'Press Start 2P', monospace;
    font-size: 12px;
    text-align: center;
    color: var(--accent2);
    margin-bottom: 24px;
  }

  .compare-grid {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: 16px;
    align-items: start;
  }

  .compare-poke-card {
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 20px;
    text-align: center;
  }

  .compare-poke-card img {
    width: 100px;
    height: 100px;
    object-fit: contain;
    image-rendering: pixelated;
    filter: drop-shadow(0 4px 12px rgba(0,0,0,0.5));
    animation: float 3s ease-in-out infinite;
  }

  .compare-poke-card:last-child img { animation-delay: -1.5s; }

  .compare-poke-name {
    font-size: 20px;
    font-weight: 900;
    text-transform: capitalize;
    margin: 8px 0 6px;
  }

  .vs-divider {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding-top: 60px;
  }

  .vs-text {
    font-family: 'Press Start 2P', monospace;
    font-size: 16px;
    color: var(--accent);
    text-shadow: 0 0 20px rgba(255,61,90,0.6);
  }

  /* Compare stats */
  .compare-stats { margin-top: 16px; }

  .compare-stat-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
  }

  .compare-stat-bar-left {
    flex: 1;
    height: 8px;
    background: var(--surface);
    border-radius: 4px;
    overflow: hidden;
    display: flex;
    justify-content: flex-end;
  }

  .compare-stat-bar-right {
    flex: 1;
    height: 8px;
    background: var(--surface);
    border-radius: 4px;
    overflow: hidden;
  }

  .compare-stat-label-center {
    font-size: 9px;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    text-align: center;
    width: 70px;
    flex-shrink: 0;
  }

  .compare-stat-val-left {
    font-size: 12px;
    font-weight: 700;
    width: 30px;
    text-align: right;
    flex-shrink: 0;
  }

  .compare-stat-val-right {
    font-size: 12px;
    font-weight: 700;
    width: 30px;
    flex-shrink: 0;
  }

  .stat-winner { color: var(--accent2); }

  /* Loading */
  #loading {
    position: fixed;
    inset: 0;
    background: var(--bg);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    gap: 24px;
  }

  .loading-ball {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: linear-gradient(180deg, var(--accent) 50%, white 50%);
    position: relative;
    animation: pokeSpin 1s linear infinite;
    box-shadow: 0 0 40px rgba(255,61,90,0.4);
  }

  .loading-ball::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 20px;
    height: 20px;
    background: white;
    border-radius: 50%;
    border: 3px solid #333;
    box-shadow: 0 0 0 3px white, 0 0 0 6px #333;
  }

  @keyframes pokeSpin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
  }

  .loading-text {
    font-family: 'Press Start 2P', monospace;
    font-size: 10px;
    color: var(--text-muted);
    animation: blink 1s step-end infinite;
  }

  @keyframes blink { 0%, 100% { opacity: 1; } 50% { opacity: 0.3; } }

  #progress-bar {
    width: 300px;
    height: 6px;
    background: var(--surface2);
    border-radius: 3px;
    overflow: hidden;
  }

  #progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent), var(--accent2));
    border-radius: 3px;
    width: 0%;
    transition: width 0.1s;
  }

  /* scrollbar */
  ::-webkit-scrollbar { width: 6px; }
  ::-webkit-scrollbar-track { background: var(--surface); }
  ::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

  .type-fire { background-color: var(--fire); }
  .type-water { background-color: var(--water); }
  .type-grass { background-color: var(--grass); }
  .type-electric { background-color: var(--electric); color: #333; }
  .type-normal { background-color: var(--normal); }
  .type-ice { background-color: var(--ice); color: #333; }
  .type-fighting { background-color: var(--fighting); }
  .type-poison { background-color: var(--poison); }
  .type-ground { background-color: var(--ground); color: #333; }
  .type-flying { background-color: var(--flying); }
  .type-psychic { background-color: var(--psychic); }
  .type-bug { background-color: var(--bug); }
  .type-rock { background-color: var(--rock); }
  .type-ghost { background-color: var(--ghost); }
  .type-dragon { background-color: var(--dragon); }
  .type-dark { background-color: var(--dark); }
  .type-steel { background-color: var(--steel); color: #333; }
  .type-fairy { background-color: var(--fairy); }

  .hidden { display: none !important; }

  @media (max-width: 600px) {
    .compare-grid { grid-template-columns: 1fr; }
    .vs-divider { padding-top: 0; }
    #grid-container { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); padding: 12px; }
    .modal-header { flex-direction: column; align-items: center; text-align: center; }
    .compare-stat-row { flex-wrap: wrap; }
  }