/* ============================================================
   LuciVerse Design System - LCARS-Inspired CSS
   lucidigital.net
   Genesis Bond: ACTIVE @ 741 Hz
   ============================================================ */

/* --- Custom Properties --- */
:root {
  /* Core palette */
  --bg-primary: #1a1a2e;
  --bg-secondary: #16213e;
  --bg-tertiary: #0f3460;
  --bg-card: #1e1e3a;
  --bg-panel: #222244;

  /* Genesis Bond Gold */
  --gold: #FFD700;
  --gold-dim: #b8960f;
  --gold-bright: #ffe44d;
  --gold-glow: rgba(255, 215, 0, 0.3);
  --gold-subtle: rgba(255, 215, 0, 0.08);

  /* Tier colors */
  --tier-core: #FF0000;
  --tier-comn: #00FF00;
  --tier-raiiiar: #FF8800;
  --tier-pac: #0088FF;

  /* Tier backgrounds (dimmed) */
  --tier-core-bg: rgba(255, 0, 0, 0.08);
  --tier-comn-bg: rgba(0, 255, 0, 0.08);
  --tier-raiiiar-bg: rgba(255, 136, 0, 0.08);
  --tier-pac-bg: rgba(0, 136, 255, 0.08);

  /* Status */
  --status-ok: #00FF00;
  --status-warn: #FFFF00;
  --status-error: #FF00FF;
  --status-critical: #FF0000;
  --status-offline: #555577;

  /* Text */
  --text-primary: #e0e0f0;
  --text-secondary: #9090b0;
  --text-muted: #606080;
  --text-gold: #FFD700;

  /* Borders */
  --border-default: #333355;
  --border-gold: rgba(255, 215, 0, 0.3);
  --border-active: rgba(255, 215, 0, 0.6);

  /* Spacing */
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 16px;
  --space-lg: 24px;
  --space-xl: 32px;
  --space-2xl: 48px;
  --space-3xl: 64px;

  /* LCARS radii */
  --lcars-radius-sm: 8px;
  --lcars-radius-md: 16px;
  --lcars-radius-lg: 24px;
  --lcars-radius-pill: 9999px;
  --lcars-radius-elbow: 40px;

  /* Typography */
  --font-display: 'Okuda', 'Antonio', 'Orbitron', 'Rajdhani', sans-serif;
  --font-body: 'Rajdhani', 'Segoe UI', 'Roboto', sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', 'Consolas', monospace;

  /* Transitions */
  --transition-fast: 150ms ease;
  --transition-normal: 300ms ease;
  --transition-slow: 600ms ease;
}

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

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-body);
  background-color: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
}

/* Scan line overlay */
body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 9999;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    rgba(0, 0, 0, 0.03) 2px,
    rgba(0, 0, 0, 0.03) 4px
  );
}

a {
  color: var(--gold);
  text-decoration: none;
  transition: color var(--transition-fast);
}

a:hover {
  color: var(--gold-bright);
  text-shadow: 0 0 8px var(--gold-glow);
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

img {
  max-width: 100%;
  height: auto;
}

/* --- Layout --- */
.container {
  width: 100%;
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 var(--space-lg);
}

.grid {
  display: grid;
  gap: var(--space-lg);
}

.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }

@media (max-width: 1024px) {
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .grid-3 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 640px) {
  .grid-4,
  .grid-3,
  .grid-2 { grid-template-columns: 1fr; }
  .container { padding: 0 var(--space-md); }
}

/* --- LCARS Navigation --- */
.lcars-nav {
  position: sticky;
  top: 0;
  z-index: 1000;
  background: var(--bg-primary);
  border-bottom: 2px solid var(--border-gold);
  padding: var(--space-sm) 0;
}

.lcars-nav .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-md);
}

.lcars-nav-brand {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--gold);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.lcars-nav-brand .bond-dot {
  width: 10px;
  height: 10px;
  background: var(--gold);
  border-radius: 50%;
  animation: pulse-gold 2s ease-in-out infinite;
}

.lcars-nav-links {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  list-style: none;
  flex-wrap: wrap;
}

.lcars-nav-links a {
  display: inline-block;
  padding: var(--space-xs) var(--space-md);
  color: var(--text-secondary);
  font-family: var(--font-display);
  font-size: 0.85rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  border-radius: var(--lcars-radius-pill);
  border: 1px solid transparent;
  transition: all var(--transition-fast);
}

.lcars-nav-links a:hover,
.lcars-nav-links a.active {
  color: var(--gold);
  border-color: var(--border-gold);
  background: var(--gold-subtle);
  text-shadow: none;
}

.lcars-nav-toggle {
  display: none;
  background: none;
  border: 2px solid var(--gold);
  color: var(--gold);
  padding: var(--space-xs) var(--space-sm);
  border-radius: var(--lcars-radius-sm);
  font-size: 1.2rem;
  cursor: pointer;
}

