/* ─── Fonts ────────────────────────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=Cinzel:wght@700;900&display=swap');
@import url('https://cdn.jsdelivr.net/npm/lxgw-wenkai-webfont@1.7.0/style.css');

/* ─── Reset & Base ─────────────────────────────────────── */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --bg-deep: #050510;
  --bg-card: rgba(15,15,35,0.7);
  --bg-hover: rgba(25,25,55,0.8);
  --border: rgba(255,255,255,0.06);
  --border-active: rgba(99,179,237,0.3);
  --text: #e8e8ed;
  --text-secondary: rgba(255,255,255,0.55);
  --text-dim: rgba(255,255,255,0.5);
  --text-muted: rgba(255,255,255,0.25);
  --accent-blue: #63b3ed;
  --accent-purple: #b794f4;
  --accent-gold: #ffd700;
  --glow-blue: rgba(99,179,237,0.15);
  --glow-gold: rgba(255,215,0,0.12);
  --gradient: linear-gradient(135deg, #63b3ed, #b794f4);
  --gradient-gold: linear-gradient(135deg, #ffd700, #63b3ed, #b794f4);
  --radius: 20px;
  --radius-sm: 12px;
  --font: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Segoe UI', system-ui, sans-serif;
  --font-display: 'Cinzel', 'LXGW WenKai', serif;
  --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

html {
  font-family: var(--font);
  background: var(--bg-deep);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  overflow-x: hidden;
  position: relative;
}

/* ─── Starfield Canvas ─────────────────────────────────── */
#starfield {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  z-index: 0;
  pointer-events: none;
}

/* ─── Gradient Overlay ─────────────────────────────────── */
body::before {
  content: '';
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background:
    radial-gradient(ellipse at 30% 15%, rgba(99,179,237,0.12), transparent 55%),
    radial-gradient(ellipse at 70% 80%, rgba(183,148,244,0.09), transparent 55%),
    radial-gradient(ellipse at 50% 0%, rgba(255,215,0,0.04), transparent 40%);
  pointer-events: none;
  z-index: 1;
}

/* Everything above canvas */
nav, main, footer, .loading-overlay, .toast {
  position: relative;
  z-index: 10;
}

/* ─── Layout ───────────────────────────────────────────── */
.container {
  max-width: 960px;
  margin: 0 auto;
  padding: 0 24px;
}

/* ─── Navigation ───────────────────────────────────────── */
nav {
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  background: rgba(5,5,16,0.85);
  border-bottom: 1px solid transparent;
  background-clip: padding-box;
}

nav::after {
  content: '';
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--accent-blue), var(--accent-purple), transparent);
  opacity: 0.4;
}

nav .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 56px;
}

nav .logo {
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 0.5px;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
}

nav .logo span { opacity: 0.4; font-weight: 400; font-size: 13px; }

.nav-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.nav-tabs {
  display: flex;
  gap: 4px;
}

.nav-tab {
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 14px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition);
  border: none;
  background: none;
  font-family: var(--font);
}

.nav-tab:hover { color: var(--text); background: rgba(255,255,255,0.05); }
.nav-tab.active { color: var(--accent-blue); background: var(--glow-blue); }

.lang-toggle {
  font-size: 12px;
  padding: 6px 14px;
  border-radius: 8px;
  letter-spacing: 1px;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  transition: var(--transition);
  border: none;
  background: none;
  font-family: var(--font);
}
.lang-toggle:hover { color: var(--text); background: rgba(255,255,255,0.05); }

/* ─── Floating Orbs (depth layer) ──────────────────────── */
.floating-orbs {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  z-index: 2;
  pointer-events: none;
  overflow: hidden;
}

.floating-orb {
  position: absolute;
  border-radius: 50%;
  animation: floatOrb linear infinite;
}

