:root {
  --sky: #bfe7ff;
  --lilac: #cdbbff;
  --blush: #ffd0e7;
  --mint: #c9f7df;
  --butter: #fff0a8;
  --coral: #ff8f9c;
  --plum: #5a3d79;
  --ink: #3f315c;
  --muted: #7d6f94;
  --glass: rgba(255, 255, 255, 0.66);
  --glass-strong: rgba(255, 255, 255, 0.84);
  --line: rgba(255, 255, 255, 0.68);
  --shadow: 0 24px 70px rgba(99, 91, 157, 0.22);
  --soft-shadow: 0 14px 30px rgba(99, 91, 157, 0.16);
  --radius: 32px;
  --button-radius: 24px;
  --font: "Trebuchet MS", "Comic Sans MS", system-ui, sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: #dff4ff;
}

body {
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
  color: var(--ink);
  font-family: var(--font);
  background:
    radial-gradient(circle at 12% 16%, rgba(255, 240, 168, 0.9), transparent 24rem),
    radial-gradient(circle at 86% 12%, rgba(255, 208, 231, 0.95), transparent 22rem),
    radial-gradient(circle at 78% 78%, rgba(201, 247, 223, 0.9), transparent 22rem),
    linear-gradient(135deg, #bfe7ff 0%, #ecd7ff 46%, #ffe0ef 100%);
}

button,
input {
  font: inherit;
}

button {
  -webkit-tap-highlight-color: transparent;
}

.dream-bg {
  position: fixed;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}

.cloud,
.bubble,
.sparkle {
  position: absolute;
  animation: floaty 8s ease-in-out infinite;
}

.cloud {
  width: 9rem;
  height: 4.2rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.72);
  box-shadow: var(--soft-shadow);
}

.cloud::before,
.cloud::after {
  position: absolute;
  content: "";
  border-radius: 50%;
  background: inherit;
}

.cloud::before {
  width: 4.7rem;
  height: 4.7rem;
  left: 1.1rem;
  top: -1.8rem;
}

.cloud::after {
  width: 5.5rem;
  height: 5.5rem;
  right: 1rem;
  top: -2.5rem;
}

.cloud-one { left: -2rem; top: 6rem; }
.cloud-two { right: -2rem; top: 20rem; animation-delay: -2s; }
.cloud-three { left: 56%; bottom: 3rem; animation-delay: -4s; }

.bubble {
  width: 5.5rem;
  aspect-ratio: 1;
  border: 2px solid rgba(255, 255, 255, 0.72);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.22);
  box-shadow: inset 0 0 24px rgba(255, 255, 255, 0.4);
}

.bubble-one { right: 9%; top: 9rem; }
.bubble-two { left: 8%; bottom: 6rem; width: 3.8rem; animation-delay: -3s; }
.bubble-three { right: 26%; bottom: 15%; width: 2.8rem; animation-delay: -5s; }

.sparkle {
  color: rgba(255, 255, 255, 0.9);
  font-size: 2rem;
  text-shadow: 0 8px 18px rgba(93, 65, 140, 0.2);
}

.sparkle-one { left: 18%; top: 15%; }
.sparkle-two { right: 20%; top: 38%; animation-delay: -1.5s; }
.sparkle-three { left: 14%; bottom: 22%; animation-delay: -3.5s; }

@keyframes floaty {
  0%, 100% { transform: translate3d(0, 0, 0) rotate(-2deg); }
  50% { transform: translate3d(0, -18px, 0) rotate(2deg); }
}

.app-shell {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  padding: max(18px, env(safe-area-inset-top)) 16px max(20px, env(safe-area-inset-bottom));
}

.screen {
  display: none;
}

.screen.active,
.view.active {
  display: block;
}

.welcome-screen {
  min-height: calc(100vh - 38px);
  place-items: center;
  text-align: center;
  padding: 28px 12px;
}

.welcome-screen.active {
  display: grid;
}

.brand-cloud {
  position: relative;
  display: grid;
  width: min(45vw, 180px);
  aspect-ratio: 1.25;
  place-items: center;
  border: 2px solid rgba(255, 255, 255, 0.76);
  border-radius: 46% 54% 48% 52% / 58% 50% 50% 42%;
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.88), rgba(255, 255, 255, 0.42));
  box-shadow: var(--shadow);
}

.brand-mark {
  font-size: clamp(3.5rem, 18vw, 6rem);
  font-weight: 900;
  color: var(--plum);
  text-shadow: 0 8px 0 rgba(205, 187, 255, 0.45);
}