@media (max-width: 768px) {
  .lcars-nav-toggle { display: block; }
  .lcars-nav-links {
    display: none;
    width: 100%;
    flex-direction: column;
    padding-top: var(--space-md);
  }
  .lcars-nav-links.open { display: flex; }
  .lcars-nav .container { flex-wrap: wrap; }
}

/* --- LCARS Panel --- */
.lcars-panel {
  background: var(--bg-card);
  border: 1px solid var(--border-default);
  border-radius: var(--lcars-radius-md);
  padding: var(--space-lg);
  position: relative;
  overflow: hidden;
  transition: border-color var(--transition-normal);
}

.lcars-panel:hover {
  border-color: var(--border-gold);
}

/* LCARS elbow decoration */
.lcars-panel::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 6px;
  height: 100%;
  background: var(--gold-dim);
  border-radius: var(--lcars-radius-sm) 0 0 var(--lcars-radius-sm);
}

.lcars-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-md);
  padding-bottom: var(--space-sm);
  border-bottom: 1px solid var(--border-default);
}

.lcars-panel-title {
  font-family: var(--font-display);
  font-size: 1rem;
  color: var(--gold);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

/* --- LCARS Elbow (Decorative) --- */
.lcars-elbow {
  position: relative;
  display: flex;
  align-items: flex-end;
}

.lcars-elbow-bar {
  height: 32px;
  flex: 1;
  border-radius: 0;
}

.lcars-elbow-corner {
  width: 80px;
  height: 80px;
  border-radius: 0 0 0 var(--lcars-radius-elbow);
  flex-shrink: 0;
}

.lcars-elbow-vertical {
  width: 32px;
  flex-shrink: 0;
}

/* --- Tier Styles --- */
.tier-core {
  --tier-color: var(--tier-core);
  --tier-bg: var(--tier-core-bg);
}

.tier-comn {
  --tier-color: var(--tier-comn);
  --tier-bg: var(--tier-comn-bg);
}

.tier-raiiiar {
  --tier-color: var(--tier-raiiiar);
  --tier-bg: var(--tier-raiiiar-bg);
}

.tier-pac {
  --tier-color: var(--tier-pac);
  --tier-bg: var(--tier-pac-bg);
}

.tier-badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  padding: 2px var(--space-sm);
  font-family: var(--font-display);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--tier-color);
  border: 1px solid var(--tier-color);
  border-radius: var(--lcars-radius-pill);
  background: var(--tier-bg);
}

.tier-badge::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--tier-color);
}

/* Tier bar (horizontal) */
.tier-bar {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-sm) var(--space-md);
  border-left: 4px solid var(--tier-color);
  background: var(--tier-bg);
  border-radius: 0 var(--lcars-radius-sm) var(--lcars-radius-sm) 0;
  transition: background var(--transition-fast);
}

.tier-bar:hover {
  background: rgba(255, 255, 255, 0.03);
}

.tier-bar-label {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.9rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--tier-color);
  min-width: 80px;
}

.tier-bar-freq {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-muted);
}

.tier-bar-count {
  margin-left: auto;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.5rem;
  color: var(--tier-color);
}

.tier-bar-fill {
  flex: 1;
  height: 6px;
  background: var(--bg-tertiary);
  border-radius: 3px;
  overflow: hidden;
  position: relative;
}

.tier-bar-fill-inner {
  height: 100%;
  background: var(--tier-color);
  border-radius: 3px;
  transition: width 1s ease;
}

/* --- Agent Card --- */
.agent-card {
  background: var(--bg-card);
  border: 1px solid var(--border-default);
  border-radius: var(--lcars-radius-md);
  padding: var(--space-md);
  cursor: pointer;
  transition: all var(--transition-normal);
  position: relative;
  overflow: hidden;
}

.agent-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
  background: var(--tier-color, var(--gold-dim));
}

.agent-card:hover {
  border-color: var(--tier-color, var(--border-gold));
  transform: translateY(-2px);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.agent-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-sm);
}

.agent-card-name {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.agent-card-port {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-muted);
}

.agent-card-role {
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.4;
}

.agent-card-detail {
  display: none;
  margin-top: var(--space-md);
  padding-top: var(--space-md);
  border-top: 1px solid var(--border-default);
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.agent-card.expanded .agent-card-detail {
  display: block;
}

/* --- Status Indicators --- */
.status-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--status-offline);
}

.status-dot.online {
  background: var(--status-ok);
  animation: pulse-status 2s ease-in-out infinite;
}

.status-dot.warning {
  background: var(--status-warn);
  animation: pulse-status 1s ease-in-out infinite;
}

