/* ============================================================
   WelcomePage Styles
   Seven-stage flow: Arrival → Ambient → Presence → Introduction
   → Discovery+Teachable → Mirror → Bridge
   ============================================================ */

/* === Welcome Container === */

.welcome-container {
  display: none;   /* JS 控制可见性: launchWelcome() → flex */
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  position: relative;
  overflow: hidden;
}

/* === Stage 1: Arrival — Centered Input === */

.welcome-stage {
  display: none;
  opacity: 0;
  transition: opacity var(--duration-normal) var(--ease-out);
}

.welcome-stage--active {
  display: flex;
  opacity: 1;
}

.welcome-center {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-6);
  z-index: 10;
  position: relative;
}

/* Input wrapper (column: quick-replies / zpd sit above the input row) */
.welcome-input-wrapper {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  width: 100%;
  max-width: 560px;
  min-width: 320px;
}

/* Inner row: textarea + send button side by side.
   No gap — spacing is on the button itself so the textarea fills
   the full row width when the button is collapsed (centred). */
.welcome-input-row {
  display: flex;
  align-items: flex-end;
  width: 100%;
}

.welcome-input {
  flex: 1;
  min-width: 0;
  min-height: 56px;
  max-height: 288px;
  padding: var(--space-4) var(--space-5);
  background: var(--color-bg-surface);
  border: var(--border-normal);
  border-radius: var(--radius-md);
  color: var(--color-text-primary);
  font-family: var(--font-sans);
  font-size: var(--text-md);
  line-height: var(--leading-normal);
  resize: none;
  overflow-y: auto;
  transition: border-color var(--duration-normal) var(--ease-out),
              box-shadow var(--duration-normal) var(--ease-out);
}

.welcome-input:focus {
  outline: none;
  border-color: var(--color-accent-soft);
  box-shadow: var(--shadow-glow);
}

.welcome-input::placeholder {
  color: var(--color-text-tertiary);
}

/* Send button — sits to the right of the textarea, styled like Home's .home-chat-send.
   Collapses to 0 width when hidden so the textarea remains perfectly centred. */
.welcome-send-btn {
  width: 0;
  height: 40px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--color-accent-subtle);
  border: none;
  border-radius: var(--radius-sm);
  color: var(--color-accent);
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  overflow: hidden;
  transition: opacity 0.2s var(--ease-out),
              width 0.25s var(--ease-out);
}

.welcome-send-btn--visible {
  width: 40px;
  margin-left: var(--space-2);
  opacity: 1;
  pointer-events: auto;
}

.welcome-send-btn:hover {
  background: var(--color-accent-glow);
}

/* Hint below input */
.welcome-hint {
  opacity: 0;
  transition: opacity var(--duration-slow) var(--ease-out);
}

.welcome-hint.visible {
  opacity: 0.5;
}

.welcome-hint-text {
  font-size: var(--text-xs);
  color: var(--color-text-tertiary);
}

/* === Ambient Layer (Stage 2) === */

.ambient-layer {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 5;
  overflow: hidden;
}

.ambient-phrase {
  position: absolute;
  font-size: var(--text-md);          /* 17px — was 13px */
  color: var(--color-text-tertiary);
  opacity: 0;
  transition: opacity 3s var(--ease-out);  /* 3s fade — was 2s */
  max-width: 380px;                   /* wider — was 300px */
  line-height: var(--leading-relaxed);
  text-align: center;
}

.ambient-phrase--visible {
  opacity: 0.5;                       /* more visible — was 0.35 */
}

.ambient-phrase--fading {
  opacity: 0;
}

/* === Conversation Layer (Stage 3-6) === */

.conversation-layer {
  position: absolute;
  inset: 0;
  display: none;
  flex-direction: column;
  align-items: center;
  z-index: 8;
  padding-top: var(--space-16);
  padding-bottom: 180px; /* Space for input at bottom */
}

.conversation-layer--active {
  display: flex;
}

.conversation-messages {
  flex: 1;
  overflow-y: auto;
  padding: 0 var(--space-8);
  max-width: 640px;
  width: 100%;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: var(--space-6);
}

/* === Chat Messages === */

.chat-message {
  display: flex;
  gap: var(--space-3);
  animation: fadeIn var(--duration-normal) var(--ease-out) forwards;
  opacity: 0;
}

