:root {
  color-scheme: light;
  --bg: #e8f1f4;
  --panel: #ffffff;
  --ink: #15313a;
  --muted: #59727b;
  --line: #cbdde2;
  --accent: #147a78;
  --accent-strong: #0b5759;
  --sun: #f6b940;
  --coral: #e66a54;
  --warning-bg: #fff4d9;
  --warning-line: #f0c65e;
  --warning-ink: #76510d;
  --shadow: 0 18px 42px rgba(32, 75, 88, 0.15);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Microsoft YaHei", "PingFang SC", "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--bg);
  letter-spacing: 0;
}

button,
textarea {
  font: inherit;
}

.classroom {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 32px 24px;
}

.panel {
  width: min(980px, 100%);
  background: var(--panel);
  border: 1px solid #d9e6e9;
  box-shadow: var(--shadow);
  padding: 30px;
}

.header {
  margin-bottom: 22px;
}

.brand-row,
.teacher-heading,
.goal-line,
.progress-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--coral);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 1px;
}

h1 {
  margin: 0;
  font-size: 34px;
  line-height: 1.15;
  letter-spacing: 0;
}

.coach-mark {
  width: 72px;
  height: 72px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border: 3px solid var(--ink);
  border-radius: 50%;
  background: var(--sun);
  color: var(--ink);
  font-weight: 800;
  transform: rotate(-4deg);
}

.coach-mark span { transform: rotate(4deg); }

.goal-line {
  align-items: baseline;
  flex-wrap: wrap;
  margin: 24px 0 10px;
  padding: 14px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 14px;
}

.goal-line strong { color: var(--ink); font-size: 16px; }

.goal-line #goalDetail { margin-left: auto; }

.teacher-card {
  min-height: 230px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding: 24px 0;
}

.teacher-label,
.input-label {
  display: block;
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}

.focus-tag {
  padding: 5px 9px;
  border-radius: 999px;
  background: #e0f0ee;
  color: var(--accent-strong);
  font-size: 12px;
  font-weight: 800;
}

.teacher-output {
  white-space: pre-wrap;
  line-height: 1.75;
  font-size: 18px;
  overflow-wrap: anywhere;
}

.teacher-output.status {
  color: var(--warning-ink);
  background: var(--warning-bg);
  border: 1px solid var(--warning-line);
  border-radius: 8px;
  padding: 14px;
}

.student-form {
  margin-top: 20px;
}

.dictation-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 18px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #edf8f6;
}

.dictation-panel[hidden],
.student-form[hidden],
.speech-panel[hidden] {
  display: none;
}

.speech-panel {
  display: grid;
  gap: 10px;
  padding: 16px;
  border: 1px solid #8bc5bd;
  background: #edf8f6;
}

.speech-panel p {
  margin: 0;
  line-height: 1.6;
}

.dictation-panel p {
  margin: 0;
  line-height: 1.6;
}

.dictation-panel .icon-button {
  min-height: 44px;
  white-space: nowrap;
}

.input-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: stretch;
}

textarea {
  width: 100%;
  min-height: 96px;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  color: var(--ink);
  background: #ffffff;
  line-height: 1.6;
}

textarea:focus {
  outline: 3px solid rgba(31, 122, 104, 0.22);
  border-color: var(--accent);
}

.actions {
  display: grid;
  grid-template-rows: 1fr;
  gap: 12px;
  min-width: 110px;
}

button {
  border: 0;
  border-radius: 8px;
  padding: 0 18px;
  cursor: pointer;
  font-weight: 700;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.72;
}

.icon-button {
  color: var(--accent-strong);
  background: #e5f3ef;
}

.submit-button {
  color: #ffffff;
  background: var(--accent);
  box-shadow: inset 0 -3px 0 rgba(0, 0, 0, 0.14);
}

.submit-button:hover,
.submit-button:focus-visible {
  background: var(--accent-strong);
}

.icon-button:hover,
.icon-button:focus-visible {
  background: #d5ece5;
}

@media (max-width: 640px) {
  .classroom {
    padding: 14px;
    place-items: stretch;
  }

  .panel {
    padding: 20px;
  }

  h1 {
    font-size: 28px;
  }

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

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

  .actions {
    grid-template-columns: 1fr;
    grid-template-rows: auto;
    min-width: 0;
  }

  button {
    min-height: 48px;
  }

  .coach-mark { width: 56px; height: 56px; font-size: 13px; }
  .goal-line #goalDetail { width: 100%; margin-left: 0; }
}

.progress-row { color: var(--muted); margin: 14px 0 8px; }
progress { display: block; width: 100%; height: 12px; accent-color: var(--accent); }
h2 { margin: 0 0 14px; font-size: 22px; overflow-wrap: anywhere; }
.question { white-space: pre-wrap; font-size: 20px; line-height: 1.7; overflow-wrap: anywhere; }
.notice { min-height: 1.6em; line-height: 1.6; color: var(--warning-ink); overflow-wrap: anywhere; }
textarea:disabled { background: #f0f2f1; }

.entry-choice { padding: 24px 0; text-align: center; }
.entry-lead { margin: 0 0 18px; font-size: 18px; color: var(--ink); }
.entry-actions { display: flex; flex-direction: column; align-items: center; gap: 14px; }
.entry-actions .submit-button { min-width: 180px; padding: 12px 24px; font-size: 16px; }
.link-button {
  background: none;
  border: 0;
  padding: 0;
  color: var(--accent-strong);
  font-weight: 700;
  font-size: 14px;
  text-decoration: underline;
  cursor: pointer;
}
.link-button:hover,
.link-button:focus-visible { color: var(--accent); }
.recovery-form { margin-top: 18px; text-align: left; }
.recovery-input-row { grid-template-columns: 1fr auto; }
#recoveryInput {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 16px;
  letter-spacing: 2px;
  text-transform: uppercase;
}
#recoveryInput:focus {
  outline: 3px solid rgba(31, 122, 104, 0.22);
  border-color: var(--accent);
}
.recovery-code-banner {
  margin: 16px 0;
  padding: 14px;
  border-radius: 8px;
  background: var(--warning-bg);
  border: 1px solid var(--warning-line);
  color: var(--warning-ink);
  line-height: 1.7;
}
.recovery-code-banner strong { font-size: 18px; letter-spacing: 2px; }
.recovery-code-banner .link-button { margin-left: 10px; }

.lesson-path {
  display: grid;
  grid-template-columns: repeat(9, minmax(0, 1fr));
  gap: 7px;
  margin: 0 0 24px;
  padding: 0;
  list-style: none;
}

.path-step {
  display: grid;
  justify-items: center;
  gap: 5px;
  min-width: 0;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.path-step span {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border: 2px solid var(--line);
  border-radius: 50%;
  background: #ffffff;
}

.path-step small { font: inherit; white-space: nowrap; }
.path-step[data-state="done"] { color: var(--accent-strong); }
.path-step[data-state="done"] span { border-color: var(--accent); background: var(--accent); color: #ffffff; }
.path-step[data-state="current"] { color: var(--ink); }
.path-step[data-state="current"] span { border-color: var(--coral); background: #fff1ed; color: var(--coral); box-shadow: 0 0 0 4px #fde2db; }

@media (max-width: 640px) {
  .recovery-input-row { grid-template-columns: 1fr; }
  .lesson-path { grid-template-columns: repeat(5, minmax(0, 1fr)); row-gap: 14px; }
}
