/* ============================================
   NeoSec CTF Theme — v2
   Particle network background + hacker aesthetic
   Bootstrap 5.3 dark overlay
   ============================================ */

:root, [data-bs-theme="dark"] {
  --bs-body-bg: #060714;
  --bs-body-color: #c8c8e0;
  --bs-primary: #6c5ce7;
  --bs-primary-rgb: 108, 92, 231;
  --bs-secondary-bg: #0b0c22;
  --bs-tertiary-bg: #10112a;
  --bs-border-color: rgba(108, 92, 231, 0.12);
  --bs-link-color: #8b7cf0;
  --bs-link-hover-color: #b0a4f8;
  --ns-accent: #6c5ce7;
  --ns-accent-light: #8b7cf0;
  --ns-accent-glow: rgba(108, 92, 231, 0.3);
  --ns-green: #00d170;
  --ns-red: #ff4757;
  --ns-cyan: #4ecdc4;
  --ns-surface: rgba(11, 12, 34, 0.75);
  --ns-surface-hover: rgba(108, 92, 231, 0.06);
}

/* ============================================
   KEYFRAMES
   ============================================ */
@keyframes pulse-glow {
  0%, 100% { box-shadow: 0 0 5px rgba(108, 92, 231, 0.2); }
  50% { box-shadow: 0 0 18px rgba(108, 92, 231, 0.5), 0 0 40px rgba(108, 92, 231, 0.15); }
}

@keyframes border-flow {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

@keyframes text-glow {
  0%, 100% { text-shadow: 0 0 6px rgba(108, 92, 231, 0.3); }
  50% { text-shadow: 0 0 16px rgba(108, 92, 231, 0.7), 0 0 30px rgba(108, 92, 231, 0.2); }
}

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

@keyframes flicker {
  0%, 91%, 93%, 95%, 97%, 100% { opacity: 1; }
  92% { opacity: 0.82; }
  94% { opacity: 0.92; }
  96% { opacity: 0.88; }
}

@keyframes terminal-blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}

@keyframes scan-down {
  0% { top: -4px; opacity: 0; }
  10% { opacity: 1; }
  90% { opacity: 1; }
  100% { top: 100%; opacity: 0; }
}

/* ============================================
   PARTICLE CANVAS
   ============================================ */
#ns-particles {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
}

/* ============================================
   BASE
   ============================================ */
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif !important;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  background: #060714 !important;
  position: relative;
}

/* Subtle scanline overlay */
body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 0;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 3px,
    rgba(108, 92, 231, 0.008) 3px,
    rgba(108, 92, 231, 0.008) 4px
  );
}

/* Everything above the canvas */
.navbar, .footer, .toast-container, .offcanvas {
  position: relative;
  z-index: 1;
}

::selection { background: rgba(108, 92, 231, 0.35); }

/* Scrollbar */
::-webkit-scrollbar { width: 5px; }
::-webkit-scrollbar-track { background: #060714; }
::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, #6c5ce7, #4834d4);
  border-radius: 3px;
}

/* ============================================
   NAVBAR
   ============================================ */
.navbar {
  background: rgba(6, 7, 20, 0.88) !important;
  backdrop-filter: blur(16px) saturate(1.4);
  -webkit-backdrop-filter: blur(16px) saturate(1.4);
  border-bottom: none !important;
  padding: 0.5rem 0;
  position: fixed !important;
  z-index: 1030;
}

/* Animated glow line under navbar */
.navbar::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 1px;
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(108, 92, 231, 0.4) 15%,
    #6c5ce7 50%,
    rgba(108, 92, 231, 0.4) 85%,
    transparent 100%
  );
  background-size: 200% 100%;
  animation: border-flow 3s ease infinite;
}

.navbar-brand {
  font-weight: 800 !important;
  letter-spacing: -0.03em;
  font-size: 1.1rem !important;
}

.ns-logo-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  background: #6c5ce7;
  border-radius: 50%;
  margin-right: 8px;
  vertical-align: middle;
  box-shadow: 0 0 8px rgba(108, 92, 231, 0.6);
  animation: pulse-glow 2s ease-in-out infinite;
}

.navbar .nav-link {
  font-size: 0.82rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  transition: color 0.25s ease;
  position: relative;
  padding: 0.5rem 0.75rem !important;
}

/* Nav link hover underline slide */
.navbar .nav-link::after {
  content: '';
  position: absolute;
  bottom: 2px;
  left: 50%;
  width: 0;
  height: 2px;
  background: #6c5ce7;
  transition: width 0.3s ease, left 0.3s ease;
  border-radius: 1px;
  box-shadow: 0 0 6px rgba(108, 92, 231, 0.4);
}
.navbar .nav-link:hover::after {
  width: 80%;
  left: 10%;
}

/* ============================================
   MAIN LAYOUT
   ============================================ */
main {
  padding-top: 56px;
  min-height: calc(100vh - 100px);
}

/* Page fade-in */
main > .container,
main > .jumbotron,
main > div {
  animation: fade-in-up 0.45s ease-out;
}

/* ============================================
   JUMBOTRON (PAGE HEADERS)
   ============================================ */
.jumbotron {
  background: transparent !important;
  border-bottom: 1px solid rgba(108, 92, 231, 0.08);
  padding: 3rem 0 2.5rem;
  margin-bottom: 2rem;
  position: relative;
  overflow: hidden;
}

/* Scan line effect in jumbotron */
.jumbotron::before {
  content: '';
  position: absolute;
  left: 0;
  width: 100%;
  height: 4px;
  background: linear-gradient(90deg, transparent, rgba(108, 92, 231, 0.15), transparent);
  filter: blur(1px);
  animation: scan-down 4s ease-in-out infinite;
  pointer-events: none;
}