.floating-orb:nth-child(1) { width: 10px; height: 10px; background: rgba(99,179,237,0.4); box-shadow: 0 0 12px rgba(99,179,237,0.5); top: 15%; left: 8%; animation-duration: 18s; }
.floating-orb:nth-child(2) { width: 7px; height: 7px; background: rgba(183,148,244,0.35); box-shadow: 0 0 10px rgba(183,148,244,0.4); top: 30%; right: 12%; animation-duration: 22s; animation-delay: -5s; }
.floating-orb:nth-child(3) { width: 14px; height: 14px; background: rgba(255,215,0,0.2); box-shadow: 0 0 20px rgba(255,215,0,0.25); top: 60%; left: 5%; animation-duration: 25s; animation-delay: -10s; filter: blur(2px); }
.floating-orb:nth-child(4) { width: 5px; height: 5px; background: rgba(99,179,237,0.5); box-shadow: 0 0 8px rgba(99,179,237,0.6); top: 45%; right: 6%; animation-duration: 20s; animation-delay: -3s; }
.floating-orb:nth-child(5) { width: 9px; height: 9px; background: rgba(183,148,244,0.3); box-shadow: 0 0 14px rgba(183,148,244,0.35); top: 75%; left: 15%; animation-duration: 28s; animation-delay: -8s; }
.floating-orb:nth-child(6) { width: 6px; height: 6px; background: rgba(255,215,0,0.3); box-shadow: 0 0 10px rgba(255,215,0,0.35); top: 20%; right: 20%; animation-duration: 24s; animation-delay: -12s; }

@keyframes floatOrb {
  0% { transform: translateY(0) translateX(0); opacity: 0; }
  10% { opacity: 0.8; }
  50% { transform: translateY(-120px) translateX(40px); opacity: 1; }
  90% { opacity: 0.8; }
  100% { transform: translateY(-240px) translateX(-30px); opacity: 0; }
}

/* ─── Hero Section ─────────────────────────────────────── */
.hero {
  text-align: center;
  padding: 48px 0 16px;
  position: relative;
}

.hero::before {
  content: '';
  position: absolute;
  top: -80px;
  left: 50%;
  transform: translateX(-50%);
  width: 800px;
  height: 600px;
  background:
    radial-gradient(ellipse, rgba(99,179,237,0.08) 0%, transparent 50%),
    radial-gradient(ellipse at 50% 30%, rgba(255,215,0,0.06) 0%, transparent 40%),
    radial-gradient(ellipse at 50% 60%, rgba(183,148,244,0.05) 0%, transparent 45%);
  pointer-events: none;
}

/* ─── Soul Orb (Key Visual) ────────────────────────────── */
.soul-orb-container {
  position: relative;
  width: 240px;
  height: 240px;
  margin: 0 auto 20px;
  animation: fadeUp 0.8s ease-out;
}

/* Massive ambient glow behind the orb */
.soul-orb-container::before {
  content: '';
  position: absolute;
  inset: -60px;
  border-radius: 50%;
  background: radial-gradient(circle,
    rgba(99,179,237,0.15) 0%,
    rgba(183,148,244,0.08) 30%,
    rgba(255,215,0,0.04) 50%,
    transparent 70%);
  animation: orbAmbient 4s ease-in-out infinite;
  pointer-events: none;
}

@keyframes orbAmbient {
  0%, 100% { transform: scale(1); opacity: 0.8; }
  50% { transform: scale(1.15); opacity: 1; }
}

.soul-orb-core {
  position: absolute;
  inset: 30px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%,
    rgba(160,210,255,0.6) 0%,
    rgba(99,179,237,0.5) 20%,
    rgba(183,148,244,0.4) 45%,
    rgba(20,20,60,0.9) 75%);
  box-shadow:
    0 0 40px rgba(99,179,237,0.35),
    0 0 80px rgba(99,179,237,0.2),
    0 0 160px rgba(183,148,244,0.15),
    0 0 240px rgba(183,148,244,0.08),
    inset 0 0 40px rgba(99,179,237,0.25),
    inset 0 0 80px rgba(183,148,244,0.1);
  animation: orbBreathe 4s ease-in-out infinite;
}

/* Specular highlight - bright spot */
.soul-orb-core::before {
  content: '';
  position: absolute;
  width: 35%; height: 35%;
  top: 12%; left: 18%;
  border-radius: 50%;
  background: radial-gradient(circle,
    rgba(255,255,255,0.45) 0%,
    rgba(255,255,255,0.1) 50%,
    transparent 70%);
}

/* Gold inner nebula */
.soul-orb-core::after {
  content: '';
  position: absolute;
  inset: -8px;
  border-radius: 50%;
  background: radial-gradient(circle at 60% 70%,
    rgba(255,215,0,0.12),
    transparent 50%);
  animation: orbBreathe 4s ease-in-out infinite reverse;
}

