:root {
  color-scheme: dark;
  --bg: #030713;
  --panel: rgba(9, 18, 39, 0.78);
  --panel-strong: rgba(13, 24, 52, 0.97);
  --line: rgba(154, 194, 255, 0.18);
  --gold: #f0bf6a;
  --gold-bright: #ffe4a8;
  --jade: #67e8f9;
  --violet: #8b5cf6;
  --text: #f8fbff;
  --muted: #aebbd5;
  --shadow: 0 30px 100px rgba(0, 0, 0, 0.48);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Microsoft YaHei", "PingFang SC", system-ui, sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at 20% 12%, rgba(103, 232, 249, 0.18), transparent 28rem),
    radial-gradient(circle at 82% 10%, rgba(139, 92, 246, 0.22), transparent 30rem),
    radial-gradient(circle at 50% 95%, rgba(240, 191, 106, 0.12), transparent 26rem),
    linear-gradient(135deg, #020411, var(--bg) 45%, #071226);
  overflow-x: hidden;
  animation: pageFade 700ms ease-out both;
}

body::before,
body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: -1;
}

body::before {
  opacity: 0.62;
  background-image:
    radial-gradient(circle, rgba(255, 255, 255, 0.9) 0 1px, transparent 1.6px),
    radial-gradient(circle, rgba(103, 232, 249, 0.75) 0 1px, transparent 1.8px),
    radial-gradient(circle, rgba(240, 191, 106, 0.85) 0 1px, transparent 1.8px);
  background-size: 120px 120px, 180px 180px, 260px 260px;
  background-position: 12px 18px, 74px 92px, 130px 42px;
  animation: starDrift 28s linear infinite;
}

body::after {
  background:
    linear-gradient(115deg, transparent 0 42%, rgba(103, 232, 249, 0.09) 47%, transparent 52%),
    linear-gradient(65deg, transparent 0 54%, rgba(240, 191, 106, 0.08) 58%, transparent 62%);
  filter: blur(1px);
  animation: auroraSweep 12s ease-in-out infinite alternate;
}

button, .file-btn {
  border: 0;
  border-radius: 999px;
  padding: 0.85rem 1.25rem;
  color: #07130f;
  background: linear-gradient(135deg, var(--gold-bright), var(--gold));
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 14px 34px rgba(240, 191, 106, 0.26);
  transition: transform 180ms ease, box-shadow 180ms ease, border-color 180ms ease;
}

button:hover, .file-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 18px 44px rgba(240, 191, 106, 0.34);
}

.secondary, .ghost {
  border: 1px solid var(--line);
  color: var(--text);
  background: rgba(255, 255, 255, 0.06);
  box-shadow: none;
}

.ghost.small { padding: 0.45rem 0.75rem; font-size: 0.85rem; }
.full { width: 100%; margin-top: 1rem; }
.file-btn input { display: none; }

.shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 32px 0;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 24px;
  align-items: stretch;
  margin-bottom: 24px;
}

.hero, .panel, .stats-grid article {
  border: 1px solid var(--line);
  border-radius: 32px;
  background:
    linear-gradient(145deg, rgba(255,255,255,0.11), rgba(255,255,255,0.025)),
    radial-gradient(circle at top left, rgba(103, 232, 249, 0.08), transparent 55%);
  backdrop-filter: blur(18px);
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
}

.hero::before, .panel::before, .stats-grid article::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1px;
  background: linear-gradient(135deg, rgba(103, 232, 249, 0.36), transparent 35%, rgba(240, 191, 106, 0.28));
  mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  mask-composite: exclude;
  pointer-events: none;
}

.hero { padding: clamp(26px, 5vw, 56px); animation: riseIn 720ms ease-out both; }
.hero h1 { margin: 0; font-size: clamp(2.4rem, 8vw, 6rem); letter-spacing: 0.08em; }
.branch-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 12px 0 0;
  padding: 0.45rem 0.85rem;
  border: 1px solid rgba(240, 191, 106, 0.28);
  border-radius: 999px;
  color: var(--gold-bright);
  background: rgba(240, 191, 106, 0.08);
  box-shadow: 0 0 26px rgba(240, 191, 106, 0.12);
}
.hero-copy { max-width: 720px; color: var(--muted); font-size: 1.12rem; line-height: 1.8; }
.eyebrow { margin: 0 0 0.5rem; color: var(--gold); letter-spacing: 0.18em; font-size: 0.78rem; font-weight: 900; }
.actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 28px; }

