:root {
  --pokedex-shadow: rgba(11, 20, 28, 0.25);
  --pokedex-text-dark: #090b0e;
  --pokedex-text-muted: #e9ecf0;
  --pokedex-button-base: #3f4a55;
  --pokedex-button-base-dark: #29333d;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: 'Exo 2', sans-serif;
}

body {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: 'Exo 2', sans-serif;
  min-height: 100vh;
  display: grid;
  place-items: center;
  background: #1a3b2e url('images/nature-pokemon.jpg') center / cover no-repeat fixed;
}

.pokedex-shell {
  width: min(1120px, 100%);
  display: grid;
  gap: 14px;
  justify-items: center;
}

.pokedex-controls {
  width: min(420px, 95%);
  display: flex;
  justify-content: center;
  gap: 10px;
}

.pokedex-toggle {
  border: 2px solid #101820;
  border-radius: 999px;
  background: linear-gradient(180deg, #ffffff 0%, #d9e5ee 100%);
  color: #111;
  padding: 7px 14px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  transition: transform 120ms ease, box-shadow 120ms ease, filter 120ms ease;
  box-shadow: 0 3px 0 #101820;
}

.pokedex-toggle:hover {
  filter: brightness(1.03);
}

.pokedex-toggle:active {
  transform: translateY(2px);
  box-shadow: 0 1px 0 #101820;
}

.pokedex-toggle[aria-pressed='true'] {
  background: linear-gradient(180deg, #ffe58a 0%, #ffd04f 100%);
}

.pokedex-book {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: clamp(8px, 1.8vw, 20px);
  width: 100%;
}

.pokedex-left-panel {
  position: relative;
  width: min(460px, 100%);
  filter: drop-shadow(0 18px 22px var(--pokedex-shadow));
}

.pokedex-right-panel {
  position: relative;
  width: min(372px, 42vw);
  transform: translate(-21px, -12px);
  filter: drop-shadow(0 18px 22px var(--pokedex-shadow));
}

.pokedex-device {
  width: 100%;
  height: auto;
  display: block;
  user-select: none;
  -webkit-user-drag: none;
}

.pokedex-audio-light {
  position: absolute;
  z-index: 3;
  top: 2.6%;
  left: 9.7%;
  width: 16%;
  aspect-ratio: 1;
  border-radius: 50%;
  pointer-events: none;
  opacity: 0;
  background:
    radial-gradient(circle at 48% 36%, rgba(255, 255, 255, 0.95) 0 13%, rgba(149, 255, 255, 0.92) 14% 28%, rgba(18, 224, 239, 0.84) 42%, rgba(0, 146, 191, 0.78) 68%, rgba(0, 75, 118, 0.4) 100%);
  box-shadow: 0 0 16px 7px rgba(64, 238, 255, 0.7), inset 0 0 14px rgba(255, 255, 255, 0.85);
  transform: scale(0.96);
}

.pokedex-left-panel.pokedex-audio-playing .pokedex-audio-light {
  opacity: 1;
  animation: pokedexAudioGlow 520ms steps(2, end) infinite;
}

.pokedex-transcript-display {
  position: absolute;
  z-index: 3;
  top: 24.6%;
  left: 12.8%;
  width: 66.5%;
  height: 15.7%;
  padding: 3.2% 4%;
  display: grid;
  align-items: center;
  justify-items: start;
  overflow: hidden;
  pointer-events: none;
  color: #b6ff32;
  font-size: clamp(0.64rem, 1.15vw, 0.84rem);
  font-weight: 600;
  line-height: 1.14;
  letter-spacing: 0.02em;
  text-align: left;
  overflow-wrap: break-word;
  word-break: normal;
  hyphens: auto;
  text-shadow: 0 0 4px rgba(182, 255, 50, 0.95), 0 0 10px rgba(92, 255, 63, 0.55);
}

.pokedex-transcript-display::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: -1;
  opacity: 0.18;
  background: repeating-linear-gradient(
    180deg,
    transparent 0,
    transparent 5px,
    rgba(182, 255, 50, 0.55) 6px
  );
}

.pokedex-image {
  position: absolute;
  z-index: 2;
  bottom: 52%;
  left: 51%;
  transform: translate(-63%, 20%);
  height: 18%;
  image-rendering: auto;
}

.pokedex-data {
  position: absolute;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  top: 53.5%;
  left: 17%;
  width: 58%;
  text-align: center;
  font-size: clamp(1rem, 3.6vw, 1.7rem);
  font-weight: 700;
  color: #f4fff2;
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.75), 0 0 6px rgba(0, 0, 0, 0.35);
}

.pokedex-name {
  text-transform: capitalize;
}

.pokedex-form {
  position: absolute;
  z-index: 2;
  width: 60%;
  top: 72%;
  left: 21%;
}

.pokedex-search-input {
  width: 100%;
  border: 2px solid #2a3440;
  border-radius: 6px;
  padding: 4.1%;
  color: var(--pokedex-text-dark);
  background: #f7f9fc;
  outline: none;
  font-size: clamp(0.88rem, 2.2vw, 1rem);
  font-weight: 600;
  box-shadow: -3px 4px 0 #76879a, -5px 7px 0 #2a3440;
}

.pokedex-search-input:focus {
  border-color: #0d6eb8;
}

.pokedex-buttons {
  position: absolute;
  z-index: 2;
  bottom: 10%;
  left: 50%;
  transform: translate(-52%, 10px);
  width: 65%;
  display: flex;
  gap: 18px;
}

