/* ==========================================================================
   中级经济师刷题系统 — 样式表
   移动优先（~390px），无外部依赖，无构建步骤。
   ========================================================================== */

:root {
  --bg: #f2f5f4;
  --surface: #ffffff;
  --surface-2: #f7faf9;
  --text: #16211d;
  --text-soft: #41524c;
  --muted: #6b7d77;
  --line: #dde5e2;
  --line-strong: #c6d2ce;

  --brand: #1f6f5c;
  --brand-strong: #175a4a;
  --brand-tint: #e7f2ef;
  --brand-ink: #ffffff;

  --ok: #157f52;
  --ok-tint: #e6f4ec;
  --warn: #a86400;
  --warn-tint: #fdf1dd;
  --err: #b3342a;
  --err-tint: #fbeae8;
  --blank: #5d6b76;
  --blank-tint: #edf1f4;

  --heat-0: #e6ebe9;
  --heat-1: #b9dccf;
  --heat-2: #7cc3a9;
  --heat-3: #3f9c7c;
  --heat-4: #1f6f5c;

  --radius: 14px;
  --radius-sm: 10px;
  --radius-lg: 20px;
  --shadow: 0 1px 2px rgba(16, 32, 27, .06), 0 6px 18px rgba(16, 32, 27, .05);
  --shadow-sm: 0 1px 2px rgba(16, 32, 27, .07);

  --pad: 16px;
  --tabbar-h: 62px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);

  --font: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC",
          "Source Han Sans SC", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e1613;
    --surface: #17211d;
    --surface-2: #1d2925;
    --text: #e9f1ee;
    --text-soft: #c3d2cd;
    --muted: #93a6a0;
    --line: #26332e;
    --line-strong: #35443e;

    --brand: #4ec49b;
    --brand-strong: #6ad4ae;
    --brand-tint: #14312a;
    --brand-ink: #06231a;

    --ok: #5ecb96;
    --ok-tint: #123026;
    --warn: #e0a33f;
    --warn-tint: #33260f;
    --err: #f08a80;
    --err-tint: #3a1c19;
    --blank: #a6b4bd;
    --blank-tint: #232c31;

    --heat-0: #1e2a26;
    --heat-1: #24493e;
    --heat-2: #2f7a62;
    --heat-3: #3fa57f;
    --heat-4: #5ecb96;

    --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 6px 18px rgba(0, 0, 0, .3);
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .35);
  }
}

* { box-sizing: border-box; }
* { min-width: 0; }

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

html, body {
  margin: 0;
  padding: 0;
  max-width: 100%;
  overflow-x: hidden;
}

body {
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.65;
  letter-spacing: .01em;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
}

h1, h2, h3, h4 { margin: 0; font-weight: 700; line-height: 1.35; letter-spacing: .01em; }
h1 { font-size: 1.375rem; }
h2 { font-size: 1.125rem; }
h3 { font-size: 1rem; }
h4 { font-size: .9375rem; }
p { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--brand); }
[hidden] { display: none !important; }

:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
  border-radius: 6px;
}

/* --------------------------------------------------------------------------
   Layout
   -------------------------------------------------------------------------- */
.app-main {
  max-width: 760px;
  margin: 0 auto;
  padding: var(--pad);
  padding-top: calc(var(--pad) + var(--safe-t));
  padding-bottom: calc(var(--tabbar-h) + var(--safe-b) + 28px);
}

.view { display: flex; flex-direction: column; gap: 14px; }
.view-narrow { max-width: 640px; }

.stack { display: flex; flex-direction: column; gap: 12px; }
.row { display: flex; align-items: center; gap: 10px; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.wrap { flex-wrap: wrap; }
.grow { flex: 1 1 auto; min-width: 0; }
.center { text-align: center; }
.right { text-align: right; }
.mt { margin-top: 12px; }
.mb { margin-bottom: 12px; }
.nowrap { white-space: nowrap; }

/* --------------------------------------------------------------------------
   Boot / offline
   -------------------------------------------------------------------------- */
.boot-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  min-height: 60vh;
  color: var(--muted);
}

.spinner {
  width: 30px;
  height: 30px;
  border: 3px solid var(--line);
  border-top-color: var(--brand);
  border-radius: 50%;
  animation: spin .8s linear infinite;
  flex: none;
}

@keyframes spin { to { transform: rotate(360deg); } }

@media (prefers-reduced-motion: reduce) {
  .spinner { animation-duration: 2s; }
  * { scroll-behavior: auto !important; }
}

