/* ==========================================================================
   云梯 FDE 备考 · 在线刷题系统
   teal 蓝绿视觉 / 移动端优先 / 零外部资源
   ========================================================================== */

:root {
  --ink: #0B1B3A;
  --teal-900: #0B1B3A;
  --teal-700: #6C4CF1;
  --teal-500: #2E8BF7;
  --teal-300: #C4B5FD;
  --mint: #2F6F68;
  --bg: #F5F7FA;
  --card: #FFFFFF;
  --slate: #64748B;
  --slate-light: #94A3B8;
  --amber: #F59E0B;
  --line: rgba(11,27,58,.10);
  --line-strong: rgba(11,27,58,.18);
  --danger: #DC2626;
  --danger-bg: #FEF2F2;
  --ok: #0E9F6E;
  --ok-bg: #ECFDF5;
  --grad: linear-gradient(135deg, #0B1B3A 0%, #3B2E8F 55%, #6C4CF1 100%);
  --radius: 16px;
  --radius-lg: 22px;
  --shadow-sm: 0 1px 2px rgba(8, 27, 58, 0.06);
  --shadow: 0 6px 20px rgba(8, 27, 58, 0.10);
  --shadow-lg: 0 16px 40px rgba(11, 18, 32, 0.14);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* {
  box-sizing: border-box;
  min-width: 0;
}

html {
  -webkit-text-size-adjust: 100%;
}

html, body {
  margin: 0;
  padding: 0;
  max-width: 100%;
  overflow-x: hidden;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", "PingFang SC", "Hiragino Sans GB", Arial, sans-serif;
  font-size: 15px;
  line-height: 1.6;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, p, ul, ol {
  margin: 0;
}

ul, ol {
  padding: 0;
  list-style: none;
}

button {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
  border: 0;
  background: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

input, select, textarea {
  font-family: inherit;
  font-size: 16px; /* 防 iOS 聚焦缩放 */
  color: var(--ink);
}

a {
  color: var(--teal-700);
  text-decoration: none;
}

[hidden] {
  display: none !important;
}

/* ---------- 通用组件 ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 44px;
  padding: 10px 18px;
  border-radius: 12px;
  font-weight: 600;
  font-size: 15px;
  line-height: 1.2;
  transition: transform 0.08s ease, background 0.15s ease, opacity 0.15s ease;
  white-space: nowrap;
}

.btn:active {
  transform: scale(0.98);
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--grad);
  color: #fff;
  box-shadow: 0 6px 16px rgba(108, 76, 241, 0.22);
}

.btn-outline {
  border: 1px solid var(--line-strong);
  background: #fff;
  color: var(--teal-700);
}

.btn-ghost {
  background: rgba(108, 76, 241, 0.06);
  color: var(--teal-700);
}

.btn-danger {
  background: var(--danger-bg);
  color: var(--danger);
  border: 1px solid #FECACA;
}

.btn-sm {
  min-height: 32px;
  padding: 5px 12px;
  font-size: 13px;
  border-radius: 9px;
}

.btn-block {
  display: flex;
  width: 100%;
}

.card {
  background: var(--card);
  border-radius: var(--radius);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
  padding: 16px;
}

.card + .card {
  margin-top: 12px;
}

.card-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 12px;
}

.card-title .muted {
  font-weight: 400;
  font-size: 12px;
}

.muted {
  color: var(--slate);
}

.small {
  font-size: 12px;
}

.tiny {
  font-size: 11px;
}

.tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.7;
  background: rgba(108, 76, 241, 0.10);
  color: var(--teal-700);
  white-space: nowrap;
}

.tag-gray {
  background: #F1F5F9;
  color: var(--slate);
}

.tag-amber {
  background: rgba(245, 158, 11, 0.14);
  color: #B45309;
}

.tag-danger {
  background: var(--danger-bg);
  color: var(--danger);
}

.tag-ok {
  background: var(--ok-bg);
  color: var(--teal-700);
}

.badge-dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--teal-500);
}

.divider {
  height: 1px;
  background: var(--line);
  margin: 14px 0;
}

.empty {
  padding: 36px 16px;
  text-align: center;
  color: var(--slate);
  font-size: 14px;
}

.empty strong {
  display: block;
  font-size: 16px;
  color: var(--ink);
  margin-bottom: 6px;
}

.ellipsis {
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

/* ---------- 表单 ---------- */

.field {
  display: block;
  margin-bottom: 14px;
}

.field-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--teal-900);
  margin-bottom: 6px;
}

.field-label em {
  font-style: normal;
  font-weight: 400;
  color: var(--slate);
  font-size: 11px;
}

.input, .select, .textarea {
  width: 100%;
  padding: 11px 13px;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background: #fff;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
  appearance: none;
}

.input:focus, .select:focus, .textarea:focus {
  border-color: var(--teal-500);
  box-shadow: 0 0 0 3px rgba(108, 76, 241, 0.16);
}

.textarea {
  min-height: 84px;
  resize: vertical;
  font-size: 14px;
  line-height: 1.6;
}

.select {
  background-image: linear-gradient(45deg, transparent 50%, var(--teal-700) 50%), linear-gradient(135deg, var(--teal-700) 50%, transparent 50%);
  background-position: calc(100% - 17px) 50%, calc(100% - 12px) 50%;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  padding-right: 32px;
}

.form-error {
  margin: -4px 0 12px;
  padding: 9px 12px;
  border-radius: 10px;
  background: var(--danger-bg);
  color: var(--danger);
  font-size: 13px;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

/* ---------- 登录页 ---------- */

.login-wrap {
  min-height: 100vh;
  min-height: 100dvh;
  padding: 28px 16px calc(28px + var(--safe-bottom));
  background:
    radial-gradient(1200px 500px at 10% -10%, rgba(108, 76, 241, 0.28), transparent 60%),
    radial-gradient(900px 420px at 110% 10%, rgba(46, 139, 247, 0.16), transparent 55%),
    var(--bg);
  display: flex;
  align-items: flex-start;
  justify-content: center;
}

.login-card {
  width: 100%;
  max-width: 420px;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(6px);
  border: 1px solid rgba(204, 251, 241, 0.9);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 22px 18px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.brand-mark {
  flex: 0 0 auto;
  width: 46px;
  height: 46px;
  border-radius: 14px;
  background: var(--grad);
  color: #fff;
  font-weight: 800;
  font-size: 16px;
  letter-spacing: 1px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 18px rgba(8, 27, 58, 0.28);
}

.brand-text h1 {
  font-size: 20px;
  font-weight: 800;
  letter-spacing: 0.5px;
  color: var(--teal-900);
  line-height: 1.2;
}

.brand-text p {
  font-size: 12px;
  color: var(--slate);
  margin-top: 2px;
}

.login-points {
  margin: 4px 0 18px;
  padding: 12px 14px;
  border-radius: 12px;
  background: rgba(245, 247, 250, 0.9);
  border: 1px dashed var(--line-strong);
}

.login-points li {
  position: relative;
  padding-left: 16px;
  font-size: 12.5px;
  color: var(--teal-900);
  line-height: 1.9;
}

.login-points li::before {
  content: "";
  position: absolute;
  left: 2px;
  top: 9px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--teal-500);
}

.login-form .input {
  letter-spacing: 1px;
}

.login-help {
  margin-top: 10px;
  font-size: 12px;
  color: var(--slate);
  line-height: 1.7;
}

.deal-hint {
  margin-top: 16px;
  font-size: 12px;
  color: var(--slate);
  text-align: center;
}

.disclaimer {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px dashed var(--line-strong);
  font-size: 11px;
  line-height: 1.7;
  color: var(--slate-light);
  text-align: center;
}

/* ---------- 应用外壳 ---------- */

.app-shell {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 14px;
  background: rgba(245, 247, 250, 0.92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}

.topbar-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 15px;
  color: var(--teal-900);
}

.topbar-logo {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 9px;
  background: var(--grad);
  color: #fff;
  font-size: 11px;
  font-weight: 800;
}

.user-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 52%;
  padding: 6px 10px;
  border-radius: 999px;
  background: #fff;
  border: 1px solid var(--line-strong);
  font-size: 12px;
  font-weight: 600;
  color: var(--teal-700);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.main {
  flex: 1;
  width: 100%;
  max-width: 720px;
  margin: 0 auto;
  padding: 14px 14px calc(84px + var(--safe-bottom));
}

.tab-panel {
  animation: fade-in 0.18s ease;
}

@keyframes fade-in {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: none; }
}

.tabbar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 40;
  display: grid;
  /* 卡密模块不同，底部导航数量会变（学习卡只有 2 项）；auto-fit 让任意数量都均分 */
  grid-template-columns: repeat(auto-fit, minmax(0, 1fr));
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(10px);
  border-top: 1px solid var(--line);
  padding-bottom: var(--safe-bottom);
}

.tab-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-height: 54px;
  font-size: 12px;
  font-weight: 600;
  color: var(--slate);
  position: relative;
}

