/* ═══════════════════════════════════════════════════════════════════════════════
   CSPT Lab — Cyberpunk Theme
   ═══════════════════════════════════════════════════════════════════════════════ */

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

:root {
  /* Neon palette */
  --neon-cyan: #00ffd5;
  --neon-magenta: #ff2d55;
  --neon-blue: #007aff;
  --neon-green: #39ff14;
  --neon-yellow: #ffe600;
  --neon-purple: #bf5af2;
  --neon-orange: #ff9500;

  /* Surfaces */
  --bg-deep: #050a12;
  --bg-surface: #0b1220;
  --bg-card: #0f1a2e;
  --bg-elevated: #162040;
  --bg-input: #0d1525;
  --border-dim: rgba(0, 255, 213, 0.08);
  --border-glow: rgba(0, 255, 213, 0.25);

  /* Text */
  --text-primary: #e8edf5;
  --text-secondary: #7a8ba7;
  --text-dim: #4a5a73;

  /* Fonts */
  --font-mono: "JetBrains Mono", "Fira Code", "Cascadia Code", monospace;
  --font-display: "Outfit", system-ui, -apple-system, sans-serif;

  /* Spacing */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-xl: 20px;
}

html {
  font-size: 15px;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-mono);
  background: var(--bg-deep);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
  position: relative;
}

/* ─── Scanline overlay ─────────────────────────────────────────────────── */
.scanlines {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 9999;
  background: repeating-linear-gradient(
    0deg,
    rgba(0, 0, 0, 0) 0px,
    rgba(0, 0, 0, 0) 2px,
    rgba(0, 0, 0, 0.03) 2px,
    rgba(0, 0, 0, 0.03) 4px
  );
}

/* ─── Background Effects ───────────────────────────────────────────────── */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  background:
    radial-gradient(ellipse 600px 400px at 20% 10%, rgba(0, 255, 213, 0.04) 0%, transparent 70%),
    radial-gradient(ellipse 500px 500px at 80% 80%, rgba(255, 45, 85, 0.03) 0%, transparent 70%),
    radial-gradient(ellipse 400px 300px at 50% 50%, rgba(0, 122, 255, 0.02) 0%, transparent 70%);
  pointer-events: none;
  z-index: 0;
}

/* ─── Scrollbar ────────────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg-deep); }
::-webkit-scrollbar-thumb { background: rgba(0, 255, 213, 0.2); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(0, 255, 213, 0.4); }

/* ─── Selection ───────────────────────────────────────────────────────── */
::selection {
  background: rgba(0, 255, 213, 0.25);
  color: #fff;
}

/* ═══════════════════════════════════════════════════════════════════════════════
   Header
   ═══════════════════════════════════════════════════════════════════════════════ */
.lab-header {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 32px;
  background: rgba(5, 10, 18, 0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border-dim);
}

.header-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.logo-glyph {
  font-size: 2rem;
  font-weight: 700;
  line-height: 1;
  letter-spacing: -2px;
}
.logo-dot {
  color: var(--neon-cyan);
  text-shadow: 0 0 10px rgba(0, 255, 213, 0.5);
}
.logo-slash {
  color: var(--neon-magenta);
  text-shadow: 0 0 10px rgba(255, 45, 85, 0.5);
}

.header-text h1 {
  font-family: var(--font-display);
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: 0.5px;
}

.subtitle {
  font-size: 0.7rem;
  color: var(--text-secondary);
  letter-spacing: 1px;
  text-transform: uppercase;
  margin-top: 2px;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 20px;
}

.progress-display {
  display: flex;
  align-items: baseline;
  gap: 4px;
  padding: 8px 16px;
  background: rgba(0, 255, 213, 0.05);
  border: 1px solid var(--border-dim);
  border-radius: var(--radius-md);
}
.progress-label {
  font-size: 0.6rem;
  color: var(--text-dim);
  letter-spacing: 2px;
  text-transform: uppercase;
  margin-right: 6px;
}
.progress-count {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--neon-cyan);
  text-shadow: 0 0 8px rgba(0, 255, 213, 0.4);
}
.progress-sep {
  font-size: 1rem;
  color: var(--text-dim);
}
.progress-total {
  font-size: 1rem;
  color: var(--text-secondary);
}

.research-link {
  font-size: 0.8rem;
  color: var(--neon-cyan);
  text-decoration: none;
  padding: 8px 14px;
  border: 1px solid rgba(0, 255, 213, 0.15);
  border-radius: var(--radius-sm);
  transition: all 0.3s ease;
}
.research-link:hover {
  background: rgba(0, 255, 213, 0.08);
  border-color: rgba(0, 255, 213, 0.3);
  text-shadow: 0 0 6px rgba(0, 255, 213, 0.3);
}

