:root {
  --cream: #fff7df;
  --paper: #fffdf6;
  --ink: #243047;
  --muted: #68708a;
  --green: #7ac59f;
  --green-dark: #2f8b67;
  --blue: #7ab7e8;
  --orange: #ffb45f;
  --pink: #f5a6b8;
  --line: rgba(36, 48, 71, 0.12);
  color-scheme: light;
  font-family: "Microsoft YaHei", "PingFang SC", "Noto Sans SC", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 10% 8%, rgba(122, 183, 232, 0.25), transparent 28%),
    radial-gradient(circle at 88% 16%, rgba(245, 166, 184, 0.25), transparent 26%),
    linear-gradient(180deg, var(--cream), #f4fbef);
  color: var(--ink);
}

button,
select {
  font: inherit;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 14px clamp(16px, 4vw, 48px);
  background: rgba(255, 253, 246, 0.88);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(16px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  text-decoration: none;
  font-size: clamp(18px, 3vw, 25px);
  font-weight: 800;
}

.brand-icon {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 14px;
  background: var(--orange);
  color: #fff;
  box-shadow: 0 7px 0 rgba(177, 105, 35, 0.22);
}

.nav {
  display: flex;
  gap: 8px;
}

.nav-btn,
.primary-btn,
.secondary-btn,
.learned-btn,
.sound-btn,
.quiz-options button {
  min-height: 48px;
  border: 0;
  border-radius: 16px;
  cursor: pointer;
  font-weight: 800;
}

.nav-btn {
  padding: 0 18px;
  background: transparent;
  color: var(--muted);
}

.nav-btn.is-active {
  background: #e8f5ff;
  color: #236492;
}

main {
  width: min(1180px, calc(100% - 28px));
  margin: 0 auto;
  padding: clamp(22px, 5vw, 54px) 0 56px;
}

.page {
  display: none;
}

.page.is-active {
  display: block;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(280px, 0.7fr);
  gap: clamp(20px, 4vw, 38px);
  align-items: stretch;
}

.hero > div,
.progress-card,
.quiz-panel {
  border: 1px solid var(--line);
  border-radius: 24px;
  background: rgba(255, 253, 246, 0.92);
  box-shadow: 0 18px 45px rgba(82, 91, 117, 0.12);
}

.hero > div:first-child {
  padding: clamp(26px, 5vw, 58px);
}

.kicker,
.card-label,
.quiz-count {
  margin: 0 0 10px;
  color: var(--green-dark);
  font-size: 18px;
  font-weight: 800;
}

h1,
h2,
h3 {
  margin: 0;
  line-height: 1.15;
}

h1 {
  max-width: 650px;
  font-size: clamp(42px, 8vw, 82px);
}

h2 {
  font-size: clamp(30px, 5vw, 52px);
}

.hero-text {
  max-width: 720px;
  margin: 22px 0 0;
  color: var(--muted);
  font-size: clamp(20px, 3vw, 28px);
  line-height: 1.55;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-top: 28px;
}

.primary-btn,
.secondary-btn {
  padding: 0 24px;
  font-size: 20px;
}

.primary-btn {
  background: var(--green);
  color: #123d2c;
  box-shadow: 0 7px 0 rgba(47, 139, 103, 0.26);
}

.secondary-btn {
  background: #fff;
  color: #3e5576;
  border: 2px solid #d5e8f7;
}

.progress-card {
  position: relative;
  padding: 28px;
  overflow: hidden;
}

.sun {
  position: absolute;
  right: -34px;
  top: -34px;
  width: 124px;
  height: 124px;
  border-radius: 50%;
  background: #ffd36a;
}

.progress-card strong {
  display: block;
  margin-top: 18px;
  font-size: 66px;
  line-height: 1;
}

.progress-track {
  height: 20px;
  margin: 24px 0 14px;
  overflow: hidden;
  border-radius: 999px;
  background: #e8ecd9;
}

.progress-track span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--green), var(--orange));
  transition: width 240ms ease;
}

#progressText {
  margin: 0;
  color: var(--muted);
  font-size: 20px;
  font-weight: 700;
}

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

.unit-chip {
  padding: 18px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.8);
  border: 1px solid var(--line);
  font-size: 18px;
  font-weight: 800;
}

.unit-chip span {
  display: block;
  margin-top: 8px;
  color: var(--muted);
  font-size: 15px;
}

.page-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 22px;
}

.unit-picker {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-weight: 800;
}

.unit-picker select {
  min-width: 180px;
  min-height: 48px;
  padding: 0 14px;
  border: 2px solid #d5e8f7;
  border-radius: 15px;
  background: #fff;
  color: var(--ink);
  font-weight: 800;
}

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

.word-card {
  min-height: 238px;
  padding: 20px;
  border: 2px solid transparent;
  border-radius: 22px;
  background: var(--paper);
  box-shadow: 0 12px 28px rgba(82, 91, 117, 0.1);
  text-align: left;
  transition: transform 160ms ease, border-color 160ms ease;
}

.word-card:hover {
  transform: translateY(-3px);
  border-color: #b8def9;
}

.word-card.is-learned {
  border-color: rgba(47, 139, 103, 0.45);
  background: #f5fff8;
}

.word-top {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 12px;
}

.word {
  display: block;
  font-size: 42px;
  font-weight: 900;
}

.pinyin {
  display: block;
  margin-top: 4px;
  color: #cb6b2d;
  font-size: 20px;
  font-weight: 800;
}

.sound-btn {
  flex: 0 0 auto;
  width: 52px;
  background: #e8f5ff;
  color: #236492;
  font-size: 22px;
}

.word-detail {
  display: none;
  margin-top: 18px;
  color: var(--muted);
  font-size: 18px;
  line-height: 1.5;
}

.word-card.is-open .word-detail {
  display: block;
}

.word-detail strong {
  color: var(--ink);
}

.learned-btn {
  width: 100%;
  margin-top: 14px;
  background: var(--orange);
  color: #55340f;
  font-size: 18px;
}

.word-card.is-learned .learned-btn {
  background: var(--green);
  color: #123d2c;
}

.quiz-panel {
  padding: clamp(24px, 5vw, 46px);
}

.quiz-panel h3 {
  font-size: clamp(28px, 5vw, 46px);
}

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

.quiz-options button {
  min-height: 82px;
  padding: 14px 18px;
  background: #fff;
  border: 2px solid #d5e8f7;
  color: var(--ink);
  font-size: clamp(20px, 3vw, 28px);
}

.quiz-options button.is-correct {
  border-color: var(--green);
  background: #e7faee;
}

.quiz-options button.is-wrong {
  border-color: #ee8a8a;
  background: #fff0f0;
}

.quiz-feedback {
  min-height: 34px;
  margin: 22px 0 0;
  color: var(--green-dark);
  font-size: 22px;
  font-weight: 900;
}

@media (max-width: 860px) {
  .topbar,
  .page-heading,
  .hero {
    grid-template-columns: 1fr;
  }

  .topbar {
    align-items: stretch;
    flex-direction: column;
  }

  .nav {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
  }

  .unit-strip,
  .word-grid,
  .quiz-options {
    grid-template-columns: 1fr;
  }
}
