:root {
  color-scheme: light;
  --ink: #16202a;
  --muted: #66717d;
  --line: #dce3ea;
  --paper: #ffffff;
  --soft: #f4f7fa;
  --blue: #1f6feb;
  --green: #178a62;
  --teal: #0f766e;
  --amber: #b46a00;
  --red: #c43b32;
  --shadow: 0 18px 45px rgba(21, 34, 50, 0.12);
  --panel-gap: 18px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--ink);
  font-family: Inter, "PingFang SC", "Microsoft YaHei", Arial, sans-serif;
  background: #e9eef3;
}

button,
input,
select,
textarea {
  font: inherit;
}

.app-shell {
  min-height: 100vh;
  padding: 20px;
}

.workspace {
  display: grid;
  grid-template-columns: clamp(220px, 19vw, 280px) minmax(0, 1fr);
  min-height: calc(100vh - 40px);
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 28px;
  padding: 24px;
  background: #111827;
  color: #ffffff;
}

.brand {
  display: flex;
  gap: 12px;
  align-items: center;
}

.brand-logo {
  width: 42px;
  height: 42px;
  border-radius: 8px;
  object-fit: cover;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.18);
}

.brand strong,
.brand span,
.scope strong,
.scope span {
  display: block;
}

.brand span {
  margin-top: 4px;
  color: #aeb9c4;
  font-size: 13px;
}

nav {
  display: grid;
  gap: 8px;
}

nav a {
  color: #c7d1dc;
  text-decoration: none;
  padding: 11px 12px;
  border-radius: 8px;
}

nav a.active,
nav a:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.1);
}

.scope {
  margin-top: auto;
  padding-top: 20px;
  border-top: 1px solid rgba(255, 255, 255, 0.14);
}

.scope span {
  margin-top: 8px;
  color: #c7d1dc;
  font-size: 14px;
}

.main-panel {
  min-width: 0;
  padding: clamp(16px, 2.6vw, 32px);
  background: var(--soft);
}

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

.topbar p {
  margin: 0 0 6px;
  color: var(--green);
  font-weight: 700;
}

.topbar h1 {
  margin: 0;
  max-width: 820px;
  font-size: clamp(26px, 3.2vw, 42px);
  line-height: 1.2;
  letter-spacing: 0;
}

.topbar-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.topbar-tags span,
.mobile-nav a {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #ffffff;
  color: #405060;
  font-size: 13px;
  font-weight: 800;
}

.topbar-tags span {
  padding: 7px 10px;
}

.status-pill {
  flex: 0 0 auto;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #ffffff;
  color: var(--blue);
  font-size: 14px;
  font-weight: 700;
}

.mobile-nav {
  display: none;
  gap: 8px;
  margin: 0 0 14px;
  overflow-x: auto;
  padding-bottom: 4px;
  scrollbar-width: none;
}

.mobile-nav::-webkit-scrollbar {
  display: none;
}

.mobile-nav a {
  flex: 0 0 auto;
  padding: 9px 13px;
  color: var(--ink);
  text-decoration: none;
}

.upload-band,
.panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
}

.upload-band {
  padding: 18px;
  margin-bottom: 18px;
}

.upload-form {
  display: grid;
  grid-template-columns: minmax(260px, 340px) minmax(0, 1fr) minmax(112px, auto);
  gap: 18px;
  align-items: stretch;
}

.dropzone {
  position: relative;
  display: grid;
  min-height: clamp(210px, 26vw, 300px);
  place-items: center;
  align-content: center;
  gap: 8px;
  padding: 18px;
  border: 1px dashed #aeb9c4;
  border-radius: 8px;
  background: #f8fafc;
  overflow: hidden;
  cursor: pointer;
}

.dropzone input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.drop-icon {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border-radius: 999px;
  background: #e7f1ff;
  color: var(--blue);
  font-size: 24px;
}

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

.dropzone img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #ffffff;
}

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

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

.span-2 {
  grid-column: span 4;
}

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

