/* ============================================
   太阳系探索 · 全局样式 (shared/style.css)
   所有页面共享：暗色主题、卡片、按钮、响应式
   ============================================ */

/* --- CSS 自定义属性 (主题色) --- */
:root {
  --color-primary: #6c5ce7;
  --color-primary-light: #a29bfe;
  --color-accent: #00cec9;
  --color-accent-glow: rgba(0, 206, 201, 0.4);
  --color-bg: #0a0a1a;
  --color-bg-alt: #12122a;
  --color-card: rgba(20, 20, 50, 0.85);
  --color-card-hover: rgba(30, 30, 65, 0.9);
  --color-text: #e0e0f0;
  --color-text-muted: #a0a0c0;
  --color-danger: #e17055;
  --color-success: #55efc4;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow-card: 0 4px 24px rgba(0, 0, 0, 0.4);
  --shadow-glow: 0 0 20px rgba(108, 92, 231, 0.3);
  --transition: 0.25s ease;
}

/* --- 全局重置 --- */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei",
    "Helvetica Neue", sans-serif;
  background: linear-gradient(135deg, #0a0a1a 0%, #0d0d2b 30%, #0f0f30 60%, #0a0a1a 100%);
  color: var(--color-text);
  min-height: 100vh;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* --- 导航栏 --- */
.navbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 28px;
  background: rgba(15, 15, 40, 0.75);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  position: sticky;
  top: 0;
  z-index: 100;
}

.navbar .logo {
  font-size: 1.3rem;
  font-weight: 700;
  background: linear-gradient(135deg, var(--color-primary-light), var(--color-accent));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  text-decoration: none;
}

.navbar .nav-links {
  display: flex;
  gap: 20px;
  list-style: none;
  flex-wrap: wrap;
}

.navbar .nav-links a {
  color: var(--color-text-muted);
  text-decoration: none;
  font-size: 0.95rem;
  font-weight: 500;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  transition: color var(--transition), background var(--transition);
}

.navbar .nav-links a:hover,
.navbar .nav-links a.active {
  color: var(--color-accent);
  background: rgba(0, 206, 201, 0.08);
}

/* --- 主容器 --- */
.main-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 32px 24px;
}

/* --- 标题 --- */
.page-title {
  font-size: 2.2rem;
  font-weight: 800;
  text-align: center;
  margin-bottom: 8px;
  background: linear-gradient(135deg, var(--color-primary-light) 0%, var(--color-accent) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.page-subtitle {
  text-align: center;
  color: var(--color-text-muted);
  font-size: 1.05rem;
  margin-bottom: 36px;
}

/* --- 卡片 --- */
.card {
  background: var(--color-card);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow-card);
  transition: transform var(--transition), box-shadow var(--transition), background var(--transition);
}

.card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-card), var(--shadow-glow);
  background: var(--color-card-hover);
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 24px;
}

.card h3 {
  font-size: 1.25rem;
  margin-bottom: 10px;
  color: var(--color-accent);
}

.card p {
  color: var(--color-text-muted);
  font-size: 0.95rem;
}

/* --- 按钮 --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 22px;
  font-size: 0.95rem;
  font-weight: 600;
  font-family: inherit;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: transform var(--transition), box-shadow var(--transition), background var(--transition);
  text-decoration: none;
  color: #fff;
  background: var(--color-primary);
}

.btn:hover {
  transform: scale(1.04);
  box-shadow: var(--shadow-glow);
}

.btn:active {
  transform: scale(0.97);
}

.btn-accent {
  background: var(--color-accent);
  color: #0a0a1a;
}

.btn-outline {
  background: transparent;
  border: 2px solid var(--color-primary);
  color: var(--color-primary-light);
}

.btn-outline:hover {
  background: rgba(108, 92, 231, 0.12);
}

.btn-sm {
  padding: 6px 14px;
  font-size: 0.85rem;
}

/* --- 表单控件 --- */
input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 6px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.12);
  outline: none;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--color-accent);
  cursor: pointer;
  box-shadow: 0 0 10px var(--color-accent-glow);
}

label {
  font-size: 0.9rem;
  color: var(--color-text-muted);
  display: block;
  margin-bottom: 4px;
}

/* --- Canvas 容器 --- */
.canvas-wrapper {
  position: relative;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(0, 0, 0, 0.3);
}

