/* RBTI 科研人格鉴定 — styles. Palette carried over from ABTI.html. */

:root {
  --bg: #f5f6fa;
  --panel: #ffffff;
  --panel-soft: #fbfbfe;
  --text: #1a1e2e;
  --muted: #6b7084;
  --line: #dde0ea;
  --soft: #eceef6;
  --accent: #6366f1;
  --accent-strong: #4f46e5;
  --accent-soft: #a5b4fc;
  --danger: #e11d48;
  --shadow: 0 16px 40px rgba(79, 70, 229, 0.10);
  --shadow-soft: 0 6px 20px rgba(79, 70, 229, 0.06);
  --radius: 22px;
  --radius-sm: 14px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }

body {
  font-family:
    -apple-system, BlinkMacSystemFont, "Segoe UI",
    "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei",
    sans-serif;
  background: radial-gradient(circle at top left, #f0f0ff 0, #f5f6fa 36%, #f2f3f7 100%);
  color: var(--text);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a { color: var(--accent-strong); text-decoration: none; }
a:hover { text-decoration: underline; }

.shell {
  max-width: 720px;
  margin: 0 auto;
  padding: 28px 18px 80px;
}

/* ========== Screen switching ========== */
.screen { display: none; animation: fadeIn 0.25s ease-out; }
.screen.screen-active { display: block; }
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ========== Hero ========== */
.hero-header { text-align: center; margin-bottom: 24px; }
.brand-row {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 6px 14px;
  background: rgba(99, 102, 241, 0.10);
  border-radius: 999px;
  font-weight: 600;
  color: var(--accent-strong);
  font-size: 14px;
  margin-bottom: 20px;
}
.brand-logo { font-size: 18px; }
.hero-title {
  font-size: 36px;
  font-weight: 800;
  margin: 0 0 10px;
  letter-spacing: -0.02em;
  line-height: 1.15;
  background: linear-gradient(135deg, var(--accent-strong), var(--accent-soft));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.hero-subtitle-inline {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
  margin-top: 8px;
  letter-spacing: 0.04em;
  background: none;
  -webkit-text-fill-color: var(--muted);
}
.hero-lead {
  font-size: 16px;
  line-height: 1.7;
  color: var(--muted);
  margin: 16px 0 24px;
}
.hero-lead strong { color: var(--accent-strong); font-weight: 700; }

.stats-card {
  display: flex; flex-wrap: wrap; align-items: baseline; justify-content: center;
  gap: 6px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 14px 18px;
  box-shadow: var(--shadow-soft);
  margin: 0 0 18px;
  font-size: 14px;
  color: var(--muted);
}
.stats-total, .stats-top {
  font-weight: 700;
  color: var(--accent-strong);
  font-size: 16px;
}

.hero-meta {
  display: flex; justify-content: center; gap: 10px;
  font-size: 13px; color: var(--muted);
  margin-bottom: 24px;
  flex-wrap: wrap;
}
.hero-meta .dot { color: var(--line); }

.hero-foot {
  text-align: center;
  margin-top: 28px;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.7;
}

/* ========== Buttons ========== */
.btn {
  display: inline-block;
  padding: 14px 28px;
  font-size: 16px;
  font-weight: 600;
  border: none;
  border-radius: 999px;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
  font-family: inherit;
  line-height: 1;
}
.btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}
.btn-primary {
  background: linear-gradient(135deg, var(--accent-strong), var(--accent));
  color: white;
  box-shadow: 0 8px 20px rgba(79, 70, 229, 0.24);
}
.btn-primary:not(:disabled):hover {
  transform: translateY(-1px);
  box-shadow: 0 12px 28px rgba(79, 70, 229, 0.34);
}
.btn-primary:not(:disabled):active {
  transform: translateY(0);
}
.btn-ghost {
  background: var(--panel);
  color: var(--accent-strong);
  border: 1px solid var(--line);
}
.btn-ghost:not(:disabled):hover {
  background: var(--soft);
  border-color: var(--accent-soft);
}
#btn-start {
  display: block;
  width: 100%;
  max-width: 320px;
  margin: 0 auto;
  padding: 18px 28px;
  font-size: 17px;
}

/* ========== Test screen ========== */
.progress-wrap { margin-bottom: 22px; }
.progress-label {
  font-size: 13px;
  color: var(--muted);
  text-align: center;
  margin-bottom: 10px;
  font-variant-numeric: tabular-nums;
}
.progress-label span { font-weight: 700; color: var(--accent-strong); }
.progress-bar {
  height: 6px;
  background: var(--soft);
  border-radius: 999px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--accent-soft), var(--accent));
  border-radius: 999px;
  transition: width 0.4s cubic-bezier(0.25, 0.1, 0.25, 1);
}

.question-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 28px 22px;
  box-shadow: var(--shadow);
  margin-bottom: 20px;
}
.question-text {
  font-size: 19px;
  font-weight: 600;
  margin: 0 0 22px;
  line-height: 1.55;
}

.options { display: flex; flex-direction: column; gap: 12px; }
.option {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  background: var(--panel-soft);
  border: 1.5px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 16px 18px;
  cursor: pointer;
  transition: all 0.15s ease;
  font-size: 15px;
  line-height: 1.6;
  min-height: 56px;
  text-align: left;
  font-family: inherit;
  color: var(--text);
  width: 100%;
}
.option:hover {
  border-color: var(--accent-soft);
  background: rgba(99, 102, 241, 0.04);
}
.option.selected {
  border-color: var(--accent);
  background: rgba(99, 102, 241, 0.08);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}