.tab-btn .tab-ico {
  font-size: 18px;
  line-height: 1;
}

.tab-btn.active {
  color: var(--teal-700);
}

.tab-btn.active::before {
  content: "";
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 22px;
  height: 3px;
  border-radius: 0 0 3px 3px;
  background: var(--grad);
}

.tab-btn .tab-count {
  position: absolute;
  top: 4px;
  right: 50%;
  transform: translateX(20px);
  min-width: 15px;
  height: 15px;
  padding: 0 4px;
  border-radius: 999px;
  background: var(--danger);
  color: #fff;
  font-size: 9px;
  line-height: 15px;
  font-weight: 700;
}

/* ---------- 练习 ---------- */

.filter-bar {
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  gap: 8px;
}

.filter-bar .select {
  font-size: 13px;
  padding: 8px 28px 8px 10px;
  min-height: 38px;
}

.filter-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
}

.practice-progress {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 14px 0 10px;
  font-size: 12px;
  color: var(--slate);
}

.progress-track {
  flex: 1;
  height: 6px;
  border-radius: 999px;
  background: #E6FFFA;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  border-radius: 999px;
  background: var(--grad);
  transition: width 0.25s ease;
}

.q-card {
  padding: 16px;
}

.q-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-bottom: 10px;
}

.q-stem {
  font-size: 16.5px;
  line-height: 1.72;
  font-weight: 600;
  color: var(--ink);
  word-break: break-word;
}

