:root {
  color-scheme: light;
  --primary: #2563eb;
  --primary-dark: #1746a2;
  --secondary: #f59e0b;
  --accent: #ec4899;
  --mint: #10b981;
  --leaf: #15803d;
  --sky: #e0f2fe;
  --sun: #fde68a;
  --surface: #fffaf0;
  --surface-2: #ffffff;
  --ink: #172033;
  --muted: #526179;
  --line: #d7e3f7;
  --danger: #dc2626;
  --good: #047857;
  --shadow: 0 10px 0 rgba(23, 32, 51, 0.14), 0 18px 34px rgba(37, 99, 235, 0.12);
  --soft-shadow: 0 6px 0 rgba(23, 32, 51, 0.12), 0 12px 24px rgba(15, 23, 42, 0.10);
  --radius: 8px;
  --tap: 52px;
}

* {
  box-sizing: border-box;
}

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

body {
  min-height: 100dvh;
  margin: 0;
  overflow-x: hidden;
  color: var(--ink);
  font-family: "Baloo 2", "Comic Sans MS", "霞鹜文楷", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  font-size: 17px;
  line-height: 1.55;
  background:
    radial-gradient(circle at 16% 12%, rgba(253, 230, 138, 0.75) 0 72px, transparent 74px),
    linear-gradient(180deg, #dff7ff 0%, #eefdf4 46%, #fff4da 100%);
}

button,
input,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
  touch-action: manipulation;
}

button:focus-visible,
input:focus-visible,
textarea:focus-visible,
[tabindex]:focus-visible {
  outline: 4px solid rgba(236, 72, 153, 0.42);
  outline-offset: 3px;
}

.skip-link {
  position: fixed;
  left: 16px;
  top: 12px;
  z-index: 1000;
  transform: translateY(-160%);
  border: 3px solid var(--ink);
  border-radius: var(--radius);
  padding: 10px 14px;
  background: #fff;
  color: var(--ink);
  font-weight: 800;
}

.skip-link:focus {
  transform: translateY(0);
}

.app-shell {
  position: relative;
  width: min(100%, 1440px);
  min-height: 100dvh;
  margin: 0 auto;
  padding: clamp(14px, 2vw, 28px);
}

.screen {
  position: relative;
  z-index: 1;
}

.topbar {
  position: sticky;
  top: 10px;
  z-index: 20;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
  border: 3px solid rgba(23, 32, 51, 0.12);
  border-radius: var(--radius);
  padding: 10px;
  background: rgba(255, 255, 255, 0.86);
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.08);
  backdrop-filter: blur(10px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.brand-mark,
.icon-badge {
  display: inline-grid;
  place-items: center;
  width: 46px;
  height: 46px;
  flex: 0 0 auto;
  border: 3px solid rgba(23, 32, 51, 0.18);
  border-radius: var(--radius);
  background: #fff;
  box-shadow: 0 5px 0 rgba(23, 32, 51, 0.12);
}

.brand-title {
  margin: 0;
  font-size: clamp(1.08rem, 2.6vw, 1.55rem);
  line-height: 1.05;
}

.brand-subtitle {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 0.92rem;
  font-weight: 700;
}

.top-actions,
.stat-strip,
.button-row,
.chip-row,
.stage-nav,
.option-grid,
.lesson-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.stat-strip {
  justify-content: center;
}

.stat-pill,
.mini-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 44px;
  border: 2px solid rgba(23, 32, 51, 0.10);
  border-radius: var(--radius);
  padding: 7px 10px;
  background: #fff;
  color: var(--ink);
  font-weight: 800;
  box-shadow: 0 4px 0 rgba(23, 32, 51, 0.10);
}

.mini-pill {
  min-height: 36px;
  font-size: 0.9rem;
}

.stat-pill svg,
.mini-pill svg {
  width: 20px;
  height: 20px;
  flex: 0 0 auto;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-width: 44px;
  min-height: var(--tap);
  border: 3px solid rgba(23, 32, 51, 0.16);
  border-radius: var(--radius);
  padding: 10px 16px;
  background: #fff;
  color: var(--ink);
  font-weight: 900;
  text-decoration: none;
  box-shadow: 0 5px 0 rgba(23, 32, 51, 0.12);
  transition: transform 180ms ease, box-shadow 180ms ease, background 180ms ease, border-color 180ms ease;
}