.tiny-star {
  position: absolute;
  right: 12%;
  top: 4%;
  color: #ffbf47;
  font-size: 2rem;
}

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

h1 {
  font-size: clamp(3rem, 14vw, 6.5rem);
  line-height: 0.92;
  color: var(--plum);
}

.welcome-copy {
  max-width: 20rem;
  margin-top: -14px;
  color: var(--muted);
  font-size: clamp(1.18rem, 5vw, 1.5rem);
  line-height: 1.25;
}

.primary-button,
.secondary-button,
.icon-button,
.round-control,
.category-card,
.flash-card,
.side-nav,
.quiz-option {
  border: 0;
  cursor: pointer;
}

.primary-button {
  display: inline-flex;
  min-height: 64px;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 18px 25px;
  border-radius: var(--button-radius);
  color: #fff;
  font-size: 1.24rem;
  font-weight: 900;
  background: linear-gradient(145deg, #ff8f9c, #a78bfa);
  box-shadow: 0 13px 0 rgba(122, 89, 175, 0.23), 0 25px 44px rgba(111, 84, 180, 0.22);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.huge-button {
  min-width: min(100%, 315px);
  min-height: 76px;
  font-size: 1.45rem;
}

.primary-button:active,
.round-control:active,
.category-card:active,
.quiz-option:active {
  transform: translateY(5px) scale(0.99);
  box-shadow: 0 6px 0 rgba(122, 89, 175, 0.18), 0 15px 28px rgba(111, 84, 180, 0.16);
}

.button-icon {
  display: grid;
  width: 38px;
  aspect-ratio: 1;
  place-items: center;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.24);
}

.welcome-pills {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
}

.welcome-pills span {
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.5);
  color: var(--plum);
  font-size: 0.95rem;
  font-weight: 800;
  backdrop-filter: blur(14px);
}

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

.topbar {
  display: grid;
  grid-template-columns: 56px 1fr 56px;
  gap: 12px;
  align-items: center;
  width: min(1160px, 100%);
  margin: 0 auto 14px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 28px;
  background: var(--glass);
  box-shadow: var(--soft-shadow);
  backdrop-filter: blur(22px);
}

.topbar h2 {
  font-size: clamp(1.45rem, 6vw, 2.2rem);
  line-height: 1;
}

.creator-byline {
  display: inline-flex;
  width: fit-content;
  max-width: 100%;
  margin-top: 5px;
  padding: 4px 10px;
  border: 1px solid rgba(255, 255, 255, 0.68);
  border-radius: 999px;
  color: rgba(90, 61, 121, 0.76);
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.58), rgba(255, 255, 255, 0.22));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.72), 0 8px 18px rgba(88, 74, 146, 0.08);
  font-size: clamp(0.62rem, 2.7vw, 0.78rem);
  font-weight: 900;
  line-height: 1;
  white-space: nowrap;
  backdrop-filter: blur(12px);
}

.screen-kicker {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 900;
  text-transform: uppercase;
}

.icon-button {
  display: grid;
  min-width: 52px;
  min-height: 52px;
  place-items: center;
  border-radius: 18px;
  color: var(--plum);
  font-size: 1.55rem;
  font-weight: 900;
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.94), rgba(255, 255, 255, 0.46));
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.9), 0 12px 24px rgba(99, 91, 157, 0.16);
}

.content-layout {
  display: block;
  width: min(1160px, 100%);
  margin: 0 auto;
}

.category-sidebar {
  display: none;
}

.stage {
  min-height: calc(100vh - 116px);
}

.view {
  display: none;
}

.home-hero,
.quiz-panel,
.rewards-panel,
.settings-panel,
.learning-card-wrap {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--glass);
  box-shadow: var(--shadow);
  backdrop-filter: blur(24px);
}

.home-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 20px;
  margin-bottom: 14px;
}

.home-hero h3,
.quiz-panel h3,
.rewards-panel h3,
.settings-panel h3 {
  font-size: clamp(1.65rem, 7vw, 3rem);
  line-height: 0.96;
}

.home-hero p {
  margin-top: 7px;
  color: var(--muted);
  font-size: 1rem;
  font-weight: 800;
}

.star-bank,
.card-stars,
.reward-total {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-width: 76px;
  justify-content: center;
  padding: 11px 13px;
  border-radius: 999px;
  color: #805528;
  background: linear-gradient(145deg, #fff6bd, #ffd986);
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.88), 0 12px 22px rgba(197, 137, 59, 0.18);
}

