:root {
  --bg-gradient: linear-gradient(135deg, #fcd34d, #fca5a5, #c4b5fd, #7dd3fc);
  --surface: rgba(255, 255, 255, 0.85);
  --text-primary: #1f2937;
  --text-secondary: #4b5563;
  --accent: #f97316;
  --accent-dark: #ea580c;
  --pill-bg: rgba(255, 255, 255, 0.6);
  --card-shadow: 0 20px 45px rgba(15, 23, 42, 0.18);
  --radius-lg: 28px;
  --radius-md: 18px;
  --radius-sm: 12px;
  font-family: "Nunito", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text-primary);
  background: #f1f5f9;
  overflow-x: hidden;
}

.gradient-backdrop {
  position: fixed;
  inset: 0;
  background: var(--bg-gradient);
  background-size: 300% 300%;
  animation: shimmer 20s ease infinite;
  z-index: -2;
}

@keyframes shimmer {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

.app {
  max-width: 1100px;
  margin: 0 auto;
  padding: 24px clamp(18px, 4vw, 48px) 64px;
  position: relative;
}

.top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 24px;
  background: var(--surface);
  backdrop-filter: blur(12px);
  padding: 24px clamp(18px, 4vw, 48px);
  border-radius: var(--radius-lg);
  box-shadow: var(--card-shadow);
}

.logo {
  display: flex;
  align-items: center;
  gap: 18px;
}

.logo-icon {
  font-size: clamp(40px, 5vw, 56px);
  filter: drop-shadow(0 10px 18px rgba(15, 23, 42, 0.2));
}

h1 {
  font-family: "Baloo 2", cursive;
  font-size: clamp(28px, 4vw, 40px);
  margin: 0;
}

.version {
  color: var(--accent);
}

.tagline {
  font-size: clamp(14px, 2.2vw, 18px);
  margin: 2px 0 0;
  color: var(--text-secondary);
}

.quick-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.icon-button {
  border: none;
  background: var(--pill-bg);
  padding: 12px 16px;
  border-radius: 999px;
  font-size: 20px;
  cursor: pointer;
  transition: transform 0.2s ease, background 0.2s ease;
}

.icon-button[aria-pressed="false"] {
  opacity: 0.5;
}

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

.pill, .primary, .ghost {
  font-family: "Baloo 2", cursive;
  border: none;
  border-radius: 999px;
  padding: 12px 24px;
  cursor: pointer;
  font-size: 16px;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.primary {
  background: var(--accent);
  color: white;
  box-shadow: 0 16px 32px rgba(249, 115, 22, 0.3);
}

.primary:hover {
  transform: translateY(-2px);
  background: var(--accent-dark);
}

.pill {
  background: rgba(15, 23, 42, 0.1);
  color: var(--text-primary);
}

.pill:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 20px rgba(15, 23, 42, 0.12);
}

.ghost {
  background: rgba(255, 255, 255, 0.5);
  color: var(--text-secondary);
  border: 1px solid rgba(15, 23, 42, 0.1);
}

.screen {
  margin-top: 32px;
  display: none;
  background: var(--surface);
  backdrop-filter: blur(10px);
  padding: clamp(24px, 4vw, 40px);
  border-radius: var(--radius-lg);
  box-shadow: var(--card-shadow);
}

