:root {
  --poke-blue: #163a68;
  --poke-navy: #0b1f3a;
  --poke-red: #e63946;
  --poke-yellow: #ffcb05;
  --poke-green: #2ecc71;
  --text-light: #f5f5f5;
}

* {
  box-sizing: border-box;
}

/* Guard against component classes (e.g. .btn's display:inline-block) overriding [hidden]. */
[hidden] {
  display: none !important;
}

body {
  margin: 0;
  font-family: 'Segoe UI', Roboto, sans-serif;
  background: linear-gradient(180deg, var(--poke-blue), var(--poke-navy));
  color: var(--text-light);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  background: rgba(0, 0, 0, 0.2);
  position: relative;
  gap: 12px;
}

header .brand {
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 700;
  font-size: 1.2rem;
}

.lang-select {
  padding: 6px 10px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.3);
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-light);
  font-size: 0.85rem;
  width: auto;
  margin: 0;
  color-scheme: dark;
}

.lang-select option {
  color: #111;
  background: #fff;
}

.hamburger-btn {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 34px;
  height: 34px;
  border: none;
  background: transparent;
  cursor: pointer;
  padding: 0;
  flex-shrink: 0;
}

.hamburger-btn span {
  display: block;
  width: 100%;
  height: 3px;
  background: var(--text-light);
  border-radius: 2px;
}

@media (max-width: 640px) {
  header {
    flex-wrap: nowrap;
  }

  .hamburger-btn {
    display: flex;
    order: -1;
  }

  header .brand {
    font-size: 1rem;
    gap: 8px;
    flex: 1;
    min-width: 0;
  }

  header .brand img {
    width: 28px;
    height: 28px;
  }

  .lang-select {
    flex-shrink: 0;
  }

  nav.site-nav {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    flex-direction: column;
    gap: 4px;
    padding: 12px 24px 16px;
    background: var(--poke-navy);
    border-top: 1px solid rgba(255, 255, 255, 0.15);
    z-index: 20;
  }

  nav.site-nav.open {
    display: flex;
  }

  nav.site-nav a {
    margin-left: 0;
    padding: 8px 0;
  }
}

header .brand img {
  width: 40px;
  height: 40px;
}

nav a {
  color: var(--text-light);
  text-decoration: none;
  margin-left: 18px;
  font-weight: 600;
  opacity: 0.85;
}

nav a:hover {
  opacity: 1;
  text-decoration: underline;
}

main {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 32px 16px 64px;
  text-align: center;
}

h1 {
  color: var(--poke-yellow);
  margin-bottom: 8px;
}

.card {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 16px;
  padding: 24px;
  max-width: 460px;
  width: 100%;
  margin-top: 24px;
}

.btn {
  display: inline-block;
  padding: 12px 24px;
  border-radius: 10px;
  border: none;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  margin: 8px;
  text-decoration: none;
}

.btn-primary {
  background: var(--poke-red);
  color: white;
}

.btn-secondary {
  background: transparent;
  color: var(--text-light);
  border: 1px solid rgba(255, 255, 255, 0.4);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.device-photo {
  max-width: 180px;
  width: 100%;
  height: auto;
  margin: 12px auto;
  display: block;
  filter: drop-shadow(0 8px 16px rgba(0, 0, 0, 0.35));
}

input, select {
  width: 100%;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.3);
  background: rgba(255, 255, 255, 0.08);
  color: white;
  font-size: 1rem;
  margin-bottom: 12px;
}

input::placeholder {
  color: rgba(255, 255, 255, 0.6);
}

.form-row {
  text-align: left;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  text-align: left;
  margin-top: 16px;
}

.stat-grid .stat {
  background: rgba(255, 255, 255, 0.05);
  border-radius: 10px;
  padding: 10px 14px;
}

.stat .value {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--poke-yellow);
}

.sprite-box {
  width: 192px;
  height: 192px;
  margin: 16px auto;
  display: flex;
  align-items: center;
  justify-content: center;
}

.sprite-box img {
  width: 192px;
  height: 192px;
  image-rendering: pixelated;
  transition: filter 0.25s ease, opacity 0.25s ease, transform 0.25s ease;
  opacity: 1;
  transform: scale(1);
}

.sprite-box img.silhouette {
  filter: brightness(0);
}

.sprite-box img.sprite-enter {
  opacity: 0;
  transform: scale(0.85);
}

.options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 16px;
}

@keyframes optionPopIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes correctPulse {
  0% { transform: scale(1); }
  50% { transform: scale(1.08); }
  100% { transform: scale(1); }
}

@keyframes wrongShake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-5px); }
  75% { transform: translateX(5px); }
}

.options button {
  padding: 14px;
  border-radius: 10px;
  border: none;
  background: rgba(255, 255, 255, 0.1);
  color: white;
  font-size: 1rem;
  cursor: pointer;
  transition: background-color 0.2s ease, transform 0.15s ease;
}

.options button.option-enter {
  animation: optionPopIn 0.25s ease both;
}

.options button.correct {
  animation: correctPulse 0.3s ease;
}

.options button.wrong {
  animation: wrongShake 0.3s ease;
}

.options button.correct {
  background: var(--poke-green);
}

.options button.wrong {
  background: var(--poke-red);
}

.streak-badge {
  font-size: 2.4rem;
  font-weight: 800;
  color: var(--poke-yellow);
}

.share-row {
  display: flex;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 16px;
}

.leaderboard-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 16px;
  text-align: left;
}

.leaderboard-table th, .leaderboard-table td {
  padding: 8px 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.error-text {
  color: #ff8080;
  font-size: 0.9rem;
}

.muted {
  opacity: 0.75;
  font-size: 0.9rem;
}

.pokedex-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(84px, 1fr));
  gap: 8px;
  margin-top: 16px;
}

.pokedex-grid .entry {
  aspect-ratio: 1;
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 4px;
  font-size: 0.68rem;
  line-height: 1.1;
  text-align: center;
  background: rgba(255, 255, 255, 0.05);
}

.pokedex-grid .entry img {
  width: 48px;
  height: 48px;
  image-rendering: pixelated;
}

.pokedex-grid .entry.caught {
  background: rgba(46, 204, 113, 0.35);
  font-weight: 700;
}

footer {
  text-align: center;
  padding: 16px;
  font-size: 0.8rem;
  opacity: 0.6;
}

footer .footer-logout {
  display: block;
  margin: 0 auto 8px;
  background: transparent;
  border: none;
  color: var(--text-light);
  font-size: 0.8rem;
  text-decoration: underline;
  cursor: pointer;
  padding: 0;
}

footer a {
  color: var(--text-light);
}