.q-keypoint {
  margin-top: 8px;
  font-size: 11.5px;
  color: var(--slate);
}

.options {
  margin-top: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.option {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  width: 100%;
  padding: 12px 13px;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background: #fff;
  text-align: left;
  font-size: 14.5px;
  line-height: 1.6;
  transition: border-color 0.12s ease, background 0.12s ease;
}

.option:active {
  background: #F5F7FA;
}

.option .opt-key {
  flex: 0 0 24px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #F1F5F9;
  color: var(--slate);
  font-size: 12.5px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 1px;
}

.option.selected {
  border-color: var(--teal-500);
  background: rgba(245, 247, 250, 0.9);
  box-shadow: 0 0 0 1px var(--teal-500) inset;
}

.option.selected .opt-key {
  background: var(--teal-500);
  color: #fff;
}

.option.correct {
  border-color: var(--teal-500);
  background: var(--ok-bg);
}

.option.correct .opt-key {
  background: var(--teal-700);
  color: #fff;
}

.option.wrong {
  border-color: #FCA5A5;
  background: var(--danger-bg);
}

.option.wrong .opt-key {
  background: var(--danger);
  color: #fff;
}

.option.disabled {
  opacity: 0.92;
  cursor: default;
}

.answer-actions {
  display: flex;
  gap: 10px;
  margin-top: 16px;
}

.answer-actions .btn {
  flex: 1;
}

.result-box {
  margin-top: 14px;
  border-radius: 14px;
  border: 1px solid var(--line-strong);
  background: #fff;
  overflow: hidden;
}

.result-box.ok {
  border-color: #A7F3D0;
}

.result-box.bad {
  border-color: #FECACA;
}

.result-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 11px 14px;
  font-weight: 700;
  font-size: 14px;
  background: var(--ok-bg);
  color: var(--teal-700);
}