@keyframes orbBreathe {
  0%, 100% {
    transform: scale(1);
    box-shadow:
      0 0 40px rgba(99,179,237,0.35),
      0 0 80px rgba(99,179,237,0.2),
      0 0 160px rgba(183,148,244,0.15),
      0 0 240px rgba(183,148,244,0.08),
      inset 0 0 40px rgba(99,179,237,0.25),
      inset 0 0 80px rgba(183,148,244,0.1);
  }
  50% {
    transform: scale(1.06);
    box-shadow:
      0 0 50px rgba(99,179,237,0.45),
      0 0 100px rgba(99,179,237,0.25),
      0 0 200px rgba(183,148,244,0.2),
      0 0 300px rgba(183,148,244,0.1),
      inset 0 0 50px rgba(99,179,237,0.3),
      inset 0 0 100px rgba(183,148,244,0.15);
  }
}

.soul-orb-ring {
  position: absolute;
  inset: -5px;
  border-radius: 50%;
  border: 2px solid transparent;
  background: conic-gradient(from 0deg,
    transparent 0%,
    rgba(99,179,237,0.5) 15%,
    rgba(183,148,244,0.4) 30%,
    rgba(255,215,0,0.3) 45%,
    transparent 60%,
    rgba(99,179,237,0.3) 75%,
    transparent 100%) border-box;
  -webkit-mask: linear-gradient(#fff 0 0) padding-box, linear-gradient(#fff 0 0);
  mask: linear-gradient(#fff 0 0) padding-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  animation: orbRingSpin 8s linear infinite;
  filter: blur(0.5px);
}

.soul-orb-ring-inner {
  position: absolute;
  inset: 12px;
  border-radius: 50%;
  border: 1.5px solid transparent;
  background: conic-gradient(from 180deg,
    transparent 0%,
    rgba(255,215,0,0.4) 20%,
    rgba(99,179,237,0.3) 40%,
    transparent 55%,
    rgba(183,148,244,0.3) 80%,
    transparent 100%) border-box;
  -webkit-mask: linear-gradient(#fff 0 0) padding-box, linear-gradient(#fff 0 0);
  mask: linear-gradient(#fff 0 0) padding-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  animation: orbRingSpin 6s linear infinite reverse;
}

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

/* Orbiting particles */
.soul-orb-particle {
  position: absolute;
  width: 4px; height: 4px;
  border-radius: 50%;
  background: var(--accent-gold);
  box-shadow: 0 0 10px var(--accent-gold), 0 0 20px rgba(255,215,0,0.3);
}
.soul-orb-particle:nth-child(4) { top: 0; left: 50%; animation: orbitParticle 5s linear infinite; }
.soul-orb-particle:nth-child(5) { top: 50%; right: 0; animation: orbitParticle 7s linear infinite reverse; background: var(--accent-blue); box-shadow: 0 0 10px var(--accent-blue), 0 0 20px rgba(99,179,237,0.3); }
.soul-orb-particle:nth-child(6) { bottom: 10%; left: 10%; animation: orbitParticle 6s linear infinite; animation-delay: -2s; background: var(--accent-purple); box-shadow: 0 0 10px var(--accent-purple), 0 0 20px rgba(183,148,244,0.3); }

@keyframes orbitParticle {
  0% { transform: rotate(0deg) translateX(115px) rotate(0deg); opacity: 0.8; }
  50% { opacity: 1; }
  100% { transform: rotate(360deg) translateX(115px) rotate(-360deg); opacity: 0.8; }
}

.hero-title {
  font-size: 52px;
  font-weight: 900;
  letter-spacing: 4px;
  font-family: var(--font-display);
  background: linear-gradient(135deg, #ffd700 0%, #ffed8a 25%, #63b3ed 50%, #b794f4 75%, #ffd700 100%);
  background-size: 200% 200%;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 12px;
  animation: fadeUp 0.8s ease-out, titleShimmer 6s ease-in-out infinite;
  position: relative;
}

/* Text glow layer behind the title */
.hero-title::after {
  content: attr(data-text);
  position: absolute;
  inset: 0;
  font-size: inherit;
  font-weight: inherit;
  letter-spacing: inherit;
  font-family: inherit;
  color: rgba(255,215,0,0.15);
  filter: blur(20px);
  -webkit-text-fill-color: rgba(255,215,0,0.15);
  animation: titleGlowPulse 3s ease-in-out infinite;
  pointer-events: none;
}

@keyframes titleShimmer {
  0%, 100% { background-position: 0% 50%; filter: brightness(1); }
  50% { background-position: 100% 50%; filter: brightness(1.15); }
}

@keyframes titleGlowPulse {
  0%, 100% { opacity: 0.5; }
  50% { opacity: 1; }
}

.hero-subtitle {
  font-size: 18px;
  color: var(--text-secondary);
  max-width: 480px;
  margin: 0 auto;
  line-height: 1.6;
  animation: fadeUp 0.8s ease-out 0.1s both;
}

.hero-typewriter {
  font-size: 14px;
  color: var(--accent-gold);
  opacity: 0.6;
  margin-top: 16px;
  min-height: 1.5em;
  font-style: italic;
  animation: fadeUp 0.8s ease-out 0.2s both;
}

.hero-typewriter .cursor {
  display: inline-block;
  width: 2px;
  height: 1em;
  background: var(--accent-gold);
  margin-left: 2px;
  vertical-align: text-bottom;
  animation: blink 0.8s step-end infinite;
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}

/* ─── Decorative Divider ───────────────────────────────── */
.divider-ornate {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin: 16px auto 8px;
  max-width: 240px;
  opacity: 0.25;
}

.divider-ornate::before,
.divider-ornate::after {
  content: '';
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--accent-gold));
}

.divider-ornate::after {
  background: linear-gradient(90deg, var(--accent-gold), transparent);
}

.divider-diamond {
  width: 8px;
  height: 8px;
  transform: rotate(45deg);
  border: 1px solid var(--accent-gold);
  flex-shrink: 0;
}

/* ─── Card Corner Ornaments ────────────────────────────── */
.ornament-card {
  position: relative;
}

.ornament-card::before,
.ornament-card::after {
  content: '';
  position: absolute;
  width: 20px;
  height: 20px;
  border-color: rgba(255,215,0,0.15);
  border-style: solid;
  pointer-events: none;
  transition: border-color 0.3s;
}

.ornament-card::before {
  top: -1px; left: -1px;
  border-width: 1px 0 0 1px;
}

.ornament-card::after {
  bottom: -1px; right: -1px;
  border-width: 0 1px 1px 0;
}

.ornament-card:hover::before,
.ornament-card:hover::after {
  border-color: rgba(255,215,0,0.35);
}

#portrait-container {
  scroll-margin-top: 72px;
}

/* ─── Keyframes ────────────────────────────────────────── */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

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

@keyframes pulse {
  0%, 100% { opacity: 0.4; }
  50% { opacity: 1; }
}

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

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

/* ─── Sections ─────────────────────────────────────────── */
.section { display: none; padding-bottom: 20px; }
.section.active { display: block; animation: fadeIn 0.3s ease-out; }

/* ─── Portal Upload ────────────────────────────────────── */
.portal-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-top: 12px;
  cursor: pointer;
}

/* Portal hover (not just dragover) */
.portal-wrapper:hover .portal::before {
  background: radial-gradient(circle, rgba(99,179,237,0.15), rgba(183,148,244,0.05) 50%, transparent 70%);
}
.portal-wrapper:hover .portal-ring-outer { border-color: rgba(99,179,237,0.4); }
.portal-wrapper:hover .portal-emoji { transform: scale(1.08); }

.portal {
  position: relative;
  width: 260px;
  height: 260px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.portal-ring {
  position: absolute;
  border-radius: 50%;
  border: 2px dashed;
}

.portal-ring-outer {
  width: 260px; height: 260px;
  border-color: rgba(99,179,237,0.35);
  border-width: 2px;
  animation: spin 20s linear infinite;
  box-shadow: 0 0 15px rgba(99,179,237,0.08);
}

.portal-ring-mid {
  width: 200px; height: 200px;
  border-color: rgba(183,148,244,0.3);
  border-width: 2px;
  animation: spinReverse 15s linear infinite;
  box-shadow: 0 0 12px rgba(183,148,244,0.06);
}

.portal-ring-inner {
  width: 140px; height: 140px;
  border-color: rgba(255,215,0,0.25);
  border-style: dotted;
  border-width: 2px;
  animation: spin 10s linear infinite;
  box-shadow: 0 0 10px rgba(255,215,0,0.05);
}

.portal::before {
  content: '';
  position: absolute;
  width: 220px; height: 220px;
  border-radius: 50%;
  background: radial-gradient(circle,
    rgba(99,179,237,0.12) 0%,
    rgba(183,148,244,0.06) 40%,
    transparent 70%);
  transition: var(--transition);
}

.portal-center {
  position: relative;
  z-index: 2;
  text-align: center;
}

.portal-emoji {
  font-size: 40px;
  display: block;
  margin-bottom: 8px;
  transition: var(--transition);
}

.portal-text {
  font-size: 14px;
  color: var(--text-dim);
  font-weight: 500;
}

.portal-sub {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
}

/* Dragover state */
.portal-wrapper.dragover .portal-ring-outer { animation-duration: 4s; border-color: rgba(99,179,237,0.6); box-shadow: 0 0 25px rgba(99,179,237,0.15); }
.portal-wrapper.dragover .portal-ring-mid   { animation-duration: 3s; border-color: rgba(183,148,244,0.5); box-shadow: 0 0 20px rgba(183,148,244,0.1); }
.portal-wrapper.dragover .portal-ring-inner { animation-duration: 2s; }
.portal-wrapper.dragover .portal::before {
  background: radial-gradient(circle, rgba(99,179,237,0.25), rgba(183,148,244,0.1) 50%, transparent 70%);
  animation: portalPulse 1s ease-in-out infinite;
}
.portal-wrapper.dragover .portal-emoji { transform: scale(1.2); }
.portal-wrapper.dragover .portal-ring-outer { border-color: rgba(99,179,237,0.5); }
.portal-wrapper.dragover .portal-ring-mid   { border-color: rgba(183,148,244,0.4); }

@keyframes portalPulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.15); opacity: 0.7; }
}

