:root {
  color-scheme: light;
  --ink: #17211f;
  --muted: #64706d;
  --line: #dce4df;
  --paper: #fbfaf7;
  --panel: #ffffff;
  --green: #0f766e;
  --red: #b42318;
  --amber: #b7791f;
  --blue: #245b9e;
  --violet: #7652a6;
  --shadow: 0 18px 45px rgba(26, 37, 33, 0.1);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background:
    linear-gradient(120deg, rgba(15, 118, 110, 0.09), transparent 38%),
    linear-gradient(210deg, rgba(183, 121, 31, 0.1), transparent 36%),
    var(--paper);
}

button,
input,
select {
  font: inherit;
}

button {
  border: 0;
  border-radius: 8px;
  padding: 10px 14px;
  color: #fff;
  background: var(--green);
  cursor: pointer;
}

button:hover {
  filter: brightness(0.96);
}

button.ghost {
  color: var(--ink);
  background: #eef3ef;
}

.shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 24px 0 44px;
}

.topbar {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 20px;
  min-height: 170px;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.92), rgba(255, 255, 255, 0.68)),
    repeating-linear-gradient(90deg, rgba(15, 118, 110, 0.12) 0 1px, transparent 1px 70px),
    repeating-linear-gradient(0deg, rgba(36, 91, 158, 0.1) 0 1px, transparent 1px 54px);
  box-shadow: var(--shadow);
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--green);
  font-weight: 700;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: clamp(30px, 6vw, 58px);
  letter-spacing: 0;
}

h2 {
  margin-bottom: 16px;
  font-size: 20px;
}

.score-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(82px, 1fr));
  gap: 8px;
}

.score-strip span {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.78);
  text-align: center;
  color: var(--muted);
}

.score-strip strong {
  display: block;
  color: var(--ink);
  font-size: 24px;
}

.tabs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 18px 0;
}

.tab {
  flex: 0 0 auto;
  color: var(--ink);
  background: #edf2ee;
}

.tab.is-active {
  color: #fff;
  background: var(--ink);
}

.view {
  display: none;
}

.view.is-active {
  display: block;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr);
  gap: 16px;
}

.panel,
.question-panel {
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.panel-head,
.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.toolbar {
  flex-wrap: wrap;
  justify-content: flex-start;
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
}

select,
input {
  min-width: 180px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  background: #fff;
  color: var(--ink);
}

textarea {
  min-width: 180px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  resize: vertical;
}

.chapter-map,
.study-grid,
.library-grid,
.question-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 12px;
}

.chapter-card,
.study-card,
.file-card,
.mistake-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  background: #fff;
}

.chapter-card {
  position: relative;
  min-height: 150px;
  overflow: hidden;
}

.chapter-card::after {
  content: "";
  position: absolute;
  right: -28px;
  bottom: -28px;
  width: 88px;
  height: 88px;
  border: 16px solid rgba(15, 118, 110, 0.14);
  border-radius: 50%;
}

.chapter-card strong,
.study-card strong {
  display: block;
  margin-bottom: 8px;
}

.progress {
  width: 100%;
  height: 8px;
  margin-top: 14px;
  overflow: hidden;
  border-radius: 99px;
  background: #edf2ee;
}

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

.daily-plan {
  padding-left: 20px;
  color: var(--muted);
  line-height: 1.8;
}

.lesson-layout {
  display: grid;
  grid-template-columns: 250px minmax(0, 1fr) 260px;
  gap: 14px;
  align-items: start;
}

