:root {
  color-scheme: light;
  --bg: #f5f7f3;
  --panel: #ffffff;
  --ink: #1e2a24;
  --muted: #68736d;
  --line: #dce3dd;
  --primary: #226c5f;
  --primary-dark: #164c43;
  --accent: #b75d2a;
  --good: #28784d;
  --bad: #a23b3b;
  font-family: "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(135deg, rgba(34, 108, 95, 0.08), transparent 32%),
    linear-gradient(315deg, rgba(183, 93, 42, 0.08), transparent 28%),
    var(--bg);
  color: var(--ink);
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

.app {
  min-height: 100vh;
}

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

.brand,
.nav button {
  border: 0;
  background: transparent;
  color: var(--ink);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
}

.brand-mark {
  display: grid;
  width: 40px;
  height: 40px;
  place-items: center;
  border-radius: 8px;
  background: var(--primary);
  color: #fff;
  letter-spacing: 0;
}

.nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
}

.nav button {
  min-height: 38px;
  padding: 8px 10px;
  border-radius: 8px;
}

.nav button:hover {
  background: #e8eee8;
}

.view {
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
  padding: 32px 0 56px;
  outline: none;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(220px, 0.7fr);
  gap: 24px;
  align-items: stretch;
  padding: clamp(28px, 6vw, 64px) 0 18px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--accent);
  font-size: 0.82rem;
  font-weight: 800;
  text-transform: uppercase;
}

h1,
h2,
p {
  overflow-wrap: anywhere;
}

h1 {
  margin: 0;
  font-size: clamp(2rem, 6vw, 4.6rem);
  line-height: 1.05;
  letter-spacing: 0;
}

h2 {
  margin: 0 0 8px;
  font-size: 1.25rem;
  letter-spacing: 0;
}

.hero-copy,
.section-title p,
.card p,
.about p {
  color: var(--muted);
  line-height: 1.8;
}

.hero-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  align-content: center;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 18px 60px rgba(30, 42, 36, 0.08);
}

.hero-stats strong {
  font-size: 2rem;
  color: var(--primary);
}

.hero-stats span {
  align-self: center;
  color: var(--muted);
}

.section {
  margin-top: 28px;
}

.section-title {
  margin: 12px 0 24px;
}

.section-title h1 {
  font-size: clamp(2rem, 5vw, 3.5rem);
}

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

.card,
.question-card,
.result-card,
.feedback,
.about {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.card {
  display: flex;
  min-height: 210px;
  flex-direction: column;
  justify-content: space-between;
  padding: 20px;
  transition: transform 180ms ease, box-shadow 180ms ease, border-color 180ms ease;
}

.card:hover {
  transform: translateY(-2px);
  box-shadow: 0 18px 42px rgba(30, 42, 36, 0.1);
}

.card-kicker {
  margin: 0 0 18px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 900;
  text-transform: uppercase;
}

.mode-card {
  position: relative;
  overflow: hidden;
}

.mode-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 6px;
  background: var(--card-accent, var(--primary));
}

.mode-card::after {
  content: "";
  position: absolute;
  right: 18px;
  top: 18px;
  width: 42px;
  height: 42px;
  border: 1px solid color-mix(in srgb, var(--card-accent, var(--primary)) 55%, transparent);
  border-radius: 50%;
}

