:root {
  --ink: #17324d;
  --muted: #617386;
  --paper: #f7f4ed;
  --card: #fffdf8;
  --line: #dce4e8;
  --blue: #1b617a;
  --blue-deep: #173f5f;
  --teal: #2f8f83;
  --mint: #dff3ed;
  --amber: #e8a23a;
  --amber-soft: #fff0ce;
  --coral: #d96f55;
  --coral-soft: #ffe8df;
  --green: #25795f;
  --shadow: 0 18px 45px rgba(23, 50, 77, .10);
  font-family: "Segoe UI", "Microsoft YaHei", system-ui, sans-serif;
  color: var(--ink);
  background: var(--paper);
}

* { box-sizing: border-box; }

html { min-width: 320px; scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 8% 10%, rgba(47, 143, 131, .12), transparent 27rem),
    radial-gradient(circle at 92% 0, rgba(232, 162, 58, .13), transparent 24rem),
    var(--paper);
}

button, a { font: inherit; }

button { color: inherit; }

button:focus-visible, a:focus-visible {
  outline: 3px solid #126eaa;
  outline-offset: 3px;
}

[hidden] { display: none !important; }

.skip-link {
  position: fixed;
  top: .75rem;
  left: .75rem;
  z-index: 20;
  padding: .65rem 1rem;
  border-radius: .6rem;
  background: white;
  color: var(--blue-deep);
  transform: translateY(-150%);
}

.skip-link:focus { transform: none; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 72px;
  padding: .75rem clamp(1rem, 4vw, 3rem);
  border-bottom: 1px solid rgba(23, 50, 77, .09);
  background: rgba(247, 244, 237, .92);
  backdrop-filter: blur(14px);
}

.brand-button {
  display: flex;
  align-items: center;
  gap: .7rem;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
  text-align: left;
}

.brand-button strong, .brand-button small { display: block; }
.brand-button strong { font-size: 1.1rem; letter-spacing: .02em; }
.brand-button small { margin-top: .06rem; color: var(--muted); }

.brand-mark {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: 14px 14px 14px 4px;
  background: var(--blue-deep);
  color: white;
  font-weight: 800;
  box-shadow: 0 8px 18px rgba(23, 63, 95, .2);
}

.sync-badge, .mastery-chip {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: .35rem .72rem;
  border-radius: 999px;
  background: var(--mint);
  color: #1d6658;
  font-size: .83rem;
  font-weight: 700;
}

.sync-badge.local { background: var(--amber-soft); color: #8a5a12; }

.topbar-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: .65rem;
}

