/* ============================================================
   AILSA Interactive System — login.css  (欢迎/进入页)
   与主应用统一的高级质感：暖色画布、缓缓流动的光晕、错峰入场、
   spring 手感的进入按钮、点击后淡出过渡到应用。
   drop-in 替换原 login.css —— 沿用原 LANDING_PAGE 的类名/结构，
   动效纯 CSS（退出过渡的那点 JS 是可选增强，见 landing 说明）。
   ============================================================ */

@font-face {
  font-family: "Blue Sky Standard";
  src:
    url("assets/fonts/BlueSkyStandard-Regular.ttf") format("truetype"),
    local("Blue Sky Standard Regular"),
    local("Blue Sky Standard"),
    local("BlueSkyStandard-Regular");
  font-style: normal;
  font-weight: 400;
  font-display: swap;
}

@font-face {
  font-family: "Blue Sky Standard";
  src:
    url("assets/fonts/BlueSkyStandard-Bold.ttf") format("truetype"),
    local("Blue Sky Standard Bold"),
    local("BlueSkyStandard-Bold");
  font-style: normal;
  font-weight: 700;
  font-display: swap;
}

/* 版本号等细体，优先用本机安装的 Blue Sky Standard 细体 */
@font-face {
  font-family: "Blue Sky Standard Light";
  src:
    local("Blue Sky Standard Light"),
    local("BlueSkyStandard-Light"),
    local("BlueSkyStandardLight"),
    local("Blue Sky Standard Thin"),
    local("BlueSkyStandard-Thin"),
    local("Blue Sky Standard");
  font-weight: 100 400;
  font-style: normal;
  font-display: swap;
}

:root {
  color-scheme: light;
  --bg: #f3f2ee;
  --ink: #1d1b18;
  --ink-soft: #4a4741;
  --muted: #8c887f;
  --accent: #b5542a;
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-spring: cubic-bezier(0.34, 1.4, 0.64, 1);
  --history-duration: 620ms;
  --history-easing: cubic-bezier(0.34, 1.56, 0.64, 1);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  width: 100%;
  min-height: 100dvh;
  display: grid;
  place-items: center;
  overflow-x: hidden;
  overflow-y: auto;
  position: relative;
  font-family: "Blue Sky Standard", -apple-system, BlinkMacSystemFont, "Helvetica Neue", "PingFang SC", sans-serif;
  background: var(--bg);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  user-select: none;
  -webkit-touch-callout: none;
}

