:root {
  --bg: #f5f7f9;
  --surface: #ffffff;
  --surface-soft: #eaf6f5;
  --ink: #29313d;
  --muted: #77808d;
  --line: #dbe5ec;
  --blue: #36b7a5;
  --blue-dark: #168f86;
  --green: #57cc73;
  --orange: #ffb84d;
  --red: #ff6b6b;
  --gold: #ffb84d;
  --violet: #7b72e9;
  --shadow: 0 6px 18px rgba(35, 55, 70, .08);
  --shadow-float: 0 14px 40px rgba(35, 55, 70, .16);
  --radius: 18px;
  --radius-lg: 24px;
  --space: 16px;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  color-scheme: light;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  letter-spacing: 0;
  -webkit-tap-highlight-color: transparent;
}

body {
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
  overflow-x: hidden;
}

button,
input,
select {
  font: inherit;
}

button {
  min-height: 52px;
  border: 0;
  border-radius: 10px;
  cursor: pointer;
  touch-action: manipulation;
}

button:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: 4px solid rgba(63, 111, 168, .22);
  outline-offset: 2px;
}

.app {
  width: min(1020px, 100%);
  max-width: 100%;
  min-height: 100vh;
  margin: 0 auto;
  padding: 18px clamp(14px, 3vw, 32px) 24px;
  display: grid;
  grid-template-rows: auto 1fr;
  gap: 18px;
}

@keyframes riseIn {
  from {
    opacity: 0;
    transform: translateY(18px) scale(.985);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes softPop {
  0% {
    opacity: 0;
    transform: scale(.92);
  }
  70% {
    opacity: 1;
    transform: scale(1.035);
  }
  100% {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes pressGlow {
  0%, 100% {
    box-shadow: 0 18px 34px rgba(63, 111, 168, .24);
  }
  50% {
    box-shadow: 0 22px 42px rgba(63, 111, 168, .36);
  }
}

@keyframes barShine {
  from {
    background-position: 0 0, 0 0;
  }
  to {
    background-position: 44px 0, 0 0;
  }
}

@keyframes starPop {
  0% {
    opacity: 0;
    transform: translateY(12px) scale(.65) rotate(-8deg);
  }
  70% {
    opacity: 1;
    transform: translateY(-2px) scale(1.08) rotate(3deg);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1) rotate(0);
  }
}

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

@keyframes gentleNudge {
  0%, 100% {
    transform: translateX(0);
  }
  35% {
    transform: translateX(-5px);
  }
  70% {
    transform: translateX(5px);
  }
}

@keyframes routePulse {
  0%, 100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-4px);
  }
}

.topbar {
  display: grid;
  grid-template-columns: 1fr auto auto;
  align-items: center;
  gap: 16px;
}

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

.logo {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  background: var(--blue);
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 25px;
  font-weight: 900;
}

.brand h1 {
  margin: 0;
  font-size: clamp(23px, 3vw, 32px);
  line-height: 1.05;
}

.brand p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}

.progress-text {
  color: var(--blue-dark);
  font-weight: 900;
  white-space: nowrap;
}

.parent-entry {
  min-height: 42px;
  padding: 7px 10px;
  background: transparent;
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}

.screen {
  display: grid;
  align-content: center;
  gap: 18px;
  min-width: 0;
}

.home-shell {
  display: grid;
  gap: 18px;
}

.hero-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: clamp(22px, 4vw, 40px);
  box-shadow: var(--shadow);
  display: grid;
  gap: 22px;
  min-width: 0;
  animation: riseIn .42s cubic-bezier(.2, .8, .2, 1) both;
}

.quest-card {
  border-top: 6px solid var(--green);
}

.quest-topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.score-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.score-pills span {
  min-height: 34px;
  padding: 6px 10px;
  border-radius: 10px;
  background: #eef8f3;
  color: var(--green);
  display: inline-flex;
  align-items: center;
  font-weight: 900;
  white-space: nowrap;
}

.eyebrow {
  margin: 0;
  color: var(--blue-dark);
  font-weight: 900;
}

.hero-card h2,
.lesson-card h2,
.complete-card h2 {
  margin: 0;
  font-size: clamp(30px, 5vw, 52px);
  line-height: 1.05;
}

