@import url('https://fonts.googleapis.com/css2?family=Fredoka:wght@400;600;700;800;900&display=swap');

:root {
  color-scheme: light;
  --ink: #173042;
  --muted: #647789;
  --paper: #fffaf2;
  --panel: #ffffff;
  --teal: #1d8a9b;
  --teal-dark: #176575;
  --coral: #ff7a66;
  --yellow: #ffd95a;
  --green: #43b883;
  --purple: #7567d9;
  --blue: #4d9de0;
  --line: #dbe6ea;
  --shadow: 0 18px 44px rgba(30, 56, 72, 0.14);
  --radius: 8px;
}

* {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Fredoka", "Segoe UI", Arial, sans-serif;
  color: var(--ink);
  background:
    linear-gradient(135deg, rgba(255, 217, 90, 0.22), transparent 36%),
    linear-gradient(315deg, rgba(67, 184, 131, 0.2), transparent 40%),
    var(--paper);
}

body.is-drawing-line,
body.is-tracing {
  overflow: hidden;
  overscroll-behavior: none;
  touch-action: none;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.app-shell {
  display: grid;
  grid-template-columns: minmax(280px, 360px) 1fr;
  gap: 20px;
  min-height: 100vh;
  padding: 20px;
}

.side-panel,
.main-panel {
  background: rgba(255, 255, 255, 0.86);
  border: 1px solid rgba(219, 230, 234, 0.86);
  box-shadow: var(--shadow);
}

.side-panel {
  border-radius: var(--radius);
  padding: 18px;
  overflow: auto;
}

.main-panel {
  border-radius: var(--radius);
  padding: 18px;
  min-width: 0;
}

.brand-block,
.top-bar,
.section-title-row,
.action-row,
.current-child,
.profile-pill,
.bar-label {
  display: flex;
  align-items: center;
}

.brand-block {
  gap: 12px;
  margin-bottom: 18px;
}

.brand-mark {
  width: 86px;
  height: 86px;
  flex: 0 0 auto;
  border-radius: var(--radius);
  background: #ffffff;
  object-fit: contain;
  box-shadow: 0 10px 20px rgba(30, 56, 72, 0.12);
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--teal-dark);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: clamp(1.75rem, 4vw, 2.6rem);
}

h2 {
  margin-bottom: 0;
  font-size: 1.55rem;
}

h3 {
  margin-bottom: 12px;
  font-size: 1.05rem;
}

.profile-card,
.voice-card,
.activity-panel,
.mini-panel,
.progress-dashboard,
.topic-section,
.quick-progress {
  border: 1px solid var(--line);
  background: var(--panel);
  border-radius: var(--radius);
}

.profile-card {
  padding: 14px;
}

.voice-card {
  margin-top: 14px;
  padding: 14px;
}

.section-title-row {
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 12px;
}

.icon-button,
.tab-button,
.primary-button,
.secondary-button,
.danger-button,
.profile-pill,
.profile-delete,
.choice-button,
.swatch-button {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  color: var(--ink);
}

.icon-button {
  display: grid;
  place-items: center;
  width: 56px;
  height: 56px;
}

.profile-form {
  display: grid;
  gap: 12px;
}

label,
legend {
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 700;
}

input {
  width: 100%;
  margin-top: 6px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 11px 12px;
  color: var(--ink);
  background: #fff;
}

select {
  width: 100%;
  margin-top: 6px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 11px 12px;
  color: var(--ink);
  background: #fff;
}

fieldset {
  margin: 0;
  padding: 0;
  border: 0;
}

.swatch-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
  margin-top: 8px;
}

.swatch-button {
  aspect-ratio: 1;
  min-width: 0;
  padding: 0;
  border-width: 2px;
  overflow: hidden;
  background: #ffffff;
}

.swatch-button.is-selected {
  outline: 3px solid rgba(29, 138, 155, 0.24);
  border-color: var(--teal);
}

.avatar-swatch img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: inherit;
}

.primary-button,
.secondary-button,
.tab-button {
  min-height: 64px;
  padding: 12px 20px;
  font-weight: 800;
  font-size: 1.1rem;
}

.primary-button {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  border-color: var(--teal);
  background: var(--teal);
  color: #fff;
}

.secondary-button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.danger-button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 64px;
  padding: 12px 20px;
  border-color: #ffd1ca;
  background: #fff0ee;
  color: #a23828;
  font-weight: 800;
}

.profile-list {
  display: grid;
  gap: 8px;
  margin-top: 14px;
}

.parent-note {
  margin-top: 16px;
  padding: 14px;
  border: 1px solid rgba(255, 217, 90, 0.72);
  border-radius: var(--radius);
  background: #fff7d6;
  color: var(--ink);
}

.parent-note h3 {
  margin: 0 0 8px;
  color: var(--teal-dark);
  font-size: 1rem;
}

.parent-note p {
  margin: 0;
  color: #415466;
  font-size: 0.9rem;
  line-height: 1.45;
}

.parent-note p + p {
  margin-top: 8px;
}

.app-footnote {
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  text-align: center;
}

.app-footnote p,
.app-footnote strong {
  display: block;
  margin: 0;
  line-height: 1.35;
}

.app-footnote p {
  font-size: 0.82rem;
}

.app-footnote strong {
  margin: 3px 0;
  color: var(--teal-dark);
  font-size: 0.92rem;
  font-weight: 900;
  letter-spacing: 0.04em;
}

.profile-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 56px;
  gap: 8px;
  align-items: stretch;
}

.profile-pill {
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  padding: 9px;
  text-align: left;
}

.profile-delete {
  display: grid;
  place-items: center;
  width: 56px;
  padding: 0;
  color: #a23828;
  background: #fff0ee;
  border-color: #ffd1ca;
}

.profile-pill.is-active {
  border-color: var(--teal);
  background: #e8f7f9;
}

.avatar {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  color: #fff;
  font-weight: 900;
  overflow: hidden;
  flex: 0 0 auto;
}

.avatar-image {
  position: relative;
  border: 2px solid rgba(255, 255, 255, 0.9);
}

.avatar-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.avatar-initials {
  position: absolute;
  inset: 0;
  display: none;
  place-items: center;
}

.profile-meta {
  flex: 1;
  min-width: 0;
}

.profile-meta strong,
.profile-meta span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.profile-meta span {
  color: var(--muted);
  font-size: 0.84rem;
}

