:root {
  --sky-top: #86d9ff;
  --sky-bottom: #fff0a8;
  --grass: #93da72;
  --leaf: #43a856;
  --leaf-dark: #2b7f4c;
  --sun: #ffd85b;
  --cloud: rgba(255, 255, 255, 0.82);
  --card: rgba(255, 255, 255, 0.9);
  --ink: #21405f;
  --muted: #58748f;
  --accent: #ff8d5c;
  --gold: #ffcb4a;
  --green: #3abf63;
  --red: #f05b5b;
  --shadow: 0 24px 60px rgba(33, 64, 95, 0.18);
}

* {
  box-sizing: border-box;
}

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

body {
  font-family: "Nunito", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(255, 255, 255, 0.6), transparent 32%),
    radial-gradient(circle at 80% 18%, rgba(255, 255, 255, 0.55), transparent 20%),
    linear-gradient(180deg, var(--sky-top) 0%, #b8ecff 38%, var(--sky-bottom) 100%);
  overflow: hidden;
}

body::before,
body::after {
  content: "";
  position: fixed;
  left: 0;
  right: 0;
  z-index: 0;
  pointer-events: none;
}

body::before {
  bottom: 0;
  height: 28vh;
  background:
    radial-gradient(circle at 15% 100%, #74c758 0 22%, transparent 23%),
    radial-gradient(circle at 33% 100%, #5fbb56 0 18%, transparent 19%),
    radial-gradient(circle at 52% 100%, #78cf62 0 20%, transparent 21%),
    radial-gradient(circle at 72% 100%, #63bf58 0 19%, transparent 20%),
    radial-gradient(circle at 88% 100%, #7ed26b 0 22%, transparent 23%),
    linear-gradient(0deg, var(--grass), #a7e887);
}

body::after {
  top: 36px;
  left: 48px;
  width: 128px;
  height: 128px;
  border-radius: 50%;
  background:
    radial-gradient(circle, var(--sun) 0 56%, rgba(255, 216, 91, 0.25) 57%, transparent 75%);
  box-shadow: 0 0 70px rgba(255, 216, 91, 0.6);
}

.app-shell {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-rows: auto 1fr auto;
  min-height: 100vh;
  padding: 24px;
  gap: 18px;
}

.top-bar,
.bottom-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.score-actions,
.scoreboard {
  display: flex;
  gap: 12px;
}

.score-btn,
.score-pill,
.difficulty-panel,
.reward-panel,
.card {
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.score-btn {
  width: 72px;
  height: 72px;
  border: none;
  border-radius: 22px;
  color: white;
  font-size: 2rem;
  cursor: pointer;
  box-shadow: var(--shadow);
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.score-btn:hover,
.score-btn:focus-visible {
  transform: translateY(-3px) scale(1.02);
  box-shadow: 0 30px 60px rgba(33, 64, 95, 0.24);
  outline: none;
}

.score-btn.success {
  background: linear-gradient(180deg, #55d46f 0%, #2fa954 100%);
}

.score-btn.error {
  background: linear-gradient(180deg, #ff7b7b 0%, #e24848 100%);
}

.score-pill,
.difficulty-panel,
.reward-panel {
  background: rgba(255, 255, 255, 0.78);
  border: 2px solid rgba(255, 255, 255, 0.45);
  box-shadow: var(--shadow);
}

.score-pill {
  display: grid;
  place-items: center;
  min-width: 116px;
  padding: 12px 18px;
  border-radius: 20px;
}

.score-pill strong {
  font-size: 1.8rem;
  line-height: 1;
}

.session-pill strong {
  font-size: 1.2rem;
}

.score-label,
.card-kicker,
.card-hint,
.panel-subtitle,
.slider-labels {
  color: var(--muted);
}

.stage {
  position: relative;
  display: grid;
  place-items: center;
  cursor: pointer;
}

.card {
  position: relative;
  width: min(900px, 100%);
  min-height: min(62vh, 720px);
  background: var(--card);
  border-radius: 40px;
  padding: 28px;
  box-shadow: var(--shadow);
  border: 3px solid rgba(255, 255, 255, 0.45);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 18px;
  text-align: center;
}

.card::before {
  content: "";
  position: absolute;
  inset: 18px;
  border: 3px dashed rgba(255, 141, 92, 0.3);
  border-radius: 28px;
  pointer-events: none;
}

.card-kicker {
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.92rem;
  font-weight: 800;
}

.card-content {
  position: relative;
  z-index: 1;
  width: 100%;
  min-height: 320px;
  display: grid;
  place-items: center;
}

.word-display {
  font-family: "Baloo 2", cursive;
  font-size: clamp(3.6rem, 10vw, 7.5rem);
  line-height: 0.95;
  color: var(--ink);
  padding: 18px 32px;
  border-radius: 32px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.95), rgba(255, 255, 255, 0.72));
  box-shadow: 0 16px 40px rgba(33, 64, 95, 0.12);
}

.image-card {
  display: grid;
  gap: 16px;
  justify-items: center;
}

.image-frame {
  width: min(460px, 72vw);
  aspect-ratio: 1 / 1;
  padding: 14px;
  border-radius: 36px;
  background: linear-gradient(180deg, #ffffff, #f7fbff);
  box-shadow: 0 18px 40px rgba(33, 64, 95, 0.12);
}

.image-frame img {
  width: 100%;
  height: 100%;
  display: block;
}

.image-instruction {
  margin: 0;
  font-weight: 800;
  font-size: clamp(1.1rem, 2.5vw, 1.5rem);
}

.card-hint {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
}

.sparkles {
  position: absolute;
  width: 140px;
  height: 140px;
  background:
    radial-gradient(circle at 22% 30%, rgba(255, 255, 255, 0.9) 0 4px, transparent 5px),
    radial-gradient(circle at 70% 18%, rgba(255, 203, 74, 0.9) 0 6px, transparent 7px),
    radial-gradient(circle at 76% 72%, rgba(255, 141, 92, 0.8) 0 5px, transparent 6px),
    radial-gradient(circle at 32% 78%, rgba(113, 211, 121, 0.85) 0 7px, transparent 8px);
  opacity: 0.75;
  animation: floaty 5.5s ease-in-out infinite;
}

.sparkles-left {
  top: 60px;
  left: 4vw;
}

.sparkles-right {
  right: 3vw;
  bottom: 16vh;
  animation-delay: -2.2s;
}

.bottom-panel {
  align-items: stretch;
}

.difficulty-panel,
.reward-panel {
  flex: 1;
  border-radius: 28px;
  padding: 18px 22px;
}

.panel-title {
  margin: 0 0 4px;
  font-size: 1.15rem;
  font-weight: 800;
}

.panel-subtitle {
  margin: 0 0 14px;
  font-weight: 700;
}

.difficulty-slider {
  width: 100%;
  accent-color: var(--accent);
}

.slider-labels {
  display: flex;
  justify-content: space-between;
  margin-top: 8px;
  font-size: 0.95rem;
  font-weight: 800;
}

.reward-stars {
  margin: 0 0 10px;
  color: var(--ink);
  font-size: 1.1rem;
  font-weight: 800;
}

.badge-shelf {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  min-height: 42px;
  align-items: center;
}

.reward-badge {
  padding: 8px 12px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-weight: 800;
  font-size: 0.95rem;
  color: var(--ink);
  background: #fff6c9;
  box-shadow: 0 10px 24px rgba(33, 64, 95, 0.14);
}

.practice-tip {
  margin: 12px 0 0;
  color: var(--muted);
  font-weight: 700;
}

.grown-up-controls {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 2px dashed rgba(255, 141, 92, 0.28);
}

.grown-up-controls summary {
  cursor: pointer;
  color: var(--ink);
  font-weight: 700;
}

.grown-up-controls label {
  display: grid;
  gap: 5px;
  margin-top: 12px;
  color: var(--muted);
  font-weight: 800;
}

.grown-up-controls select {
  width: 100%;
  min-height: 42px;
  padding: 8px 10px;
  border: 2px solid rgba(67, 168, 86, 0.25);
  border-radius: 12px;
  background: white;
  color: var(--ink);
  font: inherit;
}

.grown-up-controls .toggle-label {
  display: flex;
  align-items: center;
  gap: 9px;
}

.grown-up-controls input {
  width: 20px;
  height: 20px;
  accent-color: var(--green);
}

.word-help {
  margin: 0;
  color: var(--accent);
  font-size: 1.15rem;
  font-weight: 800;
}

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

.confetti-piece {
  position: absolute;
  top: -24px;
  width: 12px;
  height: 18px;
  border-radius: 4px;
  animation: fall 1.5s ease-in forwards;
}

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

@keyframes fall {
  to {
    transform: translate(var(--drift), 108vh) rotate(520deg);
    opacity: 0;
  }
}

@media (max-width: 820px) {
  body {
    overflow: auto;
  }

  .app-shell {
    padding: 16px;
    gap: 14px;
  }

  .top-bar,
  .bottom-panel {
    flex-direction: column;
    align-items: stretch;
  }

  .score-actions,
  .scoreboard {
    justify-content: center;
  }

  .score-btn {
    width: 64px;
    height: 64px;
  }

  .card {
    min-height: 52vh;
    padding: 22px 18px;
  }

  .word-display {
    font-size: clamp(3rem, 14vw, 5.2rem);
  }

  .image-frame {
    width: min(360px, 80vw);
  }
}

@media (max-width: 480px) {
  body::after {
    top: 8px;
    left: 12px;
    width: 88px;
    height: 88px;
  }

  .top-bar {
    gap: 12px;
  }

  .score-actions,
  .scoreboard {
    width: 100%;
    justify-content: space-between;
  }

  .score-btn {
    width: 68px;
    height: 68px;
    border-radius: 20px;
  }

  .score-pill {
    min-width: 0;
    flex: 1;
    padding: 10px 12px;
  }

  .card {
    min-height: 46vh;
    border-radius: 28px;
  }

  .card-content {
    min-height: 240px;
  }

  .image-frame {
    width: min(300px, 78vw);
    border-radius: 28px;
  }

  .difficulty-panel,
  .reward-panel {
    border-radius: 22px;
    padding: 16px;
  }
}
