* { box-sizing: border-box; margin: 0; }
body { display: flex; flex-direction: column; min-height: 100vh; }
main { flex: 1; }

/* ── 主题：亮色（默认） ── */
:root,
:root[data-theme="light"] {
  --color-bg: #f7f8fa;
  --color-surface: #ffffff;
  --color-surface-alt: #f0f2f5;
  --color-primary: #4c6ef5;
  --color-primary-hover: #3b5bdb;
  --color-primary-light: #e7f0ff;
  --color-text: #1a1d29;
  --color-text-secondary: #6b7280;
  --color-text-muted: #9ca3af;
  --color-border: #e5e7eb;
  --color-success: #10b981;
  --color-danger: #ef4444;
  --color-warning: #f59e0b;
  --color-info: #3b82f6;
  --color-gradient-1: #667eea;
  --color-gradient-2: #764ba2;
  --shadow-sm: 0 1px 2px rgba(0,0,0,.05);
  --shadow-md: 0 4px 12px rgba(0,0,0,.08);
  --shadow-lg: 0 10px 30px rgba(0,0,0,.10);
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --transition: .25s cubic-bezier(.4,0,.2,1);
  --max-width: 1200px;
}

/* ── 主题：黑色 ── */
:root[data-theme="dark"] {
  --color-bg: #13141a;
  --color-surface: #1e1f26;
  --color-surface-alt: #2a2b33;
  --color-primary: #5c7cfa;
  --color-primary-hover: #748ffc;
  --color-primary-light: #2a2d4a;
  --color-text: #e2e8f0;
  --color-text-secondary: #94a3b8;
  --color-text-muted: #64748b;
  --color-border: #3a3b42;
  --color-success: #10b981;
  --color-danger: #ef4444;
  --color-warning: #f59e0b;
  --color-info: #3b82f6;
  --color-gradient-1: #4c63f2;
  --color-gradient-2: #6b46c1;
  --shadow-sm: 0 1px 2px rgba(0,0,0,.3);
  --shadow-md: 0 4px 12px rgba(0,0,0,.4);
  --shadow-lg: 0 10px 30px rgba(0,0,0,.5);
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--color-bg);
  color: var(--color-text);
  line-height: 1.6;
  font-size: 15px;
}

a { color: var(--color-primary); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--color-primary-hover); }

img { max-width: 100%; display: block; }

h1, h2, h3, h4 { margin: 0 0 .5em; font-weight: 600; line-height: 1.3; }

.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 20px;
}
.container-sm { max-width: 720px; }

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 22px;
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
  text-decoration: none;
  white-space: nowrap;
  line-height: 1.4;
}
.btn:disabled { opacity: .6; cursor: not-allowed; }
.btn-primary { background: var(--color-primary); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--color-primary-hover); color: #fff; }
.btn-secondary { background: var(--color-surface); border-color: var(--color-border); color: var(--color-text); }
.btn-secondary:hover:not(:disabled) { background: var(--color-surface-alt); }
.btn-danger { background: var(--color-danger); color: #fff; }
.btn-danger:hover:not(:disabled) { background: #dc2626; color: #fff; }
.btn-warning { background: #f59e0b; color: #fff; }
.btn-warning:hover:not(:disabled) { background: #d97706; color: #fff; }
.btn-success { background: var(--color-success); color: #fff; }
.btn-ghost { background: transparent; color: var(--color-text-secondary); }
.btn-ghost:hover { background: var(--color-surface-alt); color: var(--color-text); }
.btn-sm { padding: 6px 14px; font-size: 13px; }
.btn-lg { padding: 14px 32px; font-size: 16px; }
.btn-block { width: 100%; }

/* ── Forms ── */
.form-group { margin-bottom: 18px; }
.form-label { display: block; margin-bottom: 6px; font-weight: 500; font-size: 14px; color: var(--color-text); }
.form-label .req { color: var(--color-danger); }
.form-control, .form-select, textarea.form-control {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  font-size: 14px;
  font-family: inherit;
  background: var(--color-surface);
  color: var(--color-text);
  transition: border-color var(--transition), box-shadow var(--transition);
}
.form-control:focus, .form-select:focus, textarea.form-control:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px var(--color-primary-light);
}
textarea.form-control { min-height: 100px; resize: vertical; }
.form-hint { font-size: 12px; color: var(--color-text-muted); margin-top: 4px; }
.form-error { font-size: 13px; color: var(--color-danger); margin-top: 4px; }

/* ── Navbar ── */
.navbar {
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow-sm);
}
.navbar-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 20px;
  height: 60px;
  display: flex;
  align-items: center;
  gap: 24px;
}
.navbar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 18px;
  color: var(--color-text);
  height: 40px;
  flex-shrink: 0;
}
.navbar-brand img { height: 32px; width: 32px; border-radius: var(--radius-sm); object-fit: cover; }
.navbar-logo-placeholder {
  width: 32px; height: 32px; border-radius: 8px;
  background: linear-gradient(135deg, var(--color-gradient-1), var(--color-gradient-2));
  display: inline-flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 700; font-size: 14px;
}

/* 右侧操作区：统一高度对齐 */
.navbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 40px;
  margin-left: auto;
}
.navbar-login-btn, .navbar-register-btn { height: 34px; }

/* 页面链接（PC 常驻显示） */
.navbar-links {
  display: flex;
  align-items: center;
  gap: 4px;
  height: 40px;
}
.navbar-link {
  padding: 8px 14px; color: var(--color-text-secondary);
  border-radius: var(--radius-md); font-size: 14px; transition: all var(--transition);
  display: flex; align-items: center;
}
.navbar-link:hover { color: var(--color-text); background: var(--color-surface-alt); }