select {
  height: 42px;
  padding: 0 11px;
}

textarea {
  resize: vertical;
  padding: 11px;
}

.primary-button {
  align-self: end;
  display: grid;
  min-width: 118px;
  min-height: 56px;
  place-items: center;
  gap: 4px;
  border: 0;
  border-radius: 8px;
  background: var(--blue);
  color: #ffffff;
  font-weight: 800;
  cursor: pointer;
}

.coach-flow {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: var(--panel-gap);
  margin-bottom: var(--panel-gap);
}

.coach-flow article {
  display: grid;
  gap: 8px;
  min-height: 132px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.coach-flow span {
  color: var(--teal);
  font-weight: 900;
}

.coach-flow strong {
  font-size: 18px;
}

.coach-flow p {
  margin: 0;
  color: var(--muted);
  line-height: 1.65;
}

.section-kicker {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
}

.section-kicker strong {
  font-size: 17px;
}

.section-kicker span {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
}

.primary-button b {
  font-size: 20px;
}

.result-grid,
.lesson-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(300px, 0.65fr);
  gap: var(--panel-gap);
  margin-bottom: var(--panel-gap);
}

.panel {
  padding: 18px;
  margin-bottom: 18px;
}

.panel.large {
  min-height: 220px;
}

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

.panel-head h2 {
  margin: 0;
  font-size: 18px;
}

.panel-head span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.body-text {
  margin: 0 0 14px;
  color: #314150;
  line-height: 1.75;
}

.quote-box {
  padding: 14px;
  border-left: 4px solid var(--green);
  background: #eef9f4;
  color: #23362f;
  line-height: 1.7;
}

.knowledge-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 14px;
}

.knowledge-item,
.practice-card,
.video-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.knowledge-item {
  padding: 14px;
}

.knowledge-item div {
  display: flex;
  justify-content: space-between;
  gap: 10px;
}

.knowledge-item strong {
  font-size: 16px;
}

.knowledge-item span {
  color: var(--amber);
  font-size: 13px;
  font-weight: 800;
}

.knowledge-item p,
.knowledge-item dd {
  color: var(--muted);
  line-height: 1.6;
}

.knowledge-item dl {
  display: grid;
  gap: 6px;
  margin: 10px 0 0;
}

.knowledge-item dt {
  color: var(--ink);
  font-weight: 800;
}

.knowledge-item dd {
  margin: 0;
}

.profile-summary {
  margin-bottom: 14px;
}

.archive-note {
  display: grid;
  gap: 6px;
  padding: 14px;
  border: 1px solid #b9d9cd;
  border-radius: 8px;
  background: #eef9f4;
}

.archive-note strong {
  color: #0f5f46;
}

.archive-note span,
.archive-note small {
  color: #426054;
  line-height: 1.6;
}

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

