/* =========================
   Hero 启动页 - Agent决策辅助平台
   白红 / 亮面终端
   元素分离：video / typewriter / pills / nav 均可独立编辑
   ========================= */

:root {
  --hs-bg: #ffffff;
  --hs-surface: #f8fafc;
  --hs-ink: #0f172a;
  --hs-ink-soft: #64748b;
  --hs-accent: #dc2626;
  --hs-accent-dim: #7f1d1d;
  --hs-font: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --hs-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  --hs-radius: 0;
}

/* 页面容器 */
.hs-page {
  position: relative;
  background: var(--hs-bg);
  color: var(--hs-ink);
  font-family: var(--hs-font);
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
}

/* 背景层：纯 CSS 渲染，零视频解码、零外部网络；全尺寸绝对定位铺满作为底层 */
.hs-video {
  position: absolute;
  inset: 0;
  background: var(--hs-bg);
  overflow: hidden;
  contain: paint style;
  z-index: 0;
  pointer-events: none;
}

/* 背景网格与辐射：纯 CSS，无视频；鼠标视差由 JS 轻量驱动（transform 合成层） */
.hs-grid {
  position: absolute;
  inset: -5%;
  background-image:
    radial-gradient(circle at 50% 50%, rgba(220, 38, 38, 0.06) 0%, transparent 55%),
    linear-gradient(var(--hs-accent-dim) 1px, transparent 1px),
    linear-gradient(90deg, var(--hs-accent-dim) 1px, transparent 1px);
  background-size: 100% 100%, 40px 40px, 40px 40px;
  opacity: 0.5;
  pointer-events: none;
  will-change: transform;
}

/* 减少动画偏好：禁用光标闪烁 */
@media (prefers-reduced-motion: reduce) {
  .typewriter-cursor { animation: none !important; opacity: 1; }
}

/* 导航栏 */
.hs-nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 10;
  padding: 12px 20px;
  display: flex;
  flex-direction: row;
  justify-content: space-between;
  align-items: center;
  background: transparent;
}
@media (min-width: 768px) {
  .hs-nav { padding-left: 32px; padding-right: 32px; padding-top: 20px; padding-bottom: 20px; }
}
.hs-nav .logo {
  display: flex;
  align-items: center;
  gap: 12px;
}
.hs-nav .logo .brand {
  font-size: 21px;
  letter-spacing: -0.02em;
  color: var(--hs-ink);
  font-weight: 500;
  user-select: none;
}
@media (min-width: 640px) {
  .hs-nav .logo .brand { font-size: 26px; }
}
.hs-nav .logo .mark {
  font-size: 25px;
  color: var(--hs-accent);
  user-select: none;
  letter-spacing: -0.02em;
  font-weight: 500;
  line-height: 1;
  margin-bottom: 4px;
}
@media (min-width: 640px) {
  .hs-nav .logo .mark { font-size: 30px; }
}
.hs-nav .desktop-links {
  display: none;
  flex-direction: row;
  gap: 24px;
  font-size: 23px;
  color: var(--hs-ink);
}
@media (min-width: 768px) {
  .hs-nav .desktop-links { display: flex; }
}
.hs-nav .desktop-links a {
  color: var(--hs-ink);
  text-decoration: none;
  opacity: 1;
  transition: opacity 0.2s;
}
.hs-nav .desktop-links a:hover { opacity: 0.6; }
.hs-nav .divider {
  color: var(--hs-ink-soft);
  opacity: 0.5;
  user-select: none;
}
.hs-nav .desktop-cta {
  display: none;
  font-size: 23px;
  color: var(--hs-ink);
  text-decoration: underline;
  text-underline-offset: 8px;
  transition: opacity 0.2s;
}
@media (min-width: 768px) {
  .hs-nav .desktop-cta { display: block; }
}
.hs-nav .desktop-cta:hover { opacity: 0.6; }

/* 移动端汉堡 */
.hs-nav .mobile-burger {
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
}
@media (min-width: 768px) {
  .hs-nav .mobile-burger { display: none; }
}
.hs-nav .mobile-burger span {
  width: 24px;
  height: 2px;
  background: var(--hs-ink);
  display: block;
  transition: all 0.3s;
}
.hs-nav .mobile-burger.open span:nth-child(1) {
  transform: rotate(45deg) translateY(7px);
}
.hs-nav .mobile-burger.open span:nth-child(2) {
  opacity: 0;
}
.hs-nav .mobile-burger.open span:nth-child(3) {
  transform: rotate(-45deg) translateY(-7px);
}