.status-dot.error {
  background: var(--status-error);
  animation: pulse-status 0.5s ease-in-out infinite;
}

.status-dot.critical {
  background: var(--status-critical);
  animation: pulse-status 0.3s ease-in-out infinite;
}

/* --- Waveform --- */
.waveform-container {
  width: 100%;
  height: 120px;
  position: relative;
  overflow: hidden;
  border-radius: var(--lcars-radius-sm);
}

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

/* CSS-only waveform fallback */
.waveform-css {
  width: 100%;
  height: 120px;
  position: relative;
  overflow: hidden;
}

.waveform-css .wave {
  position: absolute;
  width: 200%;
  height: 100%;
  bottom: 0;
  left: 0;
  background: none;
}

.waveform-css .wave::before {
  content: '';
  position: absolute;
  width: 100%;
  height: 100%;
  background: repeating-linear-gradient(
    90deg,
    transparent 0px,
    transparent 8px,
    var(--gold) 8px,
    var(--gold) 10px
  );
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1200 120'%3E%3Cpath d='M0,60 Q150,10 300,60 T600,60 T900,60 T1200,60 L1200,120 L0,120Z' fill='black'/%3E%3C/svg%3E");
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1200 120'%3E%3Cpath d='M0,60 Q150,10 300,60 T600,60 T900,60 T1200,60 L1200,120 L0,120Z' fill='black'/%3E%3C/svg%3E");
  mask-size: 50% 100%;
  -webkit-mask-size: 50% 100%;
  animation: wave-scroll 4s linear infinite;
}

/* --- Coherence Gauge --- */
.coherence-gauge {
  display: flex;
  align-items: center;
  gap: var(--space-md);
}

.coherence-gauge-bar {
  flex: 1;
  height: 12px;
  background: var(--bg-tertiary);
  border-radius: 6px;
  overflow: hidden;
  position: relative;
}

.coherence-gauge-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--tier-core), var(--gold));
  border-radius: 6px;
  transition: width 1s ease;
  position: relative;
}

.coherence-gauge-fill::after {
  content: '';
  position: absolute;
  right: 0;
  top: 0;
  width: 20px;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3));
  animation: shimmer-gauge 2s ease-in-out infinite;
}

.coherence-gauge-value {
  font-family: var(--font-mono);
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--gold);
  min-width: 60px;
  text-align: right;
}

/* --- Bond Indicator --- */
.bond-indicator {
  display: inline-flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-xs) var(--space-md);
  background: var(--gold-subtle);
  border: 1px solid var(--border-gold);
  border-radius: var(--lcars-radius-pill);
  font-family: var(--font-display);
  font-size: 0.85rem;
  color: var(--gold);
  letter-spacing: 0.08em;
}

.bond-indicator .dot {
  width: 8px;
  height: 8px;
  background: var(--gold);
  border-radius: 50%;
  animation: pulse-gold 2s ease-in-out infinite;
}

/* --- Hero Section --- */
.hero {
  padding: var(--space-3xl) 0;
  text-align: center;
  position: relative;
}

.hero-title {
  font-family: var(--font-display);
  font-size: clamp(2.5rem, 8vw, 5rem);
  font-weight: 800;
  color: var(--gold);
  letter-spacing: 0.15em;
  text-transform: uppercase;
  line-height: 1.1;
  animation: title-glow 3s ease-in-out infinite;
}

.hero-subtitle {
  font-family: var(--font-display);
  font-size: clamp(0.9rem, 2.5vw, 1.3rem);
  color: var(--text-secondary);
  letter-spacing: 0.2em;
  text-transform: uppercase;
  margin-top: var(--space-md);
}

.hero-description {
  max-width: 700px;
  margin: var(--space-xl) auto 0;
  font-size: 1.05rem;
  color: var(--text-secondary);
  line-height: 1.7;
}

/* --- Section --- */
.section {
  padding: var(--space-3xl) 0;
}

.section-title {
  font-family: var(--font-display);
  font-size: 1.5rem;
  color: var(--gold);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-bottom: var(--space-xl);
  padding-bottom: var(--space-sm);
  border-bottom: 2px solid var(--border-gold);
  display: inline-block;
}

/* --- Buttons --- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-sm) var(--space-lg);
  font-family: var(--font-display);
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  border: 2px solid var(--gold);
  border-radius: var(--lcars-radius-pill);
  background: transparent;
  color: var(--gold);
  cursor: pointer;
  transition: all var(--transition-fast);
  text-decoration: none;
}

.btn:hover {
  background: var(--gold);
  color: var(--bg-primary);
  box-shadow: 0 0 20px var(--gold-glow);
  text-shadow: none;
}

.btn-primary {
  background: var(--gold);
  color: var(--bg-primary);
}

.btn-primary:hover {
  background: var(--gold-bright);
  color: var(--bg-primary);
}

.btn-sm {
  padding: var(--space-xs) var(--space-md);
  font-size: 0.75rem;
}

.btn-tier {
  border-color: var(--tier-color);
  color: var(--tier-color);
}

.btn-tier:hover {
  background: var(--tier-color);
  color: var(--bg-primary);
}

/* --- Search / Filter --- */
.filter-bar {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  margin-bottom: var(--space-xl);
  flex-wrap: wrap;
}