/* 缓缓流动的暖色光晕背景（低饱和、克制，OpenAI/Apple hero 手感） */
body::before {
  content: "";
  position: fixed;
  inset: -20%;
  z-index: 0;
  background:
    radial-gradient(38% 42% at 28% 30%, rgba(244, 196, 48, 0.10) 0%, rgba(244, 196, 48, 0) 60%),
    radial-gradient(40% 44% at 74% 68%, rgba(15, 157, 120, 0.09) 0%, rgba(15, 157, 120, 0) 62%),
    radial-gradient(60% 60% at 50% 12%, #fbfaf7 0%, rgba(251, 250, 247, 0) 60%);
  filter: blur(8px);
  animation: aurora 20s var(--ease-out) infinite alternate;
  pointer-events: none;
}

@keyframes aurora {
  0% { transform: translate3d(-2%, -1%, 0) scale(1); }
  100% { transform: translate3d(3%, 2%, 0) scale(1.08); }
}

.landing {
  position: relative;
  z-index: 1;
  display: grid;
  width: 100%;
  min-width: 0;
  justify-items: center;
  gap: 0;
  padding: 40px 32px;
  text-align: center;
}

.landing-logo {
  /* 起飞可见宽 ÷ φ：56vmin × 0.470370 ÷ 1.618 ≈ 16.28vmin */
  --logo-w: clamp(88px, 16.3vmin, 200px);
  --anim-ratio: 2.125984;
  position: relative;
  display: inline-block;
  width: var(--logo-w);
  line-height: 0;
}

.landing-logo .logo-stack__static {
  display: block;
  width: 100%;
  height: auto;
}

.landing-logo .logo-stack__anim {
  position: absolute;
  left: 50%;
  top: 50%;
  width: calc(100% * var(--anim-ratio));
  height: auto;
  transform: translate(-50%, -50%);
  pointer-events: none;
}

.landing-logo.is-animating .logo-stack__static {
  opacity: 0;
}

.landing-logo.is-settled .logo-stack__static {
  opacity: 1;
}

/* ---------- STAR 首页入场：动画独占屏幕 → 落位到页头 Logo ----------
   遮罩静态存在于 HTML 中（CSP 不允许内联脚本做首屏判断），
   landing.js 在「本会话已看过 / 减弱动态」时会在首绘前移除它。
   纯 CSS 兜底：JS 失效时遮罩在 9s 后自行隐去。 */
.star-intro {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: grid;
  place-items: center;
  pointer-events: none;
  animation: starIntroFailsafe 0.6s var(--ease-out) 9s forwards;
}

.star-intro__bg {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(38% 42% at 28% 30%, rgba(244, 196, 48, 0.10) 0%, rgba(244, 196, 48, 0) 60%),
    radial-gradient(40% 44% at 74% 68%, rgba(15, 157, 120, 0.09) 0%, rgba(15, 157, 120, 0) 62%),
    #f3f2ee;
  opacity: 1;
}

.star-intro.is-holding {
  opacity: 0;
  transition: opacity 500ms ease;
}

.star-intro__box {
  position: relative;
  width: min(72vw, 72vh);
  height: min(72vw, 72vh);
  transform-origin: 50% 50%;
  will-change: transform;
}

.star-intro__inner {
  width: 100%;
  height: 100%;
  transform-origin: 50% 50%;
  will-change: transform;
}

.star-intro__inner img {
  width: 100%;
  height: 100%;
  display: block;
}

.star-intro__inner canvas {
  width: 100%;
  height: 100%;
  display: block;
}

.star-intro__inner video {
  width: 100%;
  height: 100%;
  display: block;
}

@keyframes starFlyBlur {
  0%   { filter: blur(0); }
  15%  { filter: blur(0.5px); }
  25%  { filter: blur(1.2px); }
  39%  { filter: blur(2.3px); }
  50%  { filter: blur(1.6px); }
  60%  { filter: blur(1.0px); }
  70%  { filter: blur(0.6px); }
  85%  { filter: blur(0.2px); }
  100% { filter: blur(0); }
}

.star-intro__box.is-flying {
  animation: starFlyBlur 780ms linear both;
}

@keyframes starIntroFailsafe {
  to { opacity: 0; visibility: hidden; }
}

@media (scripting: none) {
  .star-intro { display: none; }
  .landing__body { opacity: 1; }
}

.landing__body {
  display: grid;
  justify-items: center;
  width: 100%;
  min-width: 0;
  opacity: 0;
}

.landing__body.is-in {
  opacity: 1;
  transition: opacity 800ms ease-out;
}

h1 {
  margin: 22px 0 0;
  font-size: 36px;
  font-weight: 700;
  line-height: 1.16;
  letter-spacing: -0.018em;
  animation: rise 0.9s var(--ease-out) 0.1s both;
}

.lede {
  margin: 18px 0 0;
  max-width: 30ch;
  color: var(--muted);
  font-size: 17px;
  font-weight: 400;
  line-height: 1.7;
  text-wrap: balance;
  animation: rise 0.9s var(--ease-out) 0.22s both;
}

.enter-form {
  margin: 40px 0 0;
  animation: rise 0.9s var(--ease-out) 0.34s both;
}

.latest-rehearsal {
  display: block;
  width: min(360px, calc(100vw - 48px));
  margin-top: 28px;
  padding: 18px 20px;
  border: 1px solid rgba(29, 27, 24, 0.12);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.62);
  color: inherit;
  text-decoration: none;
  text-align: left;
  cursor: pointer;
  transition: border-color 220ms ease, background-color 220ms ease, transform 220ms ease;
  animation: rise 0.9s var(--ease-out) 0.3s both;
}

.latest-rehearsal:hover {
  border-color: rgba(196, 119, 55, 0.38);
  background: rgba(255, 255, 255, 0.78);
  transform: translateY(-1px);
}

.latest-rehearsal:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.latest-label {
  display: block;
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
}

.latest-rehearsal strong {
  display: block;
  margin-top: 5px;
  font-size: 23px;
}

.latest-rehearsal p {
  margin: 4px 0 0;
  color: var(--ink-soft);
  font-size: 14px;
  line-height: 1.45;
}

.history-picker {
  width: min(360px, calc(100vw - 48px));
  margin-top: 18px;
  animation: rise 0.9s var(--ease-out) 0.42s both;
}

.history-toggle {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  width: 100%;
  min-width: 0;
  min-height: 0;
  padding: 4px;
  border: 0;
  border-radius: 2px;
  background: none;
  box-shadow: none;
  color: var(--ink-soft);
  font-family: inherit;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: color 0.45s var(--ease-out);
}

.history-toggle:hover {
  background: none;
  color: var(--ink);
  box-shadow: none;
  transform: none;
}