.star-bank span,
.card-stars span,
.reward-total span {
  color: #ffb02e;
}

.category-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.category-card {
  min-height: 142px;
  padding: 16px 12px;
  border: 1px solid var(--line);
  border-radius: 28px;
  color: var(--ink);
  text-align: left;
  background: linear-gradient(145deg, rgba(255,255,255,0.82), rgba(255,255,255,0.42));
  box-shadow: var(--soft-shadow);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.category-card .emoji {
  display: block;
  font-size: 2.55rem;
  filter: drop-shadow(0 8px 8px rgba(89, 59, 130, 0.12));
}

.category-card strong {
  display: block;
  margin-top: 9px;
  font-size: 1.25rem;
}

.category-card span:last-child {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 800;
}

.learning-card-wrap {
  display: grid;
  min-height: calc(100vh - 116px);
  align-content: center;
  gap: 18px;
  padding: 16px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.74), rgba(255, 255, 255, 0.44)),
    radial-gradient(circle at 14% 12%, rgba(255, 216, 111, 0.28), transparent 13rem),
    radial-gradient(circle at 88% 10%, rgba(255, 143, 156, 0.24), transparent 15rem),
    radial-gradient(circle at 78% 90%, rgba(142, 230, 187, 0.3), transparent 14rem);
}

.card-progress-row,
.quiz-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.progress-track {
  width: min(52vw, 360px);
  height: 12px;
  margin-top: 9px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.55);
}

.progress-track span {
  display: block;
  width: 10%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #ff9fab, #ffd86f, #89e9b7);
  transition: width 0.35s ease;
}

.flash-card {
  --card-accent: #ffb3c3;
  position: relative;
  display: grid;
  min-height: min(56vh, 480px);
  isolation: isolate;
  padding: clamp(22px, 6vw, 36px);
  overflow: hidden;
  border: 2px solid rgba(255, 255, 255, 0.82);
  border-radius: 42px;
  color: var(--ink);
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.96), rgba(255, 255, 255, 0.58)),
    radial-gradient(circle at 18% 12%, color-mix(in srgb, var(--card-accent) 32%, white), transparent 12rem),
    radial-gradient(circle at 82% 88%, rgba(205, 187, 255, 0.46), transparent 14rem);
  box-shadow:
    inset 0 5px 0 rgba(255, 255, 255, 0.95),
    inset 0 -18px 38px rgba(125, 111, 148, 0.08),
    0 16px 0 rgba(255, 255, 255, 0.24),
    0 34px 76px rgba(88, 74, 146, 0.28);
  transform-style: preserve-3d;
  transition: transform 0.45s cubic-bezier(.2,.8,.2,1), box-shadow 0.3s ease;
}

.flash-card::before {
  position: absolute;
  content: "";
  inset: 11px;
  z-index: -1;
  border: 1px solid rgba(255, 255, 255, 0.76);
  border-radius: 32px;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.46), rgba(255, 255, 255, 0.12)),
    repeating-linear-gradient(120deg, rgba(255, 255, 255, 0.16) 0 2px, transparent 2px 18px);
  box-shadow: inset 0 0 42px rgba(255, 255, 255, 0.42);
}

.flash-card::after {
  position: absolute;
  content: "";
  inset: -44% auto auto -30%;
  width: 74%;
  aspect-ratio: 1;
  z-index: -2;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.92), rgba(255, 255, 255, 0.2) 45%, transparent 68%);
  animation: cardGlow 7s ease-in-out infinite;
}

.flash-card.flipped {
  transform: rotateY(7deg) translateY(-2px) scale(0.99);
  box-shadow:
    inset 0 5px 0 rgba(255, 255, 255, 0.95),
    inset 0 -18px 38px rgba(125, 111, 148, 0.08),
    0 13px 0 rgba(255, 255, 255, 0.2),
    0 28px 64px rgba(88, 74, 146, 0.24);
}

.card-aurora,
.card-orbit,
.card-sparkle {
  position: absolute;
  pointer-events: none;
}

.card-aurora {
  inset: auto 8% 9% 8%;
  height: 22%;
  z-index: -1;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(255, 143, 156, 0.3), rgba(255, 216, 111, 0.28), rgba(142, 230, 187, 0.28), rgba(139, 223, 246, 0.28));
  filter: blur(20px);
  opacity: 0.9;
}

