/**
 * V2.0 M1 · 情绪遮罩首页 + /try 公开试写
 * 真丝燕麦 #FDFBF7 · 100vh 无滚动 · 纸飞机三阶段转场
 */

html.emotion-gate-active,
html.emotion-gate-active body {
  overflow: hidden !important;
  height: 100vh !important;
  max-height: 100vh !important;
  background: #fdfbf7;
}

.emotion-gate-stage {
  width: min(92vw, 560px);
  max-width: 720px;
}

/* Handoff overlay · 跨路由转场壳 */
.emotion-gate-handoff-shell {
  position: fixed;
  inset: 0;
  z-index: 10000;
  width: 100vw;
  height: 100vh;
  max-height: 100vh;
  overflow: hidden;
  pointer-events: none;
  background: #fdfbf7;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.emotion-gate-handoff-shell.is-launching {
  opacity: 1;
  visibility: visible;
}

.emotion-gate-handoff-shell.is-veil-out {
  opacity: 0;
  visibility: hidden;
}

/* M3 · 三阶段：0.2s 折叠 + 0.4s 撞屏 = 0.6s 总 burst */
.paper-plane-cinema {
  position: fixed;
  inset: 0;
  z-index: 10001;
  pointer-events: none;
  overflow: hidden;
}

.paper-plane-flight {
  position: absolute;
  left: var(--plane-x, 50%);
  top: var(--plane-y, 50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  width: min(280px, 72vw);
  transform: translate(-50%, -50%) scale(1);
  transform-origin: center center;
  will-change: transform, opacity, filter;
  animation: plane-fold-burst 0.6s cubic-bezier(0.32, 0.72, 0.28, 1) forwards;
}

.paper-plane-ghost {
  margin: 0 0 10px;
  font-family: "Songti SC", "Source Han Serif SC", "Noto Serif CJK SC", serif;
  font-size: 15px;
  line-height: 1.5;
  color: rgba(44, 42, 41, 0.82);
  text-align: center;
  transform-origin: center center;
  animation: plane-text-fold 0.6s cubic-bezier(0.32, 0.72, 0.28, 1) forwards;
}

.paper-plane-icon-wrap {
  display: flex;
  justify-content: center;
  opacity: 0;
  transform: scale(0.05);
  animation: plane-icon-fold-in 0.6s cubic-bezier(0.32, 0.72, 0.28, 1) forwards;
}

.paper-plane-brand-img {
  width: 72px;
  height: 72px;
  filter: drop-shadow(0 8px 18px rgba(255, 122, 92, 0.18));
}

@keyframes plane-text-fold {
  0% {
    opacity: 1;
    transform: scale(1);
  }
  28% {
    opacity: 0.65;
    transform: scale(0.35);
  }
  33% {
    opacity: 0;
    transform: scale(0.05);
  }
  100% {
    opacity: 0;
    transform: scale(0.05);
  }
}

@keyframes plane-icon-fold-in {
  0%,
  30% {
    opacity: 0;
    transform: scale(0.05);
  }
  33% {
    opacity: 1;
    transform: scale(0.55);
  }
  100% {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes plane-fold-burst {
  0% {
    transform: translate(-50%, -50%) scale(1);
    opacity: 1;
    filter: blur(0);
  }
  33% {
    transform: translate(
        calc(-50% + var(--plane-dx) * 0.15px),
        calc(-50% + var(--plane-dy) * 0.15px)
      )
      scale(0.55);
    opacity: 1;
    filter: blur(0);
  }
  55% {
    transform: translate(
        calc(-50% + var(--plane-dx) * 0.05px),
        calc(-50% + var(--plane-dy) * 0.05px - 8px)
      )
      scale(2.5);
    opacity: 0.95;
    filter: blur(0);
  }
  78% {
    transform: translate(-50%, -50%) scale(18);
    opacity: 0.55;
    filter: blur(4px);
  }
  100% {
    transform: translate(-50%, -50%) scale(120);
    opacity: 0;
    filter: blur(10px);
  }
}

@media (prefers-reduced-motion: reduce) {
  .paper-plane-flight,
  .paper-plane-ghost,
  .paper-plane-icon-wrap {
    animation: none !important;
  }
}

/* /try 公开试写页 */
.try-page-shell {
  min-height: 100vh;
  background: #fdfbf7;
  padding: 24px 20px calc(32px + env(safe-area-inset-bottom));
  box-sizing: border-box;
}

.try-page-loading {
  text-align: center;
  color: rgba(44, 42, 41, 0.55);
  padding-top: 40vh;
  font-family: "Songti SC", "Source Han Serif SC", "Noto Serif CJK SC", serif;
}

.try-page-header {
  max-width: 720px;
  margin: 0 auto 20px;
}

.try-page-kicker {
  margin: 0 0 8px;
  font-size: 12px;
  color: rgba(44, 42, 41, 0.45);
}

.try-page-title {
  margin: 0;
  font-family: "Songti SC", "Source Han Serif SC", "Noto Serif CJK SC", serif;
  font-size: clamp(1.5rem, 5vw, 2rem);
  font-weight: 700;
  color: #2c2a29;
}

.try-page-paper {
  max-width: 720px;
  margin: 0 auto;
  padding: 24px 20px;
  background: #fff;
  border-radius: 12px;
  border: 1px solid #e6e1da;
  box-shadow: 0 12px 40px -28px rgba(44, 42, 41, 0.18);
}

.try-page-draft-display {
  width: 100%;
  min-height: 160px;
  border: none;
  font-family: "Songti SC", "Source Han Serif SC", "Noto Serif CJK SC", serif;
  font-size: 17px;
  line-height: 1.65;
  color: #2c2a29;
  background: transparent;
  outline: none;
  white-space: pre-wrap;
  word-break: break-word;
}

.try-page-note {
  margin: 16px 0 0;
  font-size: 13px;
  color: rgba(44, 42, 41, 0.5);
  line-height: 1.5;
}

.try-page-actions {
  max-width: 720px;
  margin: 24px auto 0;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  justify-content: center;
}

.try-page-generate-btn {
  padding: 12px 32px;
  border: none;
  border-radius: 999px;
  font-size: 15px;
  font-family: "Songti SC", "Source Han Serif SC", "Noto Serif CJK SC", serif;
  font-weight: 600;
  cursor: pointer;
  background: #ff7a5c;
  color: #fff;
  box-shadow: 0 8px 24px rgba(255, 122, 92, 0.15);
  transition: opacity 0.15s ease, transform 0.15s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.try-page-generate-btn:hover {
  opacity: 0.93;
}

.try-page-generate-btn:active {
  transform: scale(0.98);
}

.try-page-generate-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.try-page-stop-btn {
  padding: 10px 22px;
  border: 1px solid #e6e1da;
  border-radius: 999px;
  font-size: 14px;
  cursor: pointer;
  background: transparent;
  color: rgba(44, 42, 41, 0.65);
  transition: color 0.15s ease, border-color 0.15s ease;
}

.try-page-stop-btn:hover {
  color: #c0392b;
  border-color: rgba(192, 57, 43, 0.3);
}

/* 流式输出区 */
.try-page-streaming {
  max-width: 720px;
  margin: 24px auto 0;
}

.try-page-streaming-inner {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
}

.try-page-streaming-spinner {
  color: #ff7a5c;
  animation: try-spin 0.8s linear infinite;
}

@keyframes try-spin {
  to {
    transform: rotate(360deg);
  }
}

.try-page-streaming-label {
  margin: 0;
  font-family: "Songti SC", "Source Han Serif SC", "Noto Serif CJK SC", serif;
  font-size: 14px;
  color: rgba(44, 42, 41, 0.55);
}

.try-page-streaming-text {
  padding: 20px 24px;
  background: #fff;
  border-radius: 12px;
  border: 1px solid #e6e1da;
  font-family: "Songti SC", "Source Han Serif SC", "Noto Serif CJK SC", serif;
  font-size: 16px;
  line-height: 1.75;
  color: #2c2a29;
  white-space: pre-wrap;
  word-break: break-word;
  min-height: 80px;
}

/* 结果卡片 */
.try-page-result {
  max-width: 720px;
  margin: 24px auto 0;
  padding: 24px;
  background: #fff;
  border-radius: 12px;
  border: 1px solid #e6e1da;
  box-shadow: 0 12px 40px -28px rgba(44, 42, 41, 0.18);
}

.try-page-result-label {
  margin: 0 0 16px;
  font-family: "Songti SC", "Source Han Serif SC", "Noto Serif CJK SC", serif;
  font-size: 13px;
  font-weight: 600;
  color: rgba(44, 42, 41, 0.45);
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.try-page-result-text {
  font-family: "Songti SC", "Source Han Serif SC", "Noto Serif CJK SC", serif;
  font-size: 17px;
  line-height: 1.8;
  color: #2c2a29;
  white-space: pre-wrap;
  word-break: break-word;
}

.try-page-result-meta {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid #f0ede7;
}

.try-page-result-disclaimer {
  font-size: 12px;
  color: rgba(44, 42, 41, 0.4);
}

.try-page-result-remaining {
  font-size: 12px;
  color: rgba(44, 42, 41, 0.35);
}

/* 错误提示 */
.try-page-error {
  max-width: 720px;
  margin: 24px auto 0;
  padding: 16px 20px;
  background: rgba(255, 122, 92, 0.06);
  border: 1px solid rgba(255, 122, 92, 0.15);
  border-radius: 10px;
  text-align: center;
}

.try-page-error p {
  margin: 0 0 12px;
  font-size: 14px;
  color: rgba(44, 42, 41, 0.7);
}

.try-page-retry-btn {
  padding: 8px 20px;
  border: 1px solid rgba(255, 122, 92, 0.35);
  border-radius: 999px;
  background: #fff;
  color: #ff7a5c;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease;
}

.try-page-retry-btn:hover {
  background: rgba(255, 122, 92, 0.06);
}

/* 底部操作区 */
.try-page-footer {
  max-width: 720px;
  margin: 24px auto 0;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  justify-content: center;
  padding-top: 16px;
}

.try-page-footer--fixed {
  padding-bottom: calc(48px + env(safe-area-inset-bottom));
}

.try-page-clear,
.try-page-register-btn {
  padding: 10px 18px;
  border-radius: 999px;
  font-size: 14px;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.try-page-clear {
  border: 1px solid #e6e1da;
  background: transparent;
  color: rgba(44, 42, 41, 0.65);
}

.try-page-register-btn {
  border: 1px solid rgba(255, 122, 92, 0.35);
  background: #fff;
  color: #ff7a5c;
  font-weight: 600;
}

.try-page-register-btn:hover {
  background: rgba(255, 122, 92, 0.06);
}

.emotion-gate-escape {
  position: fixed;
  z-index: 10;
  right: 24px;
  bottom: calc(24px + env(safe-area-inset-bottom));
  font-size: 12px;
  color: rgba(44, 42, 41, 0.4);
  letter-spacing: 0.05em;
  text-decoration: none;
  transition: color 0.15s ease;
}

.emotion-gate-escape:hover {
  color: #2c2a29;
}

@media (max-width: 768px) {
  .try-page-paper {
    padding: 20px 16px;
  }
}