.btn svg,
.brand-mark svg,
.icon-badge svg {
  width: 24px;
  height: 24px;
  flex: 0 0 auto;
}

.btn:hover,
.module-card:hover,
.lesson-card:hover,
.game-card:hover,
.choice-card:hover,
.draggable-item:hover,
.flip-card:hover {
  transform: translateY(-2px);
}

.btn:active,
.module-card:active,
.lesson-card:active,
.game-card:active,
.choice-card:active,
.draggable-item:active,
.flip-card:active {
  transform: translateY(2px) scale(0.99);
  box-shadow: 0 2px 0 rgba(23, 32, 51, 0.12);
}

.btn.primary {
  background: var(--primary);
  color: #fff;
  border-color: #1746a2;
}

.btn.secondary {
  background: var(--secondary);
  color: #172033;
  border-color: #b45309;
}

.btn.accent {
  background: var(--accent);
  color: #fff;
  border-color: #be185d;
}

.btn.good {
  background: var(--mint);
  color: #fff;
  border-color: #047857;
}

.btn.ghost {
  background: rgba(255, 255, 255, 0.66);
}

.btn.small {
  min-height: 44px;
  padding: 8px 12px;
  font-size: 0.95rem;
}

.btn[disabled] {
  cursor: not-allowed;
  opacity: 0.55;
  transform: none;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(320px, 0.85fr);
  gap: clamp(16px, 2.4vw, 28px);
  align-items: stretch;
}

.hero-main,
.panel,
.adventure-map,
.lesson-page,
.challenge-shell,
.summary-panel {
  border: 3px solid rgba(23, 32, 51, 0.12);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.78);
  box-shadow: var(--shadow);
}

.hero-main {
  position: relative;
  min-height: 418px;
  overflow: hidden;
  padding: clamp(20px, 3vw, 34px);
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.88), rgba(240, 253, 244, 0.82)),
    url("data:image/svg+xml,%3Csvg width='760' height='420' viewBox='0 0 760 420' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M0 308c82-26 146-11 226-31 98-24 170-78 279-55 100 21 148 64 255 33v165H0z' fill='%2386efac'/%3E%3Cpath d='M0 351c79-24 146-5 226-20 96-18 159-56 270-36 99 18 157 50 264 30v95H0z' fill='%23fef3c7'/%3E%3Cpath d='M90 240l52-88 52 88z' fill='%2322c55e'/%3E%3Cpath d='M118 251h48v66h-48z' fill='%2392400e'/%3E%3Cpath d='M582 143l62 98H520z' fill='%23f472b6'/%3E%3Cpath d='M553 238h56v72h-56z' fill='%23fde68a'/%3E%3Ccircle cx='650' cy='88' r='28' fill='%23fbbf24'/%3E%3Cpath d='M305 274c29-55 85-78 137-48 40 24 57 66 51 107H273c-2-22 8-42 32-59z' fill='%2393c5fd'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-size: cover;
  background-position: center bottom;
}

.hero-copy {
  position: relative;
  z-index: 2;
  max-width: 720px;
}

.kicker {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
  border: 2px solid rgba(245, 158, 11, 0.42);
  border-radius: 999px;
  padding: 6px 12px;
  background: rgba(255, 251, 235, 0.9);
  color: #7c2d12;
  font-weight: 900;
}

.hero h1,
.section-title,
.module-title,
.lesson-title {
  margin: 0;
  color: var(--ink);
  line-height: 1.08;
}

.hero h1 {
  max-width: 760px;
  font-size: clamp(2.3rem, 5.3vw, 4.7rem);
}

.hero-text {
  max-width: 660px;
  margin: 14px 0 0;
  color: #22304a;
  font-size: clamp(1.05rem, 1.9vw, 1.35rem);
  font-weight: 700;
}

.hero-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(120px, 1fr));
  gap: 12px;
  margin-top: 24px;
}

.stat-card {
  min-height: 112px;
  border: 3px solid rgba(23, 32, 51, 0.12);
  border-radius: var(--radius);
  padding: 14px;
  background: rgba(255, 255, 255, 0.88);
  box-shadow: 0 6px 0 rgba(23, 32, 51, 0.10);
}

.stat-value {
  display: block;
  font-size: clamp(1.65rem, 3vw, 2.45rem);
  line-height: 1;
  font-weight: 900;
}

.stat-label {
  display: block;
  margin-top: 5px;
  color: var(--muted);
  font-weight: 900;
}

