/* Basic reset */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  /* Height reserved for a top menu/navbar. Adjust if your menu is taller/shorter. */
  --menu-height: 64px; /* increased to accommodate fixed header */
  /* Additional top padding for content below the menu */
  --content-top-padding: 16px;
}

body {
  font-family: Arial, sans-serif;
  line-height: 1.6;
  color: #333;
  /* Background image applied directly to body (single non-repeating fixed image) */
  background-image: url('/static/img/bg.png');
  background-repeat: no-repeat;
  background-position: center center; /* center the image in viewport */
  background-position: 25%;
  background-attachment: fixed;
  /* scale to cover the viewport while preserving aspect ratio (no stretching) */
  background-size: cover;
  min-height: 100vh;
}

/* Ensure the web app always fits the viewport width and prevent accidental horizontal scroll */
html, body {
  width: 100vw;
  max-width: 100vw;
  overflow-x: hidden;
}

/* Make the header span exactly the viewport to avoid the navbar growing beyond 100vw */
.app-header {
  width: 100vw;
  left: 0;
  right: 0;
  box-sizing: border-box;
}

/* Decorative page background fills the viewport but begins below the top menu */
body::before {
  content: '';
  position: fixed;
  top: var(--menu-height);
  left: 0;
  right: 0;
  bottom: 0;
  z-index: -1;
  /* Cozy warm background: soft gradient + subtle dotted texture */
  background-color: #fff7ef;
  background-image:
    linear-gradient(180deg, rgba(255,247,238,1) 0%, rgba(255,235,214,1) 50%, rgba(255,224,196,1) 100%),
    radial-gradient(circle at 10% 10%, rgba(255,255,255,0.06) 1px, transparent 1px),
    radial-gradient(circle at 90% 90%, rgba(255,255,255,0.04) 1px, transparent 1px);
  background-size: auto, 10px 10px, 14px 14px;
  background-attachment: fixed;
  background-repeat: no-repeat, repeat, repeat;
  box-shadow: inset 0 60px 120px rgba(0,0,0,0.02);
  pointer-events: none;
}



/* App header that sits in the reserved top area */
.app-header {
  /* Make header fixed so it doesn't scroll away and reserve space via --menu-height */
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--menu-height);
  z-index: 99999;
  display: flex;
  align-items: center;
  background: rgba(255,255,255,0.85);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  border-bottom: 1px solid rgba(0,0,0,0.06);
}

.app-header .container {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 16px;
  height: 100%;
  box-sizing: border-box;
  position: relative;
}

/* small helper to center navbar content (Bulma doesn't provide navbar-center by default) */

.app-title {
  font-family: 'Poppins', system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial;
  font-weight: 600;
  font-size: 1.15rem;
  margin: 0;
  color: #1f140d;
  /* center visually regardless of other header content */
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
}

/* ensure main content starts below the header */
main.container { 
    /*padding-top: calc(var(--menu-height) + var(--content-top-padding));*/ padding-bottom: 72px; }

.pokedex-container{
    padding-top: calc(var(--menu-height) + var(--content-top-padding));
}

.catch-container{
    padding-top: calc(var(--menu-height) + var(--content-top-padding)) !important;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: var(--content-top-padding) 20px 20px 20px;
}

/* Small project overrides for Bulma */
/* Leave Bulma to handle most navigation/layout. These are lightweight tweaks. */

.navbar-item .pokeball-icon {
  width: 28px;
  height: 28px;
  display: inline-block;
  background: url('../static/pokeball.svg') no-repeat center/contain;
}

.container {
  max-width: 1100px; /* align with project widths */
}

/* Keep existing .card padding/box-shadow but compatible with Bulma */
.card {
  border-radius: 8px;
}

