:root {
  --bg: #f5f6f8;
  --panel: #ffffff;
  --text: #1f2933;
  --muted: #7b8494;
  --line: #e8ebf0;
  --blue: #3f7cff;
  --blue-dark: #245ee8;
  --blue-soft: #eef4ff;
  --disabled: #b7bdc8;
  --shadow: 0 8px 28px rgba(31, 41, 51, 0.08);
}

* {
  box-sizing: border-box;
}

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

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

button {
  cursor: pointer;
}

.app-shell {
  display: grid;
  grid-template-columns: 286px minmax(0, 1fr);
  min-height: 100vh;
}

.course-panel {
  background: var(--panel);
  border-right: 1px solid var(--line);
  padding: 0 14px 18px;
  box-shadow: inset 4px 0 0 #d9ecff;
}

.brand-row {
  display: grid;
  grid-template-columns: 32px 1fr 24px;
  gap: 8px;
  align-items: center;
  min-height: 66px;
}

.brand-mark {
  display: grid;
  width: 30px;
  height: 30px;
  place-items: center;
  overflow: hidden;
  border-radius: 50%;
  background: #fff;
  text-decoration: none;
}

.brand-mark img {
  width: 28px;
  height: 28px;
  object-fit: contain;
}

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

h1 {
  font-size: 24px;
  font-weight: 950;
  line-height: 1.25;
  color: #000;
  font-family: "Microsoft YaHei UI", "Microsoft YaHei", "SimHei", "黑体", sans-serif;
  letter-spacing: -0.02em;
  transform: skewX(-2deg);
}

.hamburger {
  display: grid;
  width: 24px;
  height: 24px;
  place-items: center;
  border: 0;
  background: transparent;
  color: #0a2449;
  font-size: 20px;
  font-weight: 900;
}

.brand-row p,
.module-head p,
.teacher-head,
.course-stats {
  display: none;
}

.vip-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 30px;
  border: 1px solid #efd6b7;
  border-radius: 7px;
  background: #fff1dc;
  color: #8b5a23;
  padding: 0 8px;
  font-size: 13px;
  font-weight: 600;
}

.vip-button .icon {
  display: none;
}

.course-title-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 6px;
  align-items: center;
  padding: 10px 0 16px;
  border-bottom: 1px solid var(--line);
}

.course-title-main {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  color: #073771;
}

.course-title-main strong {
  max-width: none;
  overflow: hidden;
  text-overflow: clip;
  font-size: 14px;
  font-weight: 800;
  white-space: nowrap;
}

.course-icon {
  position: relative;
  display: inline-block;
  width: 15px;
  height: 17px;
  flex: 0 0 auto;
  border: 2px solid #073771;
  border-radius: 3px;
  color: #073771;
}

.course-icon::before {
  content: "";
  position: absolute;
  left: 3px;
  right: 3px;
  top: -5px;
  height: 5px;
  border: 2px solid #073771;
  border-bottom: 0;
  border-radius: 4px 4px 0 0;
}

.course-icon::after {
  content: "";
  position: absolute;
  left: 3px;
  top: 5px;
  width: 7px;
  height: 2px;
  background: #073771;
  box-shadow: 0 5px 0 #073771;
}

.module-list {
  padding: 14px 0 82px;
}

.kb-empty { padding: 28px 12px; color: var(--muted); font-size: 13px; text-align: center; }

.module-group {
  padding: 0 0 18px;
  border-bottom: 0;
}

.module-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 34px;
  color: #9aa9c1;
}

.module-head strong {
  font-size: 15px;
  font-weight: 500;
  line-height: 1.4;
}