.chat-message--ai {
  align-self: flex-start;
}

.chat-message--user {
  align-self: flex-end;
  flex-direction: row-reverse;
}

.chat-avatar {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-sm);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--text-xs);
}

.chat-message--ai .chat-avatar {
  background: var(--color-accent-subtle);
  color: var(--color-accent);
}

.chat-message--user .chat-avatar {
  background: var(--color-bg-elevated);
  color: var(--color-text-secondary);
}

.chat-bubble {
  max-width: 480px;
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-md);
  font-size: var(--text-base);
  line-height: var(--leading-relaxed);
}

.chat-message--ai .chat-bubble {
  background: var(--color-bg-surface);
  color: var(--color-text-primary);
  border: var(--border-subtle);
  border-bottom-left-radius: var(--radius-sm);
}

.chat-message--user .chat-bubble {
  background: var(--color-accent-subtle);
  color: var(--color-text-primary);
  border-bottom-right-radius: var(--radius-sm);
}

/* Typing indicator */
.chat-typing {
  display: flex;
  gap: var(--space-1);
  padding: var(--space-2) 0;
}

.chat-typing-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--color-text-tertiary);
  animation: pulse 1.4s ease-in-out infinite;
}

.chat-typing-dot:nth-child(2) { animation-delay: 0.2s; }
.chat-typing-dot:nth-child(3) { animation-delay: 0.4s; }

/* === 生成进度气泡（B15 2026-08-17：dialogue/mirror 与课程生成同款三行结构） === */
.chat-bubble .lesson-gen-progress {
  margin-top: 0; /* 气泡已有 padding——贴顶展示标签行 */
  max-width: none; /* 气泡 max-width 480px 已约束行长（短于学习区 520px） */
}

/* === AI Thinking Indicator (live API wait) === */
.chat-thinking {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--space-2);
  padding: var(--space-2) 0;
}

.chat-thinking__dots {
  display: flex;
  gap: var(--space-1);
}

.chat-thinking__status {
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
  transition: opacity var(--duration-fast) var(--ease-out);
}

.chat-thinking__status--switching {
  opacity: 0;
}

.chat-thinking__timer {
  font-size: var(--text-xs);
  color: var(--color-text-tertiary);
  font-variant-numeric: tabular-nums;
}

/* AI message with typing effect */
.chat-bubble--typing {
  display: inline;
}

.chat-bubble--typing::after {
  content: '|';
  animation: typing-cursor 1s infinite;
  color: var(--color-accent);
  margin-left: 1px;
}

/* Pause indicator in AI message */
.chat-pause {
  display: block;
  text-align: center;
  color: var(--color-text-tertiary);
  font-size: var(--text-xs);
  margin: var(--space-2) 0;
  animation: pulse 2s ease-in-out infinite;
}

/* === Pinned Input during Conversation === */

.welcome-input-wrapper--pinned {
  position: fixed;
  bottom: var(--space-8);
  left: 50%;
  transform: translateX(-50%);
  z-index: 20;
  width: 100%;
  max-width: 560px;
  background: var(--color-bg-surface);
  border: var(--border-normal);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  padding: var(--space-3);
}

/* G7: Locked state during Mirror generation — dim + block interaction */
.welcome-input-wrapper--locked {
	opacity: 0.5;
	pointer-events: none;
}

/* Input blink — draw attention after Mirror "我想补充一下" */
.welcome-input--blink {
  border-color: var(--color-accent) !important;
  box-shadow: 0 0 20px var(--color-accent-glow) !important;
  transition: border-color 0.15s ease-out, box-shadow 0.15s ease-out;
}

/* === Teachable Moment Card (术语卡片) === */

.teachable-card {
  background: var(--color-bg-elevated);
  border: 1px solid var(--color-accent-soft);
  border-left: 3px solid var(--color-accent);
  border-radius: var(--radius-md);
  padding: var(--space-4) var(--space-5);
  margin: var(--space-3) auto;
  max-width: 560px;
  width: 100%;
  animation: fadeIn var(--duration-normal) var(--ease-out) forwards;
  opacity: 0;
}

