:root {
  color-scheme: light;
  --ink: #24302f;
  --muted: #66706d;
  --line: #d9dfd8;
  --paper: #fbf8f1;
  --surface: rgba(255, 255, 255, 0.86);
  --teal: #1f8a8a;
  --teal-dark: #12686a;
  --coral: #e76f51;
  --yellow: #f2c14e;
  --green: #6a994e;
  --blue: #5271c4;
  --shadow: 0 18px 60px rgba(45, 58, 53, 0.14);
  --radius: 8px;
  font-family:
    "Microsoft YaHei",
    "PingFang SC",
    "Hiragino Sans GB",
    system-ui,
    sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(135deg, rgba(31, 138, 138, 0.12), transparent 28%),
    linear-gradient(315deg, rgba(231, 111, 81, 0.12), transparent 32%),
    var(--paper);
  color: var(--ink);
}

button,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

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

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 0;
  background: rgba(246, 242, 234, 0.86);
  backdrop-filter: blur(18px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  min-width: 236px;
  color: inherit;
  text-decoration: none;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 10px;
  background: var(--ink);
  color: white;
  font-weight: 800;
}

.brand strong,
.brand small {
  display: block;
}

.brand strong {
  font-size: 17px;
}

.brand small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
}

.main-nav,
.segment-control,
.toolbar,
.hero-actions,
.prompt-controls,
.coach-stage-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.main-nav {
  overflow-x: auto;
  justify-content: flex-end;
  padding-bottom: 2px;
}

.nav-pill,
.segment,
.secondary-action,
.text-button,
.icon-button,
.primary-action {
  border: 1px solid transparent;
  border-radius: var(--radius);
  min-height: 40px;
  white-space: nowrap;
  transition:
    transform 0.18s ease,
    background 0.18s ease,
    border-color 0.18s ease,
    color 0.18s ease;
}

.nav-pill,
.segment,
.secondary-action,
.text-button {
  background: rgba(255, 255, 255, 0.72);
  color: var(--ink);
  padding: 0 14px;
}

.nav-pill:hover,
.segment:hover,
.secondary-action:hover,
.text-button:hover,
.icon-button:hover,
.primary-action:hover {
  transform: translateY(-1px);
}

.nav-pill.is-active,
.segment.is-active {
  background: var(--ink);
  color: white;
}

.primary-action {
  background: var(--teal);
  color: white;
  padding: 0 16px;
  border-color: var(--teal);
  font-weight: 700;
}

.primary-action:hover {
  background: var(--teal-dark);
}

.secondary-action {
  border-color: rgba(36, 48, 47, 0.14);
}

.icon-button {
  display: inline-grid;
  place-items: center;
  width: 40px;
  background: var(--ink);
  color: white;
  font-weight: 700;
}

.text-button {
  color: var(--teal-dark);
  font-weight: 700;
}

.toolbar select {
  min-width: 142px;
}

.view {
  display: none;
  scroll-margin-top: 104px;
  animation: fadeIn 0.22s ease;
}

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

.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 280px;
  gap: 18px;
  align-items: stretch;
  margin-top: 12px;
}

.hero-panel {
  position: relative;
  overflow: hidden;
  min-height: 430px;
  border-radius: 18px;
  box-shadow: var(--shadow);
  background: #111;
}

.hero-image {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.hero-panel::after {
  position: absolute;
  inset: 0;
  content: "";
  background:
    linear-gradient(90deg, rgba(15, 24, 24, 0.72), rgba(15, 24, 24, 0.2) 58%, rgba(15, 24, 24, 0.1)),
    linear-gradient(0deg, rgba(15, 24, 24, 0.26), transparent 44%);
}

.hero-overlay {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  width: min(560px, 72%);
  min-height: 430px;
  padding: 44px;
  color: white;
}

.kicker,
.panel-label {
  color: var(--coral);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.hero-overlay .kicker {
  color: #ffd36a;
}

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

h1 {
  font-size: clamp(34px, 5vw, 56px);
  line-height: 1.05;
  letter-spacing: 0;
}

.hero-overlay p,
.page-intro p {
  color: rgba(255, 255, 255, 0.86);
  margin-top: 16px;
  font-size: 17px;
  line-height: 1.8;
}

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

.status-panel,
.surface {
  border: 1px solid rgba(36, 48, 47, 0.1);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: 0 10px 35px rgba(45, 58, 53, 0.08);
}

.status-panel {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 18px;
  padding: 22px;
}

.status-panel strong {
  display: block;
  margin-top: 8px;
  font-size: 20px;
  line-height: 1.35;
}

.metric-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
  color: var(--muted);
}

.metric-row strong {
  margin-top: 0;
  color: var(--ink);
  font-size: 22px;
}

.dashboard-layout {
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  gap: 16px;
  margin-top: 18px;
}

.surface {
  padding: 20px;
}

.surface.compact {
  min-height: 258px;
}

.section-heading,
.split-intro {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.section-heading h2 {
  margin-top: 4px;
  font-size: 22px;
}

.task-list,
.radar-bars,
.gap-list,
.project-list {
  display: grid;
  gap: 12px;
  margin-top: 18px;
}

.task-item,
.gap-item,
.project-card,
.subject-card,
.transfer-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.72);
}

