:root {
  --ink: #202124;
  --muted: #69707d;
  --line: #d9e1df;
  --paper: #fbfaf6;
  --panel: #ffffff;
  --green: #256f4c;
  --green-soft: #e7f4ed;
  --red: #b33b32;
  --red-soft: #fbe9e7;
  --blue: #315f8f;
  --blue-soft: #e8f0f8;
  --gold: #a86f14;
  --shadow: 0 18px 55px rgba(32, 33, 36, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family:
    "Songti SC", "Noto Serif SC", "STSong", "Microsoft YaHei", serif;
  background:
    linear-gradient(120deg, rgba(232, 240, 248, 0.82), transparent 38%),
    linear-gradient(240deg, rgba(231, 244, 237, 0.8), transparent 42%),
    var(--paper);
}

button,
input {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

.app-shell {
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
  padding: 34px 0 56px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
}

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

.brand-mark {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--green);
  background: rgba(255, 255, 255, 0.74);
  box-shadow: 0 8px 28px rgba(32, 33, 36, 0.08);
  font-size: 26px;
  font-weight: 700;
}

.brand h1 {
  margin: 0;
  font-size: clamp(25px, 4vw, 42px);
  line-height: 1.08;
  letter-spacing: 0;
}

.brand p,
.hint {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.6;
}

.ghost-button,
.primary-button,
.small-button {
  min-height: 42px;
  border-radius: 8px;
  padding: 0 18px;
  font-family: "Microsoft YaHei", sans-serif;
  font-weight: 700;
}

.primary-button {
  color: #fff;
  background: var(--green);
  box-shadow: 0 10px 24px rgba(37, 111, 76, 0.22);
}

.primary-button:disabled {
  cursor: not-allowed;
  background: #9ba8a1;
  box-shadow: none;
}

.ghost-button,
.small-button {
  color: var(--ink);
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.7);
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.02fr) minmax(320px, 0.98fr);
  gap: 24px;
  align-items: stretch;
}

.search-panel,
.poem-panel,
.quiz-panel,
.question-card,
.result-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.86);
  box-shadow: var(--shadow);
}

.search-panel,
.poem-panel,
.quiz-panel {
  padding: 24px;
}

.search-label {
  display: block;
  margin-bottom: 10px;
  color: var(--muted);
  font-family: "Microsoft YaHei", sans-serif;
  font-size: 14px;
}

.search-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
}

.search-input {
  width: 100%;
  min-height: 52px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 16px;
  outline: none;
  background: #fff;
  font-family: "Microsoft YaHei", sans-serif;
  font-size: 17px;
}

.search-input:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 4px rgba(37, 111, 76, 0.13);
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
}

.chip {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 7px 12px;
  color: var(--muted);
  background: #fff;
  font-family: "Microsoft YaHei", sans-serif;
  font-size: 13px;
}

.result-list {
  display: grid;
  gap: 12px;
  margin-top: 22px;
}

.result-card {
  width: 100%;
  padding: 16px;
  text-align: left;
}

.result-card:hover {
  border-color: rgba(37, 111, 76, 0.48);
  transform: translateY(-1px);
}

.result-title {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.result-title strong {
  font-size: 20px;
}

.result-title span {
  flex: 0 0 auto;
  color: var(--muted);
  font-family: "Microsoft YaHei", sans-serif;
  font-size: 13px;
}

.stage-card {
  position: relative;
  min-height: 420px;
  overflow: hidden;
  border: 1px solid rgba(37, 111, 76, 0.22);
  border-radius: 8px;
  background:
    linear-gradient(rgba(255, 255, 255, 0.74), rgba(255, 255, 255, 0.84)),
    repeating-linear-gradient(
      90deg,
      rgba(37, 111, 76, 0.09) 0,
      rgba(37, 111, 76, 0.09) 1px,
      transparent 1px,
      transparent 56px
    );
  padding: 32px;
  box-shadow: var(--shadow);
}

.stage-card h2 {
  margin: 0 0 12px;
  font-size: clamp(28px, 4vw, 48px);
  letter-spacing: 0;
}

.stage-card .sample-line {
  margin: 0;
  color: var(--green);
  font-size: clamp(26px, 5vw, 58px);
  line-height: 1.45;
  writing-mode: vertical-rl;
  max-height: 340px;
}

.poem-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 20px;
}

.poem-title {
  margin: 0;
  font-size: clamp(30px, 5vw, 56px);
  line-height: 1.1;
}

.poem-meta,
.progress-text {
  color: var(--muted);
  font-family: "Microsoft YaHei", sans-serif;
}

.poem-body {
  display: grid;
  grid-template-columns: minmax(220px, 0.7fr) minmax(260px, 1fr);
  gap: 24px;
  align-items: start;
}

.poem-lines {
  margin: 0;
  padding: 22px;
  border-radius: 8px;
  background: var(--paper);
  font-size: clamp(23px, 3vw, 34px);
  line-height: 1.85;
  white-space: pre-line;
}

.meaning {
  display: grid;
  gap: 14px;
  font-family: "Microsoft YaHei", sans-serif;
}

.meaning h3,
.quiz-panel h2 {
  margin: 0;
  font-size: 22px;
}

.meaning p {
  margin: 0;
  color: #444b55;
  line-height: 1.8;
}

.toolbar {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 24px;
}

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

.progress-track {
  width: min(320px, 100%);
  height: 12px;
  overflow: hidden;
  border-radius: 999px;
  background: #edf1ef;
}

.progress-bar {
  width: var(--progress);
  height: 100%;
  background: linear-gradient(90deg, var(--green), var(--gold));
}

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

.question-card {
  padding: 16px;
  box-shadow: none;
}

.question-card.correct {
  border-color: rgba(37, 111, 76, 0.52);
  background: var(--green-soft);
}

.question-card.wrong {
  border-color: rgba(179, 59, 50, 0.42);
  background: var(--red-soft);
}

.question-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
  font-family: "Microsoft YaHei", sans-serif;
}

.badge {
  display: inline-grid;
  place-items: center;
  min-width: 34px;
  height: 28px;
  border-radius: 999px;
  color: var(--blue);
  background: var(--blue-soft);
  font-weight: 700;
}

.status {
  color: var(--muted);
  font-size: 13px;
}

.question-card h3 {
  margin: 0 0 12px;
  font-family: "Microsoft YaHei", sans-serif;
  font-size: 17px;
  line-height: 1.55;
}

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

.option {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px 10px;
  background: #fff;
  font-family: "Microsoft YaHei", sans-serif;
  line-height: 1.35;
}

.option input {
  margin-top: 3px;
  accent-color: var(--green);
}

.feedback {
  min-height: 24px;
  margin: 10px 0 0;
  color: var(--muted);
  font-family: "Microsoft YaHei", sans-serif;
  font-size: 14px;
  line-height: 1.6;
}

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

.feedback.bad {
  color: var(--red);
}

.empty {
  padding: 18px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.74);
  font-family: "Microsoft YaHei", sans-serif;
  line-height: 1.7;
}

@media (max-width: 820px) {
  .app-shell {
    width: min(100% - 22px, 680px);
    padding-top: 18px;
  }

  .topbar,
  .poem-head,
  .quiz-head {
    align-items: stretch;
    flex-direction: column;
  }

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

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

  .stage-card {
    min-height: 290px;
    padding: 24px;
  }

  .stage-card .sample-line {
    writing-mode: horizontal-tb;
    max-height: none;
    font-size: 34px;
  }

  .toolbar {
    flex-direction: column;
  }

  .primary-button,
  .ghost-button {
    width: 100%;
  }
}
