:root {
  color-scheme: light;
  --bg: #f5f7fa;
  --surface: #ffffff;
  --surface-2: #eef4f8;
  --text: #17202a;
  --muted: #5f6f7f;
  --line: #d8e1e8;
  --brand: #1f6f8b;
  --brand-2: #24566c;
  --warn: #a65f00;
  --warn-bg: #fff2d8;
  --ok: #1f7a4d;
  --ok-bg: #e5f5ec;
  --danger: #b03838;
  --danger-bg: #fde7e7;
  --shadow: 0 12px 30px rgba(31, 58, 76, .08);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  line-height: 1.5;
}

.mobile-subnav,
.mobile-bottom-nav,
.mobile-profile-summary {
  display: none;
}

.coin-layer {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 9998;
  overflow: hidden;
}

.coin {
  position: absolute;
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background:
    radial-gradient(circle at 35% 28%, #fff7bd 0 16%, transparent 17%),
    linear-gradient(145deg, #ffe66d, #f6b91f 62%, #d98900);
  border: 2px solid #f8cf4a;
  color: #7a4a00;
  font-size: 15px;
  font-weight: 900;
  box-shadow: 0 8px 16px rgba(166, 95, 0, .28);
  transform: translate3d(0, 0, 0) scale(var(--scale));
  animation: coin-burst 1.9s var(--delay) cubic-bezier(.18,.78,.28,1) forwards;
}

@keyframes coin-burst {
  0% {
    opacity: 0;
    transform: translate3d(0, 0, 0) scale(.35) rotate(0deg);
  }
  12% {
    opacity: 1;
  }
  70% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform: translate3d(var(--dx), 420px, 0) scale(var(--scale)) rotate(540deg);
  }
}

.coin-toast {
  position: fixed;
  left: 50%;
  top: 88px;
  transform: translateX(-50%);
  z-index: 9999;
  padding: 12px 18px;
  border-radius: 999px;
  background: #fff7d6;
  border: 1px solid #f6ce58;
  color: #815100;
  font-weight: 900;
  box-shadow: 0 14px 34px rgba(166, 95, 0, .2);
  animation: toast-pop 1.6s ease forwards;
}

.coin-toast span {
  display: block;
  margin-top: 2px;
  font-size: 13px;
  font-weight: 700;
}

.action-toast {
  position: fixed;
  left: 50%;
  top: 92px;
  transform: translateX(-50%);
  z-index: 10000;
  padding: 12px 18px;
  border-radius: 999px;
  background: #e7f6ff;
  border: 1px solid #9bd1ee;
  color: #174d6d;
  font-weight: 900;
  box-shadow: 0 14px 34px rgba(31, 111, 139, .18);
  animation: toast-pop 1.8s ease forwards;
}

.treasure-pop {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(22, 31, 40, .36);
  backdrop-filter: blur(3px);
  animation: chest-backdrop .28s ease both;
}

.treasure-card {
  width: min(560px, 92vw);
  display: grid;
  justify-items: center;
  gap: 14px;
  padding: 30px;
  text-align: center;
  border-radius: 8px;
  background: #fff7d6;
  border: 2px solid #f6ce58;
  color: #7a4a00;
  box-shadow: 0 30px 90px rgba(166, 95, 0, .35);
  animation: chest-impact .9s cubic-bezier(.16,.9,.2,1.25) both;
}

.treasure-box {
  width: 132px;
  height: 104px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: linear-gradient(#ffe17a 0 46%, #9c5a17 47% 100%);
  border: 4px solid #7a4a00;
  color: #fff7d6;
  font-size: 38px;
  font-weight: 900;
  box-shadow: inset 0 8px 0 rgba(255,255,255,.35), 0 18px 34px rgba(122, 74, 0, .26);
  animation: chest-shake .9s ease both;
}

.treasure-card strong {
  display: block;
  font-size: 26px;
  color: #7a4a00;
}

.treasure-card span {
  font-size: 20px;
  color: #9c5a17;
}

.treasure-pop.settle .treasure-box {
  animation: chest-glow 1.2s ease-in-out infinite alternate;
}

@keyframes chest-backdrop {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes chest-impact {
  0% { opacity: 0; transform: scale(.55) translateY(30px); }
  55% { opacity: 1; transform: scale(1.08) translateY(-6px); }
  74% { transform: scale(.97) translateY(2px); }
  100% { transform: scale(1) translateY(0); }
}

@keyframes chest-shake {
  0%, 100% { transform: rotate(0deg) scale(1); }
  20% { transform: rotate(-5deg) scale(1.05); }
  40% { transform: rotate(5deg) scale(1.05); }
  60% { transform: rotate(-3deg) scale(1.02); }
  80% { transform: rotate(3deg) scale(1.02); }
}

@keyframes chest-glow {
  from { box-shadow: inset 0 8px 0 rgba(255,255,255,.35), 0 18px 34px rgba(122, 74, 0, .26); }
  to { box-shadow: inset 0 8px 0 rgba(255,255,255,.35), 0 20px 56px rgba(246, 185, 31, .72); }
}

@keyframes toast-pop {
  0% { opacity: 0; transform: translate(-50%, -10px) scale(.94); }
  15% { opacity: 1; transform: translate(-50%, 0) scale(1); }
  82% { opacity: 1; }
  100% { opacity: 0; transform: translate(-50%, -8px) scale(.98); }
}

.motivation-overlay {
  position: fixed;
  inset: 0;
  z-index: 9997;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(17, 32, 42, .34);
  backdrop-filter: blur(4px);
}

.motivation-card {
  width: min(560px, 100%);
  padding: 28px;
  border-radius: 8px;
  background: #fffdf4;
  border: 1px solid #f6ce58;
  box-shadow: 0 24px 70px rgba(31, 58, 76, .22);
}

.motivation-card h2 {
  margin-bottom: 12px;
  font-size: 26px;
  color: #7a4a00;
}

.motivation-card p {
  color: #40505b;
  font-size: 16px;
}

button, input, select, textarea {
  font: inherit;
}

button, .import-label {
  border: 0;
  border-radius: 8px;
  padding: 10px 14px;
  cursor: pointer;
  background: var(--brand);
  color: white;
  font-weight: 700;
}

button:hover, .import-label:hover { filter: brightness(.96); }
button:active { transform: translateY(1px); }

.ghost {
  background: #e7eef3;
  color: var(--brand-2);
}

.danger {
  background: var(--danger-bg);
  color: var(--danger);
}

.primary { background: var(--brand); color: white; }
.full { width: 100%; }

#generatePlanBtn.plan-pending {
  background: var(--danger);
  color: white;
}

#generatePlanBtn.plan-confirmed {
  background: var(--ok);
  color: white;
}

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  padding: 24px 32px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 10;
}