.upload-hint {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 20px;
  text-align: center;
}

#file-input { display: none; }

/* ─── Loading State ────────────────────────────────────── */
.loading-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(5,5,16,0.92);
  backdrop-filter: blur(12px);
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 24px;
}

.loading-overlay.active { display: flex; }

.loading-spinner {
  width: 48px;
  height: 48px;
  border: 3px solid rgba(255,255,255,0.1);
  border-top-color: var(--accent-blue);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.loading-text {
  font-size: 16px;
  color: var(--text-secondary);
  animation: pulse 1.5s ease-in-out infinite;
}

/* ─── Portrait Card ────────────────────────────────────── */
.portrait-card {
  background: rgba(15,15,40,0.6);
  backdrop-filter: blur(16px);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: 0 8px 32px rgba(0,0,0,0.4), inset 0 1px 0 rgba(255,255,255,0.05);
  animation: cardEnter 0.6s ease-out;
}

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

.portrait-header {
  padding: 32px 32px 24px;
  display: flex;
  align-items: flex-start;
  gap: 24px;
  border-bottom: 1px solid var(--border);
  animation: stagger 0.6s ease-out 0.1s both;
}

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

.portrait-avatar {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: var(--gradient-gold);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 36px;
  flex-shrink: 0;
  box-shadow: 0 0 20px rgba(255,215,0,0.15);
}

.portrait-info { flex: 1; }

.portrait-name {
  font-size: 28px;
  font-weight: 700;
  margin-bottom: 4px;
}

.portrait-meta {
  font-size: 14px;
  color: var(--text-secondary);
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  margin-top: 8px;
}

.portrait-meta span { display: flex; align-items: center; gap: 4px; }

.portrait-score-badge {
  padding: 6px 16px;
  border-radius: 20px;
  background: var(--glow-blue);
  color: var(--accent-blue);
  font-size: 20px;
  font-weight: 700;
  white-space: nowrap;
  flex-shrink: 0;
  align-self: center;
}

.portrait-body {
  padding: 32px;
  animation: stagger 0.6s ease-out 0.2s both;
}

/* Radar pulse halo */
.portrait-radar {
  display: flex;
  justify-content: center;
  margin-bottom: 32px;
  position: relative;
}

.portrait-radar::before {
  content: '';
  position: absolute;
  width: 200px; height: 200px;
  border-radius: 50%;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  background: radial-gradient(circle, rgba(99,179,237,0.08), transparent 70%);
  animation: radarPulse 3s ease-in-out infinite;
}

@keyframes radarPulse {
  0%, 100% { transform: translate(-50%, -50%) scale(1); opacity: 0.6; }
  50% { transform: translate(-50%, -50%) scale(1.2); opacity: 0.2; }
}

.portrait-radar svg { max-width: 320px; width: 100%; height: auto; position: relative; z-index: 1; }

.portrait-bio {
  font-size: 15px;
  line-height: 1.8;
  color: var(--text-secondary);
  font-style: italic;
  padding: 20px 24px;
  background: rgba(255,255,255,0.02);
  border-radius: var(--radius-sm);
  border-left: 3px solid var(--accent-blue);
  margin-bottom: 32px;
  animation: stagger 0.6s ease-out 0.3s both;
}

.portrait-bio::before { content: '\201c'; }
.portrait-bio::after { content: '\201d'; }

/* Score Bars */
.score-bars {
  display: flex;
  flex-direction: column;
  gap: 16px;
  animation: stagger 0.6s ease-out 0.4s both;
}

.score-bar-item {
  display: grid;
  grid-template-columns: 120px 1fr 50px;
  align-items: center;
  gap: 12px;
}

.score-bar-label {
  font-size: 14px;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 6px;
}

.score-bar-track {
  height: 8px;
  background: rgba(255,255,255,0.05);
  border-radius: 4px;
  overflow: hidden;
}

.score-bar-fill {
  height: 100%;
  border-radius: 4px;
  background: var(--gradient);
  box-shadow: 0 0 8px rgba(99,179,237,0.4);
  transition: width 1s cubic-bezier(0.4, 0, 0.2, 1);
  width: 0;
}

.score-bar-value {
  font-size: 14px;
  font-weight: 600;
  text-align: right;
  color: var(--accent-blue);
}

/* Level & Weight Badges */
.portrait-badges {
  display: flex;
  gap: 12px;
  margin-top: 28px;
  flex-wrap: wrap;
  animation: stagger 0.6s ease-out 0.5s both;
}

.badge {
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--border);
  font-size: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.level-badge {
  border: 1px solid rgba(255,215,0,0.3);
  box-shadow: 0 0 12px rgba(255,215,0,0.15);
  animation: badgeGlow 2s ease-in-out infinite;
}

@keyframes badgeGlow {
  0%, 100% { box-shadow: 0 0 12px rgba(255,215,0,0.15); }
  50% { box-shadow: 0 0 20px rgba(255,215,0,0.25); }
}

.badge-label { color: var(--text-muted); font-size: 12px; }
.badge-value { font-weight: 600; }

/* Share & Actions */
.portrait-actions {
  display: flex;
  gap: 12px;
  margin-top: 28px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
  animation: stagger 0.6s ease-out 0.6s both;
}

.btn {
  padding: 10px 24px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  border: none;
  font-family: var(--font);
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.btn-primary {
  background: var(--gradient);
  color: #fff;
  position: relative;
  overflow: hidden;
}

.btn-primary::before {
  content: '';
  position: absolute;
  top: -50%; left: -50%;
  width: 200%; height: 200%;
  background: conic-gradient(from 0deg, transparent 0%, rgba(255,215,0,0.3) 10%, transparent 20%);
  animation: btnGlowSpin 3s linear infinite;
  opacity: 0;
  transition: opacity 0.3s;
}

.btn-primary:hover::before { opacity: 1; }

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 20px rgba(99,179,237,0.3);
}

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

/* Inner content above glow */
.btn-primary > * { position: relative; z-index: 1; }

.btn-secondary {
  background: rgba(255,255,255,0.05);
  color: var(--text-secondary);
  border: 1px solid var(--border);
  position: relative;
  overflow: hidden;
}

.btn-secondary::after {
  content: '';
  position: absolute;
  top: 0; left: -100%;
  width: 100%; height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,215,0,0.06), transparent);
  transition: left 0.5s;
}