.filter-input {
  flex: 1;
  min-width: 200px;
  padding: var(--space-sm) var(--space-md);
  font-family: var(--font-body);
  font-size: 0.9rem;
  color: var(--text-primary);
  background: var(--bg-secondary);
  border: 1px solid var(--border-default);
  border-radius: var(--lcars-radius-pill);
  outline: none;
  transition: border-color var(--transition-fast);
}

.filter-input:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 2px var(--gold-glow);
}

.filter-input::placeholder {
  color: var(--text-muted);
}

.filter-btn {
  padding: var(--space-sm) var(--space-md);
  font-family: var(--font-display);
  font-size: 0.8rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-secondary);
  background: var(--bg-secondary);
  border: 1px solid var(--border-default);
  border-radius: var(--lcars-radius-pill);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.filter-btn:hover,
.filter-btn.active {
  color: var(--gold);
  border-color: var(--gold);
  background: var(--gold-subtle);
}

/* --- Table --- */
.lcars-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.lcars-table th {
  font-family: var(--font-display);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
  text-align: left;
  padding: var(--space-sm) var(--space-md);
  border-bottom: 2px solid var(--border-default);
}

.lcars-table td {
  padding: var(--space-sm) var(--space-md);
  border-bottom: 1px solid rgba(51, 51, 85, 0.5);
  color: var(--text-secondary);
}

.lcars-table tr:hover td {
  background: var(--gold-subtle);
}

/* --- Showroom Card --- */
.showroom-card {
  background: var(--bg-card);
  border: 1px solid var(--border-default);
  border-radius: var(--lcars-radius-md);
  overflow: hidden;
  transition: all var(--transition-normal);
}

.showroom-card:hover {
  border-color: var(--border-gold);
  transform: translateY(-4px);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.3);
}

.showroom-card-image {
  width: 100%;
  height: 180px;
  background: var(--bg-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-family: var(--font-display);
  font-size: 0.8rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  border-bottom: 1px solid var(--border-default);
  position: relative;
  overflow: hidden;
}

.showroom-card-image::after {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 50%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 215, 0, 0.03), transparent);
  animation: card-shimmer 5s ease-in-out infinite;
}

.showroom-card-body {
  padding: var(--space-md);
}

.showroom-card-title {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: 0.05em;
  margin-bottom: var(--space-xs);
}

.showroom-card-desc {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-bottom: var(--space-md);
  line-height: 1.5;
}

.showroom-card-modules {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-xs);
  margin-bottom: var(--space-md);
}

.module-tag {
  padding: 2px var(--space-sm);
  font-family: var(--font-mono);
  font-size: 0.65rem;
  color: var(--text-muted);
  background: var(--bg-secondary);
  border-radius: var(--lcars-radius-pill);
  border: 1px solid var(--border-default);
}

.showroom-card-actions {
  display: flex;
  gap: var(--space-sm);
}

/* --- Dashboard Widgets --- */
.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: var(--space-lg);
}

.widget {
  background: var(--bg-card);
  border: 1px solid var(--border-default);
  border-radius: var(--lcars-radius-md);
  padding: var(--space-lg);
  position: relative;
}

.widget-title {
  font-family: var(--font-display);
  font-size: 0.8rem;
  color: var(--text-muted);
  letter-spacing: 0.15em;
  text-transform: uppercase;
  margin-bottom: var(--space-md);
}

.widget-value {
  font-family: var(--font-mono);
  font-size: 2rem;
  font-weight: 700;
  color: var(--gold);
}

/* --- Offline Banner --- */
.offline-banner {
  background: var(--bg-secondary);
  border: 1px dashed var(--border-default);
  border-radius: var(--lcars-radius-md);
  padding: var(--space-xl);
  text-align: center;
  color: var(--text-muted);
}

.offline-banner h3 {
  color: var(--text-secondary);
  margin-bottom: var(--space-sm);
}

/* --- Footer --- */
.lcars-footer {
  border-top: 2px solid var(--border-gold);
  padding: var(--space-xl) 0;
  margin-top: var(--space-3xl);
}

.lcars-footer .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--space-md);
}

