/* ============================================================
   工作记忆综合测试 · 视觉新版样式表
   仅修改视觉呈现：配色层次、圆角阴影、间距节奏、交互反馈。
   所有 class 名、id、data-*、状态语义（is-active / hidden /
   experiment-running / dataset.phase 等）与原版完全一致，
   实验逻辑、时序、文本、数据结构均未改动。
   ============================================================ */

:root {
  color-scheme: dark;

  /* ---- 背景分层 ---- */
  --background: #0e1312;
  --surface: #171e1c;
  --surface-raised: #1f2725;
  --surface-overlay: #26302d;

  /* ---- 文字 ---- */
  --text: #f2f6f4;
  --muted: #a9b8b2;
  --faint: #7d8d86;

  /* ---- 边框 ---- */
  --border: #3a4641;
  --border-soft: #262f2b;
  --border-strong: #55645d;

  /* ---- 主色（绿色家族，延续原版气质，略提亮） ---- */
  --primary: #4ed1a5;
  --primary-strong: #74e0bd;
  --primary-soft: rgba(78, 209, 165, 0.12);
  --primary-text: #06120d;

  /* ---- 强调色 ---- */
  --accent: #ffd166;
  --accent-strong: #ffdd85;
  --accent-soft: rgba(255, 209, 102, 0.1);

  /* ---- 实验刺激色（含义不变：蓝=方块常态，黄=激活） ---- */
  --block: #3d7bf5;
  --block-bright: #5a90f7;

  /* ---- 语义色 ---- */
  --danger: #ef8354;
  --danger-strong: #f49a76;

  /* ---- 焦点 ---- */
  --focus: #ffe08a;

  /* ---- 圆角分级 ---- */
  --radius-sm: 8px;
  --radius: 10px;
  --radius-lg: 16px;

  /* ---- 阴影分级（深色下：低透明黑影 + 顶部亮边） ---- */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.35);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.04);
  --shadow-lg: 0 16px 48px rgba(0, 0, 0, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.05);

  /* ---- 动效 ---- */
  --ease: cubic-bezier(0.4, 0, 0.2, 1);
  --duration: 180ms;

  --content-width: 960px;

  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif;
  font-synthesis: none;
  letter-spacing: 0;
}

* {
  box-sizing: border-box;
}

html {
  background: var(--background);
}

