:root {
  --ink: #172033;
  --muted: #667085;
  --line: #dde3ee;
  --paper: #f4f7fb;
  --panel: #ffffff;
  --green: #0f766e;
  --blue: #2563eb;
  --red: #b42318;
  --gold: #b7791f;
  --shadow: 0 12px 30px rgba(31, 41, 55, 0.08);
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: "Microsoft YaHei", "PingFang SC", "Segoe UI", Arial, sans-serif;
}
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }

.login-screen {
  position: fixed; inset: 0; z-index: 50; display: none; align-items: center; justify-content: center;
  background: rgba(15, 23, 42, .42); padding: 20px;
}
.login-screen.active { display: flex; }
.login-panel {
  width: min(480px, 100%); background: #fff; border-radius: 8px; padding: 26px; box-shadow: 0 24px 80px rgba(15,23,42,.24);
}
.auth-mode-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin: 14px 0;
}
.auth-mode-button {
  justify-content: center;
  color: #344054;
}
.auth-mode-button.active {
  color: #fff;
  background: var(--green);
  border-color: var(--green);
}
#displayNameRow { display: none; }
#displayNameRow.active { display: block; }
.app-shell { min-height: 100vh; display: grid; grid-template-columns: 260px minmax(0, 1fr); }
.sidebar {
  background: linear-gradient(180deg, #fff, #f7fbff); border-right: 1px solid var(--line);
  padding: 22px 16px; display: flex; flex-direction: column; gap: 22px; height: 100vh; position: sticky; top: 0;
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark { width: 44px; height: 44px; display: grid; place-items: center; background: var(--green); color: #fff; border-radius: 8px; font-weight: 800; }
.brand-title { font-size: 22px; font-weight: 800; }
.brand-subtitle { color: var(--muted); font-size: 12px; }
.nav-list { display: grid; gap: 6px; }
.nav-item { border: 0; background: transparent; text-align: left; color: #344054; padding: 13px 14px; border-radius: 8px; font-weight: 700; }
.nav-item:hover, .nav-item.active { background: #e9f5f3; color: #0f4f49; }
.sidebar-note { margin-top: auto; padding: 14px; border: 1px solid var(--line); border-radius: 8px; color: var(--muted); line-height: 1.7; background: #fff; }
.main { padding: 24px 28px 36px; min-width: 0; }
.topbar, .section-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 20px; }
.topbar { background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 18px 20px; box-shadow: var(--shadow); }
.topbar-actions, .button-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.eyebrow { margin: 0 0 8px; color: var(--green); font-weight: 800; }
h1, h2, h3, p { margin-top: 0; }
h1 { font-size: 28px; margin-bottom: 0; }
h2 { font-size: 24px; margin-bottom: 8px; }
h3 { font-size: 18px; margin-bottom: 10px; }
p { color: var(--muted); line-height: 1.7; }
.view { display: none; padding-top: 18px; }
.view.active { display: block; }
.primary-button, .secondary-button, .icon-button {
  border: 1px solid var(--line); background: #fff; min-height: 40px; border-radius: 8px; padding: 0 14px; font-weight: 700;
}
.primary-button { background: var(--green); color: #fff; border-color: var(--green); }
.secondary-button { color: var(--green); }
.icon-button { width: 40px; padding: 0; font-size: 18px; }
.logout-button { white-space: nowrap; color: #344054; }
.account-chip { min-height: 40px; display: flex; align-items: center; padding: 0 12px; border: 1px solid var(--line); border-radius: 999px; background: #fff; color: var(--green); font-weight: 800; }
.text-input { width: 100%; min-height: 42px; border: 1px solid var(--line); border-radius: 8px; padding: 8px 12px; background: #fff; margin: 6px 0 12px; }
.inline-select { min-width: 180px; margin: 6px 0 0; }
.diagnosis-note { margin-top: 12px; }
textarea { width: 100%; min-height: 260px; resize: vertical; border: 1px solid var(--line); border-radius: 8px; padding: 12px; line-height: 1.7; }
.notice, .report-box { border: 1px solid var(--line); background: #f8fafc; border-radius: 8px; padding: 14px; line-height: 1.8; color: #344054; }
#radarCanvas { width: 100%; max-width: 360px; height: auto; display: block; margin: 0 auto 14px; background: #fff; border: 1px solid var(--line); border-radius: 8px; }
.hero, .teacher-hero {
  display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(320px, .8fr); gap: 18px; align-items: center;
  background: linear-gradient(135deg, #0f766e, #2563eb); color: #fff; border-radius: 8px; padding: 24px; box-shadow: var(--shadow);
}
.hero h2, .teacher-hero h2 { color: #fff; font-size: 28px; }
.hero p, .teacher-hero p { color: rgba(255,255,255,.88); }
.hero-badge { display: inline-block; background: rgba(255,255,255,.18); border: 1px solid rgba(255,255,255,.28); border-radius: 999px; padding: 5px 10px; font-size: 12px; font-weight: 800; margin-bottom: 12px; }
.hero-image-wrap { border-radius: 8px; overflow: hidden; border: 1px solid rgba(255,255,255,.26); box-shadow: 0 18px 40px rgba(15,23,42,.22); background: rgba(255,255,255,.14); }
.hero-image-wrap img { width: 100%; height: 300px; object-fit: cover; display: block; }
.scenario-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; margin: 16px 0; }
.scenario-card { background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 18px; box-shadow: var(--shadow); }
.scenario-card span { color: var(--green); font-size: 12px; font-weight: 900; }
.scenario-card h3 { margin: 8px 0; }
.workflow-strip {
  display: flex; gap: 10px; align-items: center; flex-wrap: wrap; background: #fff; border: 1px solid var(--line);
  border-radius: 8px; padding: 14px 16px; margin-bottom: 16px; box-shadow: var(--shadow);
}
.workflow-strip span { background: #e9f5f3; color: #0f4f49; border-radius: 999px; padding: 6px 10px; font-weight: 800; font-size: 13px; }
.track-grid, .dashboard-grid, .path-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; margin: 16px 0; }
.track-card, .stat-card, .panel, .path-card {
  background: var(--panel); border: 1px solid var(--line); border-radius: 8px; box-shadow: var(--shadow);
}
.track-card { padding: 18px; min-height: 190px; transition: transform .16s ease, box-shadow .16s ease; }
.track-card:hover { transform: translateY(-2px); box-shadow: 0 18px 40px rgba(31,41,55,.12); }
.track-card.active { border-color: var(--green); outline: 3px solid #d7f0ec; }
.track-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 14px; }
.tag { display: inline-block; color: var(--blue); background: #eaf1ff; border-radius: 999px; padding: 4px 10px; font-size: 12px; font-weight: 800; margin-bottom: 12px; }
.stat-card { padding: 18px; }
.stat-card span { color: var(--muted); }
.stat-card strong { display: block; font-size: 30px; margin: 8px 0; }
.split-layout { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(320px, .9fr); gap: 16px; margin-top: 16px; }
.panel { padding: 20px; }
.question-list { display: grid; gap: 12px; }
.question-card { border: 1px solid var(--line); border-radius: 8px; padding: 14px; background: #fff; }
.question-meta { color: var(--green); font-size: 12px; font-weight: 800; text-transform: uppercase; margin-bottom: 6px; }
.question-passage { background: #f8fafc; border-left: 4px solid #b8d8d4; padding: 10px 12px; color: #344054; margin: 10px 0; }
.passage-group { padding: 18px; }
.passage-group .passage {
  white-space: pre-line;
  line-height: 1.78;
  color: #243044;
  background: #f8fafc;
  border: 1px solid #dbe4f0;
  border-left: 4px solid #0f766e;
  border-radius: 8px;
  padding: 16px;
  margin: 12px 0;
}
.sub-question-list { display: grid; gap: 16px; margin-top: 14px; }
.sub-question {
  border-top: 1px solid #e5edf7;
  padding-top: 14px;
}
.sub-question h3 { font-size: 18px; line-height: 1.45; margin-bottom: 8px; }
.sub-question:first-child { border-top: 0; padding-top: 0; }
.underlined-target {
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 4px;
  font-weight: 900;
}
.answer-blank {
  display: inline-block;
  width: min(180px, 46vw);
  min-width: 150px;
  height: 1em;
  border-bottom: 2px solid #0f766e;
  vertical-align: -0.08em;
  margin: 0 8px;
}
.answer-input { margin-top: 12px; }
.word-bank {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 8px;
  border: 1px solid #cfe0ef;
  background: #f7fbff;
  border-radius: 8px;
  padding: 12px;
  margin: 12px 0 4px;
}
.word-bank span {
  min-height: 34px;
  display: flex;
  align-items: center;
  gap: 6px;
  border: 1px solid #dbe7f3;
  background: #fff;
  border-radius: 6px;
  padding: 6px 8px;
  color: #243044;
}
.word-bank strong { color: #0f766e; }
.cloze-answer-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(92px, 1fr));
  gap: 10px;
  margin-top: 14px;
}
.cloze-answer-cell {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr);
  align-items: center;
  border: 1px solid #dbe7f3;
  background: #fff;
  border-radius: 8px;
  overflow: hidden;
}
.cloze-answer-cell span {
  display: grid;
  place-items: center;
  min-height: 46px;
  background: #e9f5f3;
  color: #0f4f49;
  font-weight: 900;
}
.cloze-letter-input {
  margin: 0;
  min-height: 46px;
  border: 0;
  border-left: 1px solid #dbe7f3;
  border-radius: 0;
  text-align: center;
  font-weight: 900;
  text-transform: uppercase;
}
.choice-list { display: grid; gap: 8px; margin-top: 12px; }
.choice-button { text-align: left; border: 1px solid var(--line); background: #fff; border-radius: 8px; padding: 10px; }
.choice-button.selected { border-color: var(--blue); background: #edf4ff; }
.choice-button.correct { border-color: var(--green); background: #e9f5f3; }
.choice-button.wrong { border-color: var(--red); background: #fff1f0; }
.training-toolbar { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 14px; margin-top: 16px; }
.training-toolbar-wide { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.compact-toolbar { margin-bottom: 16px; }
.feedback-toolbar { grid-template-columns: repeat(3, minmax(0, 1fr)); margin-top: 0; }
.prompt-card {
  border: 1px solid #dbe4f0;
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow);
  padding: 22px;
  margin-bottom: 14px;
}
.prompt-card h3 { font-size: 28px; margin-bottom: 16px; }
.prompt-card .prompt-meta { color: var(--green); font-weight: 800; margin-bottom: 8px; }
.prompt-card .prompt-instruction { white-space: pre-line; color: #344054; line-height: 1.8; font-size: 17px; }
.path-card { padding: 16px; }
.path-card { cursor: pointer; transition: transform .16s ease, box-shadow .16s ease, border-color .16s ease; }
.path-card:hover, .path-card.active { transform: translateY(-2px); border-color: var(--green); box-shadow: 0 18px 40px rgba(31,41,55,.12); }
.path-card small { color: var(--green); font-weight: 800; }
.path-card .path-actions { margin-top: 12px; display: flex; gap: 8px; flex-wrap: wrap; }
.path-detail-panel { margin-top: 4px; }
.record-list { display: grid; gap: 10px; }
.record-item { border: 1px solid var(--line); border-radius: 8px; padding: 12px; background: #fff; }
.bar-row { display: grid; grid-template-columns: 90px minmax(0, 1fr) 44px; gap: 10px; align-items: center; margin: 12px 0; }
.bar-row div { height: 12px; background: #eef1f5; border-radius: 999px; overflow: hidden; }
.bar-row i { display: block; height: 100%; background: var(--green); }
.xiaoyu-widget { position: fixed; right: 22px; bottom: 22px; z-index: 40; }
.xiaoyu-toggle { width: 58px; height: 58px; border-radius: 50%; border: 0; background: var(--green); color: #fff; font-weight: 900; box-shadow: 0 16px 36px rgba(15,118,110,.32); }
.xiaoyu-panel { display: none; width: 360px; max-width: calc(100vw - 32px); background: #fff; border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 24px 80px rgba(15,23,42,.22); overflow: hidden; margin-bottom: 12px; }
.xiaoyu-panel.open { display: block; }
.xiaoyu-panel header { padding: 14px 16px; background: #e9f5f3; display: flex; justify-content: space-between; gap: 12px; align-items: center; }
.xiaoyu-panel header span { color: var(--muted); font-size: 12px; }
.xiaoyu-messages { height: 260px; overflow: auto; padding: 14px; display: grid; gap: 10px; background: #f8fafc; }
.xiaoyu-msg { padding: 10px 12px; border-radius: 8px; line-height: 1.6; font-size: 14px; }
.xiaoyu-msg.bot { background: #fff; border: 1px solid var(--line); }
.xiaoyu-msg.user { background: #dff3ef; justify-self: end; max-width: 88%; }
.xiaoyu-input-row { display: grid; grid-template-columns: 1fr 70px; gap: 8px; padding: 12px; border-top: 1px solid var(--line); }
.xiaoyu-input-row input { border: 1px solid var(--line); border-radius: 8px; padding: 9px 10px; }
.xiaoyu-input-row button { border: 0; border-radius: 8px; background: var(--green); color: #fff; font-weight: 800; }
.xiaoyu-widget.disabled .xiaoyu-toggle { background: #98a2b3; }
.xiaoyu-widget.disabled .xiaoyu-panel { display: none; }
@media (max-width: 900px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; }
  .nav-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .hero, .teacher-hero, .split-layout { grid-template-columns: 1fr; }
  .track-grid, .dashboard-grid, .path-grid, .scenario-grid, .training-toolbar, .training-toolbar-wide { grid-template-columns: 1fr; }
  .hero-image-wrap img { height: 220px; }
}
