:root {
  --bg-cream: #fff8e7;
  --bg-peach: #ffd4a8;
  --bg-sun: #ffe06c;
  --bg-mint: #b9efd8;
  --bg-sea: #9ed9ff;
  --ink: #213547;
  --ink-soft: #5e727d;
  --card: rgba(255, 255, 255, 0.8);
  --card-strong: rgba(255, 252, 245, 0.95);
  --line: rgba(58, 86, 98, 0.12);
  --shadow: 0 24px 55px rgba(46, 71, 90, 0.16);
  --shadow-soft: 0 14px 24px rgba(46, 71, 90, 0.1);
  --accent: #ff9466;
  --accent-deep: #f2683a;
  --gold: #ffcc4d;
  --radius-xl: 34px;
  --radius-lg: 26px;
  --radius-md: 18px;
  --font-main: "Avenir Next Rounded", "Trebuchet MS", "Verdana", sans-serif;
  --font-display: "Marker Felt", "Avenir Next Rounded", "Trebuchet MS",
    sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-main);
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(255, 255, 255, 0.95), transparent 30%),
    radial-gradient(circle at top right, rgba(255, 255, 255, 0.85), transparent 24%),
    linear-gradient(180deg, #fff6dc 0%, #ffe2ca 42%, #c9f1e5 100%);
  overflow-x: hidden;
}

button,
input,
select {
  font: inherit;
}

button {
  border: 0;
}

.sky-glow {
  position: fixed;
  z-index: 0;
  width: 26rem;
  height: 26rem;
  border-radius: 999px;
  filter: blur(24px);
  opacity: 0.55;
  pointer-events: none;
}

.sky-glow-left {
  top: -8rem;
  left: -8rem;
  background: rgba(255, 218, 128, 0.8);
}

.sky-glow-right {
  right: -8rem;
  bottom: 10rem;
  background: rgba(126, 220, 255, 0.7);
}

.orientation-guard {
  display: none;
}

.app-shell {
  position: relative;
  z-index: 1;
  width: min(calc(100% - 24px), 744px);
  margin: 0 auto;
  padding:
    max(18px, env(safe-area-inset-top))
    0
    max(28px, env(safe-area-inset-bottom));
}

.hero-card,
.panel,
.question-card,
.feedback-card,
.answer-button,
.mission-card,
.stat-pill,
.mascot-card {
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.hero-card {
  display: grid;
  gap: 18px;
  padding: 20px;
  border: 1px solid rgba(255, 255, 255, 0.7);
  border-radius: 34px;
  background: linear-gradient(145deg, rgba(255, 252, 245, 0.92), rgba(255, 245, 222, 0.78));
  box-shadow: var(--shadow);
}

.eyebrow,
.section-kicker {
  margin: 0 0 10px;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: #e57037;
}

h1,
h2,
h3 {
  margin: 0;
  font-family: var(--font-display);
  letter-spacing: 0.01em;
}

h1 {
  font-size: clamp(2.3rem, 7vw, 3.9rem);
  line-height: 0.96;
}

h2 {
  font-size: clamp(1.4rem, 4vw, 2rem);
}

h3 {
  font-size: 1.06rem;
}

.hero-text,
.challenge-instruction,
.parent-notes,
.badge-copy,
.challenge-score,
.challenge-tag,
.round-pill,
.feedback-card,
.mascot-bubble,
.mission-description,
.stat-label,
.portrait-pill {
  color: var(--ink-soft);
}

.hero-text {
  margin: 14px 0 0;
  font-size: 1.04rem;
  line-height: 1.55;
}

.portrait-pill {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  margin-top: 14px;
  padding: 8px 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.72);
  font-size: 0.9rem;
  font-weight: 800;
}

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

.profile-strip {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 14px;
}

.profile-chip {
  display: grid;
  gap: 4px;
  min-width: 0;
  padding: 12px 14px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.74);
  border: 1px solid rgba(255, 255, 255, 0.8);
  box-shadow: var(--shadow-soft);
}

.profile-chip-status {
  background: rgba(255, 248, 232, 0.86);
}

.profile-label {
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #d56d3b;
}

.profile-chip strong {
  font-size: 0.98rem;
  line-height: 1.2;
  color: var(--ink);
}

.profile-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 12px;
}

.stat-pill {
  min-width: 0;
  padding: 14px 12px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(255, 255, 255, 0.78);
  box-shadow: var(--shadow-soft);
  text-align: center;
}