body {
  min-width: 320px;
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0;
  background:
    radial-gradient(1200px 600px at 70% -10%, rgba(78, 209, 165, 0.05), transparent 60%),
    var(--background);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

button,
input,
select {
  font: inherit;
  letter-spacing: 0;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

button:not(:disabled),
a[href] {
  cursor: pointer;
}

[hidden] {
  display: none !important;
}

:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ---------- 通用文字 ---------- */

.eyebrow {
  margin: 0 0 10px;
  color: var(--primary-strong);
  font-size: 13px;
  font-weight: 700;
  line-height: 1.4;
  letter-spacing: 0.04em;
}

.muted {
  color: var(--muted);
}

/* ---------- 顶部 Header ---------- */

.portal-header,
.task-header {
  width: 100%;
  border-bottom: 1px solid var(--border-soft);
  background: rgba(14, 19, 18, 0.82);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.portal-header__inner,
.task-header__inner {
  display: flex;
  width: min(calc(100% - 40px), var(--content-width));
  min-height: 66px;
  margin: 0 auto;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.brand {
  color: var(--text);
  font-size: 17px;
  font-weight: 700;
  letter-spacing: 0.01em;
  text-decoration: none;
}

.task-header__inner > .muted {
  min-width: 0;
  overflow: hidden;
  text-align: right;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* 服务器状态点：呼吸脉冲（仅在线/检查中），离线常亮红 */
.server-state {
  display: inline-flex;
  min-height: 32px;
  align-items: center;
  gap: 9px;
  color: var(--muted);
  font-size: 13px;
}

.server-state::before {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--accent);
  content: "";
  animation: pulse-dot 2s var(--ease) infinite;
}

.server-state[data-state="online"]::before {
  background: var(--primary);
  box-shadow: 0 0 8px rgba(78, 209, 165, 0.6);
}

.server-state[data-state="offline"]::before {
  background: var(--danger);
  animation: none;
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.45; }
}

/* ---------- 门户/区块骨架 ---------- */

.portal-main {
  width: min(calc(100% - 40px), var(--content-width));
  margin: 0 auto;
  padding: 68px 0 80px;
}

.portal-intro {
  max-width: 680px;
  margin-bottom: 52px;
}

.portal-intro h1,
.registration h1,
.instructions h1,
.completion h1,
.workflow-gate h1 {
  margin: 0;
  font-size: 34px;
  font-weight: 800;
  line-height: 1.25;
  letter-spacing: 0;
}

.portal-intro p:last-child {
  margin: 16px 0 0;
  color: var(--muted);
  font-size: 16px;
}

/* ---------- 任务列表（门户） ---------- */

.task-list {
  border-top: 1px solid var(--border);
}

.task-row {
  display: grid;
  min-height: 132px;
  padding: 26px 0;
  border-bottom: 1px solid var(--border);
  align-items: center;
  gap: 24px;
  grid-template-columns: 110px minmax(0, 1fr) auto;
}

.task-preview {
  position: relative;
  width: 110px;
  height: 78px;
  overflow: hidden;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  background: #0a0d0c;
  box-shadow: var(--shadow-sm);
}

.preview-block {
  position: absolute;
  width: 14px;
  height: 14px;
  border: 1px solid #dce6ff;
  border-radius: 3px;
  background: var(--block);
}

.preview-block:nth-child(1) { left: 55px; top: 7px; }
.preview-block:nth-child(2) { left: 12px; top: 14px; }
.preview-block:nth-child(3) { left: 85px; top: 26px; }
.preview-block:nth-child(4) { left: 34px; top: 29px; }
.preview-block:nth-child(5) { left: 59px; top: 39px; background: var(--accent); }
.preview-block:nth-child(6) { left: 90px; top: 52px; }
.preview-block:nth-child(7) { left: 7px; top: 55px; }
.preview-block:nth-child(8) { left: 36px; top: 61px; }
.preview-block:nth-child(9) { left: 63px; top: 59px; }

.digit-preview {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  color: var(--text);
  font-size: 25px;
  font-variant-numeric: tabular-nums;
}

.digit-preview span:nth-child(2) {
  color: var(--accent);
}

.task-copy {
  min-width: 0;
}

.task-copy h2 {
  margin: 0 0 6px;
  font-size: 20px;
  line-height: 1.35;
}

.task-copy p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}

/* ---------- 按钮体系 ---------- */

.button,
.icon-button {
  display: inline-flex;
  min-height: 48px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  align-items: center;
  justify-content: center;
  font-weight: 700;
  text-decoration: none;
  transition:
    background-color var(--duration) var(--ease),
    border-color var(--duration) var(--ease),
    box-shadow var(--duration) var(--ease),
    color var(--duration) var(--ease),
    transform var(--duration) var(--ease);
}

.button {
  min-width: 132px;
  padding: 12px 22px;
  background: var(--primary);
  color: var(--primary-text);
  box-shadow: 0 2px 8px rgba(78, 209, 165, 0.25);
}

@media (hover: hover) {
  .button:hover {
    background: var(--primary-strong);
    box-shadow: 0 6px 18px rgba(78, 209, 165, 0.35);
    transform: translateY(-1px);
  }
}

.button:active {
  transform: translateY(0);
  box-shadow: 0 1px 4px rgba(78, 209, 165, 0.25);
}

.button--secondary {
  border-color: var(--border);
  background: transparent;
  color: var(--text);
  box-shadow: none;
}

@media (hover: hover) {
  .button--secondary:hover {
    border-color: var(--primary);
    background: var(--surface);
    box-shadow: none;
    transform: translateY(-1px);
  }
}

.button--danger {
  min-width: auto;
  min-height: 40px;
  padding: 7px 14px;
  border-color: var(--border);
  background: transparent;
  color: var(--faint);
  font-size: 13px;
  font-weight: 600;
  box-shadow: none;
}

@media (hover: hover) {
  .button--danger:hover {
    border-color: var(--danger);
    color: var(--text);
    box-shadow: none;
    transform: none;
  }
}

.button:disabled,
.icon-button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
  transform: none;
  box-shadow: none;
}

.button-group {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

/* ---------- 任务页骨架 ---------- */

.task-page {
  display: flex;
  min-height: 100vh;
  min-height: 100dvh;
  flex-direction: column;
}

.task-page.experiment-running > .task-header {
  display: none;
}

.task-main {
  display: flex;
  width: 100%;
  flex: 1;
}

.site-footer {
  width: 100%;
  padding: 10px 20px 14px;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
  text-align: center;
}

.site-footer a {
  display: inline-flex;
  min-height: 44px;
  padding: 0 8px;
  align-items: center;
  color: inherit;
  text-decoration: none;
}

.site-footer a:hover,
.site-footer a:focus-visible {
  color: var(--text);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.task-page.experiment-running > .site-footer {
  display: none;
}

.task-section {
  width: min(calc(100% - 40px), 720px);
  margin: auto;
  padding: 56px 0 72px;
}

.task-section:focus {
  outline: none;
}

.registration .lead,
.instructions .lead,
.workflow-gate .lead {
  margin: 16px 0 36px;
  color: var(--muted);
  font-size: 16px;
}

/* ---------- 登记表单（卡片化） ---------- */

.participant-form {
  margin-top: 8px;
  padding: 30px 28px 28px;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-md);
}

.form-grid {
  display: grid;
  gap: 24px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.field--wide {
  grid-column: 1 / -1;
}

.field label,
.field-label {
  display: block;
  margin-bottom: 9px;
  color: var(--text);
  font-size: 14px;
  font-weight: 700;
}

.field input,
.field select {
  width: 100%;
  min-height: 50px;
  padding: 11px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-raised);
  color: var(--text);
  transition:
    border-color var(--duration) var(--ease),
    box-shadow var(--duration) var(--ease),
    background-color var(--duration) var(--ease);
}

.field input::placeholder {
  color: var(--faint);
}

@media (hover: hover) {
  .field input:hover,
  .field select:hover {
    border-color: var(--border-strong);
  }
}

.field input:focus,
.field select:focus {
  border-color: var(--primary);
  background: var(--surface-overlay);
  box-shadow: 0 0 0 3px var(--primary-soft);
  outline: none;
}

/* 知情同意 */
.check-field {
  display: flex;
  min-height: 48px;
  margin: 26px 0;
  padding: 14px 16px;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  align-items: flex-start;
  gap: 12px;
  background: var(--surface-raised);
  color: var(--muted);
  font-size: 14px;
  line-height: 1.65;
  cursor: pointer;
  transition: border-color var(--duration) var(--ease);
}

.check-field:has(input:checked) {
  border-color: var(--primary);
  color: var(--text);
}

.check-field input {
  flex: 0 0 auto;
  width: 20px;
  height: 20px;
  margin: 3px 0 0;
  accent-color: var(--primary);
}

/* 后续研究意愿（单选卡片） */
.follow-up-fieldset {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.follow-up-fieldset legend {
  width: 100%;
  margin-bottom: 12px;
  color: var(--text);
  font-size: 14px;
  font-weight: 700;
}

.follow-up-options {
  display: grid;
  gap: 12px;
}

.follow-up-option {
  position: relative;
  display: flex;
  min-height: 58px;
  padding: 13px 16px 13px 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  align-items: center;
  gap: 12px;
  background: var(--surface-raised);
  color: var(--muted);
  cursor: pointer;
  font-size: 14px;
  line-height: 1.55;
  transition:
    border-color var(--duration) var(--ease),
    background-color var(--duration) var(--ease),
    color var(--duration) var(--ease),
    box-shadow var(--duration) var(--ease);
}

/* 左侧选中色条 */
.follow-up-option::before {
  position: absolute;
  top: 12px;
  bottom: 12px;
  left: 0;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: transparent;
  content: "";
  transition: background-color var(--duration) var(--ease);
}

@media (hover: hover) {
  .follow-up-option:hover {
    border-color: var(--border-strong);
    color: var(--text);
  }
}

.follow-up-option:has(input:checked) {
  border-color: var(--primary);
  background: linear-gradient(135deg, var(--primary-soft), transparent 70%), var(--surface-raised);
  box-shadow: 0 0 0 1px var(--primary), 0 4px 14px rgba(78, 209, 165, 0.12);
  color: var(--text);
}

.follow-up-option:has(input:checked)::before {
  background: var(--primary);
}

.follow-up-option:has(input:focus-visible) {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

.follow-up-option input {
  flex: 0 0 auto;
  width: 20px;
  height: 20px;
  margin: 0;
  accent-color: var(--primary);
}

/* 奖励说明（高亮提示卡片） */
.follow-up-description {
  margin: 26px 0 0;
  padding: 20px 20px 20px 22px;
  border: 1px solid rgba(255, 209, 102, 0.28);
  border-left: 4px solid var(--accent);
  border-radius: var(--radius);
  background: linear-gradient(135deg, var(--accent-soft), transparent 75%), var(--surface-raised);
  color: var(--text);
  font-size: 14px;
  line-height: 1.75;
}

.follow-up-description p {
  margin: 0;
}

.follow-up-description > p:first-child {
  color: var(--muted);
}

.follow-up-description > p:first-child .reward-money {
  color: var(--accent-strong);
}

.follow-up-description p + p {
  margin-top: 12px;
}

.reward-money {
  color: var(--accent-strong);
  font-weight: 700;
}

.effort-copy {
  font-weight: 600;
  color: var(--text);
}

.follow-up-privacy {
  margin: 20px 0 0;
  color: var(--faint);
  font-size: 12px;
  line-height: 1.6;
}

.form-message {
  min-height: 28px;
  margin: -4px 0 14px;
  color: var(--accent);
  font-size: 14px;
}

/* 登记主按钮更醒目 */
#register-button {
  width: 100%;
  min-height: 54px;
  font-size: 16px;
}

/* ---------- 恢复面板 ---------- */

.resume-panel {
  display: flex;
  margin: 30px 0 10px;
  padding: 22px 24px;
  border: 1px solid var(--primary);
  border-radius: var(--radius-lg);
  align-items: center;
  justify-content: space-between;
  gap: 22px;
  background: linear-gradient(135deg, var(--primary-soft), transparent 70%), var(--surface);
  box-shadow: 0 0 0 1px rgba(78, 209, 165, 0.25), var(--shadow-md);
}

.resume-panel strong {
  font-size: 16px;
}

.resume-panel p {
  margin: 6px 0 0;
  color: var(--muted);
}

/* ---------- 流程进度条 ---------- */

.workflow-progress {
  display: grid;
  margin: 0 0 48px;
  padding: 0;
  list-style: none;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.workflow-progress li {
  position: relative;
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 12px;
  color: var(--faint);
  font-size: 13px;
}

.workflow-progress li:not(:last-child)::after {
  position: absolute;
  z-index: 0;
  top: 20px;
  right: 12px;
  left: 52px;
  height: 2px;
  border-radius: 2px;
  background: var(--border);
  content: "";
}

.workflow-progress li[data-state="completed"]:not(:last-child)::after {
  background: linear-gradient(90deg, var(--primary), var(--border));
}

.workflow-progress li > span {
  position: relative;
  z-index: 1;
  display: inline-flex;
  width: 40px;
  height: 40px;
  flex: 0 0 40px;
  border: 2px solid var(--border);
  border-radius: 50%;
  align-items: center;
  justify-content: center;
  background: var(--background);
  color: var(--muted);
  font-size: 15px;
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  transition:
    border-color var(--duration) var(--ease),
    background-color var(--duration) var(--ease),
    color var(--duration) var(--ease),
    box-shadow var(--duration) var(--ease);
}

.workflow-progress li strong {
  font-weight: 600;
}

.workflow-progress li[data-state="current"] {
  color: var(--text);
}

.workflow-progress li[data-state="current"] > span {
  border-color: var(--accent);
  color: var(--accent);
  box-shadow: 0 0 0 5px var(--accent-soft);
  animation: step-glow 2.2s var(--ease) infinite;
}

@keyframes step-glow {
  0%, 100% { box-shadow: 0 0 0 5px var(--accent-soft); }
  50% { box-shadow: 0 0 0 8px rgba(255, 209, 102, 0.05); }
}

.workflow-progress li[data-state="completed"] {
  color: var(--muted);
}

.workflow-progress li[data-state="completed"] > span {
  border-color: var(--primary);
  background: var(--primary);
  color: var(--primary-text);
}

/* 完成步骤：✓ 覆盖数字（纯 CSS 视觉，不改 DOM 文本） */
.workflow-progress li[data-state="completed"] > span::after {
  content: "✓";
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--primary);
  border-radius: 50%;
  color: var(--primary-text);
}

/* ---------- 指导语列表 ---------- */

.instruction-list {
  margin: 30px 0 38px;
  padding: 8px 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  color: var(--muted);
  list-style: none;
  counter-reset: instruction;
}

.instruction-list li {
  position: relative;
  padding: 14px 8px 14px 46px;
  counter-increment: instruction;
  line-height: 1.65;
}

.instruction-list li + li {
  border-top: 1px solid var(--border-soft);
  margin-top: 0;
}

.instruction-list li::before {
  position: absolute;
  top: 16px;
  left: 8px;
  display: flex;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  align-items: center;
  justify-content: center;
  background: var(--primary-soft);
  color: var(--primary-strong);
  content: counter(instruction);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  font-weight: 700;
}

/* 门槛页 CTA 更大 */
#start-current-task {
  min-height: 54px;
  min-width: 180px;
  font-size: 16px;
}

/* ---------- 实验区（严格微调区） ---------- */

.experiment {
  display: flex;
  width: 100%;
  min-height: 100vh;
  min-height: 100dvh;
  flex-direction: column;
  background: #090c0b;
}

.experiment:focus {
  outline: none;
}

.experiment-toolbar {
  display: grid;
  min-height: 66px;
  padding: 10px 20px;
  border-bottom: 1px solid #232b28;
  align-items: center;
  gap: 16px;
  background: rgba(14, 19, 18, 0.9);
  grid-template-columns: minmax(0, 1fr) auto auto;
}

.experiment-title {
  overflow: hidden;
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  line-height: 1.4;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.experiment-meta {
  display: flex;
  align-items: center;
  gap: 18px;
  color: var(--muted);
  font-size: 14px;
  font-variant-numeric: tabular-nums;
}

/* 进度文本更醒目 */
.experiment-meta > span:first-child {
  color: var(--text);
  font-weight: 700;
}

.save-status {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  white-space: nowrap;
}

.save-status::before {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  content: "";
}

.save-status[data-state="saved"]::before {
  background: var(--primary);
}

.save-status[data-state="error"]::before {
  background: var(--danger);
}

.experiment-stage {
  display: flex;
  min-height: 0;
  flex: 1;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

/* 阶段提示：引导被试"现在该做什么"，字号与对比度提升 */
.phase-message {
  width: min(100%, 680px);
  min-height: 34px;
  margin: 0 0 14px;
  color: #d5ded9;
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-align: center;
}

/* 注视点：尺寸不变，仅微调亮度 */
.fixation {
  display: flex;
  width: 120px;
  height: 120px;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  font-size: 58px;
  font-weight: 300;
  line-height: 1;
}

/* Corsi 方块：尺寸/位置/颜色含义/60ms 过渡特性全部保留 */
.corsi-board {
  position: relative;
  width: min(90vw, calc((100dvh - 190px) * 1.333), 820px);
  max-width: 820px;
  aspect-ratio: 4 / 3;
  border-radius: var(--radius-lg);
  touch-action: manipulation;
  user-select: none;
}

.corsi-block {
  position: absolute;
  width: 9.5%;
  aspect-ratio: 1;
  padding: 0;
  border: 2px solid #dfe8ff;
  border-radius: 4px;
  background: var(--block);
  box-shadow: 0 3px 0 rgba(0, 0, 0, 0.45), 0 6px 14px rgba(0, 0, 0, 0.3);
  transform: translate(-50%, -50%);
  transition: background-color 60ms linear, transform 60ms linear, border-color 60ms linear;
}

@media (hover: hover) {
  .corsi-block:hover:not(:disabled) {
    border-color: #ffffff;
    background: var(--block-bright);
  }
}

.corsi-block.is-active {
  background: var(--accent-strong);
  border-color: #fff6d8;
  box-shadow: 0 0 24px rgba(255, 209, 102, 0.5), 0 3px 0 rgba(0, 0, 0, 0.3);
  transform: translate(-50%, -50%) scale(1.08);
}

.corsi-block:disabled {
  cursor: default;
}

.corsi-controls {
  display: flex;
  min-height: 56px;
  margin-top: 10px;
  align-items: center;
  justify-content: center;
}

.icon-button {
  width: 52px;
  height: 52px;
  padding: 0;
  border-color: var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 25px;
}

@media (hover: hover) {
  .icon-button:hover:not(:disabled) {
    border-color: var(--primary);
    background: var(--surface-raised);
  }
}

/* 数字刺激：字号区域不变，仅微调对比 */
.digit-stage {
  display: grid;
  width: min(100%, 560px);
  min-height: 560px;
  align-content: center;
  justify-items: center;
}

.stimulus-value {
  display: flex;
  width: 180px;
  height: 160px;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  font-size: 96px;
  font-variant-numeric: tabular-nums;
  font-weight: 500;
  line-height: 1;
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.4);
}

/* 作答面板 */
.response-panel {
  display: grid;
  width: min(100%, 380px);
  min-height: 520px;
  align-content: start;
  justify-items: center;
}

.response-label {
  margin: 2px 0 10px;
  color: var(--muted);
  font-size: 14px;
}

.response-value {
  width: 100%;
  min-height: 74px;
  overflow-wrap: anywhere;
  padding: 12px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  color: var(--text);
  font-size: 30px;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  letter-spacing: 0.08em;
  line-height: 1.5;
  text-align: center;
}

/* 数字键盘：更大更易按 */
.keypad {
  display: grid;
  width: 100%;
  margin-top: 18px;
  gap: 10px;
  grid-template-columns: repeat(3, minmax(72px, 1fr));
}

.keypad-button {
  min-height: 64px;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-raised);
  color: var(--text);
  font-size: 22px;
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  box-shadow: var(--shadow-sm);
  transition:
    background-color var(--duration) var(--ease),
    border-color var(--duration) var(--ease),
    box-shadow var(--duration) var(--ease),
    transform 100ms var(--ease);
}

@media (hover: hover) {
  .keypad-button:hover {
    border-color: var(--primary);
    background: var(--surface-overlay);
  }
}

.keypad-button:active {
  transform: scale(0.96);
}

.keypad-button--action {
  font-size: 18px;
  color: var(--muted);
}

.keypad-button--submit {
  border-color: var(--primary);
  background: var(--primary);
  color: var(--primary-text);
  font-size: 18px;
  box-shadow: 0 2px 8px rgba(78, 209, 165, 0.3);
}

@media (hover: hover) {
  .keypad-button--submit:hover {
    background: var(--primary-strong);
    border-color: var(--primary-strong);
  }
}

/* ---------- 完成页 ---------- */

.completion {
  max-width: 760px;
}

.result-grid {
  display: grid;
  margin: 36px 0;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-md);
  overflow: hidden;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.result-item {
  min-width: 0;
  padding: 28px 22px;
  border-right: 1px solid var(--border-soft);
}

.result-item:last-child {
  border-right: 0;
}

.result-label {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 13px;
}

.result-value {
  display: block;
  overflow-wrap: anywhere;
  color: var(--text);
  font-size: 32px;
  font-variant-numeric: tabular-nums;
  font-weight: 800;
}

.completion-status {
  min-height: 30px;
  margin: 0 0 22px;
  color: var(--muted);
}

/* 综合版完成页：被试编号大卡 */
.completion-summary {
  display: flex;
  margin: 36px 0 24px;
  padding: 30px 32px;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-lg);
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  background: linear-gradient(135deg, var(--primary-soft), transparent 65%), var(--surface);
  box-shadow: var(--shadow-md);
  color: var(--muted);
  font-size: 15px;
}

.completion-summary strong {
  color: var(--primary-strong);
  font-size: 40px;
  font-variant-numeric: tabular-nums;
  font-weight: 800;
  letter-spacing: 0.03em;
}

/* ---------- 退出确认对话框 ---------- */

.confirm-dialog {
  width: min(calc(100% - 32px), 460px);
  padding: 30px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface-raised);
  box-shadow: var(--shadow-lg);
  color: var(--text);
}