.signed-in-user {
  max-width: 14rem;
  overflow: hidden;
  color: var(--ink);
  font-size: .9rem;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.compact-button { padding: .4rem .55rem; }

.shell {
  width: min(1040px, calc(100% - 2rem));
  margin: 0 auto;
  padding: clamp(2rem, 7vw, 5.5rem) 0 4rem;
}

.wide-shell { width: min(1240px, calc(100% - 2rem)); }

.login-shell { width: min(1120px, calc(100% - 2rem)); }

.login-card {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(18rem, .65fr);
  overflow: hidden;
  border: 1px solid rgba(23, 63, 95, .08);
  border-radius: 34px 34px 34px 10px;
  background: var(--card);
  box-shadow: var(--shadow);
}

.login-intro {
  position: relative;
  overflow: hidden;
  padding: clamp(2rem, 6vw, 4.5rem);
}

.login-intro::after {
  position: absolute;
  right: -5rem;
  bottom: -7rem;
  width: 19rem;
  height: 19rem;
  border: 3rem solid rgba(47, 143, 131, .1);
  border-radius: 50%;
  content: "";
}

.login-form {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: clamp(1.5rem, 4vw, 3rem);
  border-left: 1px solid var(--line);
  background: #f3f7f5;
}

.login-form label {
  margin: .7rem 0 .35rem;
  color: #385267;
  font-size: .9rem;
  font-weight: 800;
}

.login-form input {
  width: 100%;
  min-height: 48px;
  padding: .7rem .85rem;
  border: 1px solid #b8c8d1;
  border-radius: 12px;
  background: white;
  color: var(--ink);
  font: inherit;
}

.login-form input:focus-visible {
  outline: 3px solid rgba(18, 110, 170, .25);
  outline-offset: 2px;
  border-color: #126eaa;
}

.login-button { width: 100%; margin-top: 1.15rem; }
.login-error { margin: .75rem 0 0; color: #9c3829; font-weight: 700; line-height: 1.5; }
.privacy-copy { margin: 1rem 0 0; color: var(--muted); font-size: .82rem; line-height: 1.55; }

.hero-card {
  position: relative;
  overflow: hidden;
  padding: clamp(2rem, 7vw, 4.8rem);
  border: 1px solid rgba(23, 63, 95, .08);
  border-radius: 34px 34px 34px 10px;
  background: var(--card);
  box-shadow: var(--shadow);
}

.hero-card::after {
  position: absolute;
  right: -4rem;
  bottom: -6rem;
  width: 18rem;
  height: 18rem;
  border: 3rem solid rgba(47, 143, 131, .10);
  border-radius: 50%;
  content: "";
}

.eyebrow {
  margin: 0 0 .7rem;
  color: var(--teal);
  font-size: .78rem;
  font-weight: 800;
  letter-spacing: .13em;
  text-transform: uppercase;
}

h1, h2, h3, p { overflow-wrap: anywhere; }
h1 { margin: 0; font-size: clamp(2rem, 5vw, 4rem); line-height: 1.08; letter-spacing: -.035em; }
h1 span { color: var(--teal); }
h2 { margin: 0 0 1rem; font-size: clamp(1.3rem, 2.5vw, 1.8rem); }
h3 { margin: 0 0 .6rem; }

.lead {
  position: relative;
  z-index: 1;
  max-width: 44rem;
  margin: 1.25rem 0 1.7rem;
  color: #40576b;
  font-size: clamp(1.02rem, 2vw, 1.25rem);
  line-height: 1.8;
}

.promise-row { display: flex; flex-wrap: wrap; gap: .55rem; }
.promise-row span {
  padding: .5rem .8rem;
  border: 1px solid #d5e4e2;
  border-radius: 999px;
  background: #f0f8f5;
  color: #2a665e;
  font-size: .9rem;
  font-weight: 700;
}

.role-grid, .learner-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
  margin-top: 1rem;
}

.role-card, .learner-card {
  display: grid;
  gap: .45rem;
  min-height: 180px;
  padding: 1.5rem;
  border: 1px solid rgba(23, 50, 77, .1);
  border-radius: 24px 24px 24px 8px;
  background: var(--card);
  box-shadow: 0 8px 24px rgba(23, 50, 77, .06);
  cursor: pointer;
  text-align: left;
  transition: transform .18s ease, box-shadow .18s ease;
}

.role-card:hover, .learner-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 16px 32px rgba(23, 50, 77, .1);
}

.role-card strong { font-size: 1.3rem; }
.role-card > span:last-child, .learner-card small { color: var(--muted); line-height: 1.55; }
.role-icon { color: var(--teal); font-size: 2rem; font-weight: 800; }
.teacher-card .role-icon { color: var(--amber); }

.pilot-boundary {
  max-width: 48rem;
  margin: 1.4rem auto 0;
  color: var(--muted);
  font-size: .86rem;
  text-align: center;
}

.section-heading {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 1.25rem;
  margin-bottom: 2rem;
}

.section-heading h1 { font-size: clamp(1.8rem, 4vw, 3rem); }
.text-button {
  padding: .6rem .75rem;
  border: 0;
  border-radius: .7rem;
  background: transparent;
  color: var(--blue);
  cursor: pointer;
  font-weight: 700;
}

.text-button:hover { background: rgba(27, 97, 122, .08); }

.learner-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.learner-card { min-height: 145px; align-content: space-between; }
.learner-avatar {
  display: grid;
  width: 50px;
  height: 50px;
  place-items: center;
  border-radius: 18px 18px 18px 5px;
  background: var(--mint);
  color: var(--green);
  font-size: 1.2rem;
  font-weight: 900;
}

.lesson-layout {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  min-height: calc(100vh - 73px);
}

.lesson-rail {
  position: sticky;
  top: 73px;
  align-self: start;
  height: calc(100vh - 73px);
  overflow: auto;
  padding: 1.5rem;
  border-right: 1px solid var(--line);
  background: rgba(255, 253, 248, .72);
}

