/*
 * Design System — Onboarding Platform
 * ====================================
 * Source of truth: docs/STYLE_GUIDE.md
 * ALL visual values MUST come from these tokens.
 *
 * BEM Naming Convention (S-090):
 * Block:    .component          (standalone entity, e.g. .card, .btn, .search)
 * Element:  .component__part    (part of block, e.g. .card__header, .btn__icon)
 * Modifier: .component--variant (variation of block/element, e.g. .card--elevated, .btn--primary)
 * State:    .is-active, .has-error  (JS-toggled states, prefix with is-/has-)
 *
 * Exceptions:
 * - Utility classes (.sr-only, .bg-surface, .text-muted) — not BEM, intentional
 * - HTMX states (.htmx-loading) — framework convention
 * - Third-party prefixes (.st-*) — skill tree SVG internals
 */

/* ================================
   1. DESIGN TOKENS (CSS Custom Properties)
   ================================ */

:root {
  /* ---- Brand Colors ---- */
  --color-primary-50:  #EEF2FF;
  --color-primary-100: #E0E7FF;
  --color-primary-200: #C7D2FE;
  --color-primary-300: #A5B4FC;
  --color-primary-400: #818CF8;
  --color-primary-500: #6366F1;
  --color-primary-600: #4F46E5;
  --color-primary-700: #4338CA;
  --color-primary-800: #3730A3;
  --color-primary-900: #312E81;

  /* ---- Semantic Colors ---- */
  --color-success-50:  #ECFDF5;
  --color-success-100: #D1FAE5;
  --color-success-500: #10B981;
  --color-success-700: #047857;

  --color-warning-50:  #FFFBEB;
  --color-warning-100: #FEF3C7;
  --color-warning-500: #F59E0B;
  --color-warning-700: #B45309;

  --color-error-50:  #FEF2F2;
  --color-error-100: #FEE2E2;
  --color-error-500: #EF4444;
  --color-error-700: #B91C1C;

  --color-info-50:  #EFF6FF;
  --color-info-100: #DBEAFE;
  --color-info-500: #3B82F6;
  --color-info-700: #1D4ED8;

  /* ---- Neutrals ---- */
  --color-neutral-0:   #FFFFFF;
  --color-neutral-50:  #F9FAFB;
  --color-neutral-100: #F3F4F6;
  --color-neutral-200: #E5E7EB;
  --color-neutral-300: #D1D5DB;
  --color-neutral-400: #9CA3AF;
  --color-neutral-500: #6B7280;
  --color-neutral-600: #4B5563;
  --color-neutral-700: #374151;
  --color-neutral-800: #1F2937;
  --color-neutral-900: #111827;

  /* ---- Typography ---- */
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', 'Cascadia Code', monospace;

  --text-xs:   0.75rem;
  --text-sm:   0.875rem;
  --text-base: 1rem;
  --text-lg:   1.125rem;
  --text-xl:   1.25rem;
  --text-2xl:  1.5rem;
  --text-3xl:  1.875rem;
  --text-4xl:  2.25rem;

  /* ---- Spacing (8px grid) ---- */
  --space-0:  0;
  --space-1:  0.25rem;
  --space-2:  0.5rem;
  --space-3:  0.75rem;
  --space-4:  1rem;
  --space-5:  1.25rem;
  --space-6:  1.5rem;
  --space-8:  2rem;
  --space-10: 2.5rem;
  --space-12: 3rem;
  --space-16: 4rem;
  --space-20: 5rem;
  --space-24: 6rem;

  /* ---- Border Radius ---- */
  --radius-sm:   0.25rem;
  --radius-md:   0.5rem;
  --radius-lg:   0.75rem;
  --radius-xl:   1rem;
  --radius-2xl:  1.5rem;
  --radius-full: 9999px;

  /* ---- Shadows ---- */
  --shadow-sm:  0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-md:  0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --shadow-lg:  0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
  --shadow-xl:  0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
  --shadow-glow: 0 0 20px rgb(99 102 241 / 0.3);
  --shadow-glow-success: 0 0 20px rgb(16 185 129 / 0.3);
  --shadow-glow-gold: 0 0 24px rgb(245 158 11 / 0.4);

  /* ---- Animation ---- */
  --duration-instant:  100ms;
  --duration-fast:     200ms;
  --duration-normal:   350ms;
  --duration-slow:     500ms;
  --duration-dramatic: 800ms;

  --ease-out:    cubic-bezier(0.33, 1, 0.68, 1);
  --ease-in:     cubic-bezier(0.32, 0, 0.67, 0);
  --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --ease-standard: cubic-bezier(0.2, 0, 0, 1);

  /* ---- Z-index scale ---- */
  --z-base:      0;
  --z-dropdown:  10;
  --z-sticky:    20;
  --z-overlay:   30;
  --z-modal:     40;
  --z-toast:     50;
  --z-tooltip:   60;
}

/* ================================
   2. DARK MODE TOKENS
   ================================ */

[data-theme="dark"] {
  --color-neutral-0:   #0F172A;
  --color-neutral-50:  #1E293B;
  --color-neutral-100: #334155;
  --color-neutral-200: #475569;
  --color-neutral-300: #64748B;
  --color-neutral-400: #94A3B8;
  --color-neutral-500: #CBD5E1;
  --color-neutral-600: #E2E8F0;
  --color-neutral-700: #F1F5F9;
  --color-neutral-800: #F8FAFC;
  --color-neutral-900: #FFFFFF;

  --color-primary-50:  #1E1B4B;
  --color-primary-100: #312E81;
}

/* ================================
   3. REDUCED MOTION
   ================================ */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* ================================
   4. BASE STYLES
   ================================ */

html {
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.5;
  color: var(--color-neutral-900);
  background-color: var(--color-neutral-50);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

body.modal-open {
  overflow: hidden;
}

.focus-anchor {
  scroll-margin-top: var(--space-6);
}

/* ================================
   5. PAGE TRANSITIONS
   ================================ */

/* --- MPA View Transitions (Chrome 126+, progressive enhancement) --- */
@view-transition {
  navigation: auto;
}

/* Assign view-transition-name to the main content region */
#main-content {
  view-transition-name: page;
  contain: layout;
}

/* Remove default root crossfade — only animate the page region */
::view-transition-old(root),
::view-transition-new(root) {
  animation: none;
  mix-blend-mode: normal;
}

/* Cross-page: old page exits */
::view-transition-old(page) {
  animation: page-fade-out var(--duration-fast) var(--ease-in) forwards;
}

/* Cross-page: new page enters */
::view-transition-new(page) {
  animation: page-fade-in var(--duration-normal) var(--ease-out) forwards;
}

/* Entry animation class (fallback: applied by JS on every page load) */
.page-enter {
  animation: page-fade-in var(--duration-normal) var(--ease-out) both;
}

/* HTMX partial swap entry */
.htmx-content-enter {
  animation: page-fade-in var(--duration-normal) var(--ease-out) both;
}

