/* ==========================================================================
   LUNARQUEST — PREMIUM MONOCHROME BLACK & WHITE MINIMAL DESIGN SYSTEM
   100% Vector SVG Icons (Zero Emojis), DDoS Shield, Tiered Telemetry Vault
   ========================================================================== */

:root {
  --bg-pure: #000000;
  --bg-card: rgba(12, 12, 14, 0.75);
  --bg-card-hover: rgba(20, 20, 24, 0.9);
  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-bright: rgba(255, 255, 255, 0.22);
  --border-glow: rgba(255, 255, 255, 0.4);
  --text-primary: #ffffff;
  --text-secondary: #a1a1aa;
  --text-muted: #52525b;
  --radius-lg: 16px;
  --radius-md: 10px;
  --radius-sm: 6px;
  --font-sans: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', 'SF Mono', Consolas, monospace;
}

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

.hidden {
  display: none !important;
}

body {
  background-color: var(--bg-pure);
  color: var(--text-primary);
  font-family: var(--font-sans);
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Background Interactive Canvas */
#bg-canvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
  z-index: 0;
  opacity: 0.6;
}

/* Subtle Ambient Radial Glows */
.ambient-glow {
  position: fixed;
  width: 600px;
  height: 600px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.035) 0%, transparent 70%);
  filter: blur(80px);
  pointer-events: none;
  z-index: 1;
}
.ambient-top {
  top: -200px;
  left: 50%;
  transform: translateX(-50%);
}
.ambient-bottom {
  bottom: -250px;
  right: 10%;
}

/* Layout Shell */
.app-container {
  position: relative;
  z-index: 10;
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem 1.5rem 4rem;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Header */
.top-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--border-subtle);
  gap: 1rem;
}

.brand-wrapper {
  display: flex;
  align-items: center;
  gap: 0.875rem;
}

.brand-emblem {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  background: #09090b;
  border: 1px solid var(--border-bright);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 20px rgba(255, 255, 255, 0.05);
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), border-color 0.3s ease;
}
.brand-emblem:hover {
  transform: scale(1.05) rotate(-5deg);
  border-color: #ffffff;
}
.brand-emblem svg {
  width: 22px;
  height: 22px;
  color: #ffffff;
}

.brand-text h1 {
  font-size: 1.15rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: #ffffff;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.brand-text p {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
  letter-spacing: 0.02em;
}

.edge-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.2rem 0.6rem;
  border-radius: 9999px;
  font-size: 0.65rem;
  font-family: var(--font-mono);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
}
.edge-badge .pulse-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #ffffff;
  box-shadow: 0 0 8px #ffffff;
  animation: pulse-glow 2s infinite;
}

@keyframes pulse-glow {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.3; transform: scale(0.8); }
}

/* Security & DDoS Status Strip */
.security-status-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.6rem 1rem;
  margin-top: 1rem;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-subtle);
  font-size: 0.7rem;
  font-family: var(--font-mono);
  color: var(--text-muted);
  flex-wrap: wrap;
}
.security-pill-group {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}
.sec-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  color: var(--text-secondary);
}
.sec-pill svg {
  width: 13px;
  height: 13px;
}

/* Buttons */
.btn-group {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.mono-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.45rem 0.9rem;
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  font-weight: 600;
  font-family: var(--font-mono);
  text-decoration: none;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  border: 1px solid var(--border-subtle);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text-secondary);
}
.mono-btn svg {
  width: 14px;
  height: 14px;
}
.mono-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: var(--border-bright);
  color: #ffffff;
  transform: translateY(-1px);
}
.mono-btn.primary {
  background: #ffffff;
  color: #000000;
  border-color: #ffffff;
  box-shadow: 0 4px 15px rgba(255, 255, 255, 0.15);
}
.mono-btn.primary:hover {
  background: #e4e4e7;
  color: #000000;
  box-shadow: 0 6px 25px rgba(255, 255, 255, 0.3);
}
.mono-btn.danger {
  color: #f43f5e;
  border-color: rgba(244, 63, 94, 0.2);
}
.mono-btn.danger:hover {
  background: rgba(244, 63, 94, 0.1);
  border-color: #f43f5e;
}

/* Metric Cards Grid */
.metrics-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
  margin: 1.75rem 0;
}

.metric-card {
  position: relative;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 1.25rem 1.5rem;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  overflow: hidden;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}
.metric-card:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-bright);
  transform: translateY(-2px);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.5), 0 0 25px rgba(255, 255, 255, 0.03);
}

.metric-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.75rem;
}
.metric-label {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  font-family: var(--font-mono);
}
.metric-icon-box {
  width: 32px;
  height: 32px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
}
.metric-icon-box svg {
  width: 16px;
  height: 16px;
}

.metric-value {
  font-size: 1.85rem;
  font-weight: 800;
  letter-spacing: -0.04em;
  color: #ffffff;
  font-family: var(--font-mono);
  line-height: 1.1;
  margin-bottom: 0.35rem;
}
.metric-sub {
  font-size: 0.7rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
  display: flex;
  align-items: center;
  gap: 0.35rem;
}
.metric-sparkline {
  margin-top: 0.75rem;
  height: 3px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 9999px;
  overflow: hidden;
}
.metric-sparkline-bar {
  height: 100%;
  background: #ffffff;
  border-radius: 9999px;
  transition: width 1s ease;
}

/* Controls HUD */
.controls-hud {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 0.75rem 1rem;
  margin-bottom: 1.5rem;
  backdrop-filter: blur(20px);
  flex-wrap: wrap;
}

