/* ============================================================
   Inner Lab · 照见 — 全站统一设计系统 v5.0
   设计语言：暗黑 × 极简 × Apple 18px radius × 8px 间距基座
   参考：Antigravity (深色主题), Apple Design (getdesign.md)
   ============================================================ */

/* ===== Light Theme (default) ===== */
:root {
  /* 背景色 */
  --bg: #f8fafc;
  --bg-soft: #ffffff;
  --bg-card: #ffffff;
  --bg-card-hover: #f0f1f5;

  /* 主题色 — 紫蓝渐变链 */
  --accent: #6366f1;
  --accent-hover: #4f46e5;
  --accent-2: #a855f7;
  --accent-glow: rgba(99,102,241,0.15);
  --accent-subtle: rgba(99,102,241,0.06);

  /* 文字色 — 三阶灰度 */
  --text-primary: #1e293b;
  --text: #1e293b;
  --text-secondary: #64748b;
  --text-muted: #94a3b8;
  --muted: #94a3b8;

  /* 边框 — hairline 体系（无阴影替代方案） */
  --border: #e2e8f0;
  --border-light: #f1f5f9;
  --border-subtle: rgba(0,0,0,0.04);
  --glass: rgba(255,255,255,0.8);
  --divider: #e2e8f0;

  /* 状态色 */
  --success: #10b981;
  --success-bg: rgba(16,185,129,0.08);
  --warning: #f59e0b;
  --error: #ef4444;

  /* Apple 风格：无阴影，靠 hairline + 材质层次
     保留阴影变量仅用于弹窗等需叠加场景 */
  --shadow: 0 4px 20px rgba(0,0,0,0.06);
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.07), 0 1px 3px rgba(0,0,0,0.05);
  --shadow-lg: 0 10px 40px rgba(0,0,0,0.08), 0 2px 6px rgba(0,0,0,0.04);
  --shadow-glow: 0 0 30px rgba(99,102,241,0.12);

  /* ===== Apple 18px 圆角体系 ===== */
  --radius-sm: 10px;
  --radius-md: 14px;
  --radius-lg: 18px;
  --radius-pill: 999px;

  /* 向后兼容旧 radius 变量 */
  --radius: 16px;
  --radius-xs: 8px;

  /* ===== 8px 间距基座 ===== */
  --space-1: 8px;
  --space-2: 16px;
  --space-3: 24px;
  --space-4: 32px;
  --space-5: 48px;
  --space-6: 64px;

  /* ===== 字阶体系 ===== */
  --text-xs: 11px;
  --text-sm: 13px;
  --text-base: 15px;
  --text-lg: 18px;
  --text-xl: 22px;
  --text-2xl: 28px;
  --text-3xl: 36px;
  --text-hero: 48px;

  /* 向后兼容旧字号变量 */
  --text-2xs: 10px;

  /* 字体 */
  --font: 'Inter', 'SF Pro Display', 'PingFang SC', 'Noto Sans SC', system-ui, -apple-system, sans-serif;

  /* 布局 */
  --max-width: 900px;
  --nav-h: 64px;
  --footer-h: 48px;
  --transition: 0.25s cubic-bezier(0.4,0,0.2,1);

  /* 向后兼容别名 */
  --bg-primary: var(--bg);
  --bg-secondary: var(--bg-soft);
  --nav-height: var(--nav-h);
  --font-sans: var(--font);
}

/* ===== Dark Theme ===== */
[data-theme="dark"] {
  --bg: #0a0a0f;
  --bg-soft: #151525;
  --bg-card: #1a1a2e;
  --bg-card-hover: #1f1f35;

  --accent: #7c5cfc;
  --accent-hover: #6a46e0;
  --accent-2: #a78bfa;
  --accent-glow: rgba(124,92,252,0.25);
  --accent-subtle: rgba(124,92,252,0.08);

  --text-primary: #e8e8f0;
  --text: #e8e8f0;
  --text-secondary: #9a9ab0;
  --text-muted: #6a6a80;
  --muted: #6a6a80;

  --border: #2a2a3e;
  --border-light: #353550;
  --border-subtle: rgba(255,255,255,0.04);
  --glass: rgba(10,10,15,0.85);
  --divider: #2a2a3e;

  --success: #34d399;
  --success-bg: rgba(52,211,153,0.08);
  --warning: #f59e0b;
  --error: #ef4444;

  --shadow: 0 4px 24px rgba(0,0,0,0.3);
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.3);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.4);
  --shadow-lg: 0 10px 40px rgba(0,0,0,0.5);
  --shadow-glow: 0 0 30px rgba(124,92,252,0.12);

  /* 向后兼容别名 */
  --bg-primary: var(--bg);
  --bg-secondary: var(--bg-soft);
  --text-primary: var(--text);
  --text-muted: var(--muted);
}

