:root {
  --panel: rgba(255, 252, 246, 0.82);
  --line: rgba(83, 58, 31, 0.14);
  --text: #2a2118;
  --muted: #7d6755;
  --accent: #9f613d;
  --accent-deep: #6e3b20;
  --accent-soft: #ead2b7;
  --ok: #43623e;
  --warn: #9c6131;
  --shadow: 0 18px 60px rgba(90, 54, 24, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Outfit", "PingFang SC", "Hiragino Sans GB", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(240, 204, 160, 0.65), transparent 28%),
    radial-gradient(circle at top right, rgba(208, 173, 132, 0.36), transparent 24%),
    linear-gradient(180deg, #f8f3ea 0%, #f1e7d7 52%, #efe7dc 100%);
}

button,
input {
  font: inherit;
}

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

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.8fr) minmax(280px, 0.8fr);
  gap: 24px;
  align-items: stretch;
  margin-bottom: 28px;
}

.hero-copy,
.status-card,
.panel {
  background: var(--panel);
  backdrop-filter: blur(18px);
  border: 1px solid var(--line);
  border-radius: 24px;
  box-shadow: var(--shadow);
}

.hero-copy {
  padding: 36px;
}

.eyebrow,
.section-kicker {
  margin: 0 0 12px;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-size: 0.72rem;
  color: var(--muted);
}

.hero h1,
.panel h2 {
  margin: 0;
  font-family: "Noto Serif TC", "Songti SC", serif;
  font-weight: 700;
}

.hero h1 {
  font-size: clamp(2.2rem, 4vw, 4.6rem);
  line-height: 1.05;
  max-width: 12ch;
}

.hero-text,
.hero-note,
.panel-copy,
.micro-copy {
  color: var(--muted);
  line-height: 1.75;
}

.hero-text {
  font-size: 1.05rem;
  max-width: 64ch;
  margin: 18px 0 22px;
}

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

.status-card,
.panel {
  padding: 28px;
}

.status-card {
  display: grid;
  gap: 16px;
  align-content: start;
}

.status-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
}

.status-row:last-child {
  padding-bottom: 0;
  border-bottom: 0;
}

.layout {
  display: grid;
  grid-template-columns: 1.05fr 1.45fr;
  gap: 24px;
}

.review-panel,
.drill-panel,
.relation-panel,
.audio-panel {
  grid-column: span 1;
}

.practice-panel {
  grid-row: span 2;
}

.course-panel,
.practice-panel {
  min-height: 420px;
}

.panel-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
  margin-bottom: 22px;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border-radius: 999px;
  background: rgba(159, 97, 61, 0.1);
  color: var(--accent-deep);
  font-size: 0.92rem;
}

.pill.muted {
  background: rgba(83, 58, 31, 0.08);
}

.primary-btn,
.secondary-btn,
.ghost-btn,
.course-btn,
.tag-btn {
  border: 0;
  border-radius: 16px;
  cursor: pointer;
  transition: transform 180ms ease, box-shadow 180ms ease, background 180ms ease;
}

.primary-btn,
.secondary-btn,
.ghost-btn {
  padding: 14px 18px;
}

.primary-btn {
  background: linear-gradient(135deg, var(--accent) 0%, #b9855d 100%);
  color: #fff9f1;
  box-shadow: 0 14px 26px rgba(125, 70, 38, 0.25);
}

.secondary-btn {
  background: rgba(255, 250, 243, 0.95);
  color: var(--accent-deep);
  border: 1px solid rgba(159, 97, 61, 0.16);
}

.ghost-btn {
  background: transparent;
  color: var(--muted);
  border: 1px solid rgba(83, 58, 31, 0.14);
}

.primary-btn:hover,
.secondary-btn:hover,
.ghost-btn:hover,
.course-btn:hover,
.tag-btn:hover {
  transform: translateY(-1px);
}

.course-list,
.mini-list,
.tag-grid {
  display: grid;
  gap: 14px;
}

.course-btn {
  width: 100%;
  text-align: left;
  padding: 18px;
  background: rgba(255, 250, 243, 0.92);
  border: 1px solid rgba(159, 97, 61, 0.1);
}

.course-btn.active {
  background: linear-gradient(135deg, rgba(159, 97, 61, 0.16), rgba(255, 250, 243, 0.98));
  border-color: rgba(159, 97, 61, 0.24);
}

.course-btn h3,
.mini-card h3 {
  margin: 0 0 8px;
  font-family: "Noto Serif TC", "Songti SC", serif;
  font-size: 1.1rem;
}

.course-btn p,
.mini-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
}

.practice-card {
  min-height: 280px;
  padding: 28px;
  border-radius: 22px;
  background:
    linear-gradient(135deg, rgba(255, 248, 238, 0.96), rgba(245, 233, 214, 0.8)),
    url("data:image/svg+xml,%3Csvg width='260' height='260' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' stroke='rgba(159,97,61,0.08)'%3E%3Cpath d='M130 24c31 0 56 25 56 56s-25 56-56 56-56-25-56-56 25-56 56-56Zm0 100c24 0 44 20 44 44s-20 44-44 44-44-20-44-44 20-44 44-44Z'/%3E%3C/g%3E%3C/svg%3E");
  border: 1px solid rgba(159, 97, 61, 0.12);
}

