

:root {
  color-scheme: dark;
  
  --bg: #0A0014;
  --bg-alt: #0f0a1a;
  --surface: rgba(26, 16, 37, 0.6);
  --surface-solid: #1a1025;
  --surface-glass: rgba(10, 0, 20, 0.8);
  --text: #ffffff;
  --text-muted: rgba(255, 255, 255, 0.7);

  
  --accent: #8b5cf6;
  --accent-strong: #7c3aed;
  --accent-muted: rgba(139, 92, 246, 0.15);

  --danger: #ff4d6a;
  --neutral: #3F3F46;

  --border: rgba(255, 255, 255, 0.08);
  --header-border: rgba(255, 255, 255, 0.05);
  --pill-bg: rgba(255, 255, 255, 0.08);

  --code-bg: rgba(0, 0, 0, 0.3);
  --code-border: rgba(255, 255, 255, 0.1);
  --card-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);

  --input-border: rgba(255, 255, 255, 0.1);
  --input-bg: rgba(255, 255, 255, 0.03);

  --sidebar-bg: #0A0014;
  --sidebar-width: 260px;

  --radius-lg: 20px;
  --radius-md: 14px;
  --radius-sm: 10px;

  --primary: var(--accent);
}

:root[data-theme='light'] {
  color-scheme: light;
  --bg: #f7f9ff;
  --bg-alt: #eef2ff;
  --surface: rgba(255, 255, 255, 0.78);
  --surface-solid: #ffffff;
  --surface-glass: rgba(255, 255, 255, 0.86);
  --text: #0b1220;
  --text-muted: rgba(21, 36, 72, 0.7);
  --border: rgba(143, 160, 210, 0.24);
  --header-border: rgba(143, 160, 210, 0.24);
  --pill-bg: rgba(16, 38, 84, 0.08);
  --code-bg: #f1f4ff;
  --code-border: rgba(143, 160, 210, 0.24);
  --card-shadow: 0 15px 35px rgba(60, 92, 160, 0.16);
  --input-border: rgba(143, 160, 210, 0.35);
  --input-bg: rgba(255, 255, 255, 0.95);
  --sidebar-bg: rgba(240, 244, 255, 0.98);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  color: var(--text);
  background-color: var(--bg);
  line-height: 1.6;
}



.loading-screen {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  z-index: 9999;
}

.loading-content {
  text-align: center;
}

.loading-logo {
  width: 140px;
  margin-bottom: 24px;
}

.loading-spinner {
  width: 32px;
  height: 32px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}



.dashboard {
  display: flex;
  min-height: 100vh;
}



.sidebar {
  width: var(--sidebar-width);
  background: var(--sidebar-bg);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  left: 0;
  top: 0;
  bottom: 0;
  z-index: 100;
}

.sidebar-header {
  padding: 20px;
  border-bottom: 1px solid var(--border);
}

.sidebar-brand {
  display: block;
}

.sidebar-logo {
  height: 32px;
  width: auto;
}

.sidebar-nav {
  flex: 1;
  padding: 16px 0;
  overflow-y: auto;
}

.nav-section {
  padding: 0 12px;
  margin-bottom: 24px;
}

.nav-section-title {
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  color: var(--text-muted);
  margin: 0 0 8px 12px;
  text-transform: uppercase;
}

.nav-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 0.925rem;
  font-weight: 500;
  transition: all 0.15s ease;
  text-decoration: none;
}

.nav-link:hover {
  color: var(--text);
  background: var(--surface);
}

.nav-link.active {
  color: var(--text);
  background: var(--surface);
  border-left: 2px solid var(--accent);
  margin-left: -2px;
}

.nav-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}



.sidebar-footer {
  padding: 16px;
  border-top: 1px solid var(--border);
  position: relative;
}

.user-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: var(--surface);
  cursor: pointer;
  transition: background 0.15s ease;
}

.user-card:hover {
  background: var(--surface-solid);
}

.user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--border);
}