@keyframes page-fade-in {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes page-fade-out {
  from {
    opacity: 1;
    transform: translateY(0);
  }
  to {
    opacity: 0;
    transform: translateY(-8px);
  }
}

/* Reusable animation utilities (S-086) */
.animate-fade-in {
  animation: page-fade-in var(--duration-normal) var(--ease-out) both;
}

.animate-fade-up {
  animation: page-fade-in var(--duration-fast) var(--ease-out) both;
}

.animate-slide-in-right {
  animation: slide-in-right var(--duration-normal) var(--ease-out) both;
}

@keyframes slide-in-right {
  from {
    opacity: 0;
    transform: translateX(20px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.animate-scale-in {
  animation: scale-in var(--duration-fast) var(--ease-spring) both;
}

@keyframes scale-in {
  from {
    opacity: 0;
    transform: scale(0.92);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

/* ================================
   6. COMPONENT STYLES
   ================================ */

/* --- Buttons --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-4);
  font-size: var(--text-sm);
  font-weight: 500;
  line-height: 1.5;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all var(--duration-fast) var(--ease-out);
  text-decoration: none;
}

.btn:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.btn:active {
  transform: translateY(0);
  box-shadow: var(--shadow-sm);
}

.btn:focus-visible {
  outline: 3px solid var(--color-primary-400);
  outline-offset: 2px;
}

.btn--primary {
  background-color: var(--color-primary-500);
  color: white;
}
.btn--primary:hover {
  background-color: var(--color-primary-600);
}

.btn--secondary {
  background-color: transparent;
  color: var(--color-primary-600);
  border-color: var(--color-primary-300);
}
.btn--secondary:hover {
  background-color: var(--color-primary-50);
}

.btn--ghost {
  background-color: transparent;
  color: var(--color-neutral-600);
}
.btn--ghost:hover {
  background-color: var(--color-neutral-100);
}

.btn--danger {
  background-color: var(--color-error-500);
  color: white;
}
.btn--danger:hover {
  background-color: var(--color-error-700);
}

.btn--success {
  background-color: var(--color-success-500);
  color: white;
}
.btn--success:hover {
  background-color: var(--color-success-700);
}

/* --- Cards --- */
.card {
  background: var(--color-neutral-0);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: var(--space-6);
  transition: all var(--duration-fast) var(--ease-out);
}

.card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.card--flat {
  box-shadow: none;
  border: 1px solid var(--color-neutral-200);
}

/* --- Progress Bar --- */
.progress-bar {
  height: 8px;
  background: var(--color-neutral-200);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.progress-bar__fill {
  height: 100%;
  background: linear-gradient(90deg, var(--color-primary-400), var(--color-primary-600));
  border-radius: var(--radius-full);
  transition: width var(--duration-slow) var(--ease-in-out);
}

.progress-bar__fill--success {
  background: linear-gradient(90deg, var(--color-success-500), var(--color-success-700));
}

/* --- Toast Notification --- */
.toast {
  position: fixed;
  bottom: var(--space-6);
  right: var(--space-6);
  padding: var(--space-4) var(--space-6);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  z-index: var(--z-toast);
  animation: toast-in var(--duration-normal) var(--ease-spring) forwards;
}

.toast--leaving {
  animation: toast-out var(--duration-fast) var(--ease-in) forwards;
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateX(100%) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateX(0) scale(1);
  }
}

@keyframes toast-out {
  to {
    opacity: 0;
    transform: translateX(100%) scale(0.95);
  }
}

/* --- Badge --- */
.badge {
  display: inline-flex;
  align-items: center;
  padding: var(--space-1) var(--space-2);
  font-size: var(--text-xs);
  font-weight: 500;
  border-radius: var(--radius-full);
  line-height: 1;
}

.badge--primary { background: var(--color-primary-100); color: var(--color-primary-700); }
.badge--success { background: var(--color-success-100); color: var(--color-success-700); }
.badge--warning { background: var(--color-warning-100); color: var(--color-warning-700); }
.badge--error   { background: var(--color-error-100);   color: var(--color-error-700); }

/* ================================
   7. SKILL TREE STYLES
   ================================ */

.skill-tree {
  position: relative;
  width: 100%;
  min-height: clamp(420px, 72vh, 860px);
  height: clamp(420px, 72vh, 860px);
  overflow: hidden;
  isolation: isolate;
  background:
    linear-gradient(135deg, #0f0b1e 0%, #1a1035 50%, #0d1b2a 100%);
  border-radius: var(--radius-xl);
}

.skill-tree__canvas {
  display: block;
  width: 100%;
  height: 100%;
  min-height: inherit;
  cursor: grab;
  touch-action: none;
}

.skill-tree__canvas:active {
  cursor: grabbing;
}

/* Node base */
.skill-node {
  cursor: pointer;
}

.skill-node-anchor,
.skill-node__visual-layer,
.skill-node__motion-layer,
.skill-node__label-layer {
  transform-box: fill-box;
}

.skill-node__visual-layer,
.skill-node__motion-layer,
.skill-node__label-layer {
  transform-origin: center;
}

.skill-node__visual-layer {
  transition: transform var(--duration-fast) var(--ease-out);
}

.skill-node__motion-layer {
  transition: transform var(--duration-fast) var(--ease-out),
              filter var(--duration-fast) var(--ease-out),
              opacity var(--duration-fast) var(--ease-out);
}

.skill-node__label-layer {
  transition: opacity var(--duration-fast) var(--ease-out),
              transform var(--duration-fast) var(--ease-out);
}

.skill-node:hover .skill-node__visual-layer {
  transform: scale(1.08);
}

.skill-node:focus-visible {
  outline: none;
}

.skill-node__focus-ring {
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--duration-fast) var(--ease-out);
}

.skill-node:focus-visible .skill-node__focus-ring {
  opacity: 1;
}

/* Node states */
.skill-node--locked {
  opacity: 0.4;
}

.skill-node--locked .skill-node__motion-layer {
  filter: grayscale(60%);
}

.skill-node--in-progress {
  /* Animated ring via SVG stroke-dashoffset */
}

.skill-node--completed {
  filter: none;
}

.skill-node--milestone {
  transform-origin: center;
}

.skill-node__motion-layer--available .skill-node__visual-layer {
  animation: node-pulse 2.5s var(--ease-in-out) infinite;
}

/* Pulse glow animation */
@keyframes node-pulse {
  0%, 100% {
    filter: drop-shadow(0 0 8px rgb(99 102 241 / 0.2));
  }
  50% {
    filter: drop-shadow(0 0 20px rgb(99 102 241 / 0.5));
  }
}

/* Celebration animation */
@keyframes node-celebrate {
  0% { transform: scale(1); }
  30% { transform: scale(1.15); }
  50% { transform: scale(0.95); }
  70% { transform: scale(1.05); }
  100% { transform: scale(1); }
}

/* Milestone unlock */
@keyframes milestone-unlock {
  0% {
    transform: scale(0.8) rotate(-5deg);
    opacity: 0;
  }
  50% {
    transform: scale(1.2) rotate(2deg);
  }
  100% {
    transform: scale(1) rotate(0deg);
    opacity: 1;
  }
}

/* Path drawing */
.skill-path {
  stroke: var(--color-neutral-200);
  stroke-width: 3;
  stroke-dasharray: 8 4;
  fill: none;
  transition: all var(--duration-slow) var(--ease-out);
}

.skill-path--unlocked {
  stroke: var(--color-primary-400);
  stroke-dasharray: none;
  filter: drop-shadow(0 0 4px rgb(99 102 241 / 0.3));
}

.skill-path--completed {
  stroke: var(--color-success-500);
  stroke-width: 4;
  filter: drop-shadow(0 0 6px rgb(16 185 129 / 0.3));
}

.skill-path--animating {
  animation: draw-path var(--duration-slow) var(--ease-out) forwards;
}

@keyframes draw-path {
  from { stroke-dashoffset: 100%; }
  to   { stroke-dashoffset: 0; }
}

/* Detail slide-in panel */
.skill-detail-panel {
  position: fixed;
  top: 0;
  right: 0;
  width: min(450px, 90vw);
  height: 100vh;
  background: var(--color-neutral-0);
  box-shadow: var(--shadow-xl);
  z-index: var(--z-modal);
  transform: translateX(100%);
  transition: transform var(--duration-normal) var(--ease-out);
  overflow-y: auto;
}

.skill-detail-panel[hidden],
.skill-detail-panel__overlay[hidden],
.orb-detail-panel[hidden],
.orb-detail-panel__overlay[hidden] {
  display: none !important;
}

.skill-detail-panel--open {
  transform: translateX(0);
}

.skill-detail-panel__overlay {
  position: fixed;
  inset: 0;
  background: rgb(0 0 0 / 0.3);
  z-index: calc(var(--z-modal) - 1);
  opacity: 0;
  transition: opacity var(--duration-normal) var(--ease-out);
  pointer-events: none;
}

.skill-detail-panel__overlay--visible {
  opacity: 1;
  pointer-events: auto;
}

/* ---- Premium Skill Tree Enhancements ---- */

/* Grid overlay */
.skill-tree::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(99, 102, 241, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(99, 102, 241, 0.03) 1px, transparent 1px);
  background-size: 40px 40px;
  pointer-events: none;
}

/* Ambient particles */
.st-particle {
  animation: particle-float 6s ease-in-out infinite alternate;
}

@keyframes particle-float {
  0%   { transform: translate(0, 0); opacity: 0.08; }
  50%  { transform: translate(8px, -12px); opacity: 0.2; }
  100% { transform: translate(-5px, 10px); opacity: 0.06; }
}

/* Pulse rings around available nodes */
.st-pulse-ring {
  animation: st-ring-pulse 2s ease-in-out infinite;
  transform-origin: center;
}

@keyframes st-ring-pulse {
  0%, 100% { opacity: 0.15; transform: scale(1); }
  50%      { opacity: 0.04; transform: scale(1.15); }
}

/* Node glow halos */
.st-node-glow {
  filter: blur(2px);
  opacity: 0.3;
}

.st-node-glow--available {
  animation: glow-pulse 2.5s ease-in-out infinite;
}

@keyframes glow-pulse {
  0%, 100% { opacity: 0.2; }
  50%      { opacity: 0.45; }
}

/* Milestone golden glow */
.st-milestone-glow .st-hex-main {
  animation: gold-shimmer 3s ease-in-out infinite;
}

@keyframes gold-shimmer {
  0%, 100% { filter: drop-shadow(0 0 6px rgba(251, 191, 36, 0.2)); }
  50%      { filter: drop-shadow(0 0 16px rgba(251, 191, 36, 0.5)); }
}

/* Node float animation (subtle idle) */
.skill-node__motion-layer--available,
.skill-node__motion-layer--in-progress {
  animation: node-float 4s ease-in-out infinite;
}

@keyframes node-float {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-3px); }
}

/* Celebrate bounce */
.st-node-celebrate {
  animation: node-celebrate 0.6s var(--ease-out) forwards;
}

/* Entrance stagger */
.st-entrance {
  animation: st-fade-in 0.4s ease-out forwards;
}

@keyframes st-fade-in {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Energy flow on paths */
.skill-path-energy {
  stroke: url(#path-gradient-unlocked);
  stroke-width: 2;
  fill: none;
  stroke-dasharray: 12 20;
  animation: path-energy 1.5s linear infinite;
}

@keyframes path-energy {
  from { stroke-dashoffset: 0; }
  to   { stroke-dashoffset: -32; }
}

/* Path glow */
.skill-path-glow {
  fill: none;
  stroke-width: 8;
  stroke-linecap: round;
}

.skill-path-glow--unlocked {
  stroke: rgba(99, 102, 241, 0.08);
}

.skill-path-glow--completed {
  stroke: rgba(16, 185, 129, 0.08);
}

/* Node title text */
.st-node-title {
  font-family: var(--font-sans);
  pointer-events: none;
  -webkit-user-select: none;
  user-select: none;
}

/* Tooltip (foreignObject) */
.st-tooltip-fo {
  pointer-events: none;
  overflow: visible;
}

.st-tooltip {
  background: rgba(15, 11, 30, 0.92);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(99, 102, 241, 0.25);
  border-radius: var(--radius-lg);
  padding: var(--space-2) var(--space-3);
  color: rgba(255, 255, 255, 0.9);
  font-size: 0.75rem;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  animation: st-tooltip-in 0.15s ease-out forwards;
}

@keyframes st-tooltip-in {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

.st-tooltip__title {
  font-weight: 700;
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.st-tooltip__row {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}

.st-tooltip__time {
  margin-top: 4px;
  color: rgba(255, 255, 255, 0.5);
  font-size: 0.6875rem;
}

/* Badges */
.st-badge {
  display: inline-flex;
  align-items: center;
  padding: 1px 6px;
  border-radius: var(--radius-full);
  font-size: 0.625rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.st-badge--type {
  background: rgba(99, 102, 241, 0.2);
  color: rgb(199, 202, 255);
}

.st-badge--locked {
  background: rgba(100, 100, 120, 0.25);
  color: rgba(255, 255, 255, 0.55);
}

.st-badge--available {
  background: rgba(99, 102, 241, 0.2);
  color: rgb(199, 202, 255);
}

.st-badge--in-progress {
  background: rgba(245, 158, 11, 0.2);
  color: rgb(255, 220, 140);
}

.st-badge--completed {
  background: rgba(16, 185, 129, 0.2);
  color: rgb(140, 240, 200);
}

/* Detail panel enhancements */
.st-detail-accent {
  height: 4px;
  width: 100%;
  border-radius: var(--radius-full);
  margin-bottom: var(--space-3);
}

.st-detail-header {
  display: flex;
  gap: var(--space-2);
  margin-bottom: var(--space-2);
}

.st-detail-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--color-neutral-900);
  margin-bottom: var(--space-1);
}

.st-detail-time {
  font-size: 0.875rem;
  color: var(--color-neutral-500);
  margin-bottom: var(--space-4);
}

.st-detail-body {
  margin-top: var(--space-4);
  line-height: 1.6;
}

.st-detail-btn {
  display: block;
  width: 100%;
  padding: var(--space-3) var(--space-4);
  border: none;
  border-radius: var(--radius-lg);
  font-weight: 700;
  font-size: 0.9375rem;
  cursor: pointer;
  margin-top: var(--space-4);
  transition: transform var(--duration-fast) var(--ease-out),
              box-shadow var(--duration-fast) var(--ease-out);
}

.st-detail-btn:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.st-detail-btn--start {
  background: var(--color-primary-600);
  color: var(--color-neutral-0);
}

.st-detail-btn--complete {
  background: var(--color-success-600);
  color: var(--color-neutral-0);
}

.st-detail-completed {
  text-align: center;
  padding: var(--space-3);
  font-size: 1rem;
  font-weight: 600;
  color: var(--color-success-600);
}

/* Toast notification */
.skill-tooltip {
  position: fixed;
  bottom: var(--space-6);
  left: 50%;
  transform: translateX(-50%);
  background: rgba(15, 11, 30, 0.92);
  color: rgba(255, 255, 255, 0.9);
  padding: var(--space-3) var(--space-6);
  border-radius: var(--radius-lg);
  font-size: 0.875rem;
  font-weight: 600;
  z-index: var(--z-toast);
  animation: st-toast-in 0.2s ease-out forwards;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}

.skill-tooltip--out {
  animation: st-toast-out 0.2s ease-in forwards;
}

@keyframes st-toast-in {
  from { opacity: 0; transform: translateX(-50%) translateY(16px); }
  to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}

@keyframes st-toast-out {
  from { opacity: 1; transform: translateX(-50%) translateY(0); }
  to   { opacity: 0; transform: translateX(-50%) translateY(16px); }
}

/* ---- Mobile List-Tree View ---- */

.st-mobile-tree {
  min-height: 0;
  background: transparent;
  padding: 0;
}

.st-mobile-tree::before {
  display: none;
}

.st-mobile-list {
  display: flex;
  flex-direction: column;
}

.st-mobile-item {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  position: relative;
  cursor: pointer;
  border-radius: var(--radius-lg);
  transition: background var(--duration-fast) var(--ease-out);
}

.st-mobile-item:hover {
  background: rgba(99, 102, 241, 0.06);
}

.st-mobile-item__line {
  position: absolute;
  left: 28px;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--color-neutral-200);
}

.st-mobile-item:last-child .st-mobile-item__line {
  display: none;
}

.st-mobile-item__dot {
  flex-shrink: 0;
  font-size: 1rem;
  z-index: 1;
  width: 24px;
  text-align: center;
}

.st-mobile-item__content {
  flex: 1;
  min-width: 0;
}

.st-mobile-item__title {
  font-weight: 600;
  font-size: 0.9375rem;
  color: var(--color-neutral-900);
  margin-bottom: 2px;
}

.st-mobile-item--locked .st-mobile-item__title {
  color: var(--color-neutral-400);
}

.st-mobile-item--locked {
  cursor: default;
  opacity: 0.6;
}

.st-mobile-item__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  align-items: center;
}

.st-mobile-item__time {
  font-size: 0.6875rem;
  color: var(--color-neutral-500);
}

.st-mobile-item__milestone {
  font-size: 1.125rem;
  align-self: center;
}

/* ---- Reduced Motion ---- */

@media (prefers-reduced-motion: reduce) {
  .st-particle,
  .st-pulse-ring,
  .st-node-glow--available,
  .st-milestone-glow .st-hex-main,
  .skill-node__motion-layer--available,
  .skill-node__motion-layer--in-progress,
  .skill-node__motion-layer--available .skill-node__visual-layer,
  .skill-path-energy,
  .st-entrance {
    animation: none !important;
  }

  .skill-node__motion-layer--available .skill-node__visual-layer {
    filter: drop-shadow(0 0 12px rgb(99 102 241 / 0.35));
  }
}

/* ================================
   8. CONFETTI PARTICLES
   ================================ */

.confetti-container {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: var(--z-toast);
  overflow: hidden;
}

.confetti-particle {
  position: absolute;
  width: 10px;
  height: 10px;
  border-radius: 2px;
  animation: confetti-fall var(--duration-dramatic) var(--ease-out) forwards;
}

@keyframes confetti-fall {
  0% {
    opacity: 1;
    transform: translateY(0) rotate(0deg) scale(1);
  }
  100% {
    opacity: 0;
    transform: translateY(400px) rotate(720deg) scale(0.5);
  }
}

/* ================================
   9. RESPONSIVE UTILITIES
   ================================ */

@media (max-width: 640px) {
  .skill-tree {
    height: auto;
    min-height: 0;
  }

  .skill-detail-panel {
    width: 100vw;
    height: auto;
    max-height: 85vh;
    top: auto;
    bottom: 0;
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
    transform: translateY(100%);
  }

  .skill-detail-panel--open {
    transform: translateY(0);
  }
}

/* ================================
   10. WCAG 2.1 AA — ACCESSIBILITY (S-054)
   ================================ */

/* Skip navigation link */
.skip-link {
  position: absolute;
  top: -100%;
  left: var(--space-4);
  z-index: var(--z-tooltip);
  padding: var(--space-2) var(--space-4);
  background: var(--color-primary-600);
  color: var(--color-neutral-0);
  font-weight: 600;
  border-radius: 0 0 var(--radius-md) var(--radius-md);
  text-decoration: none;
  transition: top var(--duration-fast) var(--ease-out);
}

.skip-link:focus {
  top: 0;
}

/* Universal focus indicator — WCAG 2.4.7 */
:focus-visible {
  outline: 3px solid var(--color-primary-400);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

:focus:not(:focus-visible) {
  outline: none;
}

/* Screen reader only */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.htmx-results-summary {
  font-size: var(--text-sm);
  color: var(--color-neutral-600);
}

@media (forced-colors: active) {
  :focus-visible {
    outline: 2px solid CanvasText;
  }

  .btn,
  .modal-content,
  .skill-detail-panel,
  .orb-detail-panel,
  .orb-mobile-card,
  .progress-bar {
    forced-color-adjust: auto;
    border: 1px solid CanvasText;
  }

  .progress-bar__fill,
  .orb-mobile-card__progress-bar {
    background: Highlight;
  }

  .skip-link {
    border: 1px solid CanvasText;
  }
}

/* ================================
   11. BREADCRUMBS (S-053)
   ================================ */

.breadcrumbs {
  margin-bottom: var(--space-4);
}

.breadcrumbs__list {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-1);
  list-style: none;
  padding: 0;
  margin: 0;
  font-size: var(--text-sm);
}

.breadcrumbs__link {
  color: var(--color-primary-600);
  text-decoration: none;
}

.breadcrumbs__link:hover {
  text-decoration: underline;
}

.breadcrumbs__current {
  color: var(--color-neutral-500);
  font-weight: 500;
}

.breadcrumbs__separator {
  color: var(--color-neutral-400);
}

/* ================================
   12. TOAST NOTIFICATIONS (S-053)
   ================================ */

.toast-container {
  position: fixed;
  bottom: var(--space-6);
  right: var(--space-6);
  z-index: var(--z-toast);
  display: flex;
  flex-direction: column-reverse;
  gap: var(--space-2);
}

@media (max-width: 640px) {
  .toast-container {
    left: var(--space-4);
    right: var(--space-4);
    bottom: var(--space-4);
  }
}

.toast--success { background: var(--color-success-50); border-left: 4px solid var(--color-success-500); color: var(--color-success-700); }
.toast--warning { background: var(--color-warning-50); border-left: 4px solid var(--color-warning-500); color: var(--color-warning-700); }
.toast--error   { background: var(--color-error-50);   border-left: 4px solid var(--color-error-500);   color: var(--color-error-700); }
.toast--info    { background: var(--color-info-50);    border-left: 4px solid var(--color-info-500);    color: var(--color-info-700); }

.toast__icon {
  font-size: var(--text-lg);
}

.toast__message {
  flex: 1;
}

.toast__close {
  background: none;
  border: none;
  cursor: pointer;
  padding: var(--space-1);
  opacity: 0.7;
  font-size: var(--text-base);
}

.toast__close:hover {
  opacity: 1;
}

.toast-enter {
  animation: toast-in var(--duration-normal) var(--ease-spring) forwards;
}

.toast-leave {
  animation: toast-out var(--duration-fast) var(--ease-in) forwards;
}

/* ================================
   13. RESPONSIVE TABLES (S-053)
   ================================ */

.table--responsive {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-sm);
}

.table thead th {
  padding: var(--space-3) var(--space-4);
  text-align: left;
  font-weight: 600;
  color: var(--color-neutral-700);
  background: var(--color-neutral-50);
  border-bottom: 2px solid var(--color-neutral-200);
}

.table tbody td {
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--color-neutral-200);
  color: var(--color-neutral-600);
}

.table--striped tbody tr:nth-child(even) {
  background: var(--color-neutral-50);
}

.table tbody tr:hover {
  background: var(--color-primary-50);
}

@media (max-width: 768px) {
  .table--responsive thead { display: none; }
  .table--responsive tbody tr {
    display: block;
    padding: var(--space-4);
    margin-bottom: var(--space-2);
    background: var(--color-neutral-0);
    border: 1px solid var(--color-neutral-200);
    border-radius: var(--radius-lg);
  }
  .table--responsive tbody td {
    display: flex;
    justify-content: space-between;
    padding: var(--space-2) 0;
    border-bottom: 1px solid var(--color-neutral-100);
  }
  .table--responsive tbody td::before {
    content: attr(data-label);
    font-weight: 600;
    color: var(--color-neutral-700);
    margin-right: var(--space-4);
  }
  .table--responsive tbody td:last-child { border-bottom: none; }
}

/* ================================
   14. LOADING STATES (S-053)
   ================================ */

.htmx-loading {
  position: relative;
  min-height: 4rem;
}

.htmx-loading::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg,
    var(--color-neutral-100) 25%,
    var(--color-neutral-200) 50%,
    var(--color-neutral-100) 75%
  );
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius-md);
  z-index: 1;
}

