* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  color: #1f2937;
  background: #f3f5f9;
  -webkit-font-smoothing: antialiased;
}

a { text-decoration: none; color: inherit; }
button { font-family: inherit; cursor: pointer; }

/* ---------- Role color tokens ---------- */
:root {
  --c-subj-bg: #dbeafe;  --c-subj-fg: #1d4ed8;
  --c-verb-bg: #d1fae5;  --c-verb-fg: #047857;
  --c-obj-bg:  #fce7f3;  --c-obj-fg:  #be185d;
  --c-attr-bg: #ede9fe;  --c-attr-fg: #6d28d9;
  --c-time-bg: #ffedd5;  --c-time-fg: #c2410c;
  --c-adv-bg:  #fef3c7;  --c-adv-fg:  #92400e;
  --c-place-bg:#ccfbf1;  --c-place-fg:#0f766e;
  --c-neg-bg:  #fee2e2;  --c-neg-fg:  #b91c1c;
}

/* ---------- Header ---------- */
.app-header {
  height: 64px;
  background: #ffffff;
  border-bottom: 1px solid #e5e7eb;
  display: flex;
  align-items: center;
  padding: 0 28px;
  gap: 36px;
  position: sticky;
  top: 0;
  z-index: 100;
}

.page-nav {
  display: inline-flex;
  gap: 4px;
  margin-right: 8px;
}
.pn-btn {
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 50%;
  background: #f3f4f6;
  color: #4b5563;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  transition: background 0.15s ease, color 0.15s ease, transform 0.15s ease;
}
.pn-btn:hover {
  background: #e5e7eb;
  color: #111827;
  transform: scale(1.06);
}
.pn-btn:active { transform: scale(0.95); }
.pn-home { color: #2c6cf6; }

.brand { display: flex; align-items: center; gap: 10px; }
.brand-logo {
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #eaf1ff;
  border-radius: 8px;
}
.brand-name { font-size: 17px; font-weight: 700; color: #111827; letter-spacing: 0.2px; }

.top-nav { display: flex; gap: 28px; }
.top-link {
  font-size: 15px;
  color: #6b7280;
  padding: 22px 2px;
  position: relative;
  font-weight: 500;
}
.top-link:hover { color: #111827; }
.top-link.active { color: #2c6cf6; }
.top-link.active::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: 12px;
  height: 2px;
  background: #2c6cf6;
  border-radius: 2px;
}

.user-area { margin-left: auto; display: flex; align-items: center; gap: 14px; }
.icon-btn {
  width: 36px; height: 36px;
  border: none; background: transparent;
  border-radius: 50%;
  color: #6b7280;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s ease;
}
.icon-btn:hover { background: #f3f4f6; color: #111827; }

.mute-btn .icon-active { display: none; }
.mute-btn.is-muted .icon-inactive { display: none; }
.mute-btn.is-muted .icon-active { display: block; color: #b91c1c; }
.mute-btn.is-muted { background: #fef2f2; color: #b91c1c; }
.mute-btn.is-muted:hover { background: #fee2e2; }
.user-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 10px 4px 4px;
  border-radius: 999px;
  cursor: pointer;
  color: #1f2937;
  transition: background 0.15s ease;
}
.user-chip:hover { background: #f3f4f6; }
.avatar { width: 32px; height: 32px; border-radius: 50%; object-fit: cover; }
.user-name { font-size: 14px; font-weight: 600; }

/* ---------- Layout ---------- */
.lesson-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 20px;
  padding: 20px;
  max-width: 1600px;
  margin: 0 auto;
}

.lesson-left, .lesson-right {
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-width: 0;
}

/* ---------- Lesson banner ---------- */
.lesson-banner {
  background: #ffffff;
  border-radius: 14px;
  padding: 14px 18px;
  border: 1px solid #f1f5f9;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.04);
}
.lesson-banner:empty { display: none; }
.lb-row { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.lb-num {
  display: inline-flex;
  align-items: center;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 999px;
  background: #eff6ff;
  color: #1d4ed8;
  letter-spacing: 0.3px;
}
.lb-topic { font-size: 18px; font-weight: 700; color: #111827; }
.lb-en { font-size: 13px; color: #6b7280; font-weight: 500; margin-left: 4px; }
.lb-intro { font-size: 13px; color: #4b5563; line-height: 1.7; margin-top: 8px; }

/* ---------- Warmup card ---------- */
.warmup-card {
  background: linear-gradient(135deg, #f0f6ff 0%, #fef5ee 100%);
  border-radius: 16px;
  padding: 18px 20px 20px;
  box-shadow: 0 4px 16px rgba(15, 23, 42, 0.06);
  border: 1px solid #e5edf7;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.warmup-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.warmup-title { display: flex; align-items: center; gap: 12px; }
.wt-icon {
  width: 38px; height: 38px;
  background: #ffffff;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.06);
}
.wt-name { font-size: 16px; font-weight: 700; color: #111827; }
.wt-sub { font-size: 12px; color: #6b7280; margin-top: 2px; }

.warmup-stats { display: flex; align-items: center; gap: 10px; }
.stat-streak {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: #fff7ed;
  color: #c2410c;
  font-size: 12px;
  font-weight: 700;
  padding: 5px 10px;
  border-radius: 999px;
  border: 1px solid #ffedd5;
}
.ss-icon { font-size: 13px; }
.ss-value { font-size: 14px; }
.ss-label { font-weight: 500; opacity: 0.8; }

.stat-timer {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: #ffffff;
  color: #475569;
  font-size: 12px;
  font-weight: 600;
  padding: 5px 10px;
  border-radius: 999px;
  border: 1px solid #e5e7eb;
  font-variant-numeric: tabular-nums;
}
.stat-timer.is-urgent { color: #b45309; background: #fef3c7; border-color: #fde68a; }
.stat-timer.is-expired { color: #b91c1c; background: #fee2e2; border-color: #fecaca; }

.warmup-prompt {
  background: rgba(255,255,255,0.6);
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 14px;
  line-height: 1.6;
}
.wp-label { color: #6b7280; font-weight: 600; font-size: 12px; }
.wp-text { color: #1f2937; margin-left: 4px; }

.warmup-answer {
  min-height: 56px;
  background: #ffffff;
  border: 2px dashed #cbd5e1;
  border-radius: 12px;
  padding: 10px 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}
.wa-placeholder { color: #9ca3af; font-size: 13px; font-style: italic; }
.wa-tile {
  background: #2c6cf6;
  color: #ffffff;
  font-size: 14px;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: 8px;
  cursor: pointer;
  transition: transform 0.15s ease, background 0.15s ease;
  user-select: none;
}
.wa-tile:hover { background: #1e54d6; transform: translateY(-1px); }

.warmup-tiles {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-height: 38px;
}
.wt-tile {
  background: #ffffff;
  color: #1f2937;
  font-size: 14px;
  font-weight: 600;
  padding: 6px 12px;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  cursor: pointer;
  transition: transform 0.15s ease, background 0.15s ease, color 0.15s ease;
}
.wt-tile:hover { background: #f3f4f6; color: #111827; transform: translateY(-1px); }
.wt-tile.is-used { display: none; }

.warmup-result {
  padding: 12px 14px;
  border-radius: 10px;
  font-size: 13.5px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.warmup-result.is-correct {
  background: #d1fae5;
  color: #047857;
  border: 1px solid #a7f3d0;
}
.warmup-result.is-wrong {
  background: #fef2f2;
  color: #991b1b;
  border: 1px solid #fecaca;
}
.wr-headline { font-weight: 700; display: inline-flex; align-items: center; gap: 6px; }
.wr-sub { font-size: 13px; opacity: 0.9; }
.wr-sub em { font-style: normal; font-weight: 700; }

.warmup-footer {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 4px;
}
.warmup-footer .btn-primary { margin-left: auto; }

/* ---------- Tabs card ---------- */
.tabs-card {
  background: #ffffff;
  border-radius: 16px;
  padding: 4px 24px 24px;
  box-shadow: 0 2px 10px rgba(15, 23, 42, 0.05);
  flex: 1;
}

.tab-nav {
  display: flex;
  gap: 24px;
  border-bottom: 1px solid #f1f5f9;
  margin: 0 -24px 18px;
  padding: 0 24px;
  overflow-x: auto;
}
.tab-link {
  background: transparent;
  border: none;
  padding: 16px 2px;
  font-size: 14px;
  color: #64748b;
  font-weight: 500;
  position: relative;
  white-space: nowrap;
}
.tab-link:hover { color: #1f2937; }
.tab-link.active { color: #2c6cf6; font-weight: 600; }
.tab-link.active::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 2px;
  background: #2c6cf6;
}

.tab-pane { display: none; }
.tab-pane.active { display: block; }

/* ---------- Knowledge content ---------- */
.kb-title {
  font-size: 19px;
  font-weight: 700;
  color: #111827;
  margin-bottom: 8px;
}
.kb-en { color: #6b7280; font-weight: 600; font-size: 16px; margin-left: 4px; }
.kb-intro { font-size: 13.5px; color: #4b5563; line-height: 1.7; margin-bottom: 18px; }

.kb-box {
  background: #f8fafc;
  border-radius: 12px;
  padding: 16px 18px;
  margin-bottom: 14px;
}
.kb-tone-blue { background: #eff6fb; }
.kb-tone-green { background: #effbf2; }
.kb-tone-purple { background: #f4f1fb; }

.kb-box-title {
  font-size: 13.5px;
  font-weight: 700;
  color: #334155;
  margin-bottom: 12px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.kb-marker {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 6px;
  background: #ffffff;
  font-size: 12px;
}

.formula {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-bottom: 12px;
}
.chip {
  display: inline-flex;
  align-items: center;
  padding: 7px 14px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 600;
  border: 1px solid transparent;
}
.chip-subj { background: var(--c-subj-bg); color: var(--c-subj-fg); }
.chip-verb { background: var(--c-verb-bg); color: var(--c-verb-fg); }
.chip-obj  { background: var(--c-obj-bg);  color: var(--c-obj-fg);  }
.chip-attr { background: var(--c-attr-bg); color: var(--c-attr-fg); }
.chip-blue { background: #e0ecff; color: #1e40af; }
.plus { color: #94a3b8; font-weight: 700; }

.kb-example {
  font-size: 13.5px;
  color: #374151;
  line-height: 1.8;
  padding: 10px 12px;
  background: #ffffff;
  border-radius: 8px;
  border-left: 3px solid #2c6cf6;
}
.kb-example em { color: #1e40af; font-style: normal; font-weight: 700; }
.kb-example .ex-cn { color: #6b7280; font-size: 13px; }

.kb-keywords {
  font-size: 13.5px;
  color: #374151;
  line-height: 1.9;
  padding: 8px 0;
}

.kb-list { list-style: none; padding-left: 0; }
.kb-list li {
  font-size: 13.5px;
  color: #374151;
  padding: 4px 0 4px 18px;
  position: relative;
  line-height: 1.7;
}
.kb-list li::before {
  content: "";
  position: absolute;
  left: 4px; top: 12px;
  width: 5px; height: 5px;
  border-radius: 50%;
  background: #6d28d9;
}

/* ---------- Tab: 语法结构图 ---------- */
.tree {
  background: #f8fafc;
  border-radius: 12px;
  padding: 22px 18px;
  margin-bottom: 16px;
}
.tree-root {
  text-align: center;
  font-size: 14px;
  font-weight: 700;
  color: #111827;
  padding: 10px 16px;
  background: #ffffff;
  border-radius: 8px;
  border: 1px solid #e5e7eb;
  display: inline-block;
  margin: 0 auto 28px;
  position: relative;
  left: 50%;
  transform: translateX(-50%);
}
.tree-branches {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  position: relative;
}
.tree-branches::before {
  content: "";
  position: absolute;
  top: -16px; left: 16.66%; right: 16.66%;
  height: 1px;
  background: #cbd5e1;
}
.branch {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  position: relative;
}
.branch::before {
  content: "";
  position: absolute;
  top: -16px; left: 50%;
  width: 1px; height: 16px;
  background: #cbd5e1;
}
.node {
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 700;
  text-align: center;
  width: 100%;
}
.node small { display: block; font-weight: 500; font-size: 11px; opacity: 0.75; margin-top: 2px; }
.node-subj { background: var(--c-subj-bg); color: var(--c-subj-fg); }
.node-verb { background: var(--c-verb-bg); color: var(--c-verb-fg); }
.node-obj  { background: var(--c-obj-bg);  color: var(--c-obj-fg);  }
.node-eg { font-size: 12px; color: #6b7280; text-align: center; line-height: 1.6; }
.sub-tree {
  display: flex;
  align-items: stretch;
  gap: 6px;
  width: 100%;
}
.sub-node {
  flex: 1;
  background: #ffffff;
  border: 1px dashed #cbd5e1;
  border-radius: 6px;
  font-size: 11.5px;
  font-weight: 600;
  color: #475569;
  padding: 6px 4px;
  text-align: center;
}
.sub-node small { display: block; font-weight: 400; font-size: 10px; color: #94a3b8; }
.sub-plus { color: #94a3b8; font-weight: 700; display: flex; align-items: center; }

.diagram-sentence {
  font-size: 17px;
  line-height: 2;
  margin-bottom: 8px;
  text-align: left;
}
.ds-part {
  padding: 3px 8px;
  border-radius: 6px;
  font-weight: 600;
  margin: 0 2px;
  display: inline-block;
}
.diagram-labels {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 10px;
}
.dl {
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 999px;
}
.ds-subj, .dl.ds-subj { background: var(--c-subj-bg); color: var(--c-subj-fg); }
.ds-aux,  .dl.ds-aux  { background: var(--c-attr-bg); color: var(--c-attr-fg); }
.ds-verb, .dl.ds-verb { background: var(--c-verb-bg); color: var(--c-verb-fg); }
.ds-obj,  .dl.ds-obj  { background: var(--c-obj-bg);  color: var(--c-obj-fg);  }
.ds-adv,  .dl.ds-adv  { background: var(--c-time-bg); color: var(--c-time-fg); }

/* ---------- Tab: 使用场景 ---------- */
.scenario-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}
.scn {
  background: #f8fafc;
  border-radius: 12px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.scn-head { display: flex; align-items: center; gap: 10px; }
.scn-head h3 { font-size: 14px; font-weight: 700; color: #111827; }
.scn-tag {
  width: 24px; height: 24px;
  border-radius: 50%;
  background: #2c6cf6;
  color: #ffffff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
}
.scn-cue { font-size: 12px; color: #6b7280; }
.scn-cue em { color: #2c6cf6; font-style: normal; font-weight: 600; }
.scn-ex {
  font-size: 13px;
  color: #374151;
  padding: 8px 10px;
  background: #ffffff;
  border-radius: 8px;
  line-height: 1.7;
  border-left: 2px solid #cbd5e1;
}
.scn-ex em { color: #047857; font-style: normal; font-weight: 700; }
.scn-ex .ex-cn { color: #6b7280; font-size: 12px; }

/* ---------- Tab: 常见错误 ---------- */
.err-list { display: flex; flex-direction: column; gap: 12px; }
.err {
  background: #f8fafc;
  border-radius: 12px;
  padding: 16px;
}
.err-title { font-size: 14px; font-weight: 700; color: #111827; margin-bottom: 12px; }
.err-row { display: flex; flex-direction: column; gap: 8px; margin-bottom: 10px; }
.err-bad, .err-good {
  font-size: 13px;
  padding: 9px 12px;
  border-radius: 8px;
  display: flex;
  align-items: flex-start;
  gap: 8px;
  line-height: 1.6;
}
.err-bad {
  background: #fef2f2;
  color: #991b1b;
}
.err-good {
  background: #f0fdf4;
  color: #166534;
}
.err-mark { font-weight: 700; flex-shrink: 0; }
.err-bad em { color: #be123c; font-style: normal; font-weight: 700; }
.err-bad strong { color: #be123c; text-decoration: line-through; }
.err-good em { color: #15803d; font-style: normal; font-weight: 700; }
.err-tip {
  font-size: 12px;
  color: #6b7280;
  line-height: 1.7;
  padding-left: 4px;
}

/* ---------- Tab: 对比辨析 ---------- */
.cmp {
  background: #f8fafc;
  border-radius: 12px;
  padding: 18px;
  margin-bottom: 14px;
}
.cmp-title {
  font-size: 14px;
  font-weight: 700;
  color: #111827;
  margin-bottom: 14px;
}
.cmp-row {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 10px;
  align-items: center;
  margin-bottom: 12px;
}
.cmp-cell {
  background: #ffffff;
  border-radius: 10px;
  padding: 12px 14px;
}
.cmp-head { font-size: 12px; font-weight: 700; color: #2c6cf6; margin-bottom: 8px; }
.cmp-eg { font-size: 13.5px; color: #1f2937; margin-bottom: 6px; line-height: 1.5; }
.cmp-eg em { color: #047857; font-style: normal; font-weight: 700; }
.cmp-mean { font-size: 12px; color: #6b7280; }
.cmp-vs {
  font-size: 12px;
  font-weight: 700;
  color: #94a3b8;
  text-align: center;
  background: #ffffff;
  width: 28px; height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}
.cmp-key { font-size: 12.5px; color: #475569; line-height: 1.7; }
.cmp-key strong { color: #1e3a8a; }

.teacher-tip {
  background: linear-gradient(135deg, #fff7e6 0%, #fde8e0 100%);
  border-radius: 12px;
  padding: 16px 18px;
}
.tt-title {
  font-size: 13px;
  font-weight: 700;
  color: #b45309;
  margin-bottom: 6px;
}
.teacher-tip p { font-size: 13px; color: #57534e; line-height: 1.7; }
.teacher-tip em { color: #b45309; font-style: normal; font-weight: 700; }

/* ---------- RIGHT: Practice ---------- */
.lesson-right { gap: 0; }
.practice-header {
  background: #ffffff;
  padding: 18px 24px;
  border-radius: 16px 16px 0 0;
  border-bottom: 1px solid #f1f5f9;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.practice-title { font-size: 16px; font-weight: 700; color: #111827; }
.practice-meta { display: flex; align-items: center; gap: 16px; }
.progress { font-size: 14px; color: #94a3b8; font-variant-numeric: tabular-nums; }
.progress b { color: #2c6cf6; font-weight: 700; font-size: 15px; }
.progress .sep { margin: 0 4px; }

.btn-primary {
  background: #2c6cf6;
  color: #ffffff;
  border: none;
  font-size: 14px;
  font-weight: 600;
  padding: 8px 18px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: background 0.15s ease;
}
.btn-primary:hover { background: #1e54d6; }

.exercise-list {
  background: #ffffff;
  flex: 1;
  padding: 8px 24px 20px;
  overflow-y: auto;
}

.exercise {
  padding: 18px 0;
  border-bottom: 1px solid #f1f5f9;
  display: flex;
  gap: 14px;
}
.exercise:last-child { border-bottom: none; }
.ex-num {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #dbeafe;
  color: #1d4ed8;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  flex-shrink: 0;
  margin-top: 2px;
}
.ex-body { flex: 1; min-width: 0; }
.ex-text {
  font-size: 16px;
  line-height: 2.2;
  color: #1f2937;
  margin-bottom: 8px;
}
.ex-text .hl {
  padding: 2px 6px;
  border-radius: 5px;
  font-weight: 500;
  margin: 0 1px;
}
.ex-text .hl-subj  { background: var(--c-subj-bg);  color: var(--c-subj-fg); }
.ex-text .hl-verb  { background: var(--c-verb-bg);  color: var(--c-verb-fg); }
.ex-text .hl-obj   { background: var(--c-obj-bg);   color: var(--c-obj-fg); }
.ex-text .hl-attr  { background: var(--c-attr-bg);  color: var(--c-attr-fg); }
.ex-text .hl-time  { background: var(--c-time-bg);  color: var(--c-time-fg); }
.ex-text .hl-adv   { background: var(--c-adv-bg);   color: var(--c-adv-fg); }
.ex-text .hl-place { background: var(--c-place-bg); color: var(--c-place-fg); }
.ex-text .hl-neg   { background: var(--c-neg-bg);   color: var(--c-neg-fg); }

.ex-labels {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 12px;
}
.ex-lbl {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 999px;
  letter-spacing: 0.2px;
}
.ex-lbl.lbl-subj  { background: var(--c-subj-bg);  color: var(--c-subj-fg); }
.ex-lbl.lbl-verb  { background: var(--c-verb-bg);  color: var(--c-verb-fg); }
.ex-lbl.lbl-obj   { background: var(--c-obj-bg);   color: var(--c-obj-fg); }
.ex-lbl.lbl-attr  { background: var(--c-attr-bg);  color: var(--c-attr-fg); }
.ex-lbl.lbl-time  { background: var(--c-time-bg);  color: var(--c-time-fg); }
.ex-lbl.lbl-adv   { background: var(--c-adv-bg);   color: var(--c-adv-fg); }
.ex-lbl.lbl-place { background: var(--c-place-bg); color: var(--c-place-fg); }
.ex-lbl.lbl-neg   { background: var(--c-neg-bg);   color: var(--c-neg-fg); }

.ex-input {
  width: 100%;
  background: transparent;
  border: none;
  border-bottom: 1px solid #cbd5e1;
  padding: 8px 0;
  font-size: 14px;
  font-family: inherit;
  color: #1f2937;
  outline: none;
  transition: border-color 0.15s ease;
}
.ex-input:focus { border-bottom-color: #2c6cf6; }
.ex-input::placeholder { color: #cbd5e1; }

/* ---------- Grading result ---------- */
.ex-result {
  margin-top: 10px;
  padding: 12px 14px;
  background: #f8fafc;
  border-radius: 10px;
  font-size: 13.5px;
  line-height: 1.7;
}
.ex-result-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 999px;
  margin-bottom: 8px;
}
.ex-status-correct { background: #d1fae5; color: #047857; }
.ex-status-wrong { background: #fee2e2; color: #b91c1c; }
.rs-icon { font-size: 14px; line-height: 1; }

.ex-result-line {
  display: flex;
  gap: 8px;
  margin-top: 4px;
  flex-wrap: wrap;
}
.rl-label {
  font-size: 12px;
  color: #6b7280;
  font-weight: 600;
  flex-shrink: 0;
  padding-top: 1px;
}
.rl-text { flex: 1; min-width: 0; word-break: break-word; }

.rt-good { color: #047857; font-weight: 600; }
.rt-bad {
  color: #b91c1c;
  font-weight: 600;
  text-decoration: line-through;
  text-decoration-thickness: 1.5px;
}
.rt-missing {
  color: #b91c1c;
  font-weight: 600;
  text-decoration: underline;
  text-decoration-style: wavy;
  text-decoration-color: #fca5a5;
  text-underline-offset: 3px;
}
.rt-empty { color: #94a3b8; font-style: italic; }

/* ---------- Toast ---------- */
.flash-toast {
  position: fixed;
  top: 80px;
  left: 50%;
  transform: translateX(-50%) translateY(-6px);
  background: #1f2937;
  color: #ffffff;
  padding: 10px 18px;
  border-radius: 999px;
  font-size: 13px;
  z-index: 1000;
  box-shadow: 0 6px 18px rgba(0,0,0,0.18);
  opacity: 0;
  transition: opacity 0.2s ease, transform 0.2s ease;
  max-width: 80vw;
}
.flash-toast.is-shown {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
.flash-ok { background: #047857; }
.flash-warn { background: #b45309; }
.flash-info { background: #1e40af; }

.practice-footer {
  background: #ffffff;
  padding: 14px 24px;
  border-radius: 0 0 16px 16px;
  border-top: 1px solid #f1f5f9;
  display: flex;
  align-items: center;
  gap: 12px;
}
.btn-ghost {
  background: transparent;
  border: 1px solid #e5e7eb;
  color: #4b5563;
  font-size: 13px;
  font-weight: 500;
  padding: 8px 14px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.btn-ghost:hover { background: #f9fafb; color: #111827; }
.btn-ghost.is-active { background: #fef3c7; color: #b45309; border-color: #fde68a; }
.btn-ghost .icon-active { display: none; }
.btn-ghost.is-active .icon-inactive { display: none; }
.btn-ghost.is-active .icon-active { display: inline-block; color: #f59e0b; }
.btn-next { margin-left: auto; }

/* ---------- Responsive ---------- */
@media (max-width: 1180px) {
  .lesson-layout { grid-template-columns: 1fr; }
  .scenario-grid { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  html,
  body {
    overflow-x: hidden;
  }
  .app-header {
    width: 100%;
    max-width: 100vw;
    height: 58px;
    gap: 8px;
    padding: 0 10px;
  }
  .page-nav {
    flex: 0 0 auto;
    margin-right: 0;
  }
  .brand {
    display: none;
  }
  .top-nav {
    min-width: 0;
    flex: 1 1 auto;
    gap: 16px;
    overflow-x: auto;
    overscroll-behavior-inline: contain;
    scrollbar-width: none;
  }
  .top-nav::-webkit-scrollbar {
    display: none;
  }
  .top-link {
    flex: 0 0 auto;
    padding-block: 19px;
    font-size: 14px;
    white-space: nowrap;
  }
  .user-area {
    flex: 0 0 auto;
    gap: 4px;
    margin-left: 0;
  }
  .user-name { display: none; }
  .lesson-layout { padding: 12px; gap: 12px; }
  .tabs-card { padding: 4px 16px 16px; }
  .tab-nav { gap: 16px; margin: 0 -16px 14px; padding: 0 16px; }
  .cmp-row { grid-template-columns: 1fr; }
  .cmp-vs { margin: 0 auto; }
  .tree-branches { grid-template-columns: 1fr; }
  .tree-branches::before { display: none; }
  .branch::before { display: none; }
}
