:root {
  --bg-main: #090a0f;
  --bg-card: #11131c;
  --bg-card-elevated: #171a26;
  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-highlight: rgba(212, 175, 55, 0.35);
  --text-primary: #f3f4f6;
  --text-secondary: #9ca3af;
  --text-muted: #6b7280;
  --accent-gold: #d4af37;
  --accent-gold-hover: #e5c349;
  --accent-green: #10b981;
  --accent-red: #ef4444;
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Inter, Helvetica, Arial, sans-serif;
  --font-mono: "JetBrains Mono", "Fira Code", Consolas, Monaco, monospace;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  min-height: 100vh;
  background-color: var(--bg-main);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

body {
  display: flex;
  flex-direction: column;
  position: relative;
}

.ambient-glow {
  position: fixed;
  border-radius: 50%;
  filter: blur(130px);
  pointer-events: none;
  z-index: 0;
  opacity: 0.16;
}

.glow-1 {
  width: 520px;
  height: 520px;
  background: radial-gradient(circle, #d4af37 0%, transparent 70%);
  top: -180px;
  left: -120px;
}

.glow-2 {
  width: 480px;
  height: 480px;
  background: radial-gradient(circle, #3b82f6 0%, transparent 70%);
  bottom: -150px;
  right: -100px;
}

.container {
  width: 100%;
  max-width: 1240px;
  margin: 0 auto;
  padding: 0 24px;
  position: relative;
  z-index: 1;
}

.mono {
  font-family: var(--font-mono);
}

/* Header */
.site-header {
  border-bottom: 1px solid var(--border-subtle);
  background: rgba(9, 10, 15, 0.82);
  backdrop-filter: blur(12px);
  position: sticky;
  top: 0;
  z-index: 20;
}

.header-inner {
  height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: var(--text-primary);
}

.brand-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: rgba(212, 175, 55, 0.1);
  border: 1px solid var(--border-highlight);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent-gold);
}

.brand-text {
  display: flex;
  flex-direction: column;
}

.brand-name {
  font-weight: 700;
  letter-spacing: 0.12em;
  font-size: 16px;
  line-height: 1.1;
}

.brand-tag {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-muted);
  letter-spacing: 0.06em;
  margin-top: 2px;
}

.node-status {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 12px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-subtle);
  padding: 6px 12px;
  border-radius: 999px;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent-green);
  box-shadow: 0 0 8px var(--accent-green);
}

.status-label {
  color: var(--text-muted);
}

.status-val {
  color: var(--text-secondary);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: var(--font-sans);
  font-size: 13.5px;
  font-weight: 600;
  padding: 9px 16px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.18s ease;
  border: 1px solid transparent;
  text-decoration: none;
}

.btn-ghost {
  background: rgba(255, 255, 255, 0.03);
  color: var(--text-secondary);
  border-color: var(--border-subtle);
}

.btn-ghost:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.07);
}

.btn-primary {
  background: linear-gradient(135deg, #d4af37 0%, #b58e1c 100%);
  color: #090a0f;
  box-shadow: 0 4px 16px rgba(212, 175, 55, 0.2);
}

.btn-primary:hover {
  background: linear-gradient(135deg, #e5c349 0%, #c69d24 100%);
  transform: translateY(-1px);
}

.btn-block {
  width: 100%;
  padding: 12px 18px;
  font-size: 14px;
}

/* Main Grid */
.main-grid {
  flex: 1;
  display: grid;
  grid-template-columns: 1fr 400px;
  gap: 32px;
  padding-top: 36px;
  padding-bottom: 48px;
  align-items: start;
}

/* Hero & Left Column */
.badge-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 16px;
}

.pill {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  padding: 4px 10px;
  border-radius: 6px;
}

.pill-gold {
  background: rgba(212, 175, 55, 0.14);
  color: var(--accent-gold);
  border: 1px solid var(--border-highlight);
}

.pill-outline {
  background: rgba(255, 255, 255, 0.03);
  color: var(--text-secondary);
  border: 1px solid var(--border-subtle);
}

.hero-title {
  font-size: clamp(26px, 3.2vw, 38px);
  font-weight: 700;
  line-height: 1.18;
  letter-spacing: -0.02em;
  margin-bottom: 14px;
  color: #ffffff;
}

.hero-subtitle {
  color: var(--text-secondary);
  font-size: 15.5px;
  max-width: 680px;
  margin-bottom: 24px;
}

/* Metrics */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin-bottom: 24px;
}

.metric-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  padding: 16px;
  display: flex;
  flex-direction: column;
}

.metric-label {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.metric-value {
  font-family: var(--font-mono);
  font-size: 22px;
  font-weight: 700;
  color: var(--text-primary);
}

.metric-sub {
  font-size: 11.5px;
  color: var(--accent-gold);
  margin-top: 4px;
  opacity: 0.85;
}

/* Demo Reference Deck */
.deck-card {
  background: linear-gradient(180deg, var(--bg-card-elevated) 0%, var(--bg-card) 100%);
  border: 1px solid var(--border-subtle);
  border-radius: 14px;
  padding: 20px;
  margin-bottom: 24px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.35);
}

.deck-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 14px;
}

.deck-kicker {
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.08em;
  color: var(--accent-gold);
  display: block;
  margin-bottom: 3px;
}

.deck-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
}

.codec-badge {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--accent-green);
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.25);
  padding: 4px 9px;
  border-radius: 6px;
  white-space: nowrap;
}

.visualizer-wrap {
  position: relative;
  background: #07080c;
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 10px;
  height: 92px;
  overflow: hidden;
  margin-bottom: 16px;
}

#audioCanvas {
  width: 100%;
  height: 100%;
  display: block;
}

