:root {
  --bg: #faf8f5;
  --bg-card: #fffef9;
  --bg-muted: #f3efe8;
  --text: #3d3832;
  --text-soft: #7a7268;
  --border: #e8e2d8;
  --accent: #8b7355;
  --accent-hover: #6f5c44;
  --progress: #c4a882;
  --shadow: 0 8px 32px rgba(61, 56, 50, 0.06);
  --cat-anger-bg: #fde8e8;
  --cat-anger-border: #e8a0a0;
  --cat-anger-dot: #c45c5c;
  --cat-sigh-bg: #fef6e0;
  --cat-sigh-border: #e8c878;
  --cat-sigh-dot: #b8860b;
  --cat-heal-bg: #e8f5ee;
  --cat-heal-border: #8ecfaa;
  --cat-heal-dot: #3d9a6a;
  /* 整体字号略放大，手机阅读更舒服 */
  --fs-base: 1.125rem;
  --fs-sm: 0.9375rem;
  --fs-lg: 1.25rem;
  --fs-xl: 1.375rem;
  --fs-title: 2rem;
  --fs-topic: 1.2rem;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: var(--fs-base);
  line-height: 1.65;
}

.hidden {
  display: none !important;
}

.shell {
  max-width: 720px;
  margin: 0 auto;
  padding: 24px 16px 40px;
}

.center-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow);
}

.page-title {
  font-size: var(--fs-title);
  font-weight: 700;
  margin: 0 0 8px;
  color: var(--text);
  letter-spacing: 0.02em;
}

h1 {
  font-size: var(--fs-xl);
  font-weight: 700;
  margin: 0 0 8px;
  color: var(--text);
}

.slogan {
  margin: 0 0 20px;
  font-size: var(--fs-lg);
  font-weight: 600;
  color: var(--accent);
  letter-spacing: 0.04em;
}

.sub {
  color: var(--text-soft);
  font-size: var(--fs-base);
  margin: 0 0 24px;
}

/* 测评页：顶栏固定，选项区垂直居中 */
.test-page {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
}

.test-top {
  flex-shrink: 0;
  padding-top: 16px;
  padding-bottom: 12px;
}

.test-top .progress-bar {
  margin-top: 10px;
}

.test-main {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px 0 20px;
  min-height: 0;
}

.test-footer {
  flex-shrink: 0;
  text-align: center;
  padding: 8px 16px 24px;
}

.pair-wrap {
  width: 100%;
  max-width: 520px;
  margin: 0 auto;
  padding: 0 20px;
}

.question-prompt {
  text-align: center;
  margin: 0 0 18px;
  font-size: var(--fs-lg);
  line-height: 1.5;
  font-weight: 600;
  color: var(--text);
}

/* 对比页：选项正文再大一点，方便阅读 */
.test-page .question-prompt {
  font-size: 1.35rem;
}

.test-page .topic-text {
  font-size: 1.4rem;
  line-height: 1.6;
}

.text-meta {
  font-size: var(--fs-sm);
  color: var(--text-soft);
}

.btn {
  border: none;
  border-radius: 12px;
  padding: 16px 32px;
  font-size: var(--fs-base);
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.12s ease, background 0.15s;
}

.btn:active {
  transform: scale(0.98);
}

.btn-primary {
  background: var(--accent);
  color: #fffef9;
}

.btn-primary:hover {
  background: var(--accent-hover);
}

.btn-ghost {
  background: transparent;
  color: var(--text-soft);
  font-size: var(--fs-sm);
  padding: 8px 12px;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.btn-small {
  background: var(--bg-muted);
  color: var(--text-soft);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 14px;
  font-size: var(--fs-sm);
  cursor: pointer;
}

.progress-wrap {
  margin: 24px 0;
}

.progress-meta {
  display: flex;
  justify-content: space-between;
  font-size: var(--fs-sm);
  color: var(--text-soft);
  margin-bottom: 8px;
}

.progress-bar {
  height: 8px;
  background: var(--bg-muted);
  border-radius: 4px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--progress), var(--accent));
  border-radius: 4px;
  transition: width 0.35s ease;
}

