@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;700&family=Space+Grotesk:wght@300;400;500;600&display=swap');

:root {
  --nav-height: 90px;
  --radius-pill: 999px;
  --radius-card: 48px;
  --radius-panel: 24px;
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 16px;
  --space-lg: 24px;
  --space-xl: 48px;
  --ease-out-expo: cubic-bezier(0.16, 1, 0.3, 1);
  --transition-theme: background-color 0.6s var(--ease-out-expo), color 0.6s var(--ease-out-expo);
  --transition-element: background-color 0.3s ease, transform 0.2s ease, opacity 0.3s ease;
  --ui-overlay: rgba(3, 4, 7, 0.55);
  --ui-panel-bg: rgba(18, 18, 28, 0.72);
  --ui-panel-border: rgba(255, 255, 255, 0.1);
  --ui-toast-shadow: 0 24px 80px rgba(0, 0, 0, 0.28);
}

html {
  scroll-padding-top: var(--nav-height);
}

[data-theme="dark"] {
  --bg-base: #030407;
  --bg-surface-1: rgba(255, 255, 255, 0.03);
  --bg-surface-2: rgba(255, 255, 255, 0.06);
  --bg-surface-3: rgba(255, 255, 255, 0.12);
  --bg-accent: #FFFFFF;
  --bg-accent-hover: #E0EDFF;
  --text-primary: #FFFFFF;
  --text-secondary: rgba(255, 255, 255, 0.5);
  --text-accent: #030407;
  --text-tech: rgba(255, 255, 255, 0.3);
  --glow-color: 255, 255, 255;
  --shader-core: #FFFFFF;
  --shader-fringe: #4A88FF;
}

[data-theme="light"] {
  --bg-base: #F5F7FA;
  --bg-surface-1: rgba(0, 0, 0, 0.04);
  --bg-surface-2: rgba(0, 0, 0, 0.08);
  --bg-surface-3: rgba(0, 0, 0, 0.15);
  --bg-accent: #050608;
  --bg-accent-hover: #1A1E26;
  --text-primary: #050608;
  --text-secondary: rgba(0, 0, 0, 0.5);
  --text-accent: #FFFFFF;
  --text-tech: rgba(0, 0, 0, 0.3);
  --glow-color: 0, 0, 0;
  --shader-core: #050608;
  --shader-fringe: #8BA3CC;
  --ui-overlay: rgba(245, 247, 250, 0.6);
  --ui-panel-bg: rgba(255, 255, 255, 0.72);
  --ui-panel-border: rgba(0, 0, 0, 0.08);
  --ui-toast-shadow: 0 24px 80px rgba(0, 0, 0, 0.12);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Space Grotesk', sans-serif;
  background-color: var(--bg-base);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
  transition: var(--transition-theme);
  -webkit-font-smoothing: antialiased;
}

#webgl-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: 0;
  pointer-events: none;
}

.global-loading-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: var(--ui-overlay);
  backdrop-filter: blur(18px) saturate(140%);
  -webkit-backdrop-filter: blur(18px) saturate(140%);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.24s ease, visibility 0.24s ease;
}

.global-loading-overlay.show {
  opacity: 1;
  visibility: visible;
}

.global-loading-card {
  width: min(420px, 100%);
  padding: 28px 28px 24px;
  border-radius: var(--radius-panel);
  background: linear-gradient(135deg, var(--ui-panel-bg) 0%, rgba(255, 255, 255, 0.02) 100%);
  border: 1px solid var(--ui-panel-border);
  box-shadow: var(--ui-toast-shadow);
  text-align: center;
}

.global-loading-title {
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--text-primary);
}

.global-loading-subtitle {
  margin-top: 8px;
  font-size: 13px;
  color: var(--text-secondary);
}

.global-loading-dots {
  display: inline-flex;
  gap: 8px;
  margin-top: 16px;
}

.global-loading-dots span {
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: var(--text-primary);
  opacity: 0.28;
  animation: lumenPulse 1.1s ease-in-out infinite;
}