.top-bar {
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.top-actions {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

.current-child {
  gap: 10px;
  min-width: 0;
}

.current-child p {
  margin-bottom: 2px;
  color: var(--muted);
}

.current-child strong {
  display: block;
  font-size: 1.1rem;
}

.star-meter {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 96px;
  justify-content: center;
  border-radius: var(--radius);
  padding: 9px 12px;
  background: #fff5cb;
  color: #8a5f00;
  font-size: 1.2rem;
}

.star-meter svg {
  fill: var(--yellow);
  stroke: #a06c00;
}

.logout-button {
  text-decoration: none;
  min-width: 96px;
  min-height: 44px;
  padding: 8px 9px;
  font-size: 1.1rem;
}

body.is-abc-view .star-meter svg {
  display: none;
}

.module-tabs {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(108px, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}

/* SUSUNAN BUTANG MODUL BERGAMBAR */
.module-tabs {
  align-items: center;
}


.tab-button {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
}

.tab-button.is-active {
  border-color: var(--teal);
  background: var(--teal);
  color: #fff;
}

.view {
  display: none;
  scroll-margin-top: 16px;
}

.view.is-active {
  display: block;
}

.learning-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 260px;
  gap: 16px;
}

.activity-panel,
.mini-panel,
.progress-dashboard,
.topic-section,
.quick-progress {
  padding: 18px;
}

.home-layout {
  display: grid;
  gap: 16px;
}

.home-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 220px;
  gap: 16px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px;
  background:
    linear-gradient(120deg, rgba(255, 217, 90, 0.34), rgba(77, 157, 224, 0.18)),
    #ffffff;
}

.home-hero h2 {
  font-size: clamp(2rem, 6vw, 4rem);
}

.home-copy {
  max-width: 44ch;
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 1.08rem;
  font-weight: 700;
  line-height: 1.45;
}

.hero-art {
  display: grid;
  place-items: center;
}

.hero-art img {
  width: min(100%, 220px);
  height: auto;
  border-radius: var(--radius);
  object-fit: contain;
  box-shadow: 0 18px 34px rgba(30, 56, 72, 0.18);
}

.topic-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.topic-card {
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 116px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  background: #fbfdff;
  color: var(--ink);
  text-align: left;
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1), background 0.2s ease, border-color 0.2s ease;
}

.topic-card:hover,
.topic-card:focus-visible,
.topic-card:active {
  transform: scale(1.03);
  background: #27F5BE;
  border-color: #27F5BE;
}

.topic-card:hover small,
.topic-card:focus-visible small,
.topic-card:active small {
  color: #173042;
}

.topic-icon {
  display: grid;
  place-items: center;
  width: 68px;
  height: 68px;
  flex: 0 0 auto;
  border-radius: var(--radius);
  color: #173042;
  font-size: 2.1rem;
  font-weight: 900;
}

.topic-letter {
  background: var(--yellow);
}

.topic-number {
  background: #bcebd1;
}

.topic-lowercase {
  background: #bfe7ff;
  font-size: 1.55rem;
}

.topic-tracing {
  background: #d8d1ff;
  font-size: 1.55rem;
}

.topic-animal {
  background: #ffe0a8;
  font-size: 1.45rem;
}

.topic-card strong,
.topic-card small {
  display: block;
}

.topic-card strong {
  margin-bottom: 6px;
  font-size: 1.08rem;
}

.topic-card small {
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 700;
  line-height: 1.35;
}

.quick-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(112px, 1fr));
  gap: 12px;
}

.quick-stats article {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  background: #fffaf0;
}

.quick-stats span {
  display: block;
  color: var(--muted);
  font-weight: 800;
}

.quick-stats strong {
  display: block;
  margin-top: 8px;
  font-size: 2rem;
}

.question-head {
  margin-bottom: 18px;
}

.letter-stage,
.count-stage,
.tracing-stage {
  min-height: 238px;
  border: 1px dashed #c5d5db;
  border-radius: var(--radius);
  background:
    linear-gradient(90deg, rgba(255, 122, 102, 0.12), transparent),
    linear-gradient(180deg, #ffffff, #f2fbfd);
}

.letter-stage {
  display: grid;
  place-items: center;
}

.letter-stage span {
  display: grid;
  place-items: center;
  width: min(52vw, 210px);
  height: min(52vw, 210px);
  max-width: 100%;
  border-radius: 50%;
  background: var(--yellow);
  box-shadow: inset 0 -10px 0 rgba(138, 95, 0, 0.12);
  color: #174255;
  font-size: clamp(5rem, 18vw, 9.5rem);
  font-weight: 900;
  line-height: 1;
}

.lowercase-stage span {
  background: #bfe7ff;
  box-shadow: inset 0 -10px 0 rgba(23, 101, 117, 0.12);
  text-transform: uppercase;
}

.abc-focus {
  display: grid;
  justify-items: center;
  gap: 18px;
  align-items: center;
  margin-bottom: 16px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #f2fbfd;
}

.abc-focus img {
  display: block;
  width: min(100%, 260px);
  aspect-ratio: 1;
  object-fit: contain;
  border-radius: var(--radius);
  background: #fff;
}

.abc-focus small {
  display: block;
  color: var(--muted);
  font-weight: 800;
  text-align: center;
}

.abc-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(84px, 1fr));
  gap: 10px;
}

.abc-letter-card {
  display: grid;
  place-items: center;
  min-height: 118px;
  padding: 8px;
  background: #fff;
  color: var(--ink);
  font-weight: 900;
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1), border-color 0.2s ease, background 0.2s ease;
}

.abc-letter-card:hover,
.abc-letter-card.is-active {
  transform: scale(1.05);
  border-color: #27F5BE;
  background: #27F5BE;
}

.abc-letter-card img {
  width: min(100%, 96px);
  height: 96px;
  object-fit: contain;
  border-radius: 6px;
  background: #f8fcfd;
}

.syllable-focus {
  display: grid;
  gap: 8px;
  margin-bottom: 14px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #f2fbfd;
  text-align: center;
}

.syllable-focus span {
  color: var(--muted);
  font-weight: 900;
}

.syllable-focus strong {
  color: var(--ink);
  font-size: clamp(2rem, 7vw, 3.8rem);
  font-weight: 900;
  letter-spacing: 0;
  line-height: 1;
}

.syllable-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(132px, 1fr));
  gap: 12px;
}

.syllable-card {
  display: grid;
  min-height: 170px;
  gap: 8px;
  justify-items: center;
  align-content: center;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  color: var(--ink);
  cursor: pointer;
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1), border-color 0.2s ease, background 0.2s ease;
}

.syllable-card:hover,
.syllable-card:focus-visible,
.syllable-card:active {
  transform: scale(1.03);
  border-color: #27F5BE;
  background: #27F5BE;
}

.syllable-visual {
  display: grid;
  place-items: center;
  width: 96px;
  height: 96px;
  overflow: hidden;
  border-radius: var(--radius);
  background: #f7fbfc;
}

.syllable-visual img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.syllable-icon {
  font-size: 3.4rem;
  line-height: 1;
}

.syllable-card strong {
  font-size: 1.4rem;
  font-weight: 900;
  line-height: 1;
}

.syllable-card small {
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 800;
}

.syllable-card:hover small,
.syllable-card:focus-visible small,
.syllable-card:active small {
  color: #173042;
}

.count-stage {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(74px, 1fr));
  align-content: center;
  gap: 14px;
  padding: 20px;
}

.count-question {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 12px;
  font-size: clamp(1.15rem, 3vw, 1.6rem);
  font-weight: 900;
  color: var(--ink);
}

.count-question-image {
  width: 52px;
  height: 52px;
  object-fit: contain;
}

.tracing-toolbar {
  display: grid;
  grid-template-columns: minmax(160px, 1fr) auto;
  gap: 12px;
  align-items: end;
  margin-bottom: 14px;
}

