.test-container {
  background: var(--color-paper);
  border: 1px solid var(--color-border);
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.05);
  padding: 40px;
}

.test-header {
  text-align: center;
  padding-bottom: 24px;
  border-bottom: 1px dashed var(--color-border);
  margin-bottom: 32px;
}

.test-logo {
  font-size: 32px;
  font-weight: bold;
  color: var(--color-accent);
  text-shadow: 2px 2px 0 var(--color-accent-soft);
  letter-spacing: 4px;
  margin-bottom: 4px;
}

.test-version {
  font-family: var(--font-mono);
  font-size: 18px;
  color: var(--color-text-muted);
  letter-spacing: 1px;
  text-shadow: none;
  margin-left: 8px;
}

.test-tagline {
  font-size: 13px;
  color: var(--color-text-muted);
  margin-top: 6px;
}

.progress-bar {
  position: relative;
  height: 18px;
  background: #ebe5d2;
  border: 1px solid var(--color-border);
  margin-bottom: 32px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: var(--color-progress);
  background-image:
    repeating-linear-gradient(
      90deg,
      transparent,
      transparent 6px,
      rgba(255, 255, 255, 0.25) 6px,
      rgba(255, 255, 255, 0.25) 8px
    );
  transition: width 0.4s ease;
  width: 0%;
}

.progress-text {
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--color-text);
  line-height: 18px;
  font-weight: bold;
}

.test-main {
  min-height: 380px;
  display: flex;
  flex-direction: column;
}

.question-text {
  font-size: 19px;
  line-height: 1.8;
  margin-bottom: 28px;
  white-space: pre-line;
  min-height: 60px;
}

.options-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 32px;
  flex: 1;
}

.option {
  background: #fafaf2;
  border: 1px solid #e0d8c0;
  padding: 14px 18px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}

.option:hover {
  background: #eef3fb;
  border-color: var(--color-button);
}

.option.selected {
  background: #e0eaf8;
  border-color: var(--color-button);
}

.option label {
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
}

.option input {
  display: none;
}

.option-letter {
  font-family: var(--font-mono);
  font-weight: bold;
  color: var(--color-accent);
  width: 20px;
  flex-shrink: 0;
}

.option-text {
  flex: 1;
}