.pet-panel {
  position: relative;
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 14px;
  min-height: 418px;
  overflow: hidden;
  padding: clamp(18px, 2vw, 24px);
  border: 3px solid rgba(23, 32, 51, 0.12);
  border-radius: var(--radius);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.86), rgba(255, 247, 237, 0.88)),
    url("data:image/svg+xml,%3Csvg width='420' height='360' viewBox='0 0 420 360' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M0 265c62-35 113-22 166-42 70-26 121-79 199-51 31 11 45 28 55 43v145H0z' fill='%23bfdbfe'/%3E%3Cpath d='M0 306c62-20 120-6 181-15 70-10 134-43 239-14v83H0z' fill='%23bbf7d0'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: bottom center;
  background-size: cover;
  box-shadow: var(--shadow);
}

.pet-stage {
  display: grid;
  place-items: center;
  min-height: 190px;
}

.pet-svg {
  width: min(78%, 260px);
  filter: drop-shadow(0 10px 0 rgba(23, 32, 51, 0.10));
  animation: gentle-bob 3.2s ease-in-out infinite;
}

.speech {
  position: relative;
  border: 3px solid rgba(23, 32, 51, 0.14);
  border-radius: var(--radius);
  padding: 14px 16px;
  background: #fff;
  color: var(--ink);
  font-size: clamp(1.04rem, 1.8vw, 1.22rem);
  font-weight: 900;
  box-shadow: 0 6px 0 rgba(23, 32, 51, 0.10);
}

.speech::after {
  content: "";
  position: absolute;
  left: 34px;
  bottom: -15px;
  width: 24px;
  height: 24px;
  transform: rotate(45deg);
  border-right: 3px solid rgba(23, 32, 51, 0.14);
  border-bottom: 3px solid rgba(23, 32, 51, 0.14);
  background: #fff;
}

.module-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin-top: 20px;
}

.module-card,
.lesson-card,
.game-card,
.choice-card,
.draggable-item,
.flip-card,
.drop-zone,
.match-card {
  border: 3px solid rgba(23, 32, 51, 0.14);
  border-radius: var(--radius);
  background: #fff;
  color: var(--ink);
  box-shadow: var(--soft-shadow);
  transition: transform 180ms ease, box-shadow 180ms ease, border-color 180ms ease, background 180ms ease;
}

.module-card {
  min-height: 230px;
  padding: 18px;
  text-align: left;
}

.module-card.forest {
  background: linear-gradient(180deg, #f0fdf4, #ffffff);
}

.module-card.planet {
  background: linear-gradient(180deg, #eef2ff, #fff7ed);
}

.module-card.town {
  background: linear-gradient(180deg, #fff7ed, #ecfeff);
}

.module-art {
  display: grid;
  place-items: center;
  width: 82px;
  height: 82px;
  margin-bottom: 14px;
  border: 3px solid rgba(23, 32, 51, 0.12);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.86);
}

.module-art svg {
  width: 58px;
  height: 58px;
}

.module-title {
  font-size: clamp(1.35rem, 2.4vw, 1.8rem);
}

.module-desc {
  margin: 8px 0 14px;
  color: #334155;
  font-weight: 800;
}

.progress-track {
  width: 100%;
  height: 14px;
  overflow: hidden;
  border: 2px solid rgba(23, 32, 51, 0.12);
  border-radius: 999px;
  background: #eff6ff;
}

.progress-fill {
  width: var(--value, 0%);
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--mint), var(--secondary), var(--accent));
  transition: width 260ms ease;
}

.panel {
  margin-top: 18px;
  padding: 18px;
}

.panel-header,
.module-header,
.lesson-header,
.challenge-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 16px;
}

.section-title {
  font-size: clamp(1.55rem, 3vw, 2.5rem);
}

.adventure-map,
.lesson-page,
.challenge-shell,
.summary-panel {
  padding: clamp(16px, 2.4vw, 28px);
}

.lesson-grid,
.game-grid,
.badge-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 14px;
}

.lesson-card,
.game-card {
  min-height: 168px;
  padding: 16px;
  text-align: left;
}

.lesson-card h3,
.game-card h3,
.card-title {
  margin: 0 0 8px;
  font-size: 1.22rem;
  line-height: 1.18;
}

.card-meta {
  color: var(--muted);
  font-weight: 800;
}