.profile-card {
  display: grid;
  align-content: start;
  gap: 12px;
  min-height: 260px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.profile-card h3 {
  margin: 0;
  font-size: 16px;
}

.tutor-grid {
  display: grid;
  grid-template-columns: minmax(180px, 0.7fr) repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.tutor-score,
.tutor-card {
  display: grid;
  align-content: start;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.tutor-score h3,
.tutor-card h3 {
  margin: 0;
  font-size: 16px;
}

.score-ring {
  display: grid;
  width: 116px;
  height: 116px;
  place-items: center;
  border-radius: 999px;
  background: conic-gradient(var(--green) var(--score, 0%), #edf2f6 0);
  color: var(--ink);
  font-size: 30px;
  font-weight: 900;
}

.score-ring::after {
  content: "分";
  margin-left: 2px;
  font-size: 14px;
  font-weight: 800;
}

.tutor-score p,
.weekly-report p,
.weekly-report li,
.weekly-report small,
.role-views p {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
}

.weekly-report,
.role-views {
  display: grid;
  gap: 9px;
}

.weekly-report ul {
  margin: 0;
  padding-left: 18px;
}

.role-views div {
  display: grid;
  gap: 4px;
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
}

.mastery-list,
.topology-map,
.error-bars,
.path-list {
  display: grid;
  gap: 10px;
}

.mastery-item {
  display: grid;
  gap: 7px;
  padding: 10px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--amber);
  border-radius: 8px;
  background: #fbfcfd;
}

.mastery-item[data-status="未掌握"] {
  border-left-color: var(--red);
}

.mastery-item[data-status="不稳定"] {
  border-left-color: var(--amber);
}

.mastery-item[data-status="练习中"] {
  border-left-color: var(--blue);
}

.mastery-item[data-status="已掌握"] {
  border-left-color: var(--green);
}

.mastery-item div,
.error-bar div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.mastery-item span {
  flex: 0 0 auto;
  color: var(--amber);
  font-size: 12px;
  font-weight: 900;
}

.mastery-item p,
.mastery-item small,
.error-bar p,
.path-step p,
.topology-edges p {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}

.topology-nodes {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
}

.topology-nodes span {
  display: grid;
  gap: 4px;
  max-width: 100%;
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
}

.topology-nodes strong {
  font-size: 13px;
}

.topology-nodes small {
  color: var(--muted);
  line-height: 1.45;
}

.topology-edges {
  display: grid;
  gap: 6px;
  padding-top: 4px;
}

.error-bar {
  display: grid;
  gap: 7px;
}

.error-bar span {
  color: var(--red);
  font-weight: 900;
}

.error-bar i {
  display: block;
  height: 8px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--red) var(--bar-width), #edf2f6 var(--bar-width));
}

.path-step {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr);
  gap: 10px;
}

.path-step > span {
  display: grid;
  width: 30px;
  height: 30px;
  place-items: center;
  border-radius: 999px;
  background: #e7f1ff;
  color: var(--blue);
  font-weight: 900;
}

.path-step strong {
  display: block;
  margin-bottom: 4px;
}

.step-list {
  margin: 0 0 14px;
  padding-left: 20px;
  line-height: 1.8;
}

.mistakes {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.mistakes span {
  padding: 6px 9px;
  border-radius: 999px;
  background: #fff3ed;
  color: var(--red);
  font-size: 13px;
  font-weight: 700;
}

.video-stage {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) 42px;
  gap: 12px;
  align-items: stretch;
  min-height: 260px;
  border-radius: 8px;
  background: #111923;
  color: #ffffff;
  overflow: hidden;
}

.video-stage button {
  border: 0;
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
  font-size: 28px;
  cursor: pointer;
}

.video-stage div {
  display: grid;
  align-content: center;
  gap: 14px;
  min-width: 0;
  padding: 20px 0;
}

.video-stage strong {
  font-size: 24px;
  line-height: 1.25;
}

.video-stage p {
  margin: 0;
  color: #d8e2ee;
  line-height: 1.7;
}

.video-stage code {
  display: block;
  white-space: normal;
  padding: 12px;
  border-radius: 8px;
  background: #233142;
  color: #9ee6c4;
}

.video-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
}

.video-group h3 {
  margin: 0 0 10px;
  font-size: 15px;
}

.video-card {
  display: grid;
  gap: 6px;
  padding: 13px;
  color: var(--ink);
  text-decoration: none;
}

.video-card + .video-card {
  margin-top: 10px;
}

.video-card span,
.video-card small {
  color: var(--muted);
}

.practice-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 14px;
}

.practice-card {
  display: grid;
  gap: 10px;
  padding: 14px;
}

.practice-card > span {
  color: var(--green);
  font-weight: 900;
}

.practice-card > small {
  color: var(--amber);
  font-weight: 900;
}

.practice-card em {
  width: fit-content;
  max-width: 100%;
  padding: 5px 8px;
  border-radius: 999px;
  background: #e7f1ff;
  color: var(--blue);
  font-size: 12px;
  font-style: normal;
  font-weight: 800;
  line-height: 1.4;
}

