:root {
  --bg: #f4efe6;
  --paper: rgba(255, 251, 244, 0.92);
  --ink: #1f1913;
  --muted: #67594d;
  --line: rgba(31, 25, 19, 0.1);
  --accent: #bb5d2f;
  --accent-strong: #973f1f;
  --accent-soft: #f9e4d5;
  --olive: #52623d;
  --olive-soft: #e5ebd5;
  --rose-soft: #f7ebe5;
  --green: #2f6b4f;
  --shadow: 0 26px 70px rgba(42, 27, 16, 0.1);
  --radius: 30px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: "Segoe UI", "PingFang SC", "Hiragino Sans GB", sans-serif;
  background: linear-gradient(180deg, #fcf8f2 0%, var(--bg) 100%);
  overflow-x: hidden;
  position: relative;
}

button,
input,
textarea {
  font: inherit;
}

code {
  font-family: "SFMono-Regular", Consolas, monospace;
}

.ambient {
  position: fixed;
  width: 36rem;
  height: 36rem;
  border-radius: 50%;
  filter: blur(74px);
  opacity: 0.44;
  pointer-events: none;
}

.ambient-left {
  left: -10rem;
  top: -11rem;
  background: rgba(187, 93, 47, 0.16);
}

.ambient-right {
  right: -12rem;
  top: 10rem;
  background: rgba(82, 98, 61, 0.12);
}

.page-shell {
  position: relative;
  z-index: 1;
  max-width: 1180px;
  margin: 0 auto;
  padding: 32px 20px 64px;
}

.hero,
.section-block,
.dialogue-bubble,
.phrase-card,
.grammar-note,
.vocab-group,
.vocab-chip,
.exercise-panel,
.quiz-card,
.fill-card,
.production-card,
.feedback-box {
  border: 1px solid var(--line);
  background: var(--paper);
  box-shadow: var(--shadow);
}

.hero {
  margin-bottom: 24px;
}

.hero-copy,
.section-block {
  border-radius: var(--radius);
}

.hero-copy {
  padding: 34px;
  background: linear-gradient(135deg, rgba(255, 249, 242, 0.96) 0%, rgba(249, 238, 228, 0.96) 100%);
  box-shadow: var(--shadow);
  border: 1px solid var(--line);
}

.section-block {
  padding: 24px;
  background: transparent;
  box-shadow: none;
  border: none;
  border-radius: 0;
}

.eyebrow,
.section-label,
.exercise-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 0 0 12px;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--accent);
}

.hero h1 {
  margin: 0;
  font-size: clamp(3rem, 6vw, 5.1rem);
  line-height: 0.95;
  letter-spacing: -0.06em;
}

.hero-text,
.section-subtext,
.dialogue-meta p,
.phrase-note,
.grammar-note p,
.vocab-caption,
.quiz-feedback,
.fill-feedback,
.production-prompt,
.feedback-box {
  color: var(--muted);
  line-height: 1.75;
}

.hero-text {
  max-width: 44rem;
  font-size: 17px;
  margin: 16px 0 0;
}

.hero-actions,
.production-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.unit-switcher {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
}

.switch-button {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.76);
  color: var(--muted);
  border-radius: 999px;
  padding: 8px 12px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 700;
}

.switch-button.active {
  color: var(--accent-strong);
  border-color: rgba(187, 93, 47, 0.28);
  background: #fff1e6;
}

.hero-actions {
  margin-top: 24px;
}

.primary-button,
.secondary-button {
  border-radius: 999px;
  padding: 12px 18px;
  cursor: pointer;
  transition: transform 120ms ease, border-color 120ms ease, background-color 120ms ease;
}

.small-button {
  padding: 10px 14px;
}

.primary-button {
  border: none;
  color: #fff;
  font-weight: 800;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-strong) 100%);
}

.secondary-button {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.8);
  color: var(--ink);
  font-weight: 700;
}

.primary-button:hover,
.secondary-button:hover,
.play-button:hover,
.option-button:hover {
  transform: translateY(-1px);
}

.checklist span,
.dialogue-actions .primary-button {
  font-weight: 700;
}

.checklist span {
  border-radius: 999px;
  padding: 8px 12px;
  border: 1px solid rgba(187, 93, 47, 0.14);
  background: #fff7f1;
  font-size: 13px;
  font-weight: 700;
}

.lesson-flow {
  display: grid;
  gap: 40px;
}

.section-block h2,
.exercise-head h3 {
  margin: 0;
  font-size: 30px;
  letter-spacing: -0.04em;
}

.section-subtext {
  margin: 8px 0 0;
  font-size: 14px;
}

.dialogue-list {
  display: grid;
  gap: 10px;
  margin-top: 18px;
}

.dialogue-bubble {
  display: block;
  padding: 0;
  border: none;
  background: transparent;
  box-shadow: none;
}

.bubble-speaker {
  margin: 0 0 3px;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent);
}

.line-text {
  margin: 0;
  font-size: 23px;
  line-height: 1.5;
  font-weight: 760;
  display: inline;
}

.line-translation {
  margin: 4px 0 0;
  font-size: 14px;
  color: var(--muted);
}