.tracing-stage {
  position: relative;
  min-height: clamp(360px, 62vh, 560px);
  padding: 10px;
  background:
    linear-gradient(90deg, rgba(117, 103, 217, 0.1), transparent),
    #ffffff;
  max-width: 100%;
  overflow: hidden;
}

.tracing-stage canvas {
  display: block;
  width: 100%;
  max-width: 100%;
  height: clamp(360px, 62vh, 560px);
  border-radius: var(--radius);
  background: #f8fcfd;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

.tracing-touch-layer {
  position: absolute;
  inset: 10px;
  z-index: 2;
  border-radius: var(--radius);
  cursor: crosshair;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

.animal-game {
  position: relative;
  display: grid;
  grid-template-columns: minmax(120px, 172px) minmax(120px, 172px);
  justify-content: center;
  align-items: start;
  gap: clamp(54px, 14vw, 150px);
  max-width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  overscroll-behavior-x: contain;
  padding-bottom: 4px;
}

.animal-game > div {
  min-width: 0;
}

.animal-game h3 {
  margin-bottom: 10px;
}

.animal-lines {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 2;
}

.animal-lines path {
  fill: none;
  stroke: var(--green);
  stroke-width: 7;
  stroke-linecap: round;
  filter: drop-shadow(0 5px 8px rgba(67, 184, 131, 0.26));
}

.animal-lines path.is-draft {
  stroke: var(--teal);
  stroke-dasharray: 12 10;
  filter: drop-shadow(0 5px 8px rgba(29, 138, 155, 0.24));
}

.animal-source-grid,
.animal-shadow-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

.animal-card,
.animal-shadow {
  position: relative;
  display: grid;
  place-items: center;
  gap: 8px;
  min-height: 154px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px;
  background: #ffffff;
  color: var(--ink);
  font-weight: 900;
  touch-action: none;
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1), border-color 0.2s ease, background 0.2s ease, opacity 0.2s ease;
}

.animal-card:hover,
.animal-shadow:hover {
  transform: scale(1.03);
  border-color: var(--teal);
}

.animal-card.is-selected {
  border-color: var(--teal);
  background: #e8f7f9;
}

.animal-card.is-matched {
  opacity: 0.42;
}

.animal-audio-button {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 4;
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border: 1px solid rgba(29, 138, 155, 0.28);
  border-radius: 999px;
  background: #ffffff;
  color: var(--teal-dark);
  box-shadow: 0 6px 14px rgba(30, 56, 72, 0.1);
}

.animal-audio-button svg {
  width: 18px;
  height: 18px;
}

.animal-audio-button:hover,
.animal-audio-button:focus-visible,
.animal-audio-button.is-playing-audio {
  background: var(--yellow);
  border-color: var(--yellow);
  color: var(--ink);
}

.animal-shadow {
  background: #f4f8fa;
}

.animal-shadow.is-correct {
  border-color: var(--green);
  background: #e8f7ed;
}

.animal-shadow.is-wrong {
  border-color: var(--coral);
  background: #fff0ee;
}

.animal-svg,
.animal-image {
  width: min(100%, 104px);
  height: 104px;
}

.animal-svg {
  stroke: rgba(23, 48, 66, 0.16);
  stroke-width: 2;
}

.animal-image {
  display: block;
  object-fit: contain;
  border-radius: 10px;
}

.animal-generated-shadow {
  filter: brightness(0) saturate(0);
  opacity: 0.76;
}

.playground-question {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin: 0 0 14px;
  font-size: 1.35rem;
  font-weight: 900;
  color: var(--teal-dark);
}

.playground-question-image {
  width: 52px;
  height: 52px;
  object-fit: contain;
}

.playground-scene {
  position: relative;
  min-height: 520px;
  overflow: hidden;
  border: 3px solid #b7df88;
  border-radius: var(--radius);
  background:
    linear-gradient(#92ddff 0 42%, transparent 42%),
    linear-gradient(#7ed957 42%, #48b86b 100%);
  box-shadow: inset 0 -26px 0 rgba(34, 128, 75, 0.18);
  touch-action: none;
  user-select: none;
}

.playground-scene::before,
.playground-scene::after {
  content: "";
  position: absolute;
  left: -8%;
  right: -8%;
  bottom: 34px;
  height: 68px;
  background: rgba(255, 255, 255, 0.42);
  border-radius: 50%;
}

.playground-scene::after {
  bottom: -26px;
  height: 92px;
  background: rgba(255, 217, 90, 0.42);
}

.playground-sun {
  position: absolute;
  top: 28px;
  right: 34px;
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: #ffd95a;
  box-shadow: 0 0 0 14px rgba(255, 217, 90, 0.28);
}

.playground-tree {
  position: absolute;
  bottom: 44px;
  width: 40px;
  height: 92px;
  border-radius: 18px 18px 4px 4px;
  background: #9b6232;
}

.playground-tree::before {
  content: "";
  position: absolute;
  left: 50%;
  top: -58px;
  width: 118px;
  height: 92px;
  border-radius: 50%;
  background: #2fb36a;
  transform: translateX(-50%);
  box-shadow:
    -32px 12px 0 #43b883,
    32px 10px 0 #35a864;
}

.tree-left {
  left: 34px;
}

.tree-right {
  right: 44px;
  transform: scale(0.86);
}

.playground-circle {
  position: absolute;
  z-index: 2;
  left: 50%;
  top: 52%;
  display: grid;
  place-items: center;
  width: 240px;
  height: 240px;
  border: 7px dashed #ffffff;
  border-radius: 50%;
  background: rgba(39, 245, 190, 0.22);
  color: #176575;
  font-size: 1.15rem;
  font-weight: 900;
  text-transform: uppercase;
  transform: translate(-50%, -50%);
  box-shadow:
    0 18px 28px rgba(23, 101, 117, 0.18),
    inset 0 0 0 5px rgba(67, 184, 131, 0.2);
}

.playground-animals {
  position: absolute;
  inset: 0;
  z-index: 4;
}

.playground-animal {
  position: absolute;
  z-index: 6;
  display: grid;
  place-items: center;
  width: 88px;
  height: 88px;
  padding: 7px;
  border: 3px solid #ffffff;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 12px 20px rgba(23, 48, 66, 0.18);
  touch-action: none;
  transition: box-shadow 0.2s ease, border-color 0.2s ease, transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.playground-animal img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  pointer-events: none;
}

.playground-animal:hover,
.playground-animal:focus-visible {
  border-color: #27F5BE;
  box-shadow: 0 14px 24px rgba(23, 48, 66, 0.24);
  transform: scale(1.05);
}

.playground-animal.is-dragging {
  z-index: 12;
  border-color: #27F5BE;
  box-shadow: 0 20px 32px rgba(23, 48, 66, 0.28);
  transition: none;
}

.playground-animal.is-in-circle {
  border-color: var(--green);
  background: #f3fff8;
}

.object-match-board {
  position: relative;
  display: grid;
  grid-template-columns: minmax(120px, 172px) minmax(120px, 172px);
  justify-content: center;
  align-items: start;
  gap: clamp(54px, 14vw, 150px);
  max-width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  overscroll-behavior-x: contain;
  padding-bottom: 4px;
}

.object-match-board > div {
  min-width: 0;
}

.object-match-board h3 {
  margin-bottom: 10px;
}

.object-lines {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 2;
}

.object-lines path {
  fill: none;
  stroke: var(--green);
  stroke-width: 7;
  stroke-linecap: round;
  filter: drop-shadow(0 5px 8px rgba(67, 184, 131, 0.26));
}

.object-lines path.is-draft {
  stroke: var(--teal);
  stroke-dasharray: 12 10;
  filter: drop-shadow(0 5px 8px rgba(29, 138, 155, 0.24));
}

.object-column {
  display: grid;
  gap: 12px;
}

.object-card,
.object-name-card {
  position: relative;
  z-index: 3;
  display: grid;
  place-items: center;
  min-height: 154px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px;
  background: #ffffff;
  color: var(--ink);
  font-weight: 900;
  touch-action: none;
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1), border-color 0.2s ease, background 0.2s ease, opacity 0.2s ease;
}

.object-card:hover,
.object-card:focus-visible,
.object-name-card:hover,
.object-name-card:focus-visible {
  transform: scale(1.03);
  background: #27F5BE;
  border-color: #27F5BE;
}

.object-card.is-selected {
  border-color: var(--teal);
  background: #e8f7f9;
}

.object-card.is-matched,
.object-name-card.is-matched {
  border-color: var(--green);
  background: #e8f7ed;
}

.object-name-card.is-wrong {
  border-color: var(--coral);
  background: #fff0ee;
}

.object-card img {
  display: block;
  width: min(100%, 120px);
  height: 104px;
  object-fit: contain;
}

.object-name-card {
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  min-height: 154px;
  font-size: 1.1rem;
  text-align: center;
}

.object-name-text {
  min-width: 0;
}

.object-audio-button {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border: 1px solid rgba(29, 138, 155, 0.28);
  border-radius: 999px;
  background: #ffffff;
  color: var(--teal-dark);
  box-shadow: 0 6px 14px rgba(30, 56, 72, 0.1);
}

.object-audio-button svg {
  width: 20px;
  height: 20px;
}

.object-audio-button:hover,
.object-audio-button:focus-visible,
.object-audio-button.is-playing-audio {
  background: var(--yellow);
  border-color: var(--yellow);
  color: var(--ink);
}

.combine-board {
  --combine-link-gap: clamp(18px, 4%, 56px);
  --combine-column-gap: 12px;
  --combine-row-gap: 14px;
  --combine-gap-total: 36px;
  --combine-card-size: clamp(92px, 11vw, 152px);
  position: relative;
  display: grid;
  grid-template-columns: var(--combine-card-size) var(--combine-card-size) var(--combine-link-gap) var(--combine-card-size);
  justify-content: start;
  align-items: start;
  column-gap: var(--combine-column-gap);
  max-width: 100%;
  overflow-x: visible;
  overflow-y: visible;
  overscroll-behavior-x: contain;
  padding-bottom: 4px;
}

.combine-second-wrap {
  grid-column: 4;
}

.combine-column {
  display: grid;
  grid-template-rows: auto 1fr;
  width: var(--combine-card-size);
  min-width: 0;
}

.combine-column h3 {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  margin: 0 0 var(--combine-row-gap);
  color: var(--muted);
  font-size: clamp(0.78rem, 1.5vw, 1rem);
  font-weight: 900;
  line-height: 1.1;
  text-align: center;
  white-space: nowrap;
}

.combine-lines {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 2;
}

.combine-lines path {
  fill: none;
  stroke: var(--green);
  stroke-width: 7;
  stroke-linecap: round;
  filter: drop-shadow(0 5px 8px rgba(67, 184, 131, 0.26));
}

.combine-lines path.is-draft {
  stroke: var(--teal);
  stroke-dasharray: 12 10;
  filter: drop-shadow(0 5px 8px rgba(29, 138, 155, 0.24));
}

.combine-image-column,
.combine-first-column,
.combine-second-column {
  display: flex;
  flex-direction: column;
  gap: var(--combine-row-gap);
}

.combine-image-card,
.combine-first-card,
.combine-second-card {
  position: relative;
  z-index: 3;
  display: grid;
  place-items: center;
  width: var(--combine-card-size);
  height: var(--combine-card-size);
  flex: 0 0 var(--combine-card-size);
  min-height: 0;
  max-width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 10px;
  overflow: hidden;
  background: #ffffff;
  color: var(--ink);
  font-weight: 900;
  line-height: 1;
  text-align: center;
  touch-action: none;
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1), border-color 0.2s ease, background 0.2s ease, opacity 0.2s ease;
}

.combine-first-card,
.combine-second-card {
  font-size: clamp(1.8rem, 4.8vw, 2.8rem);
  cursor: pointer;
}

.combine-first-card:hover,
.combine-first-card:focus-visible,
.combine-second-card:hover,
.combine-second-card:focus-visible {
  transform: scale(1.03);
  background: #27F5BE;
  border-color: #27F5BE;
}

.combine-first-card.is-selected {
  border-color: var(--teal);
  background: #e8f7f9;
}

.combine-first-card.is-matched,
.combine-second-card.is-matched {
  border-color: var(--green);
  background: #e8f7ed;
}

.combine-second-card.is-wrong {
  border-color: var(--coral);
  background: #fff0ee;
}

.combine-image-card img {
  display: block;
  width: min(100%, calc(var(--combine-card-size) - 20px));
  height: calc(var(--combine-card-size) - 20px);
  object-fit: contain;
}

.tracing-subinstruction {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: clamp(0.82rem, 2vw, 0.95rem);
  font-weight: 800;
  line-height: 1.35;
}

.coloring-toolbar {
  display: grid;
  gap: 14px;
  margin-bottom: 14px;
}

.coloring-toolbar label {
  max-width: 280px;
}

.brush-size-control {
  display: grid;
  gap: 8px;
}

.brush-size-control span {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.brush-size-control strong {
  color: var(--teal-dark);
}

.brush-size-control input {
  width: min(280px, 100%);
  accent-color: var(--teal);
}

.eraser-button.is-active {
  border-color: #27F5BE;
  background: #27F5BE;
  color: var(--ink);
}

.color-palette {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(42px, 42px));
  gap: 10px;
}

.custom-color-picker {
  position: relative;
  display: inline-flex;
  align-items: center;
  width: fit-content;
  max-width: 100%;
  min-height: 42px;
  padding: 0 14px;
  border: 2px solid var(--line);
  border-radius: 999px;
  background: #ffffff;
  color: var(--ink);
  font-weight: 900;
  line-height: 1;
  cursor: pointer;
  overflow: hidden;
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1), border-color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
}