/* First-card intro strip — explains the terminology mechanism */
.teachable-card--first .teachable-card__intro {
  margin: calc(-1 * var(--space-4)) calc(-1 * var(--space-5)) var(--space-3);
  padding: var(--space-3) var(--space-5);
  background: var(--color-accent-subtle);
  border-radius: var(--radius-md) var(--radius-md) 0 0;
  font-size: var(--text-xs);
  line-height: var(--leading-normal);
  color: var(--color-accent);
}

.teachable-card__label {
  font-size: var(--text-xs);
  color: var(--color-accent);
  letter-spacing: 0.04em;
  margin-bottom: var(--space-2);
}

.teachable-card__insight {
  font-size: var(--text-sm);
  line-height: var(--leading-relaxed);
  color: var(--color-text-primary);
}

.teachable-card__footer {
  margin-top: var(--space-3);
  padding-top: var(--space-3);
  border-top: var(--border-subtle);
  font-size: var(--text-xs);
  line-height: var(--leading-normal);
  color: var(--color-text-tertiary);
}

/* 9c：三件套可折叠段（原理 / 示例）——details 原生折叠三角（B54 去 ▶ 前缀），零新 UI */
.teachable-card__fold {
  margin-top: var(--space-3);
  padding-top: var(--space-3);
  border-top: var(--border-subtle);
}

.teachable-card__fold summary {
  cursor: pointer;
  font-size: var(--text-xs);
  line-height: var(--leading-normal);
  color: var(--color-text-secondary);
  user-select: none;
}

.teachable-card__fold summary:hover {
  color: var(--color-accent);
}

.teachable-card__fold-body {
  margin-top: var(--space-2);
  font-size: var(--text-sm);
  line-height: var(--leading-relaxed);
  color: var(--color-text-secondary);
}

/* === Mirror Stage (Stage 5) — Double-sided Flip Card === */

/* Outer container: provides 3D perspective */
.mirror-card {
  max-width: 560px;
  width: 100%;
  margin: var(--space-8) auto;
  animation: fadeIn var(--duration-slow) var(--ease-out) forwards;
  opacity: 0;
}

/* 3D flip inner container */
.mirror-card__inner {
  position: relative;
  transform-style: preserve-3d;
  transition: transform 600ms var(--ease-out);
  min-height: 320px;
}

.mirror-card__inner--flipped {
  transform: rotateY(180deg);
}

/* Reduced motion: instant flip */
@media (prefers-reduced-motion: reduce) {
  .mirror-card__inner {
    transition: none;
  }
}

/* === Both Faces === */

.mirror-card__face {
  background: var(--color-bg-elevated);
  border: 1px solid var(--color-accent-soft);
  border-radius: var(--radius-lg);
  padding: 0 0 var(--space-6) 0;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  overflow: hidden;
}

.mirror-card__face--back {
  position: absolute;
  top: 0; left: 0; right: 0;
  transform: rotateY(180deg);
  min-height: 100%;
}

/* === Card Header (shared) === */

.mirror-card__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-4) var(--space-6);
  background: var(--color-accent-subtle);
  border-bottom: 1px solid var(--color-accent-soft);
  gap: var(--space-3);
}

.mirror-card__title {
  font-size: var(--text-base);
  font-weight: var(--weight-medium);
  color: var(--color-accent);
  white-space: nowrap;
}

.mirror-card__flip-btn {
  font-size: var(--text-xs);
  color: var(--color-text-tertiary);
  background: transparent;
  border: 1px solid var(--color-accent-soft);
  border-radius: var(--radius-md);
  padding: var(--space-1) var(--space-3);
  cursor: pointer;
  white-space: nowrap;
  transition: color var(--duration-fast) var(--ease-out),
              border-color var(--duration-fast) var(--ease-out);
}
.mirror-card__flip-btn:hover {
  color: var(--color-accent);
  border-color: var(--color-accent);
}

/* === Section Labels === */

.mirror-card__section-label {
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  color: var(--color-text-primary);
  margin-bottom: var(--space-3);
  padding: 0 var(--space-6);
}

/* =========================================================================
   FRONT FACE — Feasibility Analysis
   ========================================================================= */

/* ——— Score block ——— */

.mirror-card__score-section {
  text-align: center;
  padding: var(--space-6) var(--space-6) var(--space-4);
  border-bottom: 1px solid var(--color-accent-subtle);
}