.vu-overlay {
  position: absolute;
  top: 8px;
  right: 12px;
  display: flex;
  gap: 14px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
  background: rgba(9, 10, 15, 0.75);
  padding: 3px 8px;
  border-radius: 4px;
}

.vu-overlay strong {
  color: var(--text-secondary);
}

.deck-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}

.play-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--accent-gold);
  color: #090a0f;
  border: none;
  border-radius: 8px;
  padding: 9px 16px;
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  transition: background 0.15s ease;
}

.play-btn:hover {
  background: var(--accent-gold-hover);
}

.play-btn.playing {
  background: var(--accent-green);
  color: #06110d;
}

.track-selector {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.track-chip {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  font-family: var(--font-mono);
  font-size: 11.5px;
  padding: 6px 10px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.track-chip:hover {
  color: var(--text-primary);
  border-color: rgba(255, 255, 255, 0.18);
}

.track-chip.active {
  background: rgba(212, 175, 55, 0.15);
  color: var(--accent-gold);
  border-color: var(--border-highlight);
}

.volume-control {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
}

.volume-control input[type="range"] {
  width: 84px;
  accent-color: var(--accent-gold);
  cursor: pointer;
}

/* Catalog Table */
.catalog-preview {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 14px;
  padding: 20px;
}

.section-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
  gap: 12px;
}

.section-head h3 {
  font-size: 15px;
  font-weight: 600;
}

.sync-stamp {
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--text-muted);
}

.table-responsive {
  overflow-x: auto;
}

.vault-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.vault-table th {
  text-align: left;
  color: var(--text-muted);
  font-weight: 500;
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border-subtle);
}

.vault-table td {
  padding: 11px 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  color: var(--text-secondary);
}

.vault-table tr:last-child td {
  border-bottom: none;
}

.tag-format {
  font-family: var(--font-mono);
  font-size: 11px;
  background: rgba(255, 255, 255, 0.05);
  padding: 3px 7px;
  border-radius: 4px;
  color: var(--text-primary);
}

.dr-badge {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 4px;
}

.dr-high {
  background: rgba(16, 185, 129, 0.14);
  color: #34d399;
}

.dr-mid {
  background: rgba(245, 158, 11, 0.15);
  color: #fbbf24;
}

.lock-tag {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
}

/* Auth Sidebar */
.auth-sidebar {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.auth-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.4);
}

.auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  border-bottom: 1px solid var(--border-subtle);
  background: rgba(0, 0, 0, 0.25);
}

.auth-tab {
  background: none;
  border: none;
  padding: 14px;
  color: var(--text-muted);
  font-weight: 600;
  font-size: 13.5px;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all 0.15s ease;
}

.auth-tab:hover {
  color: var(--text-secondary);
}

.auth-tab.active {
  color: var(--accent-gold);
  border-bottom-color: var(--accent-gold);
  background: rgba(212, 175, 55, 0.05);
}

.auth-form {
  display: none;
  padding: 24px;
}

.auth-form.active {
  display: block;
}

.form-header {
  margin-bottom: 18px;
}

.form-header h3 {
  font-size: 17px;
  margin-bottom: 4px;
}

.form-header p {
  font-size: 13px;
  color: var(--text-secondary);
}

.field-group {
  margin-bottom: 15px;
}

.field-group label {
  display: block;
  font-size: 12.5px;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.field-group input {
  width: 100%;
  background: #0a0c12;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  padding: 10px 13px;
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 13px;
  transition: border-color 0.15s ease;
}

.field-group input:focus {
  outline: none;
  border-color: var(--accent-gold);
}

.field-row {
  margin-bottom: 16px;
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  color: var(--text-secondary);
  cursor: pointer;
}

.checkbox-label input {
  accent-color: var(--accent-gold);
}

.form-alert {
  padding: 11px 13px;
  border-radius: 8px;
  font-size: 12.5px;
  margin-bottom: 16px;
  line-height: 1.45;
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(239, 68, 68, 0.35);
  color: #fca5a5;
}

.hidden {
  display: none !important;
}

.auth-footer {
  padding: 14px 24px;
  background: rgba(0, 0, 0, 0.25);
  border-top: 1px solid var(--border-subtle);
}

.security-note {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 12px;
  color: var(--text-muted);
}

.security-note svg {
  flex-shrink: 0;
  margin-top: 2px;
  color: var(--accent-gold);
}

/* System Info Card */
.sysinfo-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 14px;
  padding: 18px 22px;
}

.sysinfo-card h4 {
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.sysinfo-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 12.5px;
}

.sysinfo-list li {
  display: flex;
  justify-content: space-between;
  color: var(--text-secondary);
}

.sysinfo-list strong {
  color: var(--text-primary);
  font-weight: 500;
}

/* Footer */
.site-footer {
  border-top: 1px solid var(--border-subtle);
  padding: 20px 0;
  margin-top: auto;
  font-size: 12.5px;
  color: var(--text-muted);
}

.footer-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}

.footer-links {
  display: flex;
  align-items: center;
  gap: 10px;
}

.footer-links a {
  color: var(--text-secondary);
  text-decoration: none;
}

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

/* Modal */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.72);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 50;
}

.modal-box {
  background: var(--bg-card-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: 14px;
  max-width: 520px;
  width: 100%;
  padding: 24px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
}

.modal-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 24px;
  cursor: pointer;
}

.modal-body p {
  font-size: 13.5px;
  color: var(--text-secondary);
  margin-bottom: 12px;
}

/* Responsive */
@media (max-width: 980px) {
  .main-grid {
    grid-template-columns: 1fr;
  }
  .node-status {
    display: none;
  }
}

@media (max-width: 640px) {
  .metrics-grid {
    grid-template-columns: 1fr;
  }
  .header-actions .btn-ghost {
    display: none;
  }
}
