:root {
  color-scheme: light;
  --bg: #f6f7ff;
  --bg-soft: #eef1ff;
  --card: rgba(255, 255, 255, 0.92);
  --line: rgba(123, 92, 255, 0.12);
  --line-strong: rgba(123, 92, 255, 0.22);
  --text: #2e3158;
  --muted: #6d7195;
  --primary: #7c5cff;
  --primary-deep: #6646eb;
  --green: #22b573;
  --yellow: #ffb84d;
  --red: #ff6f7d;
  --shadow: 0 22px 45px rgba(107, 88, 215, 0.12);
  --radius-xl: 28px;
  --radius-lg: 20px;
  --radius-md: 16px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background:
    radial-gradient(circle at top left, rgba(255, 206, 236, 0.5), transparent 28%),
    radial-gradient(circle at top right, rgba(136, 212, 255, 0.4), transparent 26%),
    linear-gradient(180deg, #f8f6ff 0%, #eef3ff 100%);
  color: var(--text);
  font-family:
    "SF Pro Display",
    "PingFang SC",
    "Hiragino Sans GB",
    "Microsoft YaHei",
    sans-serif;
}

body {
  padding: env(safe-area-inset-top, 0) 0 env(safe-area-inset-bottom, 0);
}

button,
input {
  font: inherit;
}

button {
  border: none;
  cursor: pointer;
  transition:
    transform 0.18s ease,
    box-shadow 0.18s ease,
    opacity 0.18s ease;
}

button:hover {
  transform: translateY(-1px);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
  transform: none;
}

.app-shell {
  width: min(1180px, calc(100% - 24px));
  margin: 0 auto;
  padding: 18px 0 28px;
}

.hero-card,
.panel,
.stat-card,
.forecast-card,
.garden-card {
  background: var(--card);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
}

.hero-card {
  border-radius: 32px;
  padding: 24px;
  display: grid;
  gap: 18px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--primary);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.04em;
}

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

h1 {
  font-size: clamp(30px, 6vw, 48px);
  line-height: 1.06;
}

h2 {
  font-size: 22px;
}

.hero-text,
.mascot-line,
.summary-text,
.challenge-subtitle,
.parent-note,
.garden-meta,
.forecast-meta {
  color: var(--muted);
  line-height: 1.6;
}

.profile-bar,
.hero-actions,
.status-row,
.panel-head,
.progress-meta,
.summary-card,
.feedback-row,
.spelling-actions,
.parent-actions,
.mission-tools,
.word-header,
.stat-card {
  display: flex;
  gap: 12px;
  align-items: center;
}

.profile-bar,
.hero-actions,
.parent-actions {
  flex-wrap: wrap;
}

.profile-box {
  flex: 1 1 180px;
  display: grid;
  gap: 8px;
  padding: 14px 16px;
  border-radius: var(--radius-md);
  background: var(--bg-soft);
  border: 1px solid rgba(124, 92, 255, 0.16);
}

.profile-box span,
.summary-label,
.stat-label,
.mascot-title,
.challenge-kicker,
.memory-label {
  font-size: 13px;
  font-weight: 700;
  color: var(--muted);
}

input[type="text"] {
  width: 100%;
  border: none;
  outline: none;
  background: transparent;
  font-size: 18px;
  color: var(--text);
}

.primary-btn,
.secondary-btn,
.ghost-btn,
.import-btn {
  min-height: 48px;
  border-radius: 16px;
  padding: 0 18px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.primary-btn {
  background: linear-gradient(135deg, var(--primary), #9c7bff);
  color: #fff;
  box-shadow: 0 14px 30px rgba(124, 92, 255, 0.28);
}

.secondary-btn {
  background: rgba(124, 92, 255, 0.12);
  color: var(--primary-deep);
}

.ghost-btn,
.import-btn {
  background: #fff;
  color: var(--text);
  border: 1px solid var(--line-strong);
}

.danger-btn {
  color: #cc415d;
}

.small-btn {
  min-height: 40px;
  padding: 0 14px;
  border-radius: 14px;
}

.status-pill,
.badge-soft,
.summary-badge,
.stage-badge,
.word-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  padding: 8px 12px;
  font-size: 13px;
  font-weight: 700;
}

.status-pill,
.badge-soft {
  background: rgba(124, 92, 255, 0.1);
  color: var(--primary-deep);
}

.status-pill.soft {
  background: rgba(255, 255, 255, 0.65);
  color: var(--muted);
}

.hero-side {
  display: grid;
  gap: 14px;
}

.mascot-orb {
  width: 88px;
  height: 88px;
  border-radius: 26px;
  display: grid;
  place-items: center;
  background: linear-gradient(145deg, #ffe7ff, #d8f3ff);
  font-size: 40px;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.7);
}

.mascot-card {
  padding: 16px;
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid var(--line);
}

.main-grid {
  display: grid;
  gap: 18px;
  margin-top: 18px;
}

.primary-column,
.side-column {
  display: grid;
  gap: 18px;
}

.panel {
  padding: 20px;
  border-radius: var(--radius-xl);
}

.panel-head {
  justify-content: space-between;
  margin-bottom: 16px;
}

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

.stat-card {
  padding: 16px;
  border-radius: 22px;
}

.stat-icon {
  font-size: 28px;
}

.stat-value {
  margin-top: 4px;
  font-size: 22px;
  font-weight: 800;
}

.summary-card {
  justify-content: space-between;
  margin-top: 16px;
  padding: 16px;
  border-radius: 22px;
  background: linear-gradient(135deg, rgba(124, 92, 255, 0.08), rgba(255, 217, 128, 0.13));
}

.summary-text {
  margin-top: 6px;
}

.summary-badge {
  background: #fff;
  color: var(--primary-deep);
  white-space: nowrap;
}

.progress-shell {
  margin-bottom: 18px;
}

.progress-meta {
  justify-content: space-between;
  font-weight: 700;
  margin-bottom: 10px;
}

.progress-track {
  height: 12px;
  border-radius: 999px;
  background: rgba(124, 92, 255, 0.12);
  overflow: hidden;
}

.progress-bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #8d72ff, #42d1ff);
  border-radius: 999px;
  transition: width 0.25s ease;
}