.practice-card strong {
  line-height: 1.55;
}

.practice-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
}

.print-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
}

.print-actions button,
.paper-check button {
  min-height: 44px;
  padding: 0 14px;
  border: 0;
  border-radius: 8px;
  background: var(--blue);
  color: #ffffff;
  font-weight: 900;
  cursor: pointer;
}

.print-actions span {
  color: var(--muted);
  line-height: 1.5;
}

.paper-check {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: end;
  margin-top: 14px;
  padding: 14px;
  border: 1px solid #b9d9cd;
  border-radius: 8px;
  background: #eef9f4;
}

.paper-check button {
  background: var(--green);
}

.paper-check img {
  grid-column: 1 / -1;
  max-width: min(100%, 520px);
  max-height: 280px;
  border: 1px solid var(--line);
  border-radius: 8px;
  object-fit: contain;
  background: #ffffff;
}

.paper-result {
  grid-column: 1 / -1;
  display: grid;
  gap: 8px;
  padding: 10px;
  border-radius: 8px;
  background: #ffffff;
  color: #426054;
  line-height: 1.6;
}

.paper-result p {
  margin: 0;
}

.paper-score {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--ink);
  font-weight: 900;
}

.paper-score span {
  color: var(--green);
}

summary {
  cursor: pointer;
  color: var(--blue);
  font-weight: 800;
}

@media (max-width: 1120px) {
  .workspace,
  .upload-form,
  .result-grid,
  .lesson-grid {
    grid-template-columns: 1fr;
  }

  .sidebar {
    display: none;
  }

  .mobile-nav {
    display: flex;
  }

  .primary-button {
    width: 100%;
    align-self: auto;
  }

  .form-grid,
  .coach-flow,
  .profile-grid,
  .tutor-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .span-2 {
    grid-column: span 2;
  }
}

@media (max-width: 680px) {
  .app-shell {
    padding: 0;
  }

  .workspace {
    min-height: 100vh;
    border: 0;
    border-radius: 0;
  }

  .main-panel {
    padding: 16px;
  }

  .topbar {
    display: grid;
  }

  .status-pill {
    width: fit-content;
  }

  .form-grid,
  .coach-flow,
  .profile-grid,
  .tutor-grid,
  .paper-check {
    grid-template-columns: 1fr;
  }

  .section-kicker {
    display: grid;
  }

  .print-actions {
    display: grid;
  }

  .span-2 {
    grid-column: auto;
  }

  .upload-band,
  .panel {
    padding: 14px;
  }

  .dropzone {
    min-height: 220px;
  }

  .panel-head {
    align-items: flex-start;
    display: grid;
  }

  .video-stage {
    grid-template-columns: 36px minmax(0, 1fr) 36px;
    min-height: 230px;
  }

  .video-stage strong {
    font-size: 20px;
  }
}

@media (max-width: 420px) {
  .main-panel {
    padding: 12px;
  }

  .topbar-tags span {
    width: 100%;
  }

  select,
  textarea,
  .primary-button {
    min-height: 46px;
  }

  .video-stage {
    gap: 8px;
  }
}

@media print {
  body {
    background: #ffffff;
  }

  .sidebar,
  .topbar,
  .mobile-nav,
  .coach-flow,
  .upload-band,
  .result-grid,
  #knowledge,
  #tutor,
  #lesson,
  .panel:has(#videoMatches),
  #profile,
  .print-actions,
  .paper-check {
    display: none !important;
  }

  .app-shell,
  .main-panel,
  .workspace {
    display: block;
    min-height: auto;
    padding: 0;
    border: 0;
    box-shadow: none;
    background: #ffffff;
  }

  #practice {
    display: block;
    border: 0;
    padding: 0;
  }

  #practice .panel-head span {
    display: none;
  }

  .practice-list {
    display: block;
  }

  .practice-card {
    break-inside: avoid;
    margin-bottom: 18px;
    border: 1px solid #222;
  }

  .practice-card details {
    display: none;
  }
}