.custom-color-picker.is-selected {
  border-color: #27F5BE;
  background: #27F5BE;
  box-shadow: 0 0 0 4px rgba(29, 138, 155, 0.18);
}

.custom-color-picker input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
  opacity: 0;
}

.custom-color-picker span {
  position: relative;
  z-index: 1;
  pointer-events: none;
}

.custom-color-picker input::-webkit-color-swatch-wrapper {
  padding: 0;
}

.custom-color-picker input::-webkit-color-swatch {
  border: 0;
  border-radius: 50%;
}

.custom-color-picker input::-moz-color-swatch {
  border: 0;
  border-radius: 50%;
}

.color-swatch {
  width: 42px;
  height: 42px;
  border: 3px solid #ffffff;
  border-radius: 50%;
  box-shadow: 0 0 0 1px var(--line), 0 7px 14px rgba(30, 56, 72, 0.12);
  cursor: pointer;
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.2s ease;
}

.color-swatch.is-selected {
  box-shadow: 0 0 0 4px var(--teal), 0 9px 18px rgba(29, 138, 155, 0.22);
  transform: scale(1.1);
}

.coloring-stage {
  display: grid;
  place-items: center;
  min-height: 360px;
  border: 1px dashed #c5d5db;
  border-radius: var(--radius);
  padding: 18px;
  background:
    linear-gradient(120deg, rgba(255, 217, 90, 0.18), transparent),
    linear-gradient(180deg, #ffffff, #f2fbfd);
}

.coloring-svg {
  width: min(100%, 460px);
  height: auto;
  touch-action: manipulation;
}

.coloring-canvas-wrap {
  position: relative;
  width: min(100%, 520px);
}

.coloring-base-image,
.coloring-draw-canvas,
.coloring-outline-image {
  display: block;
  width: 100%;
  height: auto;
}

.coloring-base-image {
  position: relative;
  z-index: 1;
  pointer-events: none;
  user-select: none;
}

.coloring-draw-canvas {
  position: absolute;
  inset: 0;
  z-index: 2;
  touch-action: none;
  cursor: crosshair;
}

.coloring-outline-image {
  position: absolute;
  inset: 0;
  z-index: 3;
  pointer-events: none;
  user-select: none;
}

.coloring-part {
  cursor: pointer;
  transition: fill 0.2s ease, opacity 0.2s ease, transform 0.2s ease;
}

.coloring-part:hover,
.coloring-part:focus {
  opacity: 0.86;
}

.coloring-outline {
  fill: none;
  stroke: #173042;
  stroke-width: 5;
  stroke-linecap: round;
  stroke-linejoin: round;
  pointer-events: none;
}

.coloring-detail {
  fill: #173042;
  pointer-events: none;
}

.story-reader {
  display: grid;
  gap: 14px;
}

.story-stage {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 420px;
  overflow: hidden;
  border: 3px solid #bdebdc;
  border-radius: var(--radius);
  background:
    linear-gradient(rgba(255, 255, 255, 0.38), rgba(255, 255, 255, 0.28)),
    var(--story-bg, #e8f7f9);
  background-position: center;
  background-size: cover;
  box-shadow: inset 0 -18px 0 rgba(29, 138, 155, 0.08);
}

.story-scene-image {
  display: block;
  width: min(100%, 680px);
  max-height: 440px;
  object-fit: contain;
  border-radius: 6px;
  filter: drop-shadow(0 18px 28px rgba(23, 48, 66, 0.18));
}

.story-character-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.story-character {
  position: absolute;
  display: grid;
  place-items: center;
  width: 140px;
  height: 140px;
  padding: 0;
  border: 0;
  background: transparent;
  pointer-events: auto;
  cursor: default;
  transform: translate(-50%, -50%);
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1), filter 0.2s ease;
}

.story-character:focus-visible,
.story-character.is-hovering,
.story-character.is-speaking {
  filter: drop-shadow(0 0 14px rgba(39, 245, 190, 0.82));
  transform: translate(-50%, -50%) scale(1.08);
}

.story-character.is-hovering {
  cursor: pointer;
}

.story-character img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  pointer-events: none;
  filter: drop-shadow(0 12px 18px rgba(23, 48, 66, 0.18));
}