.tone-study {
  --card-accent: #226c5f;
  background: linear-gradient(180deg, #ffffff, #edf6f2);
}

.tone-season {
  --card-accent: #9b5b9f;
  background: linear-gradient(180deg, #ffffff, #f6eef7);
}

.tone-spark {
  --card-accent: #b75d2a;
  background: linear-gradient(180deg, #ffffff, #fff2e8);
}

.tone-review {
  --card-accent: #4d67aa;
  background: linear-gradient(180deg, #ffffff, #eef2fb);
}

.pack-card {
  border-top: 4px solid var(--pack-accent, var(--primary));
}

.grade-tone-1,
.grade-tone-2,
.grade-tone-3 {
  --pack-accent: #3f8f73;
}

.grade-tone-4,
.grade-tone-5,
.grade-tone-6 {
  --pack-accent: #b75d2a;
}

.grade-tone-7,
.grade-tone-8,
.grade-tone-9 {
  --pack-accent: #4d67aa;
}

[class*="theme-tone-"] {
  --pack-accent: #9b5b9f;
}

.primary-button {
  min-height: 44px;
  border: 0;
  border-radius: 8px;
  padding: 10px 16px;
  background: var(--primary);
  color: #fff;
  font-weight: 800;
}

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

.secondary-button,
.text-button,
.poem-link {
  min-height: 40px;
  border-radius: 8px;
  padding: 8px 12px;
  font-weight: 800;
}

.secondary-button {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--primary);
}

.text-button,
.poem-link {
  border: 0;
  background: transparent;
  color: var(--primary);
}

.poem-link {
  padding: 0 2px;
  text-align: left;
}

.meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  color: var(--muted);
  font-size: 0.92rem;
}

.meta-row span {
  padding: 5px 9px;
  border-radius: 999px;
  background: #edf2ed;
}

.quiz-shell {
  max-width: 820px;
  margin: 0 auto;
}

.quiz-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
}

.quiz-head h1 {
  font-size: clamp(1.8rem, 5vw, 3.2rem);
}

.counter {
  flex: 0 0 auto;
  color: var(--muted);
  font-weight: 800;
}

.progress {
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: #dce3dd;
}

.progress span {
  display: block;
  height: 100%;
  background: var(--accent);
}

.question-card {
  margin: 18px 0;
  padding: clamp(20px, 5vw, 34px);
}

.prompt {
  margin: 0 0 12px;
  font-size: clamp(1.5rem, 5vw, 2.6rem);
  line-height: 1.45;
  font-weight: 800;
}

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

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

.option-button {
  width: 100%;
  min-height: 58px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px 18px;
  background: #fff;
  color: var(--ink);
  text-align: left;
  line-height: 1.5;
}

.option-button:hover:not(:disabled),
.option-button.is-answer {
  border-color: var(--primary);
  background: #eaf4f0;
}

.feedback {
  margin-top: 18px;
  padding: 20px;
}

.feedback.correct {
  border-color: rgba(40, 120, 77, 0.4);
}

.feedback.wrong {
  border-color: rgba(162, 59, 59, 0.4);
}

.result-card {
  max-width: 720px;
  margin: 0 auto;
  padding: clamp(24px, 6vw, 48px);
  text-align: center;
}

.result-card h1 {
  font-size: clamp(2rem, 5vw, 3.4rem);
}

.score {
  margin: 22px auto;
  font-size: clamp(4rem, 12vw, 7rem);
  font-weight: 900;
  color: var(--primary);
}

.result-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 24px;
}

.reward-card {
  margin: 0 0 22px;
  padding: 18px;
  border: 1px solid rgba(183, 93, 42, 0.24);
  border-radius: 8px;
  background: #fff7ef;
  text-align: left;
}

.reward-card h2 {
  color: var(--accent);
}

.reward-card p:last-child {
  margin-bottom: 0;
  color: var(--muted);
  line-height: 1.7;
}

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

.result-grid span,
.list-item {
  border-radius: 8px;
  background: #edf2ed;
  padding: 12px;
}

.empty {
  padding: 24px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
}

.list,
.poem-list {
  display: grid;
  gap: 12px;
  margin-top: 18px;
}

.list-item p {
  margin: 8px 0;
}

.search {
  width: 100%;
  min-height: 48px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 14px;
}

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

.poem-card blockquote {
  margin: 12px 0;
  color: var(--ink);
  line-height: 1.9;
}

.poem-card {
  cursor: pointer;
}

.poem-card:focus {
  outline: 3px solid rgba(34, 108, 95, 0.25);
  outline-offset: 3px;
}

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

.tags span {
  padding: 4px 8px;
  border-radius: 999px;
  background: #edf2ed;
  color: var(--muted);
  font-size: 0.86rem;
}

.about {
  padding: clamp(22px, 5vw, 40px);
}

.about h1 {
  font-size: clamp(2rem, 5vw, 3.5rem);
}

.poem-detail {
  max-width: 820px;
  margin: 0 auto;
  padding: clamp(24px, 6vw, 56px);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(180deg, #fff, #fbfcfa);
  box-shadow: 0 22px 70px rgba(30, 42, 36, 0.1);
}

.poem-detail h1 {
  margin-bottom: 24px;
  font-size: clamp(2.4rem, 7vw, 5rem);
}

.poem-lines {
  margin: 26px 0;
  padding: 22px;
  border-left: 5px solid var(--primary);
  background: #f3f7f3;
}

.poem-lines p {
  margin: 0 0 12px;
  font-size: clamp(1.2rem, 4vw, 1.8rem);
  line-height: 1.8;
}

.detail-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 24px;
}

.error {
  padding: 24px;
}

@media (max-width: 860px) {
  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .nav {
    width: 100%;
    justify-content: flex-start;
  }

  .hero,
  .grid,
  .poem-list {
    grid-template-columns: 1fr;
  }

  .card {
    min-height: 0;
  }

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

  .result-actions {
    grid-template-columns: 1fr;
  }
}