.mirror-card__score-big {
  font-size: 64px;
  font-weight: var(--weight-bold);
  color: var(--color-accent);
  line-height: 1;
  letter-spacing: -0.02em;
}
.mirror-card__score-total {
  font-size: var(--text-xl);
  font-weight: var(--weight-normal);
  color: var(--color-text-tertiary);
}

.mirror-card__score-stars {
  font-size: var(--text-lg);
  margin-top: var(--space-2);
  letter-spacing: 0.1em;
}

.mirror-card__score-note {
  font-size: var(--text-xs);
  color: var(--color-text-tertiary);
  margin-top: var(--space-3);
  font-style: italic;
}

/* ——— Score factors grid ——— */

.mirror-card__score-factors {
  margin-top: var(--space-4);
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-2);
  text-align: left;
}

.mirror-card__factor {
  background: var(--color-bg-base);
  border: 1px solid var(--color-border-subtle);
  border-radius: var(--radius-md);
  padding: var(--space-2) var(--space-3);
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.mirror-card__factor-label {
  font-size: var(--text-xs);
  color: var(--color-text-tertiary);
}

.mirror-card__factor-score {
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  color: var(--color-accent);
}

.mirror-card__factor-reason {
  font-size: var(--text-xs);
  color: var(--color-text-secondary);
  line-height: var(--leading-snug);
}

/* ——— Todo tree ——— */

.mirror-card__todo-section {
  padding: var(--space-4) var(--space-6);
  border-bottom: 1px solid var(--color-accent-subtle);
}

.mirror-card__todo-cat {
  margin-bottom: var(--space-2);
}
.mirror-card__todo-cat:last-child { margin-bottom: 0; }

.mirror-card__todo-cat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-2) 0;
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  color: var(--color-text-secondary);
  cursor: pointer;
  user-select: none;
}
.mirror-card__todo-cat-header:hover {
  color: var(--color-text-primary);
}

.mirror-card__todo-toggle {
  font-size: var(--text-xs);
  color: var(--color-text-tertiary);
}

.mirror-card__todo-cat-body {
  overflow: hidden;
  transition: max-height var(--duration-normal) var(--ease-out),
              opacity var(--duration-normal) var(--ease-out);
  max-height: 600px;
  opacity: 1;
}
.mirror-card__todo-cat-body--collapsed {
  max-height: 0;
  opacity: 0;
}

.mirror-card__todo-item {
  display: flex;
  align-items: flex-start;
  gap: var(--space-2);
  padding: var(--space-1) 0 var(--space-1) var(--space-2);
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
  line-height: var(--leading-relaxed);
  border-left: 1px solid var(--color-accent-subtle);
  margin-left: var(--space-1);
}

.mirror-card__todo-checkbox {
  flex-shrink: 0;
  color: var(--color-text-tertiary);
  font-size: var(--text-sm);
}

.mirror-card__todo-text {
  flex: 1;
}

/* ——— Risks section ——— */

.mirror-card__risks-section {
  padding: var(--space-4) var(--space-6);
  border-bottom: 1px solid var(--color-accent-subtle);
}

.mirror-card__risk-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: var(--space-2) 0;
}

.mirror-card__risk-label {
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  color: #E8A860;
}

.mirror-card__risk-detail {
  font-size: var(--text-xs);
  color: var(--color-text-tertiary);
  line-height: var(--leading-relaxed);
}

/* ——— Verdict section ——— */

.mirror-card__verdict-section {
  padding: var(--space-4) var(--space-6);
  border-bottom: 1px solid var(--color-accent-subtle);
}

.mirror-card__verdict-quote {
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  color: var(--color-text-primary);
  line-height: var(--leading-relaxed);
  font-style: italic;
  background: var(--color-accent-subtle);
  border-left: 3px solid var(--color-accent);
  padding: var(--space-3) var(--space-4);
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
}

/* ——— Improvements ——— */

.mirror-card__improvements-section {
  padding: var(--space-4) var(--space-6);
  border-bottom: 1px solid var(--color-accent-subtle);
}

.mirror-card__improvement-item {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: var(--space-3);
  padding: var(--space-2) 0;
}