.screen.active {
  display: block;
  animation: fadeIn 0.4s ease;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

.hero {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: clamp(24px, 5vw, 48px);
  align-items: center;
}

.mascot {
  position: relative;
  width: clamp(240px, 40vw, 320px);
  aspect-ratio: 1 / 1;
  margin-inline: auto;
}

.mascot-shadow {
  position: absolute;
  bottom: 8%;
  left: 50%;
  transform: translateX(-50%);
  width: 70%;
  height: 18%;
  background: radial-gradient(circle at 50% 50%, rgba(15, 23, 42, 0.35), rgba(15, 23, 42, 0));
  filter: blur(8px);
  opacity: 0.55;
  z-index: 0;
}

.mascot-tail {
  position: absolute;
  right: 0;
  top: 34%;
  width: 52%;
  height: 52%;
  border-radius: 60% 40% 55% 45% / 50% 55% 45% 50%;
  background: radial-gradient(circle at 35% 35%, #d9f99d 0%, #4ade80 45%, #16a34a 85%);
  box-shadow: 0 18px 28px rgba(14, 116, 144, 0.22);
  transform-origin: left center;
  animation: tailSwing 5.5s ease-in-out infinite;
  z-index: 1;
}

.mascot-tail::before {
  content: '';
  position: absolute;
  bottom: -10%;
  right: -6%;
  width: 44%;
  height: 44%;
  border-radius: 50%;
  border: 6px solid rgba(255, 255, 255, 0.35);
  border-left-color: transparent;
  border-bottom-color: transparent;
  transform: rotate(24deg);
}

.mascot-tail::after {
  content: '';
  position: absolute;
  inset: 18% 22% 24% 22%;
  border-radius: 50%;
  background: radial-gradient(circle at 40% 30%, rgba(255, 255, 255, 0.6), rgba(255, 255, 255, 0));
  opacity: 0.7;
}

.mascot-body {
  position: absolute;
  top: 24%;
  left: 20%;
  width: 58%;
  height: 52%;
  border-radius: 58% 42% 48% 52% / 55% 48% 52% 45%;
  background: radial-gradient(circle at 36% 30%, #d9f99d 0%, #86efac 42%, #22c55e 78%, #166534 100%);
  animation: wave 4s ease-in-out infinite;
  box-shadow: 0 25px 35px rgba(14, 116, 144, 0.25);
  overflow: hidden;
  z-index: 2;
}

.mascot-body::after {
  content: '';
  position: absolute;
  inset: 16% 18% 20% 32%;
  border-radius: 60% 45% 55% 50%;
  background: radial-gradient(circle at 50% 25%, rgba(255, 255, 255, 0.9), rgba(255, 255, 255, 0));
  opacity: 0.85;
}

.mascot-belly {
  position: absolute;
  inset: 32% 24% 20% 36%;
  border-radius: 55% 50% 50% 45%;
  background: radial-gradient(circle at 48% 22%, rgba(255, 255, 255, 0.95), rgba(255, 255, 255, 0));
  filter: saturate(120%);
}

.mascot-spot {
  position: absolute;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, rgba(163, 230, 53, 0.9), rgba(21, 128, 61, 0.85));
  opacity: 0.75;
}

.spot-1 {
  width: 26%;
  height: 26%;
  top: 18%;
  left: 16%;
}

.spot-2 {
  width: 20%;
  height: 20%;
  bottom: 24%;
  right: 14%;
}

.spot-3 {
  width: 18%;
  height: 18%;
  top: 46%;
  right: 24%;
}

@keyframes wave {
  0%, 100% { transform: rotate(-2deg) translateY(0); }
  50% { transform: rotate(4deg) translateY(-6px); }
}

@keyframes tailSwing {
  0%, 100% { transform: rotate(26deg) scale(1); }
  50% { transform: rotate(36deg) scale(1.05); }
}

.mascot-head {
  position: absolute;
  top: 12%;
  left: 2%;
  width: 42%;
  height: 42%;
  border-radius: 58% 42% 50% 60% / 50% 40% 60% 50%;
  background: radial-gradient(circle at 38% 32%, #ecfccb, #4ade80 70%, #16a34a 100%);
  box-shadow: 0 18px 26px rgba(14, 116, 144, 0.22);
  transform: rotate(-8deg);
  z-index: 3;
}

.mascot-head::before {
  content: '';
  position: absolute;
  top: -18%;
  left: 24%;
  width: 58%;
  height: 34%;
  border-radius: 60% 60% 0 0;
  background: linear-gradient(135deg, rgba(190, 242, 100, 0.95), rgba(34, 197, 94, 0.55));
  transform: rotate(-10deg);
  box-shadow: 0 8px 12px rgba(34, 197, 94, 0.25);
}

.mascot-head::after {
  content: '';
  position: absolute;
  bottom: 18%;
  left: 20%;
  width: 32%;
  height: 28%;
  border-radius: 50%;
  background: radial-gradient(circle at 50% 50%, rgba(253, 224, 71, 0.4), rgba(253, 224, 71, 0));
}

.mascot-eye {
  position: absolute;
  width: 34%;
  height: 34%;
  top: 32%;
  right: 20%;
  background: #f8fafc;
  border-radius: 50%;
  box-shadow: inset -2px -2px 0 rgba(14, 116, 144, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.mascot-eye::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: linear-gradient(180deg, rgba(16, 185, 129, 0.9), rgba(21, 128, 61, 0.6));
  transform-origin: top center;
  transform: scaleY(0);
  animation: blink 6.2s ease-in-out infinite;
}

.mascot-eye-inner {
  position: relative;
  width: 46%;
  height: 46%;
  border-radius: 50%;
  background: radial-gradient(circle at 40% 30%, #0f172a, #14532d 65%);
  animation: lookAround 7s ease-in-out infinite;
  z-index: 1;
}

.mascot-eye-inner::after {
  content: '';
  position: absolute;
  top: 22%;
  left: 28%;
  width: 28%;
  height: 28%;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.8);
}

@keyframes blink {
  0%, 46%, 48%, 100% { transform: scaleY(0); }
  47% { transform: scaleY(1); }
}

@keyframes lookAround {
  0%, 18%, 100% { transform: translate(0, 0); }
  28%, 34% { transform: translate(-2px, 1px); }
  46%, 54% { transform: translate(2px, -1px); }
  68%, 76% { transform: translate(1px, 2px); }
}

.mascot-mouth {
  position: absolute;
  bottom: 24%;
  right: 22%;
  width: 32%;
  height: 20%;
  border-bottom: 3px solid #166534;
  border-radius: 0 0 50% 50%;
  transform: rotate(6deg);
}

.mascot-mouth::after {
  content: '';
  position: absolute;
  right: 12%;
  top: 16%;
  width: 40%;
  height: 30%;
  border-radius: 50%;
  background: radial-gradient(circle at 50% 20%, rgba(255, 255, 255, 0.65), rgba(255, 255, 255, 0));
}

.mascot-leg {
  position: absolute;
  bottom: 14%;
  width: 22%;
  height: 30%;
  border-radius: 60% 40% 35% 35%;
  background: linear-gradient(180deg, #22c55e 0%, #15803d 100%);
  box-shadow: 0 12px 18px rgba(14, 116, 144, 0.2);
}

.mascot-leg::after {
  content: '';
  position: absolute;
  bottom: -10%;
  left: 12%;
  width: 76%;
  height: 32%;
  border-radius: 50% 50% 45% 45%;
  background: radial-gradient(circle at 40% 40%, #fef3c7, #f59e0b 80%);
  box-shadow: 0 6px 10px rgba(217, 119, 6, 0.25);
}

.mascot-leg.back {
  left: 50%;
  transform: scaleX(-1) rotate(8deg);
  opacity: 0.85;
  z-index: 1;
}

.mascot-leg.front {
  left: 28%;
  transform: rotate(4deg);
  z-index: 4;
}

.mascot-brush {
  position: absolute;
  bottom: 12%;
  right: -4%;
  width: 44%;
  height: 15%;
  background: linear-gradient(90deg, #92400e 0%, #f97316 100%);
  border-radius: 22px;
  transform: rotate(14deg);
  box-shadow: 0 12px 18px rgba(124, 45, 18, 0.28);
  z-index: 5;
}

.mascot-brush::before {
  content: '';
  position: absolute;
  left: -12%;
  top: 32%;
  width: 24%;
  height: 48%;
  border-radius: 12px;
  background: linear-gradient(180deg, #78350f, #451a03);
}

.mascot-brush::after {
  content: '';
  position: absolute;
  right: -16%;
  top: -28%;
  width: 32%;
  height: 168%;
  border-radius: 12px;
  background: linear-gradient(180deg, #fde68a 0%, #f59e0b 45%, #d97706 100%);
  transform: rotate(-6deg);
  box-shadow: 0 8px 14px rgba(217, 119, 6, 0.26);
}

.hero-copy h2 {
  font-family: "Baloo 2", cursive;
  font-size: clamp(28px, 4vw, 36px);
  margin: 0 0 12px;
}

.hero-copy p {
  margin: 0 0 18px;
  color: var(--text-secondary);
  font-size: clamp(16px, 2.3vw, 18px);
}

.name-entry {
  display: block;
  margin-bottom: 8px;
  font-weight: 600;
}

.name-form {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

input[type="text"] {
  flex: 1 1 180px;
  padding: 12px 18px;
  border-radius: var(--radius-sm);
  border: 2px solid rgba(15, 23, 42, 0.1);
  font-size: 16px;
  font-family: inherit;
}

input[type="text"]:focus {
  outline: 3px solid rgba(249, 115, 22, 0.35);
}

.map-intro {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  flex-wrap: wrap;
}

.map-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 20px;
  margin: 28px 0;
}

.map-tile {
  list-style: none;
  padding: 22px;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.75);
  border: 2px solid transparent;
  box-shadow: 0 18px 30px rgba(30, 41, 59, 0.15);
  position: relative;
  overflow: hidden;
  display: grid;
  gap: 12px;
  transition: transform 0.2s ease, border 0.2s ease;
}

.map-tile::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at top, rgba(255, 255, 255, 0.6), transparent 60%);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.map-tile:hover {
  transform: translateY(-6px);
  border-color: rgba(249, 115, 22, 0.4);
}

.map-tile:hover::after {
  opacity: 1;
}

.map-tile.locked {
  filter: grayscale(0.8);
  opacity: 0.6;
  pointer-events: none;
}

.tile-icon {
  font-size: 36px;
}

.tile-progress {
  display: flex;
  gap: 8px;
  align-items: center;
  font-weight: 600;
}

.tile-action {
  justify-self: start;
}

.map-footer {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: space-between;
}

.game-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 24px;
}

.game-title h2 {
  font-family: "Baloo 2", cursive;
  font-size: clamp(24px, 3vw, 32px);
  margin: 0;
}

.subtitle {
  margin: 4px 0 0;
  color: var(--text-secondary);
  font-size: 15px;
}

.game-stats {
  display: flex;
  gap: 12px;
  align-items: center;
}

.stat-pill {
  background: rgba(15, 23, 42, 0.08);
  padding: 10px 16px;
  border-radius: 999px;
  font-weight: 700;
}

.instructions {
  background: rgba(255, 255, 255, 0.85);
  padding: 16px 20px;
  border-radius: var(--radius-md);
  border: 1px solid rgba(15, 23, 42, 0.08);
  margin-bottom: 20px;
  line-height: 1.5;
}

.game-area {
  display: grid;
  gap: 16px;
  margin-bottom: 24px;
}

.color-grid {
  display: grid;
  gap: 16px;
}

.color-card {
  border-radius: var(--radius-md);
  padding: 18px;
  display: grid;
  gap: 12px;
  text-align: center;
  position: relative;
  cursor: pointer;
  border: 3px solid transparent;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border 0.2s ease;
  min-height: 160px;
  box-shadow: 0 16px 24px rgba(15, 23, 42, 0.12);
}

.color-card .swatch {
  border-radius: var(--radius-md);
  height: 110px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 42px;
  color: rgba(255, 255, 255, 0.92);
  text-shadow: 0 4px 10px rgba(15, 23, 42, 0.25);
}

.color-card .label {
  font-weight: 700;
  font-size: 18px;
}

.color-card .helper {
  font-size: 14px;
  color: rgba(15, 23, 42, 0.7);
}

.color-card.correct {
  border-color: #22c55e;
  transform: translateY(-4px) scale(1.02);
  box-shadow: 0 18px 30px rgba(34, 197, 94, 0.32);
}

.color-card.incorrect {
  border-color: #ef4444;
  animation: shake 0.4s ease;
}

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

.sequence-display {
  display: flex;
  gap: 12px;
  justify-content: center;
  margin-bottom: 16px;
}

.sequence-dot {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: rgba(15, 23, 42, 0.12);
  border: 2px solid rgba(15, 23, 42, 0.15);
  transition: transform 0.2s ease, background 0.2s ease;
}

.sequence-dot.active {
  background: rgba(249, 115, 22, 0.9);
  transform: scale(1.2);
}

.game-controls {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: center;
}

.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(120%);
  background: rgba(15, 23, 42, 0.9);
  color: white;
  padding: 14px 24px;
  border-radius: 999px;
  font-weight: 600;
  box-shadow: 0 20px 30px rgba(15, 23, 42, 0.3);
  transition: transform 0.3s ease;
  z-index: 20;
}

.toast.visible {
  transform: translateX(-50%) translateY(0);
}

.creative-wrapper {
  display: grid;
  gap: 24px;
  grid-template-columns: 260px 1fr 220px;
}

.palette {
  display: grid;
  gap: 12px;
}

.palette button {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  border: 2px solid transparent;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.2s ease, border 0.2s ease;
}

.palette button:hover {
  transform: translateX(4px);
}

.palette button.active {
  border-color: rgba(15, 23, 42, 0.35);
  transform: translateX(4px);
}

.canvas-wrapper {
  background: white;
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: 0 20px 30px rgba(15, 23, 42, 0.15);
}

#creative-canvas {
  width: 100%;
  height: auto;
  cursor: pointer;
}

#creative-canvas [data-area] {
  transition: fill 0.2s ease;
}

.creative-tips {
  background: rgba(255, 255, 255, 0.8);
  border-radius: var(--radius-md);
  padding: 16px 18px;
  box-shadow: 0 12px 20px rgba(15, 23, 42, 0.12);
  font-size: 15px;
  line-height: 1.6;
}

.practice-wrapper {
  display: grid;
  gap: 18px;
  justify-items: center;
  text-align: center;
}

.practice-prompt {
  font-size: 28px;
  font-weight: 700;
  padding: 18px 28px;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.8);
  box-shadow: 0 16px 24px rgba(15, 23, 42, 0.12);
}

.practice-note {
  max-width: 420px;
  color: var(--text-secondary);
  font-size: 14px;
}

.sticker-collection {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  margin-top: 24px;
}

.sticker-card {
  background: rgba(255, 255, 255, 0.9);
  border-radius: var(--radius-md);
  padding: 20px;
  text-align: center;
  box-shadow: 0 16px 26px rgba(15, 23, 42, 0.12);
  position: relative;
  overflow: hidden;
}

.sticker-card.locked {
  opacity: 0.35;
}

.sticker-icon {
  font-size: 42px;
  margin-bottom: 12px;
}

.reward-dialog {
  border: none;
  border-radius: var(--radius-lg);
  padding: 0;
  max-width: 420px;
  width: calc(100% - 40px);
  background: var(--surface);
  box-shadow: 0 30px 45px rgba(15, 23, 42, 0.2);
}

.reward-dialog::backdrop {
  background: rgba(15, 23, 42, 0.35);
}

.reward-content {
  padding: 32px 28px 24px;
  text-align: center;
}

.reward-sticker {
  font-size: 72px;
  margin: 16px 0;
}

@media (max-width: 900px) {
  .creative-wrapper {
    grid-template-columns: 1fr;
  }

  .top-bar {
    flex-direction: column;
    align-items: flex-start;
  }

  .quick-actions {
    align-self: flex-end;
  }
}

@media (max-width: 600px) {
  .app {
    padding-inline: 16px;
  }

  .top-bar {
    padding: 18px;
  }

  .screen {
    padding: 20px;
  }

  .game-area {
    gap: 12px;
  }

  .color-card {
    padding: 14px;
  }
}
