:root {
  --bg: #F0EEE6;
  --surface: #EAE8DD;
  --surface-raised: #F5F3EB;
  --ink: #1F1E1D;
  --body: #5E5D59;
  --muted: #87867F;
  --line: #E4E2D6;
  --line-strong: #CFCDC2;
  --accent: #D97757;
  --accent-deep: #C15F3C;
  --accent-soft: #F2E1D8;
  --display: "Newsreader", "Songti SC", "Noto Serif SC", SimSun, Georgia, serif;
  --sans: Inter, system-ui, -apple-system, "Segoe UI", "Microsoft YaHei", sans-serif;
  color-scheme: light;
}

[data-theme="dark"] {
  --bg: #262624;
  --surface: #30302E;
  --surface-raised: #353431;
  --ink: #F0EEE6;
  --body: #B4B0A6;
  --muted: #8C887E;
  --line: #3A3936;
  --line-strong: #4A4844;
  --accent: #D97757;
  --accent-deep: #E08A6C;
  --accent-soft: #43302A;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 100px; }
body {
  margin: 0;
  min-width: 320px;
  background: var(--bg);
  color: var(--ink);
  font: 400 16px/1.7 var(--sans);
  -webkit-font-smoothing: antialiased;
}
body, button, input, textarea { font-family: var(--sans); }
a { color: inherit; text-decoration: none; }
button, input, textarea { font: inherit; }
button { color: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
img { max-width: 100%; }
button { cursor: pointer; }
[hidden] { display: none !important; }
::selection { background: var(--accent-soft); color: var(--ink); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }

.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;
  top: 8px;
  left: 8px;
  z-index: 100;
  padding: 8px 14px;
  border-radius: 8px;
  background: var(--ink);
  color: var(--bg);
  transform: translateY(-160%);
}
.skip-link:focus { transform: none; }
.grain {
  position: fixed;
  inset: -50%;
  z-index: 20;
  pointer-events: none;
  opacity: .035;
  mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
[data-theme="dark"] .grain { mix-blend-mode: screen; opacity: .025; }
.page-width { width: min(1120px, calc(100% - 48px)); margin-inline: auto; }

.site-header {
  position: fixed;
  inset: 12px 0 auto;
  z-index: 30;
  padding-inline: 12px;
  pointer-events: none;
}
.nav-shell {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  width: min(1180px, 100%);
  min-height: 64px;
  margin-inline: auto;
  padding: 10px 14px 10px 24px;
  border: 1px solid color-mix(in srgb, var(--line) 82%, transparent);
  border-radius: 22px;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  box-shadow: 0 12px 36px -28px rgba(40, 30, 20, .5);
  backdrop-filter: blur(16px) saturate(1.15);
  -webkit-backdrop-filter: blur(16px) saturate(1.15);
  pointer-events: auto;
}
.brand { display: inline-flex; align-items: center; gap: 11px; font: 500 26px/1 var(--display); letter-spacing: -.025em; }
.brand-star { width: 25px; height: 25px; overflow: visible; }
.brand-star g { fill: none; stroke: var(--accent); stroke-width: 2.4; stroke-linecap: round; }
.top-links { display: flex; align-items: center; gap: 4px; margin-left: auto; }
.top-links a, .text-link { padding: 7px 13px; border-radius: 999px; color: var(--body); font-size: 14px; }
.top-links a:hover, .text-link:hover { background: var(--surface); color: var(--ink); }
.top-links a[aria-current="page"] { background: var(--surface); color: var(--ink); }
.nav-actions { display: flex; align-items: center; gap: 12px; }
/* 与主站同款：沙色凹槽轨道 + 珊瑚色旋钮 */
.theme-toggle {
  position: relative;
  flex: none;
  width: 58px;
  height: 32px;
  padding: 0;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--surface);
  box-shadow: inset 0 1px 3px rgba(31, 30, 29, .07);
  transition: background-color .5s, border-color .5s;
}
.theme-toggle:hover { border-color: var(--muted); }
.theme-knob {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 1px 3px rgba(31, 30, 29, .3);
  transition: transform .35s cubic-bezier(.34, 1.56, .64, 1), background-color .5s;
}
[data-theme="dark"] .theme-toggle { box-shadow: inset 0 1px 3px rgba(0, 0, 0, .35); }
[data-theme="dark"] .theme-knob { transform: translateX(26px); }

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 20px;
  border: 1px solid transparent;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 500;
  line-height: 1;
  transition: transform .2s, background-color .2s, border-color .2s;
}
.button:active { transform: scale(.96); }
.button-dark { background: var(--ink); color: var(--bg); }
.button-dark:hover { background: var(--accent); color: #FFF9F2; }
.button-light { border-color: var(--line-strong); background: var(--surface-raised); color: var(--ink); }
.button-light:hover { background: var(--surface); border-color: var(--line-strong); }
.button-accent { background: var(--accent); color: #FFF9F2; }
.button-accent:hover { background: var(--accent-deep); }
.nav-apply { min-height: 40px; padding-inline: 18px; }

.friends-hero {
  position: relative;
  display: grid;
  grid-template-columns: 1.25fr .75fr;
  align-items: end;
  gap: 72px;
  min-height: 500px;
  padding-top: 168px;
  padding-bottom: 64px;
  border-bottom: 1px solid var(--line);
}
.section-kicker { margin: 0 0 18px; color: var(--accent); font-size: 13px; font-weight: 600; letter-spacing: .08em; }
.friends-hero h1, .admin-heading h1, .login-panel h1 {
  margin: 0;
  font: 500 clamp(72px, 10vw, 116px)/.9 var(--display);
  letter-spacing: -.065em;
}

/* ——— 入场动画：逐字升起的大标题 ——— */
.char-mask { display: inline-block; overflow: hidden; vertical-align: bottom; }
.hero-char {
  display: inline-block;
  animation: char-rise .9s cubic-bezier(.19, 1, .22, 1) both;
}
.hero-title .char-mask:nth-child(2) .hero-char { animation-delay: .1s; }
@keyframes char-rise {
  from { transform: translateY(108%) rotate(6deg); }
  to   { transform: translateY(0) rotate(0); }
}
.hero-copy .section-kicker, .hero-quote, .hero-aside { animation: soft-in 1s ease both; }
.hero-copy .section-kicker { animation-delay: .05s; }
.hero-quote { animation-delay: .3s; }
.hero-aside { animation-delay: .45s; }
@keyframes soft-in {
  from { opacity: 0; transform: translateY(18px); }
  to   { opacity: 1; transform: none; }
}

/* ——— 飘落的花瓣（二次元点缀，克制版） ——— */
.petals { position: absolute; inset: 0; overflow: hidden; pointer-events: none; }
.petals span {
  position: absolute;
  top: -24px;
  left: var(--pl, 10%);
  width: 10px;
  height: 13px;
  border-radius: 60% 40% 60% 40%;
  background: color-mix(in srgb, var(--accent) 26%, transparent);
  opacity: 0;
  animation: petal-fall var(--pd, 11s) linear var(--pdl, 0s) infinite;
}
.petals span:nth-child(2n) { background: color-mix(in srgb, var(--accent-deep) 20%, transparent); }
.petals span:nth-child(3n) { width: 7px; height: 9px; }
.petals span:nth-child(1)  { --pl: 6%;  --pd: 12s;  --pdl: 0s;    --px: 60px; }
.petals span:nth-child(2)  { --pl: 18%; --pd: 10s;  --pdl: 2.4s;  --px: -46px; }
.petals span:nth-child(3)  { --pl: 30%; --pd: 13s;  --pdl: 5.2s;  --px: 72px; }
.petals span:nth-child(4)  { --pl: 43%; --pd: 9.5s; --pdl: 1.1s;  --px: -60px; }
.petals span:nth-child(5)  { --pl: 55%; --pd: 12.5s;--pdl: 3.8s;  --px: 48px; }
.petals span:nth-child(6)  { --pl: 66%; --pd: 10.5s;--pdl: 6.4s;  --px: -38px; }
.petals span:nth-child(7)  { --pl: 76%; --pd: 11.5s;--pdl: .7s;   --px: 66px; }
.petals span:nth-child(8)  { --pl: 86%; --pd: 9s;   --pdl: 4.5s;  --px: -52px; }
.petals span:nth-child(9)  { --pl: 12%; --pd: 14s;  --pdl: 7.6s;  --px: 40px; }
.petals span:nth-child(10) { --pl: 50%; --pd: 13.5s;--pdl: 8.8s;  --px: -70px; }
.petals span:nth-child(11) { --pl: 93%; --pd: 12s;  --pdl: 2s;    --px: 30px; }
.petals span:nth-child(12) { --pl: 25%; --pd: 11s;  --pdl: 9.6s;  --px: -30px; }
[data-theme="dark"] .petals span { background: color-mix(in srgb, var(--accent) 20%, transparent); }
@keyframes petal-fall {
  0%   { opacity: 0; transform: translate3d(0, -20px, 0) rotate(0deg); }
  8%   { opacity: .9; }
  85%  { opacity: .7; }
  100% { opacity: 0; transform: translate3d(var(--px, 40px), 560px, 0) rotate(340deg); }
}

/* ——— 星芒闪烁 ——— */
.sparkle {
  position: absolute;
  left: var(--sx);
  top: var(--sy);
  color: var(--accent);
  font-size: var(--ss);
  opacity: 0;
  pointer-events: none;
  animation: twinkle 3.4s ease-in-out var(--sd, 0s) infinite;
  text-shadow: 0 0 12px color-mix(in srgb, var(--accent) 55%, transparent);
}
@keyframes twinkle {
  0%, 100% { opacity: 0; transform: scale(.4) rotate(0deg); }
  50%      { opacity: .95; transform: scale(1) rotate(90deg); }
}

/* ——— 星座连线描绘动画 ——— */
.constellation path {
  stroke-dasharray: 260;
  stroke-dashoffset: 260;
  animation: draw-line 1.8s ease .5s forwards;
}
.constellation circle {
  transform-origin: center;
  transform-box: fill-box;
  scale: 0;
  animation: star-pop .55s cubic-bezier(.34, 1.56, .64, 1) forwards;
}
.constellation circle:nth-of-type(1) { animation-delay: .5s; }
.constellation circle:nth-of-type(2) { animation-delay: .95s; }
.constellation circle:nth-of-type(3) { animation-delay: 1.35s; }
@keyframes draw-line { to { stroke-dashoffset: 0; } }
@keyframes star-pop { from { scale: 0; } to { scale: 1; } }
.hero-quote { margin: 32px 0 0; color: var(--body); font: 400 clamp(19px, 2vw, 24px)/1.55 var(--display); }
.hero-aside { padding-bottom: 4px; }
.hero-aside p { max-width: 350px; margin: 24px 0 0; color: var(--body); font-size: 14px; line-height: 1.9; }
.constellation { display: block; width: min(100%, 230px); height: auto; }
.constellation path { fill: none; stroke: var(--line-strong); stroke-width: 1; }
.constellation circle { fill: var(--bg); stroke: var(--accent); stroke-width: 2; }
.constellation circle:nth-of-type(2) { fill: var(--accent); }

.friends-content { padding-top: 34px; }
.list-tools { display: flex; align-items: center; justify-content: space-between; gap: 24px; margin-bottom: 42px; }
.list-hint { color: var(--muted); font-size: 13px; }
.search-box {
  display: flex;
  align-items: center;
  gap: 9px;
  width: min(290px, 100%);
  min-height: 42px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-raised);
  color: var(--muted);
}
.search-box:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 12%, transparent); }
.search-box svg { flex: none; width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; }
.search-box input { width: 100%; min-width: 0; border: 0; outline: 0; background: transparent; color: var(--ink); font-size: 13px; }
.search-box input::placeholder { color: var(--muted); }
/* ——— VRChat 风格好友名片 ——— */
.vrc-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; }
.vrc-card {
  --vrc-panel: #201F1D;
  position: relative;
  min-width: 0;
  overflow: hidden;
  border: 1px solid color-mix(in srgb, var(--vrc-panel) 72%, #FFFFFF 14%);
  border-radius: 14px;
  background: var(--vrc-panel);
  color: #F2EEE5;
  box-shadow: 0 20px 44px -30px rgba(15, 12, 8, .7);
  transform-style: preserve-3d;
  transition: transform .35s cubic-bezier(.34, 1.4, .64, 1), border-color .25s, box-shadow .35s;
  will-change: transform;
}
[data-theme="dark"] .vrc-card { --vrc-panel: #2C2B28; }
a.vrc-card { display: block; text-decoration: none; }
a.vrc-card:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.vrc-banner { position: relative; aspect-ratio: 16 / 9; overflow: hidden; background: linear-gradient(140deg, #3B3733, #262420 58%, #332A24); }
.vrc-banner.is-blank { background: radial-gradient(120% 95% at 50% 0%, #34312C, #262420 72%); }
.vrc-banner-image { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; transition: transform .6s cubic-bezier(.19, 1, .22, 1); }
.vrc-banner-shade { position: absolute; inset: 0; background: linear-gradient(to top, var(--vrc-panel) 2%, color-mix(in srgb, var(--vrc-panel) 55%, transparent) 30%, transparent 62%); }
.vrc-body { position: relative; display: flex; align-items: flex-end; gap: 14px; margin-top: -34px; padding: 0 16px 16px; }
.vrc-avatar {
  flex: none;
  width: 66px;
  height: 66px;
  overflow: hidden;
  border: 3px solid var(--vrc-panel);
  border-radius: 50%;
  background: #3A3631;
  box-shadow: 0 0 0 2px var(--accent);
}
.vrc-avatar img { display: block; width: 100%; height: 100%; object-fit: cover; }
.vrc-id { min-width: 0; padding-bottom: 3px; }
.vrc-name { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 16px; font-weight: 600; letter-spacing: -.01em; color: #F5F1E8; }
.vrc-status { display: inline-flex; align-items: center; gap: 6px; margin-top: 3px; color: #A9A49A; font-size: 12px; }
.vrc-status i { width: 8px; height: 8px; border-radius: 50%; background: #6FBF73; box-shadow: 0 0 8px rgba(111, 191, 115, .8); }
.vrc-glare {
  position: absolute;
  inset: 0;
  z-index: 3;
  pointer-events: none;
  opacity: 0;
  background: radial-gradient(320px circle at var(--gx, 50%) var(--gy, 50%), rgba(255, 244, 230, .14), transparent 65%);
  transition: opacity .3s;
}
@media (hover: hover) and (pointer: fine) {
  .vrc-card:hover { border-color: color-mix(in srgb, var(--accent) 60%, var(--vrc-panel)); box-shadow: 0 26px 52px -28px rgba(15, 12, 8, .8); }
  .vrc-card:hover .vrc-banner-image { transform: scale(1.06); }
  .vrc-card:hover .vrc-glare { opacity: 1; }
  .vrc-card:hover .vrc-avatar { animation: avatar-wiggle .5s ease; }
  .brand:hover .brand-star { transform: rotate(45deg); }
}
@keyframes avatar-wiggle {
  0%, 100% { transform: rotate(0); }
  30% { transform: rotate(-8deg) scale(1.06); }
  65% { transform: rotate(6deg) scale(1.04); }
}
.brand-star { transition: transform .5s cubic-bezier(.34, 1.56, .64, 1); }

/* ——— 滚动入场：分组与卡片依次浮起 ——— */
.reveal { opacity: 0; transform: translateY(26px); }
.reveal.is-in {
  opacity: 1;
  transform: none;
  transition: opacity .8s ease var(--rd, 0s), transform .9s cubic-bezier(.19, 1, .22, 1) var(--rd, 0s);
}

/* ——— 邮箱卡片 ——— */
.email-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 20px;
  padding: 14px 14px 14px 20px;
  border: 1px dashed var(--line-strong);
  border-radius: 14px;
  background: var(--surface);
}
.email-address { font: 500 19px/1.2 var(--display); letter-spacing: .01em; color: var(--ink); user-select: all; }
.dialog-actions .button { transition: transform .25s cubic-bezier(.34, 1.56, .64, 1), background-color .25s, border-color .25s; }
.dialog-actions .button:hover { transform: translateY(-2px); }

/* ——— 弹窗入场 ——— */
.apply-dialog[open] { animation: dialog-pop .45s cubic-bezier(.34, 1.4, .64, 1); }
@keyframes dialog-pop {
  from { opacity: 0; transform: translateY(26px) scale(.94); }
  to   { opacity: 1; transform: none; }
}

.empty-state { padding: 64px 24px; border: 1px dashed var(--line-strong); border-radius: 16px; text-align: center; }
.empty-state h2 { margin: 0; font: 500 28px/1.3 var(--display); }
.empty-state p { margin: 12px auto 20px; color: var(--body); font-size: 14px; }
.exchange-note { display: grid; grid-template-columns: 1.1fr .9fr; gap: 72px; margin-top: 100px; padding-block: 58px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.exchange-note h2 { max-width: 480px; margin: 0; font: 500 clamp(34px, 4vw, 50px)/1.15 var(--display); letter-spacing: -.035em; }
.exchange-copy p { margin: 0 0 24px; color: var(--body); font-size: 14px; line-height: 1.9; }
.site-footer { display: flex; justify-content: space-between; gap: 20px; padding-block: 28px 40px; color: var(--muted); font-size: 12px; }
.site-footer a:hover { color: var(--accent); }

.apply-dialog {
  width: min(580px, calc(100% - 32px));
  max-height: min(760px, calc(100dvh - 40px));
  padding: 34px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--surface-raised);
  color: var(--ink);
  box-shadow: 0 28px 90px -30px rgba(20, 15, 10, .45);
}
.apply-dialog::backdrop { background: rgba(20, 18, 15, .42); backdrop-filter: blur(5px); }
.apply-dialog h2 { margin: 0 0 18px; font: 500 34px/1.2 var(--display); letter-spacing: -.025em; }
.apply-dialog > p:not(.section-kicker):not(.form-status) { color: var(--body); font-size: 14px; }
.apply-dialog p a { color: var(--accent-deep); text-decoration: underline; text-underline-offset: 3px; }
.dialog-close { position: absolute; top: 16px; right: 16px; width: 36px; height: 36px; border: 0; border-radius: 50%; background: var(--surface); color: var(--body); font-size: 24px; line-height: 1; }
.dialog-close:hover { color: var(--ink); }
.dialog-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 24px; }
.form-status { min-height: 24px; margin: 12px 0 0; color: var(--body); font-size: 13px; }
.form-status.is-error { color: #B54434; }
.toast { position: fixed; left: 50%; bottom: 24px; z-index: 80; max-width: calc(100% - 32px); padding: 10px 18px; border-radius: 999px; background: var(--ink); color: var(--bg); font-size: 13px; opacity: 0; transform: translate(-50%, 12px); pointer-events: none; transition: opacity .25s, transform .25s; }
.toast.is-visible { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 960px) {
  .vrc-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .friends-hero { gap: 40px; }
}
@media (max-width: 760px) {
  .page-width { width: min(100% - 32px, 620px); }
  .top-links { display: none; }
  .friends-hero { grid-template-columns: 1fr; gap: 36px; min-height: auto; padding-top: 154px; padding-bottom: 46px; }
  .hero-aside { display: grid; grid-template-columns: 140px 1fr; align-items: center; gap: 24px; }
  .hero-aside p { margin: 0; }
  .list-tools { align-items: stretch; flex-direction: column; gap: 14px; }
  .search-box { width: 100%; }
  .exchange-note { grid-template-columns: 1fr; gap: 28px; margin-top: 70px; }
}
@media (max-width: 620px) {
  .vrc-grid { grid-template-columns: 1fr; }
  .friends-hero h1 { font-size: 78px; }
  .nav-shell { min-height: 58px; padding-left: 17px; border-radius: 18px; }
  .brand { font-size: 23px; }
  .brand-star { width: 22px; height: 22px; }
  .nav-apply { display: none; }
  .hero-aside { grid-template-columns: 100px 1fr; gap: 18px; }
  .apply-dialog { padding: 28px 22px; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition-duration: .01ms !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
  .petals, .sparkle { display: none; }
  .reveal { opacity: 1; transform: none; }
  .hero-char, .hero-copy .section-kicker, .hero-quote, .hero-aside { animation: none; }
  .constellation path { stroke-dashoffset: 0; animation: none; }
  .constellation circle { scale: 1; animation: none; }
}