.mirror-card__improvement-text {
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
  line-height: var(--leading-relaxed);
  flex: 1;
}

.mirror-card__improvement-score {
  font-size: var(--text-xs);
  color: var(--color-accent);
  white-space: nowrap;
  font-weight: var(--weight-medium);
  flex-shrink: 0;
}

/* =========================================================================
   BACK FACE — Learning Profile (existing 5-dimension grid)
   ========================================================================= */

.mirror-card__grid {
  display: flex;
  flex-direction: column;
  gap: 0;
  padding: var(--space-4) var(--space-6);
}

.mirror-card__dim {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: var(--space-3) 0;
  border-bottom: 1px solid var(--color-accent-subtle);
}
.mirror-card__dim:last-child { border-bottom: none; }

.mirror-card__dim-label {
  font-size: var(--text-xs);
  color: var(--color-text-tertiary);
  margin-bottom: var(--space-1);
}

.mirror-card__dim-value {
  font-size: var(--text-base);
  font-weight: var(--weight-medium);
  color: var(--color-text-primary);
  line-height: var(--leading-relaxed);
}

/* Mirror — learned insight */
.mirror-card__learned {
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
  line-height: var(--leading-relaxed);
  text-align: center;
  padding: var(--space-3) var(--space-6);
  margin: 0 var(--space-6) var(--space-3);
  border-top: 1px solid var(--color-accent-soft);
  border-bottom: 1px solid var(--color-accent-subtle);
}

/* Mirror — ZPD: accent-tinted card, centered */
.mirror-card__zpd {
  background: var(--color-accent-subtle);
  border: 1px solid var(--color-accent-soft);
  border-radius: var(--radius-md);
  padding: var(--space-4);
  margin: 0 var(--space-6) var(--space-4);
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
  line-height: var(--leading-relaxed);
  text-align: center;
}

/* =========================================================================
   ACTIONS (outside flip — always visible)
   ========================================================================= */

.mirror-card__actions {
  margin-top: var(--space-4);
  display: flex;
  gap: var(--space-3);
  justify-content: center;
}

/* =========================================================================
   SHARE ROW (outside flip — always visible)
   ========================================================================= */

.mirror-card__share-row {
  margin-top: var(--space-4);
  padding-top: var(--space-3);
  border-top: 1px dashed var(--color-accent-soft);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-2);
}

.mirror-card__share-label {
  font-size: var(--text-xs);
  color: var(--color-text-tertiary);
}

.mirror-card__share-buttons {
  display: flex;
  gap: var(--space-3);
}

.mirror-card__share-btn {
  font-size: var(--text-xs);
  padding: var(--space-1) var(--space-4);
  border: 1px solid var(--color-accent-soft);
  border-radius: var(--radius-md);
  background: transparent;
  color: var(--color-text-secondary);
  cursor: pointer;
  transition: color var(--duration-fast) var(--ease-out),
              border-color var(--duration-fast) var(--ease-out),
              background var(--duration-fast) var(--ease-out);
}
.mirror-card__share-btn:hover {
  color: var(--color-accent);
  border-color: var(--color-accent);
  background: var(--color-accent-subtle);
}

/* =========================================================================
   TODO FLOAT INDICATOR + MINI PANEL (Phase 2)
   ========================================================================= */

.todo-float {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-2) var(--space-4);
  margin-bottom: var(--space-2);
  background: var(--color-bg-elevated);
  border-bottom: 1px solid var(--color-accent-soft);
  animation: fadeIn var(--duration-fast) var(--ease-out) forwards;
}

.todo-float__badge {
  font-size: var(--text-xs);
  color: var(--color-accent);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-1) var(--space-3);
  border: 1px solid var(--color-accent-soft);
  border-radius: 999px;
  transition: background var(--duration-fast) var(--ease-out);
}
.todo-float__badge:hover {
  background: var(--color-accent-subtle);
}

.todo-float__count {
  font-weight: var(--weight-semibold);
  font-size: var(--text-sm);
}

/* Mini panel overlay */
.todo-panel {
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  margin-top: var(--space-2);
  background: var(--color-bg-elevated);
  border: 1px solid var(--color-accent-soft);
  border-radius: var(--radius-lg);
  padding: var(--space-4);
  min-width: 300px;
  max-width: 420px;
  width: 90vw;
  box-shadow: 0 8px 32px rgba(0,0,0,0.4);
  animation: fadeIn var(--duration-fast) var(--ease-out) forwards;
  z-index: 20;
}