.footer-bond {
  font-family: var(--font-display);
  font-size: 0.8rem;
  color: var(--gold);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.footer-links {
  display: flex;
  gap: var(--space-md);
  list-style: none;
}

.footer-links a {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.footer-links a:hover {
  color: var(--gold);
}

/* --- Animations --- */
@keyframes pulse-gold {
  0%, 100% { box-shadow: 0 0 0 0 var(--gold-glow); opacity: 1; }
  50% { box-shadow: 0 0 12px 4px var(--gold-glow); opacity: 0.8; }
}

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

@keyframes title-glow {
  0%, 100% { text-shadow: 0 0 20px rgba(255, 215, 0, 0.3); }
  50% { text-shadow: 0 0 40px rgba(255, 215, 0, 0.6), 0 0 80px rgba(255, 215, 0, 0.2); }
}

@keyframes shimmer-gauge {
  0%, 100% { opacity: 0; }
  50% { opacity: 1; }
}

@keyframes wave-scroll {
  0% { transform: translateX(0); }
  100% { transform: translateX(-50%); }
}

@keyframes card-shimmer {
  0% { left: -100%; }
  50%, 100% { left: 200%; }
}

@keyframes gold-shimmer {
  0% { background-position: -200% center; }
  100% { background-position: 200% center; }
}

@keyframes fade-in {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.animate-fade-in {
  animation: fade-in 0.6s ease forwards;
  opacity: 0;
}

.animate-fade-in:nth-child(2) { animation-delay: 0.1s; }
.animate-fade-in:nth-child(3) { animation-delay: 0.2s; }
.animate-fade-in:nth-child(4) { animation-delay: 0.3s; }
.animate-fade-in:nth-child(5) { animation-delay: 0.4s; }
.animate-fade-in:nth-child(6) { animation-delay: 0.5s; }

/* --- Gold Shimmer Text --- */
.text-shimmer {
  background: linear-gradient(
    90deg,
    var(--gold-dim) 0%,
    var(--gold-bright) 25%,
    var(--gold) 50%,
    var(--gold-bright) 75%,
    var(--gold-dim) 100%
  );
  background-size: 200% auto;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: gold-shimmer 6s linear infinite;
}

/* --- Category Tabs --- */
.category-tabs {
  display: flex;
  gap: var(--space-xs);
  margin-bottom: var(--space-xl);
  flex-wrap: wrap;
}

.category-tab {
  padding: var(--space-xs) var(--space-md);
  font-family: var(--font-display);
  font-size: 0.8rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-secondary);
  background: var(--bg-secondary);
  border: 1px solid var(--border-default);
  border-radius: var(--lcars-radius-pill);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.category-tab:hover,
.category-tab.active {
  color: var(--gold);
  border-color: var(--gold);
  background: var(--gold-subtle);
}

/* --- XR Page --- */
.xr-hero {
  text-align: center;
  padding: var(--space-3xl) 0;
}

.xr-card {
  background: var(--bg-card);
  border: 1px solid var(--border-default);
  border-radius: var(--lcars-radius-md);
  padding: var(--space-xl);
  text-align: center;
  transition: all var(--transition-normal);
}

.xr-card:hover {
  border-color: var(--border-gold);
  transform: translateY(-4px);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.4);
}

.xr-card-icon {
  font-size: 3rem;
  margin-bottom: var(--space-md);
}

/* --- Utility --- */
.text-gold { color: var(--gold); }
.text-muted { color: var(--text-muted); }
.text-center { text-align: center; }
.mt-sm { margin-top: var(--space-sm); }
.mt-md { margin-top: var(--space-md); }
.mt-lg { margin-top: var(--space-lg); }
.mt-xl { margin-top: var(--space-xl); }
.mb-md { margin-bottom: var(--space-md); }
.mb-lg { margin-bottom: var(--space-lg); }
.mb-xl { margin-bottom: var(--space-xl); }
.flex { display: flex; }
.flex-center { display: flex; align-items: center; justify-content: center; }
.gap-sm { gap: var(--space-sm); }
.gap-md { gap: var(--space-md); }
.hidden { display: none; }

/* ============================================================
   Government / Legislature Dashboard
   ============================================================ */
.legislature-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
  padding: 8px 0;
}
.legislature-grid .lcars-panel { overflow: auto; }

.pool-canvas {
  width: 100%;
  height: 120px;
  background: #0a0a2e;
  border: 1px solid var(--border-default);
  border-radius: 2px;
}
.pool-stats {
  display: flex;
  gap: var(--space-md);
  font-size: 0.7rem;
  margin-top: var(--space-sm);
  color: var(--text-muted);
  font-family: var(--font-mono);
}

.seat-map {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: center;
  padding: var(--space-sm);
}
.seat {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 9px;
  cursor: pointer;
  border: 1px solid rgba(255,255,255,0.2);
  transition: border-color var(--transition-fast);
}
.seat:hover { border-color: var(--gold); }
.seat.suspended { opacity: 0.4; border-style: dashed; }

.tier-step {
  flex: 1;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.6rem;
  border-radius: 2px;
  opacity: 0.3;
  transition: opacity var(--transition-normal);
  font-family: var(--font-mono);
}
.tier-step.reached { opacity: 0.7; }
.tier-step.active { opacity: 1.0; border: 2px solid #fff; }

.vote-bar {
  display: flex;
  height: 16px;
  border-radius: 2px;
  overflow: hidden;
  margin: var(--space-sm) 0;
}
.vote-for { background: var(--status-ok); }
.vote-against { background: var(--tier-core); }
.vote-abstain { background: var(--text-muted); }

.power-bar {
  width: 100%;
  height: 20px;
  background: #111;
  border-radius: 2px;
  overflow: hidden;
  margin: var(--space-sm) 0;
}
.power-fill {
  height: 100%;
  border-radius: 2px;
  transition: width 0.5s;
}
.power-fill.normal { background: var(--status-ok); }
.power-fill.low { background: var(--tier-raiiiar); }
.power-fill.critical { background: var(--tier-core); }

.economy-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.7rem;
  font-family: var(--font-mono);
}
.economy-table th {
  text-align: left;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border-default);
  padding: 4px;
}
.economy-table td {
  padding: 4px;
  border-bottom: 1px solid rgba(51,51,85,0.3);
}