.token {
  display: inline-block;
  margin-right: 3px;
  padding: 1px 4px;
  border-radius: 8px;
  cursor: pointer;
  transition: background-color 120ms ease, color 120ms ease;
}

.token:hover {
  background: rgba(255, 255, 255, 0.76);
  color: var(--accent);
}

.play-button {
  width: 24px;
  height: 24px;
  border: none;
  border-radius: 50%;
  color: white;
  background: linear-gradient(135deg, var(--accent) 0%, #d38143 100%);
  box-shadow: none;
  cursor: pointer;
  font-size: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  vertical-align: middle;
  margin-left: 8px;
}

.grammar-panel,
.phrase-list,
.vocab-groups,
.practice-stack,
.quiz-list,
.fill-list {
  display: grid;
  gap: 16px;
}

.grammar-table-wrap {
  overflow-x: auto;
}

.grammar-table {
  width: 100%;
  border-collapse: collapse;
  margin: 18px 0 16px;
  overflow: hidden;
  border-radius: 18px;
}

.grammar-table th,
.grammar-table td {
  padding: 12px 14px;
  text-align: left;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.72);
}

.grammar-table th {
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
}

.grammar-note,
.phrase-card,
.exercise-panel,
.vocab-group,
.production-card {
  border-radius: 24px;
  padding: 18px;
}

.grammar-note {
  background: linear-gradient(135deg, rgba(229, 235, 213, 0.78) 0%, rgba(255, 255, 255, 0.92) 100%);
  box-shadow: none;
}

.grammar-note h3,
.phrase-card h3,
.vocab-group h3,
.quiz-card h4,
.fill-card h4 {
  margin: 0;
  font-size: 22px;
  letter-spacing: -0.03em;
}

.grammar-note p,
.phrase-note,
.vocab-caption,
.quiz-question,
.fill-question {
  margin: 8px 0 0;
  font-size: 14px;
}

.phrase-card {
  background: linear-gradient(135deg, rgba(255, 247, 239, 0.98) 0%, rgba(255, 255, 255, 0.9) 100%);
  box-shadow: none;
}

.phrase-pattern {
  cursor: pointer;
}

.vocab-groups {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-top: 18px;
}

.vocab-group {
  background: rgba(255, 255, 255, 0.82);
  box-shadow: none;
}

.vocab-chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 14px;
}

.vocab-chip {
  border-radius: 16px;
  padding: 10px 12px;
  background: #fff8f3;
  box-shadow: none;
  min-width: 120px;
}

.vocab-chip strong {
  display: block;
  font-size: 15px;
  cursor: pointer;
}

.vocab-chip span {
  display: block;
  margin-top: 4px;
  font-size: 12px;
  color: var(--muted);
}

.practice-stack {
  margin-top: 18px;
}

.exercise-panel {
  background: rgba(255, 255, 255, 0.82);
  box-shadow: none;
}

.exercise-head h3 {
  font-size: 24px;
}

.quiz-card,
.fill-card {
  border: 1px dashed rgba(187, 93, 47, 0.2);
  border-radius: 18px;
  padding: 16px;
  background: #fff8f2;
  box-shadow: none;
}

.quiz-options,
.fill-input-row {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.option-button,
textarea {
  width: 100%;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: white;
}

.option-button {
  padding: 11px 12px;
  text-align: left;
  cursor: pointer;
}

.option-button.selected {
  border-color: var(--accent);
  background: #fff0e6;
}

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

.option-button.wrong {
  border-color: #b44f3a;
  background: #fbebe7;
}

.quiz-actions,
.fill-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 12px;
}

textarea {
  padding: 12px 14px;
}

textarea {
  min-height: 140px;
  resize: vertical;
}

.fill-inline {
  display: inline-flex;
  min-width: 0;
  margin: 0 6px;
  vertical-align: middle;
}

.fill-inline input {
  width: 100%;
  border: none;
  border-bottom: 2px solid rgba(187, 93, 47, 0.28);
  background: transparent;
  padding: 2px 4px 6px;
  text-align: center;
  outline: none;
  font-size: 15px;
}

.fill-inline input.correct {
  border-bottom-color: var(--green);
  color: var(--green);
}

.fill-inline input.wrong {
  border-bottom-color: #a14d36;
  color: #a14d36;
}

.dialogue-actions {
  margin-top: 14px;
}

.section-plain {
  padding-left: 0;
  padding-right: 0;
}

.feedback-box,
.quiz-feedback,
.fill-feedback {
  margin-top: 10px;
  font-size: 14px;
}

.feedback-box {
  border-radius: 16px;
  padding: 14px;
  box-shadow: none;
}

.neutral {
  background: #f8f4ef;
}

.success {
  background: #edf7f0;
  color: var(--green);
  border-color: rgba(47, 107, 79, 0.18);
}

.error {
  background: #faece7;
  color: #a14d36;
  border-color: rgba(161, 77, 54, 0.18);
}

.checklist {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 14px;
}

@media (max-width: 1024px) {
  .vocab-groups {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .page-shell {
    padding: 18px 14px 40px;
  }

  .hero-copy,
  .hero-panel,
  .section-block {
    padding: 18px;
    border-radius: 24px;
  }

  .dialogue-bubble {
    grid-template-columns: 1fr;
  }

  .line-text {
    font-size: 20px;
  }
}