/* ── Avatar dropdown ── */
.avatar-dropdown { position: relative; }
.avatar-btn {
  display: flex; align-items: center; gap: 8px;
  padding: 2px 10px 2px 2px; border-radius: 30px;
  border: 1px solid var(--color-border); background: var(--color-surface-alt);
  cursor: pointer; transition: all var(--transition); height: 36px;
}
.avatar-btn:hover { background: var(--color-surface); border-color: var(--color-primary); }
.avatar-img {
  width: 30px; height: 30px; border-radius: 50%; object-fit: cover;
  background: var(--color-primary-light); flex-shrink: 0;
}
.avatar-img-placeholder {
  display: flex; align-items: center; justify-content: center;
  font-weight: 600; color: var(--color-primary); font-size: 13px;
  border-radius: 50%; flex-shrink: 0;
}
.avatar-name { font-size: 13px; font-weight: 500; color: var(--color-text); }
.avatar-menu {
  position: absolute; top: calc(100% + 8px); right: 0;
  min-width: 180px; background: var(--color-surface);
  border: 1px solid var(--color-border); border-radius: var(--radius-md);
  box-shadow: var(--shadow-md); padding: 6px; display: none;
}
.avatar-menu.show { display: block; }
.avatar-menu a {
  display: block; padding: 9px 12px; border-radius: var(--radius-sm);
  color: var(--color-text); font-size: 14px;
}
.avatar-menu a:hover { background: var(--color-surface-alt); color: var(--color-text); }
.avatar-menu .divider { height: 1px; background: var(--color-border); margin: 4px 0; }

/* ── Hero ── */
.hero {
  background: linear-gradient(135deg, var(--color-gradient-1), var(--color-gradient-2));
  color: #fff;
  padding: 60px 0 50px;
  text-align: center;
}
.hero h1 { font-size: 2rem; margin-bottom: 12px; }
.hero p { font-size: 1.05rem; opacity: .9; max-width: 600px; margin: 0 auto; }

