:root {
  color-scheme: light;
  --bg-top: #7fe5ff;
  --bg-bottom: #ffe86a;
  --panel: #fff8ed;
  --panel-strong: #ffffff;
  --ink: #252049;
  --muted: #6c6692;
  --line: #28214f;
  --pink: #ff4f9a;
  --blue: #24b8ff;
  --green: #3ddb78;
  --yellow: #ffd447;
  --orange: #ff9436;
  --danger: #ff4d60;
  --shadow: rgba(37, 32, 73, 0.22);
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  font-family: "Trebuchet MS", "Segoe UI", Arial, sans-serif;
  background:
    radial-gradient(circle at 18% 14%, rgba(255, 255, 255, 0.72), transparent 17rem),
    radial-gradient(circle at 86% 10%, rgba(255, 79, 154, 0.24), transparent 17rem),
    radial-gradient(circle at 78% 84%, rgba(36, 184, 255, 0.28), transparent 20rem),
    linear-gradient(155deg, var(--bg-top), var(--bg-bottom));
  overflow-x: hidden;
}

body.dark-mode {
  color-scheme: dark;
  --bg-top: #15183e;
  --bg-bottom: #4a226d;
  --panel: #242352;
  --panel-strong: #302d68;
  --ink: #fff7ca;
  --muted: #c9c1ef;
  --line: #fff7ca;
  --shadow: rgba(0, 0, 0, 0.36);
}

button {
  border: 0;
  font: inherit;
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  filter: grayscale(0.2) brightness(0.94);
}

button:focus-visible {
  outline: 4px solid var(--yellow);
  outline-offset: 3px;
}

.app-shell {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 16px;
}

.game-panel,
.result-card {
  width: min(100%, 540px);
  border: 4px solid var(--line);
  border-radius: 28px;
  background: var(--panel);
  box-shadow: 0 16px 0 rgba(37, 32, 73, 0.16), 0 26px 38px var(--shadow);
}

.game-panel {
  display: grid;
  gap: 16px;
  padding: 16px;
}

.top-bar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.title-block {
  min-width: 0;
}

.eyebrow,
.prompt,
.stat-label {
  margin: 0;
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  line-height: 1;
  letter-spacing: 0;
}

h1 {
  max-width: 9ch;
  font-size: clamp(2.45rem, 14vw, 4.65rem);
}

.icon-actions {
  display: flex;
  flex: 0 0 auto;
  gap: 8px;
}

.icon-button {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border: 3px solid var(--line);
  border-radius: 50%;
  color: var(--ink);
  background: var(--panel-strong);
  box-shadow: 0 5px 0 var(--line);
  transition: transform 160ms ease, box-shadow 160ms ease;
}

.icon-button:active {
  transform: translateY(4px);
  box-shadow: 0 1px 0 var(--line);
}

.icon-button.muted {
  opacity: 0.62;
}

.status-strip {
  display: grid;
  grid-template-columns: 1.35fr repeat(3, 1fr);
  gap: 8px;
}

.lives-box,
.stat-box,
.result-stats article {
  min-width: 0;
  border: 3px solid var(--line);
  border-radius: 18px;
  background: var(--panel-strong);
  padding: 9px 8px;
  text-align: center;
  box-shadow: 0 6px 0 rgba(37, 32, 73, 0.15);
}

.stat-box strong,
.result-stats strong {
  display: block;
  font-size: 1.45rem;
  line-height: 1.1;
}

.hearts {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 30px;
  gap: 3px;
}

.heart {
  color: var(--danger);
  font-size: 1.35rem;
  line-height: 1;
  text-shadow: 0 2px 0 var(--line);
}

.heart.empty {
  color: rgba(108, 102, 146, 0.34);
  text-shadow: none;
}

.heart.lost {
  animation: loseHeart 520ms ease both;
}

.progress-wrap {
  height: 16px;
  overflow: hidden;
  border: 3px solid var(--line);
  border-radius: 999px;
  background: var(--panel-strong);
}

.progress-bar {
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--green), var(--yellow), var(--pink));
  transition: width 320ms ease;
}

.name-card {
  display: grid;
  gap: 10px;
  min-height: 250px;
  place-items: center;
  border: 4px solid var(--line);
  border-radius: 26px;
  padding: 18px;
  text-align: center;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.58), transparent),
    var(--panel-strong);
  box-shadow: inset 0 -8px 0 rgba(37, 32, 73, 0.08);
  transition: background 180ms ease, opacity 180ms ease, transform 180ms ease;
}

.badge-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
}

.pill {
  border: 2px solid var(--line);
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 0.76rem;
  font-weight: 900;
  text-transform: uppercase;
}

.difficulty {
  background: var(--yellow);
}

.rarity {
  background: #b4f4ff;
}

body.dark-mode .rarity {
  background: #403b8e;
}