.offline-banner {
  position: sticky;
  top: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  padding-top: calc(8px + var(--safe-t));
  background: var(--warn-tint);
  color: var(--warn);
  border-bottom: 1px solid var(--line);
  font-size: .8125rem;
  font-weight: 600;
}

.offline-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
  flex: none;
}

/* --------------------------------------------------------------------------
   Cards & sections
   -------------------------------------------------------------------------- */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
  box-shadow: var(--shadow-sm);
}

.card-flat { box-shadow: none; }
.card-brand { border-color: var(--brand); background: var(--brand-tint); }
.card-tight { padding: 12px; }

.card-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.card-title { font-size: .9375rem; font-weight: 700; letter-spacing: .02em; }
.card-sub { font-size: .8125rem; color: var(--muted); }

.section-label {
  font-size: .8125rem;
  font-weight: 700;
  color: var(--muted);
  letter-spacing: .06em;
  margin-top: 4px;
}

.divider { height: 1px; background: var(--line); margin: 12px 0; }

/* --------------------------------------------------------------------------
   Buttons
   -------------------------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 44px;
  padding: 10px 16px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  font-size: .9375rem;
  font-weight: 600;
  cursor: pointer;
  text-align: center;
  transition: transform .06s ease, background .15s ease, border-color .15s ease;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.btn:active:not(:disabled) { transform: scale(.985); }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.btn-primary {
  background: var(--brand);
  border-color: var(--brand);
  color: var(--brand-ink);
}

.btn-ghost { background: transparent; border-color: var(--line-strong); color: var(--text-soft); }
.btn-danger { background: var(--err-tint); border-color: var(--err); color: var(--err); }
.btn-block { width: 100%; }
.btn-sm { min-height: 36px; padding: 6px 12px; font-size: .8125rem; }

.btn-xl {
  min-height: 58px;
  font-size: 1.0625rem;
  border-radius: var(--radius);
  letter-spacing: .04em;
}

.btn-group { display: flex; gap: 8px; flex-wrap: wrap; }
.btn-group > .btn { flex: 1 1 120px; }

/* --------------------------------------------------------------------------
   Forms
   -------------------------------------------------------------------------- */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; }
.field label { font-size: .8125rem; font-weight: 600; color: var(--text-soft); }
.field-hint { font-size: .75rem; color: var(--muted); }
.field-error { font-size: .8125rem; color: var(--err); font-weight: 600; }

.input, .select, .textarea {
  width: 100%;
  min-height: 46px;
  padding: 10px 12px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  font-size: 1rem;
  appearance: none;
}

.select {
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%),
                    linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 18px) 20px, calc(100% - 13px) 20px;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  padding-right: 34px;
}

.textarea { min-height: 80px; resize: vertical; line-height: 1.6; }

.input:focus, .select:focus, .textarea:focus {
  border-color: var(--brand);
  outline: 2px solid var(--brand-tint);
  outline-offset: 0;
}

.field-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 12px;
}

.check-row {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  font-size: .875rem;
  cursor: pointer;
}

.check-row input { width: 20px; height: 20px; accent-color: var(--brand); flex: none; }

.chapter-picker {
  max-height: 240px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 2px;
  -webkit-overflow-scrolling: touch;
}

/* --------------------------------------------------------------------------
   Metrics
   -------------------------------------------------------------------------- */
.metrics {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.metric {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  box-shadow: var(--shadow-sm);
}

.metric-label { font-size: .75rem; color: var(--muted); font-weight: 600; }
.metric-value { font-size: 1.5rem; font-weight: 700; line-height: 1.2; font-variant-numeric: tabular-nums; }
.metric-value small { font-size: .8125rem; font-weight: 600; color: var(--muted); margin-left: 2px; }
.metric-sub { font-size: .75rem; color: var(--muted); }

/* --------------------------------------------------------------------------
   Progress
   -------------------------------------------------------------------------- */
.progress-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  font-size: .875rem;
  margin-bottom: 6px;
}

.progress-head .num { font-variant-numeric: tabular-nums; font-weight: 700; }

.progress {
  height: 10px;
  border-radius: 999px;
  background: var(--line);
  overflow: hidden;
}

.progress > i {
  display: block;
  height: 100%;
  width: 0;
  border-radius: 999px;
  background: var(--brand);
  transition: width .3s ease;
}

.progress.is-ok > i { background: var(--ok); }
.progress.is-warn > i { background: var(--warn); }
.progress.is-err > i { background: var(--err); }

