/* 华育知新 —— 视觉：暖纸 · 墨色 · 华育绿。独立设计。 */
:root {
  --paper: #f7f3ec;
  --card: #fffdf8;
  --ink: #26221c;
  --muted: #8a7f70;
  --line: #e5ddd0;
  --brand: #10744d;
  --brand-dark: #0b5638;
  --brand-tint: #e7f2ec;
  --ok: #3d7a4e;
  --warn: #b07d2a;
  --danger: #b03a2e;
  --serif: "Noto Serif SC", "Source Han Serif SC", "STSong", "SimSun", serif;
  --sans: -apple-system, "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
}
* { box-sizing: border-box; }
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font-family: var(--sans); font-size: 15px; line-height: 1.7;
}
h1, h2, h3, .brand { font-family: var(--serif); }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── 顶栏 ── */
.topbar {
  display: flex; align-items: center; gap: 16px;
  padding: 12px 28px; border-bottom: 1px solid var(--line);
  background: var(--card); position: sticky; top: 0; z-index: 20;
}
.topbar .brand { font-size: 20px; font-weight: 700; letter-spacing: 2px; display: flex; align-items: center; gap: 8px; }
.topbar-logo { height: 24px; width: auto; }
.topbar .brand em { color: var(--brand); font-style: normal; }
.topbar nav { display: flex; gap: 18px; margin-left: 8px; }
.topbar nav a { color: var(--ink); font-size: 14px; }
.topbar nav a.active { color: var(--brand); font-weight: 600; }
.topbar .spacer { flex: 1; }
.topbar .who { color: var(--muted); font-size: 13px; }

/* ── 按钮/表单 ── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 9px 20px; border: 1px solid var(--ink); background: var(--ink);
  color: #fff; font-size: 14px; cursor: pointer; border-radius: 3px;
  font-family: var(--sans); transition: opacity .15s;
}
.btn:hover { opacity: .85; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.primary { background: var(--brand); border-color: var(--brand); }
.btn.primary:hover { background: var(--brand-dark); }
.btn.ghost { background: transparent; color: var(--ink); }
.btn.small { padding: 4px 12px; font-size: 13px; }
.btn.danger { background: transparent; color: var(--danger); border-color: var(--danger); }

.field { margin-bottom: 16px; }
.field label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.field input, .field textarea, .field select {
  width: 100%; padding: 10px 12px; border: 1px solid var(--line);
  background: #fff; border-radius: 3px; font-size: 15px; font-family: var(--sans);
  color: var(--ink);
}
.field input:focus, .field textarea:focus { outline: 2px solid var(--brand); outline-offset: -1px; }
.field textarea { resize: vertical; min-height: 84px; }
.radio-row { display: flex; gap: 18px; align-items: center; }
.radio-row label { display: flex; gap: 6px; align-items: center; color: var(--ink); font-size: 14px; white-space: nowrap; }

.msg { min-height: 22px; font-size: 13px; color: var(--danger); margin-top: 8px; }
.msg.ok { color: var(--ok); }

/* ── 登录页 ── */
.login-wrap { display: grid; grid-template-columns: 1fr 1fr; min-height: 100vh; }
.login-left {
  display: flex; flex-direction: column; justify-content: center;
  align-items: center; text-align: center;
  padding: 0 8vw; border-right: 1px solid var(--line);
}
.brand-logo { width: 168px; height: auto; margin-bottom: 30px; }
.brand-name {
  font-family: var(--serif); font-size: 46px; font-weight: 700;
  letter-spacing: 8px; margin: 0 0 34px; color: var(--ink);
}
.brand-name em { color: var(--brand); font-style: normal; }
.slogan-1 {
  font-family: var(--serif); font-size: 26px; font-weight: 700;
  color: var(--ink); margin: 0 0 14px; letter-spacing: 2px;
}
.slogan-2 {
  font-family: var(--serif); font-size: 26px; font-weight: 700;
  color: var(--ink); margin: 0; letter-spacing: 2px;
}
.slogan-2 b { color: var(--brand); font-weight: 700; }
.login-right { display: flex; align-items: center; justify-content: center; padding: 40px; }
.login-card { width: 360px; background: var(--card); border: 1px solid var(--line); padding: 32px; border-radius: 4px; }
.tabs { display: flex; gap: 0; margin-bottom: 22px; border-bottom: 1px solid var(--line); }
.tabs button {
  flex: 1; padding: 10px; background: none; border: none; font-size: 15px;
  cursor: pointer; color: var(--muted); font-family: var(--serif);
}
.tabs button.active { color: var(--brand); border-bottom: 2px solid var(--brand); font-weight: 700; }
.login-card .btn { width: 100%; margin-top: 6px; }
.agree-row {
  display: flex; gap: 7px; align-items: flex-start; margin-top: 14px;
  font-size: 12px; color: var(--muted); cursor: pointer; line-height: 1.6;
}
.agree-row input { margin-top: 3px; accent-color: var(--brand); }
.agree-row.shake { animation: agreeShake .4s; }
@keyframes agreeShake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-5px); }
  75% { transform: translateX(5px); }
}
.login-foot { margin-top: 18px; font-size: 12px; color: var(--muted); text-align: center; }
.login-footer {
  position: fixed; left: 0; right: 0; bottom: 0; padding: 10px 0;
  text-align: center; font-size: 12px; color: var(--muted);
  background: var(--paper); border-top: 1px solid var(--line);
}