@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.is-loading {
  pointer-events: none;
  opacity: 0.7;
}

.is-loading::after {
  content: '';
  display: inline-block;
  width: 1em;
  height: 1em;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: var(--radius-full);
  animation: spin 0.6s linear infinite;
  margin-left: var(--space-2);
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ================================
   15. NAVIGATION ACTIVE STATE (S-053)
   ================================ */

.nav-link--active {
  color: var(--color-primary-600) !important;
  font-weight: 600;
  position: relative;
}

.nav-link--active::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: var(--space-3);
  right: var(--space-3);
  height: 2px;
  background: var(--color-primary-500);
  border-radius: var(--radius-full);
}

/* ================================
   16. SEARCH (S-056)
   ================================ */

.search {
  position: relative;
}

.search__input {
  padding: var(--space-2) var(--space-3) var(--space-2) var(--space-8);
  border: 1px solid var(--color-neutral-300);
  border-radius: var(--radius-full);
  font-size: var(--text-sm);
  background: var(--color-neutral-50);
  width: 16rem;
  transition: width var(--duration-fast) var(--ease-out),
              border-color var(--duration-fast) var(--ease-out);
}

.search__input:focus {
  width: 24rem;
  border-color: var(--color-primary-400);
  background: var(--color-neutral-0);
}