/* 移动端全屏菜单 */
.hs-mobile-menu {
  position: fixed;
  inset: 0;
  z-index: 9;
  background: #ffffff;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 24px;
  color: var(--hs-ink);
  font-size: 23px;
  font-weight: 500;
}
.hs-mobile-menu.open {
  opacity: 1;
  pointer-events: auto;
}
.hs-mobile-menu a {
  color: var(--hs-ink);
  text-decoration: none;
  display: block;
}
.hs-mobile-menu a.cta { text-decoration: underline; }

/* 内容容器：透明背景，让 CSS 网格背景透出 */
.hs-content {
  position: relative;
  z-index: 10;
  width: 100%;
  background: transparent;
  padding-bottom: 32px;
  min-height: 100dvh;
}
#spade-hero {
  width: 100%;
  max-width: 800px;
  margin: 0 auto;
  padding: 48px 24px;
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  text-align: center;
}
@media (min-width: 1024px) {
  #spade-hero { text-align: left; }
}

/* 打字机标题 */
.hs-headline {
  width: 100%;
  margin-bottom: 32px;
}
#typewriter-output {
  /* 圆润字体栈：优先圆体/马天文黑，回退到常见黑体 */
  font-family: "Yuanti SC", "YouYuan", "幼圆", "YouYuan", "Hiragino Maru Gothic ProN", "华文圆体", "PingFang SC", "MiSans", "HarmonyOS Sans SC", "Microsoft YaHei", system-ui, sans-serif;
  font-size: clamp(38px, 5vw, 60px);
  font-weight: 700;
  letter-spacing: 0.01em;
  color: var(--hs-ink);
  line-height: 1.16;
  margin-bottom: 32px;
  user-select: none;
  white-space: pre-wrap;
  text-wrap: balance;
}
@media (min-width: 768px) {
  #typewriter-output { font-size: clamp(44px, 4.4vw, 68px); }
}

/* 打字光标 */
.typewriter-cursor {
  display: inline-block;
  width: 2px;
  height: 1.1em;
  background: var(--hs-ink);
  vertical-align: middle;
  margin-left: 8px;
  animation: blink 1s step-end infinite;
}
@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}

/* 副描述 */
.hs-sub {
  font-size: 18px;
  color: var(--hs-ink-soft);
  line-height: 1.625;
  font-weight: 400;
  margin-bottom: 56px;
  max-width: 640px;
  margin-left: auto;
  margin-right: auto;
}
@media (min-width: 1024px) {
  .hs-sub { margin-left: 0; margin-right: 0; }
}

/* 服务药丸 */
.hs-pills {
  width: 100%;
  max-width: 640px;
  margin-left: auto;
  margin-right: auto;
}
@media (min-width: 1024px) {
  .hs-pills { margin-left: 0; margin-right: 0; }
}
.hs-pills h2 {
  font-size: 32px;
  font-weight: 500;
  letter-spacing: -0.02em;
  color: var(--hs-ink);
  margin-bottom: 8px;
}
.hs-pills p.subtitle {
  color: var(--hs-ink-soft);
  opacity: 0.85;
  margin-bottom: 32px;
  font-size: 16px;
}
#pills-container {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}
.pill {
  padding: 8px 16px;
  font-size: 14px;
  font-family: var(--hs-font);
  border-radius: var(--hs-radius);
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}
.pill.inactive {
  background: var(--hs-bg);
  color: var(--hs-accent);
  border: 1px solid var(--hs-accent-dim);
}
.pill.inactive:hover { background: rgba(220, 38, 38, 0.05); }
.pill.active {
  background: var(--hs-accent);
  color: #ffffff;
  box-shadow: 0 0 0 1px var(--hs-accent-dim);
}
.pill.active .check {
  display: inline-block;
  margin-left: 6px;
  animation: checkDrop 0.4s cubic-bezier(0.16, 1, 0.3, 1) both;
}
@keyframes checkDrop {
  0% { transform: scale(0); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

/* 参议反馈横幅 */
#pills-feedback {
  margin-top: 24px;
}
.feedback-empty {
  font-size: 12px;
  font-style: italic;
  opacity: 0.5;
  color: var(--hs-ink-soft);
}
.feedback-active {
  background: #fffbff;
  border: 1px solid #fecaca;
  border-radius: 16px;
  padding: 16px 20px;
  color: var(--hs-ink);
  font-size: 14px;
  animation: slideUp 0.4s cubic-bezier(0.16, 1, 0.3, 1) both;
}
@keyframes slideUp {
  0% { opacity: 0; transform: translateY(12px); }
  100% { opacity: 1; transform: translateY(0); }
}
.cta-go {
  margin-top: 10px;
  padding: 6px 14px;
  background: transparent;
  border: 1px solid var(--hs-accent);
  color: var(--hs-accent);
  font-size: 12px;
  font-family: var(--hs-font);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  border-radius: var(--hs-radius);
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}
.cta-go:hover { background: var(--hs-accent); color: #ffffff; }

.hidden { display: none !important; }

/* Hero 启动页覆盖层（首次打开即显示，取代 boot 动画） */
#hero-landing {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  background: var(--hs-bg);
}
#hero-landing.hidden { display: none !important; }

/* hs-content 作为固定层内占满视口 */
#hero-landing .hs-content {
  background: transparent;
  flex: 1;
  min-height: 100dvh;
  padding-bottom: 32px;
  display: flex;
}