.search-hud {
  position: relative;
  flex: 1;
  min-width: 240px;
}
.search-hud svg {
  position: absolute;
  left: 0.875rem;
  top: 50%;
  transform: translateY(-50%);
  width: 14px;
  height: 14px;
  color: var(--text-muted);
}
.search-hud input {
  width: 100%;
  background: #09090b;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 0.5rem 0.75rem 0.5rem 2.25rem;
  font-size: 0.75rem;
  color: #ffffff;
  font-family: var(--font-mono);
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.search-hud input:focus {
  border-color: #ffffff;
  box-shadow: 0 0 15px rgba(255, 255, 255, 0.08);
}
.search-hud input::placeholder {
  color: var(--text-muted);
}

.filter-segments {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  background: #09090b;
  padding: 0.25rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
  overflow-x: auto;
}
.segment-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.35rem 0.75rem;
  border-radius: 4px;
  font-size: 0.7rem;
  font-family: var(--font-mono);
  font-weight: 500;
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s ease;
}
.segment-btn svg {
  width: 12px;
  height: 12px;
}
.segment-btn:hover {
  color: #ffffff;
}
.segment-btn.active {
  background: #ffffff;
  color: #000000;
  font-weight: 700;
}

.sort-hud {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.sort-hud select {
  background: #09090b;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 0.45rem 0.75rem;
  font-size: 0.75rem;
  font-family: var(--font-mono);
  color: var(--text-primary);
  outline: none;
  cursor: pointer;
}

/* Leaderboard Table & Vault Panel */
.table-panel {
  flex: 1;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  overflow: hidden;
  backdrop-filter: blur(20px);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6);
  position: relative;
}

/* Vault Locked Cover (Shown when unauthenticated for DDoS/Legal protection) */
.vault-locked-cover {
  padding: 4rem 2rem;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
}
.vault-icon-circle {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: #09090b;
  border: 1px solid var(--border-bright);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  box-shadow: 0 0 30px rgba(255, 255, 255, 0.05);
}
.vault-icon-circle svg {
  width: 26px;
  height: 26px;
}
.vault-locked-title {
  font-size: 1.1rem;
  font-weight: 800;
  color: #ffffff;
  letter-spacing: -0.02em;
}
.vault-locked-desc {
  max-width: 500px;
  font-size: 0.75rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
  line-height: 1.6;
}

.leaderboard-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}
.leaderboard-table th {
  padding: 0.875rem 1.25rem;
  background: #09090b;
  font-size: 0.65rem;
  font-family: var(--font-mono);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border-subtle);
}
.leaderboard-table td {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  font-size: 0.8rem;
  vertical-align: middle;
  transition: background 0.15s ease;
}
.leaderboard-table tr:hover td {
  background: rgba(255, 255, 255, 0.02);
}
.leaderboard-table tr:last-child td {
  border-bottom: none;
}

/* Rank Badges */
.rank-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 6px;
  font-family: var(--font-mono);
  font-weight: 800;
  font-size: 0.75rem;
}
.rank-1 {
  background: #ffffff;
  color: #000000;
  box-shadow: 0 0 15px rgba(255, 255, 255, 0.4);
}
.rank-2 {
  background: rgba(255, 255, 255, 0.2);
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.4);
}
.rank-3 {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-secondary);
  border: 1px solid var(--border-subtle);
}
.rank-other {
  color: var(--text-muted);
}

/* Platform Tag */
.platform-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  font-size: 0.65rem;
  font-family: var(--font-mono);
  font-weight: 500;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
}
.platform-pill svg {
  width: 12px;
  height: 12px;
}

/* User Identity Cell */
.user-cell {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.user-badge {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: #09090b;
  border: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
}
.user-badge svg {
  width: 16px;
  height: 16px;
}

.user-name {
  font-weight: 700;
  color: #ffffff;
  letter-spacing: -0.01em;
  display: flex;
  align-items: center;
  gap: 0.35rem;
}
.user-meta {
  font-size: 0.65rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

/* Visual Progress Bar */
.mini-progress {
  width: 60px;
  height: 4px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 9999px;
  overflow: hidden;
  margin-top: 0.25rem;
}
.mini-progress-fill {
  height: 100%;
  background: #ffffff;
  border-radius: 9999px;
}

/* Footer */
.app-footer {
  margin-top: 2.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  font-size: 0.7rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
  flex-wrap: wrap;
}

/* Modals */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(0, 0, 0, 0.88);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  opacity: 1;
  transition: opacity 0.2s ease;
}
.modal-backdrop.hidden {
  display: none;
  opacity: 0;
  pointer-events: none;
}

.modal-card {
  width: 100%;
  background: #09090b;
  border: 1px solid var(--border-bright);
  border-radius: var(--radius-lg);
  padding: 1.75rem;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.9), 0 0 40px rgba(255, 255, 255, 0.04);
  animation: modal-enter 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modal-enter {
  from { opacity: 0; transform: scale(0.96) translateY(8px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border-subtle);
}
.modal-title {
  font-size: 1rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: #ffffff;
}

.modal-close-btn {
  background: transparent;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  width: 28px;
  height: 28px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}
.modal-close-btn svg {
  width: 14px;
  height: 14px;
}
.modal-close-btn:hover {
  color: #ffffff;
  border-color: #ffffff;
}

@media (max-width: 768px) {
  .app-container {
    padding: 1rem;
  }
  .metrics-strip {
    grid-template-columns: 1fr 1fr;
  }
  .controls-hud {
    flex-direction: column;
    align-items: stretch;
  }
}
