:root {
  --bg: #f7fbff;
  --panel: #ffffff;
  --ink: #172033;
  --muted: #667085;
  --blue: #2563eb;
  --blue-soft: #dceafe;
  --sky: #67e8f9;
  --pink: #fb7185;
  --pink-soft: #ffe4e9;
  --purple: #7c3aed;
  --purple-soft: #ede9fe;
  --green: #15803d;
  --green-soft: #dcfce7;
  --gold: #b7791f;
  --gold-soft: #fef3c7;
  --red: #dc2626;
  --red-soft: #fee2e2;
  --line: #d9e2ef;
  --shadow: 0 14px 34px rgba(37, 99, 235, 0.12);
  --radius: 8px;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--bg);
}

body {
  margin: 0;
  min-height: 100%;
  color: var(--ink);
  background:
    radial-gradient(circle at 8% 10%, rgba(103, 232, 249, 0.32) 0 90px, transparent 92px),
    radial-gradient(circle at 92% 5%, rgba(251, 113, 133, 0.22) 0 80px, transparent 82px),
    linear-gradient(180deg, #dbeafe 0, rgba(219, 234, 254, 0) 275px),
    var(--bg);
  font-family: "Microsoft YaHei", "PingFang SC", "Noto Sans SC", Arial, sans-serif;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  width: min(100%, 920px);
  min-height: 100vh;
  margin: 0 auto;
  padding-bottom: calc(82px + env(safe-area-inset-bottom));
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 18px 12px;
  background: rgba(247, 251, 255, 0.9);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid rgba(217, 226, 239, 0.7);
}

.eyebrow {
  margin: 0 0 3px;
  color: var(--purple);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
}

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

h1 {
  margin-bottom: 0;
  font-size: 23px;
  line-height: 1.18;
  letter-spacing: 0;
}

h2 {
  font-size: 20px;
  line-height: 1.25;
  letter-spacing: 0;
}

h3 {
  font-size: 16px;
  line-height: 1.28;
  letter-spacing: 0;
}

.app-main {
  padding: 14px 14px 24px;
}

.screen {
  display: grid;
  gap: 12px;
}

.hero-card,
.card,
.lesson-card,
.question-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  position: relative;
}