.search__dropdown {
  position: absolute;
  top: calc(100% + var(--space-2));
  left: 0;
  right: 0;
  min-width: 24rem;
  background: var(--color-neutral-0);
  border: 1px solid var(--color-neutral-200);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  z-index: var(--z-dropdown);
  max-height: 24rem;
  overflow-y: auto;
}

.search__section {
  padding: var(--space-2) 0;
  border-bottom: 1px solid var(--color-neutral-100);
}

.search__heading {
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--color-neutral-500);
  text-transform: uppercase;
  padding: var(--space-1) var(--space-4);
}

.search__item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-2) var(--space-4);
  color: var(--color-neutral-700);
  text-decoration: none;
  font-size: var(--text-sm);
}

.search__item:hover {
  background: var(--color-primary-50);
}

.search__footer {
  display: block;
  padding: var(--space-2) var(--space-4);
  text-align: center;
  font-size: var(--text-sm);
  color: var(--color-primary-600);
  text-decoration: none;
  border-top: 1px solid var(--color-neutral-100);
}

.search__footer:hover {
  background: var(--color-primary-50);
}

.search__empty {
  padding: var(--space-4);
  text-align: center;
  color: var(--color-neutral-500);
  font-size: var(--text-sm);
}

.search-results {
  margin-bottom: var(--space-6);
}