.lesson-name {
  margin: 0;
  color: var(--ink);
  font-size: clamp(22px, 3.3vw, 34px);
  font-weight: 900;
}

.lesson-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  min-width: 0;
  width: 100%;
}

.meta-pill {
  min-height: 38px;
  min-width: 0;
  max-width: 100%;
  padding: 8px 12px;
  border-radius: 10px;
  background: var(--surface-soft);
  color: var(--blue-dark);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 1 1 112px;
  font-weight: 850;
  line-height: 1.25;
  overflow-wrap: anywhere;
  white-space: normal;
}

.primary-btn,
.secondary-btn,
.plain-btn {
  padding: 0 18px;
  font-weight: 900;
  transition: transform .14s ease, box-shadow .18s ease, background-color .18s ease, border-color .18s ease;
}

.primary-btn {
  background: var(--blue);
  color: #fff;
}

.primary-btn:hover {
  background: var(--blue-dark);
}

.primary-btn:active,
.secondary-btn:active,
.plain-btn:active,
.path-node.unlocked:active {
  transform: translateY(1px) scale(.99);
}

.quest-btn {
  min-height: 58px;
  font-size: 18px;
}

.secondary-btn {
  background: var(--surface-soft);
  color: var(--blue-dark);
  border: 1px solid rgba(63, 111, 168, .18);
}

.plain-btn {
  background: #fff;
  color: var(--ink);
  border: 1px solid var(--line);
}

.home-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.learning-path {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  align-items: stretch;
}

.path-node {
  min-height: 96px;
  padding: 12px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  display: grid;
  grid-template-columns: auto 1fr;
  grid-template-areas:
    "step title"
    "step meta";
  align-items: center;
  gap: 4px 10px;
  text-align: left;
  box-shadow: 0 10px 22px rgba(38, 49, 63, .05);
  animation: riseIn .34s ease both;
  animation-delay: calc(var(--node-index, 0) * 35ms);
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}

.path-node.unlocked {
  cursor: pointer;
}

.path-node.current {
  border-color: rgba(63, 111, 168, .45);
  box-shadow: 0 14px 28px rgba(63, 111, 168, .14);
  animation-name: riseIn, routePulse;
  animation-duration: .34s, 2.6s;
  animation-delay: calc(var(--node-index, 0) * 35ms), .6s;
  animation-iteration-count: 1, infinite;
}

.path-node.unlocked:hover {
  transform: translateY(-2px);
  box-shadow: 0 14px 28px rgba(38, 49, 63, .1);
}

.path-node.completed {
  border-color: rgba(47, 138, 102, .42);
  background: #f3fbf7;
}

.path-node.locked {
  opacity: .58;
  cursor: default;
}

.node-step {
  grid-area: step;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: var(--surface-soft);
  color: var(--blue-dark);
  display: grid;
  place-items: center;
  font-weight: 950;
}

.path-node.current .node-step {
  background: var(--blue);
  color: #fff;
}

.path-node.completed .node-step {
  background: var(--green);
  color: #fff;
}

.node-title {
  grid-area: title;
  font-weight: 930;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.node-meta {
  grid-area: meta;
  color: var(--muted);
  font-size: 13px;
  font-weight: 850;
}

.stat {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  min-height: 108px;
  display: grid;
  align-content: center;
  gap: 6px;
  min-width: 0;
  animation: riseIn .36s ease both;
}

.stat:nth-child(2) {
  animation-delay: .04s;
}

.stat:nth-child(3) {
  animation-delay: .08s;
}

.stat strong {
  font-size: clamp(20px, 2.6vw, 28px);
  overflow-wrap: anywhere;
}

.stat span {
  color: var(--muted);
  font-weight: 760;
  line-height: 1.38;
}

.lesson-layout {
  display: grid;
  gap: 14px;
}

.lesson-hud {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 16px;
  display: grid;
  gap: 10px;
  box-shadow: 0 10px 24px rgba(38, 49, 63, .06);
  animation: riseIn .32s ease both;
}

.hud-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  color: var(--muted);
  font-weight: 900;
}

.lesson-exit-btn {
  min-height: 38px;
  padding: 6px 10px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--blue-dark);
  font-weight: 900;
  white-space: nowrap;
}

.hud-title {
  min-width: 0;
  overflow-wrap: anywhere;
}

.hud-row strong {
  color: var(--blue-dark);
  white-space: nowrap;
}