.stage-nav {
  margin: 16px 0;
  padding: 8px;
  border: 3px solid rgba(23, 32, 51, 0.10);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.68);
}

.stage-btn {
  flex: 1 1 116px;
}

.stage-btn.active,
.choice-card.selected,
.match-card.selected {
  border-color: var(--primary);
  background: #dbeafe;
}

.lesson-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(280px, 0.9fr);
  gap: 16px;
  align-items: start;
}

.content-card,
.side-card {
  border: 3px solid rgba(23, 32, 51, 0.12);
  border-radius: var(--radius);
  padding: clamp(14px, 2vw, 20px);
  background: rgba(255, 255, 255, 0.86);
  box-shadow: var(--soft-shadow);
}

.poem-lines {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.poem-line {
  border: 2px solid rgba(23, 32, 51, 0.10);
  border-radius: var(--radius);
  padding: 12px 14px;
  background: #fff;
}

.poem-line.active-speech {
  border-color: var(--accent);
  background: #fce7f3;
}

.line-text {
  display: block;
  font-size: clamp(1.12rem, 2vw, 1.46rem);
  font-weight: 900;
}

.pinyin {
  display: block;
  margin-top: 4px;
  color: #6b3a0d;
  font-size: 0.92rem;
  font-weight: 800;
}

.term-list,
.note-list {
  display: grid;
  gap: 9px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.term-list li,
.note-list li {
  border-left: 6px solid var(--secondary);
  border-radius: var(--radius);
  padding: 10px 12px;
  background: #fff7ed;
  font-weight: 800;
}

.term-list strong {
  color: #7c2d12;
}

.choice-card {
  min-height: 72px;
  padding: 14px 16px;
  font-size: clamp(1rem, 2vw, 1.22rem);
  font-weight: 900;
  text-align: left;
}

.choice-card.correct {
  border-color: var(--good);
  background: #d1fae5;
}

.choice-card.wrong {
  border-color: var(--danger);
  background: #fee2e2;
}

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

.prompt-box {
  border: 3px solid rgba(23, 32, 51, 0.12);
  border-radius: var(--radius);
  padding: clamp(16px, 2.6vw, 26px);
  background: #ffffff;
  box-shadow: var(--soft-shadow);
}

.prompt-text {
  margin: 0;
  font-size: clamp(1.35rem, 3vw, 2.4rem);
  line-height: 1.35;
  font-weight: 900;
}

.blank {
  display: inline-block;
  min-width: 4.5em;
  border-bottom: 5px solid var(--accent);
  text-align: center;
  color: var(--accent);
}

.order-list,
.weekday-list {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.draggable-item {
  display: grid;
  grid-template-columns: 1fr auto auto;
  align-items: center;
  gap: 8px;
  min-height: 58px;
  padding: 10px 12px;
  font-weight: 900;
}

.drag-handle {
  color: var(--muted);
  font-weight: 900;
}

.tiny-btn {
  display: inline-grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border: 2px solid rgba(23, 32, 51, 0.14);
  border-radius: var(--radius);
  background: #f8fafc;
  color: var(--ink);
  font-weight: 900;
}

.match-layout,
.season-board {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.match-column {
  display: grid;
  gap: 10px;
}

.match-card {
  min-height: 64px;
  padding: 12px;
  font-weight: 850;
  text-align: left;
}

.match-card.done {
  border-color: var(--good);
  background: #d1fae5;
}

.theater {
  position: relative;
  min-height: 360px;
  overflow: hidden;
  border: 3px solid rgba(23, 32, 51, 0.12);
  border-radius: var(--radius);
  background:
    linear-gradient(180deg, #dff7ff, #f0fdf4 66%, #fef3c7);
  box-shadow: var(--soft-shadow);
}

.scene-svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.scene-hotspot {
  position: absolute;
  min-width: 52px;
  min-height: 52px;
  border: 3px solid #fff;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-weight: 900;
  box-shadow: 0 6px 0 rgba(23, 32, 51, 0.12);
  animation: pulse 1.9s ease-in-out infinite;
}

.scene-caption {
  position: absolute;
  left: 16px;
  right: 16px;
  bottom: 16px;
  border: 3px solid rgba(23, 32, 51, 0.12);
  border-radius: var(--radius);
  padding: 12px 14px;
  background: rgba(255, 255, 255, 0.92);
  font-weight: 900;
}

.flip-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
}

.flip-card {
  min-height: 118px;
  padding: 12px;
  background: #dbeafe;
  font-weight: 900;
  transform-style: preserve-3d;
}

.flip-card.flipped,
.flip-card.matched {
  background: #fff;
}

.flip-card.matched {
  border-color: var(--good);
}

.dictation-input {
  width: 100%;
  min-height: 118px;
  resize: vertical;
  border: 3px solid rgba(23, 32, 51, 0.14);
  border-radius: var(--radius);
  padding: 12px;
  background: #fff;
  color: var(--ink);
  font-weight: 850;
}

.challenge-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 0.38fr);
  gap: 16px;
}

.challenge-main {
  min-width: 0;
}

.challenge-side {
  display: grid;
  gap: 14px;
  align-content: start;
}

.formula {
  display: inline-block;
  margin: 0;
  font-size: clamp(2.25rem, 6vw, 5.6rem);
  line-height: 1;
  font-weight: 900;
  color: var(--primary-dark);
}

.monster-stage,
.clock-stage {
  display: grid;
  place-items: center;
  min-height: 220px;
  border: 3px solid rgba(23, 32, 51, 0.10);
  border-radius: var(--radius);
  background: #eff6ff;
}

.monster-svg {
  width: min(260px, 75%);
  transition: transform 180ms ease;
}

.monster-svg.hit {
  transform: scale(0.92) rotate(-3deg);
}

.hp-bar {
  height: 16px;
  overflow: hidden;
  border: 2px solid rgba(23, 32, 51, 0.14);
  border-radius: 999px;
  background: #fee2e2;
}

.hp-fill {
  height: 100%;
  width: var(--hp, 100%);
  background: linear-gradient(90deg, #22c55e, #f59e0b);
  transition: width 220ms ease;
}

.balloon-field {
  position: relative;
  min-height: 300px;
  overflow: hidden;
  border: 3px solid rgba(23, 32, 51, 0.10);
  border-radius: var(--radius);
  background: #ecfeff;
}

.balloon {
  position: absolute;
  left: var(--x, 20%);
  top: var(--y, 30%);
  min-width: 76px;
  min-height: 86px;
  border: 3px solid rgba(23, 32, 51, 0.18);
  border-radius: 50% 50% 46% 46%;
  background: var(--balloon, #f9a8d4);
  color: var(--ink);
  font-size: 1.28rem;
  font-weight: 900;
  box-shadow: 0 7px 0 rgba(23, 32, 51, 0.12);
  animation: balloon-float 3.6s ease-in-out infinite;
}

.balloon::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -18px;
  width: 2px;
  height: 20px;
  background: rgba(23, 32, 51, 0.32);
}

.clock-svg {
  width: min(280px, 78%);
  height: auto;
}

.season-board {
  grid-template-columns: minmax(180px, 0.6fr) minmax(0, 1.4fr);
}

.month-pool,
.season-zones {
  display: grid;
  gap: 10px;
}

.month-pool {
  grid-template-columns: repeat(auto-fit, minmax(82px, 1fr));
  align-content: start;
}

.month-chip {
  min-height: 52px;
  border: 3px solid rgba(23, 32, 51, 0.14);
  border-radius: var(--radius);
  background: #fff;
  font-weight: 900;
  box-shadow: 0 4px 0 rgba(23, 32, 51, 0.10);
}

.drop-zone {
  min-height: 100px;
  padding: 10px;
  background: #f8fafc;
}

.drop-zone h4 {
  margin: 0 0 8px;
}

.drop-zone.over {
  border-color: var(--accent);
  background: #fce7f3;
}

.reward-burst {
  pointer-events: none;
  position: fixed;
  left: 50%;
  top: 50%;
  z-index: 60;
  transform: translate(-50%, -50%);
}

.reward-bit {
  position: absolute;
  width: 18px;
  height: 18px;
  transform: rotate(45deg);
  border: 2px solid #fff;
  background: var(--bit, #f59e0b);
  animation: burst 700ms ease-out forwards;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: max(20px, env(safe-area-inset-bottom));
  z-index: 100;
  max-width: min(92vw, 560px);
  transform: translate(-50%, 140%);
  border: 3px solid rgba(23, 32, 51, 0.16);
  border-radius: var(--radius);
  padding: 12px 16px;
  background: #fff;
  color: var(--ink);
  font-weight: 900;
  box-shadow: var(--shadow);
  opacity: 0;
  transition: transform 220ms ease, opacity 220ms ease;
}

.toast.show {
  transform: translate(-50%, 0);
  opacity: 1;
}

.cloud {
  pointer-events: none;
  position: absolute;
  z-index: 0;
  width: 170px;
  height: 58px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.74);
  filter: drop-shadow(0 8px 0 rgba(23, 32, 51, 0.06));
  animation: cloud-drift 18s ease-in-out infinite alternate;
}

.cloud::before,
.cloud::after {
  content: "";
  position: absolute;
  bottom: 18px;
  border-radius: 999px;
  background: inherit;
}

.cloud::before {
  left: 28px;
  width: 64px;
  height: 64px;
}

.cloud::after {
  right: 26px;
  width: 72px;
  height: 72px;
}

.cloud.one {
  left: 4%;
  top: 96px;
}

.cloud.two {
  right: 8%;
  top: 150px;
  width: 130px;
  height: 48px;
  animation-delay: -5s;
}

.sparkle {
  pointer-events: none;
  position: absolute;
  z-index: 0;
  width: 16px;
  height: 16px;
  transform: rotate(45deg);
  border-radius: 3px;
  background: #fbbf24;
  animation: twinkle 2.4s ease-in-out infinite;
}

.sparkle.a {
  left: 78%;
  top: 110px;
}

.sparkle.b {
  left: 12%;
  top: 320px;
  background: #ec4899;
  animation-delay: -1.1s;
}

.sparkle.c {
  right: 16%;
  top: 410px;
  background: #22c55e;
  animation-delay: -0.6s;
}

.hidden {
  display: none !important;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@keyframes gentle-bob {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-10px);
  }
}

@keyframes cloud-drift {
  from {
    transform: translateX(-12px);
  }
  to {
    transform: translateX(24px);
  }
}

@keyframes twinkle {
  0%,
  100% {
    transform: rotate(45deg) scale(0.8);
    opacity: 0.45;
  }
  50% {
    transform: rotate(45deg) scale(1.22);
    opacity: 1;
  }
}

@keyframes pulse {
  0%,
  100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.08);
  }
}