.btn-secondary:hover::after { left: 100%; }
.btn-secondary:hover { background: rgba(255,255,255,0.08); color: var(--text); border-color: rgba(255,215,0,0.15); }

/* ─── Leaderboard ──────────────────────────────────────── */
.leaderboard-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  padding-top: 40px;
}

.leaderboard-title {
  font-size: 22px;
  font-weight: 600;
  font-family: var(--font-display);
  letter-spacing: 1px;
}

.leaderboard-count {
  font-size: 14px;
  color: var(--text-muted);
}

.leaderboard-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.leaderboard-item {
  display: grid;
  grid-template-columns: 56px 48px 1fr auto;
  align-items: center;
  gap: 16px;
  padding: 16px 20px;
  background: var(--bg-card);
  backdrop-filter: blur(8px);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}

/* Hover sweep effect */
.leaderboard-item::after {
  content: '';
  position: absolute;
  top: 0; left: -100%;
  width: 60%; height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.03), transparent);
  transition: left 0.6s;
}
.leaderboard-item:hover::after { left: 150%; }

.leaderboard-item:hover {
  border-color: var(--border-active);
  background: var(--bg-hover);
  transform: translateX(4px);
}

/* Gold/Silver/Bronze glow */
.rank-1 { border-left: 3px solid #ffd700; box-shadow: inset 0 0 20px rgba(255,215,0,0.05); }
.rank-2 { border-left: 3px solid #c0c0c0; box-shadow: inset 0 0 20px rgba(192,192,192,0.05); }
.rank-3 { border-left: 3px solid #cd7f32; box-shadow: inset 0 0 20px rgba(205,127,50,0.05); }

/* Mini radar thumbnail */
.mini-radar {
  width: 48px;
  height: 48px;
  flex-shrink: 0;
}
.mini-radar svg { width: 100%; height: 100%; }

.rank-number {
  font-size: 20px;
  font-weight: 700;
  text-align: center;
  color: var(--text-muted);
}

.rank-1 .rank-number { color: #ffd700; text-shadow: 0 0 8px rgba(255,215,0,0.3); }
.rank-2 .rank-number { color: #c0c0c0; text-shadow: 0 0 8px rgba(192,192,192,0.2); }
.rank-3 .rank-number { color: #cd7f32; text-shadow: 0 0 8px rgba(205,127,50,0.2); }

.leaderboard-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.leaderboard-name {
  font-size: 16px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
}

.leaderboard-detail {
  font-size: 13px;
  color: var(--text-muted);
  display: flex;
  gap: 12px;
}

.leaderboard-score {
  font-size: 18px;
  font-weight: 700;
  color: var(--accent-blue);
  white-space: nowrap;
}

.leaderboard-empty {
  text-align: center;
  padding: 64px 0;
  color: var(--text-muted);
  font-size: 15px;
}

/* ─── Coming Soon / Roadmap ────────────────────────────── */
.roadmap-header {
  text-align: center;
  padding-top: 48px;
  margin-bottom: 40px;
}

.roadmap-title {
  font-size: 28px;
  font-weight: 700;
  font-family: var(--font-display);
  letter-spacing: 1px;
  margin-bottom: 8px;
}

.roadmap-subtitle {
  font-size: 15px;
  color: var(--text-dim);
}

.roadmap-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}

.roadmap-card {
  position: relative;
  padding: 32px 24px;
  background: var(--bg-card);
  backdrop-filter: blur(8px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  text-align: center;
  transition: var(--transition);
  overflow: hidden;
}

.roadmap-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.25);
  border-radius: var(--radius);
  pointer-events: none;
  transition: var(--transition);
}

.roadmap-card:hover {
  transform: translateY(-4px);
  border-color: rgba(255,255,255,0.1);
}
.roadmap-card:hover::before { background: rgba(0,0,0,0.15); }

.roadmap-lock {
  position: absolute;
  top: 12px; left: 16px;
  font-size: 14px;
  opacity: 0.5;
}

.roadmap-version {
  position: absolute;
  top: 12px; right: 16px;
  font-size: 11px;
  color: var(--text-muted);
  padding: 2px 8px;
  border-radius: 4px;
  background: rgba(255,255,255,0.05);
}

.roadmap-emoji {
  font-size: 40px;
  display: block;
  margin-bottom: 16px;
  position: relative;
  transition: transform 0.3s;
}

.roadmap-card:hover .roadmap-emoji {
  transform: scale(1.15) translateY(-4px);
}

.roadmap-name {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 8px;
  position: relative;
}

.roadmap-desc {
  font-size: 13px;
  color: var(--text-dim);
  line-height: 1.6;
  margin-bottom: 20px;
  position: relative;
}

.roadmap-badge {
  font-size: 12px;
  color: var(--accent-gold);
  opacity: 0.6;
  position: relative;
}

/* ─── Footer ───────────────────────────────────────────── */
footer {
  text-align: center;
  padding: 12px 0 8px;
}

.footer-line {
  width: 120px;
  height: 1px;
  margin: 0 auto 16px;
  background: linear-gradient(90deg, transparent, var(--accent-blue), var(--accent-purple), transparent);
  opacity: 0.3;
}

footer p {
  font-size: 11px;
  color: var(--text-muted);
  letter-spacing: 0.5px;
}

/* ─── Hint Link ────────────────────────────────────────── */
.hint-link {
  color: var(--accent-blue);
  text-decoration: none;
  border-bottom: 1px dotted rgba(99,179,237,0.3);
  cursor: pointer;
  transition: var(--transition);
}
.hint-link:hover {
  color: var(--accent-gold);
  border-bottom-color: rgba(255,215,0,0.4);
}

/* ─── Modal ───────────────────────────────────────────── */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 500;
  background: rgba(5,5,16,0.7);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  align-items: center;
  justify-content: center;
}

.modal-overlay.active { display: flex; }

.modal-card {
  background: rgba(15,15,40,0.95);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: var(--radius);
  padding: 40px;
  max-width: 480px;
  width: 90%;
  text-align: center;
  position: relative;
  box-shadow: 0 20px 60px rgba(0,0,0,0.5), 0 0 80px rgba(99,179,237,0.05);
  animation: cardEnter 0.3s ease-out;
}

.modal-close {
  position: absolute;
  top: 16px; right: 20px;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 24px;
  cursor: pointer;
  transition: color 0.2s;
  font-family: var(--font);
}
.modal-close:hover { color: var(--text); }

.modal-emoji { font-size: 48px; margin-bottom: 12px; }

.modal-title {
  font-size: 22px;
  font-weight: 700;
  font-family: var(--font-display);
  margin-bottom: 8px;
}
.modal-title span {
  color: var(--text-dim);
  font-weight: 400;
  font-size: 16px;
  font-family: var(--font);
}

.modal-desc {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 24px;
  line-height: 1.6;
}

.modal-code {
  background: rgba(0,0,0,0.3);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: var(--radius-sm);
  padding: 16px 20px;
  text-align: left;
  margin-bottom: 24px;
}

.modal-code code {
  display: block;
  font-family: 'SF Mono', 'Fira Code', monospace;
  font-size: 13px;
  color: var(--accent-blue);
  line-height: 2;
}

.modal-links {
  display: flex;
  gap: 12px;
  justify-content: center;
}

/* ─── Toast Notification ───────────────────────────────── */
.toast {
  position: fixed;
  bottom: 32px;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  padding: 12px 24px;
  background: rgba(15,15,35,0.9);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border-active);
  border-radius: var(--radius-sm);
  font-size: 14px;
  color: var(--text);
  z-index: 300;
  transition: transform 0.3s ease-out;
  pointer-events: none;
}

.toast.visible { transform: translateX(-50%) translateY(0); }

/* ─── Responsive ───────────────────────────────────────── */
@media (max-width: 768px) {
  .hero-title { font-size: 36px; letter-spacing: 2px; }
  .hero-subtitle { font-size: 15px; }
  .hero { padding: 24px 0 16px; }
  .soul-orb-container { width: 180px; height: 180px; }
  @keyframes orbitParticle {
    0% { transform: rotate(0deg) translateX(85px) rotate(0deg); opacity: 0.8; }
    50% { opacity: 1; }
    100% { transform: rotate(360deg) translateX(85px) rotate(-360deg); opacity: 0.8; }
  }

  .portal { width: 200px; height: 200px; }
  .portal-ring-outer { width: 200px; height: 200px; }
  .portal-ring-mid { width: 150px; height: 150px; }
  .portal-ring-inner { width: 100px; height: 100px; }

  .portrait-header {
    flex-direction: column;
    align-items: center;
    text-align: center;
  }

  .portrait-meta { justify-content: center; }
  .portrait-score-badge { align-self: center; }

  .score-bar-item {
    grid-template-columns: 100px 1fr 40px;
    gap: 8px;
  }

  .score-bar-label { font-size: 12px; }
  .portrait-actions { flex-direction: column; }
  .portrait-badges { justify-content: center; }

  .leaderboard-item {
    grid-template-columns: 40px 1fr auto;
    padding: 12px 14px;
    gap: 12px;
  }
  .mini-radar { display: none; }

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

@media (max-width: 480px) {
  .nav-tabs { gap: 2px; }
  .nav-tab { padding: 6px 10px; font-size: 13px; }
  .nav-tab .tab-label { display: none; }
  .nav-tab .tab-icon { display: inline; }

  .hero-title { font-size: 28px; letter-spacing: 1px; }
  .soul-orb-container { width: 140px; height: 140px; }
  .portal { width: 180px; height: 180px; }
  .portal-ring-outer { width: 180px; height: 180px; }
  .portal-ring-mid { width: 130px; height: 130px; }
  .portal-ring-inner { width: 80px; height: 80px; }

  .score-bar-item { grid-template-columns: 80px 1fr 36px; }
  .hero-typewriter { font-size: 12px; }
}

/* ─── Scrollbar ────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.2); }