.next-button {
  align-self: flex-end;
  background: linear-gradient(180deg, #6a8fd0, #4a6fb0);
  color: white;
  padding: 10px 28px;
  border-radius: 4px;
  font-size: 15px;
  box-shadow: 0 2px 4px rgba(74, 111, 176, 0.3);
  letter-spacing: 2px;
  transition: background 0.15s;
}

.next-button:disabled {
  background: #bbb;
  cursor: not-allowed;
  box-shadow: none;
}

.next-button:not(:disabled):hover {
  background: linear-gradient(180deg, #7a9fd8, #5a7fc0);
}

.test-footer {
  text-align: center;
  padding-top: 24px;
  margin-top: 32px;
  border-top: 1px dashed var(--color-border);
  font-size: 12px;
  color: var(--color-text-muted);
}

.test-footer a {
  color: var(--color-button);
  text-decoration: underline;
  margin: 0 6px;
}

.result-container {
  background: var(--color-paper);
  border: 1px solid var(--color-border);
  padding: 60px 40px;
  text-align: center;
}

.result-container h2 {
  font-size: 24px;
  margin-bottom: 24px;
  color: var(--color-accent);
  letter-spacing: 2px;
}

.result-container p {
  font-size: 18px;
  margin-bottom: 12px;
}

.result-container strong {
  font-family: var(--font-mono);
  font-size: 28px;
  color: var(--color-accent);
  letter-spacing: 4px;
}

.result-note {
  margin-top: 32px;
  font-size: 13px;
  color: var(--color-text-muted);
  font-style: italic;
}

/* ===== overlay slot：摘要 / 封缄预测 / Q16 反转 ===== */

.overlay-slot {
  margin-bottom: 24px;
}

.overlay-slot:empty {
  margin-bottom: 0;
}

/* 摘要 */
.summary-overlay {
  background: #f8f4e6;
  border: 1px solid var(--color-border);
  border-left: 3px solid var(--color-accent);
  padding: 28px 32px;
  font-size: 17px;
  line-height: 2;
  white-space: pre-line;
  font-style: italic;
  color: #333;
  letter-spacing: 0.5px;
}

.summary-continue {
  margin-top: 20px;
  display: block;
  margin-left: auto;
  font-style: normal;
}

/* 封缄预测 */
.sealed-prediction {
  background: #2a2622;
  color: #b8a888;
  padding: 20px 24px;
  border: 2px solid #44392e;
  text-align: center;
  font-family: var(--font-mono);
  letter-spacing: 2px;
  position: relative;
  transition: background 0.6s ease, color 0.6s ease, border-color 0.6s ease;
  overflow: hidden;
}

.sealed-prediction::before {
  content: '⌬';
  display: block;
  font-size: 24px;
  color: #6a4a3a;
  margin-bottom: 8px;
  transition: color 0.6s ease;
}

.sealed-prediction .sealed-prompt {
  font-size: 14px;
  letter-spacing: 1px;
  font-family: var(--font-serif);
  white-space: pre-line;
  min-height: 22px;
}

.sealed-prediction .sealed-letter {
  display: block;
  font-size: 36px;
  margin: 16px 0 8px;
  letter-spacing: 8px;
  font-weight: bold;
  color: #5a4838;
  transition: color 0.6s ease;
}

.sealed-prediction .sealed-line {
  font-size: 14px;
  letter-spacing: 1px;
  font-family: var(--font-serif);
  min-height: 22px;
  color: var(--color-accent);
}

.sealed-prediction.revealed {
  background: #fefdf4;
  color: var(--color-accent);
  border-color: var(--color-accent);
  border-style: dashed;
}

.sealed-prediction.revealed::before {
  content: '✕';
  color: #c0392b;
}

.sealed-prediction.revealed .sealed-letter {
  color: var(--color-accent);
}

.sealed-prediction.fading {
  opacity: 0;
  transition: opacity 0.8s ease;
}

/* Q16 反转 */
.q16-reveal {
  background: var(--color-paper);
  border: 1px solid var(--color-border);
  padding: 32px;
  white-space: pre-line;
  font-size: 17px;
  line-height: 2;
  letter-spacing: 1px;
  color: var(--color-text);
}

/* 收尾：人格码 + 进度条 + 崩溃 */

.persona-code {
  font-family: var(--font-mono);
  font-size: 36px !important;
  color: var(--color-accent);
  letter-spacing: 8px;
  text-shadow: 2px 2px 0 var(--color-accent-soft);
  display: inline-block;
  margin: 12px 0;
}

.result-status {
  margin-top: 32px;
  font-family: var(--font-mono);
  font-size: 14px;
  color: var(--color-text-muted);
  min-height: 22px;
}

.loading-bar {
  margin: 16px auto 0;
  width: 280px;
  height: 12px;
  background: #ebe5d2;
  border: 1px solid var(--color-border);
  overflow: hidden;
}

.loading-fill {
  height: 100%;
  width: 0%;
  background: var(--color-progress);
  background-image:
    repeating-linear-gradient(
      90deg,
      transparent,
      transparent 6px,
      rgba(255, 255, 255, 0.25) 6px,
      rgba(255, 255, 255, 0.25) 8px
    );
}

@keyframes crash-glitch {
  0%   { filter: none; transform: none; }
  10%  { filter: hue-rotate(180deg) contrast(1.4); transform: translateX(-3px); }
  20%  { filter: invert(1); transform: translateX(4px); }
  30%  { filter: none; transform: skewX(-2deg); }
  45%  { filter: hue-rotate(45deg) saturate(2); transform: translateY(2px); }
  60%  { filter: invert(1) brightness(1.5); transform: translate(-2px, 2px); }
  75%  { filter: none; transform: scale(1.02); }
  90%  { filter: brightness(0.2); transform: none; }
  100% { filter: brightness(0); transform: none; opacity: 0; }
}

@keyframes crash-rgb-split {
  0%, 100% { text-shadow: none; }
  20%      { text-shadow: -2px 0 #ff003c, 2px 0 #00d4ff; }
  40%      { text-shadow:  2px 0 #ff003c, -2px 0 #00d4ff; }
  60%      { text-shadow: -3px 1px #ff00aa, 3px -1px #00ff88; }
  80%      { text-shadow:  1px -1px #ff003c, -1px 1px #00d4ff; }
}

@keyframes crash-shake {
  0%, 100% { transform: translate(0, 0); }
  20%      { transform: translate(-4px, 2px) skewX(0.6deg); }
  40%      { transform: translate(3px, -3px) skewX(-0.4deg); }
  60%      { transform: translate(-2px, 4px) skewY(0.5deg); }
  80%      { transform: translate(2px, -2px); }
}

@keyframes crash-filter-pulse {
  0%, 100% { filter: none; }
  25%      { filter: hue-rotate(45deg) contrast(1.2); }
  50%      { filter: invert(0.08) saturate(1.4); }
  75%      { filter: hue-rotate(-30deg) contrast(1.3); }
}

.crashing {
  position: relative;
  animation:
    crash-rgb-split 0.32s steps(6) infinite,
    crash-shake 0.18s steps(3) infinite,
    crash-filter-pulse 0.6s steps(8) infinite;
}

.crashing .persona-code {
  animation: crash-rgb-split 0.18s steps(4) infinite;
  color: #ff3060 !important;
}

@keyframes crash-fragment-out {
  0%   { opacity: 1; transform: scale(1); filter: blur(0); }
  40%  { opacity: 0.7; transform: scale(1.04) skewX(3deg); filter: blur(1px) brightness(2); }
  100% { opacity: 0; transform: scale(0.94) skewX(-6deg); filter: blur(8px) brightness(0); }
}

.fragmenting {
  animation: crash-fragment-out 0.5s ease-in forwards !important;
}

/* 全屏故障层（扫描线 + 杂色光晕） */

.glitch-overlay {
  position: fixed;
  inset: 0;
  z-index: 9990;
  pointer-events: none;
  overflow: hidden;
}

.glitch-scanlines {
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    0deg,
    rgba(0, 0, 0, 0.20),
    rgba(0, 0, 0, 0.20) 1px,
    transparent 1px,
    transparent 3px
  );
  mix-blend-mode: multiply;
  animation: scanline-shift 0.1s steps(2) infinite;
}

.glitch-static {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 20% 30%, rgba(255, 0, 60, 0.18) 0%, transparent 35%),
    radial-gradient(circle at 80% 70%, rgba(0, 200, 255, 0.18) 0%, transparent 35%),
    radial-gradient(circle at 50% 50%, rgba(255, 255, 255, 0.08) 0%, transparent 60%);
  mix-blend-mode: screen;
  animation: static-flicker 0.07s steps(2) infinite;
}

@keyframes scanline-shift {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(2px); }
}

@keyframes static-flicker {
  0%   { opacity: 0.85; }
  35%  { opacity: 0.45; }
  70%  { opacity: 0.95; }
  100% { opacity: 0.6; }
}

/* 横向切片闪烁（由 JS 动态注入） */
.glitch-slice {
  position: absolute;
  left: 0;
  right: 0;
  pointer-events: none;
  mix-blend-mode: difference;
  animation: slice-flash 0.18s linear forwards;
}

@keyframes slice-flash {
  0%   { opacity: 0.9; }
  60%  { opacity: 0.6; }
  100% { opacity: 0; }
}

/* 爆白闪 */
.crash-flash {
  position: fixed;
  inset: 0;
  background: #ffffff;
  z-index: 9999;
  pointer-events: none;
  animation: flash-fade 0.12s linear forwards;
}

@keyframes flash-fade {
  0%   { opacity: 1; }
  100% { opacity: 0; }
}

.crashed-mode {
  background: #050505;
}

.crashed {
  background: #050505;
  color: #6a8a7a;
  font-family: var(--font-mono);
  padding: 80px 40px;
  min-height: 400px;
  font-size: 14px;
  line-height: 2.2;
  letter-spacing: 1.5px;
  border: 1px solid #1a1a1a;
  white-space: pre-line;
}

/* DEV 面板 */
#dev-panel {
  position: fixed;
  left: 12px;
  bottom: 12px;
  background: rgba(20, 20, 20, 0.88);
  border: 1px solid rgba(255, 255, 255, 0.18);
  padding: 6px 10px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: #aaa;
  z-index: 10000;
  display: flex;
  gap: 4px;
  align-items: center;
  border-radius: 3px;
  pointer-events: auto;
  user-select: none;
}

.dev-panel-label {
  color: #ff7777;
  margin-right: 4px;
  letter-spacing: 1px;
}

#dev-panel button {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.15);
  padding: 3px 8px;
  font-size: 11px;
  color: #ccc;
  cursor: pointer;
  font-family: inherit;
  letter-spacing: 0.5px;
  border-radius: 2px;
  transition: background 0.12s, color 0.12s;
}

#dev-panel button:hover {
  background: rgba(255, 255, 255, 0.16);
  color: #fff;
}