@keyframes burst {
  from {
    transform: translate(0, 0) rotate(45deg) scale(1);
    opacity: 1;
  }
  to {
    transform: translate(var(--tx), var(--ty)) rotate(180deg) scale(0.3);
    opacity: 0;
  }
}

@keyframes balloon-float {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-18px);
  }
}

@media (max-width: 1020px) {
  .topbar {
    position: static;
    grid-template-columns: 1fr;
    gap: 8px;
    margin-bottom: 10px;
    padding: 8px;
    backdrop-filter: none;
  }

  .brand {
    justify-content: center;
  }

  .topbar .stat-strip {
    display: none;
  }

  .top-actions {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 8px;
  }

  .top-actions .btn {
    width: auto;
    min-height: 44px;
    padding: 8px 6px;
    gap: 5px;
    font-size: 0.95rem;
  }

  .top-actions .btn svg {
    width: 20px;
    height: 20px;
  }

  .hero,
  .lesson-layout,
  .challenge-shell {
    grid-template-columns: 1fr;
  }

  .module-grid {
    grid-template-columns: 1fr;
  }

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

@media (max-width: 720px) {
  body {
    font-size: 16px;
  }

  .app-shell {
    padding: 8px;
  }

  .topbar {
    border-width: 2px;
  }

  .brand-mark {
    width: 38px;
    height: 38px;
  }

  .brand-title {
    font-size: 1.05rem;
  }

  .brand-subtitle {
    display: none;
  }

  .top-actions .btn {
    min-height: 42px;
    padding: 7px 4px;
    gap: 4px;
    font-size: 0.84rem;
  }

  .top-actions .btn svg {
    width: 18px;
    height: 18px;
  }

  .hero-main,
  .pet-panel {
    min-height: auto;
  }

  .hero-stats,
  .match-layout,
  .season-board {
    grid-template-columns: 1fr;
  }

  .panel-header,
  .module-header,
  .lesson-header,
  .challenge-header {
    display: grid;
  }

  .btn,
  .choice-card {
    width: 100%;
  }

  .top-actions .btn {
    width: auto;
  }

  .stage-btn {
    flex-basis: 46%;
  }

  .formula {
    font-size: clamp(2.4rem, 18vw, 4.5rem);
  }
}

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