.todo-panel__header {
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  color: var(--color-text-primary);
  margin-bottom: var(--space-3);
  text-align: center;
}

.todo-panel__close {
  display: block;
  width: 100%;
  margin-top: var(--space-3);
  padding: var(--space-1) 0;
  font-size: var(--text-xs);
  color: var(--color-text-tertiary);
  background: transparent;
  border: none;
  cursor: pointer;
  text-align: center;
}
.todo-panel__close:hover {
  color: var(--color-accent);
}

/* =========================================================================
   TOAST (Phase 3)
   ========================================================================= */

.mirror-toast {
  position: fixed;
  bottom: var(--space-6);
  left: 50%;
  transform: translateX(-50%);
  z-index: 100;
  font-size: var(--text-sm);
  color: #fff;
  background: var(--color-bg-elevated);
  border: 1px solid var(--color-accent);
  border-radius: var(--radius-md);
  padding: var(--space-2) var(--space-5);
  box-shadow: 0 4px 16px rgba(0,0,0,0.3);
  animation: fadeIn var(--duration-fast) var(--ease-out) forwards;
  pointer-events: none;
}
.mirror-toast--error {
  border-color: #E86060;
}

/* === Bridge Stage (Stage 6) === */

.bridge-options {
  display: flex;
  gap: var(--space-3);
  flex-wrap: wrap;
  margin-top: var(--space-3);
  max-width: 560px;
  width: 100%;
  align-self: center;
}

.bridge-option {
  flex: 1;
  min-width: 200px;
  padding: var(--space-4) var(--space-5);
  background: var(--color-bg-surface);
  border: var(--border-normal);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--duration-fast) var(--ease-out);
  text-align: left;
  color: var(--color-text-primary);
  font-family: var(--font-sans);
  font-size: var(--text-sm);
}

.bridge-option:hover {
  border-color: var(--color-accent-soft);
  background: var(--color-bg-elevated);
  box-shadow: var(--shadow-sm);
}

.bridge-option__title {
  font-size: var(--text-base);
  font-weight: var(--weight-medium);
  margin-bottom: var(--space-1);
}

.bridge-option__desc {
  font-size: var(--text-xs);
  color: var(--color-text-secondary);
}

/* === Opening Question (Stage 1→2, 2.5s) === */

.welcome-opening {
  text-align: center;
  max-width: 560px;
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 1.2s var(--ease-out),
              transform 1.2s var(--ease-out);
  margin-bottom: var(--space-8);
}

.welcome-opening--visible {
  opacity: 1;
  transform: translateY(0);
}

.welcome-opening-text {
  font-size: var(--text-lg);           /* 20px */
  font-weight: var(--weight-light);
  color: var(--color-text-secondary);
  line-height: var(--leading-relaxed);
  margin: 0;
  white-space: pre-line;
}

.welcome-opening-follow {
  font-size: var(--text-base);         /* 15px */
  color: var(--color-text-tertiary);
  margin-top: var(--space-4);
  opacity: 0;
  transition: opacity 1.5s var(--ease-out);
}

.welcome-opening-follow--visible {
  opacity: 0.7;
}

/* === Centered Conversation Mode (Stage 4+) === */

/* AI messages: centered, no bubble — "a voice in the room" */
.conversation-layer .chat-message--ai {
  align-self: center;
  max-width: 540px;
  width: 100%;
}

.conversation-layer .chat-message--ai .chat-avatar {
  display: none;
}

.conversation-layer .chat-message--ai .chat-bubble {
  background: transparent;
  border: none;
  text-align: center;
  font-size: var(--text-md);
  color: var(--color-text-secondary);
  padding: var(--space-4) var(--space-8);
  max-width: none;
}

/* User messages: right-aligned, lighter */
.conversation-layer .chat-message--user {
  align-self: flex-end;
}

.conversation-layer .chat-message--user .chat-avatar {
  display: none;
}

.conversation-layer .chat-message--user .chat-bubble {
  background: var(--color-accent-subtle);
  border: var(--border-subtle);
  color: var(--color-text-primary);
}