.stat-value {
  display: block;
  font-size: 1.9rem;
  line-height: 1;
  font-weight: 900;
  color: var(--accent-deep);
}

.mascot-card {
  display: grid;
  gap: 14px;
  padding: 16px;
  border-radius: 28px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.82), rgba(255, 244, 205, 0.7));
  border: 1px solid rgba(255, 255, 255, 0.72);
}

.mascot-bubble {
  padding: 16px 18px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.9);
  font-weight: 700;
  line-height: 1.45;
}

.mascot-scene {
  position: relative;
  min-height: 180px;
  border-radius: 24px;
  background:
    linear-gradient(180deg, #9ad9ff 0%, #d5f4ff 56%, #aee3bf 57%, #88c889 100%);
  overflow: hidden;
}

.mascot-scene::before,
.mascot-scene::after {
  content: "";
  position: absolute;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.8);
}

.mascot-scene::before {
  width: 88px;
  height: 28px;
  top: 22px;
  left: 18px;
}

.mascot-scene::after {
  width: 112px;
  height: 34px;
  top: 58px;
  right: 18px;
}

.mascot-face {
  position: absolute;
  left: 50%;
  bottom: 22px;
  transform: translateX(-50%);
  width: 126px;
  height: 126px;
  border-radius: 50%;
  background:
    radial-gradient(circle at 32% 30%, #fff6c2 0%, #ffe49a 42%, #ffc14e 100%);
  box-shadow: 0 18px 24px rgba(239, 156, 52, 0.28);
  animation: bounce 3.2s ease-in-out infinite;
}

.eye {
  position: absolute;
  top: 46px;
  width: 14px;
  height: 18px;
  border-radius: 999px;
  background: #3a4347;
}

.eye:first-child {
  left: 34px;
}

.eye:nth-child(2) {
  right: 34px;
}

.smile {
  position: absolute;
  left: 50%;
  bottom: 32px;
  width: 52px;
  height: 24px;
  transform: translateX(-50%);
  border-bottom: 6px solid #3a4347;
  border-radius: 0 0 50px 50px;
}

.floating-star {
  position: absolute;
  width: 28px;
  height: 28px;
  background: var(--gold);
  clip-path: polygon(50% 0%, 62% 34%, 98% 35%, 69% 57%, 79% 91%, 50% 70%, 21% 91%, 31% 57%, 2% 35%, 38% 34%);
  animation: drift 4s ease-in-out infinite;
}

.star-one {
  top: 22px;
  left: 34px;
}

.star-two {
  top: 62px;
  right: 44px;
  animation-delay: 1s;
}

.star-three {
  left: 50%;
  top: 14px;
  margin-left: 58px;
  animation-delay: 2s;
}

.dashboard-grid,
.bottom-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 18px;
  margin-top: 18px;
}

.panel {
  padding: 18px;
  border-radius: var(--radius-xl);
  background: var(--card);
  border: 1px solid rgba(255, 255, 255, 0.76);
  box-shadow: var(--shadow);
}

.challenge-panel {
  background: linear-gradient(180deg, rgba(255, 251, 244, 0.88), rgba(243, 250, 255, 0.78));
}

.daily-panel {
  margin-top: 18px;
  background: linear-gradient(145deg, rgba(255, 249, 234, 0.92), rgba(234, 246, 255, 0.82));
}

.panel-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.panel-heading.compact {
  margin-bottom: 14px;
}

.mission-list,
.badge-list,
.answer-grid {
  display: grid;
  gap: 14px;
}

.mission-list,
.badge-list {
  grid-template-columns: 1fr;
}

.lane-group + .lane-group {
  margin-top: 18px;
}

.lane-heading {
  margin-bottom: 12px;
}

.daily-copy,
.lesson-goal,
.lesson-text {
  margin: 0;
  color: var(--ink-soft);
  line-height: 1.5;
}

.daily-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 16px;
}

.mission-card {
  position: relative;
  display: grid;
  gap: 10px;
  width: 100%;
  padding: 18px;
  text-align: left;
  border-radius: 24px;
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.92), rgba(255, 248, 236, 0.75));
  border: 1px solid rgba(255, 255, 255, 0.88);
  box-shadow: var(--shadow-soft);
  transition: transform 180ms ease, box-shadow 180ms ease, border-color 180ms ease;
}

.mission-card.level-new {
  background: linear-gradient(145deg, rgba(255, 249, 229, 0.95), rgba(255, 239, 199, 0.78));
}