.card-orbit {
  width: clamp(72px, 20vw, 132px);
  aspect-ratio: 1;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.5);
  background: radial-gradient(circle at 35% 28%, rgba(255, 255, 255, 0.8), color-mix(in srgb, var(--card-accent) 26%, transparent));
  box-shadow: inset 0 0 18px rgba(255, 255, 255, 0.42), 0 16px 28px rgba(88, 74, 146, 0.12);
  animation: orbitFloat 8s ease-in-out infinite;
}

.card-orbit-one {
  left: -34px;
  top: 18%;
}

.card-orbit-two {
  right: -38px;
  bottom: 18%;
  width: clamp(58px, 16vw, 104px);
  animation-delay: -3s;
}

.card-sparkle {
  z-index: 1;
  color: color-mix(in srgb, var(--card-accent) 58%, #ffffff);
  font-size: clamp(1.15rem, 4vw, 1.9rem);
  text-shadow: 0 8px 18px rgba(88, 74, 146, 0.2);
  animation: premiumTwinkle 3.6s ease-in-out infinite;
}

.card-sparkle-one {
  left: 14%;
  top: 12%;
}

.card-sparkle-two {
  right: 15%;
  top: 18%;
  animation-delay: -1.1s;
}

.card-sparkle-three {
  right: 20%;
  bottom: 17%;
  color: #ffbf47;
  animation-delay: -2.1s;
}

.card-content {
  display: grid;
  width: 100%;
  min-height: calc(min(56vh, 480px) - 70px);
  grid-template-rows: minmax(92px, auto) auto auto auto;
  align-content: center;
  justify-items: center;
  gap: clamp(8px, 1.7vh, 16px);
  padding: clamp(8px, 2vw, 16px);
  border-radius: 30px;
  background: radial-gradient(circle at 50% 12%, rgba(255, 255, 255, 0.68), transparent 55%);
}

.card-media {
  display: flex;
  width: 100%;
  min-height: clamp(86px, 19vh, 150px);
  align-items: center;
  justify-content: center;
}

.card-icon {
  display: flex;
  width: 100%;
  max-height: clamp(92px, 21vh, 170px);
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: clamp(2px, 1vw, 8px);
  font-size: clamp(2.65rem, 13vw, 7rem);
  line-height: 1;
  overflow: hidden;
  overflow-wrap: anywhere;
  text-align: center;
  transform: translateZ(34px);
  filter:
    drop-shadow(0 5px 0 rgba(255, 255, 255, 0.86))
    drop-shadow(0 18px 16px rgba(89, 59, 130, 0.2));
}

.flash-card.animal-card .card-icon {
  font-size: clamp(5.4rem, 24vw, 10.5rem);
}

.flash-card.fruit-card .card-icon {
  font-size: clamp(5rem, 23vw, 10.2rem);
}

.flash-card.vehicle-card .card-icon {
  font-size: clamp(5rem, 22vw, 10rem);
}

.flash-card.counting-card .card-icon {
  font-size: clamp(2.45rem, 12.5vw, 6.4rem);
}

.card-image {
  display: block;
  width: min(82%, 240px);
  aspect-ratio: 1;
  object-fit: cover;
  border: 2px solid rgba(255, 255, 255, 0.88);
  border-radius: 34%;
  background: rgba(255, 255, 255, 0.52);
  box-shadow:
    inset 0 2px 0 rgba(255, 255, 255, 0.9),
    0 8px 0 rgba(255, 255, 255, 0.34),
    0 24px 36px rgba(88, 74, 146, 0.18);
  transform: translateZ(38px);
}

.card-image[hidden],
.card-icon[hidden] {
  display: none;
}

.card-title {
  max-width: 100%;
  font-size: clamp(3.45rem, 19vw, 8.8rem);
  font-weight: 900;
  line-height: 1.05;
  color: var(--plum);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: clip;
  text-align: center;
  font-size: clamp(3rem, var(--title-scale, 19vw), 8.8rem);
  transform: translateZ(42px);
  text-shadow:
    0 4px 0 rgba(255, 255, 255, 0.78),
    0 10px 0 color-mix(in srgb, var(--card-accent) 26%, transparent),
    0 18px 32px rgba(88, 74, 146, 0.16);
}

.card-subtitle {
  max-width: 100%;
  font-size: clamp(1.2rem, var(--subtitle-scale, 8vw), 3.65rem);
  font-weight: 900;
  line-height: 1.02;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: clip;
  text-align: center;
  transform: translateZ(30px);
  text-shadow: 0 4px 0 rgba(255, 255, 255, 0.65), 0 14px 24px rgba(88, 74, 146, 0.14);
}

.card-phrase {
  max-width: 100%;
  color: var(--muted);
  font-size: clamp(0.82rem, var(--phrase-scale, 4.1vw), 1.7rem);
  font-weight: 900;
  line-height: 1.12;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: clip;
  text-align: center;
  transform: translateZ(24px);
  padding: 9px 18px;
  border: 1px solid rgba(255, 255, 255, 0.68);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.42);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7), 0 14px 24px rgba(88, 74, 146, 0.08);
}