.global-loading-dots span:nth-child(2) {
  animation-delay: 0.14s;
}

.global-loading-dots span:nth-child(3) {
  animation-delay: 0.28s;
}

.global-toast-stack {
  position: fixed;
  top: calc(var(--nav-height) + 14px);
  right: 32px;
  z-index: 1001;
  width: min(360px, calc(100vw - 32px));
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.global-toast {
  display: grid;
  grid-template-columns: 20px 1fr auto;
  align-items: start;
  gap: 12px;
  padding: 14px 16px;
  border-radius: 18px;
  background: linear-gradient(135deg, var(--ui-panel-bg) 0%, rgba(255, 255, 255, 0.02) 100%);
  border: 1px solid var(--ui-panel-border);
  box-shadow: var(--ui-toast-shadow);
  backdrop-filter: blur(24px) saturate(160%);
  -webkit-backdrop-filter: blur(24px) saturate(160%);
  animation: toastIn 0.24s var(--ease-out-expo);
}

.global-toast.is-exit {
  animation: toastOut 0.18s ease forwards;
}

.global-toast-icon {
  font-size: 18px;
  line-height: 1;
  margin-top: 2px;
}

.global-toast-message {
  font-size: 14px;
  line-height: 1.45;
  color: var(--text-primary);
}

.global-toast-close {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-size: 14px;
  cursor: pointer;
  padding: 2px;
}

.global-toast-close:hover {
  color: var(--text-primary);
}

.global-toast[data-type="success"] .global-toast-icon {
  color: #4ade80;
}

.global-toast[data-type="error"] .global-toast-icon {
  color: #f87171;
}

.global-toast[data-type="info"] .global-toast-icon {
  color: #60a5fa;
}

@keyframes lumenSpin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes lumenPulse {
  0%, 100% {
    opacity: 0.24;
    transform: translateY(0);
  }
  50% {
    opacity: 1;
    transform: translateY(-3px);
  }
}

@keyframes toastIn {
  from {
    opacity: 0;
    transform: translateY(-8px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes toastOut {
  from {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
  to {
    opacity: 0;
    transform: translateY(-8px) scale(0.98);
  }
}

/* 顶部导航容器 - 统一布局 */
.top-nav-container {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  padding: 32px 48px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  pointer-events: none;
}

.top-nav-container[data-show-bg="true"] {
  background: var(--bg-base);
}

.top-nav-container > * {
  pointer-events: auto;
}

.logo-label {
  font-size: 20px;
  font-weight: 700;
  transition: var(--transition-theme);
  display: flex;
  align-items: baseline;
  line-height: 1;
  transform: translateY(-7px);
}

.logo-lumen {
  color: var(--text-primary);
  font-weight: 700;
}

.logo-lock {
  color: var(--text-secondary);
  font-weight: 700;
}

.main-nav {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 6px;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.05) 0%, rgba(255, 255, 255, 0.02) 100%);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 24px;
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  transition: var(--transition-theme);
  position: relative;
}

[data-theme="light"] .main-nav {
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.8) 0%, rgba(255, 255, 255, 0.6) 100%);
  border: 1px solid rgba(0, 0, 0, 0.1);
}

/* 导航栏活动指示器 */
.nav-indicator {
  position: absolute;
  height: calc(100% - 12px);
  background-color: var(--bg-surface-2);
  border-radius: 16px;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  pointer-events: none;
  z-index: 0;
  top: 6px;
  left: 6px;
}

.nav-indicator.is-initializing {
  transition: none;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  color: var(--text-secondary);
  text-decoration: none;
  border-radius: 16px;
  font-size: 14px;
  font-weight: 500;
  transition: color 0.2s ease;
  border: none;
  background: transparent;
  cursor: pointer;
  white-space: nowrap;
  position: relative;
  z-index: 1;
}

.nav-link:hover {
  color: var(--text-primary);
}

.nav-link.active {
  color: var(--text-primary);
}

.nav-link i {
  font-size: 18px;
}

.nav-divider {
  width: 1px;
  height: 24px;
  background-color: rgba(255, 255, 255, 0.1);
  margin: 0 4px;
}

[data-theme="light"] .nav-divider {
  background-color: rgba(0, 0, 0, 0.1);
}

.dashboard-wrapper {
  position: relative;
}

.dashboard-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  background: rgba(20, 20, 30, 0.98);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 16px;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 180px;
  backdrop-filter: blur(40px) saturate(180%);
  -webkit-backdrop-filter: blur(40px) saturate(180%);
  z-index: 100;
  box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.6);
  
  /* 动画相关 */
  opacity: 0;
  visibility: hidden;
  transform: translateY(-10px);
  transition: opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1),
              transform 0.3s cubic-bezier(0.4, 0, 0.2, 1),
              visibility 0.3s;
}