.task-item {
  display: grid;
  grid-template-columns: 34px 1fr;
  gap: 12px;
  align-items: start;
  width: 100%;
  padding: 14px;
  text-align: left;
}

.task-check {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  color: transparent;
}

.task-item.is-done .task-check {
  background: var(--green);
  border-color: var(--green);
  color: white;
}

.task-item strong,
.gap-item strong,
.project-card strong,
.subject-card strong,
.transfer-card strong {
  display: block;
  line-height: 1.35;
}

.task-item p,
.gap-item p,
.project-card p,
.subject-card p,
.transfer-card p {
  margin-top: 6px;
  color: var(--muted);
  line-height: 1.65;
}

.bar-row {
  display: grid;
  grid-template-columns: 84px minmax(0, 1fr) 42px;
  gap: 10px;
  align-items: center;
}

.bar-track {
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: #e9eee8;
}

.bar-fill {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--teal), var(--yellow));
}

.learning-loop {
  grid-column: 1 / -1;
}

.loop-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-top: 18px;
}

.loop-grid article {
  padding: 16px;
  border-radius: var(--radius);
  background: rgba(246, 242, 234, 0.74);
}

.loop-grid span {
  color: var(--coral);
  font-weight: 800;
}

.loop-grid strong {
  display: block;
  margin-top: 8px;
}

.loop-grid p {
  margin-top: 8px;
  color: var(--muted);
  line-height: 1.6;
}

.page-intro {
  margin: 34px 0 20px;
}

.page-intro h1 {
  color: var(--ink);
}

.page-intro p {
  max-width: 780px;
  color: var(--muted);
}

.segment-control {
  flex-wrap: wrap;
  margin-bottom: 16px;
}

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

.subject-card {
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-height: 310px;
  padding: 18px;
}

.subject-card header {
  display: flex;
  align-items: center;
  gap: 12px;
}

.subject-icon {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 10px;
  color: white;
  font-weight: 800;
}

.tag-row,
.unit-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tag,
.unit-chip {
  border-radius: 999px;
  background: #eef4f1;
  color: #35514d;
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 700;
}

.unit-chip {
  background: #fff8e6;
  color: #6e5720;
}

.textbook-surface {
  margin-bottom: 16px;
}

.anchor-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-top: 18px;
}

.anchor-card {
  min-height: 168px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.72);
}

.anchor-card strong {
  display: block;
  margin-bottom: 8px;
}

.anchor-card p {
  color: var(--muted);
  line-height: 1.58;
}

.subject-card footer {
  margin-top: auto;
  display: grid;
  gap: 8px;
}

.mini-label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.gap-layout {
  display: grid;
  grid-template-columns: 360px minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.gap-form {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
}

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

select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: white;
  color: var(--ink);
}

select {
  min-height: 42px;
  padding: 0 12px;
}

textarea {
  resize: vertical;
  min-height: 112px;
  padding: 12px;
  line-height: 1.6;
}

.wide-button {
  width: 100%;
}

.gap-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  padding: 16px;
}

.gap-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.gap-actions {
  display: flex;
  align-items: start;
  gap: 8px;
}

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

.transfer-card {
  padding: 18px;
  min-height: 220px;
}

.transfer-card span {
  display: inline-block;
  margin-bottom: 12px;
  color: var(--coral);
  font-size: 12px;
  font-weight: 800;
}

.coach-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 16px;
  align-items: start;
}

.coach-main {
  min-height: 620px;
}

