/* ============================================
   Top-level Layout
   全屏画布 + 浮动卡片 + 固定底部输入栏
   ============================================ */

body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ====================== HUD TOP ====================== */

.hud-top {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: var(--z-hud);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--sp-4);
  height: 48px;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(
    180deg,
    rgba(20, 27, 37, 0.95) 0%,
    rgba(15, 20, 27, 0.85) 100%
  );
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  box-shadow: var(--hl);
  /* v36.39 · 顶 HUD 整体是深色底，覆盖文字色为浅色（让 --text-primary 默认的深色不再生效）*/
  color: #d4d4d8;
}
.hud-top .hud-mono { color: #d4d4d8; }

.hud-left,
.hud-center,
.hud-right {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  flex: 1;
}

.hud-center {
  justify-content: center;
  color: var(--text-secondary);
}

/* v36.39 · HUD 中央"作品名"· 居中大字（替掉 v0.2 / v33-VISITOR 调试信息）*/
.hud-center-brand {
  font-family: var(--font-mono, 'IBM Plex Mono', monospace);
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 0.32em;  /* 字距加宽 · 配合中文"歧 视 观 测 站" */
  color: #fafafa !important;  /* v36.39 · 强制白（覆盖 --text-primary 深色）*/
  text-shadow:
    0 0 12px rgba(212, 175, 55, 0.4),
    0 1px 2px rgba(0, 0, 0, 0.6);
}

/* v36.39 · 调试模式（?debug=1）· 观众模式下 hidden 的调试元素显示 */
/* 默认（观众）· 已 hidden 的元素保持 hidden · JS 仍可改 textContent 但不可见 */
body.debug-mode [id^="hudEngine"][hidden],
body.debug-mode [id^="hudEngineReason"][hidden],
body.debug-mode [id^="hudProtocol"][hidden],
body.debug-mode [id^="hudEngineSep"][hidden],
body.debug-mode [id^="hudEngineReasonSep"][hidden],
body.debug-mode [id^="hudProtocolSep"][hidden] {
  display: inline !important;  /* 覆盖 hidden 属性 */
}

.hud-right {
  justify-content: flex-end;
}

/* ====================== STAGE ====================== */

.stage {
  position: relative;
  z-index: var(--z-stage);
  flex: 1;
  width: 100%;
  padding: 48px 0 0 0;
  min-height: 100vh;
  overflow: hidden;
}

.stage > section {
  animation: stage-in var(--t-base) var(--ease-out);
}

@keyframes stage-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ====================== HOME ====================== */

.stage-home {
  min-height: calc(100vh - 48px);
  display: flex;
  align-items: center;
  justify-content: center;
}

.home-shell {
  max-width: 720px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--sp-5);
  padding: var(--sp-5);
}

.home-meta {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  color: var(--text-secondary);
  padding: var(--sp-1) var(--sp-3);
  border: 1px solid var(--border);
  border-radius: var(--r-pill);
  background: var(--bg-panel);
}

.home-engine {
  display: inline-block;
  padding: var(--sp-1) var(--sp-3);
  border: 1px solid var(--border);
  border-radius: var(--r-pill);
  background: var(--bg-panel);
  color: var(--text-secondary);
  font-family: var(--font-mono);
  font-size: var(--fs-sm);
  letter-spacing: 0.05em;
}
.home-engine.is-preset { color: var(--text-tertiary); }
.home-engine.is-ai {
  color: var(--accent);
  border-color: var(--accent-line);
  background: var(--accent-soft);
}

.home-title {
  font-family: var(--font-cn);
  font-size: var(--fs-display);
  font-weight: 200;
  line-height: 1.1;
  letter-spacing: 0.08em;
  color: var(--text-primary);
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
  margin: var(--sp-3) 0;
}

.home-title-en {
  font-family: var(--font-mono);
  font-size: var(--fs-sm);
  font-weight: 400;
  letter-spacing: 0.3em;
  color: var(--text-tertiary);
  text-transform: uppercase;
  transition: color 800ms var(--ease-out), letter-spacing 800ms var(--ease-out);
}
.home-title-en[data-active="1"] {
  color: #dc2626;
  letter-spacing: 0.2em;
  font-weight: 600;
}

.home-sub {
  font-family: var(--font-cn);
  font-size: var(--fs-md);
  line-height: 1.7;
  color: var(--text-secondary);
  max-width: 480px;
  margin: 0 auto;
}

.home-fineprint {
  font-family: var(--font-cn);
  font-size: var(--fs-xs);
  color: var(--text-tertiary);
  line-height: 1.7;
  margin-top: var(--sp-5);
  letter-spacing: 0.05em;
}

/* ====================== CANVAS (floating cards) ====================== */

.stage-canvas {
  position: relative;
  width: 100%;
  min-height: calc(100vh - 48px - 32px);
  /* 底部留出 composer (≈60-80) + reactionsBar (≈50) + hud-bottom (32) 的总高度 */
  padding-bottom: 200px;
  overflow-x: hidden;
  overflow-y: auto;
  scrollbar-gutter: stable;
}

.canvas-loading {
  position: absolute;
  top: 56px;
  left: 24px;
  z-index: 4;
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  color: var(--text-secondary);
  font-size: var(--fs-sm);
  letter-spacing: 0.05em;
  pointer-events: none;
}

.canvas-loading-dots {
  display: inline-flex;
  align-items: center;
  gap: 2px;
}

.canvas-loading-dots span {
  display: inline-block;
  opacity: 0;
  animation: load-blink 1.4s ease-in-out infinite;
}

.canvas-loading-dots span:nth-child(1) { animation-delay: 0s; }
.canvas-loading-dots span:nth-child(2) { animation-delay: 0.2s; }
.canvas-loading-dots span:nth-child(3) { animation-delay: 0.4s; }
.canvas-loading-dots span:nth-child(4) { animation-delay: 0.6s; }

@keyframes load-blink {
  0%, 100% { opacity: 0.2; }
  50% { opacity: 1; }
}

.canvas-cards {
  position: relative;
  width: 100%;
  min-height: 100%;
  z-index: 2;
}

.canvas-clear {
  position: absolute;
  top: 56px;
  right: 24px;
  z-index: 5;
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  color: var(--text-tertiary);
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--r-1);
  padding: var(--sp-1) var(--sp-3);
  cursor: pointer;
  letter-spacing: 0.05em;
  transition: all var(--t-fast) var(--ease-out);
}

.canvas-clear:hover {
  color: var(--warn);
  border-color: var(--warn);
  background: var(--warn-soft);
}

/* ====================== HUD BOTTOM ====================== */

.hud-bottom {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: var(--z-hud);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--sp-4);
  height: 32px;
  border-top: 1px solid var(--border);
  background: linear-gradient(0deg,
    rgba(20, 27, 37, 0.95) 0%,
    rgba(15, 20, 27, 0.85) 100%
  );
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  color: var(--text-tertiary);
  font-size: var(--fs-xs);
  font-family: var(--font-mono);
  letter-spacing: 0.05em;
}

.hud-bottom-left,
.hud-bottom-right {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
}

.hud-link {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-secondary);
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  letter-spacing: 0.05em;
  padding: 2px 8px;
  border-radius: var(--r-pill);
  cursor: pointer;
  transition: all var(--t-fast) var(--ease-out);
}
.hud-link:hover {
  color: var(--warn);
  border-color: var(--warn);
  background: var(--warn-soft);
}