/* --------------------------------------------------------------------------
   Chips, badges, stars
   -------------------------------------------------------------------------- */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 9px;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  font-size: .75rem;
  font-weight: 600;
  color: var(--text-soft);
  white-space: nowrap;
}

.chip-brand { background: var(--brand-tint); border-color: var(--brand); color: var(--brand); }
.chip-ok { background: var(--ok-tint); border-color: var(--ok); color: var(--ok); }
.chip-warn { background: var(--warn-tint); border-color: var(--warn); color: var(--warn); }
.chip-err { background: var(--err-tint); border-color: var(--err); color: var(--err); }

.chips { display: flex; flex-wrap: wrap; gap: 6px; }

.stars { color: var(--warn); letter-spacing: 1px; font-size: .8125rem; }

/* --------------------------------------------------------------------------
   Banners / states
   -------------------------------------------------------------------------- */
.banner {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: var(--surface-2);
  font-size: .875rem;
}

.banner-ok { background: var(--ok-tint); border-color: var(--ok); color: var(--ok); }
.banner-warn { background: var(--warn-tint); border-color: var(--warn); color: var(--warn); }
.banner-err { background: var(--err-tint); border-color: var(--err); color: var(--err); }
.banner-brand { background: var(--brand-tint); border-color: var(--brand); color: var(--brand); }
.banner-strong { font-weight: 700; }
.banner-body { color: var(--text-soft); }
.banner-ok .banner-body, .banner-warn .banner-body,
.banner-err .banner-body, .banner-brand .banner-body { color: inherit; opacity: .9; }

.state-block {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 28px 16px;
  text-align: center;
  color: var(--muted);
  background: var(--surface);
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
}

.state-title { font-weight: 700; color: var(--text); }
.state-desc { font-size: .875rem; max-width: 34ch; }

.async-block { display: block; }

/* --------------------------------------------------------------------------
   Toast
   -------------------------------------------------------------------------- */
.toast-host {
  position: fixed;
  left: 0;
  right: 0;
  bottom: calc(var(--tabbar-h) + var(--safe-b) + 14px);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  z-index: 90;
  pointer-events: none;
  padding: 0 12px;
}

.toast {
  max-width: min(92vw, 460px);
  padding: 10px 16px;
  border-radius: 999px;
  background: #22312c;
  color: #f2f7f5;
  font-size: .875rem;
  font-weight: 600;
  box-shadow: var(--shadow);
  animation: toast-in .18s ease-out;
}

.toast-ok { background: var(--ok); color: #fff; }
.toast-err { background: var(--err); color: #fff; }

@keyframes toast-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}

/* --------------------------------------------------------------------------
   Tab bar
   -------------------------------------------------------------------------- */
.tabbar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 80;
  display: flex;
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: saturate(1.4) blur(12px);
  -webkit-backdrop-filter: saturate(1.4) blur(12px);
  border-top: 1px solid var(--line);
  padding-bottom: var(--safe-b);
}

.tab {
  flex: 1 1 0;
  min-height: var(--tabbar-h);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  border: 0;
  background: none;
  color: var(--muted);
  font-size: .6875rem;
  font-weight: 600;
  cursor: pointer;
  padding: 6px 2px;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.tab-icon { font-size: 1.25rem; line-height: 1.2; }
.tab[aria-current="page"] { color: var(--brand); }
.tab[aria-current="page"] .tab-icon { transform: translateY(-1px); }

/* --------------------------------------------------------------------------
   Auth screen
   -------------------------------------------------------------------------- */
.auth-screen {
  max-width: 440px;
  margin: 0 auto;
  padding: calc(24px + var(--safe-t)) 16px calc(24px + var(--safe-b));
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-height: 100dvh;
  justify-content: center;
}

.auth-brand { text-align: center; display: flex; flex-direction: column; gap: 4px; }
.auth-logo {
  width: 56px;
  height: 56px;
  margin: 0 auto 6px;
  border-radius: 16px;
  background: var(--brand);
  color: var(--brand-ink);
  display: grid;
  place-items: center;
  font-size: 1.5rem;
  font-weight: 700;
}
.auth-title { font-size: 1.25rem; }
.auth-sub { font-size: .875rem; color: var(--muted); }

.segmented {
  display: flex;
  padding: 4px;
  gap: 4px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
}

.segmented button {
  flex: 1 1 0;
  min-height: 40px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font-weight: 700;
  font-size: .875rem;
  cursor: pointer;
}

.segmented button[aria-pressed="true"] {
  background: var(--surface);
  color: var(--brand);
  box-shadow: var(--shadow-sm);
}

/* --------------------------------------------------------------------------
   Drill
   -------------------------------------------------------------------------- */
.drill-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}