.history-toggle:active { transform: none; }
.history-toggle:focus-visible { outline: 2px solid var(--accent); outline-offset: 5px; }
.history-toggle::after { content: none; }

.history-chevron {
  display: inline-block;
  margin-top: -3px;
  font-size: 18px;
  font-weight: 400;
  line-height: 1;
  transform: rotate(0deg) translateY(0);
  transform-origin: 50% 58%;
  transition: transform var(--history-duration) var(--history-easing);
}

.history-picker.is-open .history-chevron {
  transform: rotate(180deg) translateY(-1px);
}

.history-panel {
  display: grid;
  grid-template-rows: 0fr;
  margin-top: 12px;
  transition: grid-template-rows var(--history-duration) var(--history-easing);
}

.history-picker.is-open .history-panel { grid-template-rows: 1fr; }

.history-panel-inner {
  overflow: hidden;
  min-height: 0;
}

.history-list {
  border-top: 1px solid rgba(29, 27, 24, 0.12);
  opacity: 0;
  transform: translateY(-8px);
  transition:
    opacity var(--history-duration) var(--history-easing),
    transform var(--history-duration) var(--history-easing);
}

.history-picker.is-open .history-list {
  opacity: 1;
  transform: translateY(0);
  transition-delay: 90ms;
}

.history-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid rgba(29, 27, 24, 0.12);
  text-align: left;
  opacity: 0;
  transform: translateY(-6px);
  transition:
    opacity 0.4s var(--ease-out),
    transform 0.4s var(--ease-out);
}

.history-picker.is-open .history-item {
  opacity: 1;
  transform: translateY(0);
  transition-delay: calc(90ms + var(--history-index, 0) * 70ms);
}

.history-item > span { flex: 1; min-width: 0; }
.history-item strong { display: block; font-size: 15px; }
.history-item small { display: block; margin-top: 2px; overflow: hidden; color: var(--muted); font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }

.history-item button {
  min-width: 38px;
  min-height: 38px;
  width: 38px;
  height: 38px;
  padding: 0;
  border-radius: 50%;
  box-shadow: none;
  font-size: 24px;
}

.history-item button::after { content: none; }

button {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-width: 210px;
  min-height: 54px;
  padding: 0 30px;
  border: 0;
  border-radius: 999px;
  background: var(--ink);
  color: #fff;
  font-family: inherit;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.01em;
  cursor: pointer;
  box-shadow: 0 10px 26px -8px rgba(29, 27, 24, 0.5);
  transition:
    transform 0.4s var(--ease-spring),
    background-color 0.28s var(--ease-out),
    box-shadow 0.4s var(--ease-out);
}

/* 按钮尾部的箭头，悬停时轻轻前移 */
button::after {
  content: "→";
  font-size: 17px;
  line-height: 1;
  transform: translateX(0);
  transition: transform 0.4s var(--ease-spring);
}

button:hover {
  background: #322f2a;
  transform: translateY(-2px);
  box-shadow: 0 16px 34px -10px rgba(29, 27, 24, 0.55);
}

button:hover::after {
  transform: translateX(4px);
}

button:active {
  transform: scale(0.97);
  transition-duration: 0.09s;
}

button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 4px;
}

.meta {
  margin: 34px 0 0;
  color: var(--muted);
  font-size: 12px;
  animation: rise 0.9s var(--ease-out) 0.46s both;
}

/* 细体版本号（若 LANDING_PAGE 里加了 .brand-version） */
.brand-version {
  display: block;
  margin-top: 6px;
  font-family: "Blue Sky Standard Light", "Blue Sky Standard", -apple-system, sans-serif;
  font-weight: 300;
  font-size: 11px;
  letter-spacing: 0.04em;
  color: var(--muted);
}

@keyframes rise {
  from { opacity: 0; transform: translateY(18px); filter: blur(4px); }
  to { opacity: 1; transform: none; filter: blur(0); }
}

@keyframes shimmer {
  0%, 100% { filter: drop-shadow(0 0 16px rgba(214, 176, 70, 0.22)); }
  50% { filter: drop-shadow(0 0 30px rgba(214, 176, 70, 0.48)); }
}
.landing.is-leaving {
  animation: leave 0.5s var(--ease-out) forwards;
}

@keyframes leave {
  to { opacity: 0; transform: translateY(-10px) scale(0.985); }
}

@media (max-width: 480px) {
  h1 { font-size: 28px; }
  .lede { font-size: 15px; }
  button { min-width: 190px; }
}

@media (prefers-reduced-motion: reduce) {
  .landing-logo .logo-stack__anim { display: none; }
  .star-intro { display: none; }
  .landing__body { opacity: 1; }

  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}
