/* SY Studio 开屏与页面衔接（2026-11-06）
 * 参考：Chrome 跨文档视图过渡（@view-transition）、Linear / Vercel 一类应用壳的“先背景、后内容、再淡入”开屏，
 * 以及 NN/g 与 AI 生成工具的等待体验建议（不做纯展示用的闪屏，短加载不打扰，长加载给出明确状态）。
 * 本文件在 <head> 中同步加载（必须在首帧前生效）。只改呈现，不改登录、跳转等业务流程。
 *
 * 1. 页面之间（首页 ↔ 图片工作台 ↔ 视频工作台 ↔ 开发者中心）：浏览器原生跨文档淡入淡出；
 *    不支持的浏览器照常直接跳转。系统设置“减少动态效果”时关闭。
 * 2. 开屏：已登录用户打开工作台时，原来会先闪一个带关闭按钮、夜间模式按钮的“登录框”，像被退回了登录页。
 *    现在“确认登录”阶段只显示品牌字标、一行状态和一条细进度线，并且延迟 0.3 秒才出现（快速加载时什么都不闪）。
 *    登录失败、需要输入账号密码时，仍是原来的登录框，不受影响。
 * 3. 工作台出现时整体淡入（只动透明度，不位移，不影响布局）。
 */

/* ---------------------------------------------------------------- 1. 页面之间的衔接 */
@media (prefers-reduced-motion: no-preference) {
  @view-transition { navigation: auto; }
  ::view-transition-old(root) { animation: 140ms cubic-bezier(.4, 0, 1, 1) both sy-vt-out; }
  ::view-transition-new(root) { animation: 260ms cubic-bezier(.22, 1, .36, 1) both sy-vt-in; }
}
@keyframes sy-vt-out { to { opacity: 0; } }
@keyframes sy-vt-in { from { opacity: 0; } }