.confirm-dialog::backdrop {
  background: rgba(0, 0, 0, 0.78);
  backdrop-filter: blur(4px);
}

.confirm-dialog h2 {
  margin: 0;
  font-size: 21px;
  line-height: 1.35;
}

.confirm-dialog p {
  margin: 14px 0 26px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.65;
}

.confirm-dialog__actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}

/* ---------- 响应式 ---------- */

@media (max-width: 700px) {
  .portal-header__inner,
  .task-header__inner,
  .portal-main,
  .task-section {
    width: min(calc(100% - 28px), var(--content-width));
  }

  .portal-main {
    padding-top: 44px;
  }

  .portal-intro h1,
  .registration h1,
  .instructions h1,
  .completion h1,
  .workflow-gate h1 {
    font-size: 28px;
  }

  .participant-form {
    padding: 24px 20px 22px;
  }

  .task-row {
    grid-template-columns: 82px minmax(0, 1fr);
    gap: 16px;
  }

  .task-preview {
    width: 82px;
    height: 70px;
    transform-origin: left center;
  }

  .task-row .button {
    width: 100%;
    grid-column: 1 / -1;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }

  .field--wide {
    grid-column: auto;
  }

  .experiment-toolbar {
    min-height: 76px;
    padding: 8px 12px;
    gap: 8px;
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .experiment-meta {
    gap: 10px;
    grid-column: 1;
    grid-row: 2;
  }

  .button--danger {
    grid-column: 2;
    grid-row: 1 / span 2;
  }

  .experiment-stage {
    padding: 12px;
  }

  .corsi-board {
    width: min(95vw, calc((100dvh - 220px) * 1.333));
  }

  .corsi-block {
    width: max(44px, 12%);
  }

  .corsi-block[data-block="6"] {
    left: 6.5% !important;
  }

  .digit-stage {
    min-height: 480px;
  }

  .stimulus-value {
    height: 130px;
    font-size: 72px;
  }

  .response-panel {
    min-height: 455px;
  }

  .keypad-button {
    min-height: 56px;
  }

  .result-grid {
    grid-template-columns: 1fr;
  }

  .result-item {
    display: flex;
    padding: 18px 20px;
    border-right: 0;
    border-bottom: 1px solid var(--border-soft);
    align-items: center;
    justify-content: space-between;
    gap: 20px;
  }

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

  .result-label {
    margin: 0;
  }

  .result-value {
    font-size: 25px;
  }

  .completion-summary strong {
    font-size: 32px;
  }

  .button-group .button {
    width: 100%;
  }
}

@media (max-width: 360px) {
  .corsi-block[data-block="0"] {
    top: 10% !important;
  }

  .corsi-block[data-block="6"] {
    left: 7.5% !important;
  }

  .corsi-block[data-block="7"] {
    top: 90% !important;
  }
}

@media (max-height: 700px) {
  .experiment-toolbar {
    min-height: 64px;
  }

  .experiment-stage {
    padding-top: 8px;
    padding-bottom: 8px;
  }

  .phase-message {
    min-height: 26px;
    margin-bottom: 6px;
  }

  .digit-stage {
    min-height: 390px;
  }

  .response-panel {
    min-height: 370px;
  }

  .response-value {
    min-height: 58px;
    padding: 8px 14px;
    font-size: 26px;
  }

  .keypad {
    margin-top: 10px;
    gap: 8px;
  }

  .keypad-button {
    min-height: 50px;
  }
}

@media (max-width: 430px) {
  .brand {
    max-width: 176px;
    font-size: 15px;
    line-height: 1.3;
  }

  .server-state {
    max-width: 128px;
    justify-content: flex-end;
    line-height: 1.25;
    text-align: right;
  }

  .confirm-dialog__actions {
    flex-direction: column-reverse;
  }

  .confirm-dialog__actions .button {
    width: 100%;
  }

  .task-section {
    padding-top: 40px;
  }
}

/* ---------- 响应式：流程进度条小屏 ---------- */

@media (max-width: 700px) {
  .workflow-header-meta {
    gap: 8px;
  }

  .workflow-header-meta > .muted {
    display: none;
  }

  .resume-panel {
    align-items: stretch;
    flex-direction: column;
  }

  .workflow-progress {
    gap: 8px;
  }

  .workflow-progress li {
    align-items: flex-start;
    flex-direction: column;
    gap: 8px;
  }

  .workflow-progress li:not(:last-child)::after {
    top: 20px;
    right: 0;
    left: 46px;
  }

  .workflow-progress li strong {
    font-size: 12px;
    line-height: 1.35;
  }
}

/* ---------- 减少动效偏好 ---------- */

@media (prefers-reduced-motion: reduce) {
  * {
    scroll-behavior: auto !important;
  }

  .button,
  .icon-button,
  .keypad-button,
  .field input,
  .field select,
  .follow-up-option,
  .check-field,
  .workflow-progress li > span,
  .corsi-block {
    transition: none;
  }

  .server-state::before,
  .workflow-progress li[data-state="current"] > span {
    animation: none;
  }
}

/* ---------- 综合版 header 元信息 ---------- */

.workflow-header-meta {
  display: flex;
  min-width: 0;
  align-items: center;
  justify-content: flex-end;
  gap: 18px;
}

.workflow-header-meta > .muted {
  white-space: nowrap;
}