.story-copy {
  display: grid;
  gap: 6px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #ffffff;
}

.story-copy strong {
  font-size: 1.3rem;
}

.story-copy p {
  margin: 0;
  color: var(--muted);
  font-weight: 800;
  line-height: 1.45;
}

.story-copy span {
  color: var(--teal-dark);
  font-size: 0.94rem;
  font-weight: 900;
}

.story-actions {
  justify-content: center;
}

.shape-token,
.count-item {
  display: grid;
  place-items: center;
  min-height: 58px;
}

.count-item img {
  width: min(100%, 78px);
  height: 78px;
  object-fit: contain;
}

.shape-token svg {
  width: 54px;
  height: 54px;
  stroke: rgba(23, 48, 66, 0.28);
  stroke-width: 1.5;
}

.action-row {
  flex-wrap: wrap;
  gap: 10px;
  margin: 14px 0;
}

.choice-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.number-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.choice-button {
  min-height: 96px;
  padding: 16px;
  background: #fff;
  font-size: clamp(2rem, 6vw, 3rem);
  font-weight: 900;
  color: var(--ink);
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1), border-color 0.2s ease, background 0.2s ease;
}

.choice-button:hover,
.choice-button:active,
.profile-pill:hover,
.profile-delete:hover,
.secondary-button:hover,
.danger-button:hover,
.icon-button:hover,
.tab-button:hover {
  transform: scale(1.05);
  border-color: var(--teal);
}

.primary-button:hover,
.primary-button:active {
  transform: scale(1.05); 
  background: var(--teal-dark);
}

#letter-options .choice-button:hover:not(.is-correct):not(.is-wrong) {
  background: #27F5BE;
  border-color: #27F5BE;
}

#lowercase-options .choice-button:hover:not(.is-correct):not(.is-wrong) {
  background: #27F5BE;
  border-color: #27F5BE;
}

#number-options .choice-button:hover:not(.is-correct):not(.is-wrong) {
  background: #27F5BE;
  border-color: #27F5BE;
}

.sequence-summary {
  display: grid;
  gap: 8px;
  margin-bottom: 14px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #f2fbfd;
}

.sequence-summary span {
  color: var(--muted);
  font-weight: 900;
}

.sequence-summary strong {
  font-size: clamp(1.2rem, 3vw, 1.7rem);
}

.sequence-answer {
  display: grid;
  grid-template-columns: repeat(5, minmax(54px, 1fr));
  gap: 10px;
  min-height: 82px;
  margin-bottom: 14px;
  padding: 12px;
  border: 2px dashed #b8cbd3;
  border-radius: var(--radius);
  background: #ffffff;
}

.sequence-answer.is-correct {
  border-color: var(--green);
  background: #eefcf5;
}

.sequence-answer.is-wrong {
  border-color: var(--coral);
  background: #fff0ee;
}

.sequence-slot,
.sequence-number {
  display: grid;
  place-items: center;
  min-height: 58px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  font-weight: 900;
  font-size: clamp(1.4rem, 5vw, 2.25rem);
}

.sequence-slot {
  color: #e3ebef;
  background: #f7fbfc;
}

.sequence-slot.is-filled {
  color: #fff;
  background: var(--teal);
  border-color: var(--teal);
}

.sequence-options {
  display: grid;
  grid-template-columns: repeat(5, minmax(54px, 1fr));
  gap: 10px;
}