.user-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.user-name {
  font-size: 0.875rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-email {
  font-size: 0.75rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-menu-btn {
  width: 28px;
  height: 28px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}

.user-menu-btn:hover {
  background: var(--border);
  color: var(--text);
}

.user-menu-btn svg {
  width: 16px;
  height: 16px;
}

.user-dropdown {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 16px;
  right: 16px;
  background: var(--surface-solid);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 6px;
  box-shadow: var(--card-shadow);
  opacity: 0;
  visibility: hidden;
  transform: translateY(8px);
  transition: all 0.2s ease;
  z-index: 10;
}

.user-dropdown.open {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.dropdown-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: none;
  background: transparent;
  color: var(--text);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  border-radius: 8px;
  transition: background 0.15s ease;
  text-align: left;
}

.dropdown-item:hover {
  background: var(--surface);
}

.dropdown-item.danger {
  color: var(--danger);
}

.dropdown-icon {
  width: 16px;
  height: 16px;
}



.main-content {
  flex: 1;
  margin-left: var(--sidebar-width);
  padding: 32px 40px;
  min-height: 100vh;
}

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
  animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.content-header {
  margin-bottom: 32px;
}

.content-header h1 {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1.75rem;
  margin: 0 0 6px;
}

.content-subtitle {
  color: var(--text-muted);
  margin: 0;
  font-size: 0.95rem;
}

.content-body {
  max-width: 800px;
}



.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  margin-bottom: 24px;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.card-header h2 {
  font-size: 1.1rem;
  font-weight: 600;
  margin: 0;
}

.card-description {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin: 0 0 20px;
}

.badge {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--accent-muted);
  color: var(--accent);
}



.position-card {
  background: linear-gradient(135deg, rgba(102, 247, 197, 0.12), rgba(119, 149, 255, 0.12));
  border: 1px solid rgba(102, 247, 197, 0.25);
  border-radius: var(--radius-lg);
  padding: 28px;
  margin-bottom: 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
}

.position-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.position-label {
  font-size: 0.85rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.position-number {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 2.5rem;
  font-weight: 700;
  color: var(--accent);
}

.position-meta {
  color: var(--text-muted);
  font-size: 0.95rem;
}



.leaderboard-table {
  margin-top: 16px;
}

.leaderboard-header {
  display: grid;
  grid-template-columns: 60px 1fr 100px;
  gap: 12px;
  padding: 10px 16px;
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
}

.leaderboard-body {
  max-height: 400px;
  overflow-y: auto;
}

.leaderboard-row {
  display: grid;
  grid-template-columns: 60px 1fr 100px;
  gap: 12px;
  padding: 14px 16px;
  align-items: center;
  border-bottom: 1px solid var(--border);
  transition: background 0.15s ease;
}

.leaderboard-row:last-child {
  border-bottom: none;
}

.leaderboard-row:hover {
  background: var(--surface-solid);
}

.leaderboard-row.highlight {
  background: rgba(102, 247, 197, 0.08);
  border-left: 3px solid var(--accent);
  margin-left: -3px;
}

.col-rank {
  font-weight: 600;
  color: var(--text-muted);
}

.leaderboard-row .col-rank {
  font-size: 1rem;
}

.leaderboard-row.highlight .col-rank {
  color: var(--accent);
}

.col-user {
  display: flex;
  align-items: center;
  gap: 12px;
}

.leaderboard-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--border);
}

.leaderboard-username {
  font-weight: 500;
}

.col-referrals {
  text-align: right;
  font-weight: 600;
  color: var(--accent);
}

.leaderboard-empty {
  padding: 40px;
  text-align: center;
  color: var(--text-muted);
}



.share-section {
  margin-bottom: 28px;
}

.share-section h2 {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1.25rem;
  margin: 0 0 8px;
}

.share-description {
  color: var(--text-muted);
  margin: 0;
  font-size: 0.95rem;
}

.referral-inputs {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px;
  margin-bottom: 28px;
}

.input-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.input-group label {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-muted);
}

.copy-input {
  display: flex;
  background: var(--surface-solid);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.copy-input input {
  flex: 1;
  padding: 12px 16px;
  border: none;
  background: transparent;
  color: var(--text);
  font-size: 0.95rem;
  font-family: 'Space Grotesk', monospace;
  outline: none;
}

.copy-btn {
  width: 48px;
  border: none;
  background: var(--surface);
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
  border-left: 1px solid var(--border);
}

.copy-btn:hover {
  background: var(--accent-muted);
  color: var(--accent);
}

.copy-btn.copied {
  background: var(--accent);
  color: #04110d;
}

.copy-btn svg {
  width: 18px;
  height: 18px;
}



.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-top: 16px;
}