h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 6px; font-size: 28px; letter-spacing: 0; }
h2 { margin-bottom: 12px; font-size: 20px; }
h3 { margin-bottom: 8px; font-size: 16px; }

.eyebrow {
  margin-bottom: 4px;
  color: var(--brand);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.subhead {
  margin: 0;
  color: var(--muted);
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.sync-status {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 7px 12px;
  border-radius: 999px;
  background: #e7eef3;
  color: var(--brand-2);
  font-size: 13px;
  font-weight: 800;
}

.sync-status[data-kind="ok"] {
  background: #e7f7ed;
  color: #17683a;
}

.sync-status[data-kind="syncing"] {
  background: #eef8ff;
  color: #1f6f8b;
}

.sync-status[data-kind="error"] {
  background: var(--danger-bg);
  color: var(--danger);
}

.import-label input { display: none; }

.plan-tools {
  display: grid;
  gap: 10px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.rollback-panel {
  display: grid;
  gap: 8px;
}

.layout {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  gap: 20px;
  padding: 20px;
  max-width: 1500px;
  margin: 0 auto;
}

.sidebar, .content {
  min-width: 0;
}

.panel, .task-card, .reply-card, .material-card, .exam-card, .mistake-card, .analysis-report {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.panel {
  padding: 16px;
  margin-bottom: 14px;
}

.compact { box-shadow: none; }

.mode-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 14px;
}

.mode-button {
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--line);
  min-height: 62px;
  text-align: left;
}

.mode-button.active {
  background: var(--brand);
  color: white;
  border-color: var(--brand);
}

.mode-button span {
  display: block;
  font-size: 12px;
  font-weight: 500;
  opacity: .82;
}

.field {
  display: block;
  margin-bottom: 12px;
}

.inline-field {
  min-width: 150px;
  margin-bottom: 0;
}

.field span {
  display: block;
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.field input, .field select {
  width: 100%;
  padding: 10px 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
}

.stat-list {
  display: grid;
  gap: 8px;
}

.stat-list div {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 10px;
  border-radius: 8px;
  background: var(--surface-2);
}

.stat-list strong { font-size: 24px; color: var(--brand); }
.stat-list span { color: var(--muted); font-size: 13px; }

.route-progress {
  display: grid;
  gap: 10px;
}

.route-item {
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
}

.route-item.active {
  border-color: #63add4;
  background: #eef8ff;
}

.route-item.finished {
  border-color: #8dceb0;
  background: #f0fbf5;
}

.route-head {
  display: flex;
  align-items: center;
  gap: 8px;
}

.route-head span {
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--brand);
  color: #fff;
  font-size: 12px;
  font-weight: 800;
}

.route-head strong {
  font-size: 14px;
}

.route-bar {
  height: 8px;
  margin: 8px 0;
  border-radius: 999px;
  background: #d9e6ed;
  overflow: hidden;
}

.route-bar div {
  height: 100%;
  border-radius: inherit;
  background: var(--brand);
}

.route-item.finished .route-bar div {
  background: var(--ok);
}

.route-item p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.tab {
  background: var(--surface);
  color: var(--brand-2);
  border: 1px solid var(--line);
}

.tab.active {
  background: var(--brand-2);
  color: white;
}

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

.section-title {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 14px;
}

.inline-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.task-list, .reply-stack, .material-grid, .exam-area, .mistake-list {
  display: grid;
  gap: 12px;
}

.task-card {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  padding: 16px;
}

.task-card p, .reply-card p, .material-card p, .exam-card p, .mistake-card p {
  color: var(--muted);
  margin-bottom: 0;
}

.checkline {
  display: flex;
  gap: 8px;
  align-items: center;
  white-space: nowrap;
  color: var(--muted);
}

.reply-card {
  padding: 18px;
}

.material-card {
  padding: 18px;
  background: #eef8ff;
  border-color: #b8dff4;
}

.question-panel {
  background: #dff2ff;
  border: 1px solid #9bd1ee;
  border-left: 5px solid #2f8fc5;
  border-radius: 8px;
  padding: 14px;
  margin: 12px 0;
}

.question-panel h3 {
  margin: 0 0 8px;
  color: #174d6d;
}

.question-panel p {
  margin: 0;
  color: #225f7e;
  font-weight: 700;
}

.material-block {
  margin-top: 12px;
  padding: 14px;
  background: #f7fcff;
  border: 1px solid #b8dff4;
  border-radius: 8px;
}

.material-block h4,
.sentence-list h4 {
  margin: 0 0 8px;
  font-size: 15px;
}

.logic-list {
  margin: 0;
  padding-left: 22px;
}

.logic-list li {
  margin: 6px 0;
}

.sentence-list {
  margin-top: 12px;
}

.sentence-card {
  margin-bottom: 10px;
  padding: 12px;
  border: 1px solid #b8dff4;
  border-radius: 8px;
  background: #f7fcff;
}

.svo-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
  margin: 8px 0;
}

.clause-breakdown {
  display: grid;
  gap: 8px;
  margin: 10px 0;
}

.clause-row {
  padding: 10px;
  border: 1px solid #d4e5ee;
  border-radius: 8px;
  background: #fff;
}

.clause-row.main {
  background: #eef8ff;
  border-color: #b8dff4;
}

.clause-row.sub {
  background: #f6fbf7;
  border-color: #cae5d2;
}

.clause-row strong,
.clause-row small {
  display: block;
}

.clause-row p {
  margin: 5px 0;
}

.clause-row small {
  color: var(--muted);
  line-height: 1.5;
}

.svo-grid span {
  display: block;
  min-height: 58px;
  padding: 9px;
  border-radius: 8px;
  background: var(--surface-2);
  color: var(--text);
  overflow-wrap: anywhere;
}

.svo-grid b {
  display: block;
  color: var(--brand);
  font-size: 12px;
  margin-bottom: 3px;
}

.schedule-card h3 {
  color: var(--brand-2);
}

.reply-meta {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 4px 9px;
  border-radius: 8px;
  background: var(--surface-2);
  color: var(--brand-2);
  font-size: 12px;
  font-weight: 800;
}

.badge.warn { background: var(--warn-bg); color: var(--warn); }
.badge.ok { background: var(--ok-bg); color: var(--ok); }

.answer-box {
  padding: 14px;
  border-left: 4px solid var(--brand);
  background: #f7fbfd;
  border-radius: 8px;
  white-space: pre-wrap;
}

.study-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 14px;
}

