/* 登录页：移植自 bslworking web/src/views/LoginView.vue。
   夜间 = 星云粒子字标；白天 = 复刻 Amin Ankward《Ankward Corp.》的版式（细框、衬线大标题、树枝在下半屏）。
   主题由 /theme.js 写在 <html data-theme>。 */
@import url('./fonts/fonts.css');

:root {
  color-scheme: dark;
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --dur: 220ms;
  --dur-fast: 140ms;
  --brand-ring: rgb(255 122 26 / 70%);
  --brand-soft: rgb(255 122 26 / 12%);
  --font-sans: 'PingFang SC', 'Microsoft YaHei UI', 'Microsoft YaHei', 'Noto Sans SC', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-mono: ui-monospace, 'Cascadia Mono', 'SF Mono', Consolas, 'PingFang SC', 'Microsoft YaHei', monospace;
  --font-serif: 'Instrument Serif', 'BSL Serif SC', 'Songti SC', 'STSong', 'SimSun', serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body { background: #050506; font-family: var(--font-sans); -webkit-font-smoothing: antialiased; }
:root[data-theme='light'] body { background: #e9ebeb; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
[hidden] { display: none !important; }
:root[data-theme='light'] .night-only, :root:not([data-theme='light']) .day-only { display: none !important; }
@keyframes rise-in { from { opacity: 0; transform: translateY(14px); } }

.login {
  --lg-bg: #050506;
  --lg-fg: #ffffff;
  --lg-fg-2: rgb(255 255 255 / 78%);
  --lg-fg-3: rgb(255 255 255 / 50%);
  --lg-field: rgb(18 18 20 / 72%);
  --lg-field-hover: rgb(255 255 255 / 8%);
  --lg-line: rgb(255 255 255 / 12%);
  --lg-line-2: rgb(255 255 255 / 30%);
  --lg-go: rgb(22 22 25 / 88%);
  --lg-go-hover: rgb(30 30 34 / 92%);
  --lg-haze-1: rgb(170 174 186 / 12%);
  --lg-haze-2: rgb(170 174 186 / 7%);
  --lg-vignette: rgb(5 5 6 / 85%);
  --lg-word: linear-gradient(180deg, #fff 30%, rgb(255 255 255 / 70%));
  --lg-word-glow: rgb(255 255 255 / 16%);

  position: relative;
  display: grid;
  grid-template-rows: 1fr auto auto;
  justify-items: center;
  min-height: 100vh;
  min-height: 100dvh;
  padding: 0 16px;
  overflow: hidden;
  background:
    radial-gradient(60% 40% at 72% 38%, var(--lg-haze-1), transparent 70%),
    radial-gradient(55% 35% at 22% 62%, var(--lg-haze-2), transparent 70%),
    var(--lg-bg);
  color: var(--lg-fg);
  transition: background-color 300ms ease;
}

.fx { position: absolute; inset: 0; pointer-events: none; }
.fx-field { position: absolute; inset: 0; display: block; width: 100%; height: 100%; pointer-events: none; }
.vignette { position: absolute; inset: 0; background: radial-gradient(120% 90% at 50% 40%, transparent 45%, var(--lg-vignette) 100%); pointer-events: none; }

/* 主题按钮（/theme.js 挂进 .masthead-inner） */
.theme-slot { position: absolute; top: 16px; right: 16px; z-index: 4; animation: rise-in 900ms 400ms var(--ease-out) both; }
.theme-btn { position: relative; width: 36px; height: 36px; margin: 0; padding: 0; border: 1px solid var(--lg-line); border-radius: 50%; background: var(--lg-field); backdrop-filter: blur(14px); color: var(--lg-fg-2); display: grid; place-items: center; overflow: hidden; cursor: pointer; transition: color var(--dur), border-color var(--dur); }
.theme-btn:hover { color: var(--lg-fg); border-color: var(--lg-line-2); }
.theme-btn svg { width: 17px; height: 17px; }
.theme-btn .auto-tag { position: absolute; right: 4px; bottom: 3px; font: 600 8px/1 var(--font-mono); color: #ff9a4d; }
.theme-btn.spin svg { animation: themeSpin .6s var(--ease-out); }
@keyframes themeSpin { from { transform: rotate(-120deg) scale(.4); opacity: 0; } }
::view-transition-old(root), ::view-transition-new(root) { animation: none; mix-blend-mode: normal; }
::view-transition-new(root) { z-index: 2; }

/* ———— 夜间 ———— */
.hero { position: relative; align-self: center; display: grid; justify-items: center; gap: 14px; padding-top: 8vh; text-align: center; transition: opacity 500ms ease, transform 700ms var(--ease-out), filter 700ms ease; }
.kicker { margin: 0; color: var(--lg-fg-3); font-family: var(--font-mono); font-size: 12px; letter-spacing: 0.34em; opacity: 0; transition: opacity 900ms 200ms ease; }
.wordmark {
  margin: 0;
  font-family: 'PingFang SC', 'Noto Sans SC', 'Microsoft YaHei', sans-serif;
  font-size: clamp(56px, 11vw, 116px);
  font-weight: 700;
  line-height: 1.05;
  letter-spacing: 0.06em;
  background: var(--lg-word);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  /* 先由粒子拼出，再从模糊中浮现 */
  opacity: 0;
  filter: blur(10px);
  transition: opacity 1100ms ease, filter 1300ms var(--ease-out);
}
.formed .kicker { opacity: 1; }
.formed .wordmark { opacity: 1; filter: blur(0) drop-shadow(0 0 40px var(--lg-word-glow)); }
.tagline { min-height: 1.6em; margin: 0; color: var(--lg-fg-2); font-family: var(--font-mono); font-size: clamp(14px, 1.8vw, 18px); letter-spacing: 0.08em; white-space: pre; }
.cursor { animation: blink 1.05s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }

.panel-login { position: relative; z-index: 3; display: grid; gap: 12px; width: min(400px, 100%); margin-bottom: 48px; animation: rise-in 900ms 900ms var(--ease-out) both; transition: opacity 500ms ease, transform 700ms var(--ease-out); }
.pill-field { display: flex; align-items: center; gap: 10px; height: 52px; padding: 0 8px 0 20px; border: 1px solid var(--lg-line); border-radius: 999px; background: var(--lg-field); backdrop-filter: blur(14px); color: var(--lg-fg-3); transition: border-color var(--dur), box-shadow var(--dur), background-color 300ms ease; }
.pill-field:focus-within { border-color: var(--brand-ring); box-shadow: 0 0 0 4px var(--brand-soft); color: var(--lg-fg); }
.pill-field input { flex: 1; min-width: 0; height: 100%; border: 0; outline: 0; background: transparent; color: var(--lg-fg); font: inherit; font-size: 15px; }
.pill-field input::placeholder { color: var(--lg-fg-3); }
.reveal { display: grid; place-items: center; width: 40px; height: 40px; border: 0; border-radius: 50%; background: transparent; color: var(--lg-fg-3); cursor: pointer; }
.reveal:hover { background: var(--lg-field-hover); color: var(--lg-fg); }
.reveal[aria-pressed='true'] .slash { display: none; }
.go { display: flex; align-items: center; justify-content: center; gap: 10px; height: 56px; margin-top: 6px; border: 1px solid var(--lg-line); border-radius: 999px; background: var(--lg-go); backdrop-filter: blur(14px); color: #fff; font: inherit; font-size: 17px; font-weight: 600; letter-spacing: 0.12em; cursor: pointer; box-shadow: 0 0 32px -6px rgb(255 122 26 / 35%); transition: background-color var(--dur), box-shadow var(--dur), transform var(--dur-fast); }
.go:hover:not(:disabled) { background: var(--lg-go-hover); box-shadow: 0 0 44px -4px rgb(255 122 26 / 50%); }
.go:active:not(:disabled) { transform: scale(0.985); }
.go:disabled { cursor: progress; }
.go:focus-visible, .reveal:focus-visible, .theme-btn:focus-visible, .day-nav button:focus-visible { outline: 2px solid var(--brand-ring); outline-offset: 3px; }
.spinner { display: none; width: 18px; height: 18px; border: 2px solid rgb(255 255 255 / 25%); border-top-color: #fff; border-radius: 50%; animation: spin 0.8s linear infinite; }
.busy .spinner { display: block; }
@keyframes spin { to { transform: rotate(360deg); } }
.hint { margin: 2px 0 0; color: var(--lg-fg-3); font-size: 13px; text-align: center; }
.error { margin: 0; padding: 10px 16px; border: 1px solid rgb(248 113 113 / 30%); border-radius: 999px; background: rgb(248 113 113 / 11%); color: #fca5a5; font-size: 13px; text-align: center; animation: shake .4s var(--ease-out); }
@keyframes shake { 25% { transform: translateX(-4px); } 75% { transform: translateX(4px); } }
.foot { position: relative; z-index: 2; padding: 0 0 24px; color: var(--lg-fg-3); font-size: 12px; text-align: center; transition: opacity 500ms ease; }

/* 登录成功：界面后退淡出，粒子向外冲 */
.leaving .hero { opacity: 0; transform: scale(1.08); filter: blur(6px); }
.leaving .panel-login, .leaving .foot, .leaving .theme-slot { animation: none; opacity: 0; transform: translateY(12px); transition: opacity 450ms ease, transform 600ms var(--ease-out); }

@media (max-width: 600px) { .hero { padding-top: 4vh; } .panel-login { margin-bottom: 28px; } }

/* ———— 白天 ———— */
:root[data-theme='light'] { color-scheme: light; }
:root[data-theme='light'] .login {
  display: block;
  background: radial-gradient(120% 90% at 50% 10%, #f4f5f5 0%, #e9ebeb 55%, #dfe2e2 100%);
  color: #111;
  font-family: var(--font-serif);
  --lg-field: rgb(255 255 255 / 70%);
  --lg-line: rgb(17 17 17 / 18%);
  --lg-line-2: rgb(17 17 17 / 40%);
  --lg-fg: #111;
  --lg-fg-2: rgb(17 17 17 / 70%);
  --lg-fg-3: rgb(17 17 17 / 50%);
}
.frame { position: absolute; inset: 22px; z-index: 1; border: 1px solid rgb(17 17 17 / 32%); border-radius: 14px; pointer-events: none; }
.day-top { position: absolute; top: 22px; left: 22px; right: 22px; z-index: 3; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; height: 56px; padding: 0 22px; font-size: 15px; }
.day-logo { display: inline-flex; align-items: center; gap: 8px; }
.asterisk { font-size: 15px; }
.day-logo-text { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; }
.day-nav { display: flex; gap: 40px; }
.day-nav button { padding: 4px 0; border: 0; background: none; color: #111; font: inherit; font-size: 15px; text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; cursor: pointer; }
.day-nav button:hover, .day-nav button[aria-expanded='true'] { text-decoration-thickness: 2px; }
:root[data-theme='light'] .theme-slot { top: 32px; right: 34px; animation: none; }
.day-note { position: absolute; top: 88px; left: 50%; z-index: 4; width: min(560px, calc(100% - 64px)); margin: 0; padding: 12px 18px; border: 1px solid rgb(17 17 17 / 14%); border-radius: 12px; background: rgb(255 255 255 / 82%); backdrop-filter: blur(10px); color: rgb(17 17 17 / 78%); font-family: var(--font-sans); font-size: 13px; line-height: 1.7; text-align: center; transform: translateX(-50%); animation: note-in 320ms var(--ease-out); }
.day-note a { color: #111; }
@keyframes note-in { from { opacity: 0; transform: translate(-50%, -6px); } }
.day-hero { position: absolute; top: clamp(120px, 19vh, 170px); left: 0; right: 0; z-index: 2; display: grid; justify-items: center; gap: 8px; text-align: center; pointer-events: none; animation: rise-in 1200ms var(--ease-out) both; }
.day-kicker { margin: 0; font-size: 19px; font-style: italic; color: rgb(17 17 17 / 58%); }
.day-title { display: grid; margin: 0; font-family: 'BSL Serif SC', 'Songti SC', 'STSong', 'SimSun', serif; font-size: clamp(34px, 4.5vw, 66px); font-weight: 300; line-height: 1.18; letter-spacing: 0.03em; color: #0e0e0e; }
.day-arrow { position: relative; width: 1px; height: 46px; margin-top: 26px; background: rgb(17 17 17 / 45%); }
.day-arrow::before, .day-arrow::after { content: ''; position: absolute; left: -3px; width: 7px; height: 7px; border-left: 1px solid rgb(17 17 17 / 45%); border-top: 1px solid rgb(17 17 17 / 45%); }
.day-arrow::before { top: -1px; transform: rotate(45deg); }
.day-arrow::after { bottom: -1px; transform: rotate(225deg); }

/* 左上角的登录：一行斜体小标题、两条细下划线输入、一个“进入 →” */
:root[data-theme='light'] .panel-login { position: absolute; left: 54px; top: clamp(100px, 15vh, 140px); z-index: 3; grid-template-columns: 1fr; gap: 2px; width: 300px; margin: 0; padding: 0; font-family: var(--font-sans); animation: rise-in 1200ms 300ms var(--ease-out) both; }
.day-form-title { margin: 0 0 6px; font-family: 'Instrument Serif', serif; font-size: 22px; font-style: italic; color: #111; }
.day-form-title span { font-family: var(--font-sans); font-size: 12px; font-style: normal; color: rgb(17 17 17 / 52%); }
:root[data-theme='light'] .pill-field { display: grid; grid-template-columns: 40px minmax(0, 1fr) auto; align-items: center; height: 42px; padding: 0; border: 0; border-bottom: 1px solid rgb(17 17 17 / 26%); border-radius: 0; background: transparent; backdrop-filter: none; color: rgb(17 17 17 / 55%); transition: border-color var(--dur); }
:root[data-theme='light'] .pill-field svg { display: none; }
:root[data-theme='light'] .reveal svg { display: block; }
:root[data-theme='light'] .pill-field:focus-within { border-bottom-color: #111; box-shadow: none; color: #111; }
.day-label { font-size: 12px; color: rgb(17 17 17 / 55%); }
:root[data-theme='light'] .pill-field input { height: 40px; color: #111; font-size: 14px; }
:root[data-theme='light'] .pill-field input::placeholder { color: rgb(17 17 17 / 38%); }
:root[data-theme='light'] .reveal { width: 32px; height: 32px; color: rgb(17 17 17 / 45%); }
:root[data-theme='light'] .reveal:hover { background: rgb(17 17 17 / 6%); }
:root[data-theme='light'] .go { justify-content: space-between; height: 44px; margin: 14px 0 0; padding: 0 18px; border: 0; background: #111; color: #fff; font-size: 14px; letter-spacing: 0.12em; box-shadow: none; backdrop-filter: none; }
:root[data-theme='light'] .busy .go { justify-content: center; }
.day-go-arrow { font-family: 'Instrument Serif', serif; font-size: 20px; letter-spacing: 0; transition: transform var(--dur) var(--ease-out); }
:root[data-theme='light'] .go:hover:not(:disabled) { background: #000; box-shadow: 0 8px 22px -10px rgb(17 17 17 / 60%); }
:root[data-theme='light'] .go:hover:not(:disabled) .day-go-arrow { transform: translateX(4px); }
:root[data-theme='light'] .hint { margin: 8px 0 0; color: rgb(17 17 17 / 50%); font-size: 11.5px; text-align: left; }
:root[data-theme='light'] .error { margin: 8px 0 0; padding: 8px 12px; border: 0; border-radius: 10px; background: rgb(220 38 38 / 8%); color: #b91c1c; font-size: 12.5px; text-align: left; }
.day-sign { position: absolute; right: 46px; bottom: 40px; z-index: 2; font-size: 13px; color: rgb(17 17 17 / 62%); letter-spacing: 0.04em; }
:root[data-theme='light'] .leaving :is(.day-hero, .day-top, .day-sign, .panel-login, .theme-slot) { animation: none; opacity: 0; transform: translateY(-10px); transition: opacity 500ms ease, transform 700ms var(--ease-out); }

@media (max-width: 760px) {
  .frame { inset: 12px; }
  .day-top { top: 12px; left: 12px; right: 12px; padding: 0 16px; grid-template-columns: 1fr auto; }
  .day-nav { display: none; }
  :root[data-theme='light'] .theme-slot { top: 22px; right: 24px; }
  .day-hero { top: 96px; padding: 0 24px; }
  .day-title { font-size: clamp(24px, 7.4vw, 34px); }
  /* 手机上登录区压在树枝上，留一层毛玻璃底保证看得清 */
  :root[data-theme='light'] .panel-login { top: auto; left: 24px; right: 24px; bottom: 28px; width: auto; padding: 18px 20px 16px; border-radius: 14px; background: rgb(244 245 245 / 84%); backdrop-filter: blur(14px) saturate(120%); }
  .day-sign { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .wordmark { filter: none; }
  *, *::before, *::after { animation-duration: 1ms !important; transition-duration: 1ms !important; }
}