.mission-area {
  min-height: 360px;
}

.empty-state,
.challenge-shell,
.complete-card,
.home-card {
  display: grid;
  gap: 16px;
}

.home-card,
.challenge-card,
.word-top,
.complete-card {
  padding: 18px;
  border-radius: 24px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.92), rgba(243, 246, 255, 0.96));
  border: 1px solid rgba(124, 92, 255, 0.12);
}

.word-top {
  gap: 16px;
}

.word-bubble {
  padding: 16px;
  border-radius: 22px;
  background: rgba(124, 92, 255, 0.08);
}

.word-title {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.word-big {
  font-size: clamp(30px, 7vw, 42px);
  font-weight: 900;
}

.phonics {
  color: var(--muted);
  font-weight: 700;
}

.meaning-tag {
  color: var(--primary-deep);
  background: rgba(124, 92, 255, 0.1);
  padding: 8px 12px;
  border-radius: 999px;
  font-weight: 700;
  width: fit-content;
}

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

.challenge-title {
  font-size: 22px;
  font-weight: 900;
  line-height: 1.3;
}

.choice-grid,
.letter-bank,
.today-pack,
.forecast-grid,
.garden-grid {
  display: grid;
  gap: 12px;
}

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

.choice-btn,
.letter-btn {
  min-height: 56px;
  padding: 14px 16px;
  border-radius: 18px;
  background: #fff;
  color: var(--text);
  border: 1px solid rgba(124, 92, 255, 0.16);
  box-shadow: 0 10px 20px rgba(113, 92, 209, 0.08);
  text-align: left;
  font-size: 17px;
  font-weight: 700;
}

.choice-btn.correct,
.letter-btn.correct {
  border-color: rgba(34, 181, 115, 0.28);
  background: rgba(34, 181, 115, 0.12);
  color: #118b57;
}

.choice-btn.wrong,
.letter-btn.wrong {
  border-color: rgba(255, 111, 125, 0.24);
  background: rgba(255, 111, 125, 0.12);
  color: #c84a5a;
}

.answer-slots {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(46px, 1fr));
  gap: 10px;
}

.slot {
  min-height: 54px;
  display: grid;
  place-items: center;
  border-radius: 16px;
  background: rgba(124, 92, 255, 0.08);
  border: 1px dashed rgba(124, 92, 255, 0.28);
  font-size: 24px;
  font-weight: 900;
  text-transform: lowercase;
}

.letter-bank {
  grid-template-columns: repeat(auto-fit, minmax(52px, 1fr));
}

.letter-btn {
  min-height: 52px;
  justify-content: center;
  text-align: center;
  text-transform: lowercase;
}

.letter-btn.used {
  opacity: 0.35;
}

.feedback-box {
  min-height: 54px;
  padding: 14px 16px;
  border-radius: 18px;
  background: rgba(124, 92, 255, 0.06);
  color: var(--muted);
  line-height: 1.6;
}

.feedback-box.success {
  background: rgba(34, 181, 115, 0.11);
  color: #127a4e;
}

.feedback-box.error {
  background: rgba(255, 111, 125, 0.11);
  color: #ba4958;
}

.word-pill {
  background: rgba(124, 92, 255, 0.08);
  color: var(--primary-deep);
}

.word-pill.review {
  background: rgba(66, 209, 255, 0.14);
  color: #0b7da4;
}

.word-pill.boost {
  background: rgba(255, 184, 77, 0.18);
  color: #9a6906;
}

.word-pill.new {
  background: rgba(124, 92, 255, 0.12);
}

.word-pill.soft {
  background: rgba(255, 255, 255, 0.92);
  color: var(--muted);
  border: 1px dashed rgba(124, 92, 255, 0.2);
}

.exam-overview,
.phase-roadmap {
  display: grid;
  gap: 12px;
}

.exam-card,
.focus-card,
.roadmap-card {
  padding: 16px;
  border-radius: 22px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.95), rgba(244, 247, 255, 0.95));
  border: 1px solid rgba(124, 92, 255, 0.12);
}