.tap-hint {
  position: absolute;
  right: 18px;
  bottom: 16px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 12px;
  border-radius: 999px;
  color: var(--plum);
  background: rgba(255, 255, 255, 0.72);
  font-size: 0.82rem;
  font-weight: 900;
  box-shadow: 0 10px 20px rgba(88, 74, 146, 0.1);
}

.card-controls {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  padding: 5px;
  border-radius: 30px;
  background: rgba(255, 255, 255, 0.28);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.55);
}

.animal-sound-button {
  display: inline-flex;
  min-height: 58px;
  width: min(100%, 320px);
  align-items: center;
  justify-content: center;
  justify-self: center;
  gap: 10px;
  border: 1px solid rgba(255, 255, 255, 0.74);
  border-radius: 22px;
  color: var(--plum);
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.76), rgba(255, 255, 255, 0.38)),
    radial-gradient(circle at 20% 20%, rgba(142, 230, 187, 0.34), transparent 8rem);
  box-shadow:
    inset 0 2px 0 rgba(255, 255, 255, 0.82),
    0 13px 0 rgba(98, 166, 132, 0.16),
    0 22px 34px rgba(92, 80, 155, 0.12);
  font-size: 1.06rem;
  font-weight: 900;
  cursor: pointer;
}

.animal-sound-button[hidden] {
  display: none;
}

.animal-sound-button span {
  display: grid;
  width: 34px;
  aspect-ratio: 1;
  place-items: center;
  border-radius: 50%;
  background: linear-gradient(145deg, #8ee6bb, #8bdff6);
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.55);
}

.animal-sound-button:active {
  transform: translateY(4px);
  box-shadow:
    inset 0 2px 0 rgba(255, 255, 255, 0.82),
    0 7px 0 rgba(98, 166, 132, 0.14),
    0 16px 25px rgba(92, 80, 155, 0.1);
}

.round-control {
  display: grid;
  min-height: 76px;
  place-items: center;
  border-radius: 24px;
  color: #fff;
  font-size: 2.4rem;
  font-weight: 900;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.34), transparent),
    linear-gradient(145deg, #8bdff6, #a78bfa);
  box-shadow:
    inset 0 3px 0 rgba(255, 255, 255, 0.42),
    0 11px 0 rgba(98, 85, 166, 0.2),
    0 22px 34px rgba(92, 80, 155, 0.16);
}

.repeat-control {
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.34), transparent),
    linear-gradient(145deg, #ffb3c3, #ffd86f);
}

@keyframes cardGlow {
  0%, 100% { transform: translate3d(0, 0, 0) scale(1); opacity: 0.68; }
  50% { transform: translate3d(34%, 18%, 0) scale(1.12); opacity: 0.92; }
}

@keyframes orbitFloat {
  0%, 100% { transform: translate3d(0, 0, 0) scale(1); }
  50% { transform: translate3d(0, -12px, 0) scale(1.04); }
}

@keyframes premiumTwinkle {
  0%, 100% { transform: scale(0.82) rotate(-8deg); opacity: 0.42; }
  50% { transform: scale(1.22) rotate(8deg); opacity: 1; }
}

.quiz-panel,
.rewards-panel,
.settings-panel,
.piano-panel {
  padding: 18px;
}

.piano-panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.72), rgba(255, 255, 255, 0.44)),
    radial-gradient(circle at 18% 18%, rgba(255, 216, 111, 0.28), transparent 12rem),
    radial-gradient(circle at 82% 18%, rgba(139, 223, 246, 0.3), transparent 12rem),
    radial-gradient(circle at 70% 90%, rgba(255, 179, 195, 0.25), transparent 14rem);
  box-shadow: var(--shadow);
  backdrop-filter: blur(24px);
}

.piano-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 18px;
}

.piano-header h3 {
  font-size: clamp(1.9rem, 8vw, 3.4rem);
  line-height: 0.95;
}