.ruby-stage {
  display: flex;
  justify-content: flex-end;
  align-items: stretch;
  min-height: 520px;
  padding: 12px;
  border-radius: 20px;
  background: rgba(255, 251, 245, 0.55);
  border: 1px solid rgba(159, 97, 61, 0.08);
}

.ruby-board {
  width: fit-content;
  max-height: 100%;
  writing-mode: vertical-rl;
  text-orientation: upright;
  display: flex;
  flex-wrap: wrap;
  align-content: flex-start;
  justify-content: flex-start;
  gap: 12px 20px;
  margin-bottom: 10px;
  margin-left: auto;
}

.ruby-unit {
  display: inline-flex;
  writing-mode: horizontal-tb;
  flex-direction: row-reverse;
  align-items: center;
  justify-content: center;
  min-width: 4.4rem;
  min-height: 2.6rem;
  padding: 3px 4px;
  border-radius: 12px;
  background: rgba(255, 252, 246, 0.7);
}

.hanzi-char {
  writing-mode: vertical-rl;
  text-orientation: upright;
  font-family: "Noto Serif TC", "Songti SC", serif;
  font-size: clamp(1.95rem, 2.5vw, 2.95rem);
  line-height: 1.2;
}

.side-pinyin {
  writing-mode: horizontal-tb;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.2rem;
  margin-right: 8px;
  font-size: 0.82rem;
  line-height: 1;
  color: var(--accent-deep);
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.ruby-punc {
  display: inline-flex;
  writing-mode: vertical-rl;
  text-orientation: upright;
  align-items: center;
  justify-content: center;
  font-family: "Noto Serif TC", "Songti SC", serif;
  font-size: clamp(1.6rem, 2vw, 2.2rem);
  color: var(--muted);
}

.practice-card.empty {
  display: grid;
  place-items: center;
}

.lesson-name {
  margin: 0 0 12px;
  color: var(--accent-deep);
  font-size: 0.92rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.chant-line {
  margin: 0;
  font-family: "Noto Serif TC", "Songti SC", serif;
  font-size: clamp(1.8rem, 2.3vw, 2.7rem);
  line-height: 1.5;
}

.pinyin-line {
  margin: 16px 0 0;
  font-size: 1.06rem;
  color: var(--muted);
  line-height: 1.7;
}

.sentence-view {
  margin-top: 14px;
  opacity: 0.72;
  font-size: 0.95rem;
}

.tag-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 20px;
}

.tiny-tag,
.tag-btn {
  display: inline-flex;
  align-items: center;
  padding: 9px 12px;
  border-radius: 999px;
  background: rgba(159, 97, 61, 0.1);
  color: var(--accent-deep);
}

.tag-btn {
  justify-content: center;
  border: 1px solid rgba(159, 97, 61, 0.14);
  background: rgba(255, 250, 243, 0.92);
}

.feedback-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-top: 18px;
}

.feedback-card,
.mini-card {
  padding: 18px;
  border-radius: 18px;
  background: rgba(255, 250, 243, 0.88);
  border: 1px solid rgba(159, 97, 61, 0.08);
}

.feedback-label {
  margin: 0 0 10px;
  font-size: 0.82rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.feedback-value {
  margin: 0;
  line-height: 1.65;
}

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

.success {
  color: var(--ok);
}

.warning {
  color: var(--warn);
}

.file-label {
  display: inline-flex;
  margin: 8px 0 12px;
  padding: 12px 16px;
  border-radius: 14px;
  background: rgba(159, 97, 61, 0.1);
  color: var(--accent-deep);
  cursor: pointer;
}

.tts-config-grid {
  display: grid;
  gap: 12px;
  margin: 16px 0 14px;
}

.config-label {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 0.9rem;
}

.text-input {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid rgba(159, 97, 61, 0.16);
  border-radius: 14px;
  background: rgba(255, 252, 246, 0.95);
  color: var(--text);
}

input[type="file"] {
  display: block;
  width: 100%;
  color: var(--muted);
}

code {
  padding: 2px 6px;
  border-radius: 8px;
  background: rgba(83, 58, 31, 0.08);
}

@media (max-width: 980px) {
  .hero,
  .layout {
    grid-template-columns: 1fr;
  }

  .practice-panel {
    grid-row: auto;
  }
}

@media (max-width: 640px) {
  .page-shell {
    width: min(100% - 20px, 100%);
    padding-top: 18px;
  }

  .hero-copy,
  .status-card,
  .panel {
    padding: 20px;
    border-radius: 20px;
  }

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

  .chant-line {
    font-size: 1.58rem;
  }

  .ruby-board {
    min-height: 420px;
    gap: 8px 14px;
  }

  .ruby-unit {
    min-width: 3.7rem;
    min-height: 2.2rem;
  }

  .side-pinyin {
    min-width: 1.9rem;
    margin-right: 6px;
    font-size: 0.74rem;
  }
}