.sequence-number {
  color: var(--ink);
  background: #fff;
  cursor: pointer;
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1), border-color 0.2s ease, background 0.2s ease;
}

.sequence-number:hover:not(:disabled) {
  background: #27F5BE;
  border-color: #27F5BE;
  transform: scale(1.05);
}

.sequence-number.is-used,
.sequence-number:disabled {
  color: #8da0aa;
  background: #eef4f6;
  transform: none;
}

.voice-form {
  display: grid;
  gap: 12px;
}

.voice-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.voice-status {
  min-height: 40px;
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 700;
  line-height: 1.35;
}

.choice-button.is-correct {
  background: #e8f7ed;
  border-color: var(--green);
  transform: scale(1.08) rotate(3deg);
  box-shadow: 0 10px 20px rgba(67, 184, 131, 0.2);
}

.choice-button.is-wrong {
  background: #fff0ee;
  border-color: var(--coral);
  transform: scale(0.95);
}

.mini-panel {
  align-self: start;
}

.progress-ring {
  --value: 0;
  display: grid;
  place-items: center;
  width: 154px;
  height: 154px;
  margin: 8px auto 16px;
  border-radius: 50%;
  background: conic-gradient(var(--green) calc(var(--value) * 1%), #edf3f5 0);
  position: relative;
}

.progress-ring::after {
  content: "";
  position: absolute;
  width: 112px;
  height: 112px;
  border-radius: 50%;
  background: #fff;
}

.progress-ring span {
  position: relative;
  z-index: 1;
  font-size: 1.65rem;
  font-weight: 900;
}

.feedback {
  min-height: 48px;
  margin: 0;
  color: var(--muted);
  font-weight: 700;
  line-height: 1.4;
}

.progress-dashboard {
  max-width: 980px;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.stat-tile {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  background: #fbfdff;
}

.stat-label {
  display: block;
  min-height: 38px;
  color: var(--muted);
  font-weight: 800;
}

.stat-tile strong {
  display: block;
  margin-top: 8px;
  font-size: 2rem;
}

.progress-bars {
  display: grid;
  gap: 14px;
}

.bar-label {
  justify-content: space-between;
  margin-bottom: 8px;
  font-weight: 900;
}

.progress-bar {
  height: 16px;
  border-radius: 999px;
  background: #edf3f5;
  overflow: hidden;
}

.progress-bar span {
  display: block;
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--teal), var(--green));
  transition: width 0.25s ease;
}

.floating-main-button {
  position: fixed;
  right: 18px;
  bottom: 92px;
  z-index: 25;
  display: grid;
  place-items: center;
  width: 74px;
  height: 74px;
  border: 4px solid #ffffff;
  border-radius: 50%;
  background: #27F5BE;
  color: var(--ink);
  box-shadow: 0 18px 30px rgba(23, 48, 66, 0.24);
  font-size: 0.94rem;
  font-weight: 900;
}

.floating-main-button:hover,
.floating-main-button:focus-visible {
  transform: scale(1.06);
  background: var(--yellow);
}

@media (max-width: 560px) {
  .floating-main-button {
    right: 12px;
    bottom: 78px;
    width: 62px;
    height: 62px;
    border-width: 3px;
    font-size: 0.82rem;
  }
}

.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 20;
  max-width: min(360px, calc(100vw - 40px));
  border-radius: var(--radius);
  padding: 12px 14px;
  background: var(--ink);
  color: #fff;
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(8px);
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.toast.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.back-exit-modal {
  position: fixed;
  inset: 0;
  z-index: 70;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(18, 35, 47, 0.52);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s ease;
}

.back-exit-modal.is-visible {
  opacity: 1;
  pointer-events: auto;
}

.back-exit-dialog {
  width: min(360px, calc(100vw - 32px));
  border: 4px solid #ffffff;
  border-radius: 22px;
  padding: 24px 20px 20px;
  background: #ffffff;
  box-shadow: 0 24px 46px rgba(18, 35, 47, 0.28);
  text-align: center;
}

.back-exit-dialog h2 {
  margin: 0;
  color: var(--ink);
  font-size: 1.35rem;
  line-height: 1.25;
}

.back-exit-actions {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin-top: 18px;
}

.back-exit-actions button {
  min-width: 104px;
}

@media (max-width: 480px) {
  .back-exit-dialog {
    border-radius: 18px;
    padding: 22px 16px 18px;
  }

  .back-exit-dialog h2 {
    font-size: 1.18rem;
  }

  .back-exit-actions button {
    min-width: 92px;
  }
}

.account-bar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 14px;
  padding: 10px 20px;
  border-bottom: 1px solid rgba(219, 230, 234, 0.9);
  background: rgba(255, 255, 255, 0.94);
  color: var(--muted);
  font-size: 0.92rem;
}

.account-bar a {
  color: var(--teal-dark);
  font-weight: 800;
  text-decoration: none;
}

.auth-page {
  display: grid;
  place-items: center;
  padding: 24px;
}

.auth-card {
  width: min(440px, 100%);
  padding: 24px;
  border: 1px solid rgba(219, 230, 234, 0.92);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.92);
  box-shadow: var(--shadow);
}

.auth-logo {
  display: block;
  width: min(220px, 72%);
  margin: 0 auto 14px;
}

.auth-card h1 {
  margin: 0 0 16px;
  font-size: clamp(1.7rem, 5vw, 2.3rem);
}

.auth-form {
  display: grid;
  gap: 14px;
}

.auth-form label,
.auth-field {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-weight: 800;
}

.auth-form input,
.auth-success input,
.auth-field input {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 10px 12px;
  background: #fff;
  color: var(--ink);
}

.auth-alert,
.auth-error,
.auth-success {
  margin: 0 0 14px;
  padding: 12px;
  border-radius: var(--radius);
  font-weight: 800;
}

.auth-alert,
.auth-error {
  border: 1px solid #ffd1ca;
  background: #fff0ed;
  color: #9d2c1f;
}

.auth-success {
  display: grid;
  gap: 8px;
  border: 1px solid #bee8d2;
  background: #eefcf5;
  color: #176b47;
}

.auth-note {
  margin: 14px 0 0;
  color: var(--muted);
  line-height: 1.5;
}

.auth-note a,
.auth-link-button {
  color: var(--teal-dark);
  font-weight: 800;
  text-decoration: none;
}

.primary-button.auth-link-button,
.primary-button.auth-link-button:hover,
.primary-button.auth-link-button:focus-visible,
.primary-button.auth-link-button:active {
  color: #ffffff;
}

.confetti-pop {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  pointer-events: none;
  opacity: 0;
}

.confetti-pop.is-active {
  opacity: 1;
}

.confetti-burst {
  position: relative;
  display: grid;
  place-items: center;
  width: min(260px, 68vw);
  height: min(260px, 68vw);
  animation: popper-rise 1.05s ease-out both;
}

.correct-pop-image {
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter: drop-shadow(0 18px 24px rgba(23, 48, 66, 0.22));
}

