:root {
  --bg-top: #f8f9d2;
  --bg-bottom: #c4f0f8;
  --ink: #1f3552;
  --card: #ffffffee;
  --line: #95b6c8;
  --accent: #ff7a3d;
  --accent-2: #1fbf75;
  --accent-3: #ffd447;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Nunito", "Trebuchet MS", sans-serif;
  color: var(--ink);
  background: linear-gradient(160deg, var(--bg-top), var(--bg-bottom));
  overflow-x: hidden;
}

.bg-shape {
  position: fixed;
  border-radius: 999px;
  filter: blur(2px);
  opacity: 0.7;
  z-index: 0;
  pointer-events: none;
}

.bg-shape-a {
  width: 350px;
  height: 350px;
  left: -90px;
  top: -80px;
  background: radial-gradient(circle at 30% 30%, #ffd447, #ff9f43);
}

.bg-shape-b {
  width: 420px;
  height: 420px;
  right: -140px;
  bottom: -160px;
  background: radial-gradient(circle at 40% 40%, #7ee0a4, #25b4ce);
}

.page {
  width: min(960px, 92vw);
  margin: 0 auto;
  padding: 2rem 0 3rem;
  position: relative;
  z-index: 1;
}

.hero {
  text-align: center;
  margin-bottom: 1.3rem;
}

.hero-tag {
  display: inline-block;
  padding: 0.35rem 0.9rem;
  border-radius: 999px;
  background: #ffffffcc;
  font-weight: 800;
  font-size: 0.95rem;
  color: #0f6a85;
}

h1,
h2 {
  font-family: "Baloo 2", "Comic Sans MS", cursive;
  margin: 0.4rem 0;
  line-height: 1.06;
}

h1 {
  font-size: clamp(2.2rem, 6.3vw, 4.1rem);
  letter-spacing: 0.6px;
}

.hero-subtitle {
  width: min(680px, 100%);
  margin: 0.4rem auto 0;
  font-size: clamp(1rem, 2.3vw, 1.25rem);
}

.card {
  background: var(--card);
  border: 2px solid #ffffff;
  border-radius: 24px;
  margin-top: 1.2rem;
  box-shadow: 0 14px 28px #2a4f5f20;
  padding: 1rem;
}

.card-head p {
  margin-top: 0.2rem;
}

.focus-nav {
  display: grid;
  grid-template-columns: repeat(5, minmax(120px, 1fr));
  gap: 0.55rem;
  margin-bottom: 0.8rem;
}

.focus-tab {
  border: 2px solid transparent;
}

.focus-tab.is-active {
  background: linear-gradient(140deg, #fff7d0, #ffe9a4);
  border-color: #ffd447;
}

.screen {
  display: none;
}

.screen.is-active {
  display: block;
}

.controls {
  display: grid;
  grid-template-columns: repeat(3, minmax(100px, 1fr));
  gap: 0.6rem;
  align-items: center;
}

.controls label {
  font-weight: 800;
}

select,
textarea,
input[type="range"] {
  width: 100%;
  border: 2px solid #dce7ec;
  border-radius: 12px;
  padding: 0.5rem;
  font-family: inherit;
  font-size: 1rem;
}

input[type="text"] {
  width: 100%;
  border: 2px solid #dce7ec;
  border-radius: 12px;
  padding: 0.5rem;
  font-family: inherit;
  font-size: 1rem;
}

textarea {
  resize: vertical;
  min-height: 110px;
  background-image: linear-gradient(to bottom, transparent 1.95rem, #b9d6e3 2rem);
  background-size: 100% 2rem;
  line-height: 2rem;
}

.btn {
  border: 0;
  border-radius: 12px;
  font-size: 1rem;
  font-weight: 800;
  padding: 0.6rem 0.9rem;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

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

.btn:active {
  transform: translateY(0);
}

.btn-primary {
  color: #fff;
  background: linear-gradient(140deg, #ff7a3d, #ff4b2b);
  box-shadow: 0 8px 15px #ff5e2a45;
}

.btn-light {
  color: #073146;
  background: linear-gradient(140deg, #dff6ff, #b0e4ff);
}

.canvas-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  margin-top: 0.9rem;
  border-radius: 18px;
  border: 2px dashed var(--line);
  background: #fff;
  overflow: hidden;
}

#guideCanvas,
#drawCanvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

#drawCanvas {
  touch-action: none;
}

.feedback {
  margin-top: 0.75rem;
  font-weight: 700;
  min-height: 1.4rem;
}

.reward-burst {
  position: fixed;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 20;
}

.reward-star {
  position: absolute;
  width: 16px;
  height: 16px;
  border-radius: 3px;
  transform: rotate(45deg);
  opacity: 0.95;
  animation: star-fall 900ms ease-out forwards;
}

@keyframes star-fall {
  0% {
    transform: translate(0, 0) scale(1) rotate(20deg);
    opacity: 0.95;
  }
  100% {
    transform: translate(var(--tx), var(--ty)) scale(0.2) rotate(240deg);
    opacity: 0;
  }
}

.progress-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(140px, 1fr));
  gap: 0.6rem;
  align-items: center;
}

.progress-grid label {
  font-weight: 800;
}

.badge-row {
  margin-top: 0.8rem;
  display: grid;
  gap: 0.6rem;
  grid-template-columns: repeat(3, minmax(90px, 1fr));
}

.badge-item {
  text-align: center;
  background: linear-gradient(160deg, #fff9d5, #fff2a8);
  border: 2px solid #ffe57a;
  border-radius: 14px;
  padding: 0.5rem;
}

.badge-item span {
  display: block;
  font-size: 0.9rem;
  font-weight: 800;
}

.badge-item strong {
  display: block;
  font-family: "Baloo 2", "Comic Sans MS", cursive;
  font-size: clamp(1.2rem, 3vw, 1.7rem);
  line-height: 1;
}

.word-box {
  margin-top: 0.3rem;
  background: linear-gradient(160deg, #fff7d0, #fff1a2);
  border-radius: 15px;
  border: 2px solid #ffe57a;
  padding: 0.65rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.8rem;
}

.word-label {
  font-weight: 800;
}

#wordTarget {
  font-family: "Baloo 2", "Comic Sans MS", cursive;
  letter-spacing: 2px;
  font-size: clamp(1.8rem, 6vw, 2.4rem);
}

.word-actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(140px, 1fr));
  gap: 0.6rem;
  margin-top: 0.8rem;
}

.report-grid {
  display: grid;
  gap: 0.6rem;
  grid-template-columns: repeat(3, minmax(150px, 1fr));
}

.report-item {
  background: linear-gradient(160deg, #e9fbff, #cbf5ff);
  border: 2px solid #9be8f8;
  border-radius: 14px;
  padding: 0.7rem;
}

.report-item h3 {
  margin: 0;
  font-family: "Baloo 2", "Comic Sans MS", cursive;
  font-size: 1.2rem;
}

.report-item p {
  margin: 0.2rem 0 0;
  font-weight: 800;
}

.next-area {
  margin-top: 0.9rem;
  display: flex;
  justify-content: flex-end;
}

.textarea-label {
  display: inline-block;
  margin-top: 0.9rem;
  font-weight: 800;
}

.reveal {
  opacity: 0;
  transform: translateY(14px) scale(0.985);
  animation: rise 0.6s ease forwards;
}

.reveal:nth-of-type(2) {
  animation-delay: 0.12s;
}

.reveal:nth-of-type(3) {
  animation-delay: 0.22s;
}

.reveal:nth-of-type(4) {
  animation-delay: 0.3s;
}

.reveal:nth-of-type(5) {
  animation-delay: 0.38s;
}

.reveal:nth-of-type(6) {
  animation-delay: 0.44s;
}

@keyframes rise {
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@media (max-width: 700px) {
  .controls,
  .focus-nav,
  .progress-grid,
  .badge-row,
  .word-actions,
  .report-grid {
    grid-template-columns: 1fr;
  }

  .next-area {
    justify-content: stretch;
  }

  .page {
    padding-top: 1.5rem;
  }
}