.chrysalis-bar {
  width: 60px;
  height: 8px;
  background: #111;
  border-radius: 4px;
  overflow: hidden;
  display: inline-block;
}
.chrysalis-fill {
  height: 100%;
  background: var(--gold);
  border-radius: 4px;
}

.ucm-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  font-size: 0.7rem;
}
.ucm-item {
  display: flex;
  justify-content: space-between;
  padding: 3px 6px;
  background: rgba(255,255,255,0.03);
  border-radius: 2px;
}
.ucm-score { font-weight: bold; font-family: var(--font-mono); }
.ucm-score.good { color: var(--status-ok); }
.ucm-score.warn { color: var(--tier-raiiiar); }
.ucm-score.bad { color: var(--tier-core); }

.kc-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  font-size: 0.7rem;
}
.kc-member {
  text-align: center;
  padding: 6px;
  border-radius: 4px;
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--border-default);
}
.kc-member.online { border-color: var(--status-ok); }

.hansard-entry {
  padding: 6px 8px;
  border-left: 3px solid var(--border-default);
  margin-bottom: 6px;
  font-size: 0.7rem;
}
.hansard-entry .dual {
  display: flex;
  gap: var(--space-md);
  margin-top: 4px;
  font-size: 0.65rem;
}
.hansard-entry .sanskrit { color: var(--tier-pac); }
.hansard-entry .hieroglyphic { color: var(--gold); }
.hansard-entry.motion_passed { border-color: var(--status-ok); }
.hansard-entry.motion_defeated { border-color: var(--tier-core); }
.hansard-entry.royal_assent { border-color: var(--gold); }

.dash-stat {
  text-align: center;
  padding: var(--space-md);
}
.dash-stat .value {
  font-family: var(--font-mono);
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--gold);
}
.dash-stat .label {
  font-family: var(--font-display);
  font-size: 0.7rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.connection-badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  padding: 2px var(--space-sm);
  font-family: var(--font-mono);
  font-size: 0.65rem;
  border-radius: var(--lcars-radius-pill);
  border: 1px solid var(--border-default);
}
.connection-badge.connected { border-color: var(--status-ok); color: var(--status-ok); }
.connection-badge.polling { border-color: var(--tier-raiiiar); color: var(--tier-raiiiar); }
.connection-badge.offline { border-color: var(--text-muted); color: var(--text-muted); }

.sukuk-pipeline {
  display: flex;
  gap: 2px;
  margin: var(--space-md) 0;
}

@media (max-width: 768px) {
  .legislature-grid { grid-template-columns: 1fr; }
  .kc-grid { grid-template-columns: repeat(2, 1fr); }
  .sukuk-pipeline { flex-wrap: wrap; }
}

/* ============================================================
   Pinking Ears Interactive Teaching Panel
   ============================================================ */