.search-results__list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.search-results__item {
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--color-neutral-100);
}

.search-results__item a {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  text-decoration: none;
  color: var(--color-neutral-900);
}

.search-results__item a:hover .search-results__title {
  color: var(--color-primary-600);
}

.search-results__title {
  font-weight: 500;
}

.search-results__desc {
  font-size: var(--text-sm);
  color: var(--color-neutral-500);
  margin-top: var(--space-1);
}

/* ================================
   17. DARK MODE EXTENDED (S-055)
   ================================ */

[data-theme="dark"] {
  --color-success-50:  #064E3B;
  --color-success-100: #065F46;
  --color-warning-50:  #78350F;
  --color-warning-100: #92400E;
  --color-error-50:    #7F1D1D;
  --color-error-100:   #991B1B;
  --color-info-50:     #1E3A5F;
  --color-info-100:    #1E40AF;

  --shadow-sm:  0 1px 2px 0 rgb(0 0 0 / 0.3);
  --shadow-md:  0 4px 6px -1px rgb(0 0 0 / 0.4), 0 2px 4px -2px rgb(0 0 0 / 0.3);
  --shadow-lg:  0 10px 15px -3px rgb(0 0 0 / 0.4), 0 4px 6px -4px rgb(0 0 0 / 0.3);
  --shadow-xl:  0 20px 25px -5px rgb(0 0 0 / 0.4), 0 8px 10px -6px rgb(0 0 0 / 0.3);
}