.piano-spark {
  display: grid;
  width: 62px;
  aspect-ratio: 1;
  place-items: center;
  border-radius: 22px;
  color: #fff;
  background: linear-gradient(145deg, #ff9fab, #a78bfa);
  box-shadow: inset 0 3px 0 rgba(255, 255, 255, 0.38), 0 14px 28px rgba(88, 74, 146, 0.18);
  font-size: 2rem;
  font-weight: 900;
}

.piano-keys {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.piano-key {
  position: relative;
  display: grid;
  min-height: 112px;
  place-items: center;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.78);
  border-radius: 28px;
  color: var(--plum);
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.84), rgba(255, 255, 255, 0.35)),
    radial-gradient(circle at 50% 0%, color-mix(in srgb, var(--key-color) 44%, white), transparent 9rem);
  box-shadow:
    inset 0 3px 0 rgba(255, 255, 255, 0.86),
    0 12px 0 color-mix(in srgb, var(--key-color) 42%, rgba(98, 85, 166, 0.2)),
    0 22px 34px rgba(92, 80, 155, 0.14);
  cursor: pointer;
  transition: transform 0.16s ease, box-shadow 0.16s ease;
}

.piano-key::before {
  position: absolute;
  content: "";
  inset: 10px;
  border-radius: 20px;
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.5), transparent);
  pointer-events: none;
}

.piano-key span {
  position: relative;
  font-size: clamp(2.2rem, 12vw, 4.6rem);
  font-weight: 900;
  line-height: 0.9;
  text-shadow: 0 4px 0 rgba(255, 255, 255, 0.72), 0 12px 20px rgba(88, 74, 146, 0.14);
}

.piano-key strong {
  position: relative;
  font-size: clamp(1rem, 4.5vw, 1.35rem);
}

.piano-key.playing,
.piano-key:active {
  transform: translateY(7px) scale(0.985);
  box-shadow:
    inset 0 3px 0 rgba(255, 255, 255, 0.82),
    0 5px 0 color-mix(in srgb, var(--key-color) 38%, rgba(98, 85, 166, 0.16)),
    0 14px 24px rgba(92, 80, 155, 0.12);
}

.quiz-options {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  margin: 18px 0;
}

.quiz-option {
  display: grid;
  min-height: 116px;
  grid-template-columns: 76px 1fr;
  gap: 12px;
  align-items: center;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 28px;
  color: var(--ink);
  text-align: left;
  background: rgba(255, 255, 255, 0.66);
  box-shadow: var(--soft-shadow);
}

.quiz-option .option-icon {
  font-size: 3.6rem;
  text-align: center;
}

.quiz-option strong {
  font-size: 1.5rem;
}

.quiz-option.correct {
  outline: 4px solid rgba(137, 233, 183, 0.9);
}

.quiz-option.wrong {
  outline: 4px solid rgba(255, 143, 156, 0.8);
}

.quiz-feedback {
  min-height: 32px;
  margin-bottom: 12px;
  color: var(--plum);
  font-size: 1.15rem;
  font-weight: 900;
}

.reward-total {
  min-width: 130px;
  margin: 18px 0;
  font-size: 2rem;
}

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

.reward-card {
  padding: 16px;
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.62);
  box-shadow: var(--soft-shadow);
}

.reward-card strong {
  display: block;
  font-size: 1.1rem;
}

.reward-card span {
  color: #ffb02e;
  font-size: 1.45rem;
  letter-spacing: 2px;
}

.setting-row,
.progress-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 14px;
  padding: 15px;
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.62);
  box-shadow: var(--soft-shadow);
}

.setting-row.stacked {
  display: grid;
}

.setting-row strong {
  display: block;
  font-size: 1.08rem;
}

.setting-row span,
.progress-summary {
  color: var(--muted);
  font-weight: 800;
}

.switch {
  position: relative;
  display: inline-flex;
}

.switch input {
  position: absolute;
  opacity: 0;
}

.switch span {
  position: relative;
  width: 78px;
  height: 46px;
  border-radius: 999px;
  background: #d4cbe8;
  box-shadow: inset 0 4px 10px rgba(84, 67, 126, 0.18);
}

.switch span::after {
  position: absolute;
  content: "";
  width: 36px;
  aspect-ratio: 1;
  left: 5px;
  top: 5px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 6px 13px rgba(84, 67, 126, 0.2);
  transition: transform 0.2s ease;
}

.switch input:checked + span {
  background: linear-gradient(145deg, #8ee6bb, #8bdff6);
}

.switch input:checked + span::after {
  transform: translateX(32px);
}

.segmented {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding: 6px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.62);
}

