:root {
  --cream: #FFFCF7;
  --surface: #FFFFFF;
  --surface-alt: #FBF7F0;
  --ink: #2E2A3B;
  --ink-soft: #4A4459;
  --muted: #7A7489;
  --soft: #A8A2B8;
  --line: #EDE8F0;
  --coral: #FF6B4A;
  --coral-dark: #E85533;
  --mint: #2FD3BF;
  --lemon: #FFC93C;
  --sky: #4A9EFF;
  --lilac: #A78BFA;
  --peach: #FFB59E;
  --coral-soft: #FFE5E8;
  --mint-soft: #D9F7F2;
  --lemon-soft: #FFF3CC;
  --sky-soft: #E3F0FF;
  --lilac-soft: #EDE7FF;
  --r-sm: 14px;
  --r-md: 24px;
  --r-lg: 32px;
  --r-xl: 40px;
  --r-pill: 999px;
  --shadow-soft: 0 12px 32px -12px rgba(46, 42, 59, .16);
  --shadow-card: 0 18px 44px -18px rgba(46, 42, 59, .22);
  --shadow-coral: 0 10px 24px -8px rgba(255, 107, 74, .55);
}

body {
  background: var(--cream);
  color: var(--ink);
  font-size: 16px;
  line-height: 1.75;
}

.aurora {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  pointer-events: none;
}

.aurora span {
  position: absolute;
  border-radius: 50%;
  filter: blur(70px);
  opacity: .55;
}

.aurora .b1 { width: 420px; height: 420px; background: var(--peach); top: -120px; left: -80px; }
.aurora .b2 { width: 380px; height: 380px; background: var(--mint); top: 12%; right: -100px; }
.aurora .b3 { width: 340px; height: 340px; background: var(--lemon); bottom: 4%; left: 18%; }
.aurora .b4 { width: 300px; height: 300px; background: var(--lilac); bottom: -90px; right: 22%; }

.page {
  width: 100%;
  max-width: none;
  margin: 0 auto;
  padding: 0 24px 80px;
}

.topbar {
  position: sticky;
  top: 12px;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 18px;
  width: auto;
  max-width: none;
  margin: 12px 24px 24px;
  padding: 12px 22px;
  background: rgba(255, 255, 255, .92);
  backdrop-filter: blur(12px);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-soft);
  flex-wrap: wrap;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 18px;
}

.brand-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: linear-gradient(120deg, var(--coral), var(--lemon));
}

.tabs {
  display: flex;
  gap: 8px;
  margin-left: auto;
}

.tab {
  min-height: 44px;
  padding: 8px 18px;
  border-radius: var(--r-pill);
  font-size: 15px;
  color: var(--ink-soft);
  background: var(--surface-alt);
  transition: all var(--dur-fast) var(--ease-spring);
}

.tab:hover { transform: translateY(-2px); }

.tab.active {
  background: var(--coral);
  color: #fff;
  box-shadow: var(--shadow-coral);
}

.tab .tab-badge {
  display: inline-block;
  margin-left: 6px;
  padding: 0 8px;
  border-radius: var(--r-pill);
  background: rgba(255, 255, 255, .28);
  font-size: 12px;
}

.card {
  background: var(--surface);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-card);
  padding: 26px 28px;
  margin-bottom: 22px;
}

.card-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 20px;
  font-weight: 700;
  margin: 0 0 6px;
}

.card-desc {
  margin: 0 0 20px;
  color: var(--muted);
  font-size: 15px;
}

.h1 {
  font-size: clamp(26px, 4vw, 34px);
  margin: 0 0 10px;
  font-weight: 800;
  letter-spacing: .5px;
}

.gradient-text {
  background: linear-gradient(92deg, var(--coral), var(--peach) 38%, var(--lilac) 72%, var(--sky));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: var(--r-pill);
  font-size: 13px;
  font-weight: 600;
}