.coach-progress {
  display: inline-grid;
  place-items: center;
  min-width: 64px;
  min-height: 42px;
  border-radius: var(--radius);
  background: #eef4f1;
  color: var(--teal-dark);
  font-size: 18px;
}

.coach-steps {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 10px;
  margin-top: 18px;
}

.coach-step {
  display: grid;
  align-content: start;
  gap: 6px;
  min-height: 104px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.7);
  color: var(--ink);
  text-align: left;
}

.coach-step span,
.coach-step small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.coach-step strong {
  line-height: 1.35;
}

.coach-step.is-active {
  border-color: var(--teal);
  background: #eef8f6;
}

.coach-step.is-done span {
  color: var(--green);
}

.coach-stage {
  margin-top: 18px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.76);
}

.coach-stage h3 {
  margin-top: 8px;
  font-size: 26px;
  line-height: 1.25;
}

.coach-stage-body {
  margin-top: 14px;
  color: var(--muted);
  line-height: 1.75;
}

.coach-stage-body ul,
.coach-note-block ul {
  margin: 12px 0 0;
  padding-left: 20px;
}

.coach-stage-body li,
.coach-note-block li {
  margin-top: 6px;
}

.coach-check {
  margin-top: 16px;
  padding: 14px;
  border-radius: var(--radius);
  background: #fff8e6;
  color: #5e4a17;
}

.coach-check strong {
  display: block;
  margin-bottom: 6px;
}

.coach-stage-actions {
  justify-content: flex-end;
  margin-top: 18px;
}

.coach-side {
  display: grid;
  gap: 16px;
}

.coach-note-block {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.72);
}

.coach-note-block strong {
  display: block;
  margin-bottom: 8px;
}

.coach-note-block p,
.coach-note-block li {
  color: var(--muted);
  line-height: 1.65;
}

.reflection-box {
  margin-top: 2px;
}

.ai-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(320px, 0.9fr);
  gap: 16px;
}

.prompt-controls {
  align-items: end;
  flex-wrap: wrap;
  margin-top: 18px;
}

.prompt-controls label {
  min-width: 160px;
  flex: 1;
}

.prompt-output {
  overflow: auto;
  min-height: 280px;
  margin: 18px 0 0;
  padding: 16px;
  border-radius: var(--radius);
  background: #182322;
  color: #effaf5;
  line-height: 1.7;
  white-space: pre-wrap;
}

.project-card {
  padding: 16px;
}

.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 50;
  transform: translateY(18px);
  opacity: 0;
  max-width: min(360px, calc(100vw - 40px));
  padding: 12px 14px;
  border-radius: var(--radius);
  background: var(--ink);
  color: white;
  box-shadow: var(--shadow);
  transition:
    opacity 0.2s ease,
    transform 0.2s ease;
  pointer-events: none;
}

.toast.is-visible {
  transform: translateY(0);
  opacity: 1;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 980px) {
  .app-shell {
    width: min(100% - 24px, 860px);
  }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .split-intro {
    align-items: stretch;
    flex-direction: column;
  }

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

  .main-nav {
    width: 100%;
    justify-content: flex-start;
  }

  .hero-grid,
  .dashboard-layout,
  .gap-layout,
  .coach-layout,
  .ai-layout {
    grid-template-columns: 1fr;
  }

  .hero-panel,
  .hero-overlay {
    min-height: 390px;
  }

  .hero-overlay {
    width: min(620px, 88%);
    padding: 32px;
  }

  .subject-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .transfer-board,
  .loop-grid,
  .anchor-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .coach-steps {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

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

  .brand {
    min-width: 0;
  }

  .hero-panel,
  .hero-overlay {
    min-height: 420px;
  }

  .hero-panel::after {
    background: linear-gradient(0deg, rgba(15, 24, 24, 0.82), rgba(15, 24, 24, 0.25));
  }

  .hero-overlay {
    width: 100%;
    justify-content: flex-end;
    padding: 24px;
  }

  .hero-actions,
  .split-intro,
  .toolbar,
  .prompt-controls,
  .coach-stage-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .primary-action,
  .secondary-action,
  .toolbar select {
    width: 100%;
  }

  .subject-grid,
  .transfer-board,
  .loop-grid,
  .anchor-grid,
  .coach-steps {
    grid-template-columns: 1fr;
  }

  .gap-item {
    grid-template-columns: 1fr;
  }
}