.learner-label { margin: 1.2rem 0 .65rem; font-weight: 800; }
.progress-track { height: 9px; overflow: hidden; border-radius: 99px; background: #dbe4e6; }
.progress-track span { display: block; width: 0; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--teal), #67b8a8); transition: width .3s; }
.progress-copy { margin: .55rem 0 1.25rem; color: var(--muted); font-size: .84rem; }

.node-map { display: grid; gap: .35rem; margin: 0; padding: 0; list-style: none; }
.node-map li { display: flex; gap: .65rem; align-items: center; padding: .45rem .55rem; border-radius: .65rem; color: var(--muted); font-size: .83rem; }
.node-map li::before { display: grid; width: 21px; height: 21px; flex: 0 0 auto; place-items: center; border: 1px solid #b8c7ce; border-radius: 50%; content: attr(data-step); font-size: .68rem; }
.node-map li.current { background: var(--amber-soft); color: #785016; font-weight: 700; }
.node-map li.done { color: var(--green); }
.node-map li.done::before { border-color: var(--teal); background: var(--teal); color: white; content: "✓"; }

.lesson-stage { width: min(820px, calc(100% - 2rem)); margin: 0 auto; padding: clamp(1.5rem, 5vw, 4rem) 0 5rem; }
.lesson-topline { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1rem; }
.node-number { color: var(--teal); font-size: .8rem; font-weight: 900; letter-spacing: .12em; text-transform: uppercase; }

.lesson-card {
  padding: clamp(1.3rem, 4vw, 2.4rem);
  border: 1px solid rgba(23, 50, 77, .1);
  border-radius: 28px 28px 28px 9px;
  background: var(--card);
  box-shadow: var(--shadow);
}

.lesson-card h1 { font-size: clamp(1.75rem, 4.5vw, 3rem); }
.lesson-card .intro { margin: 1rem 0; color: #445b70; font-size: 1.04rem; line-height: 1.8; }
.prompt-box { margin: 1.5rem 0 1rem; padding: 1rem 1.1rem; border-left: 5px solid var(--amber); border-radius: .6rem; background: var(--amber-soft); font-size: 1.05rem; font-weight: 750; line-height: 1.65; }

.choice-grid { display: grid; gap: .75rem; margin-top: 1rem; }
.choice-button, .category-button, .tile-button, .distance-button {
  min-height: 52px;
  padding: .8rem 1rem;
  border: 1px solid #cbd8dd;
  border-radius: 14px;
  background: white;
  cursor: pointer;
  text-align: left;
  transition: border-color .15s, background .15s, transform .15s;
}

.choice-button:hover, .category-button:hover, .tile-button:hover, .distance-button:hover { border-color: var(--teal); background: #f3faf7; transform: translateY(-1px); }
.choice-button.selected, .category-button.selected { border-color: var(--blue); background: #e8f3f7; box-shadow: inset 0 0 0 1px var(--blue); }
.choice-button strong { display: block; font-size: 1.05rem; }
.choice-button small { display: block; margin-top: .22rem; color: var(--muted); }
.unknown-button { border-style: dashed; color: var(--muted); }

.action-row { display: flex; flex-wrap: wrap; gap: .7rem; justify-content: flex-end; margin-top: 1.4rem; }
.primary-button, .secondary-button, .primary-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  padding: .7rem 1.1rem;
  border-radius: 12px;
  cursor: pointer;
  font-weight: 800;
  text-decoration: none;
}
.primary-button, .primary-link { border: 1px solid var(--blue-deep); background: var(--blue-deep); color: white; }
.secondary-button { border: 1px solid #c4d2d8; background: white; color: var(--blue-deep); }
.primary-button:disabled { cursor: not-allowed; opacity: .45; }

.feedback-card, .remediation-card, .completion-card {
  margin-top: 1.2rem;
  padding: 1.15rem;
  border-radius: 17px;
  line-height: 1.7;
}
.feedback-card.correct { border: 1px solid #aed8cb; background: var(--mint); color: #185f50; }
.feedback-card.wrong { border: 1px solid #f0c0b0; background: var(--coral-soft); color: #7d3e2e; }
.remediation-card { border: 1px solid #ebcd8e; background: #fff7e7; }
.remediation-card ol { padding-left: 1.4rem; }
.remediation-check { margin-top: 1rem; padding-top: 1rem; border-top: 1px solid #efd9a7; }

.concept-figure {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 1rem;
  min-height: 170px;
  margin: 1.2rem 0;
  padding: 1rem;
  border-radius: 20px;
  background: #eef5f4;
}
.circle-demo { display: grid; place-items: center; margin: auto; border-radius: 50%; font-weight: 900; }
.circle-demo.robot { width: 62px; height: 62px; border: 4px solid var(--blue); background: #dcedf5; color: var(--blue); }
.circle-demo.obstacle { width: 130px; height: 130px; border: 5px solid var(--coral); background: #f9d9cf; color: #8b4533; }
.plus-sign { color: var(--muted); font-size: 2rem; font-weight: 900; }

.classify-list { display: grid; gap: 1rem; margin-top: 1rem; }
.classify-item { padding: 1rem; border: 1px solid var(--line); border-radius: 16px; background: #fbfcfa; }
.classify-item p { margin: 0 0 .75rem; font-weight: 750; }
.category-row { display: flex; flex-wrap: wrap; gap: .55rem; }
.category-button { min-height: 42px; padding: .55rem .8rem; font-size: .9rem; text-align: center; }

.tile-bank, .tile-answer { display: flex; flex-wrap: wrap; gap: .55rem; min-height: 64px; padding: .75rem; border-radius: 14px; }
.tile-bank { margin-top: 1rem; border: 1px dashed #aac1ca; background: #f5f8f7; }
.tile-answer { margin-top: .75rem; border: 2px solid #c8d9de; background: white; }
.tile-answer::before { width: 100%; color: var(--muted); content: "按顺序点选词块，组成完整解释"; font-size: .8rem; }
.tile-button { min-height: 42px; padding: .55rem .75rem; text-align: center; }
.tile-answer .tile-button { border-color: var(--teal); background: var(--mint); }

.distance-lab { margin: 1.2rem 0; padding: 1rem; border-radius: 20px; background: #eef5f4; }
.distance-track { position: relative; height: 180px; overflow: hidden; border-radius: 16px; background: linear-gradient(#fdfcf8 0 62%, #dce7e2 62%); touch-action: none; }
.distance-center-line { position: absolute; top: 22px; bottom: 36px; left: 50%; width: 2px; background: repeating-linear-gradient(to bottom, #8ba1ab 0 6px, transparent 6px 12px); }
.lab-obstacle, .lab-robot { position: absolute; top: 50%; display: grid; place-items: center; border-radius: 50%; transform: translate(-50%, -50%); user-select: none; }
.lab-obstacle { left: 24%; width: 128px; height: 128px; border: 5px solid var(--coral); background: rgba(217, 111, 85, .22); color: #8b4533; font-weight: 900; }
.lab-robot { left: 70%; width: 46px; height: 46px; border: 4px solid var(--blue); background: #d9edf5; color: var(--blue-deep); cursor: grab; font-size: .75rem; font-weight: 900; }
.lab-robot:active { cursor: grabbing; }
.distance-readout { display: flex; align-items: baseline; justify-content: center; gap: .35rem; margin: .8rem 0; font-size: 1.1rem; }
.distance-readout strong { font-size: 1.8rem; color: var(--blue); }
.distance-controls { display: grid; grid-template-columns: repeat(3, 1fr); gap: .55rem; }
.distance-button { text-align: center; }

.challenge-list { display: grid; gap: 1.1rem; }
.challenge-item { padding: 1rem; border: 1px solid var(--line); border-radius: 16px; }
.challenge-item > p { margin: 0 0 .75rem; font-weight: 750; line-height: 1.6; }

.completion-card { padding: clamp(1.5rem, 5vw, 2.5rem); border: 1px solid #b7dacf; background: linear-gradient(145deg, #effaf6, #fffdf8); box-shadow: var(--shadow); }
.completion-badge { display: grid; width: 74px; height: 74px; place-items: center; border-radius: 25px 25px 25px 8px; background: var(--teal); color: white; font-size: 2rem; font-weight: 900; }
.completion-card h1 { margin-top: 1rem; font-size: clamp(2rem, 5vw, 3.5rem); }
.mastery-facts { display: grid; grid-template-columns: repeat(3, 1fr); gap: .75rem; margin: 1.2rem 0; }
.mastery-facts div { padding: 1rem; border-radius: 14px; background: white; }
.mastery-facts strong, .mastery-facts span { display: block; }
.mastery-facts strong { font-size: 1.15rem; }
.mastery-facts span { margin-top: .2rem; color: var(--muted); font-size: .82rem; }

.heading-actions { display: flex; gap: .55rem; }
.summary-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(135px, 1fr)); gap: .8rem; margin-bottom: 1rem; }
.summary-card, .dashboard-panel { padding: 1.2rem; border: 1px solid rgba(23, 50, 77, .1); border-radius: 18px; background: var(--card); box-shadow: 0 8px 24px rgba(23, 50, 77, .05); }
.summary-card strong, .summary-card span { display: block; }
.summary-card strong { font-size: 1.9rem; }
.summary-card span { margin-top: .2rem; color: var(--muted); font-size: .86rem; }
.dashboard-panel { margin-top: 1rem; }
.weak-list { display: flex; flex-wrap: wrap; gap: .65rem; }
.weak-pill { padding: .65rem .85rem; border-radius: 12px; background: var(--amber-soft); color: #765019; }
.weak-pill strong { margin-right: .35rem; }
.test-account-badge { display: inline-block; margin-left: .45rem; padding: .12rem .42rem; border-radius: 99px; background: var(--amber-soft); color: #765019; font-size: .7rem; font-weight: 800; vertical-align: middle; }
.table-panel { padding: 0; overflow: hidden; }
.table-panel h2 { padding: 1.2rem 1.2rem 0; }
.table-scroll { overflow: auto; }
table { width: 100%; min-width: 850px; border-collapse: collapse; }
th, td { padding: .85rem 1rem; border-top: 1px solid var(--line); text-align: left; vertical-align: top; }
th { color: var(--muted); font-size: .78rem; letter-spacing: .03em; }
td { font-size: .9rem; }
.status-dot { display: inline-block; width: 9px; height: 9px; margin-right: .4rem; border-radius: 50%; background: #a9b4ba; }
.status-dot.learning { background: var(--amber); }
.status-dot.instant_mastered { background: var(--teal); }
.status-dot.delayed_mastered { background: var(--green); box-shadow: 0 0 0 3px #d9eee7; }
.attention-yes { color: #a3422c; font-weight: 800; }
.empty-state { padding: 1rem; border-radius: 14px; background: #f0f3f2; color: var(--muted); }

@media (max-width: 900px) {
  .login-card { grid-template-columns: 1fr; }
  .login-form { border-top: 1px solid var(--line); border-left: 0; }
  .learner-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .lesson-layout { grid-template-columns: 1fr; }
  .lesson-rail { position: static; height: auto; padding: 1rem; border-right: 0; border-bottom: 1px solid var(--line); }
  .node-map { grid-template-columns: repeat(6, 1fr); }
  .node-map li { justify-content: center; padding: .3rem; }
  .node-map li span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .summary-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 620px) {
  .topbar { min-height: 64px; padding: .65rem 1rem; }
  .topbar-actions { gap: .35rem; }
  .signed-in-user { max-width: 6.5rem; }
  .compact-button { display: none; }
  .brand-mark { width: 38px; height: 38px; }
  .brand-button small { display: none; }
  .sync-badge { max-width: 9rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .shell, .wide-shell { width: min(100% - 1rem, 1040px); padding-top: 1rem; }
  .login-intro, .login-form { padding: 1.4rem; }
  .hero-card { padding: 1.5rem; border-radius: 24px 24px 24px 8px; }
  .role-grid { grid-template-columns: 1fr; }
  .role-card { min-height: 140px; }
  .section-heading { grid-template-columns: 1fr auto; gap: .65rem; }
  .section-heading > .text-button { grid-column: 1 / -1; justify-self: start; }
  .heading-actions { align-self: end; }
  .learner-grid { gap: .6rem; }
  .learner-card { min-height: 130px; padding: 1rem; }
  .lesson-rail { top: 64px; }
  .lesson-stage { width: calc(100% - 1rem); padding-top: 1rem; }
  .lesson-card { padding: 1.1rem; border-radius: 20px 20px 20px 7px; }
  .node-map { grid-template-columns: repeat(4, 1fr); }
  .concept-figure { grid-template-columns: 1fr; }
  .plus-sign { transform: rotate(90deg); }
  .distance-track { height: 155px; }
  .lab-obstacle { width: 106px; height: 106px; }
  .distance-controls { grid-template-columns: 1fr; }
  .mastery-facts { grid-template-columns: 1fr; }
  .summary-grid { grid-template-columns: 1fr 1fr; }
  .summary-card { padding: .9rem; }
  .summary-card strong { font-size: 1.5rem; }
  .action-row { justify-content: stretch; }
  .action-row > * { flex: 1 1 auto; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}