.hero-card {
  padding: 24px;
  border-radius: 28px;
  background:
    radial-gradient(circle at top, rgba(103, 232, 249, 0.2), transparent 52%),
    linear-gradient(160deg, rgba(240, 191, 106, 0.18), rgba(139, 92, 246, 0.11));
  border: 1px solid var(--line);
  animation: floatCard 5.5s ease-in-out infinite;
}
.hero-card span { color: var(--muted); }
.hero-card strong { display: block; margin: 18px 0; font-size: 1.8rem; color: var(--gold-bright); }
.hero-card p { color: var(--muted); line-height: 1.7; }

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 16px;
}
.stats-grid article { padding: 22px; animation: riseIn 720ms ease-out both; }
.stats-grid article:nth-child(1) { animation-delay: 80ms; }
.stats-grid article:nth-child(2) { animation-delay: 150ms; }
.stats-grid article:nth-child(3) { animation-delay: 220ms; }
.stats-grid article:nth-child(4) { animation-delay: 290ms; }
.stats-grid span { color: var(--muted); }
.stats-grid strong { display: block; margin-top: 8px; font-size: 2.1rem; }

.layout {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(280px, 0.65fr);
  gap: 16px;
  margin-bottom: 16px;
}
.panel { padding: 22px; background-color: var(--panel); animation: riseIn 760ms ease-out both; }
.panel-head { display: flex; align-items: start; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.panel h2 { margin: 0; font-size: 1.45rem; }
.panel-head span { color: var(--muted); }

.star-map {
  min-height: 360px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 18px;
  padding: 22px;
  border-radius: 28px;
  background:
    radial-gradient(circle at 50% 50%, rgba(103, 232, 249, 0.16), transparent 22rem),
    radial-gradient(circle, rgba(248, 251, 255, 0.85) 0 1px, transparent 1.6px),
    linear-gradient(rgba(154, 194, 255, 0.07) 1px, transparent 1px),
    linear-gradient(90deg, rgba(154, 194, 255, 0.07) 1px, transparent 1px);
  background-size: auto, 88px 88px, 42px 42px, 42px 42px;
  animation: constellationPan 18s linear infinite;
}
.star-node {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 190px;
  color: var(--text);
  background: rgba(7, 16, 37, 0.88);
  border: 1px solid var(--line);
  box-shadow: 0 18px 44px rgba(0,0,0,0.34), 0 0 28px rgba(103, 232, 249, 0.12);
  transition: transform 200ms ease, box-shadow 200ms ease, border-color 200ms ease;
  animation: nodePulse 3.8s ease-in-out infinite;
}
.star-node:hover { transform: translateY(-5px) scale(1.015); border-color: rgba(103, 232, 249, 0.5); }
.star-node.active { outline: 2px solid var(--gold); transform: translateY(-6px); box-shadow: 0 24px 54px rgba(0,0,0,0.42), 0 0 38px rgba(240, 191, 106, 0.3); }
.star-node small { display: block; color: var(--muted); margin-top: 4px; }

.avatar {
  display: inline-grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  overflow: hidden;
  background: radial-gradient(circle at 30% 25%, #ffffff, var(--jade) 32%, var(--violet) 72%, var(--gold));
  color: #030713;
  font-weight: 900;
  flex: 0 0 auto;
  box-shadow: 0 0 22px rgba(103, 232, 249, 0.35);
}
.avatar.large { width: 62px; height: 62px; font-size: 1.1rem; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }

.branch-list { display: grid; gap: 10px; }
.branch-row {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 14px;
  border-radius: 18px;
  background: rgba(255,255,255,0.055);
  transition: transform 180ms ease, background 180ms ease;
}
.branch-row:hover { transform: translateX(4px); background: rgba(103, 232, 249, 0.1); }
.branch-row strong { color: var(--gold-bright); }

.heatmap {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 12px;
}
.heat-cell {
  min-height: 96px;
  border-radius: 22px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  background: rgba(103, 232, 249, calc(var(--heat) * 0.3));
  border: 1px solid rgba(103, 232, 249, 0.28);
  animation: heatGlow 3.5s ease-in-out infinite alternate;
}
.heat-cell strong { font-size: 1.8rem; color: var(--gold-bright); }
.invite-panel p { color: var(--muted); line-height: 1.7; }

.member-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 14px;
}
.member-card {
  border: 1px solid var(--line);
  border-radius: 24px;
  padding: 18px;
  background: rgba(255,255,255,0.05);
  transition: transform 190ms ease, border-color 190ms ease, background 190ms ease;
  animation: riseIn 680ms ease-out both;
}
.member-card:hover { transform: translateY(-6px); border-color: rgba(240, 191, 106, 0.36); background: rgba(103, 232, 249, 0.07); }
.member-top { display: flex; justify-content: space-between; gap: 12px; }
.member-card h3 { margin: 14px 0 6px; font-size: 1.35rem; }
.member-card p { margin: 0 0 14px; color: var(--muted); }
dl { display: grid; gap: 8px; margin: 0; }
dl div { display: grid; grid-template-columns: 64px 1fr; gap: 8px; }
dt { color: var(--muted); }
dd { margin: 0; }

dialog {
  width: min(640px, calc(100% - 24px));
  border: 1px solid var(--line);
  border-radius: 28px;
  padding: 0;
  color: var(--text);
  background: var(--panel-strong);
  box-shadow: var(--shadow);
}
dialog[open] { animation: modalIn 180ms ease-out both; }
dialog::backdrop { background: rgba(0,0,0,0.68); }
.member-form { display: grid; gap: 14px; padding: 24px; }
.modal-head { display: flex; justify-content: space-between; align-items: center; gap: 16px; }
.modal-head h2 { margin: 0; }
label { display: grid; gap: 7px; color: var(--muted); }
input, select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 0.85rem 1rem;
  color: var(--text);
  background: rgba(0,0,0,0.22);
}