.progress-rail {
  width: 100%;
  height: 14px;
  border-radius: 999px;
  background: #e7edf5;
  overflow: hidden;
}

.progress-rail span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background:
    linear-gradient(90deg, rgba(255,255,255,.28) 0 18%, transparent 18% 36%),
    linear-gradient(90deg, var(--green), var(--blue));
  background-size: 44px 100%, 100% 100%;
  animation: barShine 1.2s linear infinite;
  transition: width .28s cubic-bezier(.2, .8, .2, 1);
}

.lesson-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  min-height: min(680px, calc(100vh - 120px));
  padding: clamp(18px, 4vw, 34px);
  display: grid;
  align-content: center;
  justify-items: center;
  text-align: center;
  gap: 18px;
  min-width: 0;
  animation: riseIn .38s cubic-bezier(.2, .8, .2, 1) both;
}

.view-listening .lesson-card {
  animation-name: riseIn, listenWave;
  animation-duration: .38s, 2.4s;
  animation-delay: 0s, .55s;
  animation-iteration-count: 1, infinite;
}

.step-label {
  margin: 0;
  color: var(--muted);
  font-weight: 900;
}

.sentence {
  margin: 0;
  font-size: clamp(38px, 7vw, 72px);
  line-height: 1.08;
  font-weight: 900;
  overflow-wrap: anywhere;
  animation: softPop .38s ease both;
}

.sentence.medium {
  font-size: clamp(32px, 5vw, 58px);
}

.translation {
  margin: 0;
  color: var(--muted);
  font-size: clamp(20px, 3vw, 28px);
  font-weight: 800;
}

.lesson-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
}

.mic-btn {
  width: clamp(118px, 18vw, 158px);
  height: clamp(118px, 18vw, 158px);
  border-radius: 50%;
  background: var(--blue);
  color: #fff;
  display: grid;
  place-items: center;
  box-shadow: 0 18px 34px rgba(63, 111, 168, .24);
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  animation: pressGlow 2.2s ease-in-out infinite;
  transition: transform .14s ease, background-color .18s ease, box-shadow .18s ease;
}

.mic-btn:active {
  transform: scale(.97);
}

.mic-btn svg {
  width: 54px;
  height: 54px;
}

.mic-btn.recording {
  background: var(--orange);
  animation: pulse 1s ease-in-out infinite;
}

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

.feedback-panel {
  width: min(760px, 100%);
  display: grid;
  gap: 14px;
  animation: softPop .28s ease both;
}

.result-badge {
  justify-self: center;
  min-height: 36px;
  padding: 7px 12px;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  font-weight: 930;
}

.result-badge.success {
  background: #eef8f3;
  color: var(--green);
}

.result-badge.practice {
  background: #fff4e8;
  color: var(--orange);
  animation: gentleNudge .34s ease both;
}

.word-compare {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  font-size: clamp(28px, 4vw, 46px);
  font-weight: 900;
}

.word-token {
  padding: 4px 2px;
}

.word-token.matched {
  color: var(--ink);
}

.word-token.missing,
.word-token.wrong {
  color: var(--orange);
  text-decoration: underline;
  text-decoration-thickness: 4px;
  text-underline-offset: 8px;
}

.word-token.extra {
  color: var(--muted);
  opacity: .72;
}

.feedback-text {
  min-height: 42px;
  margin: 0;
  font-size: clamp(19px, 2.6vw, 24px);
  line-height: 1.42;
  font-weight: 840;
}

.feedback-text.good {
  color: var(--green);
}

.feedback-text.retry {
  color: var(--orange);
}

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

.dialogue {
  width: min(760px, 100%);
  display: grid;
  gap: 12px;
  text-align: left;
}

.dialogue-line {
  padding: 14px 16px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #fff;
  font-weight: 850;
  font-size: clamp(19px, 2.7vw, 26px);
}

.dialogue-line.lily {
  background: var(--surface-soft);
}

.complete-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: clamp(22px, 4vw, 40px);
  display: grid;
  gap: 20px;
  min-width: 0;
  animation: riseIn .42s cubic-bezier(.2, .8, .2, 1) both;
}

.level-complete {
  border-top: 6px solid var(--green);
}