/* ── Assessment cards grid ── */
.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 24px;
  padding: 40px 0;
}
.assessment-card {
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: transform var(--transition), box-shadow var(--transition);
  display: flex;
  flex-direction: column;
  text-decoration: none; color: inherit;
}
.assessment-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-md); }
.assessment-card .card-banner {
  height: 160px; background: linear-gradient(135deg, #a8c5ff, #c4a8ff);
  background-size: cover; background-position: center;
  position: relative; overflow: hidden;
}
.assessment-card .card-banner img {
  width: 100%; height: 100%; object-fit: cover;
  position: absolute; top: 0; left: 0;
}
.assessment-card .card-banner-placeholder {
  width: 100%; height: 100%; background: linear-gradient(135deg, #a8c5ff, #c4a8ff);
}
.assessment-card .card-body { padding: 20px; flex: 1; display: flex; flex-direction: column; }
.assessment-card .card-title { font-size: 1.1rem; font-weight: 600; margin-bottom: 8px; }
.assessment-card .card-desc { color: var(--color-text-secondary); font-size: 14px; flex: 1; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.assessment-card .card-footer { margin-top: 16px; display: flex; justify-content: space-between; align-items: center; }
.assessment-card .card-meta { font-size: 12px; color: var(--color-text-muted); }

/* ── Footer ── */
.site-footer {
  background: var(--color-surface);
  border-top: 1px solid var(--color-border);
  padding: 40px 0 24px;
  margin-top: 60px;
}
.footer-grid {
  display: flex; flex-wrap: wrap; gap: 40px; justify-content: center;
  margin-bottom: 28px;
}
.footer-col {
  display: flex; flex-direction: column; gap: 10px;
  min-width: 140px;
}
.footer-brand-col {
  min-width: 200px; max-width: 280px;
}
.footer-brand-name {
  font-size: 16px; font-weight: 700; color: var(--color-text);
  margin-bottom: 2px;
}
.footer-brand-desc {
  margin: 0; font-size: 13px; color: var(--color-text-muted); line-height: 1.5;
}
.footer-col-title {
  font-size: 12px; font-weight: 600; text-transform: uppercase;
  letter-spacing: 1px; color: var(--color-text-muted); margin-bottom: 4px;
}
.footer-col a { color: var(--color-text-secondary); font-size: 14px; transition: color var(--transition); }
.footer-col a:hover { color: var(--color-primary); }
.footer-copy {
  text-align: center; color: var(--color-text-muted); font-size: 13px;
  padding-top: 20px; border-top: 1px solid var(--color-border);
}

@media (max-width: 768px) {
  .footer-grid { gap: 28px; justify-content: flex-start; }
}

/* ── Auth pages ── */
.auth-wrap { min-height: calc(100vh - 60px); display: flex; align-items: center; justify-content: center; padding: 40px 20px; }
.auth-card {
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 40px;
  width: 100%;
  max-width: 420px;
}
.auth-card h2 { text-align: center; margin-bottom: 8px; }
.auth-card .auth-subtitle { text-align: center; color: var(--color-text-secondary); margin-bottom: 28px; font-size: 14px; }
.auth-card .auth-footer { text-align: center; margin-top: 20px; font-size: 14px; color: var(--color-text-secondary); }
.auth-alert {
  padding: 12px 16px; border-radius: var(--radius-md); margin-bottom: 20px; font-size: 14px;
}
.auth-alert-error { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }
.auth-alert-success { background: #f0fdf4; color: #166534; border: 1px solid #bbf7d0; }
.auth-alert-warning { background: #fffbeb; color: #92400e; border: 1px solid #fde68a; }

/* ── Assessment take page ── */
.assessment-header { background: var(--color-surface); border-bottom: 1px solid var(--color-border); }
.assessment-header.has-banner { position: relative; }
.assessment-header .banner-bg { height: 200px; background: linear-gradient(135deg, #a8c5ff, #c4a8ff); position: relative; overflow: hidden; }
.banner-bg-img { width: 100%; height: 100%; object-fit: cover; position: absolute; top: 0; left: 0; }
.assessment-header .header-content { max-width: 800px; margin: 0 auto; padding: 28px 20px; }
.assessment-header h1 { font-size: 1.6rem; }
.assessment-header .header-desc { color: var(--color-text-secondary); margin-top: 8px; }

.progress-bar-wrap {
  position: sticky; top: 60px; z-index: 50;
  background: var(--color-surface); border-bottom: 1px solid var(--color-border);
  padding: 12px 20px;
}
.progress-bar-wrap .progress-info { max-width: 800px; margin: 0 auto; display: flex; justify-content: space-between; font-size: 13px; color: var(--color-text-secondary); margin-bottom: 6px; }
.progress-bar { height: 6px; background: var(--color-surface-alt); border-radius: 3px; max-width: 800px; margin: 0 auto; overflow: hidden; }
.progress-bar-fill { height: 100%; background: var(--color-primary); border-radius: 3px; transition: width .3s ease; }

.questions-list { max-width: 800px; margin: 0 auto; padding: 30px 20px; }
.question-card {
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  padding: 28px;
  margin-bottom: 20px;
  box-shadow: var(--shadow-sm);
  scroll-margin-top: 130px;
}
.question-card.unanswered { border: 2px solid var(--color-warning); }
.question-number { font-size: 13px; color: var(--color-primary); font-weight: 600; margin-bottom: 8px; }
.question-text { font-size: 1.05rem; font-weight: 500; margin-bottom: 18px; }
.option-list { display: flex; flex-direction: column; gap: 10px; }
.option-item {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 16px; border: 1px solid var(--color-border); border-radius: var(--radius-md);
  cursor: pointer; transition: all var(--transition);
}
.option-item:hover { border-color: var(--color-primary); background: var(--color-primary-light); }
.option-item input { display: none; }
.option-item .option-radio {
  width: 20px; height: 20px; border: 2px solid var(--color-border); border-radius: 50%; flex-shrink: 0; transition: all var(--transition);
}
.option-item.selected { border-color: var(--color-primary); background: var(--color-primary-light); }
.option-item.selected .option-radio { border-color: var(--color-primary); background: var(--color-primary); box-shadow: inset 0 0 0 3px #fff; }
.option-item .option-text { font-size: 14px; }

.assessment-submit-bar { max-width: 800px; margin: 0 auto; padding: 20px; text-align: center; }

/* ── Loading / waiting screen ── */
.loading-screen {
  position: fixed; inset: 0; background: var(--color-surface);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  z-index: 9999; padding: 20px;
}
.loading-screen.hidden { display: none; }
.loading-ring {
  width: 80px; height: 80px; border-radius: 50%;
  border: 4px solid var(--color-surface-alt);
  border-top-color: var(--color-primary);
  border-right-color: var(--color-primary);
  animation: spin 1s linear infinite;
  margin: 0 auto 32px;
}
.loading-ring-breath { animation: spin 1s linear infinite, breath 2s ease-in-out infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes breath { 0%, 100% { opacity: 1; } 50% { opacity: .5; } }
.loading-title { font-size: 1.3rem; font-weight: 600; margin-bottom: 12px; text-align: center; }
.loading-subtitle { font-size: 14px; color: var(--color-text-secondary); text-align: center; max-width: 480px; margin-left: auto; margin-right: auto; }
.loading-indeterminate-bar { width: 200px; height: 4px; background: var(--color-surface-alt); border-radius: 2px; overflow: hidden; margin: 24px 0; }
.loading-indeterminate-fill { height: 100%; width: 40%; background: var(--color-primary); border-radius: 2px; animation: indeterminate 1.4s ease-in-out infinite; }
@keyframes indeterminate { 0% { margin-left: -40%; } 100% { margin-left: 100%; } }

/* ── SSE 流式文本展示 ── */
.stream-header { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; padding-bottom: 10px; border-bottom: 1px solid var(--color-border); }
.stream-badge {
    display: inline-flex; align-items: center; gap: 6px;
    font-size: 12px; font-weight: 600; color: #fff;
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    padding: 5px 12px; border-radius: 20px;
    animation: badgePulse 2s ease-in-out infinite;
}
.stream-badge::before {
    content: ''; width: 8px; height: 8px; border-radius: 50%;
    background: #a5f3fc; animation: dotBlink 0.8s ease-in-out infinite;
}
@keyframes badgePulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(99,102,241,.4); } 50% { box-shadow: 0 0 0 8px rgba(99,102,241,0); } }
@keyframes dotBlink { 0%, 100% { opacity: 1; } 50% { opacity: 0.3; } }

.stream-cursor {
    display: inline-block; width: 2px; height: 18px;
    background: var(--color-primary); animation: cursorBlink 0.8s step-end infinite;
    vertical-align: middle;
}
@keyframes cursorBlink { 50% { opacity: 0; } }

.stream-content {
    background: var(--color-surface-alt); border: 1px solid var(--color-border);
    border-radius: var(--radius-md); padding: 20px 24px;
    min-height: 120px; max-height: 420px; overflow-y: auto;
    font-size: 14px; line-height: 1.8; color: var(--color-text-primary);
    white-space: pre-wrap; word-break: break-word;
    text-align: left;
}
.stream-content .stream-new { animation: fadeInUp 0.35s ease-out; }
@keyframes fadeInUp { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }

/* ── Result page ── */
.result-wrap { max-width: 800px; margin: 0 auto; padding: 40px 20px; }
.result-card { background: var(--color-surface); border-radius: var(--radius-lg); padding: 36px; box-shadow: var(--shadow-sm); margin-bottom: 24px; }
.result-card h1 { font-size: 1.5rem; }

/* Dimension cards */
.dim-cards { display: flex; flex-direction: column; gap: 16px; margin-bottom: 20px; }
.dim-card {
    background: var(--color-surface-alt); border-radius: var(--radius-md);
    padding: 18px 20px; border: 1px solid var(--color-border);
}
.dim-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.dim-name { font-weight: 600; font-size: 15px; }
.dim-score { font-weight: 700; font-size: 1.1rem; }
.dim-bar-bg { height: 6px; background: var(--color-border); border-radius: 3px; overflow: hidden; margin-bottom: 10px; }
.dim-bar-fill { height: 100%; border-radius: 3px; transition: width .5s ease; }
.dim-analysis { font-size: 13px; color: var(--color-text-secondary); line-height: 1.6; }
.dim-summary-card {
    background: linear-gradient(135deg, var(--color-primary-light), var(--color-surface-alt));
    border-radius: var(--radius-md); padding: 20px; border: 1px solid var(--color-primary);
    margin-bottom: 20px;
}
.dim-summary-card h3 { font-size: 1rem; margin: 0 0 10px; }
.dim-summary-text { font-size: 14px; line-height: 1.7; color: var(--color-text); }

/* Peak analysis card (highest dimension) */
.peak-analysis-card {
    background: linear-gradient(135deg, rgba(102,126,234,0.12), rgba(118,75,162,0.08));
    border-radius: var(--radius-md); padding: 20px;
    border: 1px solid var(--color-primary);
    margin-bottom: 24px;
}
.peak-analysis-card h3 { font-size: 1rem; margin: 0 0 10px; color: var(--color-primary); }
.peak-analysis-text { font-size: 14px; line-height: 1.7; color: var(--color-text); }

/* Radar chart wrapper */
.radar-chart-wrap canvas { max-width: 100%; height: auto; }

/* Star rating */
.star-rating { display: inline-flex; gap: 6px; font-size: 28px; }
.star-rating .star { color: #d1d5db; cursor: pointer; transition: color .15s, transform .15s; user-select: none; }
.star-rating .star:hover { transform: scale(1.15); color: #f59e0b; }
.star-rating .star.active { color: #f59e0b; }
.rating-section { padding: 16px 0; border-top: 1px solid var(--color-border); }
.card-stars { color: #f59e0b; font-weight: 600; }

/* ── Crop modal ── */
.crop-modal-box {
    background: var(--color-surface); border-radius: var(--radius-lg);
    max-width: 640px; width: 100%; box-shadow: var(--shadow-lg);
    overflow: hidden;
}
.crop-modal-header { display: flex; justify-content: space-between; align-items: center; padding: 16px 20px; border-bottom: 1px solid var(--color-border); }
.crop-modal-header h3 { margin: 0; font-size: 1.1rem; }
.crop-area { max-height: 50vh; overflow: hidden; background: #1a1a2e; display: flex; align-items: center; justify-content: center; }
.crop-toolbar { display: flex; gap: 8px; justify-content: center; padding: 12px 20px; border-top: 1px solid var(--color-border); }
.crop-toolbar button {
    width: 36px; height: 36px; border-radius: 8px; border: 1px solid var(--color-border);
    background: var(--color-surface); color: var(--color-text); font-size: 16px;
    cursor: pointer; display: flex; align-items: center; justify-content: center;
    transition: background .15s;
}
.crop-toolbar button:hover { background: var(--color-surface-alt); }
.crop-modal-footer { display: flex; gap: 10px; justify-content: flex-end; padding: 16px 20px; border-top: 1px solid var(--color-border); }

/* ── Categories page ── */
.categories-layout { display: flex; gap: 0; max-width: 1200px; margin: 0 auto; }
.categories-sidebar {
    width: 260px; flex-shrink: 0; border-right: 1px solid var(--color-border);
    background: var(--color-surface); padding: 20px 0; overflow-y: auto;
}
.categories-sidebar-title { font-size: 13px; font-weight: 600; color: var(--color-text-secondary); padding: 0 16px 12px; text-transform: uppercase; letter-spacing: .5px; }
.categories-sidebar-item {
    display: flex; align-items: center; gap: 10px; padding: 10px 16px;
    text-decoration: none; color: var(--color-text); font-size: 14px;
    transition: background .15s; border-left: 3px solid transparent;
}
.categories-sidebar-item:hover { background: var(--color-surface-alt); }
.categories-sidebar-item.active { background: var(--color-primary-light); color: var(--color-primary); border-left-color: var(--color-primary); font-weight: 600; }
.csi-cover { width: 32px; height: 32px; border-radius: 6px; overflow: hidden; background: var(--color-surface-alt); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.csi-cover img { width: 100%; height: 100%; object-fit: cover; }
.csi-cover span { color: var(--color-border); font-size: 14px; font-weight: 700; }
.csi-info { flex: 1; min-width: 0; }
.csi-name { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.csi-count { font-size: 12px; color: var(--color-text-secondary); }
.categories-sidebar-item .csi-count { font-size: 12px; color: var(--color-text-secondary); margin-left: auto; flex-shrink: 0; }
.categories-content { flex: 1; padding: 0; overflow-y: auto; }
.cat-hero {
    height: 200px; position: relative; overflow: hidden;
    display: flex; align-items: flex-end;
}
.cat-hero-img {
    position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover;
}
.cat-hero-plain { background: var(--color-surface); align-items: center; justify-content: center; flex-direction: column; border-bottom: 1px solid var(--color-border); }
.cat-hero-plain h1 { font-size: 1.8rem; margin-bottom: 4px; }
.cat-hero-overlay {
    position: relative; z-index: 1;
    width: 100%; padding: 32px; background: linear-gradient(transparent, rgba(0,0,0,.6));
    color: #fff;
}
.cat-hero-overlay h1 { font-size: 1.6rem; margin: 0 0 4px; }
.cat-hero-overlay p { margin: 0; font-size: 14px; opacity: .85; }
.cat-question-list { padding: 20px; }
.cat-question-item {
    display: flex; gap: 16px; align-items: center; padding: 16px;
    text-decoration: none; color: inherit;
    border-bottom: 1px solid var(--color-border);
    transition: background .15s;
}
.cat-question-item:hover { background: var(--color-surface-alt); }
.cqi-cover {
    width: 64px; height: 64px; border-radius: 10px; overflow: hidden;
    background: var(--color-surface-alt); display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.cqi-cover img { width: 100%; height: 100%; object-fit: cover; }
.cqi-cover span { font-size: 24px; font-weight: 700; color: var(--color-border); }
.cqi-body { flex: 1; min-width: 0; }
.cqi-title { font-size: 15px; font-weight: 600; margin-bottom: 4px; }
.cqi-desc { font-size: 13px; color: var(--color-text-secondary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cqi-meta { font-size: 12px; color: var(--color-text-secondary); margin-top: 6px; }

@media (max-width: 768px) {
    .categories-layout { flex-direction: column; }
    .categories-sidebar {
        width: 100%; border-right: none; border-bottom: 1px solid var(--color-border);
        padding: 12px 0; display: flex; overflow-x: auto; gap: 4px;
    }
    .categories-sidebar-title { display: none; }
    .categories-sidebar-item { border-left: none; border-bottom: 2px solid transparent; white-space: nowrap; padding: 8px 12px; }
    .categories-sidebar-item.active { border-left: none; border-bottom-color: var(--color-primary); }
    .csi-cover { display: none; }
    .csi-count { display: none; }
}
.result-report { line-height: 1.8; }
.result-report h1, .result-report h2, .result-report h3 { margin-top: 1.2em; }
.result-report p { margin: .8em 0; }
.result-report ul, .result-report ol { padding-left: 1.5em; margin: .8em 0; }
.result-report code { background: var(--color-surface-alt); padding: 2px 6px; border-radius: 4px; font-size: 13px; }
.result-report blockquote { border-left: 4px solid var(--color-primary); margin: 1em 0; padding: .5em 1em; background: var(--color-primary-light); border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }

.answers-summary { margin-top: 24px; }
.answers-summary details { background: var(--color-surface); border-radius: var(--radius-md); border: 1px solid var(--color-border); }
.answers-summary summary { padding: 14px 20px; cursor: pointer; font-weight: 500; }
.answers-summary .summary-body { padding: 0 20px 20px; }
.answer-item { padding: 10px 0; border-bottom: 1px solid var(--color-border); font-size: 14px; }
.answer-item:last-child { border-bottom: none; }
.answer-item .q-text { color: var(--color-text); font-weight: 500; }
.answer-item .a-text { color: var(--color-primary); margin-top: 4px; }

/* ── About page ── */
.about-wrap { max-width: 640px; margin: 0 auto; padding: 50px 20px; text-align: center; }
.about-section { margin-bottom: 48px; }
.about-section h2 { font-size: 1.4rem; margin-bottom: 16px; }
.about-section p { color: var(--color-text-secondary); }
.about-section .donate-qr { max-width: 240px; margin: 16px auto; border-radius: var(--radius-md); }
.sponsor-list { text-align: left; list-style: none; padding: 0; max-width: 400px; margin: 0 auto; }
.sponsor-list li { padding: 10px 16px; border-bottom: 1px solid var(--color-border); overflow: hidden; }

/* ── Admin layout ── */
.admin-layout { display: flex; min-height: 100vh; }
.admin-sidebar {
  width: 240px; background: #1e293b; color: #cbd5e1; flex-shrink: 0;
  padding: 20px 0; position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
:root[data-theme="dark"] .admin-sidebar { background: #0f1117; }
.admin-sidebar .sidebar-brand { padding: 0 24px 20px; font-size: 18px; font-weight: 700; color: #fff; border-bottom: 1px solid #334155; }
.admin-sidebar .sidebar-nav { padding: 12px 0; }
.admin-sidebar .sidebar-link {
  display: flex; align-items: center; gap: 10px; padding: 11px 24px; color: #cbd5e1; font-size: 14px; transition: all var(--transition);
}
.admin-sidebar .sidebar-link:hover, .admin-sidebar .sidebar-link.active { background: #334155; color: #fff; }
.admin-sidebar .sidebar-section { padding: 12px 24px 6px; font-size: 11px; text-transform: uppercase; color: #64748b; letter-spacing: .5px; }
.admin-main { flex: 1; padding: 30px; min-width: 0; }
.admin-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 24px; }
.admin-header h1 { font-size: 1.5rem; }
.admin-table { width: 100%; background: var(--color-surface); border-radius: var(--radius-lg); overflow: hidden; box-shadow: var(--shadow-sm); border-collapse: collapse; }
.admin-table th { text-align: left; padding: 14px 16px; background: var(--color-surface-alt); font-size: 13px; color: var(--color-text-secondary); font-weight: 600; border-bottom: 1px solid var(--color-border); }
.admin-table td { padding: 14px 16px; border-bottom: 1px solid var(--color-border); font-size: 14px; }
.admin-table tr:last-child td { border-bottom: none; }
.admin-table tr:hover { background: var(--color-surface-alt); }

/* ── Badges ── */
.badge { display: inline-flex; align-items: center; padding: 3px 10px; border-radius: 20px; font-size: 12px; font-weight: 500; }
.badge-success { background: #d1fae5; color: #065f46; }
.badge-warning { background: #fef3c7; color: #92400e; }
.badge-danger { background: #fee2e2; color: #991b1b; }
.badge-info { background: #dbeafe; color: #1e40af; }

/* ── Toggle switch ── */
.toggle { position: relative; display: inline-block; width: 44px; height: 24px; }
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle .slider { position: absolute; cursor: pointer; inset: 0; background: var(--color-border); border-radius: 24px; transition: var(--transition); }
.toggle .slider::before { content: ''; position: absolute; height: 18px; width: 18px; left: 3px; bottom: 3px; background: #fff; border-radius: 50%; transition: var(--transition); }
.toggle input:checked + .slider { background: var(--color-primary); }
.toggle input:checked + .slider::before { transform: translateX(20px); }

/* ── Dynamic question form ── */
.dyn-question { background: var(--color-surface-alt); border-radius: var(--radius-md); padding: 20px; margin-bottom: 16px; }
.dyn-question .dyn-q-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.dyn-option-row { display: flex; gap: 10px; align-items: center; margin-bottom: 8px; }
.dyn-option-row .opt-text { flex: 1; }
.dyn-option-row .opt-score { width: 80px; }

/* ── JSON editor ── */
.json-editor {
  width: 100%; min-height: 300px; font-family: "Cascadia Code", "Fira Code", Consolas, monospace;
  font-size: 13px; padding: 16px; border: 1px solid var(--color-border); border-radius: var(--radius-md);
  background: #1e293b; color: #e2e8f0; resize: vertical;
}
.json-preview { background: var(--color-surface-alt); border-radius: var(--radius-md); padding: 16px; margin-top: 12px; }
.json-preview .preview-error { color: var(--color-danger); font-size: 14px; }
.json-preview .preview-ok { color: var(--color-success); font-size: 14px; }

/* ── Pagination ── */
.pagination { display: flex; gap: 6px; justify-content: center; margin-top: 24px; }
.pagination a, .pagination span { padding: 8px 14px; border: 1px solid var(--color-border); border-radius: var(--radius-sm); font-size: 14px; color: var(--color-text-secondary); }
.pagination a:hover { background: var(--color-surface-alt); color: var(--color-text); }
.pagination .active { background: var(--color-primary); color: #fff; border-color: var(--color-primary); }

/* ── Tabs ── */
.tabs { display: flex; gap: 4px; border-bottom: 2px solid var(--color-border); margin-bottom: 24px; }
.tabs-center { justify-content: center; }
.tab { padding: 12px 20px; cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -2px; color: var(--color-text-secondary); font-weight: 500; font-size: 14px; transition: all var(--transition); }
.tab.active { color: var(--color-primary); border-bottom-color: var(--color-primary); }
.tab:hover:not(.active) { color: var(--color-text); }

/* ── Modal ── */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.5); display: none; align-items: center; justify-content: center; z-index: 1000; padding: 20px; }
.modal-overlay.show { display: flex; }
.modal { background: var(--color-surface); border-radius: var(--radius-lg); padding: 28px; max-width: 440px; width: 100%; box-shadow: var(--shadow-lg); }
.modal h3 { font-size: 1.2rem; margin:0; }
.modal p { color: var(--color-text-secondary); margin-bottom: 20px; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; }

.modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; }
.modal-close { background: none; border: none; font-size: 1.5rem; cursor: pointer; color: var(--color-text-secondary); line-height: 1; padding: 0 4px; }
.modal-close:hover { color: var(--color-text); }
.modal-body { margin-bottom: 20px; }
.modal-footer { display: flex; gap: 10px; justify-content: flex-end; }

/* ── 用户协议弹窗 ── */
.agreement-box { margin: 16px 0 8px; }
.agreement-label { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--color-text-secondary); cursor: pointer; user-select: none; }
.agreement-label input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--color-primary, #4f46e5); cursor: pointer; flex-shrink: 0; }
.agreement-link { color: var(--color-primary, #4f46e5); font-weight: 600; text-decoration: underline; cursor: pointer; }
.agreement-link:hover { text-decoration: none; }
.agreement-modal { max-width: 680px; max-height: 80vh; display: flex; flex-direction: column; background: var(--color-surface); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); }
.agreement-body { overflow-y: auto; font-size: 14px; line-height: 1.8; color: var(--color-text-secondary); padding-right: 8px; max-height: 55vh; }
.agreement-body h1, .agreement-body h2, .agreement-body h3 { color: var(--color-text); margin-top: 16px; }
.agreement-body p { margin-bottom: 12px; }
.agreement-modal .modal-footer { justify-content: center; padding-top: 12px; border-top: 1px solid var(--color-border); }

/* ── Category grid ── */
.category-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 20px; }
.category-card {
    background: var(--color-surface); border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm); overflow: hidden;
    transition: transform .2s, box-shadow .2s;
}
.category-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.category-card-cover {
    position: relative; height: 140px; background: var(--color-surface-alt);
    display: flex; align-items: center; justify-content: center; overflow: hidden;
}
.category-card-cover img { width: 100%; height: 100%; object-fit: cover; }
.category-card-placeholder {
    font-size: 2.5rem; font-weight: 700; color: var(--color-border);
    text-transform: uppercase; user-select: none;
}
.category-card-actions {
    position: absolute; top: 8px; right: 8px; display: flex; gap: 6px;
    opacity: 0; transition: opacity .2s;
}
.category-card:hover .category-card-actions { opacity: 1; }
.cat-action-btn {
    width: 32px; height: 32px; border-radius: 8px; border: none;
    display: flex; align-items: center; justify-content: center; cursor: pointer;
    background: rgba(255,255,255,.9); box-shadow: 0 1px 4px rgba(0,0,0,.1);
    transition: background .15s;
}
.cat-action-btn svg { width: 16px; height: 16px; }
.cat-action-edit { color: #2563eb; }
.cat-action-edit:hover { background: #dbeafe; }
.cat-action-delete { color: #dc2626; }
.cat-action-delete:hover { background: #fee2e2; }
.category-card-body { padding: 14px 16px; }
.category-card-title { font-size: 14px; font-weight: 600; margin-bottom: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.category-card-meta { font-size: 12px; color: var(--color-text-secondary); }

/* ── Dimension tags (admin questions editor) ── */
.dim-tag {
    display: inline-block; padding: 4px 10px; margin: 4px 8px 4px 0;
    background: var(--color-primary-light); color: var(--color-primary);
    border-radius: 20px; font-size: 13px; font-weight: 500;
}

/* ── Alert messages ── */
.alert { padding: 14px 18px; border-radius: var(--radius-md); margin-bottom: 20px; font-size: 14px; }
.alert-success { background: #f0fdf4; color: #166534; border: 1px solid #bbf7d0; }
.alert-error { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }
.alert-info { background: #eff6ff; color: #1e40af; border: 1px solid #bfdbfe; }

/* ── Image upload preview ── */
.upload-preview { margin-top: 10px; }
.upload-preview img { max-height: 120px; border-radius: var(--radius-md); border: 1px solid var(--color-border); }

/* ── Stat cards ── */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px,1fr)); gap: 20px; margin-bottom: 30px; }
.stat-card { background: var(--color-surface); border-radius: var(--radius-lg); padding: 24px; box-shadow: var(--shadow-sm); }
.stat-card .stat-label { font-size: 13px; color: var(--color-text-secondary); margin-bottom: 8px; }
.stat-card .stat-value { font-size: 2rem; font-weight: 700; color: var(--color-primary); }

/* ── Toast ── */
.toast {
    position: fixed; top: 80px; right: 20px; padding: 14px 22px;
    border-radius: 10px; box-shadow: 0 4px 12px rgba(0,0,0,.15);
    z-index: 9999; font-size: 14px; max-width: 360px;
    transition: opacity .3s;
}
.toast-success { background: #d1fae5; color: #065f46; }
.toast-error { background: #fee2e2; color: #991b1b; }
.toast-info { background: #dbeafe; color: #1e40af; }
.toast-warning { background: #fef3c7; color: #92400e; }
.toast.fade-out { opacity: 0; }

/* ── Responsive ── */
/* 汉堡菜单按钮（默认隐藏，移动端显示） */
.navbar-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 38px; height: 38px;
  background: var(--color-surface-alt);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  cursor: pointer; padding: 0;
  transition: all var(--transition);
}
.navbar-toggle:hover { background: var(--color-primary-light); border-color: var(--color-primary); }
.navbar-toggle svg { width: 20px; height: 20px; color: var(--color-text); }

/* 主题切换器 */
.theme-switcher {
  display: flex; align-items: center; gap: 2px;
  background: var(--color-surface-alt); border: 1px solid var(--color-border);
  border-radius: 30px; padding: 2px; height: 36px;
}
.theme-btn {
  width: 30px; height: 30px; border-radius: 50%; border: none;
  background: transparent; cursor: pointer; display: flex;
  align-items: center; justify-content: center; color: var(--color-text-secondary);
  transition: all var(--transition);
}
.theme-btn:hover { color: var(--color-text); }
.theme-btn.active { background: var(--color-surface); color: var(--color-primary); box-shadow: var(--shadow-sm); }
.theme-btn svg { width: 15px; height: 15px; }

/* 移动端下拉导航面板：绝对定位悬浮，不挤压页面内容 */
.navbar-mobile-menu {
  display: none;
  position: absolute;
  top: 60px; left: 0; right: 0;
  flex-direction: column;
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  box-shadow: var(--shadow-md);
  padding: 8px 0;
  z-index: 99;
}
.navbar-mobile-menu.open { display: flex; }
.mobile-menu-divider { height: 1px; background: var(--color-border); margin: 0 24px; }
.mobile-menu-link {
  display: block; padding: 14px 24px;
  color: var(--color-text); font-size: 15px; font-weight: 500;
  transition: all var(--transition);
}
.mobile-menu-link:hover { background: var(--color-surface-alt); color: var(--color-primary); }
.mobile-menu-link.mobile-menu-danger { color: var(--color-danger); }
.mobile-menu-link.mobile-menu-danger:hover { background: #fef2f2; }
:root[data-theme="dark"] .mobile-menu-link.mobile-menu-danger:hover { background: #2a1515; }

@media (max-width: 768px) {
  .navbar-inner { padding: 0 16px; gap: 8px; }
  /* 隐藏 PC 页面链接 */
  .navbar-links { display: none; }
  /* 显示汉堡按钮 */
  .navbar-toggle { display: flex; }
  /* 移动端隐藏用户名，只保留头像圆 */
  .avatar-name { display: none; }
  .avatar-btn { padding: 3px; border-radius: 50%; height: auto; }
  .avatar-img, .avatar-img-placeholder { width: 32px; height: 32px; flex-shrink: 0; }
  /* 移动端隐藏导航栏内的登录/注册按钮（移入下拉面板） */
  .navbar-login-btn, .navbar-register-btn { display: none; }
  .navbar-brand-text { font-size: 16px; }

  .hero { padding: 40px 0 30px; }
  .hero h1 { font-size: 1.5rem; }
  .cards-grid { grid-template-columns: 1fr; gap: 16px; padding: 24px 0; }
  .auth-card { padding: 28px 20px; }
  .admin-layout { flex-direction: column; }
  .admin-sidebar {
    width: 100%; height: auto; position: static;
    padding: 8px 0; overflow-x: auto; white-space: nowrap;
  }
  .admin-sidebar .sidebar-brand { padding: 4px 16px 8px; font-size: 16px; border-bottom: none; }
  .admin-sidebar .sidebar-nav { display: flex; gap: 2px; padding: 4px 12px; margin: 0 -12px; }
  .admin-sidebar .sidebar-section { display: none; }
  .admin-sidebar .sidebar-link { padding: 8px 14px; font-size: 13px; border-radius: var(--radius-md); white-space: nowrap; flex-shrink: 0; }
  .admin-main { padding: 16px; }
  .admin-table { font-size: 13px; }
  .admin-table th, .admin-table td { padding: 10px 8px; }
  .question-card { padding: 20px; }
  .result-card { padding: 24px 20px; }
  .modal { padding: 20px; }
  /* 移动端个人信息统计卡片单列 */
  .profile-info-grid { grid-template-columns: 1fr 1fr; }
  .profile-header { padding: 28px 20px; }
}
@media (max-width: 375px) {
  .container { padding: 0 12px; }
  .btn { padding: 9px 16px; font-size: 13px; }
}

/* ── Profile page ── */
.profile-header {
  background: var(--color-surface); border-radius: var(--radius-lg);
  padding: 40px 32px; text-align: center; margin-bottom: 24px;
  box-shadow: var(--shadow-sm); position: relative; overflow: hidden;
}
.profile-header::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 100px;
  background: linear-gradient(135deg, var(--color-gradient-1), var(--color-gradient-2));
}
.profile-avatar-wrap {
  position: relative; z-index: 1; display: inline-block; margin-bottom: 16px;
}
.profile-avatar {
  width: 96px; height: 96px; border-radius: 50%; object-fit: cover;
  border: 4px solid var(--color-surface); box-shadow: var(--shadow-md);
}
.profile-avatar-placeholder {
  width: 96px; height: 96px; border-radius: 50%; border: 4px solid var(--color-surface);
  background: var(--color-surface-alt); display: flex; align-items: center; justify-content: center;
  font-size: 36px; font-weight: 700; color: var(--color-primary); box-shadow: var(--shadow-md);
}
.profile-avatar-edit {
  position: absolute; bottom: 0; right: 0; width: 32px; height: 32px;
  border-radius: 50%; background: var(--color-primary); color: #fff;
  border: 3px solid var(--color-surface); cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all var(--transition);
}
.profile-avatar-edit:hover { background: var(--color-primary-hover); transform: scale(1.1); }
.profile-avatar-edit svg { width: 14px; height: 14px; }
.profile-name { position: relative; z-index: 1; font-size: 1.4rem; font-weight: 700; color: var(--color-text); }
.profile-email { position: relative; z-index: 1; color: var(--color-text-secondary); font-size: 14px; }

.profile-info-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px; margin-bottom: 24px;
}
.profile-info-item {
  background: var(--color-surface); border-radius: var(--radius-md); padding: 20px;
  box-shadow: var(--shadow-sm); text-align: center;
}
.profile-info-item .info-label { font-size: 12px; color: var(--color-text-muted); margin-bottom: 6px; text-transform: uppercase; letter-spacing: .5px; }
.profile-info-item .info-value { font-size: 1.1rem; font-weight: 600; color: var(--color-text); }

.profile-section {
  background: var(--color-surface); border-radius: var(--radius-lg);
  padding: 28px; box-shadow: var(--shadow-sm); margin-bottom: 24px;
}
.profile-section-header {
  display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px;
}
.profile-section-header h2 { font-size: 1.15rem; margin: 0; }
.profile-action-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 16px; border: 1px solid var(--color-border); border-radius: var(--radius-md);
  background: var(--color-surface); color: var(--color-text-secondary); cursor: pointer;
  font-size: 13px; transition: all var(--transition);
}
.profile-action-btn:hover { border-color: var(--color-primary); color: var(--color-primary); background: var(--color-primary-light); }
.profile-action-btn svg { width: 14px; height: 14px; }

.profile-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 14px 0; border-bottom: 1px solid var(--color-border);
}
.profile-row:last-child { border-bottom: none; }
.profile-row .row-label { color: var(--color-text-secondary); font-size: 14px; }
.profile-row .row-value { color: var(--color-text); font-size: 14px; font-weight: 500; }
.row-edit-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 28px; height: 28px; border-radius: 6px; border: none;
  background: transparent; color: var(--color-text-muted); cursor: pointer;
  transition: all var(--transition);
}
.row-edit-btn:hover { background: var(--color-surface-alt); color: var(--color-primary); }
.row-edit-btn svg { width: 14px; height: 14px; }

.edit-panel {
  display: none; margin-top: 16px; padding-top: 20px; border-top: 1px solid var(--color-border);
}
.edit-panel.show { display: block; }