/* ═══════════════════════════════════════════════════════════════════════════════
   Main
   ═══════════════════════════════════════════════════════════════════════════════ */
.lab-main {
  position: relative;
  z-index: 1;
  max-width: 1200px;
  margin: 0 auto;
  padding: 40px 24px 80px;
}

/* ═══════════════════════════════════════════════════════════════════════════════
   Challenge Cards Grid
   ═══════════════════════════════════════════════════════════════════════════════ */
.challenges-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 20px;
}

.challenge-card {
  position: relative;
  padding: 28px 24px;
  background: var(--bg-card);
  border: 1px solid var(--border-dim);
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  overflow: hidden;
}
.challenge-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--card-accent), transparent);
  opacity: 0.5;
  transition: opacity 0.35s;
}
.challenge-card:hover {
  border-color: var(--border-glow);
  transform: translateY(-4px);
  box-shadow:
    0 8px 32px rgba(0, 0, 0, 0.4),
    0 0 20px rgba(0, 255, 213, 0.04);
}
.challenge-card:hover::before {
  opacity: 1;
}

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

.card-badge {
  font-size: 0.65rem;
  font-weight: 600;
  color: var(--card-accent);
  letter-spacing: 2px;
  text-transform: uppercase;
  padding: 4px 10px;
  border: 1px solid currentColor;
  border-radius: var(--radius-sm);
  opacity: 0.8;
}

.card-difficulty {
  font-size: 0.6rem;
  font-weight: 500;
  letter-spacing: 1px;
  text-transform: uppercase;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
}
.card-difficulty.easy {
  color: var(--neon-green);
  background: rgba(57, 255, 20, 0.08);
}
.card-difficulty.medium {
  color: var(--neon-yellow);
  background: rgba(255, 230, 0, 0.08);
}
.card-difficulty.hard {
  color: var(--neon-orange);
  background: rgba(255, 149, 0, 0.08);
}
.card-difficulty.expert {
  color: var(--neon-magenta);
  background: rgba(255, 45, 85, 0.08);
}

.card-title {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.card-desc {
  font-size: 0.78rem;
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 16px;
}

.card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.card-tag {
  font-size: 0.6rem;
  color: var(--text-dim);
  padding: 3px 8px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: var(--radius-sm);
  letter-spacing: 0.5px;
}

.card-status {
  position: absolute;
  bottom: 16px;
  right: 16px;
  font-size: 1.2rem;
  opacity: 0.5;
}
.card-status.solved {
  opacity: 1;
}

/* Card accent colors */
.challenge-card[data-challenge="1"] { --card-accent: var(--neon-cyan); }
.challenge-card[data-challenge="2"] { --card-accent: var(--neon-green); }
.challenge-card[data-challenge="3"] { --card-accent: var(--neon-yellow); }
.challenge-card[data-challenge="4"] { --card-accent: var(--neon-purple); }
.challenge-card[data-challenge="5"] { --card-accent: var(--neon-magenta); }
.challenge-card[data-challenge="6"] { --card-accent: var(--neon-orange); }

/* ═══════════════════════════════════════════════════════════════════════════════
   Challenge Panel
   ═══════════════════════════════════════════════════════════════════════════════ */
.challenge-panel {
  animation: panelSlideIn 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}
@keyframes panelSlideIn {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

.back-btn {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--text-secondary);
  background: none;
  border: 1px solid var(--border-dim);
  border-radius: var(--radius-sm);
  padding: 8px 16px;
  cursor: pointer;
  margin-bottom: 24px;
  transition: all 0.3s;
}
.back-btn:hover {
  color: var(--neon-cyan);
  border-color: rgba(0, 255, 213, 0.3);
}

.panel-header {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 32px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border-dim);
}

.panel-badge {
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--neon-cyan);
  letter-spacing: 2px;
  padding: 6px 12px;
  border: 1px solid rgba(0, 255, 213, 0.2);
  border-radius: var(--radius-sm);
  background: rgba(0, 255, 213, 0.05);
}

.panel-title {
  font-family: var(--font-display);
  font-size: 1.6rem;
  font-weight: 700;
  flex: 1;
}

.panel-difficulty {
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  padding: 6px 14px;
  border-radius: var(--radius-sm);
}

/* Panel sections */
.panel-body > div {
  margin-bottom: 28px;
}
.panel-body h3 {
  font-family: var(--font-display);
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 12px;
  letter-spacing: 0.3px;
}

/* Briefing */
.briefing-text {
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.75;
  padding: 16px 20px;
  background: var(--bg-surface);
  border-left: 3px solid var(--neon-cyan);
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
}