.segmented button {
  min-height: 48px;
  border: 0;
  border-radius: 16px;
  color: var(--plum);
  font-weight: 900;
  background: transparent;
}

.segmented button.active {
  color: #fff;
  background: linear-gradient(145deg, #a78bfa, #ff9fab);
  box-shadow: var(--soft-shadow);
}

.danger-zone {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  margin-top: 14px;
}

.secondary-button {
  min-height: 58px;
  padding: 14px 16px;
  border-radius: 20px;
  color: var(--plum);
  font-weight: 900;
  background: rgba(255, 255, 255, 0.72);
  box-shadow: var(--soft-shadow);
}

.secondary-button.danger {
  color: #9a3852;
}

#confettiCanvas {
  position: fixed;
  inset: 0;
  z-index: 5;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

/* === Premium Twemoji Images === */
img.emoji {
  display: inline-block;
  vertical-align: middle;
  pointer-events: none;
  image-rendering: auto;
}

.card-icon img.emoji {
  width: clamp(86px, 20vw, 150px);
  height: clamp(86px, 20vw, 150px);
  object-fit: contain;
  filter:
    drop-shadow(0 6px 0 rgba(255, 255, 255, 0.88))
    drop-shadow(0 20px 18px rgba(89, 59, 130, 0.22));
}

.flash-card.animal-card .card-icon img.emoji,
.flash-card.fruit-card .card-icon img.emoji,
.flash-card.vehicle-card .card-icon img.emoji {
  width: clamp(130px, 26vw, 200px);
  height: clamp(130px, 26vw, 200px);
}

.flash-card.counting-card .card-icon img.emoji {
  width: clamp(26px, 7vw, 46px);
  height: clamp(26px, 7vw, 46px);
  filter: drop-shadow(0 3px 4px rgba(89, 59, 130, 0.18));
}

.option-icon img.emoji {
  width: 56px;
  height: 56px;
}

.category-card .emoji img.emoji {
  width: 2.55rem;
  height: 2.55rem;
  filter: drop-shadow(0 8px 8px rgba(89, 59, 130, 0.14));
}

/* === Drawing Screen === */
.drawing-panel {
  display: grid;
  gap: 14px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--glass);
  box-shadow: var(--shadow);
  backdrop-filter: blur(24px);
}

.drawing-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.drawing-header h3 {
  font-size: clamp(1.9rem, 8vw, 3.4rem);
  line-height: 0.95;
}

.drawing-header-tools {
  display: flex;
  gap: 10px;
  flex-shrink: 0;
}

.draw-icon-btn {
  display: grid;
  width: 52px;
  height: 52px;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.78);
  border-radius: 18px;
  font-size: 1.45rem;
  color: var(--plum);
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.88), rgba(255, 255, 255, 0.46));
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.88), 0 8px 18px rgba(88, 74, 146, 0.12);
  cursor: pointer;
  transition: transform 0.15s ease;
}

.draw-icon-btn:active {
  transform: translateY(3px) scale(0.96);
}

.draw-icon-btn.danger {
  color: #9a3852;
}

.drawing-canvas {
  display: block;
  width: 100%;
  height: min(45vh, 380px);
  border: 2px solid rgba(255, 255, 255, 0.82);
  border-radius: 24px;
  background: #fff;
  box-shadow:
    inset 0 2px 0 rgba(255, 255, 255, 0.9),
    0 10px 28px rgba(88, 74, 146, 0.14);
  cursor: crosshair;
  touch-action: none;
}

.drawing-toolbar {
  display: grid;
  gap: 12px;
}

.color-palette {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
}

.color-swatch {
  width: 42px;
  height: 42px;
  border: 3px solid rgba(255, 255, 255, 0.9);
  border-radius: 50%;
  background: var(--swatch-color);
  box-shadow: 0 4px 12px rgba(88, 74, 146, 0.18);
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.color-swatch.active {
  transform: scale(1.26);
  box-shadow: 0 0 0 3px var(--swatch-color), 0 6px 16px rgba(88, 74, 146, 0.22);
}

.color-swatch:active {
  transform: scale(0.9);
}

.brush-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.44);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.6);
}

.brush-sizes {
  display: flex;
  gap: 10px;
  flex: 1;
  justify-content: center;
}

.brush-size-btn {
  display: grid;
  width: 52px;
  height: 52px;
  place-items: center;
  border: 2px solid rgba(255, 255, 255, 0.78);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.64);
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.86), 0 6px 14px rgba(88, 74, 146, 0.1);
  cursor: pointer;
  transition: transform 0.15s ease;
}