.result-box.bad .result-head {
  background: var(--danger-bg);
  color: var(--danger);
}

.result-body {
  padding: 12px 14px 14px;
  font-size: 13.5px;
  line-height: 1.75;
  color: #1E293B;
}

.answer-line {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 8px;
  font-size: 13px;
}

.answer-line b {
  color: var(--teal-700);
}

.explain {
  color: #334155;
  white-space: pre-wrap;
  word-break: break-word;
}

.explain-title {
  font-weight: 700;
  color: var(--teal-900);
  margin: 8px 0 4px;
  font-size: 13px;
}

.q-tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 14px;
}

.note-box {
  margin-top: 10px;
}

.note-box .textarea {
  min-height: 64px;
}

.note-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 8px;
}

.practice-done {
  text-align: center;
  padding: 26px 18px;
}

.practice-done .big-num {
  font-size: 34px;
  font-weight: 800;
  color: var(--teal-700);
  line-height: 1.2;
}

/* ---------- 模考 ---------- */

.exam-rules li {
  position: relative;
  padding-left: 16px;
  font-size: 13px;
  color: #334155;
  line-height: 1.9;
}

.exam-rules li::before {
  content: "";
  position: absolute;
  left: 2px;
  top: 10px;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--teal-500);
}

.exam-bar {
  position: sticky;
  top: 52px;
  z-index: 25;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  margin: -2px -4px 10px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid var(--line-strong);
  box-shadow: var(--shadow-sm);
}

.exam-timer {
  font-variant-numeric: tabular-nums;
  font-weight: 800;
  font-size: 16px;
  color: var(--teal-700);
  letter-spacing: 0.5px;
}

.exam-timer.warn {
  color: var(--amber);
}

.exam-timer.danger {
  color: var(--danger);
  animation: pulse 1s infinite;
}

@keyframes pulse {
  50% { opacity: 0.55; }
}

.exam-bar .spacer {
  flex: 1;
}

.exam-bar .progress-mini {
  font-size: 12px;
  color: var(--slate);
}

.score-hero {
  text-align: center;
  padding: 20px 16px 16px;
  border-radius: var(--radius-lg);
  background: var(--grad);
  color: #fff;
  box-shadow: var(--shadow);
}