.dashboard-dropdown.show {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

/* 下拉菜单项渐入动画 */
.dashboard-dropdown.show .dropdown-item {
  animation: slideInItem 0.3s cubic-bezier(0.4, 0, 0.2, 1) backwards;
}

.dashboard-dropdown.show .dropdown-item:nth-child(1) { animation-delay: 0.05s; }
.dashboard-dropdown.show .dropdown-item:nth-child(2) { animation-delay: 0.08s; }
.dashboard-dropdown.show .dropdown-item:nth-child(3) { animation-delay: 0.11s; }
.dashboard-dropdown.show .dropdown-item:nth-child(4) { animation-delay: 0.14s; }
.dashboard-dropdown.show .dropdown-item:nth-child(5) { animation-delay: 0.17s; }

@keyframes slideInItem {
  from {
    opacity: 0;
    transform: translateX(-10px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

[data-theme="light"] .dashboard-dropdown {
  background: rgba(255, 255, 255, 0.98);
  border: 1px solid rgba(0, 0, 0, 0.12);
  box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.2);
}

.dropdown-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: transparent;
  color: var(--text-primary);
  border: none;
  border-radius: 12px;
  cursor: pointer;
  font-size: 14px;
  text-decoration: none;
  transition: background-color 0.2s ease, transform 0.2s ease;
  width: 100%;
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 500;
}

.dropdown-item:hover {
  background-color: var(--bg-surface-2);
  transform: translateX(4px);
}

.dropdown-item i {
  font-size: 18px;
  flex-shrink: 0;
}

.dropdown-divider {
  height: 1px;
  background-color: rgba(255, 255, 255, 0.1);
  margin: 4px 0;
}

.top-bar {
  display: flex;
  gap: 16px;
  align-items: center;
}

.header-auth-actions {
  display: flex;
  gap: 12px;
  align-items: center;
}

.header-auth-link {
  height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 16px;
  border-radius: var(--radius-pill);
  background-color: var(--bg-surface-1);
  color: var(--text-primary);
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  border: 1px solid rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(10px);
  transition: var(--transition-element);
}

.header-auth-link:hover {
  background-color: var(--bg-surface-2);
}

.header-auth-link.primary {
  background-color: var(--bg-accent);
  color: var(--text-accent);
  border-color: transparent;
}

.header-auth-link.primary:hover {
  background-color: var(--bg-accent-hover);
}

.lang-toggle-wrapper {
  position: relative;
}

.lang-toggle, .theme-toggle {
  height: 40px;
  padding: 0 16px;
  background-color: var(--bg-surface-1);
  color: var(--text-primary);
  gap: 8px;
  font-size: 13px;
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.05);
  display: flex;
  align-items: center;
  border-radius: var(--radius-pill);
  cursor: pointer;
  transition: var(--transition-element);
}

.lang-toggle:hover, .theme-toggle:hover {
  background-color: var(--bg-surface-2);
}

.lang-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  left: auto;
  background: rgba(20, 20, 30, 0.98);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 12px;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 140px;
  backdrop-filter: blur(40px) saturate(180%);
  -webkit-backdrop-filter: blur(40px) saturate(180%);
  z-index: 100;
  box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.6);
  
  /* 动画相关 */
  opacity: 0;
  visibility: hidden;
  transform: translateY(-10px);
  transition: opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1),
              transform 0.3s cubic-bezier(0.4, 0, 0.2, 1),
              visibility 0.3s;
}

