:root { --bg: #f0f0f0; --text: #222; --card: #fff; }
[data-theme="dark"] { --bg: #1a1a1a; --text: #eee; --card: #2a2a2a; }
body { margin:0; padding:20px; background:var(--bg); color:var(--text); font-family:system-ui,sans-serif; }
/* Fixed left boxes */
.gen-completion {
  position: fixed;
  top: 20px;
  left: 20px;
  width: 340px;
  z-index: 100;
}
.toggles-box {
  position: fixed;
  bottom: 20px;
  left: 20px;
  width: 200px;
  z-index: 100;
}
.floating-box {
  background:var(--card);
  border-radius:16px;
  box-shadow:0 4px 15px rgba(0,0,0,0.1);
  padding:20px;
}
.gen-completion h2 { margin:0 0 15px 0; font-size:1.3rem; }
.completion-gens { display:flex; flex-direction:column; gap:12px; }
/* === COMPLETION BARS === */
.completion-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 0.95rem;
}
.completion-bar span:first-child { width: 48px; font-weight: 600; flex-shrink: 0; }
.completion-bar span:last-child { font-weight: 600; min-width: 95px; text-align: right; flex-shrink: 0; }
.progress-bar {
  height: 14px;
  background: #e5e5e5;
  border-radius: 9999px;
  flex: 1;
  overflow: hidden;
  box-shadow: inset 0 1px 3px rgba(0,0,0,0.15);
}
[data-theme="dark"] .progress-bar { background: #444; }
.progress-bar-fill {
  height: 100%;
  transition: width 0.7s cubic-bezier(0.34, 1.56, 0.64, 1);
  min-width: 6px;
}
/* ===================== TOTAL LIVING DEX BAR – MULTICOLOR GRADIENT RESTORED ===================== */
.total-completion {
  margin: 20px 0 25px 0;
  padding: 18px 20px;
  background: var(--card);
  border-radius: 16px;
  box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}
.completion-label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
  font-size: 1.15rem;
  font-weight: 600;
}
.progress-bar-bg {
  height: 26px;
  background: #e5e5e5;
  border-radius: 9999px;
  overflow: hidden;
  position: relative;
  box-shadow: inset 0 2px 4px rgba(0,0,0,0.15);
}
[data-theme="dark"] .progress-bar-bg { background: #444; }
.total-completion .progress-bar-fill {
  background: linear-gradient(90deg, #ef4036, #f4a261) !important;
  box-shadow: 0 0 10px rgba(239, 64, 54, 0.6);
}
.complete-flash { animation: completeAnim 1.5s ease; }
@keyframes completeAnim {
  0% { transform: scale(1); }
  50% { transform: scale(1.12); }
  100% { transform: scale(1); }
}
#caught-count {
  text-align: center;
  margin-top: 12px;
  font-size: 1.05rem;
  font-weight: 500;
  color: var(--text);
  opacity: 0.9;
}
/* ===================== TOOLS MENU – NOW HIDDEN UNTIL CLICKED ===================== */
.tools-btn {
  position: fixed !important;
  top: 20px !important;
  right: 20px !important;
  z-index: 9999 !important;
  background: var(--card);
  border: none;
  width: 52px;
  height: 52px;
  border-radius: 14px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 5px;
  cursor: pointer;
  box-shadow: 0 4px 15px rgba(0,0,0,0.12);
  transition: all 0.3s ease;
}
.tools-btn:hover {
  transform: scale(1.08);
  box-shadow: 0 6px 20px rgba(0,0,0,0.18);
}
.hamburger-line {
  width: 26px;
  height: 3px;
  background: var(--text);
  border-radius: 3px;
  transition: all 0.3s ease;
}
.tools-btn:hover .hamburger-line { background: #ef4036; }
.tools-menu {
  position: fixed !important;
  top: 0 !important;
  right: -600px !important;
  width: 360px;
  height: 100vh;
  background: var(--card);
  box-shadow: -8px 0 30px rgba(0,0,0,0.25);
  transition: right 0.4s cubic-bezier(0.32, 0.72, 0, 1);
  z-index: 10000 !important;
  padding: 30px 25px;
  overflow-y: auto;
}
.tools-menu.open { right: 0 !important; }
.tools-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 25px;
  padding-bottom: 15px;
  border-bottom: 1px solid #ccc;
}
[data-theme="dark"] .tools-header { border-bottom-color: #555; }
.tools-header h2 { margin: 0; font-size: 1.6rem; }
.close-tools {
  background: none;
  border: none;
  font-size: 2.2rem;
  cursor: pointer;
  color: var(--text);
  opacity: 0.6;
  line-height: 1;
}
.close-tools:hover { opacity: 1; color: #ef4036; }
.tools-content p { line-height: 1.7; margin-bottom: 20px; }
/* (everything below is your original CSS – unchanged) */
.toggles-box .toggle-row { display:flex; justify-content:space-between; align-items:center; margin:15px 0; }
.switch { position:relative; display:inline-block; width:58px; height:32px; }
.switch input { opacity:0; width:0; height:0; }
.slider { position:absolute; cursor:pointer; top:0; left:0; right:0; bottom:0; background:#ccc; transition:.4s; border-radius:9999px; }
.slider:before { position:absolute; content:""; height:24px; width:24px; left:4px; bottom:4px; background:white; transition:.4s; border-radius:50%; }
input:checked + .slider { background:#22c55e; }
input:checked + .slider:before { transform:translateX(26px); }
.content-area { flex:1; }
header h1 { margin:0 0 25px 0; font-size:2.4rem; text-align:center; }
.centered-block {
  max-width:800px;
  margin:0 auto;
  display:flex;
  flex-direction:column;
  gap:15px;
}
.centered-block input {
 width:100%;
  max-width:770px;
  padding:14px;
  font-size:1.1rem;
  border-radius:12px;
  background: var(--card);
  color: var(--text);
  border: 2px solid #ccc;
}
.centered-block select {
  width:100%;
  max-width:820px;
  padding:14px;
  font-size:1.1rem;
  border-radius:12px;
  background: var(--card);
  color: var(--text);
  border: 2px solid #ccc;
}
[data-theme="dark"] .centered-block input,
[data-theme="dark"] .centered-block select { border-color: #555; }
.centered-block button {
  border:none;
  cursor:pointer;
  font-weight:600;
  padding:14px;
}
#random-btn { background:#22c55e; color:white; border-radius:12px;}
#reset-btn { background:#ef4036; color:white; border-radius:12px; }
.pokemon-grid { display:grid; grid-template-columns:repeat(5,1fr); gap:18px; }
.pokemon-card {
  background:var(--card); border-radius:16px; padding:12px; text-align:center;
  box-shadow:0 4px 15px rgba(0,0,0,0.1); transition:all 0.3s ease; cursor:pointer; position:relative;
}
.pokemon-card:hover { transform:scale(1.05); }
.pokemon-card.caught { opacity:0.65; filter:grayscale(1); }
.pokemon-card img { width:110px; height:110px; image-rendering:pixelated; }
.menu-btn {
  position:absolute; bottom:8px; right:8px;
  background:none; border:none; font-size:1.8rem; cursor:pointer; color:var(--text); opacity:0.6;
}
.menu-btn:hover { opacity:1; transform:scale(1.2); }
/* Modal and Loading */
.modal { position:fixed; top:0; left:0; width:100%; height:100%; background:rgba(0,0,0,0.85); display:none; align-items:center; justify-content:center; z-index:10000; }
.modal-content { background:var(--card); padding:25px; border-radius:20px; max-width:460px; width:90%; text-align:center; position:relative; }
.close { position:absolute; top:15px; right:20px; font-size:2rem; cursor:pointer; }
.type-badge { display:inline-block; padding:6px 14px; margin:4px; border-radius:9999px; color:white; font-weight:bold; font-size:0.95rem; }
.evo-info { text-align:left; background:rgba(0,0,0,0.05); padding:18px; border-radius:12px; margin:20px 0; line-height:1.6; }
.evo-row { display:flex; align-items:center; gap:12px; margin:14px 0; }
.evo-row img { width:60px; height:60px; image-rendering:pixelated; }
.evo-method { font-size:0.9rem; color:#666; font-style:italic; }
.loading { position:fixed; top:0; left:0; width:100%; height:100%; background:#000; display:flex; flex-direction:column; align-items:center; justify-content:center; z-index:100000 !important; color:white; font-size:1.8rem; }
.pokeball-container { position:relative; }
.pokeball { width:130px; height:130px; background:linear-gradient(#ef4036 50%, #fff 50%); border:12px solid #222; border-radius:50%; position:relative; animation:spin 1s linear infinite; box-shadow:0 0 0 8px #222; }
.pokeball::before { content:""; position:absolute; top:50%; left:0; right:0; height:14px; background:#222; transform:translateY(-50%); }
.pokeball::after { content:""; position:absolute; top:50%; left:50%; transform:translate(-50%,-50%); width:36px; height:36px; background:#fff; border:6px solid #222; border-radius:50%; }
.pokeball.shaking::after { animation:yellowFlash 0.4s infinite alternate; }
.pokeball.success::after { background:#39ff14; animation:limeFlash 0.8s 2; }
@keyframes yellowFlash { from { background:#fff; } to { background:#ffeb3b; } }
@keyframes limeFlash { 0%,100%{opacity:1} 50%{opacity:0.4} }
.skip-btn { position:absolute; bottom:40px; right:40px; padding:12px 24px; background:#ef4036; color:white; border:none; border-radius:9999px; font-size:1rem; cursor:pointer; }

/* ===================== NEW FIXES ===================== */
/* 1. Tools button is now completely hidden while loading screen is active */
.loading ~ .tools-btn,
.loading .tools-btn {
  display: none !important;
}
/* 2. Loading screen is guaranteed to be on top of everything */
.loading {
  z-index: 100000 !important;
}
/* ===================== SWITCH GAMES SECTION ===================== */
.games-info {
  text-align: left;
  background: rgba(0,0,0,0.05);
  padding: 18px;
  border-radius: 12px;
  margin: 20px 0;
  line-height: 1.6;
}
.games-info strong {
  display: block;
  margin-bottom: 8px;
}
.game-badge {
  display: inline-block;
  padding: 6px 14px;
  margin: 4px 2px;
  border-radius: 9999px;
  background: linear-gradient(90deg, #22c55e, #10b981);
  color: white;
  font-weight: 600;
  font-size: 0.9rem;
  box-shadow: 0 2px 6px rgba(34, 197, 94, 0.3);
}
[data-theme="dark"] .game-badge {
  background: linear-gradient(90deg, #10b981, #059669);
}
/* ===================== FINAL MODAL BACKDROP FIX (no more bottom gap) ===================== */
.modal {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.92);
  display: none;                    /* ← removed !important */
  align-items: center;
  justify-content: center;
  z-index: 10000;
  overflow: hidden;
}
}

.modal-content {
  max-height: 90vh !important;
  overflow-y: auto !important;
  margin: 20px !important;
  padding-bottom: 40px !important;        /* extra breathing room */
}

/* Keeps the X button stuck at the top while scrolling */
.close {
  position: sticky !important;
  top: 15px !important;
  z-index: 10 !important;
}
/* ===================== QUICK NOTES ===================== */
.tools-section {
  margin-bottom: 30px;
}
.tools-section h3 {
  margin: 0 0 12px 0;
  font-size: 1.3rem;
  color: var(--text);
}
#quick-notes {
  width: 100%;
  min-height: 220px;
  padding: 14px;
  border-radius: 12px;
  border: 2px solid #ccc;
  background: var(--card);
  color: var(--text);
  font-family: system-ui, sans-serif;
  font-size: 1rem;
  line-height: 1.5;
  resize: vertical;
}
[data-theme="dark"] #quick-notes {
  border-color: #555;
}
.notes-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 10px;
  font-size: 0.9rem;
}
.saved-indicator {
  color: #22c55e;
  font-weight: 600;
  opacity: 0;
  transition: opacity 0.3s;
}
.saved-indicator.show { opacity: 1; }
/* ===================== EXP CALCULATOR ===================== */
#exp-calculator {
  background: var(--card);
  padding: 18px;
  border-radius: 16px;
  box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}
#exp-results p {
  margin: 8px 0;
  font-size: 1.05rem;
}
.candy-row {
  background: rgba(0,0,0,0.05);
  padding: 10px;
  border-radius: 12px;
  text-align: center;
}
[data-theme="dark"] .candy-row {
  background: rgba(255,255,255,0.1);
}
/* ===================== RESIZABLE TOOLS MENU ===================== */
.resize-handle {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 8px;
  background: transparent;
  cursor: col-resize;
  z-index: 10;
  user-select: none;
}

.resize-handle::before {
  content: '';
  position: absolute;
  left: 2px;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 80px;
  background: #ddd;
  border-radius: 9999px;
  opacity: 0.6;
  transition: all 0.2s ease;
}

.tools-menu:hover .resize-handle::before {
  background: #fff;
  opacity: 1;
}

[data-theme="dark"] .resize-handle::before {
  background: #555;
}

/* Disable slide animation while resizing */
.tools-menu {
  transition: width 0.1s ease !important;
}
/* ===================== NEON GLOW FOR 100% COMPLETE BARS ===================== */
.completion-bar.complete .progress-bar-fill,
.progress-bar-fill.complete {
  box-shadow: 
    0 0 8px #39ff14,
    0 0 16px #39ff14,
    0 0 24px #22ff88,
    0 0 32px #22ff88;
  animation: neonPulse 1.8s ease-in-out infinite alternate;
}

.total-completion.complete .progress-bar-fill {
  box-shadow: 
    0 0 12px #39ff14,
    0 0 24px #39ff14,
    0 0 36px #22ff88,
    0 0 48px #22ff88;
  animation: neonPulse 1.8s ease-in-out infinite alternate;
}

@keyframes neonPulse {
  from { filter: brightness(1); }
  to   { filter: brightness(1.4); }
}