.mission-card.level-confirm {
  background: linear-gradient(145deg, rgba(234, 251, 240, 0.95), rgba(212, 244, 225, 0.8));
}

.mission-card.level-timed {
  background: linear-gradient(145deg, rgba(233, 246, 255, 0.95), rgba(210, 234, 255, 0.82));
}

.mission-card.level-exam {
  background: linear-gradient(145deg, rgba(255, 238, 231, 0.95), rgba(255, 214, 194, 0.84));
}

.mission-card::after {
  content: "";
  position: absolute;
  inset: auto 18px 0;
  height: 10px;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(255, 198, 111, 0.95), rgba(255, 136, 102, 0.95));
  transform: scaleX(var(--progress, 0));
  transform-origin: left center;
  transition: transform 220ms ease;
}

.mission-card:hover,
.mission-card:focus-visible,
.answer-button:hover,
.answer-button:focus-visible,
.primary-button:hover,
.secondary-button:hover,
.ghost-button:hover {
  transform: translateY(-2px);
}

.mission-card.is-active {
  border-color: rgba(242, 104, 58, 0.4);
  box-shadow: 0 20px 30px rgba(242, 104, 58, 0.16);
}

.mission-topline,
.badge-topline,
.challenge-topline,
.challenge-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.challenge-topline,
.challenge-actions {
  flex-wrap: wrap;
}

.mission-icon,
.badge-icon,
.orientation-icon {
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, 0.74);
}

.mission-icon,
.badge-icon {
  width: 52px;
  height: 52px;
  font-size: 1.6rem;
  border-radius: 18px;
}

.mission-description,
.badge-copy {
  margin: 0;
  font-size: 0.95rem;
  line-height: 1.45;
}

.mission-source,
.mission-support,
.mission-best {
  margin: 0;
  font-size: 0.88rem;
  line-height: 1.4;
  color: var(--ink-soft);
}

.mission-support {
  font-weight: 800;
}

.mission-meta,
.badge-earned {
  font-size: 0.9rem;
  font-weight: 700;
  color: #d56d3b;
}

.challenge-card {
  display: grid;
  gap: 16px;
}

.challenge-tag,
.challenge-score,
.timer-pill,
.round-pill,
.badge-earned {
  padding: 10px 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.9);
  font-size: 0.92rem;
  font-weight: 800;
}

.challenge-instruction {
  margin: 0;
  font-size: 0.98rem;
  line-height: 1.45;
}

.question-card,
.feedback-card {
  padding: 18px;
  border-radius: 24px;
  background: var(--card-strong);
  border: 1px solid rgba(255, 255, 255, 0.88);
  box-shadow: var(--shadow-soft);
}

.question-card {
  min-height: 150px;
  display: grid;
  align-items: center;
}

.question-text {
  margin: 0;
  font-size: clamp(1.9rem, 6vw, 2.8rem);
  line-height: 1.14;
  font-weight: 900;
  color: #243a44;
}

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

.answer-button {
  min-height: 104px;
  padding: 16px 14px;
  border-radius: 24px;
  background: linear-gradient(155deg, rgba(255, 255, 255, 0.96), rgba(246, 252, 255, 0.76));
  border: 1px solid rgba(103, 170, 201, 0.18);
  box-shadow: var(--shadow-soft);
  color: var(--ink);
  font-size: clamp(1.2rem, 3vw, 1.7rem);
  font-weight: 900;
  transition: transform 180ms ease, box-shadow 180ms ease, background 180ms ease;
}

.answer-button.is-correct {
  background: linear-gradient(160deg, rgba(195, 248, 218, 0.98), rgba(129, 223, 169, 0.96));
  color: #164b30;
}

.answer-button.is-wrong {
  background: linear-gradient(160deg, rgba(255, 219, 213, 0.98), rgba(255, 171, 157, 0.94));
  color: #6e3028;
}

.feedback-card {
  min-height: 92px;
  display: grid;
  align-items: center;
  background: linear-gradient(160deg, rgba(255, 252, 243, 0.96), rgba(255, 244, 214, 0.9));
  font-weight: 800;
}

.feedback-card.success {
  background: linear-gradient(160deg, rgba(228, 255, 241, 0.98), rgba(197, 246, 212, 0.95));
  color: #16603c;
}

.feedback-card.error {
  background: linear-gradient(160deg, rgba(255, 239, 236, 0.98), rgba(255, 218, 210, 0.95));
  color: #7d4238;
}