/* ---------------------------------------------------------------- 2. 开屏（确认登录阶段） */
:is(#loginOverlay.auth-checking, #loginGate.checking) {
  background: var(--sy-bg, #141414) !important;
}
:is(#loginOverlay.auth-checking, #loginGate.checking) :is(.auth-spline-bg, .auth-spline-scrim, .sy-auth-home, .sy-login-theme) {
  display: none !important;
}
/* 登录框背后的彩色光晕在开屏时也不显示 */
:is(#loginOverlay.auth-checking, #loginGate.checking)::before,
:is(#loginOverlay.auth-checking, #loginGate.checking)::after { display: none !important; }
html[data-sy-theme] :is(#loginOverlay.auth-checking .login-box, #loginGate.checking .lg-card),
:is(#loginOverlay.auth-checking .login-box, #loginGate.checking .lg-card) {
  background: transparent !important;
  border-color: transparent !important;
  box-shadow: none !important;
  -webkit-backdrop-filter: none !important;
  backdrop-filter: none !important;
  height: auto !important;
  min-height: 0 !important;
}
/* 品牌下的小字说明在开屏时不需要 */
:is(#loginOverlay.auth-checking, #loginGate.checking) sy-auth-brand .sy-auth-caption { display: none !important; }
/* 开屏文案：“正在同步统一登录状态…”对用户是技术用语。确认登录阶段脚本写入的始终是这句固定文字
   （出错时会切到另一个状态并显示具体原因，不受影响），这里只在该阶段换成“正在进入工作台…”。 */
#loginOverlay.auth-checking #authCheckingText { display: none; }
#loginOverlay.auth-checking #authChecking::before,
#loginGate.checking #lgChecking::before { content: "正在进入工作台…"; font-size: 13px; }
#loginGate.checking #lgChecking { font-size: 0 !important; }
/* 状态文字下方一条细进度线（不定进度：不编造百分比） */
:is(#authChecking, #lgChecking)::after {
  content: "";
  display: block;
  width: 132px;
  height: 2px;
  margin: 14px auto 0;
  border-radius: 2px;
  background: linear-gradient(90deg, transparent 0%, var(--sy-accent, #08cbea) 50%, transparent 100%) 0 0 / 50% 100% no-repeat,
              color-mix(in srgb, var(--sy-text, #ededed) 10%, transparent);
  animation: sy-boot-bar 1.15s cubic-bezier(.45, 0, .55, 1) infinite;
}
#loginOverlay.auth-session-error #authChecking::after,
#loginGate:not(.checking) #lgChecking::after { display: none; }
@keyframes sy-boot-bar {
  from { background-position: -100% 0, 0 0; }
  to { background-position: 200% 0, 0 0; }
}
@media (prefers-reduced-motion: no-preference) {
  /* 快速加载（0.3 秒内）只看到背景色；慢一点再显示字标和状态 */
  :is(#loginOverlay.auth-checking .login-box, #loginGate.checking .lg-card) > * {
    animation: sy-boot-show 320ms cubic-bezier(.22, 1, .36, 1) 300ms backwards;
  }
}
@media (prefers-reduced-motion: reduce) {
  :is(#authChecking, #lgChecking)::after { animation: none; background: var(--sy-accent, #08cbea); opacity: .5; }
}
@keyframes sy-boot-show {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: none; }
}

/* 首页的“工作台入口”在确认登录时（点“开始创作”“进入工作台”后约 1 秒）也用同一个开屏：
   原来先显示首页自己的玻璃登录框（关闭按钮、夜间模式、背景动画、“正在同步统一登录状态…”），
   跳到工作台后又换成工作台开屏，两种加载画面接连出现。现在两边完全一致，跳转时无缝衔接。
   未登录时确认完成后照常显示登录表单，不受影响。
   夜间模式下用工作台开屏的同一组颜色（底色、文字、青色进度线），跳转前后看不出切换；
   日间模式跟随首页主题，确认后出现的登录表单或工作台选择不会先闪一下深色。 */
html:not([data-sy-theme="light"]) #workspaceLauncher.sy-auth-checking {
  --sy-bg: #141414;
  --sy-text: #f3f3f3;
  --sy-accent: #08cbea;
}
html #workspaceLauncher.sy-auth-checking {
  background: var(--sy-bg, #141414) !important;
}
html #workspaceLauncher.sy-auth-checking :is(.launcher-motion, .launcher-motion-scrim, .sy-login-theme, .launcher-close, sy-auth-brand .sy-auth-caption) {
  display: none !important;
}
html #workspaceLauncher.sy-auth-checking::before,
html #workspaceLauncher.sy-auth-checking::after,
html #workspaceLauncher.sy-auth-checking .launcher-card::before,
html #workspaceLauncher.sy-auth-checking .launcher-card::after { display: none !important; }
html #workspaceLauncher.sy-auth-checking .launcher-card {
  background: transparent !important;
  border-color: transparent !important;
  box-shadow: none !important;
  -webkit-backdrop-filter: none !important;
  backdrop-filter: none !important;
}
html #workspaceLauncher.sy-auth-checking .sy-auth-status { font-size: 0 !important; color: color-mix(in srgb, var(--sy-text, #ededed) 72%, transparent) !important; }
html #workspaceLauncher.sy-auth-checking .sy-auth-status::before { content: "正在进入工作台…"; font-size: 13px; }
html #workspaceLauncher.sy-auth-checking .sy-auth-status::after {
  content: "";
  display: block;
  width: 132px;
  height: 2px;
  margin: 14px auto 0;
  border-radius: 2px;
  background: linear-gradient(90deg, transparent 0%, var(--sy-accent, #08cbea) 50%, transparent 100%) 0 0 / 50% 100% no-repeat,
              color-mix(in srgb, var(--sy-text, #ededed) 10%, transparent);
  animation: sy-boot-bar 1.15s cubic-bezier(.45, 0, .55, 1) infinite;
}
@media (prefers-reduced-motion: no-preference) {
  html #workspaceLauncher.sy-auth-checking .launcher-pane > * {
    animation: sy-boot-show 320ms cubic-bezier(.22, 1, .36, 1) 300ms backwards;
  }
}
@media (prefers-reduced-motion: reduce) {
  html #workspaceLauncher.sy-auth-checking .sy-auth-status::after { animation: none; background: var(--sy-accent, #08cbea); opacity: .5; }
}

/* 首页“工作台入口”的选择界面：标题区原来是一列居中的窄块（字标、说明、标题、账号挤在左上），
   和下方左对齐的两张工作台卡片对不齐。改为整体左对齐，字标作为小标题，去掉重复的说明小字。 */
#workspaceLauncher .launcher-workspace .workspace-head > div { text-align: left; }
#workspaceLauncher .launcher-workspace .workspace-head sy-auth-brand { text-align: left; margin-bottom: 10px; }
#workspaceLauncher .launcher-workspace .workspace-head .sy-auth-wordmark { font-size: 15px !important; line-height: 20px !important; letter-spacing: -.2px !important; opacity: .72; }
#workspaceLauncher .launcher-workspace .workspace-head .sy-auth-caption { display: none !important; }

/* 首页已登录：页头和手机菜单只留主按钮“开始创作”（直达图片工作台），隐藏意思重复的“进入工作台”。
   标记由 assets/sy-portal-account.js 根据本站登录会话设置；登录弹窗里的按钮不受影响。 */
html[data-sy-session] [data-sy-signed-in]:not([role="dialog"] *) { display: none !important; }

/* ---------------------------------------------------------------- 3. 工作台出现时淡入 */
@media (prefers-reduced-motion: no-preference) {
  html[data-sy-theme] #mainApp.workspace-ready,
  #mainApp.workspace-ready,
  html[data-sy-theme] body.auth-ready :is(.app, .sbar),
  body.auth-ready :is(.app, .sbar) {
    /* 不保留填充：动画结束后不留下层叠上下文，弹窗层级不受影响 */
    animation: sy-workspace-in 260ms cubic-bezier(.22, 1, .36, 1);
  }
}
@keyframes sy-workspace-in { from { opacity: 0; } to { opacity: 1; } }

/* 11-11（P4）：首页页头的账号按钮（已登录时显示邮箱，点开是入口面板，可切换账号） */
.sy-portal-account-chip { max-width: 190px; min-height: 44px; padding: 0 12px; border: 0; border-radius: 12px; background: transparent; color: rgba(255,255,255,.72); font: inherit; font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: pointer; }
.sy-portal-account-chip:hover { color: #fff; background: rgba(255,255,255,.06); }
.sy-portal-account-chip:focus-visible { outline: 2px solid rgba(255,255,255,.7); outline-offset: 2px; }
html[data-sy-theme="light"] .sy-portal-account-chip { color: rgba(15,23,42,.72); }
html[data-sy-theme="light"] .sy-portal-account-chip:hover { color: #0f172a; background: rgba(15,23,42,.06); }
@media (max-width: 900px) { .sy-portal-account-chip { display: none; } }

/* 11-11（P3）：门户页头的“开始创作”是首屏唯一的主入口，原来和旁边的普通按钮几乎一个样子。这一个按钮用实心强调色。
   放进主题的同一层（层内 !important 才比得过主题的统一按钮样式）。门户不加载 workspace-theme.css，所以写在这里。 */
@layer sy-controls{html[data-sy-theme] .portal-header .portal-account-actions [data-sy-button-level="primary"]{background:linear-gradient(160deg,#ffffff14,#ffffff00 55%,#ffffff0a),#0066cc!important;color:#fff!important;border-color:#ffffff38!important;font-weight:600!important}html[data-sy-theme] .portal-header .portal-account-actions [data-sy-button-level="primary"]:hover:not(:disabled){background:linear-gradient(160deg,#ffffff1f,#ffffff05 55%,#ffffff12),#0066cc!important}html[data-sy-theme="light"] .portal-header .portal-account-actions [data-sy-button-level="primary"]{background:#0066cc!important;color:#fff!important;border-color:transparent!important}}

/* 11-11（P6 / P5）：入口面板里的“登录并继续 / 注册”是主操作，浅色主题下原来像个空心按钮，比旁边选中的标签还弱。和页头“开始创作”一样用实心强调色。
   首页大标题在手机上原来断成“…短视频，一 / 套工作台完成”，让两行长度更均匀。 */
@layer sy-controls{html[data-sy-theme] #workspaceLauncher .auth-submit:not(:disabled){background:#0066cc!important;color:#fff!important;border-color:transparent!important;font-weight:600!important}html[data-sy-theme] #workspaceLauncher .auth-submit:hover:not(:disabled){background:#005bb5!important}}
.portal-hero-title{text-wrap:balance}
