:root {
  --sky: #7ec8ff;
  --mint: #7ce0b8;
  --sun: #ffd166;
  --coral: #ff6b6b;
  --grape: #7b6cff;
  --ink: #1d2a44;
  --paper: #fffdf8;
  --shadow: 0 12px 0 rgba(29, 42, 68, 0.12);
  --radius: 28px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  min-height: 100dvh;
  font-family: "Nunito", system-ui, sans-serif;
  color: var(--ink);
  background: linear-gradient(165deg, #8fd3ff 0%, #b8f0d8 55%, #ffe9a8 100%);
  display: grid;
  place-items: center;
  padding: 16px;
  overflow-x: hidden;
}

.bg {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
}

.blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(2px);
  opacity: 0.35;
}

.b1 {
  width: 220px;
  height: 220px;
  background: #fff;
  top: -40px;
  left: -40px;
}

.b2 {
  width: 160px;
  height: 160px;
  background: #ff8fab;
  bottom: 8%;
  right: -30px;
}

.b3 {
  width: 120px;
  height: 120px;
  background: #ffd166;
  top: 30%;
  left: 8%;
}

.app {
  position: relative;
  z-index: 1;
  width: min(560px, 100%);
  min-height: min(720px, calc(100dvh - 32px));
  background: var(--paper);
  border-radius: 36px;
  box-shadow: var(--shadow), 0 0 0 6px rgba(255, 255, 255, 0.35);
  padding: 28px 22px 32px;
  display: flex;
  flex-direction: column;
}

.screen {
  display: none;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 16px;
}

.screen.is-active {
  display: flex;
  flex: 1;
  animation: pop 0.35s ease;
}

#screen-play.is-active {
  align-items: stretch;
  justify-content: flex-start;
  gap: 14px;
  min-height: 100%;
}

h1,
h2,
.countdown,
.question {
  font-family: "Fredoka", "Nunito", sans-serif;
  margin: 0;
}

h1 {
  font-size: clamp(2.4rem, 8vw, 3.4rem);
  letter-spacing: -0.03em;
}

h2 {
  font-size: 2rem;
}

.badge {
  margin: 8px 0 0;
  background: #ffe08a;
  border-radius: 999px;
  padding: 6px 14px;
  font-weight: 800;
  font-size: 0.9rem;
}

.lead {
  margin: 0;
  max-width: 34ch;
  font-size: 1.1rem;
  line-height: 1.4;
}

.ops {
  border: 0;
  padding: 0;
  margin: 8px 0 0;
  width: 100%;
  display: grid;
  gap: 10px;
}

.ops legend {
  font-weight: 800;
  margin-bottom: 8px;
}

.chip {
  display: block;
  cursor: pointer;
}

.chip input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.chip span {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 18px;
  border-radius: 18px;
  background: #eef3ff;
  font-weight: 800;
  box-shadow: 0 4px 0 #c9d4f5;
  transition: transform 0.12s ease, background 0.12s ease;
}

.chip input:checked + span {
  background: #d8ffe8;
  box-shadow: 0 4px 0 #7ed9a8;
}

.chip input:focus-visible + span {
  outline: 3px solid var(--grape);
  outline-offset: 3px;
}

.chip:active span {
  transform: translateY(3px);
  box-shadow: 0 1px 0 #c9d4f5;
}

.best {
  margin: 4px 0 0;
  font-weight: 800;
  opacity: 0.8;
}

.btn {
  appearance: none;
  border: 0;
  cursor: pointer;
  font: inherit;
  font-weight: 800;
  border-radius: 20px;
  padding: 16px 28px;
  min-width: 200px;
}

.btn-play {
  background: var(--grape);
  color: white;
  box-shadow: 0 6px 0 #5348c4;
  font-size: 1.25rem;
}

.btn-play:hover {
  transform: translateY(-1px);
}

.btn-play:active {
  transform: translateY(4px);
  box-shadow: 0 2px 0 #5348c4;
}

.btn-ghost {
  background: #eef3ff;
  color: var(--ink);
  box-shadow: 0 4px 0 #c9d4f5;
}

.countdown {
  font-size: 8rem;
  line-height: 1;
  color: var(--grape);
  align-self: center;
  margin: auto;
}

.hud {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.lives {
  display: flex;
  gap: 6px;
  font-size: 1.8rem;
  letter-spacing: 2px;
}

.heart {
  display: inline-block;
  transition: transform 0.2s ease, opacity 0.2s ease, filter 0.2s ease;
}

.heart.is-lost {
  opacity: 0.25;
  filter: grayscale(1);
  transform: scale(0.85);
}

.score-wrap {
  background: #fff3c4;
  border-radius: 16px;
  padding: 8px 14px;
  min-width: 88px;
}

.score-label {
  display: block;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

#score {
  font-family: "Fredoka", sans-serif;
  font-size: 1.6rem;
}

.timer-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.timer {
  flex: 1;
  height: 16px;
  background: #ece7dc;
  border-radius: 999px;
  overflow: hidden;
}

.timer-sec {
  min-width: 2.6em;
  font-family: "Fredoka", sans-serif;
  font-weight: 700;
  font-size: 1.1rem;
}

.timer-bar {
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, #7ce0b8, #ffd166);
  transform-origin: left center;
  transform: scaleX(1);
}

.timer-bar.is-low {
  background: linear-gradient(90deg, #ffd166, #ff6b6b);
}

.question {
  font-size: clamp(3rem, 12vw, 4.4rem);
  margin: 8px 0 0;
  letter-spacing: -0.04em;
}

.hint {
  min-height: 1.4em;
  margin: 0;
  font-weight: 800;
}

.hint.is-ok {
  color: #178a4e;
}

.hint.is-ko {
  color: #c23b3b;
}

.answers {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-top: auto;
}

.answer {
  appearance: none;
  border: 0;
  font-family: "Fredoka", sans-serif;
  font-size: 2rem;
  font-weight: 700;
  padding: 22px 10px;
  border-radius: 22px;
  color: var(--ink);
  cursor: pointer;
  box-shadow: 0 6px 0 rgba(29, 42, 68, 0.16);
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.answer:nth-child(1) { background: #c9f4e4; }
.answer:nth-child(2) { background: #ffe08a; }
.answer:nth-child(3) { background: #c9dcff; }
.answer:nth-child(4) { background: #ffc9d8; }
.answer:nth-child(5) { background: #e4d4ff; }
.answer:nth-child(6) { background: #d4f5a8; }

.answer:active:not(:disabled) {
  transform: translateY(4px);
  box-shadow: 0 2px 0 rgba(29, 42, 68, 0.16);
}

.answer:disabled {
  cursor: default;
}

.answer.is-correct {
  background: #5ee0a0;
  transform: scale(1.04);
}

.answer.is-wrong {
  background: #ff8a8a;
  animation: shake 0.35s ease;
}

.over-emoji {
  font-size: 4rem;
  margin: 24px 0 0;
}

.over-score {
  font-size: 1.4rem;
  margin: 0;
}

@keyframes pop {
  from {
    opacity: 0;
    transform: scale(0.96) translateY(8px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

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

@media (max-width: 420px) {
  .app {
    padding: 22px 16px 26px;
    border-radius: 28px;
  }

  .answer {
    font-size: 1.7rem;
    padding: 18px 8px;
  }
}