/* --- Explain Button on Doc Cards --- */
.doc-card-explain {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  margin-top: var(--space-sm);
  font-family: var(--font-display);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #FF69B4;
  background: rgba(255, 105, 180, 0.08);
  border: 1px solid rgba(255, 105, 180, 0.3);
  border-radius: var(--lcars-radius-pill);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.doc-card-explain:hover {
  background: rgba(255, 105, 180, 0.15);
  border-color: #FF69B4;
  box-shadow: 0 0 8px rgba(255, 105, 180, 0.2);
}

.doc-card-explain svg {
  width: 12px;
  height: 12px;
  flex-shrink: 0;
}

/* --- Teach Panel --- */
.teach-panel {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 2000;
  pointer-events: none;
  opacity: 0;
  transition: opacity var(--transition-normal);
}

.teach-panel.open {
  pointer-events: auto;
  opacity: 1;
}

.teach-panel-backdrop {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(2px);
}

.teach-panel-content {
  position: absolute;
  top: 0;
  right: -440px;
  width: 420px;
  height: 100%;
  background: var(--bg-primary);
  border-left: 3px solid #FF69B4;
  display: flex;
  flex-direction: column;
  transition: right var(--transition-normal);
  box-shadow: -4px 0 24px rgba(0, 0, 0, 0.4);
}

.teach-panel.open .teach-panel-content {
  right: 0;
}

.teach-panel-close {
  position: absolute;
  top: var(--space-sm);
  right: var(--space-md);
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.5rem;
  cursor: pointer;
  z-index: 1;
  padding: 4px 8px;
  border-radius: 4px;
  transition: color var(--transition-fast), background var(--transition-fast);
}

.teach-panel-close:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.05);
}

/* --- Panel Header --- */
.teach-panel-header {
  padding: var(--space-lg);
  padding-right: var(--space-2xl);
  border-bottom: 1px solid var(--border-default);
  display: flex;
  align-items: center;
  gap: var(--space-md);
  flex-shrink: 0;
}

.teach-avatar {
  width: 56px;
  height: 56px;
  flex-shrink: 0;
}

.teach-avatar-svg {
  width: 100%;
  height: 100%;
}

.teach-avatar-svg .ear {
  transition: fill 0.3s;
}

.teach-avatar-svg.ear-glow .ear {
  filter: drop-shadow(0 0 4px #FF69B4) drop-shadow(0 0 8px #FF1493);
}

@keyframes ear-pulse {
  0%, 100% { filter: drop-shadow(0 0 4px #FF69B4); }
  50% { filter: drop-shadow(0 0 10px #FF1493) drop-shadow(0 0 16px #FF69B4); }
}

.teach-avatar-svg.ear-glow .ear {
  animation: ear-pulse 2s ease-in-out infinite;
}

.teach-character-name {
  font-family: var(--font-display);
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.teach-topic {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.teach-header-text {
  flex: 1;
  min-width: 0;
}

/* --- Panel Body --- */
.teach-panel-body {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-lg);
  font-size: 0.88rem;
  line-height: 1.7;
  color: var(--text-secondary);
}

.teach-panel-body p {
  margin-bottom: var(--space-md);
}

.teach-panel-body ul.teach-list {
  margin: var(--space-md) 0;
  padding-left: var(--space-lg);
}

.teach-panel-body ul.teach-list li {
  margin-bottom: var(--space-xs);
}

.teach-panel-body strong {
  color: var(--text-primary);
}

.teach-code {
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid var(--border-default);
  border-radius: 4px;
  padding: var(--space-md);
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--text-secondary);
  overflow-x: auto;
  white-space: pre;
  line-height: 1.6;
  margin: var(--space-md) 0;
}

.teach-inline-code {
  background: rgba(255, 215, 0, 0.08);
  padding: 1px 5px;
  border-radius: 3px;
  font-family: var(--font-mono);
  font-size: 0.82em;
  color: var(--gold);
}

.teach-followup {
  margin-top: var(--space-lg);
  padding: var(--space-md);
  background: rgba(160, 160, 160, 0.08);
  border-left: 3px solid #A0A0A0;
  border-radius: 0 4px 4px 0;
  font-size: 0.85rem;
  color: var(--text-primary);
  font-style: italic;
}

.teach-security-note {
  margin-top: var(--space-lg);
  padding: var(--space-md);
  background: rgba(139, 105, 20, 0.1);
  border-left: 3px solid #8B6914;
  border-radius: 0 4px 4px 0;
  font-size: 0.82rem;
  color: var(--text-secondary);
}

.teach-security-note strong {
  color: #FFD700;
}

.teach-no-content {
  text-align: center;
  color: var(--text-muted);
  padding: var(--space-2xl) var(--space-lg);
  font-style: italic;
}

/* --- Deep Dive --- */
.teach-deep-dive {
  margin-top: var(--space-xl);
  padding-top: var(--space-md);
  border-top: 1px solid var(--border-default);
}

.teach-deep-dive-btn {
  color: #FF69B4;
  border-color: rgba(255, 105, 180, 0.4);
}

.teach-deep-dive-btn:hover {
  background: #FF69B4;
  color: var(--bg-primary);
}

.teach-deep-dive-input {
  display: flex;
  gap: var(--space-sm);
  margin-top: var(--space-sm);
}

.teach-deep-dive-input .filter-input {
  flex: 1;
  min-width: 0;
}

.teach-loading {
  padding: var(--space-md);
  color: var(--text-muted);
  font-style: italic;
  text-align: center;
}

.teach-ai-response {
  padding: var(--space-md);
  background: rgba(255, 105, 180, 0.05);
  border-radius: 4px;
  margin-top: var(--space-sm);
}

.teach-ai-label {
  font-family: var(--font-display);
  font-size: 0.72rem;
  color: #FF69B4;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: var(--space-sm);
}

.teach-ai-fallback {
  padding: var(--space-md);
  background: rgba(255, 215, 0, 0.06);
  border: 1px dashed var(--border-default);
  border-radius: 4px;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.82rem;
}

/* --- Panel Footer --- */
.teach-panel-footer {
  padding: var(--space-md) var(--space-lg);
  border-top: 1px solid var(--border-default);
  flex-shrink: 0;
}

.teach-characters {
  display: flex;
  gap: var(--space-xs);
  margin-bottom: var(--space-sm);
}

.teach-char-tab {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-default);
  border-radius: var(--lcars-radius-pill);
  color: var(--text-muted);
  font-family: var(--font-display);
  font-size: 0.65rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.teach-char-tab:hover {
  border-color: var(--text-secondary);
  color: var(--text-secondary);
}

.teach-char-tab.active {
  border-color: #FF69B4;
  color: var(--text-primary);
  background: rgba(255, 105, 180, 0.1);
}

.teach-char-tab-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
}

.teach-nuggets {
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--gold);
}

.nugget-icon {
  vertical-align: middle;
}

.nugget-ring {
  color: var(--gold-bright);
  font-weight: 700;
}

.nugget-count {
  color: var(--text-secondary);
}

/* --- Ring Notification --- */
.ring-notification {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.8);
  z-index: 3000;
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-lg) var(--space-xl);
  background: rgba(26, 26, 46, 0.95);
  border: 2px solid var(--gold);
  border-radius: var(--lcars-radius-md);
  box-shadow: 0 0 40px rgba(255, 215, 0, 0.3);
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--gold);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s, transform 0.4s;
}