.q-card { display: flex; flex-direction: column; gap: 12px; }

.q-meta { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }

.q-stem {
  font-size: 1.0625rem;
  line-height: 1.7;
  font-weight: 600;
  overflow-wrap: anywhere;
}

.case-material {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-left: 3px solid var(--brand);
  border-radius: var(--radius-sm);
  padding: 12px;
  font-size: .9375rem;
  line-height: 1.75;
  color: var(--text-soft);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.options { display: flex; flex-direction: column; gap: 10px; }

.opt {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  width: 100%;
  min-height: 52px;
  padding: 12px 14px;
  border: 1.5px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  text-align: left;
  cursor: pointer;
  font-size: .9375rem;
  line-height: 1.6;
  color: var(--text);
  transition: border-color .12s ease, background .12s ease;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.opt:active:not(:disabled) { background: var(--surface-2); }
.opt:disabled { cursor: default; }

.opt-key {
  flex: none;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 1.5px solid var(--line-strong);
  display: grid;
  place-items: center;
  font-size: .8125rem;
  font-weight: 700;
  color: var(--text-soft);
  background: var(--surface-2);
}

.opt-text { flex: 1 1 auto; overflow-wrap: anywhere; }

.opt.is-selected { border-color: var(--brand); background: var(--brand-tint); }
.opt.is-selected .opt-key { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }

.opt.is-correct { border-color: var(--ok); background: var(--ok-tint); }
.opt.is-correct .opt-key { background: var(--ok); border-color: var(--ok); color: #fff; }

.opt.is-wrong { border-color: var(--err); background: var(--err-tint); }
.opt.is-wrong .opt-key { background: var(--err); border-color: var(--err); color: #fff; }

.opt.is-missed { border-color: var(--warn); border-style: dashed; background: var(--warn-tint); }
.opt.is-missed .opt-key { border-color: var(--warn); color: var(--warn); }

.opt-mark { flex: none; font-size: .75rem; font-weight: 700; align-self: center; }
.opt.is-correct .opt-mark { color: var(--ok); }
.opt.is-wrong .opt-mark { color: var(--err); }
.opt.is-missed .opt-mark { color: var(--warn); }

.drill-footer {
  position: sticky;
  bottom: calc(var(--tabbar-h) + var(--safe-b) + 8px);
  display: flex;
  gap: 8px;
  padding-top: 4px;
  z-index: 20;
}

.explanation {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 12px;
  font-size: .9375rem;
  line-height: 1.75;
  color: var(--text-soft);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.kbd-hint {
  font-size: .75rem;
  color: var(--muted);
  text-align: center;
}

kbd {
  display: inline-block;
  min-width: 20px;
  padding: 0 5px;
  border: 1px solid var(--line-strong);
  border-bottom-width: 2px;
  border-radius: 5px;
  background: var(--surface-2);
  font-family: inherit;
  font-size: .6875rem;
  font-weight: 700;
  color: var(--text-soft);
}

/* --------------------------------------------------------------------------
   Calendar / heatmap
   -------------------------------------------------------------------------- */
.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 5px;
}

.cal-dow {
  text-align: center;
  font-size: .6875rem;
  font-weight: 700;
  color: var(--muted);
  padding-bottom: 2px;
}

.cal-cell {
  position: relative;
  aspect-ratio: 1 / 1;
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--heat-0);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0;
  padding: 2px;
  font-size: .625rem;
  font-weight: 700;
  color: var(--text-soft);
  cursor: pointer;
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
}

.cal-cell .cal-day { font-size: .6875rem; line-height: 1.1; font-variant-numeric: tabular-nums; }
.cal-cell .cal-count { font-size: .5625rem; line-height: 1.1; opacity: .8; font-variant-numeric: tabular-nums; }
.cal-cell.is-empty { background: transparent; border-color: transparent; cursor: default; }
.cal-cell.is-today { border-color: var(--brand); border-width: 2px; }
.cal-cell.is-done::after {
  content: "✓";
  position: absolute;
  top: 0;
  right: 2px;
  font-size: .5rem;
  color: var(--ok);
}
.cal-cell.is-selected { outline: 2px solid var(--brand); outline-offset: 1px; }
.cal-cell.lv0 { background: var(--heat-0); }
.cal-cell.lv1 { background: var(--heat-1); }
.cal-cell.lv2 { background: var(--heat-2); }
.cal-cell.lv3 { background: var(--heat-3); }
.cal-cell.lv4 { background: var(--heat-4); }
.cal-cell.lv3, .cal-cell.lv4 { color: #fff; }

.cal-legend {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
  font-size: .6875rem;
  color: var(--muted);
  margin-top: 8px;
}

.cal-legend i {
  width: 11px;
  height: 11px;
  border-radius: 3px;
  display: block;
  border: 1px solid var(--line);
}

.heatmap {
  display: grid;
  grid-template-rows: repeat(7, minmax(0, 1fr));
  grid-auto-flow: column;
  grid-auto-columns: minmax(0, 1fr);
  gap: 3px;
}

.heat-cell {
  aspect-ratio: 1 / 1;
  border-radius: 3px;
  background: var(--heat-0);
  border: 0;
  padding: 0;
}

.heat-cell.lv1 { background: var(--heat-1); }
.heat-cell.lv2 { background: var(--heat-2); }
.heat-cell.lv3 { background: var(--heat-3); }
.heat-cell.lv4 { background: var(--heat-4); }

/* --------------------------------------------------------------------------
   Lists
   -------------------------------------------------------------------------- */
.list { display: flex; flex-direction: column; }

.list-item {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 52px;
  padding: 10px 2px;
  border-bottom: 1px solid var(--line);
}

.list-item:last-child { border-bottom: 0; }

.list-main { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.list-title { font-size: .875rem; font-weight: 600; overflow-wrap: anywhere; }
.list-sub { font-size: .75rem; color: var(--muted); }
.list-side { flex: none; text-align: right; font-size: .875rem; font-weight: 700; font-variant-numeric: tabular-nums; }

.bar-mini { height: 6px; border-radius: 999px; background: var(--line); overflow: hidden; }
.bar-mini > i { display: block; height: 100%; background: var(--brand); }
.bar-mini.is-err > i { background: var(--err); }
.bar-mini.is-warn > i { background: var(--warn); }
.bar-mini.is-ok > i { background: var(--ok); }

/* --------------------------------------------------------------------------
   Exam
   -------------------------------------------------------------------------- */
.exam-bar {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  margin: -4px -4px 0;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-sm);
}

.timer {
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  font-size: 1.0625rem;
  color: var(--brand);
}

.timer.is-danger { color: var(--err); }

.exam-q { display: flex; flex-direction: column; gap: 10px; }
.exam-q + .exam-q { margin-top: 14px; }
.exam-q-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

.answer-map {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(40px, 1fr));
  gap: 6px;
}

.answer-dot {
  min-height: 40px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--surface);
  font-size: .75rem;
  font-weight: 700;
  color: var(--muted);
  cursor: pointer;
  font-variant-numeric: tabular-nums;
}

.answer-dot.is-answered { background: var(--brand-tint); border-color: var(--brand); color: var(--brand); }

.score-hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 20px 14px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--surface);
}