.stat-card {
  background: var(--surface-solid);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 20px;
  display: flex;
  flex-direction: column;
}

.stat-label {
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: 2px;
}

.stat-sublabel {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.stat-value {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--text);
}



.settings-form {
  max-width: 500px;
}

.avatar-section {
  display: flex;
  align-items: center;
  gap: 20px;
  margin-bottom: 28px;
  padding-bottom: 28px;
  border-bottom: 1px solid var(--border);
}

.settings-avatar {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--border);
}

.avatar-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.avatar-label {
  font-weight: 600;
}

.avatar-note {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  margin-bottom: 8px;
}

.form-group input,
.form-group textarea {
  width: 100%;
  padding: 12px 16px;
  background: var(--input-bg);
  border: 1px solid var(--input-border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 0.95rem;
  font-family: inherit;
  transition: all 0.2s ease;
}

.form-group input:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(102, 247, 197, 0.15);
}

.form-group input[readonly] {
  background: var(--surface);
  color: var(--text-muted);
  cursor: not-allowed;
}

.form-hint {
  display: block;
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 6px;
}

.form-actions {
  display: flex;
  gap: 12px;
  margin-top: 28px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}



.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 24px;
  border-radius: 999px;
  border: none;
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  color: #04110d;
  font-size: 0.925rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 24px rgba(102, 247, 197, 0.3);
}

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.btn-secondary {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
}

.btn-secondary:hover {
  background: var(--surface-solid);
  box-shadow: none;
}



.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 16px 0;
}

.toggle-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.toggle-label {
  font-weight: 600;
}

.toggle-description {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.toggle-switch {
  position: relative;
  width: 52px;
  height: 28px;
  cursor: pointer;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: absolute;
  inset: 0;
  background: var(--surface-solid);
  border: 1px solid var(--border);
  border-radius: 999px;
  transition: all 0.2s ease;
}

.toggle-slider::before {
  content: '';
  position: absolute;
  left: 3px;
  top: 3px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--text-muted);
  transition: all 0.2s ease;
}

.toggle-switch input:checked+.toggle-slider {
  background: var(--accent);
  border-color: var(--accent);
}

.toggle-switch input:checked+.toggle-slider::before {
  transform: translateX(24px);
  background: #04110d;
}



.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: var(--surface-solid);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px 24px;
  box-shadow: var(--card-shadow);
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
  z-index: 1000;
}

.toast.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
  visibility: visible;
}

.toast.success {
  border-color: var(--accent);
}

.toast.error {
  border-color: var(--danger);
}

.toast-message {
  font-size: 0.9rem;
  font-weight: 500;
}



@media (max-width: 900px) {
  .sidebar {
    width: 100%;
    height: auto;
    position: relative;
    border-right: none;
    border-bottom: 1px solid var(--border);
  }

  .sidebar-nav {
    display: flex;
    overflow-x: auto;
    padding: 0 12px;
  }

  .nav-section {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 0;
    padding: 12px 0;
  }

  .nav-section-title {
    display: none;
  }

  .nav-list {
    display: flex;
    gap: 4px;
  }

  .nav-link {
    white-space: nowrap;
    padding: 8px 14px;
  }

  .nav-link.active {
    border-left: none;
    border-bottom: 2px solid var(--accent);
    margin-left: 0;
    margin-bottom: -2px;
  }

  .sidebar-footer {
    display: none;
  }

  .main-content {
    margin-left: 0;
    padding: 24px;
  }

  .dashboard {
    flex-direction: column;
  }
}

@media (max-width: 600px) {
  .position-card {
    flex-direction: column;
    align-items: flex-start;
  }

  .leaderboard-header,
  .leaderboard-row {
    grid-template-columns: 50px 1fr 70px;
    font-size: 0.85rem;
  }

  .stats-grid {
    grid-template-columns: 1fr;
  }

  .form-actions {
    flex-direction: column;
  }

  .form-actions .btn {
    width: 100%;
  }
}