/* ── 协议页 ── */
.legal-body { max-width: 760px; margin: 0 auto; padding: 48px 24px 96px; }
.legal-body h1 { font-size: 28px; }
.legal-body h2 { font-size: 18px; margin-top: 32px; }
.legal-body p, .legal-body li { color: #4a4238; font-size: 15px; }
.legal-body .draft-note {
  background: var(--brand-tint); border: 1px solid var(--brand);
  padding: 10px 16px; border-radius: 3px; font-size: 13px; color: var(--brand-dark);
}

/* ── 主页/广场卡片 ── */
.page { max-width: 1080px; margin: 0 auto; padding: 32px 24px 80px; }
.page h2 { font-size: 26px; margin: 8px 0 4px; }
.page .sub { color: var(--muted); margin-bottom: 28px; }
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 18px; }
.stage-divider {
  grid-column: 1 / -1;
  display: flex; align-items: center; gap: 16px;
  font-family: var(--serif); font-size: 17px; font-weight: 700;
  color: var(--ink); margin-top: 20px; letter-spacing: 2px;
}
.stage-divider:first-child { margin-top: 0; }
.stage-divider::before, .stage-divider::after {
  content: ""; flex: 1; border-top: 1px solid var(--line);
}
.stage-divider::before { max-width: 60px; }
.course-card {
  background: var(--card); border: 1px solid var(--line); border-radius: 4px;
  padding: 20px; display: flex; flex-direction: column; gap: 10px;
}
.course-card h3 { margin: 0; font-size: 18px; }
.course-card .meta { color: var(--muted); font-size: 12px; }
.course-card .ops { display: flex; gap: 8px; margin-top: auto; flex-wrap: wrap; }
.progress-track { height: 6px; background: var(--line); border-radius: 3px; overflow: hidden; }
.progress-fill { height: 100%; background: var(--brand); transition: width .4s; }
.progress-text { font-size: 12px; color: var(--muted); }
.badge {
  display: inline-block; padding: 1px 8px; font-size: 12px; border-radius: 2px;
  border: 1px solid var(--line); color: var(--muted);
}
.badge.gen { color: var(--warn); border-color: var(--warn); }
.badge.fail { color: var(--danger); border-color: var(--danger); }

/* ── 建课表单 ── */
.create-panel {
  background: var(--card); border: 1px solid var(--line); border-radius: 4px;
  padding: 28px; margin-bottom: 36px;
}
.create-panel h2 { margin-top: 0; }
.char-count { float: right; font-size: 12px; color: var(--muted); }