/* Code block */
.code-block {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  line-height: 1.7;
  color: var(--neon-green);
  background: #060d15;
  border: 1px solid rgba(57, 255, 20, 0.1);
  border-radius: var(--radius-md);
  padding: 20px 24px;
  overflow-x: auto;
  white-space: pre;
}

/* Framework text */
.framework-text {
  font-size: 0.82rem;
  color: var(--text-secondary);
  line-height: 1.7;
  padding: 16px 20px;
  background: rgba(191, 90, 242, 0.04);
  border: 1px solid rgba(191, 90, 242, 0.1);
  border-radius: var(--radius-md);
}

/* Hint */
.hint-toggle {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--neon-yellow);
  background: rgba(255, 230, 0, 0.05);
  border: 1px solid rgba(255, 230, 0, 0.15);
  border-radius: var(--radius-sm);
  padding: 10px 18px;
  cursor: pointer;
  transition: all 0.3s;
}
.hint-toggle:hover {
  background: rgba(255, 230, 0, 0.1);
  border-color: rgba(255, 230, 0, 0.3);
}

.hint-content {
  font-size: 0.82rem;
  color: var(--neon-yellow);
  background: rgba(255, 230, 0, 0.04);
  border: 1px solid rgba(255, 230, 0, 0.1);
  border-radius: var(--radius-md);
  padding: 16px 20px;
  margin-top: 10px;
  line-height: 1.7;
}

/* ─── Test / Exploit Console ──────────────────────────────────────────── */
.test-input-row {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-bottom: 12px;
}
.test-label {
  font-size: 0.75rem;
  color: var(--text-dim);
  white-space: nowrap;
}
.test-input {
  flex: 1;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--neon-cyan);
  background: var(--bg-input);
  border: 1px solid var(--border-dim);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  outline: none;
  transition: border-color 0.3s;
}
.test-input:focus {
  border-color: rgba(0, 255, 213, 0.4);
  box-shadow: 0 0 12px rgba(0, 255, 213, 0.06);
}
.test-input::placeholder {
  color: var(--text-dim);
}

.test-btn {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--bg-deep);
  background: var(--neon-cyan);
  border: none;
  border-radius: var(--radius-sm);
  padding: 12px 24px;
  cursor: pointer;
  transition: all 0.3s;
  white-space: nowrap;
}
.test-btn:hover {
  background: #33ffe0;
  box-shadow: 0 0 16px rgba(0, 255, 213, 0.3);
}
.test-btn:active {
  transform: scale(0.97);
}

.test-url-preview {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  background: rgba(0, 0, 0, 0.3);
  border-radius: var(--radius-sm);
}
.url-label {
  font-size: 0.65rem;
  color: var(--text-dim);
  letter-spacing: 1px;
  text-transform: uppercase;
  white-space: nowrap;
}
.url-value {
  font-size: 0.82rem;
  color: var(--neon-green);
  word-break: break-all;
}

/* ─── Traffic Viewer ──────────────────────────────────────────────────── */
.traffic-viewer {
  background: #060d15;
  border: 1px solid var(--border-dim);
  border-radius: var(--radius-md);
  padding: 16px 20px;
  max-height: 200px;
  overflow-y: auto;
  font-size: 0.78rem;
  line-height: 1.8;
}
.traffic-empty,
.response-empty {
  color: var(--text-dim);
  font-style: italic;
  text-align: center;
  padding: 20px;
}

.traffic-line {
  display: flex;
  gap: 8px;
  padding: 3px 0;
}
.traffic-method {
  color: var(--neon-magenta);
  font-weight: 600;
  min-width: 40px;
}
.traffic-url {
  color: var(--text-primary);
  word-break: break-all;
}
.traffic-status {
  color: var(--neon-green);
  font-weight: 600;
  margin-left: auto;
  white-space: nowrap;
}
.traffic-status.error {
  color: var(--neon-magenta);
}

/* ─── Response Viewer ─────────────────────────────────────────────────── */
.response-viewer {
  background: #060d15;
  border: 1px solid var(--border-dim);
  border-radius: var(--radius-md);
  padding: 16px 20px;
  max-height: 300px;
  overflow-y: auto;
  font-size: 0.78rem;
  line-height: 1.7;
}
.response-json {
  white-space: pre-wrap;
  word-break: break-all;
}
.response-key {
  color: var(--neon-purple);
}
.response-string {
  color: var(--neon-green);
}
.response-number {
  color: var(--neon-cyan);
}
.response-bool {
  color: var(--neon-yellow);
}
.response-null {
  color: var(--text-dim);
}
.response-flag {
  color: var(--neon-magenta);
  font-weight: 700;
  text-shadow: 0 0 8px rgba(255, 45, 85, 0.4);
  animation: flagPulse 1.5s ease-in-out infinite alternate;
}
@keyframes flagPulse {
  from { opacity: 0.8; }
  to { opacity: 1; text-shadow: 0 0 14px rgba(255, 45, 85, 0.7); }
}