#nameValue {
  max-width: 100%;
  font-size: clamp(2.55rem, 15vw, 5.2rem);
  overflow-wrap: anywhere;
  text-shadow: 0 5px 0 rgba(36, 184, 255, 0.3);
}

.hint {
  min-height: 2.7em;
  margin: 0;
  color: var(--muted);
  font-weight: 800;
  line-height: 1.35;
}

.answer-grid,
.result-actions {
  display: grid;
  gap: 12px;
}

.answer-button,
.primary-action,
.secondary-action {
  min-height: 66px;
  border: 4px solid var(--line);
  border-radius: 20px;
  color: var(--ink);
  font-size: 1.12rem;
  font-weight: 950;
  box-shadow: 0 8px 0 var(--line);
  transition: transform 160ms ease, box-shadow 160ms ease, filter 160ms ease;
}

.answer-button:hover:not(:disabled),
.primary-action:hover,
.secondary-action:hover {
  filter: saturate(1.12);
  transform: translateY(-2px);
}

.answer-button:active:not(:disabled),
.primary-action:active,
.secondary-action:active {
  transform: translateY(6px);
  box-shadow: 0 2px 0 var(--line);
}

.pokemon {
  background: var(--blue);
}

.venezolano {
  background: var(--orange);
}

.primary-action {
  background: var(--green);
}

.secondary-action {
  background: var(--pink);
}

.feedback,
.share-message {
  min-height: 1.6em;
  margin: 0;
  color: var(--muted);
  font-weight: 900;
  text-align: center;
}

.correct .name-card {
  animation: bounceWin 440ms ease;
  background: linear-gradient(135deg, rgba(61, 219, 120, 0.38), rgba(255, 212, 71, 0.35)), var(--panel-strong);
}

.wrong .name-card {
  animation: shakeLose 380ms ease;
  background: linear-gradient(135deg, rgba(255, 77, 96, 0.34), rgba(255, 255, 255, 0.42)), var(--panel-strong);
}

.question-enter {
  animation: questionEnter 260ms ease;
}

.result-screen {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgba(20, 17, 48, 0.48);
  backdrop-filter: blur(8px);
}

.result-card {
  display: grid;
  gap: 16px;
  padding: 22px;
  text-align: center;
  animation: popIn 260ms ease;
}

.result-card h2 {
  font-size: clamp(2rem, 13vw, 4rem);
}

#finalScore {
  font-size: clamp(4rem, 22vw, 7rem);
  line-height: 0.9;
}

.result-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.result-stats span {
  display: block;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 900;
  text-transform: uppercase;
}

.hidden {
  display: none;
}

.confetti-layer {
  pointer-events: none;
  position: fixed;
  inset: 0;
  overflow: hidden;
}

.confetti {
  position: absolute;
  top: 42%;
  left: 50%;
  width: 12px;
  height: 18px;
  border: 2px solid rgba(37, 32, 73, 0.35);
  border-radius: 5px;
  animation: confettiPop 780ms ease-out forwards;
}

@keyframes bounceWin {
  0%,
  100% {
    transform: scale(1);
  }
  45% {
    transform: scale(1.05) rotate(-1deg);
  }
}

@keyframes shakeLose {
  0%,
  100% {
    transform: translateX(0);
  }
  20% {
    transform: translateX(-12px) rotate(-1.5deg);
  }
  40% {
    transform: translateX(12px) rotate(1.5deg);
  }
  60% {
    transform: translateX(-8px);
  }
  80% {
    transform: translateX(8px);
  }
}

@keyframes questionEnter {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes loseHeart {
  0% {
    color: var(--danger);
    opacity: 1;
    transform: scale(1);
  }
  45% {
    transform: scale(1.35) rotate(-10deg);
  }
  100% {
    color: rgba(108, 102, 146, 0.34);
    opacity: 0.55;
    transform: scale(0.88) translateY(4px);
  }
}

@keyframes popIn {
  from {
    opacity: 0;
    transform: scale(0.92);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes confettiPop {
  to {
    opacity: 0;
    transform: translate(var(--x), var(--y)) rotate(var(--r));
  }
}

@media (max-width: 390px) {
  .app-shell {
    padding: 10px;
  }

  .game-panel {
    border-radius: 24px;
    gap: 12px;
    padding: 12px;
  }

  .status-strip {
    gap: 6px;
  }

  .lives-box,
  .stat-box {
    padding: 8px 5px;
  }

  .heart {
    font-size: 1.08rem;
  }

  .stat-box strong {
    font-size: 1.22rem;
  }

  .name-card {
    min-height: 225px;
    padding: 14px;
  }
}

@media (min-width: 560px) {
  .app-shell {
    padding: 32px;
  }

  .game-panel {
    gap: 20px;
    padding: 24px;
  }

  .answer-grid,
  .result-actions {
    grid-template-columns: repeat(2, 1fr);
  }
}
