:root {
  --sky: #7ad7ff;
  --sun: #ffe27a;
  --mint: #8cf5c2;
  --bubblegum: #ff86b8;
  --berry: #ff5c7a;
  --grape: #6d63ff;
  --ink: #26415f;
  --card: rgba(255, 255, 255, 0.92);
  --shadow: 0 20px 50px rgba(64, 62, 146, 0.18);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Trebuchet MS", "Lucida Sans Unicode", "Gill Sans", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(255, 255, 255, 0.8), transparent 28%),
    radial-gradient(circle at bottom right, rgba(255, 255, 255, 0.7), transparent 30%),
    linear-gradient(180deg, #89e2ff 0%, #8ce8db 42%, #ffe291 100%);
  overflow-x: hidden;
}

.background-bubbles span {
  position: fixed;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.25);
  animation: float 12s ease-in-out infinite;
  z-index: 0;
}

.background-bubbles span:nth-child(1) {
  width: 160px;
  height: 160px;
  top: 8%;
  left: 4%;
}

.background-bubbles span:nth-child(2) {
  width: 100px;
  height: 100px;
  top: 68%;
  left: 8%;
  animation-delay: -3s;
}

.background-bubbles span:nth-child(3) {
  width: 180px;
  height: 180px;
  top: 12%;
  right: 6%;
  animation-delay: -6s;
}

.background-bubbles span:nth-child(4) {
  width: 120px;
  height: 120px;
  bottom: 14%;
  right: 20%;
  animation-delay: -2s;
}

.background-bubbles span:nth-child(5) {
  width: 72px;
  height: 72px;
  top: 48%;
  right: 10%;
  animation-delay: -8s;
}

.background-bubbles span:nth-child(6) {
  width: 64px;
  height: 64px;
  bottom: 6%;
  left: 44%;
  animation-delay: -5s;
}

.game-shell {
  position: relative;
  z-index: 1;
  width: min(1100px, calc(100% - 32px));
  margin: 0 auto;
  padding: 24px 0 40px;
}

.top-bar,
.hero-card,
.play-area {
  display: grid;
  gap: 20px;
}

.top-bar {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: center;
}

.brand {
  display: flex;
  align-items: center;
  gap: 16px;
}

.brand-badge {
  width: 82px;
  height: 82px;
  display: grid;
  place-items: center;
  border-radius: 28px;
  background: linear-gradient(135deg, var(--berry), var(--bubblegum));
  color: white;
  font-family: "Comic Sans MS", "Trebuchet MS", "Arial Rounded MT Bold", sans-serif;
  font-size: 2rem;
  font-weight: 800;
  box-shadow: var(--shadow);
}

.eyebrow,
.hero-tag,
.score-label {
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.78rem;
}