.mini {
  padding: 12px;
  background: var(--surface-2);
  border-radius: 8px;
}

.mini ul {
  margin: 6px 0 0;
  padding-left: 18px;
}

.progress-mini {
  align-content: start;
}

.micro-list {
  display: grid;
  gap: 10px;
  margin-top: 10px;
}

.micro-item {
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.micro-item b,
.micro-item span {
  display: block;
}

.micro-item span {
  color: var(--muted);
  font-size: 13px;
  margin-top: 3px;
}

.item-progress-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 10px;
}

.pause-banner {
  padding: 12px;
  margin: 12px 0;
  border: 1px solid #e2b84f;
  border-radius: 8px;
  background: #fff8df;
  color: #6f4d00;
}

.pause-inline {
  display: inline-block;
  padding: 7px 10px;
  margin-top: 8px;
  border-radius: 8px;
  background: #fff8df;
  color: #6f4d00;
}

.reply-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 14px;
}

.small-btn {
  padding: 6px 9px;
  font-size: 13px;
}

.material-guide {
  padding: 16px;
  margin-bottom: 12px;
  background: #eef8ff;
  border: 1px solid #b8dff4;
  border-radius: 8px;
}

.material-guide h3 {
  color: #174d6d;
}

.step-track {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 8px;
  margin-top: 12px;
}