.score-hero.fail {
  background: linear-gradient(135deg, #475569 0%, #64748B 60%, #94A3B8 100%);
}

.score-hero .score {
  font-size: 46px;
  font-weight: 800;
  line-height: 1;
  letter-spacing: -1px;
}

.score-hero .score small {
  font-size: 14px;
  font-weight: 600;
  opacity: 0.8;
}

.score-hero .verdict {
  margin-top: 8px;
  font-size: 14px;
  font-weight: 700;
}

.score-meta {
  display: flex;
  justify-content: center;
  gap: 18px;
  margin-top: 12px;
  font-size: 12px;
  opacity: 0.92;
}

.domain-row {
  display: grid;
  grid-template-columns: 92px 1fr 44px;
  align-items: center;
  gap: 8px;
  margin-bottom: 9px;
  font-size: 12.5px;
}

.domain-row .bar-track {
  height: 8px;
  border-radius: 999px;
  background: #F1F5F9;
  overflow: hidden;
}

.domain-row .bar-fill {
  height: 100%;
  border-radius: 999px;
  background: var(--grad);
}

.domain-row .bar-fill.warn {
  background: linear-gradient(90deg, #F59E0B, #FBBF24);
}

.domain-row .bar-fill.bad {
  background: linear-gradient(90deg, #DC2626, #F87171);
}

.domain-row .num {
  text-align: right;
  font-variant-numeric: tabular-nums;
  color: var(--slate);
}

.review-item {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  margin-bottom: 10px;
  overflow: hidden;
}

.review-head {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 11px 12px;
  font-size: 13.5px;
  line-height: 1.6;
  cursor: pointer;
}

.review-head .idx {
  flex: 0 0 22px;
  height: 22px;
  border-radius: 50%;
  background: #F1F5F9;
  color: var(--slate);
  font-size: 11px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

.review-item.ok .review-head .idx {
  background: var(--ok-bg);
  color: var(--teal-700);
}

.review-item.bad .review-head .idx {
  background: var(--danger-bg);
  color: var(--danger);
}

.review-body {
  padding: 0 12px 12px;
  font-size: 13px;
  line-height: 1.75;
  color: #334155;
  border-top: 1px dashed var(--line);
  padding-top: 10px;
}

.review-body .opt-line {
  padding: 3px 0;
}

.review-body .opt-line.correct {
  color: var(--teal-700);
  font-weight: 700;
}

.review-body .opt-line.picked-wrong {
  color: var(--danger);
}

.history-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 12px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #fff;
  margin-bottom: 8px;
  width: 100%;
  text-align: left;
}

.history-item .h-score {
  font-size: 20px;
  font-weight: 800;
  color: var(--teal-700);
  font-variant-numeric: tabular-nums;
  flex: 0 0 auto;
}

.history-item .h-score.fail {
  color: var(--slate);
}

.history-item .h-info {
  flex: 1;
  font-size: 12px;
  color: var(--slate);
  line-height: 1.5;
}

/* ---------- 答题卡 ---------- */

.answer-card-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 8px;
}

.ac-cell {
  aspect-ratio: 1;
  min-height: 40px;
  border-radius: 9px;
  border: 1px solid var(--line-strong);
  background: #fff;
  color: var(--slate);
  font-size: 13px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

.ac-cell.done {
  background: rgba(108, 76, 241, 0.12);
  border-color: var(--teal-500);
  color: var(--teal-700);
}

.ac-cell.current {
  outline: 2px solid var(--teal-500);
  outline-offset: 1px;
}

/* ---------- 列表（错题/收藏/笔记） ---------- */

.list-item {
  display: block;
  width: 100%;
  text-align: left;
  padding: 12px 13px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #fff;
  margin-bottom: 9px;
}

.list-item:active {
  background: #F8FFFD;
}

.list-item .li-top {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 5px;
}

.list-item .li-stem {
  font-size: 14px;
  line-height: 1.6;
  color: #1E293B;
}

.list-item .li-note {
  margin-top: 6px;
  padding: 7px 9px;
  border-radius: 8px;
  background: rgba(245, 158, 11, 0.10);
  color: #92400E;
  font-size: 12.5px;
  line-height: 1.6;
}

.list-item .li-meta {
  margin-top: 6px;
  font-size: 11.5px;
  color: var(--slate-light);
}

/* ---------- 统计 ---------- */

.metric-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.metric {
  padding: 13px 14px;
  border-radius: 14px;
  background: #fff;
  border: 1px solid var(--line);
}

.metric .m-label {
  font-size: 12px;
  color: var(--slate);
}

.metric .m-value {
  font-size: 26px;
  font-weight: 800;
  color: var(--teal-700);
  line-height: 1.3;
  font-variant-numeric: tabular-nums;
}

.metric .m-value small {
  font-size: 12px;
  font-weight: 600;
  color: var(--slate);
}

.metric .m-sub {
  font-size: 11px;
  color: var(--slate-light);
}

.bars {
  display: flex;
  align-items: flex-end;
  gap: 5px;
  height: 92px;
  padding-top: 8px;
}

.bars .bar-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: center;
  gap: 4px;
  height: 100%;
}

.bars .bar {
  width: 100%;
  border-radius: 5px 5px 2px 2px;
  background: linear-gradient(180deg, #2E8BF7, #6C4CF1);
  min-height: 2px;
  transition: height 0.3s ease;
}

.bars .bar-label {
  font-size: 9px;
  color: var(--slate-light);
  white-space: nowrap;
}

.trend-canvas {
  display: block;
  width: 100%;
  height: 150px;
}

.legend {
  display: flex;
  gap: 14px;
  font-size: 11.5px;
  color: var(--slate);
}

.legend i {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 2px;
  margin-right: 4px;
  background: var(--teal-500);
}

.legend i.amber {
  background: var(--amber);
}

/* ---------- 我的 ---------- */

.profile-head {
  display: flex;
  align-items: center;
  gap: 12px;
}

.avatar {
  width: 52px;
  height: 52px;
  border-radius: 16px;
  background: var(--grad);
  color: #fff;
  font-weight: 800;
  font-size: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
}

.kv {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 0;
  font-size: 13.5px;
  border-bottom: 1px dashed var(--line);
}

.kv:last-child {
  border-bottom: 0;
}

.kv .k {
  color: var(--slate);
  flex: 0 0 auto;
}

.kv .v {
  text-align: right;
  word-break: break-all;
}

.device-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 0;
  border-bottom: 1px dashed var(--line);
  font-size: 13px;
}

.device-item:last-child {
  border-bottom: 0;
}

.device-item .d-name {
  flex: 1;
}

/* ---------- 水印 ---------- */

.watermark {
  position: fixed;
  inset: 0;
  z-index: 9999;
  pointer-events: none;
  user-select: none;
  opacity: 1;
  background-repeat: repeat;
  background-position: 0 0;
  display: none;
}

.watermark.show {
  display: block;
}

/* ---------- 弹层 / Toast ---------- */

.modal-root {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  background: rgba(11, 18, 32, 0.42);
  padding: 0;
}

.modal {
  width: 100%;
  max-width: 560px;
  max-height: 86vh;
  overflow-y: auto;
  background: #fff;
  border-radius: 20px 20px 0 0;
  padding: 18px 16px calc(18px + var(--safe-bottom));
  animation: slide-up 0.2s ease;
}

@keyframes slide-up {
  from { transform: translateY(24px); opacity: 0.6; }
  to { transform: none; opacity: 1; }
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.modal-head h3 {
  font-size: 17px;
  font-weight: 800;
  color: var(--teal-900);
}

.modal-close {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #F1F5F9;
  color: var(--slate);
  font-size: 18px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(96px + var(--safe-bottom));
  transform: translateX(-50%);
  z-index: 2000;
  max-width: 86%;
  padding: 10px 16px;
  border-radius: 999px;
  background: rgba(11, 18, 32, 0.88);
  color: #fff;
  font-size: 13px;
  text-align: center;
  box-shadow: var(--shadow);
  animation: toast-in 0.18s ease;
}

@keyframes toast-in {
  from { opacity: 0; transform: translate(-50%, 6px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}

/* ---------- 后台 ---------- */

.admin-body {
  background: #F8FAFC;
}

.admin-wrap {
  min-height: 100vh;
  min-height: 100dvh;
}

.admin-login {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px 16px;
  background:
    radial-gradient(900px 400px at 0% 0%, rgba(108, 76, 241, 0.26), transparent 60%),
    radial-gradient(800px 360px at 100% 100%, rgba(46, 139, 247, 0.14), transparent 55%),
    #F5F7FA;
}

.admin-login-card {
  width: 100%;
  max-width: 380px;
  background: #fff;
  border-radius: var(--radius-lg);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  padding: 24px 20px;
}

.admin-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 14px;
  background: #fff;
  border-bottom: 1px solid #E2E8F0;
}

.admin-header h1 {
  font-size: 15px;
  font-weight: 800;
  color: var(--teal-900);
}

.admin-shell {
  max-width: 1080px;
  margin: 0 auto;
  padding: 14px 12px 40px;
}

.admin-tabs {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 4px;
  margin-bottom: 12px;
  -webkit-overflow-scrolling: touch;
}

.admin-tab {
  flex: 0 0 auto;
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  background: #fff;
  color: var(--teal-700);
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
}

.admin-tab.active {
  background: var(--grad);
  color: #fff;
  border-color: transparent;
}

.admin-panel {
  animation: fade-in 0.18s ease;
}

.metric-grid-4 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

@media (min-width: 720px) {
  .metric-grid-4 {
    grid-template-columns: repeat(4, 1fr);
  }
  .metric-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

.table-wrap {
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
}

table.data {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
  white-space: nowrap;
}

table.data th,
table.data td {
  padding: 9px 10px;
  text-align: left;
  border-bottom: 1px solid #F1F5F9;
}

table.data th {
  background: #F8FAFC;
  color: var(--slate);
  font-weight: 700;
  position: sticky;
  top: 0;
}

table.data tr:last-child td {
  border-bottom: 0;
}

table.data td.wrap {
  white-space: normal;
  min-width: 160px;
}

.admin-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-bottom: 10px;
}

.admin-toolbar .input,
.admin-toolbar .select {
  width: auto;
  min-width: 120px;
  padding: 8px 10px;
  font-size: 13px;
  border-radius: 9px;
}

.admin-toolbar .input.grow {
  flex: 1;
  min-width: 160px;
}

.code-output {
  width: 100%;
  min-height: 150px;
  font-family: ui-monospace, SFMono-Regular, Consolas, "Courier New", monospace;
  font-size: 12px;
  line-height: 1.7;
  padding: 12px;
  border-radius: 12px;
  border: 1px solid var(--line-strong);
  background: #F8FFFD;
  color: #134E4A;
  resize: vertical;
}

.stat-bars .domain-row {
  grid-template-columns: 150px 1fr 60px;
}

.pagination {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 10px;
  font-size: 12px;
  color: var(--slate);
}

/* ---------- 响应式 ---------- */

@media (min-width: 560px) {
  .tabbar {
    grid-template-columns: repeat(auto-fit, minmax(0, 1fr));
  }
  .modal {
    border-radius: 20px;
    margin-bottom: 24px;
  }
  .answer-card-grid {
    grid-template-columns: repeat(10, 1fr);
  }
}

@media (min-width: 768px) {
  body {
    font-size: 15.5px;
  }
  .main {
    padding-top: 20px;
  }
  .login-card {
    padding: 28px 26px;
  }
  .filter-bar {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* 深色模式跟随（系统级），仅微调背景，保持 teal 主题 */
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #F5F7FA;
  }
  body {
    color-scheme: light;
  }
}

/* 打印时隐藏水印与导航（防止整卷导出） */
@media print {
  .watermark, .tabbar, .topbar, .exam-bar {
    display: none !important;
  }
}

/* ==========================================================================
   免登录试看页（/demo）
   ========================================================================== */

.demo-entry {
  margin-top: 14px;
}

.demo-entry-hint {
  text-align: center;
  margin-top: 8px;
}

.demo-body {
  background:
    radial-gradient(900px 420px at 0% 0%, rgba(108, 76, 241, 0.24), transparent 58%),
    radial-gradient(800px 380px at 100% 6%, rgba(108, 76, 241, 0.16), transparent 55%),
    var(--bg);
}

.demo-wrap {
  min-height: 100vh;
  min-height: 100dvh;
}

.demo-head {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 14px;
  background: rgba(245, 247, 250, 0.94);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}

.demo-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
}

.demo-brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.3;
}

.demo-brand-text b {
  font-size: 15px;
  color: var(--teal-900);
}

.demo-brand-text small {
  font-size: 11px;
  color: var(--slate);
}

.demo-shell {
  width: 100%;
  max-width: 720px;
  margin: 0 auto;
  padding: 14px 14px calc(28px + var(--safe-bottom));
}

.demo-intro-text {
  font-size: 13.5px;
  line-height: 1.75;
  color: #334155;
}

.demo-rules li {
  font-size: 12.5px;
}

.demo-q {
  margin-top: 12px;
}

.demo-q .answer-actions {
  margin-top: 14px;
}

.demo-cta {
  margin-top: 16px;
  border: 1px solid transparent;
  background:
    linear-gradient(180deg, rgba(245, 247, 250, 0.96), #FFFFFF) padding-box,
    var(--grad) border-box;
  box-shadow: var(--shadow);
}

.demo-cta.done {
  border-color: var(--teal-300);
}

.demo-cta-head {
  display: flex;
  gap: 6px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}

.demo-cta h3 {
  font-size: 18px;
  font-weight: 800;
  color: var(--teal-900);
  margin: 0 0 6px;
}

.demo-cta p {
  font-size: 13px;
  line-height: 1.75;
  color: #334155;
  margin: 0 0 10px;
}

.demo-shop {
  display: block;
  padding: 10px 14px;
  margin: 12px 0;
  border-radius: 12px;
  background: rgba(245, 158, 11, 0.12);
  color: #92400E;
  font-size: 15px;
  font-weight: 800;
  text-align: center;
  letter-spacing: 0.5px;
}

.demo-cta-note {
  margin: 10px 0 0;
  font-size: 11px;
  line-height: 1.7;
  color: var(--slate-light);
}

.demo-footer {
  margin-top: 22px;
  text-align: center;
  font-size: 11.5px;
  color: var(--slate);
  line-height: 1.8;
}

.demo-watermark {
  background-repeat: repeat;
  opacity: 1;
}

@media (min-width: 768px) {
  .demo-shell {
    padding-top: 20px;
  }
}

@media print {
  .demo-watermark,
  .demo-head {
    display: none !important;
  }
}


/* ============ 品牌令牌应用（2026-11，一起学AI × 云梯FDE） ============ */
:root{
  --brand-navy:#0B1B3A; --brand-indigo:#3B2E8F; --brand-violet:#6C4CF1; --brand-blue:#2E8BF7;
  --cta-accent:#2F6F68; --cta-accent-ink:#FFFFFF; --promo-gold:#FFB020; --promo-gold-ink:#4A2E00;
  --surface-page:#F5F7FA; --surface-card:#FFFFFF; --text-primary:#1A1D24; --text-secondary:#6B7280;
  --border-subtle:rgba(11,27,58,.10); --shadow-cta:0 8px 22px rgba(47,111,104,.32);
}
body{background:var(--surface-page);color:var(--text-primary)}
.brand-text h1{color:var(--brand-violet)}
.btn-primary{background:var(--cta-accent);color:var(--cta-accent-ink);box-shadow:var(--shadow-cta)}
.btn-primary:hover{background:#28605A}
.tab-btn.active{color:var(--brand-violet)}
.tab-btn.active::before{background:var(--cta-accent)}
.progress-fill{background:var(--brand-violet)}
.admin-tab.active{color:var(--brand-violet);border-color:var(--brand-violet)}
.tag-amber{background:#FFF3D6;color:var(--promo-gold-ink)}

/* Logo 用头像同款墨绿底 */
.brand-mark,.topbar-logo{background:linear-gradient(135deg,#2F6F68,#3E8B82)!important;color:#fff;box-shadow:0 8px 18px rgba(47,111,104,.28)!important}
.demo-brand .brand-mark{background:linear-gradient(135deg,#081B3A,#3B2E8F)!important}


/* ===== FDE 工程师感配色（Navy/Indigo/Violet/Mint）===== */
:root{
  --brand-navy:#081B3A; --brand-indigo:#3B2E8F; --brand-violet:#6C4CF1; --brand-blue:#2E8BF7;
  --cta-accent:#00E5C0; --cta-accent-ink:#081B3A; --mint:#00E5C0;
  --surface-page:#F5F7FA; --text-primary:#1A1D24; --text-secondary:#6B7280;
  --grad:linear-gradient(135deg,#081B3A 0%,#3B2E8F 55%,#6C4CF1 100%);
}
body{background:#F5F7FA;color:#1A1D24}
.btn-primary{background:#00E5C0;color:#081B3A;box-shadow:0 8px 22px rgba(0,229,192,.32)}
.btn-primary:hover{background:#00d1af}
.brand-mark,.topbar-logo{background:linear-gradient(135deg,#081B3A,#3B2E8F)!important;box-shadow:0 8px 18px rgba(8,27,58,.28)!important}
.brand-text h1{color:#6C4CF1}
.tab-btn.active{color:#6C4CF1}
.progress-fill{background:#6C4CF1}
code,.mono,.tag-mono{font-family:var(--font-mono)}