.module-actions {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.module-head button {
  border: 0;
  border-radius: 6px;
  background: #eef4ff;
  color: var(--blue);
  padding: 4px 8px;
  font-size: 12px;
}

.chevron {
  color: #315074;
  font-size: 17px;
  line-height: 1;
}

.lesson-list {
  position: relative;
  display: grid;
  gap: 6px;
  padding: 8px 0 0 23px;
}

.lesson-list::before {
  content: "";
  position: absolute;
  left: 12px;
  top: 28px;
  bottom: 18px;
  border-left: 1px dashed #d4deec;
}

.lesson-item {
  position: relative;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  width: 100%;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: #c3ccdb;
  padding: 7px 9px 7px 12px;
  text-align: left;
  line-height: 1.5;
  font-size: 14px;
}

.lesson-item::before {
  content: "";
  position: absolute;
  left: -19px;
  top: 50%;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #d6deea;
  transform: translateY(-50%);
}

.lesson-index {
  display: none;
}

.lesson-item:hover,
.lesson-item.active {
  background: #1769f5;
  color: #fff;
}

.lesson-item.locked {
  color: #c7d0df;
}

.lesson-item.active::before {
  left: -26px;
  width: 21px;
  height: 21px;
  background: #1769f5;
  box-shadow: 0 0 0 3px #fff;
}

.lesson-item.active::after {
  content: "";
  position: absolute;
  left: -18px;
  top: 50%;
  border-left: 6px solid #fff;
  border-top: 5px solid transparent;
  border-bottom: 5px solid transparent;
  transform: translateY(-50%);
}

.lesson-state {
  color: currentColor;
  font-size: 12px;
}

.lesson-row {
  display: flex;
  align-items: center;
  gap: 6px;
  position: relative;
}

.lesson-row .lesson-item {
  flex: 1;
  min-width: 0;
}

.lesson-relearn {
  flex: none;
  width: 26px;
  height: 26px;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, .14);
  color: #c3ccdb;
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background .15s, color .15s;
}

.lesson-relearn:hover {
  background: #1769f5;
  color: #fff;
}

.user-entry {
  position: fixed;
  left: 18px;
  bottom: 18px;
  z-index: 5;
  display: grid;
  grid-template-columns: 34px 1fr;
  gap: 9px;
  align-items: center;
  width: 258px;
  border-radius: 9px;
  background: #fafafa;
  box-shadow: 0 8px 26px rgba(31, 41, 51, 0.07);
  padding: 11px 13px;
}

.avatar {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 50%;
  border: 1px solid #d8dee8;
  background: #e1e6ee;
  color: #7d8796;
  font-size: 13px;
  font-weight: 700;
}

.user-entry strong {
  font-size: 14px;
}

.user-entry p {
  color: var(--muted);
  font-size: 12px;
}

.user-menu {
  display: none;
  position: fixed;
  left: 34px;
  bottom: 76px;
  z-index: 6;
  width: 224px;
  overflow: hidden;
  border-radius: 9px;
  background: #fff;
  box-shadow: var(--shadow);
}

.user-menu.open {
  display: grid;
}

.user-menu button {
  border: 0;
  background: #fff;
  padding: 12px 16px;
  text-align: left;
  color: #3b4554;
}

.user-menu button:hover {
  background: var(--blue-soft);
}

.lesson-panel {
  position: relative;
  min-width: 0;
  background: var(--bg);
}

.lesson-top {
  position: sticky;
  top: 0;
  z-index: 3;
  display: grid;
  grid-template-columns: auto 1fr 230px;
  gap: 18px;
  align-items: center;
  min-height: 82px;
  border-bottom: 1px solid var(--line);
  background: #f5f6f8;
  padding: 4px 42px;
}

.mobile-menu {
  display: none;
  width: 36px;
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
}

.eyebrow {
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 4px;
}

h2 {
  font-size: 22px;
  line-height: 1.3;
}

.progress-box {
  color: var(--muted);
  font-size: 14px;
}

.progress-track {
  height: 6px;
  overflow: hidden;
  border-radius: 999px;
  background: #e1e6ee;
  margin-top: 8px;
}

#progressBar {
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: var(--blue);
  transition: width 0.25s ease;
}

.teacher-area {
  padding: 18px 42px 116px;
}

.teacher-card {
  max-width: 880px;
  margin: 0 auto;
}