/* ===== Reset & Base ===== */
*, *::before, *::after { box-sizing: border-box; }
html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}
body {
  margin: 0; padding: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  transition: background var(--transition), color var(--transition);
}
a { color: var(--accent); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--accent-hover); }
img { max-width: 100%; height: auto; }
::selection { background: var(--accent); color: #fff; }

/* ===== 背景效果 ===== */
/* 🆕 v5.0: particle-bg.js Canvas 粒子为全站标准背景
   旧版 .bg-orbs 浮球保留，新页面使用 particle-bg.js */
canvas#particleCanvas {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  z-index: 0;
  pointer-events: none;
}
/* 旧版浮球（向后兼容） */
.bg-orbs {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}
.bg-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.12;
  animation: orbFloat 20s ease-in-out infinite alternate;
}
.bg-orb:nth-child(1) { width: 500px; height: 500px; background: var(--accent); top: -10%; left: -10%; animation-delay: 0s; }
.bg-orb:nth-child(2) { width: 400px; height: 400px; background: #ec4899; bottom: -10%; right: -10%; animation-delay: -8s; }
.bg-orb:nth-child(3) { width: 300px; height: 300px; background: var(--accent-2); top: 40%; left: 50%; animation-delay: -14s; }
[data-theme="light"] .bg-orb { opacity: 0.06; filter: blur(100px); }
@keyframes orbFloat {
  0%   { transform: translate(0, 0) scale(1); }
  33%  { transform: translate(30px, -40px) scale(1.05); }
  66%  { transform: translate(-20px, 20px) scale(0.95); }
  100% { transform: translate(10px, -10px) scale(1.02); }
}

/* ===== Page Wrapper ===== */
.page-content {
  padding-top: calc(var(--nav-h) + 24px);
  padding-bottom: 80px;
  max-width: var(--max-width);
  margin: 0 auto;
  padding-left: var(--space-3, 24px);
  padding-right: var(--space-3, 24px);
  position: relative;
  z-index: 1;
  width: 100%;
  flex: 1;
}

/* ===== Navbar (glass-morphism) ===== */
.navbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--nav-h, 64px);
  background: var(--glass);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 0 20px;
}
.navbar-inner {
  width: 100%;
  max-width: 900px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.nav-logo {
  font-weight: 700;
  font-size: 1.15rem;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-primary, var(--text));
  text-decoration: none;
}
.nav-logo span {
  background: linear-gradient(135deg, var(--accent), #a78bfa);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.beta-badge {
  display: inline-block;
  font-size: 8px;
  font-weight: 600;
  padding: 1px 4px;
  border-radius: 3px;
  background: linear-gradient(135deg, var(--accent), #a855f7);
  color: #fff !important;
  vertical-align: middle;
  line-height: 1.4;
  margin-left: 4px;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  -webkit-text-fill-color: #fff !important;
}
[data-theme="light"] .beta-badge {
  background: linear-gradient(135deg, #5b21b6, #7c3aed);
}
.nav-logo .beta-badge {
  -webkit-text-fill-color: #fff !important;
  background: linear-gradient(135deg, var(--accent), #a855f7);
}
[data-theme="dark"] .nav-logo .beta-badge {
  background: linear-gradient(135deg, #818cf8, #c084fc);
}
[data-theme="light"] .nav-logo .beta-badge {
  background: linear-gradient(135deg, #5b21b6, #7c3aed);
}

/* Nav links */
.nav-links {
  display: flex;
  align-items: center;
  gap: 6px;
}
.nav-links a, .nav-link {
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 0.85rem;
  font-weight: 500;
  text-decoration: none;
  transition: all .2s;
}
.nav-links a:hover, .nav-link:hover {
  color: var(--text-primary, var(--text));
  background: var(--accent-subtle);
}
.nav-auth-btn {
  background: var(--accent);
  color: #fff !important;
  padding: 8px 20px !important;
  border-radius: var(--radius-sm) !important;
  font-weight: 600;
}
.nav-auth-btn:hover {
  background: var(--accent-hover) !important;
}
.navbar .theme-toggle {
  width: 36px; height: 36px; border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 15px; flex-shrink: 0; transition: all .2s;
}
.navbar .theme-toggle:hover {
  background: var(--accent-subtle);
  color: var(--text-primary, var(--text));
}
#navItems {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  flex-wrap: nowrap;
}
#navAuthArea {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  vertical-align: middle;
}

/* ===== Nav User Menu (avatar dropdown) ===== */
.nav-user-menu {
  position: relative;
  display: inline-flex;
}
.nav-user-trigger {
  display: inline-flex;
  align-items: center;
  height: 34px;
  text-decoration: none;
  cursor: pointer;
}
.nav-user-initial {
  width: 34px; height: 34px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.nav-user-dropdown {
  display: none;
  position: absolute;
  top: 100%; right: 0;
  margin-top: 4px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 4px;
  min-width: 140px;
  box-shadow: 0 8px 30px rgba(0,0,0,0.25);
  z-index: 100;
}
.nav-user-menu:hover .nav-user-dropdown,
.nav-user-dropdown.open {
  display: block;
}
.nav-user-dropdown a {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  color: var(--text-primary);
  text-decoration: none;
  font-size: var(--text-sm, 13px);
  border-radius: 6px;
  transition: background .15s;
}
.nav-user-dropdown a:hover {
  background: var(--accent-subtle);
}
.nav-user-avatar {
  width: 34px; height: 34px;
  border-radius: 50%;
  cursor: pointer;
  object-fit: cover;
  border: 2px solid var(--border-light);
  transition: border-color .2s;
}

/* ===== Footer (v5.0: 默认 static 流动定位) ===== */
.mirro-footer {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 10px 24px;
  gap: 3px;
  font-size: 0.75rem;
  color: var(--text-secondary);
  z-index: 999;
  width: 100%;
  /* v5.0: 默认 static（不再 fixed，避免覆盖页面内容） */
  position: relative;
  margin-top: auto;
  background: var(--glass);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid var(--border);
}
.mirro-footer.fixed {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: var(--footer-h, 48px);
  padding: 6px 24px;
  gap: 2px;
}
.mirro-footer-links {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  justify-content: center;
}
.mirro-footer-copyright {
  color: var(--text-muted);
  font-size: 0.6rem;
  opacity: 0.7;
}
.mirro-footer a {
  color: var(--text-secondary);
  text-decoration: none;
  transition: color .2s;
}
.mirro-footer a:hover {
  color: var(--accent);
}

/* ===== Button 系统 (Apple 语法: pill + hairline) ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 28px;
  font-size: var(--text-base, 15px);
  font-weight: 600;
  border: 1px solid transparent;
  border-radius: var(--radius-pill);
  cursor: pointer;
  transition: all var(--transition);
  font-family: inherit;
  letter-spacing: 0.2px;
  white-space: nowrap;
  text-decoration: none;
  line-height: 1.2;
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0) scale(0.98); }

.btn-primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff;
  border: none;
  box-shadow: 0 4px 20px var(--accent-glow);
}
.btn-primary:hover {
  box-shadow: 0 8px 32px var(--accent-glow);
  color: #fff;
}

.btn-secondary {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
}
.btn-secondary:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-subtle);
}

.btn-muted {
  background: transparent;
  color: var(--text-secondary);
  border: none;
  padding: 8px 16px;
  font-size: var(--text-sm, 13px);
}
.btn-muted:hover {
  color: var(--text-primary);
  background: var(--accent-subtle);
}

/* ===== Card (Apple 18px, no shadow) ===== */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg, 18px);
  padding: var(--space-5, 48px);
  transition: background var(--transition), border-color var(--transition);
}
.card-sm {
  padding: var(--space-3, 24px);
  border-radius: var(--radius-md, 14px);
}
.card-compact {
  padding: var(--space-2, 16px);
  border-radius: var(--radius-md, 14px);
}
.card-hover:hover {
  border-color: var(--accent);
  background: var(--bg-card-hover);
}
.card-glass {
  background: rgba(255,255,255,0.03);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}

/* ===== Modal ===== */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(4px);
  z-index: 2000;
  align-items: center;
  justify-content: center;
}
.modal-overlay.active {
  display: flex;
}
.modal-box {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg, 18px);
  padding: var(--space-5, 48px) var(--space-4, 32px);
  max-width: 440px;
  width: 90%;
  max-height: 85vh;
  overflow-y: auto;
  position: relative;
  box-shadow: var(--shadow-lg);
}
.modal-close {
  position: absolute;
  top: 16px; right: 16px;
  width: 32px; height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  cursor: pointer;
  color: var(--text-secondary);
  font-size: 18px;
  transition: all .2s;
  background: transparent;
  border: none;
}
.modal-close:hover {
  background: var(--accent-subtle);
  color: var(--text);
}
.modal-input {
  width: 100%;
  padding: 12px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm, 10px);
  background: var(--bg-soft);
  color: var(--text);
  font-size: var(--text-base, 15px);
  font-family: inherit;
  transition: border-color .2s;
  outline: none;
}
.modal-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}
.modal-hint {
  font-size: var(--text-sm, 13px);
  color: var(--text-muted);
  text-align: center;
  margin-top: 12px;
}