/* Thinking indicator: centered */
.conversation-layer .chat-message--ai .chat-typing {
  justify-content: center;
}

.conversation-layer .chat-message--ai .chat-thinking {
  align-items: center;
}

/* Conversation layer background glow */
.conversation-layer--active {
  background:
    radial-gradient(ellipse at 50% 30%, rgba(196, 162, 101, 0.03) 0%, transparent 60%),
    radial-gradient(ellipse at 50% 70%, rgba(196, 162, 101, 0.02) 0%, transparent 50%);
}

/* === Welcome Page Theme Toggle === */

.welcome-container .theme-toggle {
  position: fixed;
  top: var(--space-6);
  right: var(--space-6);
  z-index: 60;
}

/* === Bottom-right cluster: debug + settings, side by side === */
#welcome-bottom-right {
  position: fixed;
  bottom: var(--space-6);
  right: var(--space-6);
  z-index: 60;
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

/* Undo any position:fixed on children — the container handles placement */
#welcome-bottom-right #welcome-settings,
#welcome-bottom-right #btn-debug-panel {
  position: static;
}

@media (max-width: 640px) {
  #welcome-bottom-right {
    bottom: var(--space-4);
    right: var(--space-4);
  }
}

/* === Quick Replies in Welcome Page === */

#welcome-quick-replies {
  margin-top: var(--space-3);
}

/* Pinned mode (conversation): chips sit inside the fixed input wrapper, above the textarea */
#welcome-quick-replies.welcome-quick-replies--pinned {
  width: 100%;
  margin-top: 0;
  margin-bottom: var(--space-2);
  justify-content: center;
}

/* ZPD progress indicator — accent-colored hint above quick replies */
.zpd-progress {
  width: 100%;
  text-align: center;
  font-size: var(--text-xs, 12px);
  color: var(--color-accent, #C4A265);
  opacity: 0.85;
  margin-bottom: var(--space-1, 4px);
  transition: opacity 0.5s ease;
}

/* Pulse flash when progress updates — reuses dash-pulse keyframes from home.css */
.zpd-progress--pulse {
  animation: dash-pulse 0.9s var(--ease-in-out, cubic-bezier(0.16, 1, 0.3, 1)) 1;
  border-radius: var(--radius-sm, 4px);
}

/* === Responsive: Mobile === */

@media (max-width: 640px) {
  .welcome-input-wrapper {
    max-width: 90vw;
    min-width: auto;
  }

  .conversation-messages {
    padding: 0 var(--space-4);
  }

  .chat-bubble {
    max-width: 75vw;
  }

  .mirror-card {
    margin: var(--space-4) 0;
  }

  .mirror-card__header {
    padding: var(--space-3) var(--space-4);
  }

  .mirror-card__title {
    font-size: var(--text-sm);
  }

  .mirror-card__score-big {
    font-size: 48px;
  }

  .mirror-card__score-factors {
    grid-template-columns: 1fr;
  }

  .mirror-card__actions {
    flex-direction: column;
    gap: var(--space-2);
  }

  .mirror-card__share-buttons {
    flex-direction: column;
    gap: var(--space-2);
  }

  .todo-panel {
    min-width: auto;
    width: calc(100vw - var(--space-8));
  }

  .teachable-card {
    max-width: none;
    margin: var(--space-3) var(--space-4);
  }

  .bridge-options {
    max-width: none;
    padding: 0 var(--space-4);
  }

  .welcome-input-wrapper--pinned {
    max-width: 90vw;
    bottom: var(--space-4);
  }
}

/* === B36（2026-08-20）：AI 生成期间禁用全部按钮 ===
   用户裁决：生成 mission / 对话回复时禁用当前页面所有按钮类
   （ui-busy 门面接线 → 容器 .ai-busy；发送路径另有 aiBusy.busy 代码兜底） */
#welcome-container.ai-busy button {
  pointer-events: none;
  opacity: 0.55;
}

/* B36 例外：busy-allow——bridge 选择按钮（mission 后台生成时仍可选路线，
   两者本就是并行设计）+ DebugPanel 放大镜随时可开（用户裁决 2026-08-20） */
#welcome-container.ai-busy button.busy-allow {
  pointer-events: auto;
  opacity: 1;
}