.star-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.star-row span {
  min-width: 54px;
  min-height: 42px;
  padding: 8px 12px;
  border-radius: 10px;
  background: var(--surface-soft);
  color: var(--muted);
  display: inline-grid;
  place-items: center;
  font-weight: 950;
  opacity: 0;
  animation: starPop .48s cubic-bezier(.2, .8, .2, 1) forwards;
}

.star-row span:nth-child(2) {
  animation-delay: .12s;
}

.star-row span:nth-child(3) {
  animation-delay: .24s;
}

.star-row span.filled {
  background: #fff6df;
  color: var(--gold);
}

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

.summary-item {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px;
  display: grid;
  gap: 6px;
  animation: riseIn .34s ease both;
}

.summary-item:nth-child(2) {
  animation-delay: .04s;
}

.summary-item:nth-child(3) {
  animation-delay: .08s;
}

.summary-item:nth-child(4) {
  animation-delay: .12s;
}

.summary-item strong {
  font-size: 26px;
}

.summary-item span {
  color: var(--muted);
  font-weight: 760;
}

.review-list {
  margin: 0;
  padding-left: 20px;
  color: var(--orange);
  font-weight: 850;
  line-height: 1.6;
}

.review-list.clear {
  color: var(--green);
}

.parent-panel {
  position: fixed;
  inset: 0;
  background: rgba(38, 49, 63, .38);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 18px;
  z-index: 20;
}

.parent-panel.open {
  display: flex;
}

.parent-card {
  width: min(820px, 100%);
  max-height: min(860px, 92vh);
  overflow: auto;
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px;
  display: grid;
  gap: 16px;
}

.parent-gate-card {
  width: min(420px, 100%);
}

.parent-card h2,
.parent-card h3 {
  margin: 0;
}

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

.field {
  display: grid;
  gap: 6px;
}

.field label {
  color: var(--muted);
  font-weight: 820;
}

.field input,
.field select {
  min-height: 46px;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0 12px;
}

.parent-note {
  margin: 0;
  color: var(--muted);
  line-height: 1.52;
  font-weight: 740;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(18px + env(safe-area-inset-bottom));
  transform: translateX(-50%) translateY(18px);
  opacity: 0;
  pointer-events: none;
  max-width: min(92vw, 560px);
  background: var(--ink);
  color: #fff;
  border-radius: 10px;
  padding: 12px 16px;
  box-shadow: var(--shadow);
  font-weight: 850;
  transition: opacity .2s ease, transform .2s ease;
  z-index: 30;
}

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

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