.canvas-wrapper canvas {
  display: block;
  width: 100%;
  height: auto;
}

/* --- 控制面板 --- */
.control-panel {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  align-items: center;
  padding: 16px 20px;
  background: var(--color-card);
  border-radius: var(--radius);
  border: 1px solid rgba(255, 255, 255, 0.06);
  margin-top: 16px;
}

.control-panel .slider-group {
  flex: 1;
  min-width: 150px;
}

/* --- 页脚 --- */
.footer {
  text-align: center;
  padding: 24px;
  color: var(--color-text-muted);
  font-size: 0.85rem;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  margin-top: 48px;
}

/* --- 工具类 --- */
.text-center { text-align: center; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-16 { margin-bottom: 16px; }

/* ====== 登录弹窗样式 ====== */
.login-overlay {
  position: fixed;
  inset: 0;
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.login-stars {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.login-card {
  position: relative;
  z-index: 1;
  background: rgba(20, 20, 55, 0.95);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 20px;
  padding: 40px 32px;
  width: 90%;
  max-width: 400px;
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.6), 0 0 60px rgba(108, 92, 231, 0.15);
  animation: loginSlideIn 0.5s ease;
}

@keyframes loginSlideIn {
  from { opacity: 0; transform: translateY(30px) scale(0.95); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.login-header {
  text-align: center;
  margin-bottom: 28px;
}

.login-logo {
  font-size: 3rem;
  display: block;
  margin-bottom: 8px;
}

.login-header h2 {
  font-size: 1.5rem;
  font-weight: 800;
  background: linear-gradient(135deg, #a29bfe, #00cec9);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 6px;
}

.login-header p {
  color: #8888aa;
  font-size: 0.9rem;
}

.login-form .input-group {
  margin-bottom: 18px;
}

.login-form label {
  display: block;
  font-size: 0.9rem;
  color: #c0c0e0;
  margin-bottom: 6px;
  font-weight: 500;
}

.login-form input[type="text"] {
  width: 100%;
  padding: 12px 16px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(15, 15, 40, 0.8);
  color: #e0e0f0;
  font-size: 1rem;
  font-family: inherit;
  outline: none;
  transition: border-color 0.2s;
}

.login-form input[type="text"]:focus {
  border-color: #6c5ce7;
}

.login-form .code-row {
  display: flex;
  gap: 10px;
}

.login-form .code-row input {
  flex: 1;
}

.btn-code {
  padding: 12px 16px;
  border-radius: 12px;
  border: 1px solid rgba(108, 92, 231, 0.4);
  background: rgba(108, 92, 231, 0.15);
  color: #a29bfe;
  font-size: 0.85rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.2s, border-color 0.2s;
}

.btn-code:hover {
  background: rgba(108, 92, 231, 0.25);
  border-color: #a29bfe;
}

.btn-code:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.input-error {
  display: block;
  color: #e17055;
  font-size: 0.8rem;
  margin-top: 4px;
  min-height: 18px;
}

.btn-login {
  width: 100%;
  padding: 14px;
  border-radius: 14px;
  border: none;
  background: linear-gradient(135deg, #6c5ce7, #a29bfe);
  color: #fff;
  font-size: 1.05rem;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  margin-top: 8px;
  transition: transform 0.2s, box-shadow 0.2s;
}

.btn-login:hover {
  transform: scale(1.02);
  box-shadow: 0 0 20px rgba(108, 92, 231, 0.4);
}

.btn-login:active {
  transform: scale(0.98);
}

.login-hint {
  text-align: center;
  color: #6666aa;
  font-size: 0.8rem;
  margin-top: 14px;
}

/* ====== 名片页面样式 ====== */
.card-page {
  max-width: 800px;
  margin: 0 auto;
}

.profile-card {
  border-radius: 20px;
  padding: 32px;
  margin-bottom: 24px;
  position: relative;
  overflow: hidden;
  min-height: 320px;
  transition: background 0.5s ease;
}

.profile-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: inherit;
  z-index: 0;
}

.profile-card .profile-inner {
  position: relative;
  z-index: 1;
}

.profile-header {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 20px;
}

.profile-avatar {
  font-size: 3.5rem;
  cursor: pointer;
  transition: transform 0.2s;
  line-height: 1;
}

.profile-avatar:hover {
  transform: scale(1.15);
}

.profile-nickname {
  font-size: 1.6rem;
  font-weight: 800;
  margin-bottom: 2px;
}

.profile-nickname .edit-icon {
  font-size: 0.9rem;
  margin-left: 6px;
  cursor: pointer;
  opacity: 0.5;
  transition: opacity 0.2s;
}

.profile-nickname .edit-icon:hover {
  opacity: 1;
}

.profile-phone {
  font-size: 0.9rem;
  color: #8888aa;
}

.profile-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-top: 20px;
}

.stat-item {
  text-align: center;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 12px;
  padding: 14px 10px;
}

.stat-item .stat-num {
  font-size: 1.5rem;
  font-weight: 800;
}

.stat-item .stat-label {
  font-size: 0.75rem;
  color: #8888aa;
  margin-top: 4px;
}

/* 装扮面板 */
.customize-panel {
  background: rgba(20, 20, 50, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 16px;
  padding: 24px;
  margin-bottom: 24px;
}

.customize-panel h3 {
  font-size: 1.1rem;
  color: #00cec9;
  margin-bottom: 16px;
}

.theme-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-bottom: 20px;
}

.theme-option {
  padding: 12px 8px;
  border-radius: 12px;
  border: 2px solid rgba(255, 255, 255, 0.1);
  text-align: center;
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 600;
  transition: border-color 0.2s, transform 0.2s;
}

.theme-option:hover {
  transform: translateY(-2px);
}

.theme-option.selected {
  border-color: #00cec9;
  box-shadow: 0 0 12px rgba(0, 206, 201, 0.25);
}

.avatar-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 20px;
}

.avatar-option {
  font-size: 2rem;
  padding: 8px;
  border-radius: 12px;
  border: 2px solid rgba(255, 255, 255, 0.1);
  cursor: pointer;
  transition: border-color 0.2s, transform 0.2s;
  line-height: 1;
}

.avatar-option:hover {
  transform: scale(1.1);
}

.avatar-option.selected {
  border-color: #a29bfe;
  box-shadow: 0 0 12px rgba(162, 155, 254, 0.3);
}

.color-picker-row {
  display: flex;
  gap: 10px;
  align-items: center;
}

.color-dot {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  cursor: pointer;
  border: 2px solid transparent;
  transition: border-color 0.2s, transform 0.2s;
}

.color-dot:hover {
  transform: scale(1.15);
}

.color-dot.selected {
  border-color: #fff;
  box-shadow: 0 0 10px currentColor;
}

/* 证书样式 */
.cert-preview {
  background: linear-gradient(135deg, #1a1a3e 0%, #0f0f30 100%);
  border: 3px solid;
  border-radius: 20px;
  padding: 40px 28px;
  text-align: center;
  max-width: 500px;
  margin: 0 auto 24px;
  position: relative;
  overflow: hidden;
}

.cert-preview::before {
  content: '';
  position: absolute;
  inset: 8px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 14px;
  pointer-events: none;
}

.cert-preview .cert-seal {
  font-size: 4rem;
  display: block;
  margin-bottom: 10px;
}

.cert-preview .cert-name {
  font-size: 1.8rem;
  font-weight: 900;
  margin-bottom: 4px;
}

.cert-preview .cert-title-badge {
  display: inline-block;
  padding: 6px 20px;
  border-radius: 20px;
  font-size: 1rem;
  font-weight: 700;
  margin: 10px 0;
}

.cert-preview .cert-details {
  margin-top: 16px;
  font-size: 0.9rem;
  color: #a0a0c0;
  line-height: 1.8;
}

.cert-preview .cert-footer {
  margin-top: 20px;
  font-size: 0.8rem;
  color: #6666aa;
}

/* 响应式 */
@media (max-width: 768px) {
  .login-card {
    padding: 28px 20px;
  }
  .profile-stats {
    grid-template-columns: repeat(2, 1fr);
  }
  .theme-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* --- 响应式 --- */
@media (max-width: 768px) {
  .navbar {
    flex-direction: column;
    gap: 10px;
    padding: 12px 16px;
  }

  .navbar .nav-links {
    gap: 8px;
    justify-content: center;
  }

  .page-title {
    font-size: 1.6rem;
  }

  .card-grid {
    grid-template-columns: 1fr;
  }

  .main-container {
    padding: 20px 12px;
  }

  .control-panel {
    flex-direction: column;
    align-items: stretch;
  }
}