/* Dark mode theme toggle */
.theme-toggle {
  padding: var(--space-2);
  border-radius: var(--radius-full);
  background: transparent;
  border: none;
  cursor: pointer;
  font-size: var(--text-lg);
  transition: background-color var(--duration-fast) var(--ease-out);
  min-width: 44px;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.theme-toggle:hover {
  background: var(--color-neutral-100);
}

/* Utility classes using design tokens (replaces Tailwind color classes) */
.bg-surface       { background-color: var(--color-neutral-0); }
.bg-surface-alt   { background-color: var(--color-neutral-50); }
.bg-surface-muted { background-color: var(--color-neutral-100); }
.text-primary-ds  { color: var(--color-neutral-900); }
.text-secondary   { color: var(--color-neutral-600); }
.text-muted       { color: var(--color-neutral-500); }
.text-brand       { color: var(--color-primary-600); }
.text-error       { color: var(--color-error-500); }
.border-default   { border-color: var(--color-neutral-200); }

/* Smooth color transitions */
html[data-theme] {
  transition: background-color var(--duration-fast) var(--ease-out),
              color var(--duration-fast) var(--ease-out);
}

@media (prefers-reduced-motion: reduce) {
  html[data-theme] { transition: none; }
}

/* ================================
   18. MODAL (S-058)
   ================================ */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgb(0 0 0 / 0.5);
  z-index: var(--z-modal);
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-overlay.hidden {
  display: none;
}

.modal-content {
  background: var(--color-neutral-0);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl);
  width: min(500px, 90vw);
  max-height: 80vh;
  overflow-y: auto;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-4) var(--space-6);
  border-bottom: 1px solid var(--color-neutral-200);
}

.modal-header h2 {
  font-size: var(--text-lg);
  font-weight: 600;
  margin: 0;
}

.modal-close {
  font-size: var(--text-lg);
}

.modal-body {
  padding: var(--space-4) var(--space-6);
}

.modal-body h3 {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-neutral-500);
  text-transform: uppercase;
  margin: var(--space-4) 0 var(--space-2);
}

.modal-body h3:first-child {
  margin-top: 0;
}

kbd {
  display: inline-block;
  padding: var(--space-1) var(--space-2);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  background: var(--color-neutral-100);
  border: 1px solid var(--color-neutral-300);
  border-radius: var(--radius-sm);
  line-height: 1;
}

/* ================================
   19. FORM COMPONENTS (S-085)
   ================================ */

/* --- Form Group --- */
.form-group {
  margin-bottom: var(--space-4);
}

.form-group--required .form-group__label::after {
  content: " *";
  color: var(--color-error-500);
}

/* --- Form Label --- */
.form-group__label,
.form-label {
  display: block;
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--color-neutral-700);
  margin-bottom: var(--space-1);
}

/* --- Form Input --- */
.form-group__input,
.form-input {
  display: block;
  width: 100%;
  padding: var(--space-2) var(--space-3);
  font-size: var(--text-base);
  font-family: var(--font-sans);
  color: var(--color-neutral-900);
  background-color: var(--color-neutral-0);
  border: 1px solid var(--color-neutral-300);
  border-radius: var(--radius-md);
  transition: border-color var(--duration-fast) var(--ease-out),
              box-shadow var(--duration-fast) var(--ease-out);
}

.form-group__input:focus,
.form-input:focus {
  outline: none;
  border-color: var(--color-primary-400);
  box-shadow: 0 0 0 3px rgb(99 102 241 / 0.15);
}

.form-group__input:focus-visible,
.form-input:focus-visible {
  outline: 3px solid var(--color-primary-400);
  outline-offset: 2px;
}

.form-group__input::placeholder,
.form-input::placeholder {
  color: var(--color-neutral-400);
}

/* --- Form Select --- */
.form-select {
  display: block;
  width: 100%;
  padding: var(--space-2) var(--space-3);
  padding-right: var(--space-8);
  font-size: var(--text-base);
  font-family: var(--font-sans);
  color: var(--color-neutral-900);
  background-color: var(--color-neutral-0);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%236B7280' d='M2 4l4 4 4-4'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right var(--space-3) center;
  background-size: 12px;
  border: 1px solid var(--color-neutral-300);
  border-radius: var(--radius-md);
  appearance: none;
  transition: border-color var(--duration-fast) var(--ease-out);
}

.form-select:focus {
  outline: none;
  border-color: var(--color-primary-400);
  box-shadow: 0 0 0 3px rgb(99 102 241 / 0.15);
}

.form-select:focus-visible {
  outline: 3px solid var(--color-primary-400);
  outline-offset: 2px;
}

/* --- Form Textarea --- */
.form-textarea {
  display: block;
  width: 100%;
  min-height: 6rem;
  padding: var(--space-2) var(--space-3);
  font-size: var(--text-base);
  font-family: var(--font-sans);
  color: var(--color-neutral-900);
  background-color: var(--color-neutral-0);
  border: 1px solid var(--color-neutral-300);
  border-radius: var(--radius-md);
  resize: vertical;
  transition: border-color var(--duration-fast) var(--ease-out);
}


/* ================================
   22. ORB MODULE SYSTEM (S-096/097/098)
   ================================ */

/* ---- Galaxy Container ---- */