.pokedex-button {
  flex: 1 1 0;
  min-width: 0;
  border: 2px solid #0e141a;
  border-radius: 7px;
  padding: 4.2%;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
  line-height: 1;
  color: #fff;
  background: linear-gradient(180deg, var(--pokedex-button-base) 0%, var(--pokedex-button-base-dark) 100%);
  box-shadow: -2px 3px 0 #212934, -4px 6px 0 #070a0e;
  font-size: clamp(0.88rem, 2.2vw, 1rem);
  font-weight: 700;
  cursor: pointer;
  transition: transform 90ms ease, box-shadow 90ms ease, filter 120ms ease;
}

.pokedex-button:hover:enabled {
  filter: brightness(1.08);
}

.pokedex-button:active:enabled,
.pokedex-button.pokedex-button-click {
  transform: translateY(2px);
  box-shadow: -1px 1px 0 #212934, -2px 3px 0 #070a0e;
}

.pokedex-button:disabled {
  cursor: not-allowed;
  opacity: 0.58;
}

.pokedex-right-content {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  display: grid;
  align-content: start;
  justify-items: center;
  padding-top: 28%;
  color: #e6eef6;
  text-shadow: 1px 1px 0 rgba(0, 0, 0, 0.35);
}

.pokedex-right-title {
  font-size: clamp(1rem, 2vw, 1.45rem);
  font-weight: 800;
  letter-spacing: 0.4px;
}

.pokedex-right-subtitle {
  margin-top: 6px;
  font-size: clamp(0.78rem, 1.35vw, 1rem);
  max-width: 65%;
  line-height: 1.15;
}

@media (max-width: 900px) {
  .pokedex-shell {
    gap: 10px;
  }

  .pokedex-right-panel {
    display: none;
  }

  .pokedex-left-panel {
    width: min(460px, 96vw);
  }
}

@media (max-width: 640px) {
  .pokedex-controls {
    width: min(460px, 100%);
    gap: 8px;
  }

  .pokedex-toggle {
    padding: 7px 12px;
    gap: 6px;
    font-size: clamp(0.95rem, 4.2vw, 1.08rem);
  }

  .pokedex-toggle-flag {
    font-size: 1rem;
    line-height: 1;
  }

  .pokedex-data {
    left: 17%;
    width: 58%;
    gap: 5px;
    font-size: clamp(1.15rem, 6.2vw, 1.5rem);
  }

  .pokedex-form {
    width: 62%;
    left: 20%;
  }

  .pokedex-search-input {
    padding: 4.6%;
    font-size: clamp(1.02rem, 4.7vw, 1.15rem);
  }

  .pokedex-buttons {
    width: 66%;
    gap: 12px;
  }

  .pokedex-button {
    padding: 4.6%;
    font-size: clamp(1.02rem, 4.7vw, 1.15rem);
  }

  .pokedex-language-pt .pokedex-buttons {
    width: 72%;
    gap: 8px;
  }

  .pokedex-language-pt .pokedex-button {
    font-size: clamp(0.72rem, 3.2vw, 0.82rem);
    font-weight: 600;
    padding: 4.2% 2%;
  }
}

@media (max-width: 420px) {
  .pokedex-toggle {
    padding: 6px 10px;
    font-size: clamp(0.9rem, 4vw, 0.98rem);
  }

  .pokedex-data {
    left: 17%;
    width: 58%;
    font-size: clamp(1.05rem, 5.8vw, 1.28rem);
  }

  .pokedex-search-input {
    min-height: 32px;
    padding: 1%;
    font-size: clamp(0.95rem, 4.6vw, 1.05rem);
  }

  .pokedex-button {
    min-height: 32px;
    font-size: clamp(0.95rem, 4.6vw, 1.05rem);
  }

  .pokedex-button {
    font-size: clamp(0.66rem, 3vw, 0.74rem);
    padding: 4% 1.5%;
  }

  .pokedex-form {
    top: 72.5% !important;
  }

  .pokedex-buttons {
    width: 65% !important;
    gap: 6px !important;
    bottom: 9.5% !important;
    transform: translate(-52%, 8px) !important;
  }
}

.pokedex-pwa-splash {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: grid;
  place-items: center;
  background: #1976d2;
  transition: opacity 220ms ease, visibility 220ms ease;
}

.pokedex-pwa-splash-image {
  width: min(34vw, 128px);
  max-width: 128px;
  min-width: 72px;
  animation: pokedexSplashSpin 1.25s linear infinite;
}

.pokedex-pwa-splash-hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

@keyframes pokedexSplashSpin {
  from {
    transform: rotate(0deg);
  }

  to {
    transform: rotate(360deg);
  }
}

@keyframes pokedexAudioGlow {
  0% {
    filter: brightness(1.05) saturate(1.1);
    box-shadow: 0 0 14px 5px rgba(64, 238, 255, 0.58), inset 0 0 12px rgba(255, 255, 255, 0.76);
    transform: scale(0.95);
  }

  35% {
    filter: brightness(1.7) saturate(1.8);
    box-shadow: 0 0 30px 14px rgba(88, 247, 255, 0.9), inset 0 0 22px rgba(255, 255, 255, 0.94);
    transform: scale(1.04);
  }

  70% {
    filter: brightness(1.28) saturate(1.45);
    box-shadow: 0 0 22px 10px rgba(26, 212, 255, 0.78), inset 0 0 16px rgba(255, 255, 255, 0.88);
    transform: scale(0.99);
  }

  100% {
    filter: brightness(1.9) saturate(2);
    box-shadow: 0 0 34px 16px rgba(125, 252, 255, 0.96), inset 0 0 24px rgba(255, 255, 255, 0.98);
    transform: scale(1.06);
  }
}