h1,
h2,
h3,
.puzzle-display,
.letter-input {
  font-family: "Comic Sans MS", "Trebuchet MS", "Arial Rounded MT Bold", sans-serif;
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1 {
  font-size: clamp(2rem, 4vw, 3rem);
  line-height: 0.95;
}

.scoreboard {
  display: flex;
  justify-content: end;
  gap: 16px;
}

.score-card,
.hero-card,
.puzzle-card,
.helper-card {
  background: var(--card);
  border: 3px solid rgba(255, 255, 255, 0.7);
  border-radius: 28px;
  box-shadow: var(--shadow);
}

.score-card {
  min-width: 110px;
  padding: 14px 18px;
  text-align: center;
}

.score-card strong {
  display: block;
  font-size: 2rem;
  color: var(--grape);
}

.hero-card {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  padding: 22px 24px;
  margin-top: 18px;
}

.hero-text {
  margin-top: 8px;
  font-size: 1.05rem;
}

.play-area {
  grid-template-columns: minmax(0, 2fr) minmax(260px, 1fr);
  margin-top: 22px;
}

.puzzle-card,
.helper-card {
  padding: 24px;
}

.round-header,
.mini-stats {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 12px;
}

.mode-badge,
.timer-text {
  padding: 8px 14px;
  border-radius: 999px;
  background: #eef8ff;
  font-weight: 600;
}

.timer-text {
  background: #fff7cf;
}

.image-stage {
  margin-top: 18px;
  background: linear-gradient(180deg, #dbf8ff 0%, #eefdf4 100%);
  border-radius: 24px;
  min-height: 190px;
  display: grid;
  place-items: center;
  overflow: hidden;
}

.hidden {
  display: none;
}

#pictureSvg {
  width: min(100%, 320px);
  height: auto;
}

.prompt-wrap {
  text-align: center;
  margin-top: 20px;
}

.instruction-text {
  font-size: 1.1rem;
  font-weight: 600;
}

.puzzle-display {
  margin-top: 12px;
  font-size: clamp(2.4rem, 7vw, 4.6rem);
  letter-spacing: 0.14em;
  color: #22324a;
}

.answer-ghost {
  min-height: 30px;
  margin-top: 10px;
  font-size: 1.5rem;
  letter-spacing: 0.18em;
  color: rgba(38, 65, 95, 0.16);
  transition: opacity 1s ease;
}

.answer-form {
  margin-top: 18px;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: end;
  justify-content: center;
}

.answer-label {
  width: 100%;
  text-align: center;
  font-weight: 600;
}

.letter-input {
  width: 120px;
  height: 84px;
  border-radius: 24px;
  border: 4px solid #ffd364;
  text-align: center;
  font-size: 2.8rem;
  color: var(--grape);
  background: white;
  outline: none;
}

.letter-input:focus {
  border-color: var(--bubblegum);
  transform: translateY(-1px);
}

.primary-button,
.secondary-button {
  border: 0;
  border-radius: 999px;
  padding: 16px 22px;
  font-family: "Trebuchet MS", "Lucida Sans Unicode", "Gill Sans", sans-serif;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.primary-button {
  background: linear-gradient(135deg, #ff9366, #ff5c7a);
  color: white;
  box-shadow: 0 14px 24px rgba(255, 92, 122, 0.24);
}

.secondary-button {
  background: linear-gradient(135deg, #7edcff, #5df0b1);
  color: #144253;
  box-shadow: 0 14px 24px rgba(83, 220, 194, 0.24);
}

.primary-button:hover,
.secondary-button:hover,
.primary-button:focus-visible,
.secondary-button:focus-visible {
  transform: translateY(-2px) scale(1.01);
}

.feedback-text {
  margin-top: 18px;
  text-align: center;
  font-size: 1.15rem;
  font-weight: 600;
  min-height: 28px;
}

.feedback-text.success {
  color: #1f9e61;
}

.feedback-text.error {
  color: #d94163;
}

.feedback-text.hint {
  color: #7159df;
}

.mini-stats {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 2px dashed rgba(38, 65, 95, 0.18);
  font-size: 0.98rem;
}

.helper-card h3 {
  font-size: 1.8rem;
}

.helper-card ul {
  margin: 14px 0 0;
  padding-left: 20px;
  display: grid;
  gap: 10px;
}

.fireworks {
  pointer-events: none;
  position: fixed;
  inset: 0;
  overflow: hidden;
  z-index: 3;
}

.burst {
  position: absolute;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  animation: pop 900ms ease-out forwards;
}

@keyframes float {
  0%,
  100% {
    transform: translateY(0px);
  }
  50% {
    transform: translateY(-18px);
  }
}

@keyframes pop {
  0% {
    transform: translate(0, 0) scale(0.1);
    opacity: 1;
  }
  100% {
    transform: translate(var(--x), var(--y)) scale(1.4);
    opacity: 0;
  }
}

@media (max-width: 820px) {
  .top-bar,
  .hero-card,
  .play-area {
    grid-template-columns: 1fr;
  }

  .scoreboard {
    justify-content: start;
  }

  .hero-card {
    justify-items: start;
  }

  .answer-form {
    justify-content: center;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