@keyframes popper-rise {
  0% {
    opacity: 0;
    transform: translateY(26px) scale(0.72);
  }
  18% {
    opacity: 1;
    transform: translateY(0) scale(1.08);
  }
  68% {
    opacity: 1;
    transform: translateY(-10px) scale(1);
  }
  100% {
    opacity: 0;
    transform: translateY(-22px) scale(0.96);
  }
}

.empty-state {
  color: var(--muted);
  font-weight: 700;
  line-height: 1.4;
}

@media (max-width: 920px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .topic-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .learning-layout {
    grid-template-columns: 1fr;
  }

  .mini-panel {
    display: grid;
    grid-template-columns: minmax(140px, 180px) 1fr;
    gap: 12px;
    align-items: center;
  }

  .mini-panel h3 {
    grid-column: 1 / -1;
    margin-bottom: 0;
  }

  .progress-ring {
    width: 132px;
    height: 132px;
    margin: 0;
  }

  .progress-ring::after {
    width: 94px;
    height: 94px;
  }
}

@media (max-width: 640px) {
  .app-shell {
    padding: 10px;
  }

  .side-panel,
  .main-panel,
  .activity-panel,
  .mini-panel,
  .progress-dashboard {
    padding: 12px;
  }

  .top-bar,
  .brand-block {
    align-items: flex-start;
  }

  .top-bar {
    flex-direction: column;
  }

  .top-actions {
    width: 100%;
    justify-content: space-between;
  }

  .star-meter,
  .logout-button {
    flex: 1 1 0;
  }

  .module-tabs {
    /* Tukar grid supaya butang di telefon tersusun 2 atau 3 lajur */
    grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
    justify-items: center;
  }

  .choice-grid,
  .abc-grid,
  .number-grid,
  .stats-grid,
  .topic-grid,
  .quick-stats,
  .home-hero {
    grid-template-columns: 1fr;
  }

  .abc-focus {
    grid-template-columns: 1fr;
    text-align: center;
  }

  .abc-focus img {
    width: min(100%, 220px);
    margin: 0 auto;
  }

  .abc-letter-card {
    min-height: 104px;
  }

  .abc-letter-card img {
    width: min(100%, 86px);
    height: 86px;
  }

  .animal-game {
    grid-template-columns: minmax(96px, 132px) minmax(96px, 132px);
    gap: 28px;
  }

  .animal-source-grid,
  .animal-shadow-grid {
    grid-template-columns: 1fr;
  }

  .animal-card,
  .animal-shadow {
    min-height: 122px;
    padding: 10px;
  }

  .animal-svg,
  .animal-image {
    height: 82px;
  }

  .playground-scene {
    min-height: 460px;
  }

  .playground-circle {
    width: 210px;
    height: 210px;
  }

  .playground-animal {
    width: 74px;
    height: 74px;
  }

  .story-stage {
    min-height: 340px;
  }

  .story-scene-image {
    max-height: 340px;
  }

  .story-actions {
    justify-content: stretch;
  }

  .object-match-board {
    grid-template-columns: minmax(96px, 132px) minmax(96px, 132px);
    gap: 28px;
  }

  .combine-board {
    --combine-link-gap: clamp(16px, 5%, 28px);
    --combine-column-gap: 8px;
    --combine-row-gap: 12px;
    --combine-gap-total: 24px;
    --combine-card-size: clamp(72px, 18vw, 112px);
    grid-template-columns: var(--combine-card-size) var(--combine-card-size) var(--combine-link-gap) var(--combine-card-size);
  }

  .object-card,
  .object-name-card {
    min-height: 122px;
    padding: 10px;
  }

  .object-card img {
    width: min(100%, 96px);
    height: 82px;
  }

  .combine-image-card img {
    width: min(100%, calc(var(--combine-card-size) - 18px));
    height: calc(var(--combine-card-size) - 18px);
  }

  .object-name-card {
    font-size: 0.95rem;
  }

  .combine-first-card,
  .combine-second-card {
    font-size: clamp(1.45rem, 5vw, 2rem);
  }

  .animal-lines path,
  .object-lines path,
  .combine-lines path {
    stroke-width: 5;
  }

  .count-stage {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .mini-panel {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 380px) {
  .animal-game,
  .object-match-board {
    grid-template-columns: minmax(82px, 106px) minmax(82px, 106px);
    gap: 20px;
  }

  .combine-board {
    --combine-link-gap: clamp(10px, 4%, 16px);
    --combine-column-gap: 6px;
    --combine-row-gap: 10px;
    --combine-gap-total: 18px;
    --combine-card-size: clamp(58px, 22vw, 76px);
  }

  .animal-card,
  .animal-shadow,
  .object-card,
  .object-name-card {
    min-height: 104px;
    padding: 8px;
  }

  .animal-svg,
  .animal-image,
  .object-card img {
    height: 68px;
  }

  .combine-image-card img {
    width: min(100%, calc(var(--combine-card-size) - 16px));
    height: calc(var(--combine-card-size) - 16px);
  }

  .playground-scene {
    min-height: 430px;
  }

  .playground-circle {
    width: 176px;
    height: 176px;
    font-size: 0.95rem;
  }

  .playground-animal {
    width: 62px;
    height: 62px;
    padding: 5px;
  }

  .story-stage {
    min-height: 280px;
  }

  .story-character {
    width: 82px;
    height: 82px;
  }

  .combine-first-card,
  .combine-second-card {
    font-size: clamp(1.2rem, 5vw, 1.55rem);
  }
}

/* =========================================================
   FIX RESPONSIVE BUTANG BERGAMBAR
   Untuk Kenali Huruf ABC, Cari Huruf, Kenali Huruf Kecil,
   ABC & Suku Kata, Cantum 2 Suku Kata dan Kenali Nombor.
   ========================================================= */
.tab-button.image-tab {
  --image-tab-size: clamp(76px, 10vw, 118px);
  display: grid;
  place-items: center;
  width: var(--image-tab-size);
  height: var(--image-tab-size);
  min-width: 0;
  min-height: 0;
  padding: 0;
  border: 1px solid transparent;
  background: transparent;
  overflow: visible;
  position: relative;
  margin: 0 auto;
}

.tab-button.image-tab img {
  display: block;
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: var(--radius);
  box-shadow: 0 8px 16px rgba(30, 56, 72, 0.12);
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.2s ease;
}

.tab-button.image-tab img.is-missing {
  display: none;
}

.image-tab-label {
  display: none;
  place-items: center;
  width: 100%;
  min-height: 64px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #ffffff;
  color: var(--ink);
  font-size: 0.9rem;
  font-weight: 900;
  line-height: 1.1;
  text-align: center;
  box-shadow: 0 8px 16px rgba(30, 56, 72, 0.12);
}

.image-tab-label.is-visible {
  display: grid;
}

.tab-button.image-tab.is-active {
  background: transparent;
  border-color: transparent;
}

.tab-button.image-tab.is-active img {
  box-shadow: 0 0 0 4px var(--teal), 0 12px 24px rgba(29, 138, 155, 0.24);
}

.tab-button.image-tab.is-active .image-tab-label {
  border-color: var(--teal);
  box-shadow: 0 0 0 4px var(--teal), 0 12px 24px rgba(29, 138, 155, 0.24);
}

.tab-button.image-tab:hover img,
.tab-button.image-tab:focus-visible img,
.tab-button.image-tab:hover .image-tab-label,
.tab-button.image-tab:focus-visible .image-tab-label {
  transform: scale(1.04);
}

@media (max-width: 640px) {
  .module-tabs {
    grid-template-columns: repeat(auto-fit, minmax(82px, 1fr));
  }

  .tab-button.image-tab {
    --image-tab-size: clamp(68px, 22vw, 98px);
  }
}

@media (max-width: 380px) {
  .tab-button.image-tab {
    --image-tab-size: clamp(62px, 24vw, 86px);
  }
}


/* MODUL SURIH */
.tracing-toolbar {
  display: flex;
  justify-content: flex-start;
  align-items: center;
}

#clear-tracing-button,
#clear-number-tracing-button {
  flex: 0 0 auto;
  width: auto;
  min-width: 0;
}

.tracing-stage {
  min-height: 420px;
  background:
    linear-gradient(120deg, rgba(117, 103, 217, 0.08), transparent 38%),
    linear-gradient(180deg, #ffffff, #f8fcfd);
}

.tracing-stage canvas {
  height: 420px;
}

.tracing-letter-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(52px, 1fr));
  gap: 8px;
  margin-top: 14px;
}