.step-pill {
  min-height: 62px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: #e7f2fa;
  color: #12394d;
  border: 1px solid rgba(18, 57, 77, 0.12);
}

.step-pill span {
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #ffffff;
  color: #24566c;
  font-size: 12px;
}

.step-pill.depth-4 span,
.step-pill.depth-5 span,
.step-pill.depth-6 span {
  color: #155f8e;
}

.step-pill.current {
  outline: 3px solid rgba(255, 255, 255, 0.85);
  box-shadow: 0 0 0 3px rgba(28, 91, 125, 0.28);
  color: #fff;
}

.step-pill.done {
  color: #fff;
  border-color: rgba(255, 255, 255, 0.42);
}

.step-pill.depth-1, .material-tab.depth-1 { background: #d9eef9; color: #12394d; }
.step-pill.depth-2, .material-tab.depth-2 { background: #bfe2f4; color: #12394d; }
.step-pill.depth-3, .material-tab.depth-3 { background: #95cde8; color: #12394d; }
.step-pill.depth-4, .material-tab.depth-4 { background: #63add4; color: #fff; }
.step-pill.depth-5, .material-tab.depth-5 { background: #2f86b7; color: #fff; }
.step-pill.depth-6, .material-tab.depth-6 { background: #155f8e; color: #fff; }

.checkin-dashboard {
  display: grid;
  grid-template-columns: minmax(240px, .8fr) minmax(0, 1.2fr);
  gap: 14px;
  margin-bottom: 14px;
}

.progress-card,
.calendar-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
}

.progress-card {
  display: flex;
  align-items: center;
  gap: 16px;
}

.vault-card {
  margin-bottom: 14px;
  padding: 18px;
  border-radius: 8px;
  border: 1px solid #f0c85a;
  background: linear-gradient(135deg, #fff9df, #fffef8);
  box-shadow: 0 14px 36px rgba(166, 95, 0, .12);
}

.vault-main {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
}

.vault-balance {
  display: block;
  font-size: 34px;
  color: #8a5600;
  line-height: 1.1;
}

.vault-stats {
  display: grid;
  gap: 8px;
  min-width: 220px;
}

.vault-stats span {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  padding: 8px 10px;
  border-radius: 8px;
  background: rgba(255, 255, 255, .72);
  color: #7a4a00;
}

.vault-progress {
  height: 12px;
  margin: 14px 0;
  border-radius: 999px;
  background: #f3df97;
  overflow: hidden;
}

.vault-progress div {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #e3a813, #ffd95c);
}

.vault-chest-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

.vault-chest-head h4 {
  margin: 0 0 8px;
  color: #7a4a00;
}

.vault-chest-head span {
  color: #8a6a20;
  font-size: 12px;
  font-weight: 800;
}

.vault-chest-grid {
  display: grid;
  grid-template-columns: repeat(8, minmax(0, 1fr));
  gap: 8px;
}

.vault-chest-slot {
  min-height: 112px;
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 5px;
  padding: 10px 8px;
  border: 1px solid rgba(138, 86, 0, .2);
  border-radius: 8px;
  background: rgba(255, 255, 255, .7);
  text-align: center;
}

.vault-chest-slot.opened {
  background: linear-gradient(180deg, #fff7d1, #fff);
  border-color: #e0ad2d;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .7);
}

.vault-chest-slot.empty {
  opacity: .78;
  background: rgba(255, 255, 255, .48);
}

.slot-box {
  width: 38px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: linear-gradient(135deg, #c8861a, #ffd45c);
  color: #5c3600;
  font-weight: 900;
}

.vault-chest-slot.empty .slot-box {
  background: #ead9a8;
  color: #8a6a20;
}

.vault-chest-slot span {
  color: #8a6a20;
  font-size: 11px;
}

.vault-chest-slot strong {
  max-width: 100%;
  color: #6d4300;
  font-size: 12px;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.progress-ring {
  width: 118px;
  height: 118px;
  flex: 0 0 118px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background:
    radial-gradient(circle at center, var(--surface) 0 58%, transparent 59%),
    conic-gradient(var(--brand) 0 var(--progress), #dce6e2 var(--progress) 360deg);
}

.progress-ring span {
  font-size: 24px;
  font-weight: 800;
  color: var(--brand-2);
}

.calendar-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.calendar-weekdays,
.checkin-calendar {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 6px;
}

.calendar-weekdays span {
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

.calendar-cell {
  min-height: 54px;
  border: 1px solid var(--line);
  background: var(--surface-2);
  border-radius: 8px;
  color: var(--ink);
  display: grid;
  place-items: center;
  gap: 2px;
  padding: 6px;
}

.calendar-cell span {
  font-weight: 700;
}

.calendar-cell small {
  color: var(--muted);
  font-size: 11px;
}

.calendar-cell.today {
  border-color: var(--brand);
}

.calendar-cell.active {
  background: var(--brand);
  color: #fff;
  border-color: var(--brand);
}

.calendar-cell.active small {
  color: rgba(255,255,255,.82);
}

.calendar-cell.muted {
  background: transparent;
  border-color: transparent;
}

.day-detail {
  margin-bottom: 14px;
}

.compact-title {
  margin-bottom: 12px;
}

.day-checkins {
  display: grid;
  gap: 8px;
}

.day-checkin-row {
  display: grid;
  grid-template-columns: 76px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  padding: 10px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.day-checkin-row span {
  color: var(--muted);
  font-size: 12px;
}

.day-checkin-row.done {
  border-color: #8bc9a6;
  background: #eef7f2;
}

.day-checkin-row.done span {
  color: #26764d;
  font-weight: 700;
}

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

.material-tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 12px;
  padding: 10px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.material-tab {
  border: 1px solid rgba(18, 57, 77, 0.14);
  min-height: 38px;
}

.material-tab.active {
  color: #fff;
  outline: 3px solid rgba(255, 255, 255, 0.92);
  box-shadow: 0 0 0 3px rgba(28, 91, 125, 0.28);
}

.material-tab.depth-1.active,
.material-tab.depth-2.active,
.material-tab.depth-3.active,
.step-pill.depth-1.current,
.step-pill.depth-2.current,
.step-pill.depth-3.current {
  color: #12394d;
}

.material-content {
  display: grid;
  gap: 12px;
}

.cn-line {
  color: #304b5c;
  background: #eef7f2;
  border-radius: 8px;
  padding: 8px;
  margin-top: 8px;
}

.bilingual-block {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 12px;
}

.bilingual-block > div {
  border: 1px solid var(--line);
  background: var(--surface-2);
  border-radius: 8px;
  padding: 12px;
}

.bilingual-block b {
  display: inline-block;
  margin-bottom: 6px;
  color: var(--brand-2);
}

.bilingual-block p {
  margin: 0;
  line-height: 1.65;
}

.sentence-card .cn-line,
.mini .cn-line {
  display: block;
  margin-top: 6px;
}

.phrase-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.phrase-card {
  padding: 12px;
  background: #f7fcff;
  border: 1px solid #b8dff4;
  border-radius: 8px;
}

.phrase-card.paused {
  border-color: #e2b84f;
  box-shadow: 0 0 0 3px rgba(226, 184, 79, 0.18);
}

.phrase-card strong,
.phrase-card span,
.phrase-card em {
  display: block;
}

.phrase-card-head,
.phrase-mini-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.phrase-card-head strong,
.phrase-mini-head b {
  min-width: 0;
}

.phrase-card-head .small-btn,
.phrase-mini-head .small-btn {
  flex: 0 0 auto;
}

.phrase-card em {
  color: #225f7e;
  font-style: normal;
  font-weight: 700;
  margin-top: 4px;
}

.phrase-card span {
  color: var(--muted);
  font-size: 12px;
  margin: 4px 0 8px;
}

.phrase-examples {
  display: grid;
  gap: 6px;
  margin: 10px 0;
}

.phrase-examples p {
  margin: 0;
  padding: 8px;
  border-radius: 8px;
  background: #eef8ff;
  color: #304b5c;
  font-size: 13px;
}

.exam-card, .mistake-card {
  padding: 16px;
}

.exam-prompt {
  display: grid;
  gap: 8px;
  margin-bottom: 10px;
}

.exam-prompt p {
  margin: 0;
  font-weight: 700;
  color: var(--text);
}

.exam-target-zh {
  display: grid;
  gap: 4px;
  padding: 12px 14px;
  border: 1px solid #8bc9a6;
  border-left: 5px solid #24965a;
  border-radius: 8px;
  background: #eefaf2;
}

.exam-target-zh strong {
  color: #17683a;
  font-size: 13px;
}

.exam-target-zh span {
  color: #123c27;
  font-size: 17px;
  font-weight: 800;
  line-height: 1.55;
}

.exam-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 14px;
}

.exam-controls {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.exam-controls strong {
  min-width: 86px;
  text-align: center;
  font-size: 22px;
  color: var(--brand-2);
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
}

.exam-section-heading {
  margin: 18px 0 10px;
  padding: 10px 12px;
  border-left: 4px solid var(--brand);
  background: #eef8ff;
  color: var(--brand-2);
  border-radius: 8px;
}

.choice-list {
  display: grid;
  gap: 8px;
  margin: 12px 0;
}

.choice-list label {
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr);
  gap: 8px;
  align-items: start;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
}

.score-panel {
  margin-bottom: 14px;
  padding: 14px;
  border: 1px solid #8bc9a6;
  background: #eef7f2;
  border-radius: 8px;
}

.score-panel strong {
  font-size: 20px;
  color: #26764d;
}

.exam-feedback {
  margin-top: 10px;
  padding: 10px;
  border-radius: 8px;
}

.exam-feedback.ok {
  background: #eef7f2;
  color: #26764d;
}

.exam-feedback.warn {
  background: #fff3e3;
  color: #955b00;
}

.exam-input, .big-text {
  width: 100%;
  min-height: 90px;
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  resize: vertical;
  background: white;
}

.big-text { min-height: 280px; }

.two-col {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 14px;
}

.api-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr) minmax(0, 1fr);
  gap: 12px;
}

.analysis-report {
  margin-top: 14px;
  padding: 16px;
  min-height: 120px;
}

.analysis-report:empty::before {
  content: "对话分析会显示在这里。";
  color: var(--muted);
}

.friends-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.friends-card {
  padding: 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.friends-lines {
  grid-column: 1 / -1;
}

.friends-transcript-input {
  min-height: 160px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.line-drill {
  margin-top: 10px;
  padding: 12px;
  border-radius: 8px;
  background: #eef8ff;
  border: 1px solid #b8dff4;
}

.segment-map {
  display: grid;
  gap: 10px;
}

.segment-detail {
  padding: 10px 12px;
  border: 1px solid #cfe0ea;
  border-radius: 8px;
  background: #f8fbfd;
}

.segment-detail summary {
  cursor: pointer;
  font-weight: 800;
  color: var(--brand-2);
}

.segment-detail p {
  margin: 8px 0 0;
}

.line-drill span {
  display: block;
  color: var(--brand);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.line-drill strong {
  display: block;
  margin-top: 4px;
  color: #174d6d;
}

.line-drill p {
  margin: 6px 0 0;
}

.small-note {
  color: var(--muted);
  font-size: 13px;
}

.profile-dashboard {
  display: grid;
  gap: 14px;
}

.achievement-report {
  display: grid;
  grid-template-columns: minmax(260px, 1.2fr) minmax(0, 2fr);
  gap: 14px;
}

.report-boost {
  padding: 18px;
  border-radius: 8px;
  background: linear-gradient(135deg, #fff6d6, #eef8ff);
  border: 1px solid #e7c35a;
}

.report-boost h3 {
  margin: 0;
  color: #714800;
  font-size: 22px;
  line-height: 1.35;
}

.report-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.report-metrics div {
  padding: 14px;
  border-radius: 8px;
  background: var(--surface);
  border: 1px solid var(--line);
}

.report-metrics strong {
  display: block;
  color: var(--brand);
  font-size: 24px;
}

.report-metrics span {
  color: var(--muted);
  font-size: 12px;
}

.profile-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.profile-wide {
  grid-column: 1 / -1;
}

.profile-section {
  margin-top: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fbfd;
  overflow: hidden;
}

.profile-section summary {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 12px;
  cursor: pointer;
  color: var(--brand-2);
}

.profile-section summary span {
  color: var(--muted);
  font-size: 13px;
}

.profile-qa-list {
  display: grid;
  gap: 8px;
  padding: 12px;
  border-top: 1px solid var(--line);
}

.profile-qa,
.profile-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 10px;
  border-radius: 8px;
  background: #fff;
  border: 1px solid var(--line);
}

.profile-qa.done {
  background: #eef7f2;
  border-color: #8bc9a6;
}

.profile-qa p,
.profile-row span {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.profile-chip-list {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.profile-chip-list span {
  padding: 7px 9px;
  border-radius: 8px;
  background: #eef8ff;
  border: 1px solid #b8dff4;
  color: var(--brand-2);
  font-size: 13px;
  font-weight: 700;
}

.chat-log {
  min-height: 260px;
  max-height: 420px;
  overflow: auto;
  display: grid;
  align-content: start;
  gap: 10px;
  padding: 12px;
  border-radius: 8px;
  background: #f6fafc;
  border: 1px solid var(--line);
}

.chat-empty {
  color: var(--muted);
  background: #fff;
  border: 1px dashed #bfd2dc;
  border-radius: 8px;
  padding: 14px;
}

.chat-message {
  max-width: 88%;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #fff;
  box-shadow: 0 8px 18px rgba(31, 58, 76, .06);
}

.chat-message span {
  display: block;
  margin-bottom: 4px;
  font-size: 12px;
  font-weight: 900;
  color: var(--brand-2);
}

.chat-message p {
  margin: 0;
  white-space: pre-wrap;
}

.chat-message.user {
  justify-self: end;
  background: #e7f6ff;
  border-color: #a9d6ec;
}

.chat-message.assistant {
  justify-self: start;
}

.chat-input {
  width: 100%;
  min-height: 90px;
  resize: vertical;
  margin-top: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font: inherit;
}

.logic-detail {
  padding: 12px;
  border-radius: 8px;
  background: #fffdf4;
  border: 1px solid #f2d58a;
  color: #384955;
  line-height: 1.72;
  white-space: normal;
}

.mobile-profile-card {
  padding: 14px;
  border-radius: 8px;
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.mobile-stat-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.mobile-stat-row div {
  padding: 12px 8px;
  border-radius: 8px;
  background: #eef8ff;
  border: 1px solid #b8dff4;
  text-align: center;
}

.mobile-stat-row strong {
  display: block;
  color: var(--brand-2);
  font-size: 22px;
}

.mobile-stat-row span,
.mobile-route-list span {
  color: var(--muted);
  font-size: 12px;
}

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

.mobile-route-list article {
  padding: 10px;
  border-radius: 8px;
  background: #f7fafc;
  border: 1px solid var(--line);
}

.mobile-route-list article.active {
  background: #e7f6ff;
  border-color: #9bd1ee;
}

.mobile-route-list article > div:first-child {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

@media (max-width: 980px) {
  .layout { grid-template-columns: 1fr; }
  .topbar { position: static; flex-direction: column; }
  .two-col, .study-grid, .friends-grid, .api-grid, .svo-grid, .phrase-grid, .bilingual-block, .checkin-dashboard, .step-track, .achievement-report, .profile-grid { grid-template-columns: 1fr; }
  .report-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .vault-chest-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 620px) {
  body {
    padding-bottom: calc(86px + env(safe-area-inset-bottom));
  }
  .topbar, .layout { padding: 12px; }
  .topbar {
    gap: 10px;
  }
  .topbar h1 {
    font-size: 24px;
  }
  .topbar .subhead {
    display: none;
  }
  .top-actions {
    width: 100%;
    display: flex;
    justify-content: flex-start;
  }
  .top-actions button,
  .top-actions label,
  .top-actions .sync-status {
    width: auto;
    justify-content: center;
    text-align: center;
  }
  .sidebar .panel.compact {
    display: none;
  }
  .mode-grid { grid-template-columns: 1fr; }
  .section-title, .task-card { flex-direction: column; }
  .vault-main { flex-direction: column; align-items: stretch; }
  .vault-chest-grid { grid-template-columns: 1fr; }
  .report-metrics, .profile-qa, .profile-row { grid-template-columns: 1fr; }
  .tabs {
    display: none;
  }
  .mobile-subnav {
    position: sticky;
    top: 0;
    z-index: 25;
    display: grid;
    gap: 8px;
    padding: 10px 0 12px;
    background: linear-gradient(180deg, var(--bg) 70%, rgba(245, 247, 250, 0));
  }
  .mobile-subnav strong {
    color: var(--brand-2);
    font-size: 13px;
    letter-spacing: .08em;
    text-transform: uppercase;
  }
  .mobile-subnav div {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 2px;
  }
  .mobile-subnav button {
    flex: 0 0 auto;
    padding: 9px 12px;
    border-radius: 999px;
    border: 1px solid var(--line);
    background: #fff;
    color: var(--brand-2);
    font-weight: 800;
  }
  .mobile-subnav button.active {
    background: var(--brand);
    border-color: var(--brand);
    color: #fff;
  }
  .mobile-bottom-nav {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 9000;
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 4px;
    padding: 8px 10px calc(8px + env(safe-area-inset-bottom));
    background: rgba(255, 255, 255, .96);
    border-top: 1px solid var(--line);
    box-shadow: 0 -12px 30px rgba(31, 58, 76, .12);
    backdrop-filter: blur(10px);
  }
  .mobile-nav-btn {
    display: grid;
    justify-items: center;
    gap: 4px;
    min-height: 58px;
    padding: 7px 4px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--muted);
    font-size: 12px;
    font-weight: 900;
  }
  .mobile-nav-btn svg {
    width: 23px;
    height: 23px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
  }
  .mobile-nav-btn.active {
    background: #e7f6ff;
    color: var(--brand);
  }
  .mobile-profile-summary {
    display: grid;
    gap: 12px;
    margin-bottom: 14px;
  }
  .chat-log {
    min-height: 48vh;
    max-height: 54vh;
  }
  .chat-message {
    max-width: 94%;
  }
  .chat-input,
  input,
  textarea,
  select {
    font-size: 16px;
  }
  .inline-actions {
    width: 100%;
  }
  .inline-actions button {
    flex: 1 1 auto;
  }
}