/* ── 学习页 ── */
.learn-layout { display: grid; grid-template-columns: 320px 1fr; min-height: calc(100vh - 54px); }
.tree-pane {
  border-right: 1px solid var(--line); background: var(--card);
  padding: 20px 16px; overflow-y: auto; max-height: calc(100vh - 54px);
  position: sticky; top: 54px;
}
.tree-pane h3 { margin: 0 0 4px; font-size: 17px; }
.tree-pane .progress-text { margin-bottom: 14px; display: block; }
.pt { padding: 7px 10px; border-radius: 3px; font-size: 14px; margin-bottom: 2px; }
.pt.l1 { font-family: var(--serif); font-weight: 700; margin-top: 12px; font-size: 15px; }
.pt.l2 { padding-left: 26px; }
.pt .ico { margin-right: 6px; }
.pt.locked { color: var(--muted); }
.pt.unlocked { color: var(--ink); }
.pt.focus { background: var(--brand-tint); box-shadow: inset 2px 0 0 var(--brand); }
.pt .cog { font-size: 11px; color: var(--warn); margin-left: 6px; }
.pt[title] { cursor: help; }

.chat-pane { display: flex; flex-direction: column; max-width: 860px; }
.chat-scroll { flex: 1; padding: 24px 28px; overflow-y: auto; }
.bubble-row { margin-bottom: 18px; display: flex; flex-direction: column; }
.bubble-row.user { align-items: flex-end; }
.bubble {
  max-width: 82%; padding: 12px 16px; border-radius: 4px; font-size: 15px;
  background: var(--card); border: 1px solid var(--line); white-space: normal;
}
.bubble-row.user .bubble { background: #2e2a24; color: #f5efe6; border-color: #2e2a24; }
.bubble .fav-star {
  float: right; margin-left: 10px; cursor: pointer; color: var(--muted);
  font-size: 14px; user-select: none;
}
.bubble .fav-star:hover, .bubble .fav-star.on { color: var(--warn); }
.bubble p { margin: 6px 0; }
.bubble p:first-child { margin-top: 0; }
.bubble p:last-child { margin-bottom: 0; }
.bubble blockquote { border-left: 3px solid var(--warn); margin: 8px 0; padding: 2px 12px; color: #6b5f50; background: #faf6ee; }
.bubble code { background: #efe9de; padding: 1px 5px; border-radius: 2px; font-size: 13px; }
.bubble pre { background: #efe9de; padding: 10px 12px; border-radius: 3px; overflow-x: auto; }
.bubble pre code { background: none; padding: 0; }
.bubble table { border-collapse: collapse; margin: 8px 0; }
.bubble th, .bubble td { border: 1px solid var(--line); padding: 4px 10px; font-size: 14px; }

.quiz-card {
  margin: 12px 0; padding: 16px; border: 1px solid var(--warn);
  border-radius: 4px; background: #fffaf0;
}
.quiz-card .q { font-weight: 600; margin-bottom: 10px; }
.quiz-card .opt {
  display: block; padding: 7px 12px; margin: 6px 0; border: 1px solid var(--line);
  border-radius: 3px; cursor: pointer; background: #fff;
}
.quiz-card .opt:hover { border-color: var(--warn); }
.quiz-card .opt.right { border-color: var(--ok); background: #eef6ef; }
.quiz-card .opt.wrong { border-color: var(--danger); background: #faeeec; }
.quiz-card .exp { margin-top: 10px; font-size: 13px; color: var(--muted); display: none; }
.quiz-card.answered .exp { display: block; }

.chat-input {
  border-top: 1px solid var(--line); background: var(--card);
  padding: 14px 28px; display: flex; gap: 10px; align-items: flex-end;
}
.chat-input textarea {
  flex: 1; min-height: 44px; max-height: 140px; padding: 10px 12px;
  border: 1px solid var(--line); border-radius: 3px; font-size: 15px;
  font-family: var(--sans); resize: none;
}
.side-tabs { display: flex; gap: 8px; padding: 10px 28px 0; }
.side-tabs button {
  background: none; border: 1px solid var(--line); border-radius: 3px;
  padding: 4px 14px; font-size: 13px; cursor: pointer; color: var(--muted);
}
.side-tabs button.active { color: var(--brand); border-color: var(--brand); }
.drawer {
  border-top: 1px solid var(--line); background: #fbf8f2; padding: 14px 28px;
  display: none; max-height: 260px; overflow-y: auto;
}
.drawer.open { display: block; }
.drawer .item {
  background: #fff; border: 1px solid var(--line); border-radius: 3px;
  padding: 10px 12px; margin-bottom: 8px; font-size: 14px;
  display: flex; gap: 10px; align-items: flex-start;
}
.drawer .item .txt { flex: 1; white-space: pre-wrap; }
.drawer .item .mini { color: var(--muted); cursor: pointer; font-size: 12px; white-space: nowrap; }
.drawer .item .mini:hover { color: var(--brand); }
.drawer .add-row { display: flex; gap: 8px; }
.drawer .add-row input {
  flex: 1; padding: 8px 10px; border: 1px solid var(--line); border-radius: 3px; font-size: 14px;
}

/* ── 弹窗 ── */
.modal-mask {
  position: fixed; inset: 0; background: rgba(38, 34, 28, .4);
  display: none; align-items: center; justify-content: center; z-index: 50;
}
.modal-mask.open { display: flex; }
.modal {
  background: var(--card); border: 1px solid var(--line); border-radius: 4px;
  padding: 26px; width: 420px; max-width: 92vw; position: relative;
}
.modal h3 { margin-top: 0; }
.modal-close {
  position: absolute; top: 10px; right: 14px; background: none; border: none;
  font-size: 22px; line-height: 1; color: var(--muted); cursor: pointer; padding: 2px 6px;
}
.modal-close:hover { color: var(--ink); }
.modal .share-url {
  width: 100%; padding: 8px 10px; border: 1px solid var(--line);
  border-radius: 3px; font-size: 13px; background: #fff;
}
.modal hr { border: none; border-top: 1px solid var(--line); margin: 18px 0; }
.muted-note { color: var(--muted); font-size: 13px; }

/* ── 推广页 ── */
.promo-banner {
  display: flex; align-items: center; gap: 18px;
  background: var(--card); border: 1px solid var(--line); border-radius: 4px;
  padding: 18px 24px; margin-bottom: 22px;
}
.promo-banner img { width: 72px; height: auto; }
.promo-title { font-family: var(--serif); font-size: 18px; font-weight: 700; color: var(--ink); }
.promo-sub { font-size: 13px; color: var(--muted); letter-spacing: 2px; margin-top: 2px; }
.promo-cta {
  margin-top: 24px; text-align: center; background: var(--brand-tint);
  border: 1px solid var(--brand); border-radius: 4px; padding: 24px;
}
.promo-cta p { margin-top: 0; color: var(--brand-dark); }
.empty-tip { color: var(--muted); text-align: center; padding: 60px 0; font-size: 14px; }

/* ── 广场/分享页 ── */
.shared-head {
  background: var(--card); border: 1px solid var(--line); border-radius: 4px;
  padding: 28px; margin-bottom: 24px;
}
.shared-head .meta { color: var(--muted); font-size: 13px; margin-top: 8px; }

@media (max-width: 860px) {
  .login-wrap { grid-template-columns: 1fr; }
  .login-left { padding: 60px 8vw; border-right: none; border-bottom: 1px solid var(--line); }
  .learn-layout { grid-template-columns: 1fr; }
  .tree-pane { position: static; max-height: none; border-right: none; border-bottom: 1px solid var(--line); }
}