/* 导航在亮色背景可见 */
#hero-landing .hs-nav .logo .brand,
#hero-landing .hs-nav .logo .mark,
#hero-landing .hs-nav .desktop-links a,
#hero-landing .hs-nav .desktop-cta {
  color: var(--hs-ink) !important;
}
#hero-landing .hs-nav .divider {
  color: var(--hs-ink-soft) !important;
}

/* 打字标题 */
#hero-landing #typewriter-output {
  color: var(--hs-ink) !important;
}

/* 副描述 */
#hero-landing .hs-sub {
  color: var(--hs-ink-soft) !important;
}

/* 药丸标题与副标题 */
#hero-landing .hs-pills h2 { color: var(--hs-ink) !important; }
#hero-landing .hs-pills p.subtitle { color: var(--hs-ink-soft) !important; }

/* =========================
   Hero 背景 + 人物 3D 浮雕（Three.js canvas）
   ========================= */

/* 背景层：白红品牌渐变 */
#hero-landing .hero-bg {
  position: absolute;
  inset: 0;
  z-index: 1;
  background:
    radial-gradient(1200px 800px at 78% 42%, rgba(220, 38, 38, 0.10) 0%, transparent 55%),
    radial-gradient(900px 600px at 15% 85%, rgba(127, 29, 29, 0.06) 0%, transparent 60%),
    linear-gradient(135deg, #ffffff 0%, #fff5f5 55%, #ffffff 100%);
  pointer-events: none;
}

/* 内容层需在背景之上 */
#hero-landing .hs-content { z-index: 20; }

/* 人物容器：缩至底部右侧，远离顶部标题，互不遮挡。
   文字层 z-index 高于人物，始终清晰可见。 */
#hero-landing .hero-character {
  position: absolute;
  z-index: 15;
  right: clamp(-10px, 1vw, 40px);
  bottom: -3vh;
  width: min(500px, 40vw);
  aspect-ratio: 1164 / 1351;
  transform: translateY(0);
  pointer-events: none;
  filter: drop-shadow(0 30px 50px rgba(15, 23, 42, 0.22));
  animation: heroCharFloat 7s ease-in-out infinite;
  will-change: transform;
}

@keyframes heroCharFloat {
  0%, 100% { transform: translateY(0) rotate(-0.8deg); }
  50%      { transform: translateY(-12px) rotate(0deg); }
}

#hero-landing .character-canvas {
  display: block;
  width: 100%;
  height: 100%;
  background: transparent;
}

/* 减少动画：人物静止 */
@media (prefers-reduced-motion: reduce) {
  #hero-landing .hero-character { animation: none; transform: translateY(0); }
}

/* 平板/中屏：人物略缩，仍贴右 */
@media (max-width: 1024px) {
  #hero-landing .hero-character {
    width: min(420px, 46vw);
    right: -10px;
    bottom: -2vh;
  }
}

/* 窄屏：手机上人物缩到右下角 */
@media (max-width: 720px) {
  #hero-landing .hero-character {
    width: min(340px, 72vw);
    right: -30px;
    bottom: -1vh;
    opacity: 0.95;
  }
}

/* =========================
   登录页（登录门禁 · 按账号分离数据）
   风格：白红渐变 + 圆润卡片 + 红色主按钮（与全站白红主题一致）
   ========================= */