.exam-label {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.exam-value {
  margin-top: 6px;
  font-size: 22px;
  font-weight: 900;
  line-height: 1.35;
}

.exam-meta,
.roadmap-goal {
  margin-top: 6px;
  color: var(--muted);
  line-height: 1.6;
}

.today-focus {
  margin-top: 12px;
}

.exam-format {
  display: grid;
  gap: 12px;
  margin-top: 12px;
}

.focus-head,
.roadmap-top {
  display: flex;
  gap: 10px;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
}

.focus-line {
  margin-top: 8px;
  color: var(--text);
  line-height: 1.6;
}

.phase-roadmap {
  margin-top: 12px;
}

.exam-summary,
.exam-modules-grid {
  display: grid;
  gap: 12px;
}

.exam-mini-card,
.exam-module-card,
.attempt-box {
  padding: 16px;
  border-radius: 22px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(245, 247, 255, 0.96));
  border: 1px solid rgba(124, 92, 255, 0.12);
}

.exam-mini-card p,
.attempt-line,
.module-text.soft {
  color: var(--muted);
}

.exam-mini-card.done,
.summary-badge.done {
  background: rgba(34, 181, 115, 0.12);
  color: #127a4e;
}

.summary-badge.done {
  border: none;
}

.module-top {
  display: flex;
  gap: 10px;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
}

.module-body {
  display: grid;
  gap: 14px;
  margin-top: 14px;
}

.module-text {
  line-height: 1.7;
}

.module-question {
  padding: 14px;
  border-radius: 18px;
  background: rgba(124, 92, 255, 0.06);
}

.module-options,
.module-checklist {
  display: grid;
  gap: 10px;
  margin-top: 10px;
}

.module-option {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 12px 14px;
  border-radius: 16px;
  background: #fff;
  border: 1px solid rgba(124, 92, 255, 0.14);
}

.module-option input {
  margin-top: 2px;
}

.module-textarea {
  width: 100%;
  min-height: 132px;
  padding: 14px 16px;
  border-radius: 18px;
  border: 1px solid rgba(124, 92, 255, 0.18);
  background: #fff;
  color: var(--text);
  resize: vertical;
}

.attempt-box {
  margin-top: 14px;
  padding: 14px;
  background: rgba(124, 92, 255, 0.06);
}

.attempt-title {
  font-size: 13px;
  font-weight: 800;
  color: var(--primary-deep);
}

.attempt-line {
  margin-top: 6px;
  line-height: 1.6;
}

.attempt-line.ok {
  color: #127a4e;
}

.attempt-line.warn {
  color: #ba4958;
}

.speaking-timer-row {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}

.speaking-timer {
  min-width: 92px;
  padding: 10px 14px;
  border-radius: 14px;
  background: rgba(124, 92, 255, 0.1);
  color: var(--primary-deep);
  font-size: 22px;
  font-weight: 900;
  text-align: center;
}

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

.forecast-card,
.garden-card {
  padding: 14px;
  border-radius: 22px;
}

.forecast-card strong,
.garden-card strong {
  font-size: 18px;
}

.forecast-day {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.forecast-count {
  margin-top: 6px;
  font-size: 26px;
  font-weight: 900;
  color: var(--primary-deep);
}

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

.garden-card {
  display: grid;
  gap: 8px;
}

.garden-flower {
  font-size: 30px;
}

.garden-meta {
  font-size: 13px;
}

.parent-summary {
  display: grid;
  gap: 10px;
  margin-bottom: 16px;
}

.parent-note {
  padding: 14px 16px;
  border-radius: 18px;
  background: rgba(124, 92, 255, 0.08);
}

.complete-card {
  text-align: center;
}

.complete-title {
  font-size: 28px;
  font-weight: 900;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(16px + env(safe-area-inset-bottom, 0));
  transform: translate(-50%, 14px);
  width: min(92vw, 520px);
  padding: 14px 16px;
  border-radius: 18px;
  background: rgba(46, 49, 88, 0.92);
  color: #fff;
  box-shadow: 0 18px 36px rgba(20, 20, 46, 0.22);
  opacity: 0;
  pointer-events: none;
  transition:
    transform 0.2s ease,
    opacity 0.2s ease;
  z-index: 30;
}

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

@media (min-width: 860px) {
  .hero-card {
    grid-template-columns: 1.4fr 0.8fr;
    align-items: center;
  }

  .main-grid {
    grid-template-columns: minmax(0, 1.35fr) minmax(320px, 0.85fr);
    align-items: start;
  }

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

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

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

  .exam-overview {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

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

  .exam-modules-grid,
  .phase-roadmap {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .exam-format {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 520px) {
  .app-shell {
    width: min(100% - 16px, 100%);
    padding-top: 10px;
  }

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

  .stats-grid,
  .forecast-grid,
  .garden-grid {
    grid-template-columns: 1fr;
  }

  .hero-actions > button,
  .parent-actions > button,
  .parent-actions > .import-btn {
    width: 100%;
  }
}