.chat-list {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.message {
  position: relative;
  max-width: 760px;
  line-height: 1.85;
  font-size: 16px;
}

.message h4 {
  display: none;
}

.message.teacher {
  align-self: flex-start;
  margin-left: 0;
  margin-top: 34px;
  width: min(100%, 1120px);
  max-width: 1120px;
  border-radius: 0 18px 18px 18px;
  background: #eef2f7;
  color: #0a3470;
  padding: 26px 26px 24px;
  min-height: 112px;
}

.teacher-mascot {
  position: absolute;
  left: 16px;
  top: -70px;
  width: 92px;
  height: 92px;
  object-fit: contain;
  filter: drop-shadow(0 8px 14px rgba(31, 41, 51, 0.12));
  pointer-events: none;
}

.message.teacher p {
  position: relative;
  z-index: 1;
}

.message.user {
  align-self: flex-end;
  margin-right: 54px;
  border-radius: 18px 4px 18px 18px;
  background: var(--blue);
  color: #fff;
  padding: 14px 20px;
  animation: sendPop 0.18s ease-out;
}

.user-avatar {
  position: absolute;
  right: -54px;
  top: 0;
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: 50%;
  background: #4c95ff;
  color: #fff;
  font-size: 15px;
  font-weight: 700;
}

.message ul {
  margin: 8px 0 0;
  padding-left: 20px;
}

.typing-text::after {
  content: "";
  display: inline-block;
  width: 2px;
  height: 1em;
  margin-left: 3px;
  background: currentColor;
  vertical-align: -0.12em;
  animation: caretBlink 0.85s steps(1) infinite;
}

.action-row {
  position: relative;
  display: grid;
  grid-template-columns: minmax(420px, 760px) auto 82px;
  justify-content: center;
  align-items: center;
  gap: 14px 36px;
  margin: 48px auto 0;
  pointer-events: none;
}

.relearn-action {
  pointer-events: auto;
}

.relearn-action.hidden {
  display: none;
}

.primary-action,
.secondary-action {
  pointer-events: auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 46px;
  border: 0;
  border-radius: 8px;
  padding: 0 22px;
  font-weight: 700;
}

.primary-action {
  width: 100%;
  min-height: 50px;
  border-radius: 999px;
  background: var(--blue);
  color: #fff;
  font-size: 16px;
}

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

.primary-action.hidden {
  display: none;
}

.primary-action.sending,
.primary-action:disabled,
.primary-action.locked {
  background: #b3b7be;
  color: #fff;
  cursor: default;
}

.inline-ask {
  pointer-events: auto;
  display: none;
  grid-template-columns: 1fr 42px;
  align-items: center;
  width: 100%;
  height: 50px;
  border: 1px solid #e0e5ee;
  border-radius: 999px;
  background: #fff;
  box-shadow: 0 12px 34px rgba(31, 41, 51, 0.08);
  padding: 0 10px 0 28px;
}

.inline-ask.open {
  display: grid;
}

.inline-ask input {
  height: 100%;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: #0a3470;
  font-size: 17px;
  outline: none;
  padding: 0;
  box-shadow: none;
}

.inline-ask input:focus {
  border: 0;
  box-shadow: none;
}

.inline-ask input::placeholder {
  color: #a2abba;
}

.inline-ask button {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: #6f8fe8;
  color: #fff;
  font-size: 18px;
  font-weight: 900;
}

.secondary-action {
  width: 82px;
  height: 82px;
  min-height: 82px;
  border-radius: 50%;
  border: 8px solid #9fb4f4;
  background: var(--blue);
  color: #fff;
  box-shadow: none;
  padding: 0;
  flex-direction: column;
  font-size: 15px;
}

.secondary-action:disabled,
.secondary-action.locked {
  border-color: #c8cfdb;
  background: #aeb4bd;
  cursor: default;
}

.secondary-action .icon {
  display: grid;
  width: 20px;
  height: 20px;
  place-items: center;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.22);
  font-size: 13px;
  font-weight: 700;
}

.primary-action .icon {
  display: none;
}

.ask-panel {
  position: fixed;
  top: 0;
  right: 0;
  z-index: 20;
  width: min(390px, 92vw);
  height: 100vh;
  overflow-y: auto;
  border-left: 1px solid var(--line);
  background: #fff;
  box-shadow: var(--shadow);
  padding: 24px;
  transform: translateX(100%);
  transition: transform 0.22s ease;
}

.ask-panel.open {
  transform: translateX(0);
}

.ask-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: start;
  margin-bottom: 18px;
}

.ask-head h3,
.modal h3 {
  font-size: 22px;
}

.icon-button,
.modal-close {
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 7px;
  background: #eef2f7;
  color: #4d5867;
}

.suggestions {
  display: grid;
  gap: 8px;
  margin-bottom: 18px;
}

.suggestions button {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 10px 12px;
  text-align: left;
  color: var(--blue-dark);
}

.ask-input-label,
.modal label {
  display: block;
  margin: 14px 0 7px;
  font-weight: 700;
}

textarea,
input,
select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 11px 12px;
  color: var(--text);
  outline: none;
}

textarea:focus,
input:focus,
select:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(63, 124, 255, 0.12);
}

.answer-box {
  display: none;
  margin-top: 16px;
  border-radius: 8px;
  background: var(--blue-soft);
  padding: 16px;
  line-height: 1.75;
}

.answer-box.open {
  display: block;
}

.overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 10;
  background: rgba(24, 32, 44, 0.28);
}