.jumbotron h1 {
  font-weight: 800;
  font-size: 2rem;
  letter-spacing: -0.03em;
  animation: text-glow 3s ease-in-out infinite;
}

/* ============================================
   BUTTONS
   ============================================ */
.btn {
  font-weight: 600;
  border-radius: 8px;
  transition: all 0.25s ease;
  letter-spacing: 0.01em;
}

.btn-primary {
  --bs-btn-bg: #6c5ce7;
  --bs-btn-border-color: #6c5ce7;
  --bs-btn-hover-bg: #7d6ff0;
  --bs-btn-hover-border-color: #7d6ff0;
  --bs-btn-focus-shadow-rgb: 108, 92, 231;
  --bs-btn-active-bg: #5b4bd6;
  --bs-btn-active-border-color: #5b4bd6;
  position: relative;
  overflow: hidden;
}

.btn-primary:hover {
  box-shadow: 0 0 20px rgba(108, 92, 231, 0.35), 0 4px 12px rgba(108, 92, 231, 0.2);
  transform: translateY(-1px);
}

/* Light sweep on hover */
.btn-primary::after {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.15), transparent);
  transition: left 0.6s ease;
}
.btn-primary:hover::after {
  left: 100%;
}

.btn-outline-secondary {
  --bs-btn-color: #8888a8;
  --bs-btn-border-color: rgba(108, 92, 231, 0.2);
  --bs-btn-hover-bg: rgba(108, 92, 231, 0.1);
  --bs-btn-hover-border-color: #6c5ce7;
  --bs-btn-hover-color: #fff;
}

/* ============================================
   FORMS
   ============================================ */
.form-control, .form-select {
  background-color: rgba(11, 12, 34, 0.8) !important;
  border: 1px solid rgba(108, 92, 231, 0.12) !important;
  color: #c8c8e0 !important;
  border-radius: 8px;
  transition: border-color 0.25s ease, box-shadow 0.25s ease;
}
.form-control:focus, .form-select:focus {
  border-color: #6c5ce7 !important;
  box-shadow: 0 0 0 3px rgba(108, 92, 231, 0.15), 0 0 15px rgba(108, 92, 231, 0.1) !important;
  background-color: rgba(11, 12, 34, 0.95) !important;
}
.form-control::placeholder {
  color: #4a4a6a !important;
}
.form-label {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #7a7a9a;
  font-weight: 600;
}

/* ============================================
   TABLES
   ============================================ */
.table {
  --bs-table-bg: transparent;
  --bs-table-striped-bg: rgba(108, 92, 231, 0.03);
  --bs-table-hover-bg: rgba(108, 92, 231, 0.06);
}
.table > thead > tr > th {
  font-weight: 700;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #6c5ce7;
  border-bottom: 1px solid rgba(108, 92, 231, 0.15);
  padding: 0.75rem;
}
.table > tbody > tr > td {
  border-top-color: rgba(108, 92, 231, 0.05);
  padding: 0.7rem 0.75rem;
}
.table > tbody > tr {
  transition: all 0.2s ease;
}
.table > tbody > tr:hover {
  box-shadow: inset 3px 0 0 0 #6c5ce7;
  background-color: rgba(108, 92, 231, 0.04) !important;
}

/* ============================================
   CARDS
   ============================================ */