/* ─── XSS Render Section ─────────────────────────────────────────────── */
.xss-render-section {
  border: 2px dashed rgba(255, 45, 85, 0.3);
  border-radius: var(--radius-lg);
  padding: 20px;
  background: rgba(255, 45, 85, 0.02);
}
.danger-tag {
  font-size: 0.6rem;
  color: var(--neon-magenta);
  background: rgba(255, 45, 85, 0.1);
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  margin-left: 8px;
  vertical-align: middle;
}
.xss-render-target {
  min-height: 80px;
  padding: 16px;
  background: rgba(0, 0, 0, 0.3);
  border-radius: var(--radius-md);
  border: 1px solid rgba(255, 45, 85, 0.1);
}

/* ─── Flag Section ────────────────────────────────────────────────────── */
.flag-section {
  padding-top: 24px;
  border-top: 1px solid var(--border-dim);
}
.flag-input-row {
  display: flex;
  gap: 10px;
}
.flag-input {
  flex: 1;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--neon-magenta);
  background: var(--bg-input);
  border: 1px solid rgba(255, 45, 85, 0.15);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  outline: none;
  transition: border-color 0.3s;
}
.flag-input:focus {
  border-color: rgba(255, 45, 85, 0.4);
  box-shadow: 0 0 12px rgba(255, 45, 85, 0.06);
}
.flag-input::placeholder {
  color: var(--text-dim);
}

.flag-btn {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  font-weight: 600;
  color: #fff;
  background: var(--neon-magenta);
  border: none;
  border-radius: var(--radius-sm);
  padding: 12px 28px;
  cursor: pointer;
  transition: all 0.3s;
}
.flag-btn:hover {
  background: #ff4d70;
  box-shadow: 0 0 16px rgba(255, 45, 85, 0.3);
}

.flag-result {
  margin-top: 12px;
  font-size: 0.85rem;
  min-height: 24px;
}
.flag-result.success {
  color: var(--neon-green);
  text-shadow: 0 0 8px rgba(57, 255, 20, 0.3);
}
.flag-result.error {
  color: var(--neon-magenta);
}

/* ═══════════════════════════════════════════════════════════════════════════════
   Footer
   ═══════════════════════════════════════════════════════════════════════════════ */
.lab-footer {
  position: relative;
  z-index: 1;
  text-align: center;
  padding: 24px;
  border-top: 1px solid var(--border-dim);
  font-size: 0.72rem;
  color: var(--text-dim);
}
.lab-footer a {
  color: var(--neon-cyan);
  text-decoration: none;
}
.lab-footer a:hover {
  text-decoration: underline;
}

/* ═══════════════════════════════════════════════════════════════════════════════
   Animations
   ═══════════════════════════════════════════════════════════════════════════════ */
@keyframes cardFadeIn {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}
.challenge-card {
  animation: cardFadeIn 0.5s cubic-bezier(0.4, 0, 0.2, 1) both;
}
.challenge-card:nth-child(1) { animation-delay: 0.05s; }
.challenge-card:nth-child(2) { animation-delay: 0.1s; }
.challenge-card:nth-child(3) { animation-delay: 0.15s; }
.challenge-card:nth-child(4) { animation-delay: 0.2s; }
.challenge-card:nth-child(5) { animation-delay: 0.25s; }
.challenge-card:nth-child(6) { animation-delay: 0.3s; }

/* Glow pulse for solved cards */
@keyframes solvedGlow {
  0%, 100% { box-shadow: 0 0 0 rgba(57, 255, 20, 0); }
  50% { box-shadow: 0 0 20px rgba(57, 255, 20, 0.08); }
}
.challenge-card.solved {
  border-color: rgba(57, 255, 20, 0.2);
  animation: solvedGlow 3s ease-in-out infinite;
}

/* ═══════════════════════════════════════════════════════════════════════════════
   Responsive
   ═══════════════════════════════════════════════════════════════════════════════ */
@media (max-width: 768px) {
  .lab-header {
    flex-direction: column;
    gap: 12px;
    padding: 14px 16px;
  }
  .header-right {
    width: 100%;
    justify-content: space-between;
  }
  .challenges-grid {
    grid-template-columns: 1fr;
  }
  .lab-main {
    padding: 24px 14px 60px;
  }
  .test-input-row {
    flex-direction: column;
    align-items: stretch;
  }
  .flag-input-row {
    flex-direction: column;
  }
  .panel-header {
    flex-wrap: wrap;
  }
}