.badge-mint { background: var(--mint-soft); color: #0E7A6D; }
.badge-lemon { background: var(--lemon-soft); color: #96650A; }
.badge-sky { background: var(--sky-soft); color: #1B6FC4; }
.badge-lilac { background: var(--lilac-soft); color: #6D4BD1; }
.badge-coral { background: var(--coral-soft); color: var(--coral-dark); }

.btn {
  min-height: 44px;
  padding: 10px 22px;
  border-radius: var(--r-pill);
  font-size: 16px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: transform var(--dur-fast) var(--ease-spring), box-shadow var(--dur-fast), background var(--dur-fast);
}

.btn-primary { background: var(--coral); color: #fff; box-shadow: var(--shadow-coral); }
.btn-primary:hover { transform: translateY(-2px); }
.btn-primary:disabled { opacity: .55; box-shadow: none; transform: none; cursor: not-allowed; }
.btn-mint { background: var(--mint); color: #10403A; }
.btn-mint:hover { transform: translateY(-2px); }
.btn-ghost { background: var(--surface-alt); color: var(--ink-soft); }
.btn-ghost:hover { background: var(--line); }
.btn-sm { min-height: 44px; padding: 6px 16px; font-size: 15px; }

.field { margin-bottom: 18px; }

.label {
  display: block;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--ink);
}

.hint {
  color: var(--muted);
  font-size: 14px;
  margin: 6px 0 0;
}

.input, .textarea, .select {
  width: 100%;
  min-height: 44px;
  padding: 12px 16px;
  border-radius: var(--r-sm);
  border: 1px solid var(--line);
  background: var(--surface-alt);
  font-size: 16px;
  line-height: 1.7;
  color: var(--ink);
  transition: border-color var(--dur-fast), box-shadow var(--dur-fast);
}

.textarea { min-height: 110px; resize: vertical; }

.input:focus, .textarea:focus, .select:focus {
  outline: none;
  border-color: var(--coral);
  box-shadow: 0 0 0 4px rgba(255, 107, 74, .14);
}

.q-block {
  padding: 20px 22px;
  border-radius: var(--r-md);
  background: var(--surface-alt);
  margin-bottom: 16px;
}

.q-title {
  font-weight: 700;
  font-size: 17px;
  margin: 0 0 12px;
  display: flex;
  gap: 10px;
}

.q-index {
  flex: none;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--coral-soft);
  color: var(--coral-dark);
  display: grid;
  place-items: center;
  font-size: 14px;
  font-weight: 700;
}

.keypoints {
  margin: 0 0 12px;
  padding: 12px 16px;
  border-radius: var(--r-sm);
  background: var(--sky-soft);
  color: #1B6FC4;
  font-size: 15px;
  line-height: 1.7;
}

.keypoints summary {
  cursor: pointer;
  min-height: 44px;
  display: flex;
  align-items: center;
  font-weight: 600;
}

.option {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 14px;
  border-radius: var(--r-sm);
  border: 1px solid var(--line);
  background: var(--surface);
  margin-bottom: 10px;
  cursor: pointer;
  min-height: 44px;
  transition: border-color var(--dur-fast), background var(--dur-fast);
}

.option:hover { border-color: var(--coral); }

.option input { margin-top: 6px; width: 18px; height: 18px; accent-color: var(--coral); }
.option.correct { border-color: var(--mint); background: var(--mint-soft); }
.option.wrong { border-color: #F0A08C; background: var(--coral-soft); }

.progress-track {
  height: 12px;
  border-radius: var(--r-pill);
  background: var(--surface-alt);
  overflow: hidden;
  margin: 10px 0 4px;
}

.progress-fill {
  height: 100%;
  border-radius: var(--r-pill);
  background: linear-gradient(90deg, var(--mint), var(--sky));
  transition: width var(--dur-slow, .8s) var(--ease-spring);
}

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

.stage-name { min-width: 72px; font-weight: 600; }

.score-big {
  font-size: 42px;
  font-weight: 800;
  line-height: 1.2;
}

.grade-item {
  border-left: 4px solid var(--coral);
  padding: 12px 16px;
  border-radius: 0 var(--r-sm) var(--r-sm) 0;
  background: var(--surface-alt);
  margin-bottom: 14px;
}

.grade-item .grade-head {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  margin-bottom: 6px;
}

.ul-plain {
  margin: 6px 0 0;
  padding-left: 20px;
  color: var(--ink-soft);
  font-size: 15px;
}

.upload-zone {
  border: 2px dashed var(--line);
  border-radius: var(--r-md);
  padding: 30px 20px;
  text-align: center;
  background: var(--surface-alt);
  transition: border-color var(--dur-fast), background var(--dur-fast);
}

.upload-zone.hot { border-color: var(--coral); background: var(--coral-soft); }

.thumb-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 16px;
}

.thumb {
  position: relative;
  width: 120px;
  border-radius: var(--r-sm);
  overflow: hidden;
  border: 1px solid var(--line);
  background: var(--surface);
}

.thumb img { width: 100%; height: 96px; object-fit: cover; display: block; }

.thumb button {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(46, 42, 59, .78);
  color: #fff;
  font-size: 14px;
  display: grid;
  place-items: center;
}

.thumb button::after {
  content: "";
  position: absolute;
  inset: -8px;
}

.chat {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-bottom: 16px;
}

.bubble {
  max-width: 88%;
  padding: 14px 18px;
  border-radius: var(--r-md);
  white-space: pre-wrap;
  word-break: break-word;
  line-height: 1.8;
  font-size: 16px;
}

.bubble.user {
  align-self: flex-end;
  background: var(--coral);
  color: #fff;
  border-bottom-right-radius: 6px;
}

.bubble.ai {
  align-self: flex-start;
  background: var(--surface-alt);
  border: 1px solid var(--line);
  border-bottom-left-radius: 6px;
}

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

.source-item {
  font-size: 14px;
  color: var(--muted);
  padding: 8px 12px;
  border-radius: var(--r-sm);
  background: var(--surface-alt);
  margin-bottom: 8px;
}

.ask-bar {
  display: flex;
  gap: 10px;
  align-items: flex-end;
  flex-wrap: wrap;
}

.ask-bar .textarea { flex: 1 1 320px; min-height: 56px; }

.mic-btn {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--surface-alt);
  color: var(--ink-soft);
  display: grid;
  place-items: center;
  font-size: 22px;
  border: 1px solid var(--line);
}

.mic-btn.recording {
  background: var(--coral);
  color: #fff;
  box-shadow: 0 0 0 8px rgba(255, 107, 74, .2);
}

.mic-btn:disabled { opacity: .45; cursor: not-allowed; }

.level-track {
  width: 100%;
  height: 6px;
  border-radius: var(--r-pill);
  background: var(--line);
  overflow: hidden;
  margin-top: 8px;
}

.level-fill { height: 100%; background: var(--coral); width: 0; transition: width .1s linear; }

.history-item {
  padding: 14px 16px;
  border-radius: var(--r-md);
  background: var(--surface-alt);
  margin-bottom: 12px;
}

.history-q { font-weight: 600; margin-bottom: 6px; }

.history-a { color: var(--ink-soft); font-size: 15px; }

.empty {
  text-align: center;
  color: var(--muted);
  padding: 30px 10px;
}

.empty .emoji { font-size: 34px; display: block; margin-bottom: 8px; }

.kcard {
  padding: 18px 20px;
  border-radius: var(--r-md);
  background: var(--surface-alt);
  border-left: 4px solid var(--coral);
  margin-bottom: 14px;
}

.kcard-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.kcard-title {
  font-size: 17px;
  font-weight: 700;
}

.kcard-body {
  margin: 0;
  color: var(--ink-soft);
  font-size: 16px;
  line-height: 1.85;
  max-width: 1120px;
}

.kcard-body, .bubble, .history-a, .grade-item, .ask-bar .textarea, .q-block {
  max-width: 1120px;
}

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

/* ---- 确认弹窗（清空学习记录） ---- */
.btn-danger { background: var(--coral); color: #fff; box-shadow: var(--shadow-coral); }
.btn-danger:hover { background: var(--coral-dark); transform: translateY(-2px); }
.btn-danger:disabled { opacity: .55; box-shadow: none; transform: none; cursor: not-allowed; }
.modal-mask {
  position: fixed;
  inset: 0;
  z-index: 70;
  background: rgba(46, 42, 59, .45);
  backdrop-filter: blur(3px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.modal {
  width: 80%;
  max-width: 720px;
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-card);
  overflow: hidden;
}
.modal-narrow { max-width: 560px; width: 100%; }
.modal-head {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 18px 22px;
  border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
}
.modal-title { font-size: 17px; font-weight: 700; color: var(--ink); }
.modal-sub { font-size: 13px; color: var(--muted); margin-top: 2px; }
.modal-body { flex: 1; overflow-y: auto; padding: 18px 22px 26px; }
.modal-body p { margin: 0 0 10px; }
.modal-body .sub { color: var(--muted); font-size: 14px; }
.tips { margin: 0 0 12px; padding-left: 22px; color: var(--ink-soft); }
.tips li { margin-bottom: 6px; line-height: 1.7; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row.end { justify-content: flex-end; }
body.modal-open { overflow: hidden; }

@media (max-width: 1024px) {
  .page, .topbar { max-width: 100%; }
  .page { padding: 0 18px 60px; }
  .topbar { margin: 10px 18px 20px; padding: 10px 16px; }
  .card { padding: 22px 20px; }
  .grid-2 { gap: 12px; }
}

@media (max-width: 760px) {
  .grid-2 { grid-template-columns: 1fr; }
  .tabs { width: 100%; margin-left: 0; }
  .tab { flex: 1; }
  .brand { font-size: 16px; }
  .card { padding: 18px 16px; border-radius: var(--r-md); }
  .ask-bar .textarea { flex: 1 1 100%; }
}