.card {
  background: var(--ns-surface) !important;
  border: 1px solid rgba(108, 92, 231, 0.1) !important;
  border-radius: 12px;
  transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease;
  backdrop-filter: blur(8px);
}
.card:hover {
  transform: translateY(-3px);
  box-shadow: 0 12px 35px rgba(108, 92, 231, 0.12), 0 0 0 1px rgba(108, 92, 231, 0.15);
  border-color: rgba(108, 92, 231, 0.2) !important;
}
.card-header {
  background: transparent !important;
  border-bottom: 1px solid rgba(108, 92, 231, 0.08) !important;
  font-weight: 700;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* ============================================
   MODALS — bright text, solid bg, fix blackout
   ============================================ */
.modal {
  z-index: 1055 !important;
  position: fixed !important;
}
.modal-backdrop {
  z-index: 1050 !important;
  background-color: rgba(0, 0, 0, 0.55) !important;
}
.modal-content {
  background: #141533 !important;
  border: 1px solid rgba(108, 92, 231, 0.25) !important;
  border-radius: 14px;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.6), 0 0 40px rgba(108, 92, 231, 0.1);
  color: #e8e8f4 !important;
}
.modal-content h1, .modal-content h2, .modal-content h3,
.modal-content h4, .modal-content h5, .modal-content h6 { color: #fff !important; }
.modal-content p, .modal-content label,
.modal-content td, .modal-content th,
.modal-content li, .modal-content small,
.modal-content .challenge-desc,
.modal-content .challenge-name,
.modal-content .challenge-value { color: #ddddf0 !important; }
.modal-content a:not(.btn) { color: #8b7cf0 !important; }
.modal-content .text-muted, .modal-content .text-secondary { color: #9999bb !important; }
.modal-content .modal-header { border-bottom: 1px solid rgba(108, 92, 231, 0.15) !important; }
.modal-content .modal-body { color: #e8e8f4 !important; }
.modal-content .modal-footer { border-top: 1px solid rgba(108, 92, 231, 0.15) !important; }
.modal-content .btn-close { filter: invert(1) grayscale(100%) brightness(200%); }
.modal-content .nav-tabs .nav-link { color: #9999bb !important; border-color: transparent !important; }
.modal-content .nav-tabs .nav-link.active { color: #fff !important; border-bottom-color: #6c5ce7 !important; }
.modal-content input.form-control,
.modal-content textarea.form-control {
  background-color: #0e0f28 !important;
  border: 1px solid rgba(108, 92, 231, 0.2) !important;
  color: #e8e8f4 !important;
}
.modal-content input.form-control::placeholder { color: #666688 !important; }
.modal-content .btn { pointer-events: auto; }
.modal-content .btn-outline-secondary {
  color: #c8c8e0 !important;
  border-color: rgba(108, 92, 231, 0.3) !important;
}
.modal-content .btn-outline-secondary:hover {
  background: rgba(108, 92, 231, 0.15) !important;
  color: #fff !important;
}
.modal-content .btn-info { color: #fff !important; }
.modal-content .alert { color: inherit !important; }
.modal-content .alert-success { color: #0f5132 !important; background-color: #d1e7dd !important; border-color: #badbcc !important; }
.modal-content .alert-danger { color: #842029 !important; background-color: #f8d7da !important; border-color: #f5c2c7 !important; }
.modal-content .alert-info { color: #055160 !important; background-color: #cff4fc !important; border-color: #b6effb !important; }
.modal-content .alert-warning { color: #664d03 !important; background-color: #fff3cd !important; border-color: #ffecb5 !important; }
.modal-content .challenge-tag { color: #fff !important; }
.modal.show .modal-dialog { animation: fade-in-up 0.3s ease-out; }
#challenge-window .modal-dialog { max-width: 620px; }
#challenge-window .modal-content { background: #141533 !important; }

/* ============================================
   CHALLENGE LIST VIEW
   ============================================ */
.ns-toolbar {
  padding: 0.75rem 1rem;
  background: var(--ns-surface);
  border: 1px solid rgba(108, 92, 231, 0.1);
  border-radius: 12px;
  backdrop-filter: blur(8px);
}
.ns-toolbar .input-group-text {
  background: rgba(108, 92, 231, 0.1) !important;
  border-color: rgba(108, 92, 231, 0.12) !important;
  color: #6c5ce7 !important;
}
.ns-challenge-list {
  border: 1px solid rgba(108, 92, 231, 0.1);
  border-radius: 12px;
  overflow: hidden;
  background: var(--ns-surface);
  backdrop-filter: blur(8px);
}
.ns-challenge-list-header {
  display: flex !important;
  flex-direction: row !important;
  align-items: center;
  padding: 0.65rem 1.25rem;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #6c5ce7;
  border-bottom: 1px solid rgba(108, 92, 231, 0.1);
  background: rgba(108, 92, 231, 0.04);
  user-select: none;
}
.ns-challenge-list-header > div { cursor: pointer; }
.ns-challenge-list-header > div:hover { color: #8b7cf0; }
.ns-challenge-list-row {
  display: flex !important;
  flex-direction: row !important;
  flex-wrap: nowrap !important;
  align-items: center;
  padding: 0.75rem 1.25rem;
  border-bottom: 1px solid rgba(108, 92, 231, 0.05);
  cursor: pointer;
  transition: all 0.2s ease;
}
.ns-challenge-list-row:last-child { border-bottom: none; }
.ns-challenge-list-row:hover {
  background: rgba(108, 92, 231, 0.06);
  box-shadow: inset 3px 0 0 0 #6c5ce7;
}
.ns-challenge-list-row.ns-solved { box-shadow: inset 3px 0 0 0 #00d170; }
.ns-challenge-list-row.ns-solved:hover {
  box-shadow: inset 3px 0 0 0 #00d170;
  background: rgba(0, 209, 112, 0.04);
}
.ns-cl-status { width: 40px; min-width: 40px; max-width: 40px; text-align: center; flex-shrink: 0; }
.ns-cl-name { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding-right: 1rem; }
.ns-cl-category { width: 130px; min-width: 130px; max-width: 130px; flex-shrink: 0; }
.ns-cl-points { width: 100px; min-width: 100px; max-width: 100px; flex-shrink: 0; text-align: right; padding-right: 1.5rem; }
.ns-cl-solves { width: 80px; min-width: 80px; max-width: 80px; flex-shrink: 0; text-align: right; }
@media (max-width: 767.98px) {
  .ns-challenge-list-header { display: none !important; }
  .ns-challenge-list-row { flex-wrap: wrap !important; gap: 0.3rem; padding: 0.8rem 1rem; }
  .ns-cl-status { width: 30px; min-width: 30px; max-width: 30px; }
  .ns-cl-name { width: calc(100% - 34px); min-width: calc(100% - 34px); max-width: none; white-space: normal; }
  .ns-cl-category, .ns-cl-points, .ns-cl-solves {
    width: auto; min-width: auto; max-width: none;
    font-size: 0.78rem; margin-left: 34px; text-align: left; padding-right: 0.75rem;
  }
}
.ns-category-badge {
  display: inline-block;
  padding: 2px 10px;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  background: rgba(108, 92, 231, 0.1);
  color: #8b7cf0;
  border-radius: 4px;
  border: 1px solid rgba(108, 92, 231, 0.15);
}
.ns-points-value {
  font-weight: 700;
  color: #6c5ce7;
  font-size: 0.95rem;
}
.text-success { color: #00d170 !important; }

/* ============================================
   NAV PILLS (settings/tabs)
   ============================================ */
.nav-pills .nav-link {
  color: #6a6a8a;
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.82rem;
  letter-spacing: 0.02em;
  transition: all 0.25s ease;
}
.nav-pills .nav-link:hover {
  color: #c8c8e0;
  background: rgba(108, 92, 231, 0.08);
}
.nav-pills .nav-link.active {
  background: linear-gradient(135deg, #6c5ce7, #5b4bd6) !important;
  color: #fff !important;
  box-shadow: 0 4px 15px rgba(108, 92, 231, 0.3);
}

/* ============================================
   ALERTS
   ============================================ */
.alert-info {
  --bs-alert-bg: rgba(108, 92, 231, 0.08);
  --bs-alert-border-color: rgba(108, 92, 231, 0.15);
  --bs-alert-color: #b8b0e8;
}

/* ============================================
   BADGES
   ============================================ */
.badge.bg-primary {
  background: linear-gradient(135deg, #6c5ce7, #5b4bd6) !important;
  font-weight: 600;
}
.badge-notification {
  animation: pulse-glow 2s ease-in-out infinite;
}

/* ============================================
   CHALLENGE BUTTONS
   ============================================ */
.challenge-button {
  background: var(--ns-surface) !important;
  border: 1px solid rgba(108, 92, 231, 0.1) !important;
  border-radius: 12px !important;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
  backdrop-filter: blur(6px);
}

/* Radial glow on hover */
.challenge-button::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  background: radial-gradient(circle, rgba(108, 92, 231, 0.1) 0%, transparent 70%);
  transition: width 0.4s ease, height 0.4s ease, top 0.4s ease, left 0.4s ease;
  border-radius: 50%;
  pointer-events: none;
  transform: translate(-50%, -50%);
}
.challenge-button:hover::before {
  width: 300%;
  height: 300%;
}

.challenge-button:hover {
  border-color: rgba(108, 92, 231, 0.35) !important;
  box-shadow: 0 8px 25px rgba(108, 92, 231, 0.15), 0 0 0 1px rgba(108, 92, 231, 0.1);
  transform: translateY(-3px);
}

/* Solved = green accent */
.challenge-button.challenge-solved {
  border-color: rgba(0, 209, 112, 0.3) !important;
  background: rgba(0, 209, 112, 0.04) !important;
}
.challenge-button.challenge-solved:hover {
  box-shadow: 0 8px 25px rgba(0, 209, 112, 0.15), 0 0 20px rgba(0, 209, 112, 0.08) !important;
  border-color: rgba(0, 209, 112, 0.5) !important;
}

/* ============================================
   PAGINATION
   ============================================ */
.page-select {
  background: rgba(11, 12, 34, 0.8);
  color: #c8c8e0;
  border: 1px solid rgba(108, 92, 231, 0.12);
  border-radius: 6px;
  padding: 3px 10px;
}

/* ============================================
   FOOTER
   ============================================ */
.footer {
  padding: 1.5rem 0;
  margin-top: 3rem;
  border-top: none;
  position: relative;
}
.footer::before {
  content: '';
  display: block;
  width: 60px;
  height: 2px;
  margin: 0 auto 1.2rem;
  background: linear-gradient(90deg, transparent, #6c5ce7, transparent);
  box-shadow: 0 0 10px rgba(108, 92, 231, 0.4);
  animation: pulse-glow 3s ease-in-out infinite;
  border-radius: 1px;
}

/* ============================================
   MISC COMPONENTS
   ============================================ */

/* Progress bars */
.progress {
  background: rgba(11, 12, 34, 0.8);
  border-radius: 8px;
  overflow: hidden;
}

/* Dropdowns */
.dropdown-menu {
  background: rgba(11, 12, 34, 0.95) !important;
  border: 1px solid rgba(108, 92, 231, 0.12) !important;
  border-radius: 10px;
  backdrop-filter: blur(16px);
  box-shadow: 0 15px 40px rgba(0, 0, 0, 0.4);
}
.dropdown-item {
  color: #7a7a9a !important;
  font-size: 0.85rem;
  transition: all 0.2s ease;
  border-radius: 6px;
  margin: 2px 4px;
}
.dropdown-item:hover {
  background: rgba(108, 92, 231, 0.1) !important;
  color: #fff !important;
}

/* Toasts */
.toast {
  background: rgba(16, 17, 42, 0.95) !important;
  border: 1px solid rgba(108, 92, 231, 0.12) !important;
  backdrop-filter: blur(12px);
  border-radius: 10px;
}

/* Spinner */
.spinner { color: #6c5ce7; }

/* HR */
hr { border-color: rgba(108, 92, 231, 0.08); }

/* ============================================
   HEADINGS
   ============================================ */
h1 {
  animation: flicker 8s ease-in-out infinite;
}
h1, h2, h3, h4, h5, h6 {
  letter-spacing: -0.02em;
  font-weight: 700;
}

/* ============================================
   LINKS
   ============================================ */
a {
  transition: color 0.2s ease;
}

/* ============================================
   WELCOME PAGE (unauthenticated)
   ============================================ */
.ns-welcome-wrap {
  min-height: calc(100vh - 120px);
  display: flex;
  align-items: center;
  justify-content: center;
}
.ns-welcome {
  max-width: 600px;
  margin: 0 auto;
  padding: 3rem 2rem;
}
.ns-welcome-badge {
  display: inline-block;
  padding: 4px 16px;
  font-size: 0.7rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  background: rgba(108, 92, 231, 0.15);
  color: #6c5ce7;
  border: 1px solid rgba(108, 92, 231, 0.25);
  border-radius: 4px;
  margin-bottom: 1.5rem;
}
.ns-welcome-title {
  font-size: 3rem;
  font-weight: 800;
  letter-spacing: -0.04em;
  margin-bottom: 0.75rem;
  background: linear-gradient(135deg, #fff 0%, #8b7cf0 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.ns-welcome-desc {
  font-size: 1.1rem;
  color: #7a7a9a;
  margin-bottom: 2rem;
  line-height: 1.6;
}
.ns-welcome-actions {
  display: flex;
  gap: 1rem;
  justify-content: center;
  flex-wrap: wrap;
}

/* ============================================
   DASHBOARD (authenticated index)
   ============================================ */
.ns-dash-tabs {
  justify-content: center;
  gap: 0.5rem;
}
.ns-stat-card {
  background: var(--ns-surface);
  border: 1px solid rgba(108, 92, 231, 0.1);
  border-radius: 12px;
  padding: 1.25rem;
  text-align: center;
  backdrop-filter: blur(8px);
  transition: all 0.3s ease;
}
.ns-stat-card:hover {
  border-color: rgba(108, 92, 231, 0.25);
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(108, 92, 231, 0.1);
}
.ns-stat-icon {
  font-size: 1.4rem;
  color: #6c5ce7;
  margin-bottom: 0.5rem;
}
.ns-stat-value {
  font-size: 1.8rem;
  font-weight: 800;
  color: #fff;
  letter-spacing: -0.02em;
}
.ns-stat-label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #6a6a8a;
  font-weight: 600;
  margin-top: 0.2rem;
}

.ns-panel {
  background: var(--ns-surface);
  border: 1px solid rgba(108, 92, 231, 0.1);
  border-radius: 12px;
  overflow: hidden;
  backdrop-filter: blur(8px);
}
.ns-panel-header {
  padding: 0.75rem 1.25rem;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #6c5ce7;
  border-bottom: 1px solid rgba(108, 92, 231, 0.08);
  background: rgba(108, 92, 231, 0.04);
}
.ns-panel-body {
  padding: 0.75rem 1.25rem;
}

/* Rank rows */
.ns-rank-row {
  display: flex;
  align-items: center;
  padding: 0.5rem 0;
  border-bottom: 1px solid rgba(108, 92, 231, 0.05);
}
.ns-rank-row:last-child { border-bottom: none; }
.ns-rank-pos {
  width: 36px;
  font-weight: 800;
  font-size: 0.85rem;
  color: #6a6a8a;
}
.ns-rank-pos.ns-gold { color: #ffd32a; }
.ns-rank-pos.ns-silver { color: #a8a8c0; }
.ns-rank-pos.ns-bronze { color: #cd7f32; }
.ns-rank-name {
  flex: 1;
  font-weight: 600;
  color: #c8c8e0 !important;
  text-decoration: none !important;
}
.ns-rank-name:hover { color: #fff !important; }
.ns-rank-score {
  font-weight: 700;
  color: #6c5ce7;
  font-size: 0.85rem;
}

/* Activity rows */
.ns-activity-row {
  padding: 0.4rem 0;
  font-size: 0.85rem;
  border-bottom: 1px solid rgba(108, 92, 231, 0.04);
}
.ns-activity-row:last-child { border-bottom: none; }

/* Gold/Silver/Bronze in tables */
.ns-gold { color: #ffd32a !important; }
.ns-silver { color: #a8a8c0 !important; }
.ns-bronze { color: #cd7f32 !important; }

/* ============================================
   FIRST BLOOD
   ============================================ */
.ns-firstblood {
  background: linear-gradient(135deg, rgba(255, 71, 87, 0.08), rgba(255, 71, 87, 0.02));
  border: 1px solid rgba(255, 71, 87, 0.15);
  border-radius: 8px;
  padding: 0.5rem 1rem;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.82rem;
}
.ns-fb-label {
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #ff4757;
  font-size: 0.7rem;
}
.ns-fb-user {
  font-weight: 700;
  color: #fff;
}
.ns-fb-team {
  color: #8b7cf0;
  font-weight: 600;
}
.ns-fb-time {
  color: #6a6a8a;
  font-size: 0.75rem;
}
.ns-firstblood-row {
  background: rgba(255, 71, 87, 0.04) !important;
}
.ns-firstblood-row td:first-child {
  font-weight: 700;
}

/* ============================================
   CORRECT FLAG ANIMATION
   ============================================ */
.ns-correct-flag {
  animation: ns-pulse-success 0.6s ease-out;
  position: relative;
  overflow: hidden;
}
.ns-correct-flag::before {
  content: '';
  position: absolute;
  top: 0; left: -100%;
  width: 100%; height: 100%;
  background: linear-gradient(90deg, transparent, rgba(0, 209, 112, 0.15), transparent);
  animation: ns-sweep 0.8s ease-out forwards;
}
@keyframes ns-pulse-success {
  0% { transform: scale(0.95); opacity: 0.5; }
  50% { transform: scale(1.02); }
  100% { transform: scale(1); opacity: 1; }
}
@keyframes ns-sweep {
  0% { left: -100%; }
  100% { left: 100%; }
}

/* Confetti canvas */
#ns-confetti {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  z-index: 99999;
  pointer-events: none;
}

/* ============================================
   ACCESSIBILITY
   ============================================ */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  #ns-particles { display: none; }
}

/* ============================================
   OVERRIDE CTFd ADMIN THEME-COLOR INJECTION
   ============================================ */
:root { --theme-color: #060714 !important; }
html .navbar { background-color: rgba(6, 7, 20, 0.88) !important; }
html .jumbotron { background: transparent !important; }

/* ============================================
   PRINT
   ============================================ */
@media print {
  body { background: #fff !important; color: #000 !important; }
  .navbar, .footer, #ns-particles { display: none !important; }
}

/* ============================================
   CAPTAIN ACTIONS
   ============================================ */
.ns-captain-actions .ns-panel {
  border-color: rgba(108, 92, 231, 0.15);
}
.ns-captain-actions .btn-outline-primary {
  color: #8b7cf0 !important;
  border-color: rgba(108, 92, 231, 0.3) !important;
}
.ns-captain-actions .btn-outline-primary:hover {
  background: rgba(108, 92, 231, 0.15) !important;
  color: #fff !important;
}
.ns-kick-btn {
  padding: 0.2rem 0.5rem !important;
  font-size: 0.75rem !important;
}

/* ============================================
   CTF COUNTDOWN TIMER
   ============================================ */
.ns-countdown {
  background: var(--ns-surface);
  border: 1px solid rgba(108, 92, 231, 0.15);
  border-radius: 12px;
  padding: 1rem 1.5rem;
  text-align: center;
  backdrop-filter: blur(8px);
}
.ns-countdown-label {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: #6c5ce7;
  margin-bottom: 0.5rem;
}
.ns-countdown-timer {
  display: flex;
  justify-content: center;
  gap: 1rem;
}
.ns-countdown-unit {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 54px;
}
.ns-countdown-value {
  font-size: 1.6rem;
  font-weight: 800;
  color: #fff;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}
.ns-countdown-name {
  font-size: 0.6rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: #6a6a8a;
  font-weight: 600;
  margin-top: 0.25rem;
}
.ns-countdown-sep {
  font-size: 1.4rem;
  font-weight: 800;
  color: #6c5ce7;
  align-self: flex-start;
  line-height: 1;
}
.ns-countdown-ended {
  color: #ff4757;
  font-weight: 700;
  font-size: 1rem;
}
.ns-countdown-notstarted {
  color: #ffd32a;
}
.ns-countdown-inprogress {
  color: #00d170;
}

/* ============================================
   FIRST BLOOD INFO IN CHALLENGE MODAL
   ============================================ */
.ns-firstblood-badge {
  display: inline-block;
  background: rgba(255, 71, 87, 0.1);
  border: 1px solid rgba(255, 71, 87, 0.25);
  border-radius: 8px;
  padding: 0.4rem 1rem;
  font-size: 0.82rem;
  color: #ddddf0 !important;
}
.ns-firstblood-badge .fa-tint { color: #ff4757 !important; }
.ns-firstblood-badge .ns-fb-name {
  color: #ff4757 !important;
  font-weight: 700;
  text-decoration: none;
}
.ns-firstblood-badge .ns-fb-name:hover { text-decoration: underline; }
.ns-firstblood-badge .ns-fb-time {
  color: #9999bb !important;
  font-size: 0.75rem;
}
.ns-firstblood-row {
  background: rgba(255, 71, 87, 0.06) !important;
}
.ns-firstblood-row td { color: #ff6b7a !important; }

/* ============================================
   GAMIFIED SCOREBOARD
   ============================================ */

/* --- Podium Section --- */
.ns-podium-section { padding: 1rem 0 0; }
.ns-podium {
  display: flex;
  justify-content: center;
  align-items: flex-end;
  gap: 1.2rem;
  max-width: 700px;
  margin: 0 auto;
}
.ns-podium-slot {
  display: flex;
  flex-direction: column;
  align-items: center;
  cursor: pointer;
  transition: transform 0.25s ease;
  position: relative;
}
.ns-podium-slot:hover { transform: translateY(-6px); }

.ns-podium-avatar {
  width: 60px; height: 60px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.5rem;
  margin-bottom: 0.4rem;
  position: relative;
  z-index: 2;
}
.ns-rank-gold {
  background: linear-gradient(135deg, #ffd700, #f0a500);
  color: #1a1a2e;
  box-shadow: 0 0 25px rgba(255, 215, 0, 0.5), 0 0 60px rgba(255, 215, 0, 0.15);
}
.ns-rank-silver {
  background: linear-gradient(135deg, #c0c0c0, #8a8a9e);
  color: #1a1a2e;
  box-shadow: 0 0 20px rgba(192, 192, 192, 0.35);
}
.ns-rank-bronze {
  background: linear-gradient(135deg, #cd7f32, #a0522d);
  color: #1a1a2e;
  box-shadow: 0 0 20px rgba(205, 127, 50, 0.35);
}

.ns-crown {
  font-size: 1.5rem;
  color: #ffd700;
  margin-bottom: -0.2rem;
  animation: ns-crown-bob 2s ease-in-out infinite;
  filter: drop-shadow(0 0 8px rgba(255, 215, 0, 0.5));
}
@keyframes ns-crown-bob {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-5px); }
}

.ns-podium-rank {
  font-size: 0.7rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #9999bb;
  margin-bottom: 0.15rem;
}
.ns-podium-name {
  font-size: 0.95rem;
  font-weight: 700;
  color: #e8e8f4;
  text-align: center;
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ns-podium-score {
  font-size: 0.8rem;
  font-weight: 600;
  color: #6c5ce7;
  margin-bottom: 0.5rem;
}

.ns-podium-pillar {
  width: 120px;
  border-radius: 8px 8px 0 0;
  background: linear-gradient(180deg, rgba(108, 92, 231, 0.15), rgba(108, 92, 231, 0.04));
  border: 1px solid rgba(108, 92, 231, 0.12);
  border-bottom: none;
  position: relative;
}
.ns-pillar-1 { height: 100px; background: linear-gradient(180deg, rgba(255, 215, 0, 0.12), rgba(108, 92, 231, 0.04)); border-color: rgba(255, 215, 0, 0.15); }
.ns-pillar-2 { height: 72px; background: linear-gradient(180deg, rgba(192, 192, 192, 0.1), rgba(108, 92, 231, 0.04)); border-color: rgba(192, 192, 192, 0.12); }
.ns-pillar-3 { height: 52px; background: linear-gradient(180deg, rgba(205, 127, 50, 0.1), rgba(108, 92, 231, 0.04)); border-color: rgba(205, 127, 50, 0.12); }

.ns-podium-1 { order: 2; }
.ns-podium-2 { order: 1; }
.ns-podium-3 { order: 3; }

/* --- Stats Bar --- */
.ns-stats-bar {
  display: flex;
  justify-content: center;
  gap: 2rem;
  flex-wrap: wrap;
  background: var(--ns-surface);
  border: 1px solid rgba(108, 92, 231, 0.1);
  border-radius: 12px;
  padding: 1rem 1.5rem;
}
.ns-stat-item { text-align: center; min-width: 90px; }
.ns-stat-value {
  font-size: 1.5rem;
  font-weight: 800;
  color: #fff;
  font-variant-numeric: tabular-nums;
}
.ns-stat-label {
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: #6a6a8a;
}

/* --- Scoreboard Split Cards --- */
.ns-sb-card {
  background: var(--ns-surface);
  border: 1px solid rgba(108, 92, 231, 0.1);
  border-radius: 12px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.ns-sb-card-header {
  padding: 0.75rem 1.2rem;
  font-weight: 700;
  font-size: 0.8rem;
  color: #8b7cf0;
  border-bottom: 1px solid rgba(108, 92, 231, 0.08);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

/* --- Top 3 Vertical Podium --- */
.ns-podium-v {
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  flex: 1;
  justify-content: center;
}
.ns-top-entry {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 0.9rem 1rem;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.2s ease;
  border: 1px solid transparent;
}
.ns-top-entry:hover {
  transform: translateX(4px);
  border-color: rgba(108, 92, 231, 0.15);
}
.ns-top-1 { background: rgba(255, 215, 0, 0.06); border-color: rgba(255, 215, 0, 0.1); }
.ns-top-1:hover { background: rgba(255, 215, 0, 0.1); border-color: rgba(255, 215, 0, 0.2); }
.ns-top-2 { background: rgba(192, 192, 192, 0.04); border-color: rgba(192, 192, 192, 0.08); }
.ns-top-2:hover { background: rgba(192, 192, 192, 0.08); border-color: rgba(192, 192, 192, 0.15); }
.ns-top-3 { background: rgba(205, 127, 50, 0.04); border-color: rgba(205, 127, 50, 0.08); }
.ns-top-3:hover { background: rgba(205, 127, 50, 0.08); border-color: rgba(205, 127, 50, 0.15); }

.ns-top-left {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.ns-top-badge {
  width: 42px; height: 42px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.1rem;
  flex-shrink: 0;
}
.ns-top-name {
  font-size: 0.95rem;
  font-weight: 700;
  color: #e8e8f4;
  line-height: 1.2;
}
.ns-top-1 .ns-top-name { color: #ffd700; }
.ns-top-2 .ns-top-name { color: #d0d0e0; }
.ns-top-3 .ns-top-name { color: #e0a060; }

.ns-top-score {
  font-size: 0.75rem;
  font-weight: 600;
  color: #9999bb;
  font-variant-numeric: tabular-nums;
}
.ns-top-1 .ns-top-score { color: #f0c050; }

.ns-top-bar-wrap {
  height: 6px;
  background: rgba(108, 92, 231, 0.06);
  border-radius: 3px;
  overflow: hidden;
}
.ns-top-bar {
  height: 100%;
  border-radius: 3px;
  transition: width 1s ease-out;
}

/* --- Score Graph Container --- */
#score-graph {
  flex: 1;
  min-height: 0;
}

/* --- Team Members in Scoreboard --- */
.ns-top-members {
  font-size: 0.8rem;
  color: #9999bb;
  line-height: 1.4;
  margin-top: 0.15rem;
}
.ns-top-members i { font-size: 0.7rem; color: #8b7cf0; }
.ns-members-line {
  font-size: 0.8rem;
  color: #9999bb;
  margin-top: 0.2rem;
  line-height: 1.4;
}
.ns-members-line i { font-size: 0.7rem; color: #8b7cf0; }

/* --- Teams Listing: Member Chips --- */
.ns-team-members-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  align-items: center;
}
.ns-member-chip {
  display: inline-flex;
  align-items: center;
  font-size: 0.8rem;
  font-weight: 600;
  color: #c8c8e0;
  background: rgba(108, 92, 231, 0.1);
  border: 1px solid rgba(108, 92, 231, 0.15);
  border-radius: 999px;
  padding: 0.2rem 0.65rem;
  transition: all 0.15s;
}
.ns-member-chip:hover {
  background: rgba(108, 92, 231, 0.2);
  border-color: rgba(108, 92, 231, 0.3);
}
.ns-member-chip i {
  font-size: 0.65rem;
  color: #8b7cf0;
}

/* --- Standings Table --- */
.ns-standings-card {
  background: var(--ns-surface);
  border: 1px solid rgba(108, 92, 231, 0.1);
  border-radius: 12px;
  overflow: hidden;
  margin-bottom: 2rem;
}
.ns-standings-header {
  padding: 0.8rem 1.2rem;
  font-weight: 700;
  font-size: 0.85rem;
  color: #8b7cf0;
  border-bottom: 1px solid rgba(108, 92, 231, 0.08);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.ns-standings-table {
  background: transparent !important;
}
.ns-standings-table thead th {
  background: rgba(108, 92, 231, 0.06) !important;
  color: #7a7a9a !important;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  border-bottom: 1px solid rgba(108, 92, 231, 0.08) !important;
  padding: 0.7rem 0.5rem;
}
.ns-standings-table tbody tr {
  border-bottom: 1px solid rgba(108, 92, 231, 0.04);
  transition: background 0.15s;
}
.ns-standings-table tbody tr:hover {
  background: rgba(108, 92, 231, 0.06) !important;
}

/* Row entrance animation */
.ns-standing-row {
  animation: ns-row-in 0.4s ease-out both;
}
@keyframes ns-row-in {
  from { opacity: 0; transform: translateX(-15px); }
  to { opacity: 1; transform: translateX(0); }
}

/* Rank-specific row highlights */
.ns-rank-1 { background: rgba(255, 215, 0, 0.04) !important; }
.ns-rank-2 { background: rgba(192, 192, 192, 0.03) !important; }
.ns-rank-3 { background: rgba(205, 127, 50, 0.03) !important; }
.ns-rank-top10 { background: rgba(108, 92, 231, 0.02) !important; }

/* Rank badges */
.ns-rank-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px; height: 32px;
  border-radius: 50%;
  font-size: 0.75rem;
  font-weight: 800;
}
.ns-badge-gold {
  background: linear-gradient(135deg, #ffd700, #f0a500);
  color: #1a1a2e;
  box-shadow: 0 0 12px rgba(255, 215, 0, 0.35);
  font-size: 0.9rem;
}
.ns-badge-silver {
  background: linear-gradient(135deg, #c0c0c0, #8a8a9e);
  color: #1a1a2e;
  box-shadow: 0 0 8px rgba(192, 192, 192, 0.25);
  font-size: 0.85rem;
}
.ns-badge-bronze {
  background: linear-gradient(135deg, #cd7f32, #a0522d);
  color: #1a1a2e;
  box-shadow: 0 0 8px rgba(205, 127, 50, 0.25);
  font-size: 0.85rem;
}
.ns-badge-default {
  background: rgba(108, 92, 231, 0.12);
  color: #9999bb;
  border: 1px solid rgba(108, 92, 231, 0.15);
}

/* Team link */
.ns-team-link {
  color: #e8e8f4 !important;
  text-decoration: none !important;
  font-weight: 600;
  transition: color 0.15s;
}
.ns-team-link:hover { color: #8b7cf0 !important; }

.ns-rank-1 .ns-team-link { color: #ffd700 !important; }
.ns-rank-2 .ns-team-link { color: #d0d0e0 !important; }
.ns-rank-3 .ns-team-link { color: #e0a060 !important; }

/* Score value */
.ns-score-value {
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  color: #e8e8f4;
  font-size: 0.95rem;
}
.ns-rank-1 .ns-score-value { color: #ffd700; }

/* Leader streak badge */
.ns-streak-badge {
  display: inline-block;
  font-size: 0.6rem;
  font-weight: 700;
  padding: 0.15rem 0.45rem;
  border-radius: 999px;
  background: linear-gradient(135deg, #ff4757, #ff6b7a);
  color: #fff !important;
  animation: ns-pulse-glow 2s ease-in-out infinite;
}
@keyframes ns-pulse-glow {
  0%, 100% { box-shadow: 0 0 4px rgba(255, 71, 87, 0.4); }
  50% { box-shadow: 0 0 12px rgba(255, 71, 87, 0.6); }
}

/* Progress bar */
.ns-progress-track {
  position: relative;
  height: 20px;
  background: rgba(108, 92, 231, 0.06);
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid rgba(108, 92, 231, 0.08);
}
.ns-progress-fill {
  height: 100%;
  border-radius: 10px;
  transition: width 1s ease-out;
  min-width: 2px;
}
.ns-progress-label {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 0.6rem;
  font-weight: 700;
  color: #9999bb;
}

.ns-bar-gold { background: linear-gradient(90deg, #ffd700, #f0a500); box-shadow: 0 0 8px rgba(255, 215, 0, 0.3); }
.ns-bar-silver { background: linear-gradient(90deg, #c0c0c0, #8a8a9e); }
.ns-bar-bronze { background: linear-gradient(90deg, #cd7f32, #a0522d); }
.ns-bar-top10 { background: linear-gradient(90deg, #6c5ce7, #8b7cf0); }
.ns-bar-default { background: linear-gradient(90deg, rgba(108, 92, 231, 0.4), rgba(108, 92, 231, 0.2)); }

/* Bracket bar */
.ns-bracket-bar .nav-pills { gap: 0.5rem; }
.ns-bracket-bar .nav-link {
  border-radius: 8px !important;
  font-size: 0.8rem;
  font-weight: 600;
  padding: 0.4rem 1rem;
  color: #9999bb !important;
  border: 1px solid rgba(108, 92, 231, 0.1);
  background: transparent;
  transition: all 0.2s;
}
.ns-bracket-bar .nav-link:hover { background: rgba(108, 92, 231, 0.08); color: #e8e8f4 !important; }
.ns-bracket-bar .nav-link.active {
  background: linear-gradient(135deg, #6c5ce7, #4834d4) !important;
  color: #fff !important;
  border-color: transparent;
}

/* Responsive podium */
@media (max-width: 576px) {
  .ns-podium { gap: 0.5rem; }
  .ns-podium-pillar { width: 85px; }
  .ns-podium-avatar { width: 46px; height: 46px; font-size: 1.1rem; }
  .ns-podium-name { font-size: 0.75rem; max-width: 85px; }
  .ns-stats-bar { gap: 1rem; padding: 0.8rem 1rem; }
  .ns-stat-value { font-size: 1.1rem; }
}

/* --- Activity Row Time --- */
.ns-activity-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.ns-activity-time {
  font-size: 0.7rem;
  font-weight: 600;
  color: #6a6a8a;
  white-space: nowrap;
  margin-left: 0.75rem;
  font-variant-numeric: tabular-nums;
}
