/* 朋友中心 · 公共样式（未登录可见：基础、顶栏、登录、注册、提示）。
   登录后的面板样式由 /assets/app.css 在会话校验后下发。 */
:root {
  color-scheme: light;
  --ink: #1d1d1f;
  --ink-2: #424245;
  --muted: #6e6e73;
  --quiet: #86868b;
  --blue: #0066cc;
  --blue-hover: #0077ed;
  --blue-focus: #0071e3;
  --blue-wash: #eef5fd;
  --canvas: #fff;
  --parchment: #f5f5f7;
  --fill: #ececf0;
  --hairline: rgba(0, 0, 0, .08);
  --hairline-strong: rgba(0, 0, 0, .14);
  --glass: rgba(245, 245, 247, .78);
  --danger: #b42318;
  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 18px;
  --sidebar: 248px;
  --sidebar-small: 76px;
  --topbar: 52px;
  --ease: cubic-bezier(.22, 1, .36, 1);
  --ease-out: cubic-bezier(.16, 1, .3, 1);
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei UI", "Microsoft YaHei", "Noto Sans SC", system-ui, sans-serif;
  --font-display: -apple-system, BlinkMacSystemFont, "SF Pro Display", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei UI", "Microsoft YaHei", "Noto Sans SC", system-ui, sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { min-height: 100%; background: var(--parchment); -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0;
  background: var(--parchment);
  color: var(--ink);
  font: 17px/1.6 var(--font);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}