.brush-size-btn span {
  display: block;
  border-radius: 50%;
  background: var(--plum);
  opacity: 0.65;
}

.brush-size-btn.active {
  background: linear-gradient(145deg, #a78bfa, #ff9fab);
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.38), 0 8px 18px rgba(88, 74, 146, 0.2);
}

.brush-size-btn.active span {
  background: #fff;
  opacity: 1;
}

.brush-size-btn:active {
  transform: scale(0.9);
}

.eraser-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 10px 16px;
  border: 1px solid rgba(255, 255, 255, 0.78);
  border-radius: 18px;
  color: var(--plum);
  font-size: 0.9rem;
  font-weight: 900;
  background: rgba(255, 255, 255, 0.64);
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.86), 0 6px 14px rgba(88, 74, 146, 0.1);
  cursor: pointer;
  transition: transform 0.15s ease;
  white-space: nowrap;
}

.eraser-btn span {
  font-size: 1.3rem;
  line-height: 1;
}

.eraser-btn.active {
  background: linear-gradient(145deg, #8ee6bb, #8bdff6);
  color: var(--ink);
}

.eraser-btn:active {
  transform: scale(0.92);
}

@media (min-width: 720px) {
  .app-shell {
    padding: 24px;
  }

  .content-layout {
    display: grid;
    grid-template-columns: 150px 1fr;
    gap: 16px;
  }

  .category-sidebar {
    position: sticky;
    top: 18px;
    display: grid;
    align-self: start;
    gap: 10px;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 28px;
    background: var(--glass);
    box-shadow: var(--soft-shadow);
    backdrop-filter: blur(20px);
  }

  .side-nav {
    min-height: 48px;
    border-radius: 17px;
    color: var(--plum);
    font-size: 0.96rem;
    font-weight: 900;
    background: rgba(255, 255, 255, 0.48);
  }

  .side-nav.active {
    color: #fff;
    background: linear-gradient(145deg, #a78bfa, #ff9fab);
    box-shadow: var(--soft-shadow);
  }

  .category-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .category-card {
    min-height: 168px;
  }

  .learning-card-wrap {
    min-height: calc(100vh - 112px);
    padding: 24px;
  }

  .flash-card {
    min-height: min(62vh, 560px);
  }

  .card-content {
    min-height: calc(min(62vh, 560px) - 88px);
  }

  .card-icon {
    font-size: clamp(4.6rem, 9vw, 11rem);
    max-height: clamp(120px, 24vh, 230px);
  }

  .flash-card.animal-card .card-icon {
    font-size: clamp(7rem, 13vw, 13rem);
  }

  .flash-card.fruit-card .card-icon {
    font-size: clamp(6.8rem, 12vw, 12.5rem);
  }

  .flash-card.vehicle-card .card-icon {
    font-size: clamp(6.8rem, 12vw, 12.5rem);
  }

  .flash-card.counting-card .card-icon {
    font-size: clamp(4.4rem, 8vw, 9rem);
  }

  .card-image {
    width: min(58%, 300px);
  }

  .quiz-options {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .piano-keys {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .piano-key {
    min-height: 180px;
  }

  .reward-grid {
    grid-template-columns: repeat(4, 1fr);
  }

  .danger-zone {
    grid-template-columns: 1fr 1fr;
  }

  .drawing-canvas {
    height: min(54vh, 500px);
  }

  .color-swatch {
    width: 48px;
    height: 48px;
  }

  .card-icon img.emoji {
    width: clamp(110px, 13vw, 190px);
    height: clamp(110px, 13vw, 190px);
  }

  .flash-card.animal-card .card-icon img.emoji,
  .flash-card.fruit-card .card-icon img.emoji,
  .flash-card.vehicle-card .card-icon img.emoji {
    width: clamp(160px, 20vw, 250px);
    height: clamp(160px, 20vw, 250px);
  }

  .flash-card.counting-card .card-icon img.emoji {
    width: clamp(36px, 9vw, 62px);
    height: clamp(36px, 9vw, 62px);
  }

  .option-icon img.emoji {
    width: 68px;
    height: 68px;
  }
}

@media (min-width: 1024px) and (orientation: landscape) {
  .content-layout {
    grid-template-columns: 176px 1fr;
  }

  .card-controls {
    max-width: 560px;
    justify-self: center;
    width: 100%;
  }
}

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