.tracing-letter-button {
  min-height: 54px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  color: var(--ink);
  font-weight: 900;
  font-size: 1.15rem;
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1), border-color 0.2s ease, background 0.2s ease;
}

.tracing-letter-button:hover,
.tracing-letter-button:focus-visible {
  transform: scale(1.05);
  border-color: #27F5BE;
  background: #27F5BE;
}

.tracing-letter-button.is-active {
  border-color: var(--teal);
  background: #e8f7f9;
}

.tracing-letter-button.is-completed {
  border-color: var(--green);
  background: #eefcf5;
}

.tracing-letter-button.is-completed::after {
  content: " ✓";
  color: var(--green);
}

#speak-tracing-button {
  border-color: #bdebdc;
  background: #f3fff8;
}

@media (max-width: 720px) {
  .tracing-toolbar {
    display: flex;
    justify-content: flex-start;
  }

  .tracing-stage {
    min-height: 340px;
  }

  .tracing-stage canvas {
    height: 340px;
  }
}


/* STORY CHARACTER BUTTON UPDATE */
.story-stage {
  padding: 16px 62px;
  padding-bottom: 86px;
}

.story-frame-nav {
  position: absolute;
  top: 50%;
  z-index: 8;
  display: grid;
  place-items: center;
  width: 54px;
  height: 54px;
  border: 3px solid #ffffff;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.96);
  color: var(--teal-dark);
  box-shadow: 0 14px 26px rgba(23, 48, 66, 0.18);
  transform: translateY(-50%);
}

.story-frame-nav svg {
  width: 30px;
  height: 30px;
  stroke-width: 3;
}

.story-frame-nav:hover,
.story-frame-nav:focus-visible {
  border-color: #27F5BE;
  background: #ffffff;
  transform: translateY(-50%) scale(1.08);
}

.story-frame-nav:disabled {
  opacity: 0.38;
  transform: translateY(-50%);
}

.story-frame-nav-prev {
  left: 12px;
}

.story-frame-nav-next {
  right: 12px;
}

.story-play-frame-button {
  position: absolute;
  left: 50%;
  bottom: 18px;
  z-index: 10;
  min-width: 180px;
  justify-content: center;
  transform: translateX(-50%);
}

.story-play-frame-button:hover,
.story-play-frame-button:focus-visible {
  transform: translateX(-50%) translateY(-2px);
}

.story-character.story-character-button {
  position: absolute;
  right: 18px;
  bottom: 18px;
  left: auto;
  top: auto;
  z-index: 9;
  width: clamp(86px, 13vw, 126px);
  height: clamp(86px, 13vw, 126px);
  padding: 7px;
  border: 4px solid #ffffff;
  border-radius: 50%;
  background: #ffffff;
  cursor: pointer;
  box-shadow: 0 16px 28px rgba(23, 48, 66, 0.22);
  transform: none;
}

.story-character.story-character-button:nth-child(2) {
  right: clamp(112px, 17vw, 152px);
}

.story-character.story-character-button:nth-child(3) {
  right: clamp(206px, 30vw, 278px);
}

.story-character.story-character-button img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top center;
  border-radius: 50%;
  filter: none;
}

.story-character.story-character-button:hover,
.story-character.story-character-button:focus-visible,
.story-character.story-character-button.is-speaking {
  border-color: #27F5BE;
  filter: drop-shadow(0 0 14px rgba(39, 245, 190, 0.72));
  transform: scale(1.07);
}

@media (max-width: 760px) {
  .story-stage {
    padding: 12px 50px;
    padding-bottom: 154px;
    min-height: 360px;
  }

  .story-frame-nav {
    width: 44px;
    height: 44px;
  }

  .story-frame-nav-prev {
    left: 6px;
  }

  .story-frame-nav-next {
    right: 6px;
  }

  .story-character.story-character-button {
    width: 82px;
    height: 82px;
    right: 10px;
    bottom: 72px;
  }

  .story-character.story-character-button:nth-child(2) {
    right: 98px;
  }

  .story-character.story-character-button:nth-child(3) {
    right: 186px;
  }

  .story-play-frame-button {
    bottom: 14px;
    min-width: 150px;
  }
}

@media (max-width: 480px) {
  .story-stage {
    padding: 10px 42px;
    padding-bottom: 142px;
    min-height: 330px;
  }

  .story-character.story-character-button {
    width: 70px;
    height: 70px;
    right: 8px;
    bottom: 66px;
    padding: 5px;
    border-width: 3px;
  }

  .story-character.story-character-button:nth-child(2) {
    right: 84px;
  }

  .story-character.story-character-button:nth-child(3) {
    right: 160px;
  }

  .story-play-frame-button {
    bottom: 12px;
    min-width: 136px;
    padding-inline: 14px;
  }
}


/* Butang audio arahan modul */
.has-instruction-button {
  position: relative;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.instruction-audio-button {
  flex: 0 0 auto;
  min-height: 52px;
  padding: 10px 14px;
  border-color: #bdebdc;
  background: #e8f7f9;
  color: var(--teal-dark);
  box-shadow: 0 8px 18px rgba(29, 138, 155, 0.12);
}

.instruction-audio-button svg {
  width: 22px;
  height: 22px;
}

.instruction-audio-button.is-playing-audio {
  background: var(--yellow);
  border-color: #e1b935;
  color: #8a5f00;
}

.instruction-audio-button.is-playing-audio svg {
  animation: instruction-audio-pulse 0.72s ease-in-out infinite alternate;
}

@keyframes instruction-audio-pulse {
  from {
    transform: scale(1);
  }
  to {
    transform: scale(1.16);
  }
}

@media (max-width: 620px) {
  .has-instruction-button {
    flex-direction: column;
    align-items: stretch;
  }

  .instruction-audio-button {
    width: 100%;
    justify-content: center;
  }
}