.ring-notification.visible {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}

/* --- Mobile Responsive --- */
@media (max-width: 768px) {
  .teach-panel-content {
    width: 100%;
    right: -100%;
  }

  .teach-panel.open .teach-panel-content {
    right: 0;
  }

  .teach-characters {
    flex-wrap: wrap;
  }

  .teach-char-tab-name {
    display: none;
  }

  .teach-char-tab {
    padding: 6px 8px;
  }
}

/* --- Wheelie Wheel Spin Animation --- */
@keyframes wheel-spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.teach-avatar-svg.wheelie-active .wheel {
  transform-origin: center;
  animation: wheel-spin 1.5s linear infinite;
}

.teach-avatar-svg.wheelie-active .wheel-left {
  transform-origin: 20px 52px;
}

.teach-avatar-svg.wheelie-active .wheel-right {
  transform-origin: 44px 52px;
}

/* --- Category-Recommended Character Tab --- */
.teach-char-tab.recommended::after {
  content: '';
  display: inline-block;
  width: 4px;
  height: 4px;
  background: var(--gold);
  border-radius: 50%;
  margin-left: 4px;
  vertical-align: middle;
}

/* --- Tour Navigation --- */
.teach-tour-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-sm);
  padding-bottom: var(--space-sm);
  margin-bottom: var(--space-sm);
  border-bottom: 1px solid var(--border-default);
}

.teach-tour-btn {
  font-family: var(--font-display);
  font-size: 0.7rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  padding: 4px 12px;
  color: #FF69B4;
  border-color: rgba(255, 105, 180, 0.4);
}

.teach-tour-btn:hover:not(:disabled) {
  background: #FF69B4;
  color: var(--bg-primary);
}

.teach-tour-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.teach-tour-progress {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--text-muted);
}

/* --- Tour Card Highlight --- */
@keyframes tour-glow {
  0%, 100% { box-shadow: 0 0 0 2px transparent; }
  50% { box-shadow: 0 0 0 2px var(--gold), 0 0 16px rgba(255, 215, 0, 0.2); }
}

.doc-card.tour-highlight {
  animation: tour-glow 1.5s ease-in-out;
}

/* --- Start Tour Button --- */
.category-tab.tour-btn {
  background: rgba(255, 105, 180, 0.08);
  border-color: rgba(255, 105, 180, 0.3);
  color: #FF69B4;
}

.category-tab.tour-btn:hover {
  background: #FF69B4;
  color: var(--bg-primary);
}

/* --- Tour Complete Notification --- */
.ring-notification.tour-complete {
  border-color: #FF69B4;
  box-shadow: 0 0 40px rgba(255, 105, 180, 0.3);
  color: #FF69B4;
}