.hero-card {
  padding: 18px;
  overflow: hidden;
  background:
    linear-gradient(135deg, #ffffff 0%, #e0f2fe 54%, #fff7ed 100%);
  border-color: #bfdbfe;
}

.hero-card::before {
  content: "";
  position: absolute;
  inset: 10px;
  pointer-events: none;
  border: 2px dashed rgba(37, 99, 235, 0.18);
  border-radius: var(--radius);
}

.hero-card > * {
  position: relative;
}

.hero-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.hero-copy {
  min-width: 0;
}

.quest-badge {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 86px;
  height: 86px;
  color: #fff;
  background:
    linear-gradient(145deg, #2563eb, #7c3aed);
  border: 4px solid #fff;
  border-radius: 50%;
  box-shadow: 0 14px 28px rgba(37, 99, 235, 0.24);
  transform: rotate(5deg);
}

.quest-badge strong {
  display: block;
  font-family: Arial, sans-serif;
  font-size: 28px;
  line-height: 1;
}

.quest-badge span {
  font-size: 11px;
  font-weight: 900;
}

.card,
.lesson-card,
.question-card {
  padding: 14px;
}

.muted {
  color: var(--muted);
}

.lead {
  color: var(--muted);
  line-height: 1.55;
}

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

.stat {
  min-width: 0;
  padding: 11px 10px;
  background: linear-gradient(180deg, #ffffff, #f8fafc);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.stat strong {
  display: block;
  margin-bottom: 2px;
  font-size: 20px;
  line-height: 1.1;
}

.stat span {
  color: var(--muted);
  font-size: 12px;
}

.button-row,
.chip-row,
.option-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.primary-button,
.secondary-button,
.ghost-button,
.danger-button,
.word-chip,
.option-button,
.icon-button,
.nav-item,
.select-button {
  border-radius: var(--radius);
  border: 1px solid transparent;
  min-height: 44px;
}

.primary-button {
  padding: 11px 15px;
  color: #fff;
  background: linear-gradient(135deg, var(--blue), var(--purple));
  border-color: var(--blue);
  font-weight: 800;
}

.secondary-button {
  padding: 10px 14px;
  color: #6d28d9;
  background: var(--purple-soft);
  border-color: #ddd6fe;
  font-weight: 800;
}

.ghost-button {
  padding: 10px 14px;
  color: var(--ink);
  background: #fff;
  border-color: var(--line);
  font-weight: 700;
}

.danger-button {
  padding: 10px 14px;
  color: var(--red);
  background: var(--red-soft);
  border-color: #fecaca;
  font-weight: 800;
}

.icon-button {
  width: 44px;
  height: 44px;
  color: var(--blue);
  background: #fff;
  border-color: var(--line);
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.08);
}

.word-chip {
  min-width: 74px;
  padding: 8px 11px;
  color: var(--ink);
  background: linear-gradient(180deg, #ffffff, #fefce8);
  border-color: #fde68a;
  font-family: Arial, sans-serif;
  font-weight: 800;
}

.word-chip:focus-visible,
.primary-button:focus-visible,
.secondary-button:focus-visible,
.ghost-button:focus-visible,
.option-button:focus-visible,
.nav-item:focus-visible {
  outline: 3px solid rgba(37, 99, 235, 0.28);
  outline-offset: 2px;
}

.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.section-title h2,
.section-title h3 {
  margin-bottom: 0;
}

.tag {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 4px 8px;
  color: var(--blue);
  background: var(--blue-soft);
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
}

.tag.pink {
  color: #be123c;
  background: var(--pink-soft);
}

.tag.purple {
  color: var(--purple);
  background: var(--purple-soft);
}

.tag.green {
  color: var(--green);
  background: var(--green-soft);
}

.tag.gold {
  color: var(--gold);
  background: var(--gold-soft);
}

.tag.red {
  color: var(--red);
  background: var(--red-soft);
}

.callout {
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(180deg, #ffffff, #f8fafc);
  line-height: 1.55;
}

.callout strong {
  color: var(--blue);
}

.callout.green {
  background: var(--green-soft);
}

.callout.gold {
  background: var(--gold-soft);
}

.callout.red {
  background: var(--red-soft);
}

.lesson-list {
  display: grid;
  gap: 9px;
}

.lesson-card {
  display: grid;
  gap: 8px;
  text-align: left;
  overflow: hidden;
}

.lesson-card.active {
  border-color: #93c5fd;
  background: linear-gradient(135deg, #eff6ff, #f5f3ff);
}

.lesson-card.complete {
  border-color: #86efac;
}

.lesson-card::after {
  content: "Aa";
  position: absolute;
  right: 12px;
  bottom: -5px;
  color: rgba(37, 99, 235, 0.08);
  font-family: Arial, sans-serif;
  font-size: 42px;
  font-weight: 900;
}

.lesson-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.segmented {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 7px;
  padding: 5px;
  background: #dbeafe;
  border-radius: var(--radius);
}

.select-button {
  padding: 9px 10px;
  background: transparent;
  color: var(--ink);
  font-weight: 800;
}

.select-button.active {
  background: #fff;
  color: var(--blue);
  box-shadow: 0 6px 16px rgba(37, 99, 235, 0.12);
}

.question-card {
  display: grid;
  gap: 12px;
  border-color: #c7d2fe;
}

.question-stem {
  line-height: 1.55;
  font-size: 17px;
  font-weight: 800;
}

.option-row {
  display: grid;
  grid-template-columns: 1fr;
}

.option-button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  padding: 13px;
  text-align: left;
  background: linear-gradient(180deg, #ffffff, #f8fbff);
  border-color: var(--line);
}

.option-button strong {
  color: var(--blue);
}

.option-button .word {
  font-family: Arial, sans-serif;
  font-size: 19px;
  font-weight: 800;
}

.option-button.correct {
  background: var(--green-soft);
  border-color: #86efac;
}

.option-button.wrong {
  background: var(--red-soft);
  border-color: #fca5a5;
}

.answer-panel {
  display: grid;
  gap: 8px;
  padding: 12px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: #f8fafc;
}

.progress-bar {
  height: 9px;
  overflow: hidden;
  border-radius: 999px;
  background: #dbeafe;
}

.progress-fill {
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, #2563eb, #16a34a);
}

.bottom-nav {
  position: fixed;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  width: min(100%, 920px);
  margin: 0 auto;
  padding: 7px 8px calc(7px + env(safe-area-inset-bottom));
  background: rgba(255, 255, 255, 0.96);
  border-top: 1px solid var(--line);
  backdrop-filter: blur(16px);
}

.nav-item {
  display: grid;
  place-items: center;
  gap: 2px;
  min-width: 0;
  padding: 6px 3px;
  color: var(--muted);
  background: transparent;
  font-size: 12px;
  font-weight: 800;
}

.nav-icon {
  display: grid;
  place-items: center;
  min-width: 25px;
  height: 22px;
  font-size: 15px;
  line-height: 1;
}

.nav-item.active {
  color: var(--blue);
  background: linear-gradient(180deg, var(--blue-soft), var(--purple-soft));
}

.toast {
  position: fixed;
  right: 14px;
  bottom: calc(92px + env(safe-area-inset-bottom));
  left: 14px;
  z-index: 30;
  display: none;
  max-width: 520px;
  margin: 0 auto;
  padding: 12px 14px;
  color: #fff;
  background: #172033;
  border-radius: var(--radius);
  box-shadow: 0 14px 30px rgba(15, 23, 42, 0.28);
  line-height: 1.45;
}

.toast.show {
  display: block;
}

.empty {
  padding: 24px 14px;
  color: var(--muted);
  text-align: center;
  background: #fff;
  border: 1px dashed #b8c4d4;
  border-radius: var(--radius);
}

.two-column {
  display: grid;
  gap: 12px;
}

@media (min-width: 720px) {
  .app-main {
    padding: 18px 22px 30px;
  }

  .screen {
    gap: 16px;
  }

  .two-column {
    grid-template-columns: 0.86fr 1.14fr;
    align-items: start;
  }

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

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

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