.lang-menu.show {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

/* 语言菜单项渐入动画 */
.lang-menu.show button {
  animation: slideInItem 0.3s cubic-bezier(0.4, 0, 0.2, 1) backwards;
}

.lang-menu.show button:nth-child(1) { animation-delay: 0.05s; }
.lang-menu.show button:nth-child(2) { animation-delay: 0.08s; }
.lang-menu.show button:nth-child(3) { animation-delay: 0.11s; }
.lang-menu.show button:nth-child(4) { animation-delay: 0.14s; }

[data-theme="light"] .lang-menu {
  background: rgba(255, 255, 255, 0.98);
  border: 1px solid rgba(0, 0, 0, 0.12);
  box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.2);
}

.lang-menu button {
  padding: 8px 12px;
  text-align: left;
  background: transparent;
  color: var(--text-primary);
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
  transition: background-color 0.2s ease, transform 0.2s ease;
  font-family: 'Space Grotesk', sans-serif;
}

.lang-menu button:hover {
  background-color: var(--bg-surface-2);
  transform: translateX(4px);
}

.copyright-label {
  position: relative;
  width: min(100%, 720px);
  margin: 88px auto 0;
  padding-top: 8px;
  font-size: 12px;
  color: var(--text-secondary);
  text-align: center;
  line-height: 1.7;
  z-index: 1;
  transition: var(--transition-theme);
}

/* 当 loading overlay 显示时隐藏 copyright */
body:has(.global-loading-overlay.show) .copyright-label {
  opacity: 0;
  visibility: hidden;
}

.content-container {
  position: relative;
  z-index: 10;
  max-width: 1200px;
  margin: 0 auto;
  padding: calc(var(--nav-height) + 50px) 48px 80px;
  min-height: 100vh;
}

.page-header {
  text-align: center;
  margin-bottom: 60px;
}

.page-title {
  font-size: 48px;
  font-weight: 500;
  letter-spacing: -0.02em;
  margin-bottom: 16px;
}

.page-subtitle {
  font-size: 18px;
  color: var(--text-secondary);
}

/* 响应式布局 */
@media (max-width: 768px) {
  :root {
    --nav-height: 72px;
  }

  .global-toast-stack {
    top: calc(var(--nav-height) + 16px);
    right: 16px;
    left: 16px;
    width: auto;
  }

  .copyright-label {
    width: 100%;
    margin-top: 56px;
    font-size: 11px;
  }

  .global-loading-card {
    padding: 24px 20px 20px;
  }

  /* 单行导航 */
  .top-nav-container {
    padding: 14px 16px;
    flex-wrap: nowrap;
    gap: 8px;
    align-items: center;
  }

  .logo-label {
    font-size: 18px;
    order: 1;
    flex-shrink: 0;
    transform: translateY(0);
    align-items: center;
  }

  .main-nav {
    order: 2;
    flex: 1;
    justify-content: center;
    gap: 0;
    padding: 3px;
    min-width: 0;
  }

  .top-bar {
    order: 3;
    flex-shrink: 0;
    gap: 4px;
  }

  .nav-link span {
    display: none;
  }

  .nav-link {
    padding: 7px 9px;
    font-size: 13px;
  }

  .nav-divider {
    display: none;
  }

  /* 控制按钮仅显示图标 */
  #langText,
  #themeText,
  .lang-toggle .ph-caret-down {
    display: none;
  }

  .lang-toggle,
  .theme-toggle {
    height: 34px;
    width: 34px;
    padding: 0;
    justify-content: center;
    font-size: 16px;
  }

  .header-auth-actions {
    gap: 6px;
  }

  .header-auth-link {
    height: 34px;
    padding: 0 10px;
    font-size: 12px;
  }

  .content-container {
    padding: calc(var(--nav-height) + 44px) 24px 60px;
  }

  .page-title {
    font-size: 36px;
  }
}
