* {
  box-sizing: border-box;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
}
html {
  height: 100%;
}
body {
  margin: 0;
  height: 100vh;
  font-family:
    -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Yu Gothic", "Meiryo",
    sans-serif;
  background: #f2f2f2;
  display: flex;
  align-items: center;
  justify-content: center;
}
.container {
  width: 100%;
  max-width: 1196px;
  height: 540px;
  border: 2px solid #333;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
header {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  width: 100%;
  height: 82px;
  padding: 7px 12px 8px;
  display: none;
  z-index: 70;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  background: transparent;
  color: #5a4230;
  font-weight: 900;
}
header.visible {
  display: grid;
}
header .center {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 9px;
}
header h1 {
  margin: 0;
  font-size: 20px;
  line-height: 22px;
}
.header-info,
.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: bold;
}
.header-info {
  justify-self: start;
}
.header-actions {
  justify-self: end;
}
.info-box {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #fff;
  border-radius: 40px;
  padding: 6px 16px;
  font-size: 18px;
  font-weight: bold;
  color: #444;
  box-shadow: 0 2px 0 #e8a000;
}
.info-box .val {
  font-size: 22px;
  color: #ff6f3c;
  min-width: 36px;
  text-align: center;
}
button {
  font: inherit;
  cursor: pointer;
  border: 0;
}
.sound,
#quit {
  height: 40px;
  border-radius: 50px;
  font-weight: 900;
}
#quit {
  padding: 0 16px;
  background: #ff9f45;
  box-shadow: 0 4px #f17f1d;
  color: #fff;
}
.sound-btn {
  min-width: 104px;
  padding: 7px 18px;
  background: #fff0ad;
  border: 3px solid #f2b321;
  color: #694100;
  box-shadow: 0 3px 0 #d89500;
  letter-spacing: 1px;
}
.sound-btn:hover {
  background: #ffe680;
  border-color: #dc9700;
  color: #5a3500;
}
.sound-btn.sound-off {
  background: #e9edf1;
  border-color: #aeb7c0;
  color: #66717b;
  box-shadow: 0 3px 0 #929ba4;
}
.top-sound {
  position: absolute;
  right: 14px;
  top: 12px;
  z-index: 70;
}
.game-main {
  position: relative;
  flex: 1;
  overflow: hidden;
  display: grid;
  place-items: center;
  background: linear-gradient(#8fe3ff 42%, #fff3b0);
}
.game-main:after {
  content: "";
  position: absolute;
  bottom: -40px;
  width: 120%;
  height: 110px;
  border-radius: 50% 50% 0 0;
  background: #70d486;
}
.screen {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: none;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  text-align: center;
  padding: 18px;
}
.screen.active {
  display: flex;
}
.animals {
  font-size: 38px;
}
.screen > h2 {
  font-size: 48px;
  line-height: 1.05;
  margin: 5px;
  color: #fff;
  text-shadow: 0 4px #e8508a;
}
.screen > p {
  background: #ffffffcc;
  padding: 7px 18px;
  border-radius: 16px;
  color: #5a4230;
  font-weight: 800;
}
.big {
  padding: 14px 30px;
  border-radius: 40px;
  background: linear-gradient(#ff8fba, #ff6fa0);
  box-shadow: 0 7px #e8508a;
  color: #fff;
  font-size: 23px;
  font-weight: 900;
}
#play {
  padding-top: 92px;
  gap: 12px;
}
.question-prompt {
  padding: 8px 24px;
  border-radius: 24px;
  background: #ffffffdc;
  color: #5a4230;
  font-size: 24px;
  font-weight: 900;
  box-shadow: 0 4px 10px #0002;
}
.question-prompt b {
  color: #e8508a;
}
.play {
  padding-bottom: 54px;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 22px;
}
.choice {
  position: relative;
  padding: 0;
  overflow: visible;
  min-width: 0;
  flex: 0 1 310px;
  width: 310px;
  aspect-ratio: 1;
  border: 5px solid #fff;
  border-radius: 30px;
  color: #fff;
  font-size: 28px;
  font-weight: 900;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-shadow:
    0 9px #0003,
    0 0 0 3px #00000018;
  transition:
    transform 0.1s,
    box-shadow 0.1s,
    filter 0.15s;
}
.choice-label {
  position: absolute;
  z-index: 1;
  top: calc(100% + 12px);
  left: 50%;
  transform: translateX(-50%);
  max-width: calc(100% + 10px);
  padding: 5px 16px;
  border: 2px solid #fff;
  border-radius: 999px;
  background: #fff;
  color: #3b2b20;
  box-shadow: 0 2px 6px #0003;
  font-size: inherit;
  line-height: 1.2;
  white-space: nowrap;
}
.choice:hover:not(:disabled):not(.dim) {
  transform: translateY(-4px);
  filter: brightness(1.06);
  box-shadow:
    0 13px #0003,
    0 0 0 3px #00000018;
}
.choice:active:not(:disabled):not(.dim) {
  transform: translateY(6px);
  box-shadow:
    0 3px #0003,
    0 0 0 3px #00000018;
}
.choice:focus-visible {
  outline: 5px solid #ffd23f;
  outline-offset: 4px;
}
.choice .icon {
  font-size: 74px;
}
.blue {
  background: linear-gradient(#6fd6ff, #4fc3f7);
}
.purple {
  background: linear-gradient(#c7a6ff, #b388ff);
}
.choice.correct {
  border-color: #4cd787;
  background: linear-gradient(#78e29a, #4cd787);
}
.choice.wrong {
  border-color: #f1615f;
  background: linear-gradient(#ff9a9a, #f1615f);
}
.choice.dim {
  filter: grayscale(0.4);
  pointer-events: none;
}
.card {
  flex: 0 1 310px;
  width: 310px;
  aspect-ratio: 1;
  padding: 12px;
  border-radius: 26px;
  background: #fffdf5;
  color: #5a4230;
  box-shadow: 0 10px #e3d9c0;
  overflow: hidden;
}
.animal-media {
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  border-radius: 18px;
  overflow: hidden;
  background: linear-gradient(145deg, #fff, #f4ead2);
}
.animal-media img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}
.animal-media img[hidden] {
  display: none;
}
.animal-media span {
  font-size: 88px;
}
.overlay {
  position: absolute;
  inset: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #281e1447;
  opacity: 0;
  pointer-events: none;
}
.overlay.show {
  opacity: 1;
}
.overlay > div,
.result-card {
  padding: 25px 45px;
  border-radius: 30px;
  background: #fff;
  text-align: center;
  box-shadow: 0 14px 25px #0004;
}
.overlay span,
.overlay strong {
  display: block;
}
.overlay span {
  font-size: 60px;
}
.overlay strong {
  font-size: 39px;
}
.overlay p {
  font-size: 20px;
  font-weight: 800;
}
.correct-text strong {
  color: #2fb768;
}
.wrong-text strong {
  color: #d9534f;
}
.result-card {
  color: #5a4230;
}
.result-card > div:first-child {
  font-size: 54px;
}
.result-card h2 {
  font-size: 30px;
  margin: 3px;
}
.result-card #resultScore {
  font-size: 40px;
  font-weight: 900;
  color: #e8508a;
}
.result-card #stars {
  font-size: 32px;
  margin: 8px;
}
.buttons {
  display: flex;
  gap: 16px;
}
.home {
  background: #4fc3f7;
  box-shadow: 0 7px #22a9e6;
}
.progress-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}
.dot {
  display: block;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #ddd;
  transition: background 0.3s;
}
.dot.done {
  background: #6ecb63;
}
.dot.current {
  background: #f9a825;
  border: 3px solid #c77c00;
}
@media (max-width: 650px) {
  header h1 {
    font-size: 14px;
  }
  .progress-wrap {
    gap: 6px;
  }
  .dot {
    width: 14px;
    height: 14px;
  }
  .play {
    gap: 7px;
  }
  .choice {
    width: calc((100% - 14px) / 3);
    font-size: 17px;
  }
  .choice-label {
    top: calc(100% + 10px);
    padding: 4px 8px;
    font-size: clamp(11px, 3vw, 17px);
  }
  .choice .icon {
    font-size: 44px;
  }
  .question-prompt {
    font-size: 18px;
    padding: 7px 16px;
  }
  .card {
    flex-basis: auto;
    width: calc((100% - 14px) / 3);
    padding: 7px;
  }
  .animal-media span {
    font-size: 54px;
  }
}

.card.moving {
  background: transparent;
  box-shadow: none;
  position: relative;
  z-index: 10;
  pointer-events: none;
  will-change: transform;
}
.card.moving .animal-media {
  background: transparent;
}
.choice:disabled { cursor: default; }
.choice-image {
  border-radius: 24px;
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.choice .icon[hidden] { display: none; }

.confetti-layer {
  position: absolute;
  inset: 0;
  z-index: 50;
  overflow: hidden;
  pointer-events: none;
}
.confetti-piece {
  position: absolute;
  top: -20px;
  width: 10px;
  height: 15px;
  animation: confetti-fall 1.2s linear both;
}
@keyframes confetti-fall {
  0% { transform: translate3d(0, 0, 0) rotate(0deg); opacity: 0; }
  10% { opacity: 1; }
  75% { opacity: 1; }
  100% { transform: translate3d(var(--drift), var(--fall), 0) rotate(var(--spin)); opacity: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .confetti-layer { display: none; }
}