.overlay.open {
  display: block;
}

.modal {
  width: min(450px, calc(100vw - 28px));
  border: 0;
  border-radius: 10px;
  background: #fff;
  color: var(--text);
  padding: 28px;
  box-shadow: var(--shadow);
}

.modal::backdrop {
  background: rgba(24, 32, 44, 0.28);
}

.modal-close {
  position: absolute;
  top: 12px;
  right: 12px;
}

.modal-copy,
.price-row span,
.price-row small {
  color: var(--muted);
  line-height: 1.6;
}

.login-status {
  min-height: 20px;
  margin: 8px 0 0;
  color: #d93025;
  font-size: 13px;
  line-height: 1.5;
}

.inline-field {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
}

.inline-field button {
  border: 0;
  border-radius: 8px;
  background: var(--blue-soft);
  color: var(--blue-dark);
  padding: 0 12px;
  font-weight: 700;
}

.check-line {
  display: flex !important;
  gap: 8px;
  align-items: center;
  color: var(--muted);
  font-weight: 400 !important;
}

.check-line input {
  width: auto;
}

.full {
  width: 100%;
}

.vip-grid {
  display: grid;
  grid-template-columns: 34px 1fr;
  gap: 10px 12px;
  margin: 20px 0;
}

.vip-grid span {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 50%;
  background: var(--blue-soft);
  color: var(--blue);
  font-weight: 700;
}

.price-row {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 18px;
}

.price-row strong {
  font-size: 36px;
  color: #ff653f;
}

.profile-lines {
  display: grid;
  gap: 10px;
  margin: 18px 0;
}

.profile-lines p {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 10px;
}

@keyframes sendPop {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes caretBlink {
  50% {
    opacity: 0;
  }
}

@media (max-width: 820px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .course-panel {
    position: fixed;
    z-index: 30;
    width: min(354px, 90vw);
    transform: translateX(-100%);
    transition: transform 0.22s ease;
    box-shadow: var(--shadow);
  }

  .course-panel.open {
    transform: translateX(0);
  }

  .lesson-top {
    position: fixed;
    top: 78px;
    left: 0;
    right: 0;
    z-index: 40;
    grid-template-columns: auto 1fr;
    padding: 14px 18px;
  }

  .mobile-menu {
    display: block;
  }

  .progress-box {
    grid-column: 1 / -1;
  }

  .teacher-area {
    padding: 24px 18px 126px;
  }

  .action-row {
    grid-template-columns: minmax(180px, 1fr) 78px;
    gap: 14px;
    margin-top: 36px;
  }

  .user-entry {
    position: static;
    width: 100%;
    margin-top: 12px;
  }
}

/* ===== 顶格：标题栏顶到 topnav 正下方 ===== */
.topnav {
  position: sticky;
  top: 0;
  z-index: 50;
}
main {
  padding-top: 0 !important;
}
.layout,
.content-card,
.kb-content-grid,
.lesson-panel {
  margin-top: 0;
  padding-top: 0;
}

/* 覆盖 821-980px：inline 媒体查询已让整页滚动（content-card height:auto），
   但 ≤820 才钉标题栏不够；这里单独把标题栏 position:fixed 钉到 topnav 下方，
   让 821-980 范围也能 "标题在最上面"。不改抽屉/其他移动端样式。 */
@media (max-width: 980px) {
  .lesson-top {
    position: fixed;
    top: 78px;
    left: 0;
    right: 0;
    z-index: 40;
  }
}

/* ===== 课程锁定样式（2026-08-28 顺序解锁）===== */
.lesson-row.locked .lesson-item {
  color: #aab3c5;
  background: #f6f8fb;
  border: 1px dashed #d5dbe8;
  cursor: not-allowed;
  box-shadow: none;
}
.lesson-row.locked .lesson-item:hover {
  color: #aab3c5;
  background: #f6f8fb;
  transform: none;
  box-shadow: none;
  border-color: #d5dbe8;
}
.lesson-row.locked .lesson-item.active {
  background: #f6f8fb;
  color: #aab3c5;
  font-weight: 400;
  border-color: #d5dbe8;
}
.lesson-item .lesson-lock {
  font-size: 12px;
  margin-right: 4px;
}

/* ===== 课程内容换行支持（2026-09-10 内容升级）===== */
.message p {
  white-space: pre-wrap;
  word-wrap: break-word;
  overflow-wrap: break-word;
}
.typing-text {
  white-space: pre-wrap;
  word-wrap: break-word;
}