.orb-galaxy {
  position: relative;
  background: radial-gradient(ellipse at center, #120a2a 0%, #080515 100%);
  min-height: 600px;
  overflow: hidden;
  cursor: grab;
}

.orb-galaxy__svg {
  display: block;
}

/* ---- Star Particles ---- */

@keyframes star-twinkle {
  0%, 100% { opacity: 0.15; }
  50% { opacity: 0.9; }
}

.orb-star-particle {
  animation: star-twinkle 4s ease-in-out infinite;
}

/* ---- Orb Glow Pulse (breathing aura for available orbs) ---- */

@keyframes orb-glow-pulse {
  0%, 100% { opacity: 0.25; stroke-width: 1.5; }
  50% { opacity: 0.6; stroke-width: 2.5; }
}

.orb-glow-ring {
  animation: orb-glow-pulse 3.5s ease-in-out infinite;
}

/* ---- Orb Orbit (progress ring rotation) ---- */

@keyframes orb-orbit {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.orb-progress-ring {
  animation: orb-orbit 8s linear infinite;
}

/* ---- Decorative ring rotation (slow) ---- */

@keyframes deco-ring-rotate {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.orb-rotate-ring {
  animation: deco-ring-rotate 20s linear infinite;
}

/* ---- Energy particle orbit around center ---- */

@keyframes energy-particle-orbit {
  0%   { opacity: 0.3; transform: rotate(0deg) translateX(8px) rotate(0deg); }
  50%  { opacity: 0.8; }
  100% { opacity: 0.3; transform: rotate(360deg) translateX(8px) rotate(-360deg); }
}

.orb-energy-particle {
  animation: energy-particle-orbit 12s linear infinite;
}

/* ---- Orbiting micro-dots on available orbs ---- */

@keyframes orbit-dot {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.orb-orbit-dot {
  animation: orbit-dot 6s linear infinite;
}

/* ---- Energy dot pulse along active connections ---- */

@keyframes energy-dot-pulse {
  0%, 100% { opacity: 0.2; r: 1.5; }
  50% { opacity: 0.9; r: 3; }
}

.orb-energy-dot {
  animation: energy-dot-pulse 2s ease-in-out infinite;
}

/* ---- Path energy flow for active constellation lines ---- */

@keyframes path-energy {
  from { stroke-dashoffset: 0; }
  to { stroke-dashoffset: -20; }
}

/* ---- Orb Zoom In ---- */

@keyframes orb-zoom-in {
  0% { transform: scale(1); opacity: 1; }
  100% { transform: scale(8); opacity: 0; }
}

/* ---- Orb Content Reveal ---- */

@keyframes orb-content-reveal {
  0% { transform: scale(0.85); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

/* ---- Orb Module Base ---- */

.orb-module {
  cursor: pointer;
  transition: transform var(--duration-normal) cubic-bezier(0.34, 1.56, 0.64, 1),
              opacity var(--duration-fast) var(--ease-out);
}

.orb-module:focus-visible {
  outline: 3px solid var(--color-primary-400);
  outline-offset: 4px;
}

.orb-module__icon {
  pointer-events: none;
}

/* ---- Orb State Variants ---- */

.orb-module--locked {
  cursor: default;
  opacity: 0.3;
  filter: grayscale(1);
}

.orb-module--available {
  opacity: 1;
}

.orb-module--in-progress {
  opacity: 1;
}

.orb-module--completed {
  opacity: 1;
}

/* ---- Constellation Lines ---- */

.constellation-line {
  stroke: rgba(99, 102, 241, 0.15);
  stroke-width: 1;
  stroke-dasharray: 6 4;
}

.constellation-line--active {
  stroke: rgba(99, 102, 241, 0.4);
  stroke-width: 1.5;
  stroke-dasharray: none;
  animation: path-energy 3s linear infinite;
}

.constellation-line--completed {
  stroke: rgba(16, 185, 129, 0.5);
  stroke-width: 2;
  stroke-dasharray: none;
}

/* ---- Detail Panel ---- */

.orb-detail-panel {
  position: fixed;
  top: 0;
  right: -440px;
  width: 420px;
  max-width: 90vw;
  height: 100vh;
  background: #13102a;
  border-left: 1px solid rgba(99, 102, 241, 0.2);
  z-index: 1100;
  overflow-y: auto;
  transition: right var(--duration-normal) var(--ease-out);
  color: #e0e7ff;
}

.orb-detail-panel.is-open {
  right: 0;
}

.orb-detail-panel__overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 1050;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--duration-normal) var(--ease-out);
}

.orb-detail-panel__overlay.is-open {
  opacity: 1;
  pointer-events: auto;
}

/* ---- Detail Content ---- */

.orb-detail__header {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-bottom: var(--space-4);
}

.orb-detail__icon {
  font-size: 2rem;
}

.orb-detail__title {
  font-size: 1.25rem;
  font-weight: 700;
  color: #fff;
  margin: 0;
}

.orb-detail__subtitle {
  font-size: 0.875rem;
  color: #9CA3AF;
  margin: 0;
}

.orb-detail__progress {
  height: 4px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 2px;
  margin-bottom: var(--space-4);
  overflow: hidden;
}

.orb-detail__progress-fill {
  height: 100%;
  border-radius: 2px;
  transition: width var(--duration-normal) var(--ease-out);
}

.orb-detail__items {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.orb-detail__item {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  padding: var(--space-3);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.04);
}

.orb-detail__item--completed {
  opacity: 0.7;
}

.orb-detail__item--locked {
  opacity: 0.4;
}

.orb-detail__item-status {
  flex-shrink: 0;
  font-size: 1rem;
}

.orb-detail__item-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.orb-detail__item-title {
  font-size: 0.875rem;
  font-weight: 500;
  color: #e0e7ff;
}

.orb-detail__item-meta {
  font-size: 0.75rem;
  color: #9CA3AF;
}

.orb-detail__badge {
  display: inline-block;
  padding: 1px 6px;
  font-size: 0.625rem;
  font-weight: 600;
  background: rgba(245, 158, 11, 0.2);
  color: #F59E0B;
  border-radius: var(--radius-sm);
  margin-left: var(--space-1);
}

/* ---- Preview Card ---- */

.orb-preview-card {
  position: fixed;
  z-index: 1200;
  background: #1e1b3a;
  border: 1px solid rgba(99, 102, 241, 0.3);
  border-radius: var(--radius-lg);
  padding: var(--space-3);
  min-width: 180px;
  max-width: 260px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
  pointer-events: none;
  animation: orb-content-reveal var(--duration-fast) var(--ease-out);
  color: #e0e7ff;
}

.orb-preview-card__title {
  font-weight: 700;
  font-size: 0.875rem;
  margin-bottom: var(--space-2);
}

.orb-preview-card__item {
  font-size: 0.75rem;
  padding: 2px 0;
  color: #c7d2fe;
}

.orb-preview-card__more {
  font-size: 0.7rem;
  color: #818CF8;
  margin-top: var(--space-1);
}

/* ---- Mobile Cards ---- */

.orb-mobile-card {
  background: rgba(255, 255, 255, 0.04);
  border-radius: var(--radius-lg);
  overflow: hidden;
  cursor: pointer;
  transition: background var(--duration-fast) var(--ease-out);
}

.orb-mobile-card:hover,
.orb-mobile-card:focus-visible {
  background: rgba(255, 255, 255, 0.08);
}

.orb-mobile-card:focus-visible {
  outline: 3px solid var(--color-primary-400);
  outline-offset: 2px;
}

.orb-mobile-card__header {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
}

.orb-mobile-card__icon {
  font-size: 1.5rem;
  flex-shrink: 0;
}

.orb-mobile-card__info {
  flex: 1;
  min-width: 0;
}

.orb-mobile-card__name {
  font-weight: 600;
  font-size: 0.875rem;
  color: #e0e7ff;
}

.orb-mobile-card__count {
  font-size: 0.75rem;
  color: #9CA3AF;
}

.orb-mobile-card__badge {
  flex-shrink: 0;
  font-size: 1rem;
}

.orb-mobile-card__progress {
  height: 3px;
  background: rgba(255, 255, 255, 0.1);
}

.orb-mobile-card__progress-bar {
  height: 100%;
  transition: width var(--duration-normal) var(--ease-out);
}

.orb-mobile-card__items {
  padding: 0 var(--space-4) var(--space-3);
}

.orb-mobile-card__item {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) 0;
  font-size: 0.8rem;
  color: #c7d2fe;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.orb-mobile-card__item-title {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.orb-mobile-card__item-meta {
  flex-shrink: 0;
  font-size: 0.7rem;
  color: #9CA3AF;
}

/* ---- Reduced Motion ---- */

@media (prefers-reduced-motion: reduce) {
  .orb-star-particle,
  .orb-glow-ring,
  .orb-progress-ring,
  .orb-rotate-ring,
  .orb-energy-particle,
  .orb-orbit-dot,
  .orb-energy-dot,
  .constellation-line--active {
    animation: none;
  }

  .orb-module {
    transition: none;
  }

  .orb-detail-panel {
    transition: none;
  }

  .orb-detail-panel__overlay {
    transition: none;
  }

  .orb-preview-card {
    animation: none;
  }
}

.form-textarea:focus {
  outline: none;
  border-color: var(--color-primary-400);
  box-shadow: 0 0 0 3px rgb(99 102 241 / 0.15);
}

.form-textarea:focus-visible {
  outline: 3px solid var(--color-primary-400);
  outline-offset: 2px;
}

/* --- Form Checkbox / Radio --- */
.form-checkbox,
.form-radio {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  cursor: pointer;
}

.form-checkbox input[type="checkbox"],
.form-radio input[type="radio"] {
  width: 1.125rem;
  height: 1.125rem;
  accent-color: var(--color-primary-500);
  cursor: pointer;
}

/* --- Validation States --- */
.form-input--error,
.form-group__input--error {
  border-color: var(--color-error-500);
}

.form-input--error:focus,
.form-group__input--error:focus {
  box-shadow: 0 0 0 3px rgb(239 68 68 / 0.15);
}

.form-input--success,
.form-group__input--success {
  border-color: var(--color-success-500);
}

.form-input--success:focus,
.form-group__input--success:focus {
  box-shadow: 0 0 0 3px rgb(16 185 129 / 0.15);
}

/* --- Form Help Text --- */
.form-group__help,
.form-help {
  font-size: var(--text-sm);
  color: var(--color-neutral-500);
  margin-top: var(--space-1);
}

/* --- Form Error Text --- */
.form-group__error,
.form-error {
  font-size: var(--text-sm);
  color: var(--color-error-500);
  margin-top: var(--space-1);
}

.form-errors {
  list-style: none;
  padding: 0;
  margin: var(--space-1) 0 0;
}

.form-errors li {
  font-size: var(--text-sm);
  color: var(--color-error-500);
}

/* ================================
   20. ALERT COMPONENTS (S-085)
   ================================ */

.alert {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-md);
  border-left: 4px solid var(--color-neutral-300);
  background-color: var(--color-neutral-50);
  color: var(--color-neutral-700);
  font-size: var(--text-sm);
  animation: alert-in var(--duration-normal) var(--ease-out);
}

@keyframes alert-in {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes alert-out {
  from {
    opacity: 1;
    transform: translateY(0);
  }
  to {
    opacity: 0;
    transform: translateY(-8px);
  }
}

.alert--leaving {
  animation: alert-out var(--duration-fast) var(--ease-in) forwards;
}

.alert--success {
  border-left-color: var(--color-success-500);
  background-color: var(--color-success-50);
  color: var(--color-success-700);
}

.alert--warning {
  border-left-color: var(--color-warning-500);
  background-color: var(--color-warning-50);
  color: var(--color-warning-700);
}

.alert--error {
  border-left-color: var(--color-error-500);
  background-color: var(--color-error-50);
  color: var(--color-error-700);
}

.alert--info {
  border-left-color: var(--color-info-500);
  background-color: var(--color-info-50);
  color: var(--color-info-700);
}

.alert__icon {
  flex-shrink: 0;
  font-size: var(--text-lg);
  line-height: 1;
}

.alert__message {
  flex: 1;
  min-width: 0;
}

.alert__close {
  flex-shrink: 0;
  background: none;
  border: none;
  cursor: pointer;
  padding: var(--space-1);
  opacity: 0.6;
  font-size: var(--text-base);
  color: inherit;
  transition: opacity var(--duration-fast) var(--ease-out);
}

.alert__close:hover {
  opacity: 1;
}

/* ================================
   21. INPUT GROUPS (S-085)
   ================================ */

.input-group {
  display: flex;
  align-items: stretch;
}

.input-group__prefix,
.input-group__suffix {
  display: flex;
  align-items: center;
  padding: var(--space-2) var(--space-3);
  font-size: var(--text-sm);
  color: var(--color-neutral-500);
  background-color: var(--color-neutral-100);
  border: 1px solid var(--color-neutral-300);
  white-space: nowrap;
}

.input-group__prefix {
  border-right: none;
  border-radius: var(--radius-md) 0 0 var(--radius-md);
}

.input-group__suffix {
  border-left: none;
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
}

.input-group__input {
  flex: 1;
  min-width: 0;
}

.input-group .input-group__input {
  border-radius: 0;
}

.input-group .input-group__prefix + .input-group__input {
  border-top-left-radius: 0;
  border-bottom-left-radius: 0;
}

.input-group .input-group__input:last-child {
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
}

.input-group .input-group__input:first-child {
  border-radius: var(--radius-md) 0 0 var(--radius-md);
}

/* ================================
   22. CARD ENHANCEMENTS (S-085)
   ================================ */

.card__header {
  padding: var(--space-4) var(--space-6);
  border-bottom: 1px solid var(--color-neutral-200);
  font-weight: 600;
}

.card__body {
  padding: var(--space-4) var(--space-6);
}

.card__footer {
  padding: var(--space-4) var(--space-6);
  border-top: 1px solid var(--color-neutral-200);
}

.card--elevated {
  box-shadow: var(--shadow-lg);
}

.card--bordered {
  box-shadow: none;
  border: 1px solid var(--color-neutral-200);
}

/* ================================
   23. DARK MODE — FORM & ALERT (S-085)
   ================================ */

[data-theme="dark"] .form-group__input,
[data-theme="dark"] .form-input,
[data-theme="dark"] .form-select,
[data-theme="dark"] .form-textarea {
  background-color: var(--color-neutral-50);
  border-color: var(--color-neutral-200);
  color: var(--color-neutral-900);
}

[data-theme="dark"] .form-group__label,
[data-theme="dark"] .form-label {
  color: var(--color-neutral-700);
}

[data-theme="dark"] .form-group__help,
[data-theme="dark"] .form-help {
  color: var(--color-neutral-400);
}

[data-theme="dark"] .input-group__prefix,
[data-theme="dark"] .input-group__suffix {
  background-color: var(--color-neutral-100);
  border-color: var(--color-neutral-200);
  color: var(--color-neutral-400);
}

[data-theme="dark"] .card__header,
[data-theme="dark"] .card__footer {
  border-color: var(--color-neutral-200);
}

[data-theme="dark"] .card--bordered {
  border-color: var(--color-neutral-200);
}