.header-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.user-tag {
  font-size: var(--fs-sm);
  color: var(--text-soft);
  background: var(--bg-muted);
  padding: 4px 10px;
  border-radius: 20px;
}

.topic-btn {
  width: 100%;
  text-align: left;
  background: var(--bg-card);
  border: 2px solid var(--border);
  border-radius: 14px;
  padding: 16px 18px;
  cursor: pointer;
  transition: border-color 0.2s ease, opacity 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
  margin-bottom: 10px;
  font: inherit;
  color: inherit;
  appearance: none;
  -webkit-appearance: none;
  outline: none;
  box-shadow: none;
  -webkit-tap-highlight-color: transparent;
}

.topic-btn:last-child {
  margin-bottom: 0;
}

/* 避免打开页面时第一个按钮因焦点/悬停显得边框更深 */
.topic-btn:focus,
.topic-btn:focus-visible {
  border-color: var(--border);
  box-shadow: none;
}

@media (hover: hover) and (pointer: fine) {
  .topic-btn:hover:not(:disabled):not(.chosen):not(.faded) {
    border-color: var(--accent);
    box-shadow: var(--shadow);
  }
}

.topic-btn:disabled {
  cursor: default;
}

.topic-btn.chosen {
  border-color: var(--accent);
  transform: scale(1.01);
  box-shadow: var(--shadow);
}

.topic-btn.faded {
  opacity: 0.45;
  transform: scale(0.98);
  border-color: var(--border);
}

.tag {
  display: inline-block;
  font-size: var(--fs-sm);
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 20px;
  margin-right: 8px;
}

.tag-愤怒 {
  background: var(--cat-anger-bg);
  color: var(--cat-anger-dot);
  border: 1px solid var(--cat-anger-border);
}

.tag-无奈 {
  background: var(--cat-sigh-bg);
  color: var(--cat-sigh-dot);
  border: 1px solid var(--cat-sigh-border);
}

.tag-疗愈 {
  background: var(--cat-heal-bg);
  color: var(--cat-heal-dot);
  border: 1px solid var(--cat-heal-border);
}

.topic-text {
  margin: 0;
  font-size: var(--fs-topic);
  line-height: 1.55;
  color: var(--text);
}

.rank-row {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}

.rank-row:last-child {
  border-bottom: none;
}

.rank-body {
  flex: 1;
  font-size: var(--fs-base);
  line-height: 1.65;
}

.rank-num {
  font-weight: 700;
  min-width: 36px;
  font-size: var(--fs-base);
  color: var(--text-soft);
}

.rank-num.top {
  color: var(--accent);
}

.rank-bar {
  margin: 8px 0 0 42px;
  height: 3px;
  background: var(--bg-muted);
  border-radius: 2px;
}

.rank-bar-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 2px;
}

.rank-empty {
  margin: 0;
  padding: 32px 20px;
  text-align: center;
  color: var(--text-soft);
  font-size: var(--fs-base);
  line-height: 1.75;
}

input[type="text"],
input[type="password"] {
  width: 100%;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: var(--fs-base);
  background: #fff;
  margin-bottom: 12px;
}

.admin-panel {
  margin-top: 32px;
  padding: 20px;
  border-top: 1px dashed var(--border);
}

.admin-panel h2 {
  font-size: var(--fs-base);
  margin: 0 0 12px;
}

.admin-note {
  font-size: var(--fs-sm);
  color: var(--text-soft);
  margin: 12px 0 0;
}

.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--text);
  color: var(--bg);
  padding: 12px 22px;
  border-radius: 8px;
  font-size: var(--fs-sm);
  opacity: 0;
  transition: opacity 0.3s;
  pointer-events: none;
  z-index: 100;
}

.toast.show {
  opacity: 1;
}