.lesson-nav,
.lesson-progress {
  position: sticky;
  top: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.lesson-nav-head,
.lesson-progress {
  padding: 16px;
}

.lesson-nav-head h2 {
  margin-bottom: 0;
}

.lesson-filter {
  display: grid;
  gap: 8px;
  padding: 0 12px 12px;
}

.lesson-filter input,
.lesson-filter select {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  background: #fff;
}

.lesson-toc,
.focus-list {
  display: grid;
  gap: 8px;
}

.lesson-toc {
  max-height: calc(100vh - 340px);
  overflow: auto;
  padding: 0 12px 12px;
}

.toc-item,
.focus-chip {
  width: 100%;
  border: 1px solid var(--line);
  padding: 10px;
  color: var(--ink);
  background: #fff;
  text-align: left;
}

.toc-item {
  display: grid;
  grid-template-columns: 44px 1fr;
  gap: 4px 8px;
  align-items: center;
}

.toc-item span {
  grid-row: span 2;
  color: var(--blue);
  font-weight: 800;
}

.toc-item small {
  color: var(--muted);
}

.toc-item strong {
  overflow-wrap: anywhere;
}

.toc-item.is-read {
  border-color: rgba(15, 118, 110, 0.45);
  background: rgba(15, 118, 110, 0.08);
}

.lesson-reader {
  display: grid;
  gap: 14px;
}

.lesson-empty {
  color: var(--muted);
  line-height: 1.7;
}

.lesson-block {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 22px;
  background: #fff;
  box-shadow: var(--shadow);
  scroll-margin-top: 18px;
}

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

.lesson-block-head h2 {
  margin-bottom: 0;
  font-size: 26px;
}

.lesson-block-head h2 span {
  color: var(--blue);
}

.lesson-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.lesson-actions .is-on {
  color: #fff;
  background: var(--blue);
}

.lesson-summary {
  margin-bottom: 18px;
  border-left: 4px solid var(--blue);
  padding: 10px 12px;
  background: #f3f7fc;
  line-height: 1.75;
}

.lesson-section-grid {
  display: grid;
  gap: 12px;
}

.lesson-section {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  background: #fff;
}

.lesson-section h3 {
  margin: 0 0 10px;
  font-size: 17px;
}

.lesson-section ul {
  display: grid;
  gap: 10px;
  margin: 0;
  padding-left: 20px;
  line-height: 1.8;
}

.lesson-section mark {
  border-radius: 4px;
  padding: 1px 4px;
  color: #7a1d18;
  background: #ffe1df;
}

.lesson-definition {
  border-left: 4px solid var(--blue);
}

.lesson-rule {
  border-left: 4px solid var(--green);
}

.lesson-exception {
  border-left: 4px solid var(--amber);
}

.exam-tip {
  margin-top: 14px;
  border: 1px solid rgba(183, 121, 31, 0.32);
  border-radius: 8px;
  padding: 14px;
  background: #fff8ea;
  line-height: 1.7;
}

.exam-tip p {
  margin-bottom: 0;
}

.progress-meter {
  display: grid;
  gap: 10px;
  margin-bottom: 16px;
}

.progress-meter span {
  color: var(--ink);
  font-weight: 800;
}

.focus-chip {
  color: var(--blue);
  font-weight: 700;
}

.lesson-note {
  margin-top: 18px;
}

.lesson-note textarea {
  width: 100%;
  min-width: 0;
  line-height: 1.6;
}

.question-meta,
.tiny {
  color: var(--muted);
  font-size: 13px;
}

.question-title {
  white-space: pre-line;
  line-height: 1.65;
  font-size: 18px;
}

.options {
  display: grid;
  gap: 10px;
  margin: 18px 0;
}

.option {
  display: grid;
  grid-template-columns: 34px 1fr;
  gap: 10px;
  align-items: start;
  width: 100%;
  border: 1px solid var(--line);
  padding: 12px;
  color: var(--ink);
  background: #fff;
  text-align: left;
}

.option b {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  color: #fff;
  background: var(--blue);
}

.option.correct {
  border-color: rgba(15, 118, 110, 0.45);
  background: rgba(15, 118, 110, 0.08);
}

.option.wrong {
  border-color: rgba(180, 35, 24, 0.4);
  background: rgba(180, 35, 24, 0.07);
}

.explain {
  display: none;
  border-left: 4px solid var(--amber);
  padding: 12px 14px;
  background: #fff8ea;
  line-height: 1.7;
}

.explain.is-visible {
  display: block;
}

.exam-area {
  display: grid;
  gap: 14px;
}

.timer {
  margin-left: auto;
  padding: 8px 12px;
  border-radius: 8px;
  color: #fff;
  background: var(--violet);
  font-weight: 700;
}

.result-banner {
  padding: 16px;
  border-radius: 8px;
  color: #fff;
  background: var(--green);
}

.file-card a {
  color: var(--blue);
  font-weight: 700;
  text-decoration: none;
}

.reader-shell {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.reader-head,
.reader-tools {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px;
  border-bottom: 1px solid var(--line);
}

.reader-head {
  justify-content: space-between;
}

.reader-head h2 {
  margin-bottom: 0;
}

.reader-link {
  border-radius: 8px;
  padding: 10px 14px;
  color: #fff;
  background: var(--blue);
  font-weight: 700;
  text-decoration: none;
}

.reader-tools {
  flex-wrap: wrap;
  background: #f6f8f6;
}

.reader-tools input {
  min-width: 96px;
  width: 110px;
}

.reader-search {
  min-width: 260px;
}

.reader-search input {
  width: 100%;
}

.reader-tools select {
  margin-left: auto;
}

.note-layout {
  display: grid;
  grid-template-columns: 290px minmax(0, 1fr);
  min-height: 640px;
}

.note-results {
  max-height: min(78vh, 900px);
  overflow: auto;
  border-right: 1px solid var(--line);
  padding: 12px;
  background: #f6f8f6;
}

.note-result {
  display: grid;
  gap: 4px;
  width: 100%;
  margin-bottom: 8px;
  border: 1px solid var(--line);
  padding: 10px;
  color: var(--ink);
  background: #fff;
  text-align: left;
}

.note-result.is-active {
  border-color: rgba(15, 118, 110, 0.45);
  background: rgba(15, 118, 110, 0.08);
}

.note-result span,
.note-result small,
.note-empty {
  color: var(--muted);
}

.note-result small {
  line-height: 1.55;
}

.note-empty {
  border: 1px dashed var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #fff;
  line-height: 1.6;
}

.note-reader {
  max-height: min(78vh, 900px);
  overflow: auto;
  padding: 22px;
  background: #fff;
}

.note-title {
  margin-bottom: 12px;
  font-size: 22px;
}

.note-text {
  max-width: 820px;
  font-size: 16px;
  line-height: 1.85;
}

.note-text p {
  margin: 0 0 12px;
}

@media (max-width: 760px) {
  .topbar,
  .dashboard-grid,
  .lesson-layout,
  .panel-head,
  .reader-head {
    display: grid;
  }

  .lesson-nav,
  .lesson-progress {
    position: static;
  }

  .lesson-block-head {
    display: grid;
  }

  .lesson-actions {
    justify-content: flex-start;
  }

  .score-strip {
    grid-template-columns: repeat(3, 1fr);
  }

  .toolbar > *,
  .reader-tools > *,
  select,
  input,
  textarea {
    width: 100%;
  }

  .reader-tools select {
    margin-left: 0;
  }

  .note-layout {
    grid-template-columns: 1fr;
    min-height: 0;
  }

  .note-results {
    max-height: 240px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .note-reader {
    max-height: none;
    min-height: 0;
  }
}