/* ===== Form Elements ===== */
input, textarea, select {
  font-family: var(--font);
  font-size: var(--text-base, 15px);
}
input[type="text"],
input[type="email"],
input[type="password"],
textarea {
  width: 100%;
  padding: 12px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm, 10px);
  background: var(--bg-soft);
  color: var(--text);
  transition: border-color .2s, box-shadow .2s;
  outline: none;
}
input[type="text"]:focus,
input[type="email"]:focus,
input[type="password"]:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

/* ===== Tags / Badges ===== */
.tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 12px;
  border-radius: var(--radius-pill, 999px);
  font-size: var(--text-xs, 11px);
  font-weight: 600;
  background: var(--accent-subtle);
  color: var(--accent);
  border: 1px solid var(--border);
}
.tag-success {
  background: var(--success-bg);
  color: var(--success);
  border-color: transparent;
}

/* ===== Spinner ===== */
.spinner {
  width: 32px; height: 32px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ===== Progress ===== */
.progress-track {
  width: 100%;
  height: 3px;
  background: var(--border);
  border-radius: 2px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  border-radius: 2px;
  transition: width 0.5s ease;
}

/* ===== Toast / Notify ===== */
.toast-container {
  position: fixed;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 3000;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}
.toast {
  padding: 12px 24px;
  border-radius: var(--radius-pill, 999px);
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: var(--text-sm, 13px);
  box-shadow: var(--shadow-md);
  pointer-events: auto;
  white-space: nowrap;
}

/* ===== Animations ===== */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes slideUp {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes pulseBtn {
  0%{transform:translateX(-50%) scale(1)}
  50%{transform:translateX(-50%) scale(1.06)}
  100%{transform:translateX(-50%) scale(1)}
}
@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ===== Responsive ===== */
@media (max-width: 640px) {
  :root {
    --space-5: 32px;
    --space-4: 24px;
  }
  .page-content {
    padding-left: var(--space-2, 16px);
    padding-right: var(--space-2, 16px);
  }
  .card {
    padding: var(--space-4, 32px) var(--space-3, 24px);
  }
  .modal-box {
    padding: var(--space-4, 32px) var(--space-3, 24px);
  }
  .mirro-footer-links {
    gap: 10px;
  }
}

/* ===== Result display enhancement (standalone quiz pages) ===== */
.jq-full-result { text-align: left; }
.jq-full-result .jq-result-header { text-align: center; }
.jq-full-result .jq-result-desc { max-width: 100%; padding: 0 4px; }
.jq-full-result .dim-badge { max-width: 100%; }
.jq-full-result .jq-rank-dd-section { text-align: left; margin-bottom: 16px; padding: 14px 16px; background: var(--bg-card); border: 1px solid var(--border-light); border-radius: var(--radius-sm, 10px); }
.jq-full-result .jq-rank-dd-title { font-size: 15px; font-weight: 700; color: var(--accent); margin-bottom: 8px; padding-bottom: 6px; border-bottom: 1px solid var(--border-light); }
.jq-full-result .jq-rank-dd-content { font-size: 14px; line-height: 1.9; color: var(--text); }
.jq-full-result .jq-rank-dd-content p { margin: 0 0 8px; }
.jq-full-result .jq-rank-dd-content strong { color: var(--accent); }
.jq-full-result .jq-rank-sw-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 600px) {
  .jq-full-result .jq-rank-sw-grid { grid-template-columns: 1fr; }
}

/* ===== Result visual sections in card ===== */
.jq-full-result > div { text-align: left; }
.jq-full-result .dim-badge { max-width: 100%; box-sizing: border-box; overflow: hidden; }
.jq-full-result .dim-badge > div:last-child { min-width: 0; overflow: hidden; }
/* Energy distribution bars - prevent overflow */
.jq-full-result [style*="margin:16px 0"][style*="padding:18px 16px"] { overflow: hidden; }
/* Result actions in card */
.jq-full-result .jq-result-actions .btn-journey { min-width: 140px; }
/* Deep dive section numbering */
.jq-full-result .jq-rank-dd-section { break-inside: avoid; }