.primary-button,
.secondary-button,
.ghost-button {
  min-height: 60px;
  padding: 14px 18px;
  border-radius: 18px;
  font-weight: 900;
  letter-spacing: 0.01em;
  transition: transform 180ms ease, box-shadow 180ms ease;
}

.primary-button,
.ghost-button,
.secondary-button {
  flex: 1 1 220px;
}

.primary-button {
  color: white;
  background: linear-gradient(135deg, #ff9466, #f2683a);
  box-shadow: 0 16px 24px rgba(242, 104, 58, 0.22);
}

.secondary-button,
.ghost-button {
  background: rgba(255, 255, 255, 0.86);
  color: var(--ink);
  box-shadow: var(--shadow-soft);
}

.badge-card {
  padding: 16px;
  border-radius: 22px;
  background: linear-gradient(155deg, rgba(255, 255, 255, 0.94), rgba(246, 249, 255, 0.78));
  border: 1px solid rgba(255, 255, 255, 0.92);
  box-shadow: var(--shadow-soft);
}

.badge-card.is-earned {
  background: linear-gradient(155deg, rgba(255, 250, 225, 0.98), rgba(255, 233, 161, 0.92));
}

.lesson-panel {
  background: linear-gradient(155deg, rgba(255, 252, 244, 0.92), rgba(238, 248, 255, 0.82));
}

.lesson-block + .lesson-block {
  margin-top: 16px;
}

.lesson-block h3 {
  margin-bottom: 10px;
}

.lesson-list {
  display: grid;
  gap: 10px;
  margin: 0;
  padding-left: 20px;
  line-height: 1.5;
  color: var(--ink-soft);
}

.lesson-memory {
  margin-top: 16px;
  padding: 14px 16px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.88);
  font-weight: 800;
  color: var(--ink-soft);
}

.parent-panel {
  background: linear-gradient(160deg, rgba(255, 252, 245, 0.82), rgba(238, 252, 245, 0.76));
}

.parent-notes {
  display: grid;
  gap: 12px;
  margin: 0;
  padding-left: 20px;
  line-height: 1.5;
}

#confetti-layer {
  position: fixed;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 10;
}

.confetti-piece {
  position: absolute;
  top: -10vh;
  width: 14px;
  height: 20px;
  border-radius: 4px;
  animation: confetti-fall 1.9s linear forwards;
}

@keyframes bounce {
  0%,
  100% {
    transform: translateX(-50%) translateY(0);
  }
  50% {
    transform: translateX(-50%) translateY(-8px);
  }
}

@keyframes drift {
  0%,
  100% {
    transform: translateY(0) rotate(0deg);
  }
  50% {
    transform: translateY(-9px) rotate(12deg);
  }
}

@keyframes confetti-fall {
  0% {
    transform: translate3d(0, 0, 0) rotate(0deg);
    opacity: 1;
  }
  100% {
    transform: translate3d(var(--drift, 0), 110vh, 0) rotate(680deg);
    opacity: 0;
  }
}

@media (max-width: 560px) {
  .app-shell {
    width: min(calc(100% - 18px), 744px);
  }

  .hero-card,
  .panel {
    padding: 16px;
    border-radius: 28px;
  }

  .profile-strip,
  .hero-stats,
  .answer-grid {
    grid-template-columns: 1fr;
  }

  .question-text {
    font-size: 1.85rem;
  }
}

@media (orientation: landscape) and (pointer: coarse) {
  .orientation-guard {
    position: fixed;
    inset: 0;
    z-index: 20;
    display: grid;
    place-items: center;
    padding: 24px;
    background:
      radial-gradient(circle at top left, rgba(255, 255, 255, 0.95), transparent 30%),
      linear-gradient(180deg, #fff6dc 0%, #ffe2ca 42%, #c9f1e5 100%);
  }

  .orientation-card {
    width: min(100%, 420px);
    padding: 26px;
    border-radius: 30px;
    text-align: center;
    background: rgba(255, 255, 255, 0.88);
    border: 1px solid rgba(255, 255, 255, 0.84);
    box-shadow: var(--shadow);
  }

  .orientation-icon {
    width: 88px;
    height: 88px;
    margin: 0 auto 16px;
    border-radius: 24px;
    font-size: 2.2rem;
  }

  .orientation-card p {
    margin: 10px 0 0;
    color: var(--ink-soft);
    line-height: 1.5;
  }

  .app-shell,
  #confetti-layer {
    display: none;
  }
}

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