/* Small button tweak to ensure .btn continues to work */
.btn {
  background: #00aaff;
  color: #fff;
  width: 320px; height: 320px;
  padding: 10px 16px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.btn:hover { background: #0088cc; }

/* Material icons sizing inline with Bulma */
.material-icons { font-size: 20px; vertical-align: middle; }

/* Navbar slide-down animation (mobile only) */
@media (max-width: 768px) {
  .navbar-menu {
    /* collapse for animation instead of display:none */
    max-height: 0;
    opacity: 0;
    transform: translateY(-18px);
    overflow: hidden;
    transition: max-height 300ms ease, transform 300ms ease, opacity 250ms ease;
    z-index: 999;
  }

  .navbar-menu.is-active {
    max-height: 1000px; /* large enough to show content */
    opacity: 1;
    transform: translateY(0);
  }

  /* Fade/slide menu items slightly for polish */
  .navbar-menu .navbar-item {
    opacity: 0;
    transform: translateY(-8px);
    transition: opacity 220ms ease, transform 220ms ease;
  }

  .navbar-menu.is-active .navbar-item {
    opacity: 1;
    transform: translateY(0);
  }

  /* Slightly animate the burger to indicate active state */
  .navbar-burger span {
    transition: background-color 200ms ease, transform 200ms ease;
  }
  .navbar-burger.is-active span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
  .navbar-burger.is-active span:nth-child(2) { opacity: 0; }
  .navbar-burger.is-active span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }
}

/* Cards */
.card {
  background: #fff;
  border: 1px solid #dee2e6;
  border-radius: 8px;
  padding: 20px;
  margin-bottom: 20px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: #007bff;
  color: white;
  border: none;
  padding: 10px 20px;
  border-radius: 4px;
  text-decoration: none;
  cursor: pointer;
  font-size: 14px;
  transition: background-color 0.2s;
}

.btn:hover {
  background: #0056b3;
  text-decoration: none;
  color: white;
}

.btn i.material-icons {
  font-size: 18px;
}

/* Form fields */
.form-field {
  margin-bottom: 20px;
}

.form-field label {
  display: block;
  margin-bottom: 5px;

/* Language toggle styles */
.lang-toggle { display: inline-flex; align-items: center; gap:8px; position: absolute; right: 10px; top: 50%; transform: translateY(-50%); z-index: 100; }
.lang-toggle .flag-icon { width:20px; height:14px; display:inline-block; vertical-align:middle; object-fit:contain; }
.lang-toggle .button.is-small { padding:4px 6px; border-radius:6px; background: none !important; border: none !important; box-shadow: none !important; appearance: none; }
.lang-toggle .button.is-small.is-active { box-shadow: none !important; }
.lang-toggle .button.is-small:hover { background: transparent !important; }
.lang-toggle .button.is-small:focus { outline: none !important; box-shadow: none !important; }
.flag-fallback { font-size: 14px; line-height: 1; }
  font-weight: bold;
  color: #555;
}

.form-field input {
  width: 100%;
  padding: 10px;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 14px;
}

.form-field input:focus {
  outline: none;
  border-color: #007bff;
  box-shadow: 0 0 0 2px rgba(0,123,255,0.25);
}

/* Progress bars */
.progress-bar {
  width: 100%;
  height: 8px;
  background: #e9ecef;
  border-radius: 4px;
  overflow: hidden;
  margin: 5px 0;
}

.progress-fill {
  height: 100%;
  background: #28a745;
  border-radius: 4px;
  transition: width 0.3s ease;
}

/* Chips */
.chip {
  display: inline-block;
  padding: 4px 8px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: bold;
}

.chip.caught {
  background: #d4edda;
  color: #155724;
}

.chip.missing {
  background: #f8d7da;
  color: #721c24;
}

/* Material Icons */
.material-icons {
  font-family: 'Material Icons';
  font-weight: normal;
  font-style: normal;
  font-size: 24px;
  line-height: 1;
  letter-spacing: normal;
  text-transform: none;
  display: inline-block;
  white-space: nowrap;
  word-wrap: normal;
  direction: ltr;
}

/* Pokédex grid */

.pokedex-container .pokedex-grid {
  /* Increase specificity so these layout rules win over legacy stylesheets */
  display: grid !important;
  /* smaller min width so more items fit on narrow screens */
  grid-template-columns: repeat(auto-fit, minmax(64px, 1fr)) !important;
  gap: 6px;
  margin: 10px 0;
  align-items: start; /* ensure grid items align to top for even rows */
}

.pokedex-container .pokemon-card {
  /* Ensure the card stays square and scales inside the grid */
  text-align: center;
  padding: 4px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  aspect-ratio: 1 / 1; /* keep square */
  overflow: hidden;
  width: 100%;
  border-radius: 10px;
  position: relative; /* allow absolute sprite and overlays */
  margin: 0; /* remove default card margins so grid gap controls spacing */
  align-self: stretch;
}

/* Game-like visual treatment for pokemon cards */
.pokedex-container .pokemon-card {
  background: linear-gradient(180deg, #ffffff 0%, #f0fbff 100%);
  border: 1px solid rgba(10,132,255,0.12);
  box-shadow: 0 8px 18px rgba(10,132,255,0.06);
  border-radius: 12px;
  padding: 12px;
  transition: transform 220ms cubic-bezier(.2,.9,.2,1), box-shadow 220ms ease, filter 200ms ease;
  position: relative;
  overflow: hidden;
}

/* Sprite area should remain centered and crisp */
.pokedex-container .pokemon-card .pokemon-image {
  /* place sprite as a large, background-like element inside the card */
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 0;
  pointer-events: none;
}

.pokedex-container .pokemon-card .pokemon-image img {
  /* make the sprite big and crisp (nearest-neighbor scaling) */
  /*width: 120%;*/
  /* max-width: none; */
  height: auto;
  object-fit: contain;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  -ms-interpolation-mode: nearest-neighbor;
  transition: transform 240ms ease, filter 200ms ease, opacity 200ms ease;
  transform: translateY(4%);
  opacity: 0.98;
}
.pokedex-container .pokemon-card:not(.uncaught)::after {
  /* subtle moving shine layered above sprite */
  content: "";
  position: absolute;
  left: -40%;
  top: -40%;
  width: 180%;
  height: 180%;
  background: radial-gradient(60% 40% at 30% 25%, rgba(255,255,255,0.22), rgba(255,255,255,0) 40%);
  transform: rotate(15deg) translateX(-100%);
  pointer-events: none;
  opacity: 0.9;
  transition: transform 1.6s ease;
  z-index: 2;
}

.pokedex-container .pokemon-card:not(.uncaught):hover::after {
  transform: rotate(15deg) translateX(0%);
}

/* Greyed out, subdued style for missing pokemon (uncaught) */
.pokedex-container .pokemon-card.uncaught {
  filter: grayscale(100%) contrast(0.9) opacity(0.6);
  background: linear-gradient(180deg, #f6f7f9 0%, #efefef 100%);
  border: 1px dashed rgba(0,0,0,0.06);
  box-shadow: none;
}

/* Ensure id positioning keeps readable contrast */
/* pokemon-id overlay removed - no project-specific overlay rules */

/* add subtle radial backdrop behind sprite for contrast */
.pokedex-container .pokemon-card::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  background: radial-gradient(circle at 50% 40%, rgba(255,255,255,0.06), rgba(255,255,255,0) 35%);
  pointer-events: none;
}

/* project-specific .pokemon-id styles removed; keep global rules if present in other files */

/* Auth forms */
.auth-container {
  max-width: 400px;
  margin: 50px auto;
  padding: 0 20px;
}

/* Auth hero: vertically center auth content on small devices
   Use the reserved --menu-height so the header area is respected. On
   larger screens keep the existing spacing behavior. */
.auth-hero {
  min-height: calc(100vh - var(--menu-height));
  display: flex;
  align-items: center;
  justify-content: center;
  padding-top: 8px; /* small padding for very small viewports */
  padding-bottom: 8px;
}

.auth-hero .container {
  width: 100%;
}

.auth-hero .auth-columns {
  /* ensure the Bulma columns inside the hero occupy the available height */
  min-height: 100%;
  align-items: center; /* vertically center the columns' children */
}

@media (min-width: 769px) {
  /* revert to the default desktop spacing so layout remains unchanged */
  .auth-hero {
    min-height: auto;
    padding-top: calc(var(--menu-height) + var(--content-top-padding));
    padding-bottom: var(--content-top-padding);
  }
  .auth-hero .auth-columns { min-height: auto; }
}

.auth-header {
  text-align: center;
  margin-bottom: 30px;
}

.auth-footer {
  text-align: center;
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid #dee2e6;
}

/* Catch page */
.catch-container {
  max-width: 600px;
  margin: 28px auto;
  padding: 0 16px;
}

.catch-header {
  text-align: center;
  margin-bottom: 18px;
}

.catch-scene {
  text-align: center;
  margin: 18px 0;
  /* smaller min-height but still allow room for enlargement */
  min-height: 360px;
}

.caught-sprite {
  /* center the sprite absolutely inside .catch-scene so transforms won't shift layout
     and so animations can use translate offsets relative to the centered position */
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  transform-origin: 50% 60%;
  /* fixed display size to avoid layout shifts while the image loads */
  width: 150px;
  max-width: none;
  height: auto;
  z-index: 4; /* ensure it's above rotor/spotlights */
  /* keep pixel-art/crisp sprites crisp when scaled */
  image-rendering: pixelated;
  image-rendering: -moz-crisp-edges;
  image-rendering: crisp-edges;
  -ms-interpolation-mode: nearest-neighbor;
}

/* Rotating ring behind the sprite */
.catch-scene { position: relative; overflow: visible; }
.rotor {
  position: absolute;
  left: 50%; top: 50%;
  width: 320px; height: 320px;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: conic-gradient(from 0deg, rgba(255,107,53,0.12), rgba(255,140,0,0.08));
  box-shadow: 0 8px 30px rgba(255,140,0,0.06) inset;
  opacity: 0.9;
  z-index: 1;
  pointer-events: none;
}
.rotor.spin { animation: rotor-spin 2.2s linear infinite; }
@keyframes rotor-spin { to { transform: translate(-50%, -50%) rotate(360deg); } }

/* decorative concentric rings and glow */
.rotor::before, .rotor::after {
  content: '';
  position: absolute;
  left: 50%; top: 50%;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  pointer-events: none;
}
.rotor::before {
  width: 280px; height: 280px; border: 2px solid rgba(255,200,120,0.12); box-shadow: 0 0 40px rgba(255,150,50,0.06);
}
.rotor::after {
  width: 240px; height: 240px; border: 1px dashed rgba(255,200,120,0.08); opacity: 0.9;
}


/* Spotlights */
.spotlights { position: absolute; inset: 0; pointer-events: none; z-index: 2; }
.spotlight {
  position: absolute;
  width: 260px; height: 260px;
  left: 50%; top: 10%;
  transform: translate(-50%, -30%) scale(0.6) rotate(-12deg);
  background: radial-gradient(ellipse at center, rgba(255,255,255,0.9) 0%, rgba(255,255,255,0.06) 25%, rgba(255,255,255,0) 60%);
  filter: blur(18px);
  opacity: 0;
  transition: transform 700ms cubic-bezier(.2,.9,.2,1), opacity 700ms ease;
}
.spotlight-1 { left: 20%; top: 0%; }
.spotlight-2 { left: 80%; top: 0%; }
.spotlight-3 { left: 50%; top: -10%; }
.spotlight.active { transform: translate(-50%, -50%) scale(1.25) rotate(0deg); opacity: 0.85; }

/* Sprite properties consolidated above; keep transform-origin consistent */
.caught-sprite { transform-origin: 50% 60%; }

.sparkles { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); width: 360px; height: 360px; z-index:3; pointer-events:none; }
.sparkles .spark { position:absolute; width:8px; height:8px; border-radius:50%; background: radial-gradient(circle, #fff 0%, rgba(255,255,255,0.9) 50%, rgba(255,240,180,0.6) 100%); opacity:0; transform: translateY(0) scale(0.6); }

/* sparkle animation (rise + fade + scale) */
@keyframes sparkle-rise {
  0% { opacity: 1; transform: translateY(0) scale(0.6); }
  60% { opacity: 1; transform: translateY(-36px) scale(1.1); }
  100% { opacity: 0; transform: translateY(-64px) scale(1.4); }
}
.spark.spark-anim { animation: sparkle-rise 900ms cubic-bezier(.2,.9,.2,1) forwards; }

/* sprite pulse/pop: include the centering translate so animation keeps the sprite centered */
@keyframes sprite-pop {
  0% { transform: translate(-50%,-50%) translateY(0) scale(1); filter: drop-shadow(0 6px 12px rgba(0,0,0,0.12)); }
  40% { transform: translate(-50%,-50%) translateY(-8px) scale(1.18); filter: drop-shadow(0 18px 30px rgba(255,180,90,0.18)); }
  100% { transform: translate(-50%,-50%) translateY(0) scale(1); filter: drop-shadow(0 6px 12px rgba(0,0,0,0.12)); }
}
.caught-sprite.pulse { animation: sprite-pop 720ms cubic-bezier(.2,.9,.2,1) forwards; }

/* When the sprite is enlarged (big), use a pop animation that scales from the larger baseline
   so the animation doesn't collapse the sprite back to scale(1). */
.caught-sprite.big.pulse {
  animation: sprite-pop-big 720ms cubic-bezier(.2,.9,.2,1) forwards;
}

@keyframes sprite-pop-big {
  /* baseline: centered translate + scale(2.4) */
  0%   { transform: translate(-50%,-50%) scale(1.8); filter: drop-shadow(0 6px 12px rgba(0,0,0,0.12)); }
  40%  { transform: translate(-50%,-50%) translateY(-8px) scale(calc(1.8 * 1.18)); filter: drop-shadow(0 18px 30px rgba(255,180,90,0.18)); }
  100% { transform: translate(-50%,-50%) scale(1.8); filter: drop-shadow(0 6px 12px rgba(0,0,0,0.12)); }
}

/* popup ring */
.pop-ring {
  position: absolute;
  left: 50%; top: 50%; transform: translate(-50%, -50%) scale(0.2);
  width: 120px; height: 120px; border-radius: 50%; border: 3px solid rgba(255,220,130,0.95);
  z-index: 2; pointer-events: none; opacity: 0.92; box-shadow: 0 6px 22px rgba(255,200,60,0.16);
  animation: pop-ring 620ms cubic-bezier(.2,.9,.2,1) forwards;
}
@keyframes pop-ring { 0% { transform: translate(-50%,-50%) scale(0.18); opacity: 0.95; } 60% { transform: translate(-50%,-50%) scale(1.18); opacity: 0.7; } 100% { transform: translate(-50%,-50%) scale(1.9); opacity: 0; } }

/* make the caught sprite much larger during the celebration */
.caught-sprite.big {
  /* keep the sprite visually large as the baseline; include the centering translate so it
     remains centered when the class is applied (avoids jumping). Animations add additional
     translate/scale on top of this baseline via keyframes. Move it up so it clears text. */
  transform: translate(-50%,-50%) scale(1.8);
  transition: filter 360ms ease, transform 360ms ease;
  /* small, subtle drop shadow to lift the sprite */
  filter: drop-shadow(0 10px 18px rgba(0,0,0,0.18));
  z-index: 12001;
}

/* subtle breathing animation: 2.4 -> 2.4*1.05 (5% increase) */
@keyframes sprite-breath {
  from { transform: translate(-50%,-50%) scale(1.8); }
  to   { transform: translate(-50%,-50%) scale(calc(1.8 * 1.05)); }
}

/* smaller button styling specifically for the catch page action */
.catch-actions .btn {
  padding: 6px 10px;
  font-size: 13px;
  border-radius: 6px;
  height: 34px;
  line-height: 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.catch-actions .btn i.material-icons {
  font-size: 16px;
  margin-right: 6px;
}

/* Start breathing only after the pop animation is finished. We avoid applying the breathing
   while .pulse is active to prevent transform conflicts. */
.caught-sprite.big:not(.pulse) {
  animation: sprite-breath 1400ms ease-in-out 720ms infinite alternate;
}


.catch-actions {
  text-align: center;
  margin-top: 30px;
}

/* Pokédex progress card */
.progress-summary-card {
  display: block;
  max-width: 900px;
  margin: 0 auto;
  padding: 14px 18px;
  background: linear-gradient(180deg, rgba(255,255,255,0.9), rgba(255,255,255,0.85));
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.06);
}

.progress-summary-card .percentage {
  font-size: 1.6rem;
  color: var(--md-sys-color-primary, #ff6b35);
  display: block;
}

.progress-summary-card .muted { color: #6b6b6b; font-size: 0.95rem; }

.progress-stats { margin-top: 6px; margin-bottom: 8px; }

/* Slightly larger progress on desktop */
@media (min-width: 769px) {
  .progress-summary-card progress.progress { height: 14px; }
}

/* Leaderboard (Bulma-friendly) */
.leaderboard-container {
  max-width: 900px;
  margin: 0 auto;
  padding: 18px;
}

/* Compact leaderboard variant: denser rows, smaller tags and progress bars */
.leaderboard-compact { padding: 10px; }
.leaderboard-compact .box { padding: 8px; }
.leaderboard-compact .table td, .leaderboard-compact .table th { padding: 6px 8px; vertical-align: middle; }
.leaderboard-compact .tag { font-size: 0.85rem; padding: 6px 8px; }
.leaderboard-compact .progress { height: 8px; }
.leaderboard-compact .player-sub { display: none; }
.leaderboard-compact .title.is-4 { font-size: 1.05rem; }

/* Avatar styles removed (leaderboard no longer shows avatars) */

.player-name { font-weight: 600; }
.player-sub { color: #6b6b6b; font-size: 0.9rem; }

/* subtle hover for table rows */
.leaderboard-row:hover { background: rgba(0,0,0,0.02); }

/* rank tags */
.table .tag { font-weight: 700; }
.table .tag.is-warning { background-color: #ffd966; color: #2b2b2b; }

/* progress bars should be responsive inside table cells */
.table progress.progress { width: 100%; max-width: 360px; }

/* mobile list tweaks: use Bulma spacing */
@media (max-width: 768px) {
  .leaderboard-container { padding: 12px; }
}

/* Leaderboard specific tweaks for Bulma */
.table-container {
  margin-top: 8px;
}

.leaderboard-container .media {
  margin-bottom: 10px;
}

.leaderboard-container .tag.is-warning {
  background-color: #ffd966;
  color: #2b2b2b;
  font-weight: 700;
}

/* Settings */
.settings-container {
  max-width: 600px;
  margin: 50px auto;
  padding: 0 20px;
}

.settings-header {
  text-align: center;
  margin-bottom: 30px;
}

/* Responsive design */
@media (max-width: 768px) {
  .pokedex-grid {
    /* try to fit 3 across on small tablets/large phones */
    grid-template-columns: repeat(3, 1fr);
  }

  .leaderboard-item {
    flex-direction: column;
    text-align: center;
  }

  .rank {
    margin-bottom: 10px;
  }

  .player-stats {
    flex-direction: column;
    gap: 5px;
  }

  .progress-container {
    max-width: none;
  }
}

@media (max-width: 480px) {
  .pokedex-grid {
    /* aggressive small column sizing to fit 4 across on narrow phones */
    grid-template-columns: repeat(4, 1fr);
    gap: 6px;
  }

  .btn {
    width: 100%;
    justify-content: center;
  }
}

/* Extra small phones (iPhone 12 Pro viewport ~390px) */
@media (max-width: 420px) {
  .container { padding-left: 8px; padding-right: 8px; }
  .pokedex-container .pokedex-grid { grid-template-columns: repeat(4, 1fr); gap: 4px; }
  .pokedex-container .pokemon-card { padding: 2px; }
  
}

/* Info page logo that overlaps the info box */
.info-logo {
  display: flex;
  justify-content: center;
  margin-top: 18px; /* push it slightly below header area */
  pointer-events: none; /* decorative */
}
.info-logo-img {
  width: 396px; /* 220 * 1.8 */
  height: 396px;
  object-fit: contain;
  /* use normal rendering for the logo (photographic/vector) */
  image-rendering: auto;
  transform: translateY(-20px); /* increased to maintain overlap */
  box-shadow: none;
  border-radius: 0; /* no box-like rounding */
  background: transparent;
  z-index: 30;
}
.info-box {
  position: relative;
  padding-top: 200px; /* make room for the larger overlapping logo */
}

@media (max-width: 1024px) {
  .info-logo-img { width: 324px; height: 324px; transform: translateY(-20px); }
  .info-box { padding-top: 160px; }
}

@media (max-width: 768px) {
  .info-logo-img { width: 252px; height: 252px; transform: translateY(-20px); }
  .info-box { padding-top: 120px; }
}

@media (max-width: 420px) {
  .info-logo-img { width: 198px; height: 198px; transform: translateY(-20px); }
  .info-box { padding-top: 90px; }
}

/* Strong overrides to ensure sprites are large and crisp */
.pokedex-container .pokemon-card .pokemon-image img {
  /*width: 120% !important;*/
  /* max-width: none !important; */
  image-rendering: pixelated !important;
  image-rendering: crisp-edges !important;
  -ms-interpolation-mode: nearest-neighbor !important;
}

/* Hide small ID on very small screens to maximize sprite area */
@media (max-width: 360px) {
  .pokedex-container .pokemon-card .pokemon-id { display: none; }
}

/* Mobile bottom navigation (Spotify-style) */
@media (max-width: 768px) {
  main.container {
    padding-bottom: 88px; /* reserve space for the bottom nav */
  }

  .mobile-bottom-nav {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    height: 64px;
    display: flex;
    justify-content: space-around;
    align-items: center;
    background: #ffffff;
    border-top: 1px solid #e6e6e6;
    box-shadow: 0 -6px 18px rgba(0,0,0,0.06);
    z-index: 1200;
    padding-bottom: env(safe-area-inset-bottom);
  }

  .mobile-bottom-nav .mobile-nav-item {
    flex: 1;
    text-align: center;
    color: #333;
    text-decoration: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    padding: 6px 4px;
  }

  .mobile-bottom-nav .mobile-nav-item .icon { font-size: 20px; }
  .mobile-bottom-nav .mobile-nav-item .label { font-size: 11px; margin-top: 2px; }
}

/* Active state for mobile bottom nav: only color the icon blue */
@media (max-width: 768px) {
  .mobile-bottom-nav .mobile-nav-item.is-active {
    background: transparent;
    color: inherit;
  }

  /* Color the material icon inside the active item */
  .mobile-bottom-nav .mobile-nav-item.is-active .icon,
  .mobile-bottom-nav .mobile-nav-item.is-active .icon i {
    color: #0a84ff !important;
  }

  .mobile-bottom-nav .mobile-nav-item { position: static; }
}

  /* --- Auth page small tweaks --- */
  .auth-card { border-radius: 12px; overflow: hidden; }
  .auth-card .card-content { padding: 28px; }
  .brand-badge {
    width: 72px;
    height: 72px;
    border-radius: 18px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg,#fff 0%, #f1fbff 100%);
    border: 1px solid rgba(10,132,255,0.08);
    box-shadow: 0 8px 22px rgba(10,132,255,0.06);
  }
  .brand-badge i.material-icons {
    display: inline-block;
    font-size: 32px;
    color: #0a84ff;
    margin: 0;
    line-height: 1;
    vertical-align: middle;
    align-self: center; /* works with parent flexbox */
  }

  /* Small adjustment for smaller badges */
  @media (max-width: 480px) {
    .brand-badge i.material-icons { font-size: 28px; }
  }

  /* Strong centering fallback: reset line-height, force block & center, small pop to adjust glyph baseline */
  .brand-badge i.material-icons {
    display: block !important;
    margin: auto !important;
    line-height: 0 !important;
    padding: 0 !important;
    transform: translateY(0.6px);
  }

  .auth-card .label { color: #4b5563; font-weight: 600; }
  .auth-card .input { border-radius: 8px; }
  .auth-card .button.is-primary { border-radius: 10px; box-shadow: 0 6px 18px rgba(10,132,255,0.08); }

  @media (max-width: 480px) {
    .auth-card .card-content { padding: 20px; }
    .brand-badge { width: 60px; height: 60px; }
  }

/* Auth hero visuals */
.auth-hero { padding-top: 48px; padding-bottom: 48px; }
.auth-columns { min-height: 360px; }
.hero-visual .visual-card {
  padding: 36px;
  border-radius: 12px;
  background: linear-gradient(135deg, #0a84ff 0%, #2ac0ff 100%);
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.hero-visual .title { color: #fff; margin-bottom: 8px; }
.hero-visual p { color: rgba(255,255,255,0.9); }

/* Slightly larger input icons alignment for auth forms */
.auth-card .icon.is-left i, .auth-card .icon.is-right i { font-size: 20px; }

/* Password toggle styling */
.password-toggle { cursor: pointer; color: #6b7280; }
.password-toggle:hover { color: #374151; }

/* Fix: ensure icon wrappers inside auth controls are absolutely positioned and centered */
.auth-card .control { position: relative; }
.auth-card .control .icon.is-left,
.auth-card .control .icon.is-right {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  pointer-events: none;
  display: flex;
  align-items: center;
}

/* Site hero (index page) */
.site-hero { margin-bottom: 18px; }
.site-hero .brand-badge { width: 56px; height: 56px; border-radius: 12px; }
.site-hero .title { margin-bottom: 2px; }
.site-hero .subtitle { margin-top: 0; color: #6b7280; }
/* Logo image inside brand-badge */
.brand-badge .site-logo { width: 88%; height: 88%; object-fit: contain; display: block; margin: auto; }

/* Give inputs room for icons so the icon doesn't wrap below on narrow widths */
.auth-card .control.has-icons-left .input { padding-left: 2.6rem; }
.auth-card .control.has-icons-right .input { padding-right: 2.6rem; }

/* Make notifications inside auth-card stand out without being loud */
.auth-card .notification { margin-bottom: 8px; border-radius: 8px; }

/* Smaller hero on tiny screens */
@media (max-width: 768px) {
  .auth-columns { min-height: auto; }
  .hero-visual { display: none; }
}