.option-key {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 28px; height: 28px;
  border-radius: 50%;
  background: var(--soft);
  color: var(--muted);
  font-weight: 700;
  font-size: 13px;
  text-transform: uppercase;
  transition: all 0.15s ease;
}
.option.selected .option-key {
  background: var(--accent);
  color: white;
}
.option-text { flex: 1; }

.test-nav {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 8px;
}
.test-nav .btn { flex: 1; }

/* ========== Result ========== */
.result-top {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
  gap: 18px;
  align-items: stretch;
  margin-bottom: 18px;
}
.result-poster-box,
.result-summary-card,
.analysis-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-soft);
}
.result-poster-box {
  padding: 14px;
}
.result-poster {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 18px;
  background: #f1f2fa;
}
.result-summary-card {
  padding: 26px 22px;
}
.result-code {
  font-size: 44px;
  font-weight: 900;
  letter-spacing: -0.02em;
  line-height: 1.0;
  margin-bottom: 10px;
  font-family: "SF Mono", "JetBrains Mono", monospace, "PingFang SC";
  color: var(--accent-strong);
}
.result-name {
  font-size: 24px;
  font-weight: 700;
  margin-bottom: 12px;
}
.result-tagline {
  font-size: 15px;
  font-style: italic;
  color: var(--muted);
  line-height: 1.5;
  margin-bottom: 16px;
}
.analysis-badge {
  display: inline-flex;
  align-items: center;
  padding: 9px 14px;
  border-radius: 999px;
  background: rgba(99, 102, 241, 0.10);
  border: 1px solid rgba(99, 102, 241, 0.16);
  color: var(--accent-strong);
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 18px;
}

.result-description {
  font-size: 15px;
  line-height: 1.85;
  color: var(--text);
  white-space: pre-wrap;
  margin: 0;
}
.analysis-card {
  padding: 18px 20px;
  margin-bottom: 22px;
}
.analysis-card h3 {
  margin: 0 0 10px;
  font-size: 16px;
}
.analysis-card p {
  margin: 0;
  font-size: 14px;
  line-height: 1.8;
  color: var(--muted);
}

.dimensions-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
  margin-bottom: 28px;
}
.dim-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  box-shadow: var(--shadow-soft);
}
.dim-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}
.dim-code {
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  letter-spacing: 0.08em;
}
.dim-name { font-size: 14px; font-weight: 600; }
.dim-match {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
}
.dim-match.is-match {
  background: rgba(79, 70, 229, 0.12);
  color: var(--accent-strong);
}
.dim-match.is-mismatch {
  background: rgba(148, 163, 184, 0.18);
  color: #475569;
}
.dim-compare {
  display: grid;
  gap: 8px;
  margin-bottom: 12px;
}
.dim-compare-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 13px;
  color: var(--muted);
}
.dim-compare-row strong {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 30px;
  height: 30px;
  padding: 0 10px;
  border-radius: 999px;
  color: white;
}
.dim-compare-row strong.level-L { background: #94a3b8; }
.dim-compare-row strong.level-M { background: #818cf8; }
.dim-compare-row strong.level-H { background: var(--accent-strong); }
.dim-desc {
  font-size: 13px;
  line-height: 1.6;
  color: var(--muted);
  margin-top: 8px;
}

.result-footer {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 20px;
}
.result-footer .btn { flex: 1 1 140px; padding: 12px 18px; font-size: 15px; }

.result-stats {
  text-align: center;
  font-size: 13px;
  color: var(--muted);
  margin-top: 10px;
}
.result-stats strong { color: var(--accent-strong); font-weight: 700; }

/* ========== Loading / Error ========== */
.loading-card, .error-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 48px 28px;
  text-align: center;
  box-shadow: var(--shadow);
  margin-top: 40px;
}
.spinner {
  width: 36px; height: 36px;
  border-radius: 50%;
  border: 3px solid var(--soft);
  border-top-color: var(--accent);
  margin: 0 auto 16px;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.error-icon { font-size: 48px; margin-bottom: 12px; }
.error-card h2 { margin: 0 0 8px; }
.error-card p { color: var(--muted); margin: 0 0 20px; }

/* ========== Footer ========== */
.site-footer {
  text-align: center;
  margin-top: 48px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
  font-size: 12px;
  color: var(--muted);
  line-height: 1.8;
}

/* ========== Toast ========== */
.toast {
  position: fixed;
  bottom: 32px;
  left: 50%;
  transform: translateX(-50%) translateY(10px);
  background: #1a1e2e;
  color: white;
  padding: 12px 22px;
  border-radius: 999px;
  font-size: 14px;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.25);
  z-index: 1000;
  opacity: 0;
  transition: opacity 0.2s ease, transform 0.2s ease;
  pointer-events: none;
}
.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ========== Responsive ========== */
@media (max-width: 480px) {
  .shell { padding: 20px 14px 64px; }
  .hero-title { font-size: 30px; }
  .hero-lead { font-size: 15px; }
  .question-card { padding: 22px 18px; }
  .question-text { font-size: 17px; }
  .option { padding: 14px 16px; font-size: 14px; }
  .result-top { grid-template-columns: 1fr; }
  .result-code { font-size: 42px; }
  .result-name { font-size: 20px; }
  .result-summary-card { padding: 20px 18px; }
  .result-description { font-size: 14px; }
  .dimensions-grid { grid-template-columns: 1fr 1fr; }
  .result-footer .btn { flex-basis: 100%; }
}

@media (max-width: 360px) {
  .dimensions-grid { grid-template-columns: 1fr; }
  .hero-title { font-size: 26px; }
  .result-code { font-size: 36px; }
}

@media (min-width: 768px) {
  .shell { padding: 40px 24px 96px; }
  .hero-title { font-size: 44px; }
  .hero-lead { font-size: 17px; }
  .question-text { font-size: 20px; }
}