@keyframes pageFade {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes riseIn {
  from { opacity: 0; transform: translateY(22px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes starDrift {
  from { background-position: 12px 18px, 74px 92px, 130px 42px; }
  to { background-position: 132px 138px, 254px 272px, 390px 302px; }
}

@keyframes auroraSweep {
  from { opacity: 0.22; transform: translateX(-3%) scale(1.02); }
  to { opacity: 0.72; transform: translateX(3%) scale(1.06); }
}

@keyframes floatCard {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}

@keyframes constellationPan {
  from { background-position: center, 0 0, 0 0, 0 0; }
  to { background-position: center, 88px 88px, 42px 42px, 42px 42px; }
}

@keyframes nodePulse {
  0%, 100% { box-shadow: 0 18px 44px rgba(0,0,0,0.34), 0 0 22px rgba(103, 232, 249, 0.1); }
  50% { box-shadow: 0 18px 44px rgba(0,0,0,0.34), 0 0 34px rgba(103, 232, 249, 0.22); }
}

@keyframes heatGlow {
  from { filter: brightness(0.95); }
  to { filter: brightness(1.18); }
}

@keyframes modalIn {
  from { opacity: 0; transform: translateY(14px) scale(0.96); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 1ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition: none !important;
  }
}

@media (max-width: 860px) {
  .hero, .layout { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .shell { width: min(100% - 20px, 1180px); padding: 16px 0; }
  .hero, .panel, .stats-grid article { border-radius: 24px; }
}

@media (max-width: 520px) {
  .stats-grid { grid-template-columns: 1fr; }
  .actions > * { width: 100%; text-align: center; }
  .star-map { justify-content: stretch; padding: 12px; }
  .star-node { width: 100%; }
}
