:root {
  color-scheme: light;
  --bg: #f4f5ff;
  --panel: #ffffff;
  --text: #1b1c3b;
  --muted: #6d718f;
  --line: #e2e4f3;
  --primary: #5b5bd6;
  --primary-strong: #39399d;
  --accent: #ff7d5c;
  --danger: #d84b65;
  --ok-bg: #edecff;
  --bad-bg: #fff0f3;
  --shadow: 0 18px 48px rgba(52, 53, 130, 0.13);
  --node: #635bdb;
  --node-done: #ffb65d;
  --node-locked: #d7d9e8;
}

* {
  box-sizing: border-box;
}

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

/* Visual refresh: indigo, lilac and coral replace the original green palette. */
.login-shell {
  background: var(--bg);
}

.login-panel,
.study-card,
.encourage-card,
.memory-item,
.mistake-item,
.user-item,
.exam-question,
.exam-result {
  border-radius: 18px;
  box-shadow: var(--shadow);
}

.login-panel {
  padding: 38px;
  border-color: rgba(255, 255, 255, 0.55);
}

.brand-mark {
  border-radius: 14px;
  background: linear-gradient(145deg, #6d68ed, #423fae);
  box-shadow: 0 8px 18px rgba(74, 69, 186, 0.28);
}

.field input,
.memory-search input,
.user-create-form input,
.user-item-fields input,
.answer-input {
  border-radius: 12px;
  border-color: #d9dcef;
  background: #fafaff;
}

.field input:focus,
.memory-search input:focus,
.user-create-form input:focus,
.user-item-fields input:focus,
.answer-input:focus {
  outline: 3px solid rgba(100, 91, 219, 0.16);
  border-color: #7671e6;
}

.primary-btn {
  border-radius: 12px;
  background: linear-gradient(135deg, #605be2, #7a61df);
  box-shadow: 0 7px 14px rgba(91, 91, 214, 0.24);
}

.primary-btn:hover {
  background: linear-gradient(135deg, #514dca, #6c50d2);
}

.secondary-btn {
  border-radius: 12px;
  background: #eeedff;
  color: var(--primary-strong);
}

.ghost-btn {
  border-radius: 10px;
}

.ghost-btn:hover {
  background: #f0f0fb;
  color: var(--primary-strong);
}

.topbar {
  height: 72px;
  background: rgba(255, 255, 255, 0.82);
  border-bottom-color: rgba(103, 98, 210, 0.12);
  box-shadow: 0 4px 24px rgba(53, 51, 126, 0.05);
  backdrop-filter: blur(16px);
}

.topbar.catalog-topbar,
.topbar.basic-topbar {
  background: rgba(255, 255, 255, 0.82);
  border-bottom-color: rgba(103, 98, 210, 0.12);
}

.topbar.basic-topbar .brand-mark {
  background: linear-gradient(145deg, #ff9178, #e85d7d);
}

.catalog-page,
.memorization-page,
.user-management-page {
  width: min(1180px, 100%);
}

.catalog-hero {
  min-height: 258px;
  padding: 30px 38px;
  border: 0;
  border-radius: 26px;
  background:
    radial-gradient(circle at 72% 20%, rgba(255, 255, 255, 0.3), transparent 22%),
    linear-gradient(135deg, #29295f 0%, #5c58d2 54%, #8d70e8 100%);
  box-shadow: 0 20px 42px rgba(54, 48, 144, 0.22);
  overflow: hidden;
}

.catalog-hero h1,
.catalog-hero .muted,
.catalog-hero .catalog-kicker {
  color: #fff;
}

.catalog-hero .catalog-kicker {
  color: #ffd4a9;
  letter-spacing: 0.08em;
}

.catalog-hero-copy {
  min-width: 0;
}

.catalog-hero h1 {
  font-size: clamp(34px, 4vw, 52px);
  letter-spacing: -0.04em;
}

.catalog-mentor {
  filter: drop-shadow(0 16px 12px rgba(20, 18, 83, 0.24));
}

.study-chart {
  width: 100%;
  margin: 22px 0 0;
  padding: 16px 20px 12px;
  border: 1px solid #e2e1f6;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.86);
  box-shadow: 0 14px 30px rgba(61, 56, 144, 0.08);
}

.study-chart-bars {
  height: 86px;
  gap: 3px;
}

.study-chart-bar {
  background: linear-gradient(to top, #5a58d7, #a47af3);
  opacity: 0.9;
}

.catalog-group {
  margin-top: 36px;
}

.catalog-group h2 {
  color: var(--text);
  font-size: 22px;
  letter-spacing: -0.03em;
}

.catalog-option {
  min-height: 224px;
  border: 1px solid transparent;
  border-bottom-width: 1px;
  border-radius: 20px;
  box-shadow: 0 12px 24px rgba(52, 52, 122, 0.08);
  overflow: hidden;
}

.catalog-option::after {
  content: "";
  position: absolute;
  right: -40px;
  bottom: -56px;
  width: 150px;
  height: 150px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.08;
}

.catalog-option:hover {
  transform: translateY(-6px);
  box-shadow: 0 22px 34px rgba(52, 52, 122, 0.15);
}

.catalog-option strong {
  color: var(--text);
}

.catalog-duration {
  color: #66628d;
}

.catalog-basic { background: linear-gradient(145deg, #fff3fb, #f3edff); border-color: #e8d5f7; color: #b35ec7; }
.catalog-advanced { background: linear-gradient(145deg, #edf1ff, #e9e9ff); border-color: #d4d8fb; color: #5d5bce; }
.catalog-memory { background: linear-gradient(145deg, #fff7e7, #ffefde); border-color: #f6d9b6; color: #dd7c45; }
.catalog-exam { background: linear-gradient(145deg, #e9f8fa, #e9efff); border-color: #cde0f2; color: #367bb6; }

.memory-heading,
.exam-runner-head {
  border-bottom-color: #dedff0;
}

.memory-tab {
  border-radius: 999px;
  background: #fff;
}

.memory-tab.active {
  border-color: #716ce0;
  background: #ecebff;
  color: #4541ad;
}

.memory-item {
  border-left: 0;
  background: rgba(255, 255, 255, 0.92);
}

.memory-item::before {
  content: "";
  display: block;
  width: 44px;
  height: 4px;
  margin-bottom: 14px;
  border-radius: 99px;
  background: linear-gradient(90deg, #ff8a67, #8b74e8);
}

.memory-item h2,
.stage-copy strong,
.map-hero h1 {
  color: var(--text);
}

.user-item,
.mistake-item {
  border-color: #e2e3f0;
  background: rgba(255, 255, 255, 0.9);
}

.mistake-hero { align-items: center; }
.mistake-subject-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; margin-top: 24px; }
.mistake-subject-card { min-height: 210px; display: grid; align-content: space-between; gap: 10px; padding: 24px; border: 1px solid #deddf3; border-radius: 20px; background: linear-gradient(145deg, #fff, #f1efff); color: var(--text); text-align: left; box-shadow: 0 12px 28px rgba(56, 53, 134, .1); transition: transform 160ms ease, box-shadow 160ms ease; }
.mistake-subject-card:nth-child(2) { background: linear-gradient(145deg, #fff, #fff1e9); border-color: #f2d9cc; }
.mistake-subject-card:hover { transform: translateY(-5px); box-shadow: 0 20px 34px rgba(56, 53, 134, .16); }
.mistake-subject-kicker { color: var(--primary-strong); font-size: 13px; font-weight: 900; }
.mistake-subject-card strong { font-size: 38px; letter-spacing: -.04em; }
.mistake-subject-card small { color: var(--muted); font-size: 14px; }
.mistake-subject-cta { color: #5b55c7; font-weight: 900; }
.mistake-analysis { min-height: 82px; margin-top: 18px; padding: 14px 16px; border-radius: 14px; background: #f3f2ff; color: #4f4b82; }
.mistake-analysis p { margin: 5px 0 0; line-height: 1.6; }
.analysis-correct { color: #2d8b70; }.analysis-wrong { color: #cb4b64; }
.mistake-exam-actions { gap: 8px; }
.danger-action { color: #c34b65; }

.map-page,
.mistake-page {
  width: min(980px, 100%);
}

.map-hero {
  padding: 24px 28px;
  border: 1px solid #e0def6;
  border-radius: 20px;
  background: linear-gradient(125deg, #fff, #f2f0ff);
  box-shadow: 0 12px 28px rgba(56, 53, 134, 0.08);
}

.map-node {
  box-shadow: inset 0 -5px 0 rgba(30, 28, 100, 0.18), 0 12px 24px rgba(72, 67, 178, 0.22);
}

.map-node.step-0 { --node: #675fdb; }
.map-node.step-1 { --node: #4d92d9; }
.map-node.step-2 { --node: #f29a62; }
.map-node.step-3 { --node: #9d6cda; }
.map-node.step-4 { --node: #dc678a; }
.map-node.step-5 { --node: #43a8ad; }

.map-node.active {
  outline-color: rgba(98, 91, 219, 0.2);
}

.map-node-time {
  border-color: #d9d7f3;
  color: #514dbd;
  box-shadow: 0 4px 10px rgba(64, 59, 161, 0.14);
}

.study-shell {
  background: var(--bg);
}

.study-card {
  border: 1px solid #e0e1f1;
  background: rgba(255, 255, 255, 0.94);
}

.study-progress-track,
.level-track,
.progress-track {
  background: #e5e5f4;
}

.study-progress-fill,
.progress-fill {
  background: linear-gradient(90deg, #5a57d6, #a774e9);
}

.speech {
  border-color: #deddf1;
  border-radius: 16px;
  background: #fafaff;
}

.speech::before {
  border-left-color: #deddf1;
  border-bottom-color: #deddf1;
  background: #fafaff;
}

.exercise-type,
.mentor-name {
  color: #615bd1;
}

.option,
.exam-options button {
  border-color: #e0e1ef;
  border-radius: 14px;
  background: #fbfbff;
  transition: transform 150ms ease, border-color 150ms ease, background 150ms ease;
}

.option:hover,
.exam-options button:hover {
  transform: translateX(3px);
  border-color: #aaa7ec;
}

.option.selected,
.exam-options button.selected {
  border-color: #716ce0;
  background: #eeedff;
  color: #3f3c9e;
}

.feedback,
.order-list {
  border-radius: 14px;
}

.feedback.show.ok {
  background: #eeedff;
  border-color: #c9c5fa;
  color: #403da1;
}

.feedback.show.bad {
  background: #fff1f3;
  border-color: #ffc7d0;
}

.actions {
  border-color: #e1e1f1;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(14px);
}

.exam-runner {
  background: transparent;
}

.exam-question,
.exam-result {
  padding: 30px;
  background: rgba(255, 255, 255, 0.9);
}

button,
input {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.login-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 28px;
}

.login-panel {
  width: min(420px, 100%);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 30px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 24px;
}

.brand-mark {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: var(--primary);
  color: #fff;
  font-weight: 800;
}

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

.muted {
  color: var(--muted);
}

.field {
  display: grid;
  gap: 8px;
  margin-bottom: 16px;
}

.field label {
  font-size: 14px;
  font-weight: 700;
}

.field input {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 12px;
  background: #fbfcfa;
}

.primary-btn,
.secondary-btn,
.ghost-btn {
  min-height: 42px;
  border-radius: 6px;
  padding: 0 16px;
  font-weight: 800;
}

.primary-btn {
  background: var(--primary);
  color: #fff;
}

.primary-btn:hover {
  background: var(--primary-strong);
}

.secondary-btn {
  background: #edf4ef;
  color: var(--primary-strong);
}

.ghost-btn {
  background: transparent;
  color: var(--muted);
}

.error {
  min-height: 20px;
  color: var(--danger);
  font-size: 14px;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-rows: auto 1fr;
}

.topbar {
  height: 64px;
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(180px, 280px) minmax(260px, 1fr);
  align-items: center;
  gap: 18px;
  padding: 0 28px;
  background: rgba(255, 255, 255, 0.9);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 2;
}

.topbar.basic-topbar {
  background: rgba(255, 238, 246, 0.94);
  border-bottom-color: #f3bfd5;
}

.topbar.basic-topbar .brand-mark {
  background: #d94f8c;
}

.topbar.basic-topbar .mode-switch-btn {
  background: #fff;
  color: #b33673;
}

.topbar.advanced-topbar .mode-switch-btn {
  background: #edf4ef;
  color: var(--primary-strong);
}

.topbar.catalog-topbar {
  background: rgba(255, 255, 255, 0.94);
}

.topbar .brand {
  margin: 0;
}

.brand-directory {
  min-height: 36px;
  margin-left: -4px;
  padding: 0 10px;
}

.top-actions {
  display: flex;
  justify-content: flex-end;
  gap: 4px;
}

.top-level {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 10px;
}

.top-weekly-score {
  padding: 5px 8px;
  border-radius: 8px;
  background: #f0efff;
  color: #514dbd;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.top-weekly-score b {
  color: #e86655;
  font-size: 15px;
}

.catalog-page,
.memorization-page,
.user-management-page {
  width: min(1040px, 100%);
  margin: 0 auto;
  padding: 42px 28px 68px;
}

.catalog-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 36px;
  min-height: 220px;
  padding: 6px 22px 24px;
  border-bottom: 1px solid var(--line);
}

.study-chart {
  width: min(620px, 100%);
  margin-top: 20px;
  padding: 12px 14px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.7);
}

.study-chart-head,
.study-chart-axis {
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: var(--muted);
  font-size: 12px;
}

.study-chart-head strong {
  color: var(--text);
  font-size: 13px;
}

.study-chart-bars {
  height: 86px;
  display: flex;
  align-items: end;
  gap: 2px;
  margin-top: 8px;
}

.study-chart-bar {
  flex: 1 1 0;
  min-width: 1px;
  border-radius: 2px 2px 0 0;
  background: var(--primary);
  opacity: 0.82;
}

.study-chart-axis {
  margin-top: 4px;
}

.catalog-kicker {
  margin: 0 0 10px;
  color: var(--primary-strong);
  font-size: 13px;
  font-weight: 900;
}

.catalog-hero h1,
.memory-heading h1 {
  margin: 0 0 10px;
  font-size: 36px;
}

.catalog-mentor {
  flex: 0 0 220px;
}

.mentor-svg-catalog {
  width: 220px;
  height: 220px;
}

.catalog-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  padding-top: 28px;
}

.catalog-group + .catalog-group {
  margin-top: 34px;
}

.catalog-group h2 {
  margin: 0;
  color: #294236;
  font-size: 18px;
}

.catalog-group .catalog-grid {
  padding-top: 14px;
}

.catalog-option {
  position: relative;
  min-height: 210px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: flex-end;
  gap: 7px;
  padding: 24px;
  border: 1px solid var(--line);
  border-bottom-width: 5px;
  border-radius: 8px;
  text-align: left;
  transition: transform 160ms ease, box-shadow 160ms ease;
}

.catalog-duration {
  position: absolute;
  top: 12px;
  right: 14px;
  display: grid;
  gap: 2px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.25;
  text-align: right;
}

.catalog-option:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow);
}

.catalog-option:active {
  transform: translateY(1px);
}

.catalog-option strong {
  color: #183329;
  font-size: 26px;
}

.catalog-option small {
  color: #52665d;
  font-size: 15px;
}

.catalog-icon {
  margin-bottom: auto;
  color: currentColor;
  font-size: 42px;
  font-weight: 900;
  line-height: 1;
}

.catalog-basic {
  background: #fff0f6;
  border-color: #f0b7d0;
  color: #c23e78;
}

.catalog-advanced {
  background: #eaf7f1;
  border-color: #a8d8c0;
  color: #167550;
}

.catalog-memory {
  background: #fff6dc;
  border-color: #ebcf81;
  color: #a46a00;
}

.catalog-exam {
  background: #edf2ff;
  border-color: #b8c8ef;
  color: #3d63ae;
}

.memory-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  padding-bottom: 22px;
  border-bottom: 1px solid var(--line);
}

.memory-search {
  display: grid;
  gap: 6px;
  min-width: min(320px, 100%);
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.memory-search input {
  height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
  color: var(--ink);
  font: inherit;
}

.memory-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 18px 0;
}

.memory-tab {
  min-height: 36px;
  padding: 0 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--muted);
  font-size: 14px;
  font-weight: 800;
}

.memory-tab.active {
  border-color: #19966a;
  background: #eaf7f1;
  color: #126646;
}

.memory-list {
  display: grid;
  gap: 12px;
}

.memory-item {
  padding: 20px 22px;
  border: 1px solid var(--line);
  border-left: 5px solid #f2a13a;
  border-radius: 8px;
  background: #fff;
}

.memory-item-meta {
  margin-bottom: 7px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.memory-item h2 {
  margin: 0;
  color: #1d342a;
  font-size: 19px;
  line-height: 1.45;
}

.memory-item ol {
  margin: 12px 0 0;
  padding-left: 23px;
  color: #3e5349;
  line-height: 1.8;
}

.memory-mnemonic {
  margin: 13px 0 0;
  color: #8a5a00;
  font-weight: 900;
}

.memory-atomic {
  border-left-color: #4594d9;
}

.memory-atomic-note {
  margin: 12px 0 0;
  color: #456074;
  font-weight: 800;
}

.memory-empty {
  padding: 28px 0;
  color: var(--muted);
  text-align: center;
}

.exam-runner {
  width: min(820px, 100%);
  min-height: 100vh;
  margin: 0 auto;
  padding: 28px;
}

.exam-runner-head {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 16px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
}

.exam-runner-head strong {
  text-align: center;
}

.exam-question,
.exam-result {
  margin-top: 28px;
}

.exam-question h1,
.exam-result h1 {
  margin: 10px 0 24px;
  font-size: 25px;
  line-height: 1.5;
}

.exam-options {
  display: grid;
  gap: 10px;
  margin-bottom: 22px;
}

.exam-options button {
  min-height: 54px;
  padding: 12px 15px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  text-align: left;
  font: inherit;
  font-weight: 700;
}

.exam-options button.selected {
  border-color: #2877c8;
  background: #edf5ff;
  color: #215c9c;
}

.user-create-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto;
  gap: 10px;
  align-items: start;
  padding: 20px 0;
}

.user-create-form input,
.user-item-fields input {
  min-width: 0;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 11px;
  color: var(--ink);
  font: inherit;
}

.user-create-form .error {
  grid-column: 1 / -1;
  margin: 0;
}

.user-list {
  display: grid;
  gap: 10px;
}

.user-item {
  display: grid;
  grid-template-columns: minmax(140px, 0.75fr) minmax(260px, 1.5fr) auto;
  align-items: center;
  gap: 16px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.user-item-title {
  display: grid;
  gap: 4px;
}

.user-item-title span {
  color: var(--muted);
  font-size: 12px;
}

.user-item-stats {
  color: var(--primary-strong);
  font-size: 12px;
}

.user-item-readonly {
  grid-template-columns: minmax(140px, 0.75fr) minmax(260px, 1.5fr) auto;
}

.user-readonly-note {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.user-item-fields,
.user-item-actions {
  display: flex;
  gap: 8px;
}

.user-item-fields {
  min-width: 0;
}

.user-item-fields input {
  width: 50%;
}

.user-delete-btn {
  color: #b54040;
}

.study-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.progress-track {
  width: 100%;
  height: 10px;
  background: #e8ede7;
  border-radius: 999px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  width: 0%;
  background: var(--primary);
}

.map-page {
  width: min(760px, 100%);
  margin: 0 auto;
  padding: 28px 18px 64px;
}

.map-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
}

.map-hero h1 {
  font-size: 30px;
  margin-bottom: 6px;
}

.map-path {
  position: relative;
  display: grid;
  grid-template-columns: minmax(320px, 860px);
  justify-content: center;
  gap: 28px;
  padding: 24px 0 80px;
}

.map-stage {
  position: relative;
  min-height: 540px;
  display: grid;
  grid-template-columns: minmax(300px, 1fr) 280px;
  align-items: center;
  column-gap: 42px;
  padding: 18px 16px;
}

.map-stage.mentor-left {
  grid-template-columns: 280px minmax(300px, 1fr);
}

.map-stage.mentor-left .stage-mentor-wrap {
  grid-column: 1;
  grid-row: 1 / span 2;
}

.map-stage.mentor-left .stage-path,
.map-stage.mentor-left .stage-copy {
  grid-column: 2;
}

.map-stage.mentor-right .stage-path,
.map-stage.mentor-right .stage-copy {
  grid-column: 1;
}

.map-stage.mentor-right .stage-mentor-wrap {
  grid-column: 2;
  grid-row: 1 / span 2;
}

.stage-copy {
  align-self: end;
  display: grid;
  gap: 8px;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
}

.stage-copy strong {
  max-width: 280px;
  color: #17322b;
  font-size: 20px;
  line-height: 1.25;
}

.stage-path {
  position: relative;
  min-height: 548px;
  grid-row: 2;
}

.stage-path .map-node {
  position: absolute;
}

.stage-path .snake-0 { left: 44%; top: 0; }
.stage-path .snake-1 { left: 18%; top: 48px; }
.stage-path .snake-2 { left: 4%; top: 112px; }
.stage-path .snake-3 { left: 26%; top: 176px; }
.stage-path .snake-4 { left: 56%; top: 222px; }
.stage-path .snake-5 { left: 76%; top: 288px; }
.stage-path .snake-6 { left: 52%; top: 344px; }
.stage-path .snake-7 { left: 24%; top: 382px; }
.stage-path .snake-8 { left: 6%; top: 436px; }
.stage-path .snake-9 { left: 38%; top: 474px; }

.map-stage.mentor-left .stage-path .snake-0 { left: 34%; }
.map-stage.mentor-left .stage-path .snake-1 { left: 60%; }
.map-stage.mentor-left .stage-path .snake-2 { left: 78%; }
.map-stage.mentor-left .stage-path .snake-3 { left: 56%; }
.map-stage.mentor-left .stage-path .snake-4 { left: 26%; }
.map-stage.mentor-left .stage-path .snake-5 { left: 6%; }
.map-stage.mentor-left .stage-path .snake-6 { left: 30%; }
.map-stage.mentor-left .stage-path .snake-7 { left: 58%; }
.map-stage.mentor-left .stage-path .snake-8 { left: 76%; }
.map-stage.mentor-left .stage-path .snake-9 { left: 44%; }

.map-node {
  position: relative;
  z-index: 1;
  width: 64px;
  height: 64px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--node);
  color: #fff;
  font-size: 24px;
  font-weight: 900;
  box-shadow: inset 0 -5px 0 rgba(0, 0, 0, 0.15), 0 10px 22px rgba(23, 124, 98, 0.22);
  justify-self: center;
  transform-origin: center bottom;
  transition: transform 160ms ease, box-shadow 160ms ease, filter 160ms ease;
}

.map-node.open,
.map-node.done {
  animation: node-float 3.6s ease-in-out infinite;
}

.map-node.done {
  animation-name: node-float, node-glow;
  animation-duration: 3.6s, 2.8s;
  animation-timing-function: ease-in-out, ease-in-out;
  animation-iteration-count: infinite, infinite;
}

.map-node.active {
  animation: node-active 1.35s ease-in-out infinite;
}

.map-node.locked {
  animation: none;
}

.map-node:hover:not(.locked) {
  transform: translateY(-6px) scale(1.06);
  filter: saturate(1.08);
  box-shadow: inset 0 -5px 0 rgba(0, 0, 0, 0.16), 0 16px 28px rgba(23, 124, 98, 0.25);
}

.map-node:active:not(.locked) {
  transform: translateY(2px) scale(0.96);
}

.map-node.snake-0 { animation-delay: 0s, 0s; }
.map-node.snake-1 { animation-delay: 0.13s, 0.13s; }
.map-node.snake-2 { animation-delay: 0.26s, 0.26s; }
.map-node.snake-3 { animation-delay: 0.39s, 0.39s; }
.map-node.snake-4 { animation-delay: 0.52s, 0.52s; }
.map-node.snake-5 { animation-delay: 0.65s, 0.65s; }
.map-node.snake-6 { animation-delay: 0.78s, 0.78s; }
.map-node.snake-7 { animation-delay: 0.91s, 0.91s; }
.map-node.snake-8 { animation-delay: 1.04s, 1.04s; }
.map-node.snake-9 { animation-delay: 1.17s, 1.17s; }

.map-node::before {
  content: "";
  position: absolute;
  inset: 11px;
  border-radius: 50%;
  background:
    radial-gradient(circle at 30% 35%, rgba(255, 255, 255, 0.5) 0 6px, transparent 7px),
    radial-gradient(circle at 68% 70%, rgba(255, 255, 255, 0.24) 0 5px, transparent 6px);
  pointer-events: none;
  animation: node-shine 4.4s ease-in-out infinite;
}

.map-node.continue-node::after {
  content: "";
  position: absolute;
  inset: -13px;
  z-index: 0;
  border: 3px solid color-mix(in srgb, var(--node) 72%, #fff);
  border-radius: 50%;
  box-shadow: 0 0 0 7px color-mix(in srgb, var(--node) 18%, transparent), 0 0 24px color-mix(in srgb, var(--node) 52%, transparent);
  pointer-events: none;
  animation: continue-node-ring 1.45s ease-out infinite;
}

.map-node span {
  position: relative;
  z-index: 1;
}

.map-node-time {
  position: absolute;
  top: -10px;
  right: -12px;
  z-index: 2;
  padding: 2px 5px;
  border: 1px solid rgba(23, 124, 98, 0.25);
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.96);
  color: var(--primary-strong);
  font-size: 10px;
  font-weight: 700;
  line-height: 1;
  white-space: nowrap;
  box-shadow: 0 2px 6px rgba(23, 124, 98, 0.14);
}

.map-node.step-0 {
  --node: #19a873;
}

.map-node.step-1 {
  --node: #4594d9;
}

.map-node.step-2 {
  --node: #f2a13a;
}

.map-node.step-3 {
  --node: #8b6bd9;
}

.map-node.step-4 {
  --node: #d95f76;
}

.map-node.step-5 {
  --node: #2aa6a1;
}

.map-node.done {
  background: var(--node);
}

.map-node.fast-done {
  --node: #e4a51e;
  background: #e4a51e;
  box-shadow: 0 7px 0 #a8760e, 0 12px 22px rgba(196, 139, 15, 0.24);
}

.map-node.review {
  --node: #4594d9;
}

.map-node.test {
  --node: #8b6bd9;
}

.map-node.active {
  outline: 5px solid rgba(25, 168, 115, 0.18);
}

.map-node.locked {
  background: #d5ddd4;
  background: color-mix(in srgb, var(--node) 22%, var(--node-locked));
  color: #879287;
  box-shadow: inset 0 -5px 0 rgba(0, 0, 0, 0.08);
}

.stage-mentor-wrap {
  justify-self: center;
  align-self: center;
  position: sticky;
  top: 110px;
}

.mentor-svg {
  display: block;
  overflow: visible;
}

.mentor-svg-stage {
  width: 260px;
  height: 260px;
}

.mentor-svg-study {
  width: 100px;
  height: 100px;
}

.mentor-svg-encourage {
  width: 240px;
  height: 240px;
  margin: 0 auto 20px;
}

.mentor-svg-mini {
  width: 34px;
  height: 34px;
}

.mentor-bob {
  transform-origin: 64px 104px;
  animation: mentor-bob 2.6s ease-in-out infinite;
}

.mentor-pupil {
  transform-origin: center;
  animation: mentor-blink 4.2s ease-in-out infinite;
}

.mentor-arm-right {
  transform-origin: 92px 84px;
  animation: mentor-wave-right 3.1s ease-in-out infinite;
}

.mentor-spark {
  opacity: 0;
  transform-origin: center;
}

.mentor-action-cheer .mentor-arm-right,
.mentor-action-celebrate .mentor-arm-right {
  animation: mentor-wave-right 0.9s ease-in-out infinite;
}

.mentor-action-cheer .mentor-bob {
  animation: mentor-bob 1.25s ease-in-out infinite;
}

.mentor-action-celebrate .mentor-bob {
  animation: mentor-celebrate 0.7s ease-in-out infinite;
}

.mentor-svg-catalog.mentor-action-celebrate .mentor-bob {
  animation-duration: 1.4s;
}

.mentor-action-celebrate .mentor-spark {
  animation: mentor-spark 1.1s ease-in-out infinite;
}

.mentor-action-celebrate .spark-two {
  animation-delay: 0.25s;
}

.mentor-smile {
  animation: mentor-smile 3.2s ease-in-out infinite;
}

@keyframes mentor-bob {
  0%, 100% {
    transform: translateY(0) rotate(-1deg);
  }
  50% {
    transform: translateY(-5px) rotate(1deg);
  }
}

@keyframes mentor-blink {
  0%, 88%, 100% {
    transform: scaleY(1);
  }
  92%, 96% {
    transform: scaleY(0.12);
  }
}

@keyframes mentor-wave-right {
  0%, 100% {
    transform: rotate(0deg);
  }
  50% {
    transform: rotate(-16deg) translateY(-3px);
  }
}

@keyframes mentor-celebrate {
  0%, 100% {
    transform: translateY(0) rotate(-1deg) scale(1);
  }
  50% {
    transform: translateY(-10px) rotate(2deg) scale(1.04);
  }
}

@keyframes mentor-spark {
  0%, 100% {
    opacity: 0;
    transform: scale(0.5);
  }
  45%, 70% {
    opacity: 1;
    transform: scale(1.25);
  }
}

@keyframes mentor-smile {
  0%, 100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(1px);
  }
}

@keyframes node-float {
  0%, 100% {
    transform: translateY(0) scale(1);
  }
  50% {
    transform: translateY(-4px) scale(1.025);
  }
}

@keyframes node-active {
  0%, 100% {
    transform: translateY(0) scale(1);
    box-shadow: inset 0 -5px 0 rgba(0, 0, 0, 0.15), 0 10px 22px rgba(23, 124, 98, 0.22);
  }
  45% {
    transform: translateY(-8px) scale(1.08);
    box-shadow: inset 0 -5px 0 rgba(0, 0, 0, 0.14), 0 18px 34px rgba(25, 168, 115, 0.28);
  }
}

@keyframes node-glow {
  0%, 100% {
    filter: saturate(1);
  }
  50% {
    filter: saturate(1.18) brightness(1.03);
  }
}

@keyframes node-shine {
  0%, 70%, 100% {
    opacity: 0.9;
  }
  82% {
    opacity: 1;
  }
}

@keyframes continue-node-ring {
  0% {
    opacity: 0.9;
    transform: scale(0.82);
  }
  70% {
    opacity: 0.18;
    transform: scale(1.2);
  }
  100% {
    opacity: 0;
    transform: scale(1.28);
  }
}

@media (prefers-reduced-motion: reduce) {
  .mentor-bob,
  .mentor-pupil,
  .mentor-arm-right,
  .mentor-smile,
  .mentor-spark,
  .map-node,
  .map-node::before,
  .map-node::after {
    animation: none !important;
  }

  .map-node,
  .map-node:hover:not(.locked),
  .map-node:active:not(.locked) {
    transform: none;
  }
}

.level-widget {
  min-width: 128px;
  display: grid;
  gap: 7px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.78);
}

.level-widget.wide {
  width: min(320px, 100%);
  margin: 16px auto 22px;
}

.level-track {
  height: 10px;
  border-radius: 999px;
  overflow: hidden;
  background: #dde7db;
}

.level-track div {
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
}

.stats-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 16px 0 0;
}

.mistake-page {
  width: min(760px, 100%);
  margin: 0 auto;
  padding: 28px 18px 64px;
}

.mistake-list {
  display: grid;
  gap: 12px;
}

.mistake-item {
  display: grid;
  gap: 10px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  background: #edf1ea;
  color: var(--muted);
  font-size: 13px;
}

.study-card {
  width: min(760px, calc(100% - 28px));
  padding: 28px 28px 104px;
  margin: 0 auto;
  box-shadow: var(--shadow);
}

.study-shell {
  min-height: 100vh;
  display: grid;
  grid-template-rows: auto 1fr;
  align-items: start;
  padding: 18px 0 42px;
}

.study-top {
  width: min(820px, calc(100% - 28px));
  height: 46px;
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 14px;
  align-items: center;
  margin: 0 auto 18px;
}

.lesson-timer {
  min-width: 54px;
  color: #171717;
  font-size: 14px;
  font-variant-numeric: tabular-nums;
  font-weight: 900;
  text-align: right;
}

.lesson-timer.expired {
  color: #c73737;
}

.study-progress-track {
  height: 14px;
  border-radius: 999px;
  background: #dde7db;
  overflow: hidden;
}

.study-progress-fill {
  height: 100%;
  width: 0%;
  border-radius: inherit;
  background: var(--primary);
}

.study-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}

.exercise-type {
  color: var(--primary);
  font-weight: 800;
  font-size: 14px;
}

.prompt {
  font-size: 21px;
  line-height: 1.45;
  margin-bottom: 0;
}

.mentor-row {
  display: grid;
  grid-template-columns: 92px 1fr;
  gap: 16px;
  align-items: center;
  margin-bottom: 22px;
}

.speech {
  position: relative;
  padding: 16px 18px;
  border: 2px solid var(--line);
  border-radius: 12px;
  background: #fff;
}

.speech::before {
  content: "";
  position: absolute;
  left: -10px;
  top: 32px;
  width: 16px;
  height: 16px;
  border-left: 2px solid var(--line);
  border-bottom: 2px solid var(--line);
  background: #fff;
  transform: rotate(45deg);
}

.mentor-name {
  margin-bottom: 6px;
  color: var(--primary);
  font-size: 13px;
  font-weight: 900;
}

.debug-code {
  margin-bottom: 7px;
  color: #98a29a;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
}

.prompt-tag {
  display: inline;
  margin: 0 1px;
  border-radius: 5px;
  padding: 1px 4px 2px;
  color: #1d2d24;
  font-weight: 900;
  box-decoration-break: clone;
  -webkit-box-decoration-break: clone;
}

.prompt-tag-subject {
  background: #d9f2ff;
  box-shadow: inset 0 -2px 0 #90d6f0;
}

.prompt-tag-focus {
  background: #fff0ad;
  box-shadow: inset 0 -2px 0 #f0cb4d;
}

.prompt-tag-confusable {
  background: #ffd8e0;
  box-shadow: inset 0 -2px 0 #ee9caf;
}

.options {
  display: grid;
  gap: 10px;
}

.option {
  width: 100%;
  min-height: 54px;
  text-align: left;
  background: #fbfcfa;
  border: 2px solid var(--line);
  border-radius: 10px;
  padding: 12px 14px;
  font-weight: 700;
  box-shadow: inset 0 -3px 0 rgba(0, 0, 0, 0.04);
}

.option.selected {
  border-color: var(--primary);
  background: #edf8f2;
}

.order-builder {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.area-label {
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.order-list {
  min-height: 220px;
  margin: 0;
  padding: 12px 12px 12px 36px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fbfcfa;
}

.order-list li {
  min-height: 40px;
  padding: 8px 0;
}

.order-list li + li {
  border-top: 1px solid var(--line);
}

.order-list li:not(.muted) {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.mini-btn {
  min-height: 28px;
  padding: 0 8px;
  border-radius: 5px;
  background: #edf1ea;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.answer-input {
  width: 100%;
  min-height: 132px;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 12px;
  font: inherit;
  line-height: 1.6;
}

.feedback {
  margin-top: 16px;
  padding: 14px;
  border-radius: 6px;
  display: none;
  border: 1px solid transparent;
}

.feedback.show.ok {
  display: block;
  background: var(--ok-bg);
  color: var(--primary-strong);
  border-color: #a8d7bf;
}

.feedback.show.bad {
  display: block;
  background: var(--bad-bg);
  color: var(--danger);
  border-color: #efb6aa;
}

.ai-feedback {
  display: flex;
  align-items: flex-start;
  gap: 7px;
  min-height: 24px;
  margin: -2px 0 12px;
  padding-bottom: 10px;
  border-bottom: 1px dashed currentColor;
  font-size: 14px;
  font-weight: 800;
  line-height: 1.5;
}

#aiFeedbackText {
  min-width: 0;
}

.ai-feedback-name {
  flex: 0 0 auto;
  color: var(--primary-strong);
  font-size: 12px;
}

.feedback.show.bad .ai-feedback-name {
  color: #a73b3b;
}

.ai-feedback.loading #aiFeedbackText::after {
  content: '';
  display: inline-block;
  width: 5px;
  height: 5px;
  margin-left: 5px;
  border-radius: 50%;
  background: currentColor;
  animation: npc-feedback-pulse 0.9s infinite ease-in-out;
}

@keyframes npc-feedback-pulse {
  50% { opacity: 0.2; transform: scale(0.65); }
}

.feedback-label {
  display: inline-block;
  margin-top: 10px;
  color: #315f4a;
  font-size: 12px;
  font-weight: 900;
}

.actions {
  position: fixed;
  right: max(10px, env(safe-area-inset-right));
  bottom: max(46px, calc(env(safe-area-inset-bottom) + 34px));
  z-index: 5;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 14px 35px rgba(36, 48, 56, 0.16);
}

.actions .primary-btn {
  min-width: 132px;
}

.actions .primary-btn:disabled {
  background: #aeb8b2;
  color: #f5f7f5;
  box-shadow: none;
}

.answer-list {
  margin: 12px 0 0;
  padding-left: 20px;
  line-height: 1.8;
}

.encourage-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 22px;
}

.encourage-card {
  width: min(480px, 100%);
  padding: 38px 28px 34px;
  text-align: center;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
  box-shadow: var(--shadow);
}

.encourage-card .mentor {
  margin: 0 auto 18px;
}

.encourage-card h1 {
  font-size: 34px;
  margin-bottom: 8px;
}

/* Final cascade for the refreshed visual system. */
.login-panel { padding: 38px; border-radius: 20px; border-color: rgba(255,255,255,.55); }
.brand-mark { border-radius: 14px; background: linear-gradient(145deg, #6d68ed, #423fae); box-shadow: 0 8px 18px rgba(74,69,186,.28); }
.primary-btn { border-radius: 12px; background: linear-gradient(135deg, #605be2, #7a61df); box-shadow: 0 7px 14px rgba(91,91,214,.24); }
.primary-btn:hover { background: linear-gradient(135deg, #514dca, #6c50d2); }
.secondary-btn { border-radius: 12px; background: #eeedff; color: var(--primary-strong); }
.ghost-btn { border-radius: 10px; }
.ghost-btn:hover { background: #f0f0fb; color: var(--primary-strong); }
.field input, .memory-search input, .user-create-form input, .user-item-fields input, .answer-input { border-radius: 12px; border-color: #d9dcef; background: #fafaff; }
.topbar { height: 72px; background: rgba(255,255,255,.82); border-bottom-color: rgba(103,98,210,.12); box-shadow: 0 4px 24px rgba(53,51,126,.05); backdrop-filter: blur(16px); }
.topbar.catalog-topbar, .topbar.basic-topbar { background: rgba(255,255,255,.82); border-bottom-color: rgba(103,98,210,.12); }
.topbar.basic-topbar .brand-mark { background: linear-gradient(145deg, #ff9178, #e85d7d); }
.catalog-page, .memorization-page, .user-management-page { width: min(1180px, 100%); }
.catalog-hero { min-height: 258px; padding: 30px 38px; border: 0; border-radius: 26px; background: radial-gradient(circle at 72% 20%, rgba(255,255,255,.3), transparent 22%), linear-gradient(135deg, #29295f 0%, #5c58d2 54%, #8d70e8 100%); box-shadow: 0 20px 42px rgba(54,48,144,.22); overflow: hidden; }
.catalog-hero h1, .catalog-hero .muted { color: #fff; }
.catalog-hero .catalog-kicker { color: #ffd4a9; letter-spacing: .08em; }
.catalog-hero h1 { font-size: clamp(34px, 4vw, 52px); letter-spacing: -.04em; }
.catalog-mentor { filter: drop-shadow(0 16px 12px rgba(20,18,83,.24)); }
.study-chart { width: 100%; margin: 22px 0 0; padding: 16px 20px 12px; border-color: #e2e1f6; border-radius: 20px; background: rgba(255,255,255,.86); box-shadow: 0 14px 30px rgba(61,56,144,.08); }
.study-chart-bars { height: 86px; gap: 3px; }
.study-chart-bar { background: linear-gradient(to top, #5a58d7, #a47af3); opacity: .9; }
.study-chart-plot { height: 132px; display: flex; align-items: stretch; gap: 3px; margin-top: 10px; }
.study-chart-column { flex: 1 1 0; min-width: 2px; display: grid; grid-template-rows: 1fr 1px 1fr; align-items: end; }
.study-chart-column i { display: block; height: 1px; background: #c4c4df; }
.study-chart-time, .study-chart-points { display: block; min-height: 2px; border-radius: 2px; }
.study-chart-time { align-self: end; background: linear-gradient(to top, #5a58d7, #a47af3); }
.study-chart-points { align-self: start; background: linear-gradient(to bottom, #ff7d5c, #ffb15f); }
.weekly-score { display: inline-flex; align-items: baseline; gap: 8px; margin-top: 18px; padding: 9px 14px; border: 1px solid rgba(255,255,255,.3); border-radius: 12px; background: rgba(20,18,83,.24); color: #fff; }
.weekly-score span, .weekly-score small { font-size: 12px; }.weekly-score strong { color: #ffd477; font-size: 30px; line-height: 1; }
.catalog-group { margin-top: 36px; }
.catalog-group h2 { color: var(--text); font-size: 22px; letter-spacing: -.03em; }
.catalog-option { min-height: 224px; border: 1px solid transparent; border-radius: 20px; box-shadow: 0 12px 24px rgba(52,52,122,.08); overflow: hidden; }
.catalog-option::after { content: ""; position: absolute; right: -40px; bottom: -56px; width: 150px; height: 150px; border-radius: 50%; background: currentColor; opacity: .08; }
.catalog-option:hover { transform: translateY(-6px); box-shadow: 0 22px 34px rgba(52,52,122,.15); }
.catalog-option strong, .memory-item h2, .stage-copy strong, .map-hero h1 { color: var(--text); }
.catalog-duration { color: #66628d; }
.catalog-basic { background: linear-gradient(145deg,#fff3fb,#f3edff); border-color:#e8d5f7; color:#b35ec7; }
.catalog-advanced { background: linear-gradient(145deg,#edf1ff,#e9e9ff); border-color:#d4d8fb; color:#5d5bce; }
.catalog-memory { background: linear-gradient(145deg,#fff7e7,#ffefde); border-color:#f6d9b6; color:#dd7c45; }
.catalog-exam { background: linear-gradient(145deg,#e9f8fa,#e9efff); border-color:#cde0f2; color:#367bb6; }
.catalog-links { display:flex; align-items:center; justify-content:space-between; gap:16px; margin-top:36px; padding:18px 22px; border:1px dashed #c9c7e9; border-radius:16px; color:#6b678f; background:rgba(255,255,255,.56); }
.catalog-links span { font-size:14px; font-weight:800; }.catalog-links a { color:#554fc4; font-size:14px; font-weight:900; text-decoration:none; }.catalog-links a:hover { text-decoration:underline; }
.memory-heading, .exam-runner-head { border-bottom-color: #dedff0; }
.memory-tab { border-radius: 999px; }
.memory-tab.active { border-color:#716ce0; background:#ecebff; color:#4541ad; }
.memory-item, .user-item, .mistake-item { border-color:#e2e3f0; background:rgba(255,255,255,.92); }
.memory-item { border-left: 0; }
.memory-item::before { content:""; display:block; width:44px; height:4px; margin-bottom:14px; border-radius:99px; background:linear-gradient(90deg,#ff8a67,#8b74e8); }
.map-page, .mistake-page { width:min(980px,100%); }
.map-hero { padding:24px 28px; border:1px solid #e0def6; border-radius:20px; background:linear-gradient(125deg,#fff,#f2f0ff); box-shadow:0 12px 28px rgba(56,53,134,.08); }
.map-node { box-shadow: inset 0 -5px 0 rgba(30,28,100,.18), 0 12px 24px rgba(72,67,178,.22); }
.map-node.step-0 { --node:#675fdb; }.map-node.step-1 { --node:#4d92d9; }.map-node.step-2 { --node:#f29a62; }.map-node.step-3 { --node:#9d6cda; }.map-node.step-4 { --node:#dc678a; }.map-node.step-5 { --node:#43a8ad; }
.map-node.active { outline-color: rgba(98,91,219,.2); }
.map-node-time { border-color:#d9d7f3; color:#514dbd; box-shadow:0 4px 10px rgba(64,59,161,.14); }
.study-shell { background:var(--bg); }
.study-card { border-color:#e0e1f1; background:rgba(255,255,255,.94); }
.study-progress-track, .level-track, .progress-track { background:#e5e5f4; }
.study-progress-fill, .progress-fill { background:linear-gradient(90deg,#5a57d6,#a774e9); }
.speech { border-color:#deddf1; border-radius:16px; background:#fafaff; }
.speech::before { border-left-color:#deddf1; border-bottom-color:#deddf1; background:#fafaff; }
.exercise-type, .mentor-name { color:#615bd1; }
.option, .exam-options button { border-color:#e0e1ef; border-radius:14px; background:#fbfbff; transition:transform 150ms ease,border-color 150ms ease,background 150ms ease; }
.option:hover, .exam-options button:hover { transform:translateX(3px); border-color:#aaa7ec; }
.option:focus:not(:focus-visible), .exam-options button:focus:not(:focus-visible) { outline: none; }
.option:focus-visible, .exam-options button:focus-visible { outline: 3px solid rgba(113,108,224,.35); outline-offset: 2px; }
.option.selected, .exam-options button.selected { border-color:#716ce0; background:#eeedff; color:#3f3c9e; }
.feedback, .order-list { border-radius:14px; }
.feedback.show.ok { background:#eeedff; border-color:#c9c5fa; color:#403da1; }
.feedback.show.bad { background:#fff1f3; border-color:#ffc7d0; }
.actions { border-color:#e1e1f1; border-radius:16px; background:rgba(255,255,255,.88); backdrop-filter:blur(14px); }
.exam-question, .exam-result { padding:30px; border-radius:18px; background:rgba(255,255,255,.9); box-shadow:var(--shadow); }
.exam-question { padding-bottom: 112px; }
.encourage-card { border-radius:22px; background:linear-gradient(145deg,#fff,#f4f2ff); }

@media (max-width: 860px) {
  .order-builder {
    grid-template-columns: 1fr;
  }

  .topbar {
    padding: 0 14px;
    grid-template-columns: 1fr;
    height: auto;
    gap: 8px;
    padding-top: 10px;
    padding-bottom: 10px;
  }

  .top-actions {
    justify-content: flex-start;
    flex-wrap: wrap;
  }

  .catalog-page,
  .memorization-page,
  .user-management-page {
    padding: 24px 16px 52px;
  }

  .catalog-hero {
    min-height: 0;
    padding: 0 4px 20px;
  }

  .catalog-hero h1,
  .memory-heading h1 {
    font-size: 29px;
  }

  .catalog-mentor,
  .mentor-svg-catalog {
    width: 142px;
    height: 142px;
  }

  .catalog-grid {
    gap: 12px;
    padding-top: 20px;
  }

  .catalog-option {
    min-height: 166px;
    padding: 18px;
  }

  .catalog-option strong {
    font-size: 21px;
  }

  .catalog-option small {
    font-size: 13px;
  }

  .catalog-icon {
    font-size: 34px;
  }

  .memory-heading {
    align-items: stretch;
    flex-direction: column;
    gap: 14px;
  }

  .memory-search {
    min-width: 0;
  }

  .memory-item {
    padding: 17px;
  }

  .mistake-subject-grid { grid-template-columns: 1fr; }

  .user-create-form,
  .user-item {
    grid-template-columns: 1fr;
  }

  .user-item-actions {
    justify-content: flex-start;
  }

  .map-path {
    grid-template-columns: minmax(280px, 100%);
    gap: 26px;
  }

  .map-node {
    width: 58px;
    height: 58px;
  }

  .map-stage,
  .map-stage.mentor-left {
    min-height: 620px;
    grid-template-columns: 1fr;
    padding: 10px 8px 18px;
  }

  .map-stage.mentor-left .stage-mentor-wrap,
  .map-stage.mentor-right .stage-mentor-wrap,
  .map-stage.mentor-left .stage-path,
  .map-stage.mentor-right .stage-path,
  .map-stage.mentor-left .stage-copy,
  .map-stage.mentor-right .stage-copy {
    grid-column: 1;
  }

  .stage-mentor-wrap {
    position: static;
    grid-row: 1;
  }

  .stage-copy {
    grid-row: 2;
    justify-items: center;
    text-align: center;
    margin-bottom: 0;
  }

  .stage-copy strong {
    font-size: 17px;
  }

  .stage-path {
    grid-row: 3;
    min-height: 430px;
  }

  .stage-path .snake-0 { left: 42%; top: 0; }
  .stage-path .snake-1 { left: 20%; top: 42px; }
  .stage-path .snake-2 { left: 8%; top: 96px; }
  .stage-path .snake-3 { left: 30%; top: 150px; }
  .stage-path .snake-4 { left: 58%; top: 190px; }
  .stage-path .snake-5 { left: 72%; top: 244px; }
  .stage-path .snake-6 { left: 50%; top: 294px; }
  .stage-path .snake-7 { left: 24%; top: 328px; }
  .stage-path .snake-8 { left: 10%; top: 376px; }
  .stage-path .snake-9 { left: 38%; top: 408px; }

  .map-stage.mentor-left .stage-path .snake-0 { left: 38%; }
  .map-stage.mentor-left .stage-path .snake-1 { left: 60%; }
  .map-stage.mentor-left .stage-path .snake-2 { left: 74%; }
  .map-stage.mentor-left .stage-path .snake-3 { left: 52%; }
  .map-stage.mentor-left .stage-path .snake-4 { left: 24%; }
  .map-stage.mentor-left .stage-path .snake-5 { left: 10%; }
  .map-stage.mentor-left .stage-path .snake-6 { left: 32%; }
  .map-stage.mentor-left .stage-path .snake-7 { left: 58%; }
  .map-stage.mentor-left .stage-path .snake-8 { left: 72%; }
  .map-stage.mentor-left .stage-path .snake-9 { left: 44%; }

  .mentor-svg-stage {
    width: 150px;
    height: 150px;
  }

  .map-hero {
    align-items: flex-start;
    flex-direction: column;
  }

  .mentor-row {
    grid-template-columns: 1fr;
  }

  .speech::before {
    display: none;
  }

  .actions {
    left: auto;
    right: max(8px, env(safe-area-inset-right));
    bottom: max(58px, calc(env(safe-area-inset-bottom) + 46px));
    justify-content: flex-end;
  }
}