#login-page {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 18px;
  overflow-y: auto;
  background:
    radial-gradient(680px 520px at 18% 12%, rgba(220, 38, 38, 0.10) 0%, transparent 60%),
    radial-gradient(620px 480px at 88% 20%, rgba(239, 68, 68, 0.09) 0%, transparent 55%),
    radial-gradient(760px 560px at 50% 108%, rgba(127, 29, 29, 0.06) 0%, transparent 60%),
    linear-gradient(165deg, #ffffff 0%, #fff5f5 52%, #ffffff 100%);
  font-family: system-ui, -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
  -webkit-font-smoothing: antialiased;
}
#login-page.hidden { display: none; }

.login-card {
  width: 100%;
  max-width: 392px;
  background: #ffffff;
  border-radius: 24px;
  padding: 34px 30px 26px;
  box-shadow: 0 22px 60px rgba(220, 38, 38, 0.12), 0 4px 14px rgba(220, 38, 38, 0.06);
  border: 1px solid rgba(252, 226, 226, 0.9);
}

.login-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: 24px;
}
.login-avatar {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  overflow: hidden;
  background: radial-gradient(circle at 50% 38%, #fff1f1 0%, #ffe4e4 100%);
  box-shadow: 0 10px 26px rgba(220, 38, 38, 0.22), inset 0 0 0 3px rgba(255, 255, 255, 0.85);
  margin-bottom: 14px;
}
.login-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 18%;
  display: block;
}
.login-logo {
  font-size: 30px;
  font-weight: 800;
  letter-spacing: 0.04em;
  margin: 0;
  background: linear-gradient(92deg, #ef4444 0%, #dc2626 55%, #b91c1c 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: #dc2626;
}
.login-subtitle {
  margin: 8px 0 0;
  font-size: 13px;
  color: #6b7488;
  letter-spacing: 0.02em;
}

.login-form { display: flex; flex-direction: column; gap: 14px; }
.login-field { display: flex; flex-direction: column; gap: 7px; }
.login-label { font-size: 13px; font-weight: 600; color: #3a4152; }
.login-field input {
  height: 46px;
  border-radius: 12px;
  border: 1.5px solid #efe0e0;
  background: #faf6f6;
  padding: 0 14px;
  font-size: 15px;
  color: #1f2430;
  outline: none;
  transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}
.login-field input::placeholder { color: #b3a6a6; }
.login-field input:focus {
  border-color: #dc2626;
  background: #ffffff;
  box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.16);
}
.login-error {
  margin: 0;
  font-size: 13px;
  color: #d64545;
  background: #fdecec;
  border: 1px solid #f6cfcf;
  border-radius: 10px;
  padding: 8px 12px;
}
.login-error.hidden { display: none; }

.login-btn {
  height: 48px;
  margin-top: 4px;
  border: none;
  border-radius: 12px;
  background: linear-gradient(92deg, #ef4444 0%, #dc2626 100%);
  color: #fff;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.08em;
  cursor: pointer;
  box-shadow: 0 10px 22px rgba(220, 38, 38, 0.32);
  transition: transform 0.12s ease, box-shadow 0.15s ease, filter 0.15s ease;
}
.login-btn:hover { filter: brightness(1.05); box-shadow: 0 12px 26px rgba(220, 38, 38, 0.42); }
.login-btn:active { transform: translateY(1px); }
.login-btn:disabled { opacity: 0.6; cursor: not-allowed; box-shadow: none; }
.login-btn:focus-visible { outline: 3px solid rgba(220, 38, 38, 0.45); outline-offset: 2px; }

.login-switch {
  margin: 18px 0 0;
  text-align: center;
  font-size: 13px;
  color: #6b7488;
}
.login-link {
  border: none;
  background: none;
  color: #dc2626;
  font-weight: 700;
  cursor: pointer;
  padding: 0 2px;
  font-size: 13px;
}
.login-link:hover { text-decoration: underline; }
.login-foot {
  margin: 16px 0 0;
  text-align: center;
  font-size: 11.5px;
  color: #9aa1b1;
}

/* 头部用户区 + 退出 */
.user-box {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 10px;
}
.user-name {
  font-size: 13px;
  font-weight: 600;
  color: #3a4152;
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.user-box .user-name::before {
  content: "👤 ";
  font-size: 12px;
}
.logout-btn {
  border: 1px solid #e4e8f1;
  background: #f6f8fc;
  color: #3a4152;
  font-size: 12.5px;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: 9px;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}
.logout-btn:hover { background: #fdecec; border-color: #f6cfcf; color: #d64545; }

@media (max-width: 460px) {
  .login-card { padding: 28px 20px 22px; border-radius: 20px; }
  .login-logo { font-size: 26px; }
  .login-avatar { width: 84px; height: 84px; }
}