.score-hero.is-pass { background: var(--ok-tint); border-color: var(--ok); }
.score-hero.is-fail { background: var(--err-tint); border-color: var(--err); }
.score-hero .big { font-size: 3rem; font-weight: 700; line-height: 1; font-variant-numeric: tabular-nums; }
.score-hero .big small { font-size: 1.125rem; color: var(--muted); font-weight: 600; }
.score-hero.is-pass .big { color: var(--ok); }
.score-hero.is-fail .big { color: var(--err); }

/* --------------------------------------------------------------------------
   Admin / jobs
   -------------------------------------------------------------------------- */
.job {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
}

.job-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.job-title { font-size: .875rem; font-weight: 600; overflow-wrap: anywhere; }
.job-meta { font-size: .75rem; color: var(--muted); }

.dot-status { width: 9px; height: 9px; border-radius: 50%; background: var(--muted); flex: none; }
.dot-status.is-running { background: var(--warn); animation: pulse 1.2s ease-in-out infinite; }
.dot-status.is-done { background: var(--ok); }
.dot-status.is-failed { background: var(--err); }

@keyframes pulse { 50% { opacity: .3; } }

/* --------------------------------------------------------------------------
   Wide screens
   -------------------------------------------------------------------------- */
@media (min-width: 560px) {
  .metrics { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .field-grid { grid-template-columns: repeat(3, 1fr); }
}

@media (min-width: 760px) {
  :root { --pad: 22px; }
  body { font-size: 16px; }
  .app-main { padding-bottom: calc(var(--tabbar-h) + var(--safe-b) + 40px); }
}