::selection { background: rgba(0, 102, 204, .16); }
a { color: var(--blue); text-decoration: none; transition: color .2s var(--ease); }
a:hover { color: var(--blue-hover); }
button, input, textarea, select { font: inherit; color: inherit; letter-spacing: inherit; }
button { cursor: pointer; }
button, a, input, textarea, select, label { -webkit-tap-highlight-color: transparent; }
/* 键盘焦点环。:focus 作为不支持 :focus-visible 的旧浏览器的后备。 */
:focus { outline: 2px solid var(--blue-focus); outline-offset: 2px; }
:focus:not(:focus-visible) { outline: none; }
button:disabled, input:disabled, textarea:disabled, select:disabled { cursor: not-allowed; opacity: .48; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.skip-link { position: fixed; left: -999px; top: 8px; z-index: 200; padding: 8px 14px; border-radius: var(--radius-sm); background: var(--ink); color: #fff; }
.skip-link:focus { left: 8px; color: #fff; }
.glass { background: var(--glass); backdrop-filter: saturate(180%) blur(20px); -webkit-backdrop-filter: saturate(180%) blur(20px); }

/* ---------- 顶栏 ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  min-height: var(--topbar);
  padding: 0 28px;
  background: var(--glass);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid var(--hairline);
}
.brand { grid-column: 1; display: inline-flex; align-items: center; justify-self: start; gap: 10px; color: var(--ink); font-size: 14px; font-weight: 600; letter-spacing: .02em; }
.brand:hover { color: var(--ink); }
.brand-mark { display: grid; place-items: center; width: 28px; height: 28px; overflow: hidden; border-radius: 50%; background: var(--ink); transition: transform .5s var(--ease); }
.brand:hover .brand-mark { transform: rotate(-8deg) scale(1.04); }
.brand-mark img { display: block; width: 100%; height: 100%; }
.topbar-session { grid-column: 3; display: flex; align-items: center; justify-self: end; gap: 14px; min-width: 0; color: var(--muted); font-size: 13px; }
.topbar-session > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar-logout {
  min-height: 32px;
  padding: 5px 14px;
  border: 0;
  border-radius: 9999px;
  background: rgba(0, 0, 0, .05);
  color: var(--ink);
  font-size: 12px;
  white-space: nowrap;
  transition: background-color .2s var(--ease), transform .18s var(--ease);
}
.topbar-logout:hover { background: rgba(0, 0, 0, .09); }
.topbar-logout:active { transform: scale(.95); }
.archived-banner { grid-column: 2; margin: 0; color: #4f555a; font-size: 13px; font-weight: 600; letter-spacing: .12em; }

/* ---------- 表单基础 ---------- */
.field { display: grid; gap: 8px; margin: 0 0 18px; color: var(--ink-2); font-size: 14px; }
.field-hint { color: var(--quiet); font-size: 12px; line-height: 1.5; }
.input,
.access-card input {
  width: 100%;
  min-height: 48px;
  padding: 12px 16px;
  border: 1px solid var(--hairline-strong);
  border-radius: var(--radius);
  background: var(--canvas);
  color: var(--ink);
  font-size: 17px;
  transition: border-color .2s var(--ease), box-shadow .2s var(--ease), background-color .2s var(--ease);
}
.input:hover, .access-card input:hover { border-color: rgba(0, 0, 0, .24); }
.input:focus, .access-card input:focus { border-color: var(--blue-focus); outline: 0; box-shadow: 0 0 0 4px rgba(0, 113, 227, .14); }
.input::placeholder, .access-card input::placeholder { color: #a1a1a6; }

.btn,
.access-card button[type="submit"] {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 10px 22px;
  border: 0;
  border-radius: 9999px;
  background: var(--blue);
  color: #fff;
  font-size: 17px;
  white-space: nowrap;
  transition: background-color .2s var(--ease), transform .18s var(--ease), opacity .2s var(--ease);
}
.btn:hover, .access-card button[type="submit"]:hover { background: var(--blue-hover); }
.btn:active, .access-card button[type="submit"]:active { transform: scale(.97); }
.btn.is-busy, .access-card button.is-busy { color: transparent !important; }
.btn.is-busy::after, .access-card button.is-busy::after {
  content: "";
  position: absolute;
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255, 255, 255, .45);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
.text-button { min-height: 40px; padding: 8px 12px; border: 0; border-radius: 9999px; background: transparent; color: var(--blue); transition: background-color .2s var(--ease); }
.text-button:hover { background: rgba(0, 102, 204, .07); }
.form-note { margin: 22px 0 0; color: var(--muted); font-size: 14px; }
.form-note a { font-weight: 600; }

/* ---------- 登录 / 注册 ---------- */
.welcome-shell, .register-shell {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(320px, 400px);
  align-items: center;
  gap: clamp(48px, 9vw, 140px);
  width: min(1080px, calc(100% - 56px));
  min-height: calc(100vh - var(--topbar));
  min-height: calc(100dvh - var(--topbar));
  margin: 0 auto;
  padding: 72px 0;
}
.welcome-copy, .register-copy { max-width: 600px; }
.section-kicker, .meta-label, .sunset-kicker { margin: 0 0 14px; color: var(--muted); font-size: 13px; font-weight: 600; letter-spacing: .14em; }
.welcome-copy h1, .register-copy h1 {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(44px, 6.4vw, 76px);
  line-height: 1.06;
  font-weight: 600;
  letter-spacing: -.02em;
}
.register-copy h1 { font-size: clamp(36px, 4.6vw, 52px); line-height: 1.14; }
.welcome-copy > p:last-child, .register-copy > p:last-child { max-width: 480px; margin: 24px 0 0; color: var(--muted); }
.welcome-copy > p:empty { display: none; }
.welcome-rule { display: block; width: 56px; height: 2px; margin-top: 36px; border-radius: 2px; background: var(--ink); transform-origin: left; }

.access-card { width: 100%; }
.access-card h2 { margin: 0 0 28px; font-family: var(--font-display); font-size: 24px; line-height: 1.25; font-weight: 600; letter-spacing: -.01em; }
.login-card h2 { text-align: center; }
.access-card label { display: grid; gap: 8px; margin: 0 0 18px; color: var(--ink-2); font-size: 14px; }
.access-card label small { color: var(--quiet); font-size: 12px; line-height: 1.5; }
.access-card button[type="submit"] { width: 100%; margin-top: 10px; }
.access-card label.remember-line { display: flex; align-items: center; gap: 10px; margin: 4px 0 14px; color: var(--muted); cursor: pointer; }
.access-card label.remember-line input { width: 18px; min-height: 0; height: 18px; margin: 0; padding: 0; accent-color: var(--blue); cursor: pointer; }
.access-card .form-note { text-align: center; }
.register-panel { position: relative; width: 100%; }
.register-panel .text-button { width: 100%; margin-top: 10px; }
.register-steps { display: flex; gap: 6px; margin: 0 0 22px; }
.register-steps span { width: 22px; height: 3px; border-radius: 3px; background: var(--fill); transition: background-color .4s var(--ease), width .4s var(--ease); }
.register-steps span.is-on { width: 34px; background: var(--ink); }
.password-meter { height: 3px; margin-top: 2px; overflow: hidden; border-radius: 3px; background: var(--fill); }
.password-meter i { display: block; width: 0; height: 100%; border-radius: inherit; background: var(--quiet); transition: width .35s var(--ease), background-color .35s var(--ease); }

/* 登录/注册的入场动画：只在首屏执行一次 */
.enter { animation: rise .8s var(--ease-out) both; }
.enter-2 { animation-delay: .08s; }
.enter-3 { animation-delay: .16s; }
.enter-4 { animation-delay: .24s; }
.welcome-rule.enter { animation: draw .9s var(--ease-out) .3s both; }
.access-card:not([hidden]) { animation: rise .6s var(--ease-out) both; }
.shake { animation: shake .42s var(--ease); }

/* ---------- 提示 ---------- */
.toast {
  position: fixed;
  bottom: 28px;
  left: 50%;
  z-index: 150;
  max-width: min(92vw, 560px);
  padding: 12px 20px;
  border-radius: 9999px;
  background: rgba(29, 29, 31, .92);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  color: #fff;
  font-size: 15px;
  line-height: 1.45;
  text-align: center;
  opacity: 0;
  transform: translate(-50%, 16px) scale(.98);
  transition: opacity .28s var(--ease), transform .4s var(--ease-out);
  pointer-events: none;
}
.toast.is-visible { opacity: 1; transform: translate(-50%, 0) scale(1); }
.toast.is-error { background: rgba(143, 29, 20, .94); }
.noscript { padding: 24px; text-align: center; }

@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes draw { from { transform: scaleX(0); } to { transform: scaleX(1); } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes shake { 0%, 100% { transform: none; } 20% { transform: translateX(-6px); } 40% { transform: translateX(5px); } 60% { transform: translateX(-3px); } 80% { transform: translateX(2px); } }

@media (max-width: 900px) {
  .welcome-shell, .register-shell { grid-template-columns: 1fr; align-content: center; gap: 48px; width: min(460px, calc(100% - 40px)); padding: 56px 0; }
  .welcome-copy h1 { font-size: clamp(44px, 12vw, 60px); }
  .welcome-rule { margin-top: 28px; }
}

@media (max-width: 700px) {
  .topbar { grid-template-columns: auto 1fr auto; gap: 10px; padding: 0 16px; }
  .brand > span:last-child { display: none; }
  .archived-banner { justify-self: center; font-size: 12px; letter-spacing: .06em; }
  .topbar-session { gap: 8px; }
  .topbar-session > span { max-width: 96px; }
}

@media (max-width: 440px) {
  .welcome-shell, .register-shell { width: calc(100% - 32px); padding: 40px 0; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-delay: 0s !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}