.ui-icon {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.game-statusbar {
  position: sticky;
  top: 0;
  z-index: 10;
  margin: -2px 0 0;
  padding: 10px 0 8px;
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(14px);
}

.logo {
  width: 46px;
  height: 46px;
  border-radius: 15px;
  box-shadow: var(--shadow);
}

.top-status-cluster {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.status-chip {
  min-height: 40px;
  min-width: 58px;
  padding: 7px 10px;
  border-radius: 999px;
  background: #fff;
  border: 1px solid rgba(54, 183, 165, .18);
  color: var(--blue-dark);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  box-shadow: 0 6px 14px rgba(35, 55, 70, .06);
  font-weight: 950;
}

.status-chip[data-status="streak"] {
  color: #e9892d;
}

.status-chip[data-status="stars"] {
  color: #d99019;
}

.status-chip[data-status="energy"] {
  color: var(--violet);
}

.parent-entry {
  border-radius: 999px;
  min-height: 36px;
}

.game-home {
  width: min(720px, 100%);
  margin: 0 auto;
  padding-bottom: 86px;
  align-content: start;
}

.welcome-hero {
  position: relative;
  min-height: 178px;
  border-radius: 30px;
  padding: 22px;
  overflow: hidden;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  background:
    radial-gradient(circle at 15% 18%, rgba(255, 184, 77, .42), transparent 30%),
    radial-gradient(circle at 90% 20%, rgba(123, 114, 233, .24), transparent 28%),
    linear-gradient(135deg, #dbfaf4, #eef5ff 54%, #fff7e6);
  box-shadow: var(--shadow-float);
  animation: riseIn .42s cubic-bezier(.2, .8, .2, 1) both;
}

.welcome-hero::before,
.welcome-hero::after {
  content: "";
  position: absolute;
  border-radius: 999px;
  background: rgba(255, 255, 255, .62);
}

.welcome-hero::before {
  width: 92px;
  height: 92px;
  right: 88px;
  bottom: -36px;
}

.welcome-hero::after {
  width: 14px;
  height: 14px;
  left: 30px;
  top: 24px;
  box-shadow: 36px 84px 0 rgba(255,255,255,.55), 188px 18px 0 rgba(255,255,255,.48);
}

.welcome-copy {
  position: relative;
  z-index: 1;
}

.welcome-copy h2,
.unit-header h2,
.review-hero h2,
.achievement-hero h2,
.profile-panel h2 {
  margin: 4px 0 12px;
  font-size: clamp(25px, 6vw, 36px);
  line-height: 1.08;
}

.goal-pill {
  min-height: 38px;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(255,255,255,.72);
  color: var(--blue-dark);
  display: inline-flex;
  align-items: center;
  font-weight: 950;
}

.lily-character {
  position: relative;
  width: 112px;
  height: 120px;
  display: grid;
  place-items: center;
  animation: characterFloat .56s ease-in-out both;
}

.lily-aura {
  position: absolute;
  width: 104px;
  height: 104px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(54, 183, 165, .18), rgba(54,183,165,0) 70%);
}

.lily-cloud {
  position: relative;
  width: 94px;
  height: 72px;
  border-radius: 42px 42px 34px 34px;
  background: linear-gradient(180deg, #fff, #eafafa);
  border: 3px solid rgba(54, 183, 165, .24);
  box-shadow: 0 14px 28px rgba(35, 55, 70, .12);
}

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

.lily-cloud::before {
  width: 44px;
  height: 44px;
  left: 13px;
  top: -24px;
}

.lily-cloud::after {
  width: 50px;
  height: 50px;
  right: 10px;
  top: -28px;
}

.lily-eye {
  position: absolute;
  z-index: 2;
  width: 8px;
  height: 13px;
  top: 28px;
  border-radius: 999px;
  background: var(--ink);
  animation: blink 3.2s infinite;
}

.lily-eye.left {
  left: 31px;
}

.lily-eye.right {
  right: 31px;
}

.lily-mouth {
  position: absolute;
  z-index: 2;
  left: 39px;
  top: 47px;
  width: 18px;
  height: 9px;
  border-bottom: 3px solid var(--ink);
  border-radius: 0 0 18px 18px;
}

.lily-headset {
  position: absolute;
  z-index: 3;
  left: 10px;
  top: 12px;
  width: 74px;
  height: 52px;
  border: 4px solid var(--violet);
  border-bottom: 0;
  border-radius: 44px 44px 0 0;
}

.lily-mic {
  position: absolute;
  z-index: 3;
  right: 8px;
  top: 42px;
  width: 20px;
  height: 4px;
  border-radius: 999px;
  background: var(--violet);
  transform: rotate(18deg);
}

.lily-star {
  position: absolute;
  width: 12px;
  height: 12px;
  background: var(--gold);
  clip-path: polygon(50% 0, 62% 35%, 100% 50%, 62% 65%, 50% 100%, 38% 65%, 0 50%, 38% 35%);
}

.lily-star.one {
  right: 8px;
  top: 22px;
}

.lily-star.two {
  left: 4px;
  bottom: 24px;
  transform: scale(.72);
}

.mood-celebrate .lily-character,
.mood-celebrate.lily-character,
.mood-happy.lily-character {
  animation: characterJump .5s ease both;
}

.mood-thinking .lily-cloud {
  transform: rotate(-2deg);
}

.mood-recording .lily-aura,
.mood-waiting .lily-aura {
  animation: auraPulse .6s ease-in-out infinite;
}

.unit-header {
  position: relative;
  border-radius: var(--radius-lg);
  padding: 18px;
  background: #fff;
  box-shadow: var(--shadow);
  display: grid;
  grid-template-columns: minmax(0, 1fr) 170px;
  gap: 16px;
  align-items: center;
}

.unit-header p {
  margin: 0;
  color: var(--muted);
  font-weight: 800;
}

.unit-progress {
  display: grid;
  gap: 8px;
}

.unit-progress strong {
  color: var(--blue-dark);
}

.map-stage {
  position: relative;
  min-height: 820px;
  border-radius: 34px;
  padding: 0;
  overflow: hidden;
  background:
    radial-gradient(circle at 50% 0, rgba(255,184,77,.16), transparent 34%),
    linear-gradient(180deg, #eefdf8, #f6f9ff 46%, #fff9ed);
  box-shadow: var(--shadow-float);
}

.map-connector {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.map-path-shadow,
.map-path-line {
  fill: none;
  vector-effect: non-scaling-stroke;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.map-path-shadow {
  stroke: rgba(35, 55, 70, .08);
  stroke-width: 20;
}

.map-path-line {
  stroke: rgba(54, 183, 165, .72);
  stroke-width: 9;
  stroke-dasharray: 2 16;
}

.map-decor {
  position: absolute;
  border-radius: 999px;
  opacity: .8;
}

.decor-a {
  width: 72px;
  height: 72px;
  left: 8%;
  top: 9%;
  background: rgba(255,184,77,.22);
}

.decor-b {
  width: 48px;
  height: 48px;
  right: 11%;
  top: 42%;
  background: rgba(123,114,233,.16);
}

.decor-c {
  width: 90px;
  height: 90px;
  left: 7%;
  bottom: 8%;
  background: rgba(87,204,115,.14);
}

.map-node {
  --node-size: 86px;
  position: absolute;
  left: calc(var(--x) * 1%);
  top: calc(var(--y) * 1%);
  width: var(--node-size);
  min-height: var(--node-size);
  margin-left: calc(var(--node-size) / -2);
  margin-top: calc(var(--node-size) / -2);
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--ink);
  display: grid;
  place-items: center;
  padding: 0;
  animation: mapNodeIn .35s ease both;
  animation-delay: calc(var(--node-index) * 50ms);
  z-index: 2;
}

.node-ring {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: #fff;
  box-shadow: 0 12px 26px rgba(35, 55, 70, .13);
  border: 4px solid #d9e6ed;
}

.node-icon {
  position: relative;
  z-index: 2;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: #edf7f7;
  color: var(--blue-dark);
}

.map-node .ui-icon {
  width: 28px;
  height: 28px;
}

.map-node .node-title,
.map-node .node-meta {
  position: absolute;
  width: 132px;
  left: 50%;
  transform: translateX(-50%);
  text-align: center;
  line-height: 1.25;
}

.map-node .node-title {
  top: calc(100% + 8px);
  font-size: 14px;
  font-weight: 950;
}

.map-node .node-meta {
  top: calc(100% + 29px);
  font-size: 12px;
  color: var(--muted);
  font-weight: 850;
}

.status-current {
  --node-size: 98px;
  animation-name: mapNodeIn, routePulse;
  animation-duration: .35s, 2.4s;
  animation-delay: calc(var(--node-index) * 50ms), .55s;
  animation-iteration-count: 1, infinite;
}

.status-current .node-ring {
  border-color: var(--blue);
  box-shadow: 0 0 0 10px rgba(54,183,165,.12), 0 16px 34px rgba(54,183,165,.24);
}

.status-current .node-icon {
  background: var(--blue);
  color: #fff;
}

.status-completed .node-ring {
  border-color: var(--green);
}

.status-completed .node-icon {
  background: var(--green);
  color: #fff;
}

.status-review .node-ring,
.status-reward .node-ring {
  border-color: var(--orange);
}

.status-review .node-icon,
.status-reward .node-icon {
  background: #fff5df;
  color: #c47a0b;
}

.status-locked {
  opacity: .62;
}

.status-locked .node-ring {
  background: #edf1f4;
}

.status-locked .node-icon {
  background: #dfe6eb;
  color: #8b96a3;
}

.node-treasure {
  --node-size: 94px;
}

.node-challenge {
  --node-size: 108px;
}

.node-challenge .node-ring {
  border-width: 5px;
}

.map-finish-flag {
  position: absolute;
  right: 14%;
  bottom: 2%;
  width: 48px;
  height: 72px;
}

.map-finish-flag span {
  position: absolute;
  left: 6px;
  top: 0;
  width: 6px;
  height: 72px;
  border-radius: 999px;
  background: var(--ink);
}

.map-finish-flag b {
  position: absolute;
  left: 12px;
  top: 4px;
  width: 34px;
  height: 24px;
  border-radius: 4px 12px 12px 4px;
  background: linear-gradient(135deg, var(--orange), #ffd784);
}

.map-start-btn {
  min-height: 58px;
  border-radius: 18px;
  box-shadow: 0 10px 22px rgba(54, 183, 165, .24);
}

.sheet-layer {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: none;
  align-items: flex-end;
  justify-content: center;
  padding: 18px;
  background: rgba(41, 49, 61, .32);
  backdrop-filter: blur(8px);
}

.sheet-layer.open {
  display: flex;
}

.lesson-preview-sheet,
.confirm-sheet {
  width: min(520px, 100%);
  border-radius: 28px;
  background: #fff;
  box-shadow: var(--shadow-float);
  padding: 22px;
  position: relative;
  display: grid;
  gap: 14px;
  animation: sheetIn .24s ease both;
}

.sheet-close {
  position: absolute;
  right: 14px;
  top: 14px;
  width: 42px;
  min-height: 42px;
  border-radius: 50%;
  background: var(--surface-soft);
  color: var(--blue-dark);
  display: grid;
  place-items: center;
}

.sheet-character {
  justify-self: center;
}

.lesson-preview-sheet h2,
.confirm-sheet h2 {
  margin: 0;
  font-size: 26px;
}

.sheet-subtitle,
.locked-hint,
.confirm-sheet p {
  margin: 0;
  color: var(--muted);
  font-weight: 800;
  line-height: 1.5;
}

.sheet-meta {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.sheet-meta span {
  min-height: 42px;
  border-radius: 14px;
  background: var(--surface-soft);
  color: var(--blue-dark);
  display: grid;
  place-items: center;
  text-align: center;
  font-weight: 900;
  font-size: 13px;
}

.bottom-nav {
  position: fixed;
  left: 50%;
  bottom: max(12px, env(safe-area-inset-bottom));
  transform: translateX(-50%);
  z-index: 14;
  width: min(460px, calc(100% - 24px));
  min-height: 64px;
  border-radius: 24px;
  background: rgba(255, 255, 255, .92);
  backdrop-filter: blur(16px);
  box-shadow: var(--shadow-float);
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
  padding: 6px;
}

.nav-item {
  min-height: 52px;
  border-radius: 18px;
  background: transparent;
  color: var(--muted);
  display: grid;
  place-items: center;
  gap: 1px;
  font-size: 12px;
  font-weight: 900;
}

.nav-item .ui-icon {
  width: 20px;
  height: 20px;
}

.nav-item.active {
  background: var(--surface-soft);
  color: var(--blue-dark);
}

.review-hero,
.achievement-hero,
.profile-panel {
  border-radius: 30px;
  padding: 20px;
  background:
    radial-gradient(circle at 88% 18%, rgba(255,184,77,.22), transparent 28%),
    linear-gradient(135deg, #fff, #effbfa);
  box-shadow: var(--shadow);
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 14px;
  align-items: center;
}

.review-groups,
.badge-wall,
.profile-grid {
  display: grid;
  gap: 12px;
}

.review-group,
.review-item,
.achievement-badge,
.profile-grid > div {
  border-radius: 22px;
  background: #fff;
  box-shadow: var(--shadow);
  padding: 16px;
}

.review-group h3 {
  margin: 0 0 10px;
}

.review-item {
  margin-top: 8px;
  display: grid;
  gap: 4px;
  box-shadow: none;
  background: #f7fafb;
}

.review-item span,
.review-item em,
.achievement-badge span,
.achievement-badge em,
.profile-panel p {
  color: var(--muted);
  font-style: normal;
  font-weight: 760;
}

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

.achievement-badge {
  min-height: 164px;
  display: grid;
  gap: 8px;
  align-content: start;
}

.achievement-badge.locked {
  filter: grayscale(1);
  opacity: .58;
}

.badge-symbol {
  width: 54px;
  height: 54px;
  border-radius: 18px;
  display: grid;
  place-items: center;
  background: var(--surface-soft);
  color: var(--blue-dark);
}

.achievement-badge.unlocked .badge-symbol {
  background: linear-gradient(135deg, var(--orange), #ffe1a3);
  color: #7d4a00;
}

.shape-shield .badge-symbol {
  border-radius: 20px 20px 26px 26px;
}

.shape-medal .badge-symbol {
  border-radius: 50%;
}

.shape-trophy .badge-symbol {
  border-radius: 18px 18px 8px 8px;
}

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

.profile-grid > div {
  display: grid;
  gap: 6px;
}

.profile-grid strong {
  font-size: 30px;
}

.focused-lesson {
  width: min(640px, 100%);
  margin: 0 auto;
  align-content: start;
}

.focused-lesson .lesson-hud {
  border-radius: 24px;
  border: 0;
  box-shadow: var(--shadow);
}

.focused-lesson .lesson-card {
  position: relative;
  min-height: min(680px, calc(100vh - 150px));
  border: 0;
  border-radius: 30px;
  background:
    radial-gradient(circle at 80% 8%, rgba(255,184,77,.16), transparent 28%),
    #fff;
}

.focused-lesson .lesson-card::before {
  content: "";
  position: absolute;
  inset: 18px;
  border-radius: 26px;
  border: 2px dashed rgba(54,183,165,.14);
  pointer-events: none;
}

.lesson-exit-btn {
  width: 42px;
  height: 42px;
  min-height: 42px;
  border-radius: 50%;
  padding: 0;
  font-size: 26px;
  line-height: 1;
}

.lesson-complete-screen {
  width: min(640px, 100%);
  margin: 0 auto;
  align-content: center;
}

@keyframes characterFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}

@keyframes characterJump {
  0% { transform: translateY(0) scale(1); }
  48% { transform: translateY(-10px) scale(1.04); }
  100% { transform: translateY(0) scale(1); }
}

@keyframes blink {
  0%, 92%, 100% { transform: scaleY(1); }
  95% { transform: scaleY(.12); }
}

@keyframes auraPulse {
  0%, 100% { transform: scale(.92); opacity: .72; }
  50% { transform: scale(1.08); opacity: 1; }
}

@keyframes mapNodeIn {
  from { opacity: 0; transform: translateY(12px) scale(.86); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes sheetIn {
  from { opacity: 0; transform: translateY(22px) scale(.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@media (max-width: 760px) {
  .app {
    padding: 12px 10px 96px;
  }

  .topbar {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px 10px;
  }

  .top-status-cluster {
    grid-column: 1 / -1;
    grid-row: 2;
    justify-content: stretch;
  }

  .status-chip {
    flex: 1;
  }

  .parent-entry {
    grid-column: 2;
    grid-row: 1;
    justify-self: end;
    align-self: center;
  }

  .home-stats,
  .summary-grid,
  .settings-grid {
    grid-template-columns: 1fr;
  }

  .game-home {
    padding-bottom: 20px;
  }

  .welcome-hero {
    min-height: 164px;
    padding: 18px;
    grid-template-columns: minmax(0, 1fr) 104px;
  }

  .lily-character {
    width: 96px;
    height: 110px;
  }

  .lily-cloud {
    transform: scale(.86);
  }

  .unit-header {
    grid-template-columns: 1fr;
  }

  .learning-path.map-stage {
    display: block;
    min-height: 770px;
  }

  .map-node {
    --node-size: 74px;
  }

  .status-current {
    --node-size: 84px;
  }

  .node-treasure {
    --node-size: 82px;
  }

  .node-challenge {
    --node-size: 92px;
  }

  .map-node .node-title {
    font-size: 12px;
    width: 112px;
  }

  .map-node .node-meta {
    width: 112px;
    font-size: 11px;
  }

  .quest-topline,
  .hud-row {
    align-items: flex-start;
  }

  .hud-row {
    align-items: center;
    gap: 8px;
  }

  .lesson-exit-btn {
    min-height: 36px;
    padding: 5px 8px;
  }

  .score-pills {
    width: 100%;
  }

  .score-pills span {
    flex: 1 1 86px;
    justify-content: center;
  }

  .hero-card,
  .lesson-card,
  .complete-card {
    padding: 18px;
  }

  .lesson-card {
    min-height: calc(100vh - 210px);
  }

  .lesson-actions {
    width: 100%;
  }

  .primary-btn,
  .secondary-btn,
  .plain-btn {
    width: 100%;
  }

  .sheet-meta,
  .badge-wall,
  .profile-grid {
    grid-template-columns: 1fr;
  }

  .bottom-nav {
    width: min(440px, calc(100% - 18px));
  }
}

@media (min-width: 761px) {
  .sheet-layer {
    align-items: center;
  }
}

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