/* Challenge Pages — Dark Hacking Theme */
@import url('https://fonts.googleapis.com/css2?family=Montserrat:wght@300;400;500;600;700;800;900&family=Poppins:wght@300;400;500;600;700&family=JetBrains+Mono:wght@400;500;700&display=swap');

:root {
  --cyan:     #32FAE6;
  --cyan-dim: #177D86;
  --purple:   #4300FF;
  --yellow:   #D6FF00;
  --pink:     #FF0086;
  --green:    #00ff41;
  --bg:       #0a0e17;
  --bg2:      #0d1221;
  --bg3:      #111827;
  --border:   rgba(50, 250, 230, 0.25);
  --text:     #c8d8e8;
}

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

/* ── Matrix Rain Canvas ────────────────────────────────────────────────────── */
#matrix-bg {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  z-index: 0;
  opacity: 0.13;
  pointer-events: none;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Poppins', sans-serif;
  min-height: 100vh;
  position: relative;
}

/* ── Scanlines Overlay ─────────────────────────────────────────────────────── */
body::before {
  content: '';
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    rgba(0, 255, 65, 0.018) 2px,
    rgba(0, 255, 65, 0.018) 4px
  );
  pointer-events: none;
  z-index: 1;
}

/* ── Vignette ──────────────────────────────────────────────────────────────── */
body::after {
  content: '';
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: radial-gradient(ellipse at center, transparent 55%, rgba(0,0,0,0.55) 100%);
  pointer-events: none;
  z-index: 2;
}

header, .container, footer {
  position: relative;
  z-index: 10;
}

/* ── Header ────────────────────────────────────────────────────────────────── */
header {
  background: rgba(10, 14, 23, 0.82);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid rgba(50, 250, 230, 0.18);
  padding: 1rem 2rem;
  display: flex;
  align-items: center;
  gap: 1rem;
}

header .logo {
  font-family: 'Montserrat', sans-serif;
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--cyan);
  text-shadow: 0 0 10px var(--cyan), 0 0 22px rgba(50,250,230,0.45);
  letter-spacing: 2px;
}

header nav a {
  font-family: 'Montserrat', sans-serif;
  color: var(--cyan-dim);
  text-decoration: none;
  margin-left: 1.5rem;
  font-size: 0.85rem;
  letter-spacing: 1px;
  transition: color 0.2s, text-shadow 0.2s;
}
header nav a:hover {
  color: var(--cyan);
  text-shadow: 0 0 8px var(--cyan), 0 0 18px rgba(50,250,230,0.4);
}

.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 2rem;
}

/* ── Glitch Text ───────────────────────────────────────────────────────────── */
@keyframes glitch-clip-a {
  0%    { clip-path: inset(0 0 97% 0); transform: translate(-3px, 0); }
  6%    { clip-path: inset(28% 0 62% 0); transform: translate(3px, 0); }
  12%   { clip-path: inset(65% 0 25% 0); transform: translate(-2px, 0); }
  18%   { clip-path: inset(0 0 100% 0); transform: translate(0, 0); }
  100%  { clip-path: inset(0 0 100% 0); transform: translate(0, 0); }
}
@keyframes glitch-clip-b {
  0%    { clip-path: inset(0 0 97% 0); transform: translate(3px, 0); color: var(--pink); }
  6%    { clip-path: inset(55% 0 35% 0); transform: translate(-3px, 0); color: var(--pink); }
  12%   { clip-path: inset(80% 0 10% 0); transform: translate(2px, 0); color: var(--cyan); }
  18%   { clip-path: inset(0 0 100% 0); transform: translate(0, 0); color: transparent; }
  100%  { clip-path: inset(0 0 100% 0); transform: translate(0, 0); color: transparent; }
}

h1, h2, h3, h4, h5, h6 {
  font-family: 'Montserrat', sans-serif;
  color: var(--cyan);
  text-shadow: 0 0 8px var(--cyan-dim), 0 0 22px rgba(50,250,230,0.3);
  letter-spacing: 2px;
  margin-bottom: 1rem;
}

h1 {
  font-size: 2rem;
  position: relative;
}
h1::before,
h1::after {
  content: attr(data-text);
  position: absolute;
  top: 0; left: 0;
  width: 100%;
  pointer-events: none;
}
h1::before {
  color: var(--pink);
  opacity: 0.75;
  animation: glitch-clip-b 5s infinite;
}
h1::after {
  color: var(--cyan);
  opacity: 0.55;
  animation: glitch-clip-a 5s infinite;
  animation-delay: 0.08s;
}

h2 { font-size: 1.4rem; }

p { margin-bottom: 0.8rem; line-height: 1.6; }

/* ── Challenges Grid ───────────────────────────────────────────────────────── */
.challenges-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1.5rem;
  margin-top: 2rem;
}

/* ── Glassmorphism Card ────────────────────────────────────────────────────── */
@keyframes border-sweep {
  0%   { background-position: 0% 50%; }
  50%  { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

.card {
  background: rgba(10, 20, 55, 0.52);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border: 1px solid rgba(50, 250, 230, 0.2);
  border-radius: 8px;
  padding: 1.5rem;
  position: relative;
  overflow: hidden;
  transition: border-color 0.3s, box-shadow 0.3s;
}

.card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: linear-gradient(90deg,
    transparent 0%,
    var(--cyan) 30%,
    var(--purple) 60%,
    var(--cyan) 80%,
    transparent 100%
  );
  background-size: 300% 100%;
  animation: border-sweep 3s ease-in-out infinite;
}

.card:hover {
  border-color: rgba(50, 250, 230, 0.5);
  box-shadow: 0 0 28px rgba(50,250,230,0.15), 0 0 55px rgba(50,250,230,0.06);
}

.card .difficulty {
  font-family: 'Montserrat', sans-serif;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 2px;
  display: inline-block;
  margin-bottom: 0.8rem;
  letter-spacing: 1px;
}
.diff-easy   { background: rgba(50,250,230,0.1);  color: var(--cyan);   border: 1px solid var(--cyan); }
.diff-medium { background: rgba(214,255,0,0.1);   color: var(--yellow); border: 1px solid var(--yellow); }
.diff-hard   { background: rgba(255,0,134,0.1);   color: var(--pink);   border: 1px solid var(--pink); }

.card h3 { font-size: 1rem; margin-bottom: 0.5rem; }
.card p  { font-size: 0.85rem; color: var(--text); margin-bottom: 1rem; }

/* ── Button ────────────────────────────────────────────────────────────────── */
.btn {
  display: inline-block;
  padding: 0.5rem 1.2rem;
  background: var(--purple);
  color: #fff;
  border: 1px solid var(--purple);
  border-radius: 2px;
  text-decoration: none;
  font-family: 'Montserrat', sans-serif;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  letter-spacing: 1px;
}
.btn:hover {
  background: var(--purple);
  color: #fff;
  box-shadow: 0 0 16px rgba(67,0,255,0.65), 0 0 32px rgba(67,0,255,0.3);
}

/* ── Glassmorphism Challenge Box ───────────────────────────────────────────── */
.challenge-container {
  max-width: 700px;
  margin: 0 auto;
}

.challenge-box {
  background: rgba(10, 20, 55, 0.52);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border: 1px solid rgba(50, 250, 230, 0.2);
  border-radius: 8px;
  padding: 2rem;
  margin-top: 1.5rem;
  position: relative;
  overflow: hidden;
}
.challenge-box::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: linear-gradient(90deg,
    transparent 0%,
    var(--cyan) 30%,
    var(--purple) 60%,
    var(--cyan) 80%,
    transparent 100%
  );
  background-size: 300% 100%;
  animation: border-sweep 3s ease-in-out infinite;
}

/* ── Forms ─────────────────────────────────────────────────────────────────── */
.form-group { margin-bottom: 1.2rem; }
.form-group label {
  display: block;
  font-family: 'Poppins', sans-serif;
  color: var(--cyan-dim);
  font-size: 0.8rem;
  letter-spacing: 1px;
  margin-bottom: 0.4rem;
}
.form-group input,
.form-group textarea,
.form-group select {
  width: 100%;
  background: rgba(5, 10, 25, 0.8);
  border: 1px solid #1e3050;
  color: var(--text);
  padding: 0.6rem 0.8rem;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.9rem;
  border-radius: 2px;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.form-group input:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--cyan);
  box-shadow: 0 0 10px rgba(50,250,230,0.25);
}

/* ── Hint ──────────────────────────────────────────────────────────────────── */
.hint {
  background: rgba(50, 250, 230, 0.05);
  border: 1px solid rgba(50, 250, 230, 0.2);
  border-radius: 4px;
  padding: 1rem;
  margin-top: 1rem;
  font-size: 0.8rem;
  color: var(--cyan-dim);
}
.hint::before { content: '> HINT: '; color: var(--cyan-dim); }

/* ── Alerts ────────────────────────────────────────────────────────────────── */
.alert {
  padding: 0.8rem 1rem;
  border-radius: 3px;
  margin: 1rem 0;
  font-size: 0.9rem;
  font-family: 'Poppins', sans-serif;
}
.alert-success { background: rgba(214,255,0,0.07);  border: 1px solid var(--yellow); color: var(--yellow); }
.alert-danger  { background: rgba(255,0,134,0.07);  border: 1px solid var(--pink);   color: var(--pink); }
.alert-info    { background: rgba(50,250,230,0.07); border: 1px solid var(--cyan);   color: var(--cyan); }

/* ── Flag Display ──────────────────────────────────────────────────────────── */
.flag {
  font-family: 'JetBrains Mono', monospace;
  font-size: 1.1rem;
  color: var(--yellow);
  background: rgba(214,255,0,0.06);
  border: 1px solid rgba(214,255,0,0.35);
  padding: 0.8rem 1.2rem;
  border-radius: 3px;
  margin-top: 1rem;
  word-break: break-all;
  text-shadow: 0 0 10px rgba(214,255,0,0.55);
}

/* ── Code / Pre ────────────────────────────────────────────────────────────── */
pre, code {
  background: rgba(5, 10, 25, 0.85);
  border: 1px solid #1e3050;
  border-radius: 3px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.85rem;
  color: var(--cyan);
}
pre { padding: 1rem; overflow-x: auto; margin: 1rem 0; }
code { padding: 0.1rem 0.4rem; }

/* ── Terminal ──────────────────────────────────────────────────────────────── */
.terminal {
  background: rgba(0, 5, 15, 0.9);
  border: 1px solid var(--cyan-dim);
  border-radius: 4px;
  padding: 1rem;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.85rem;
  color: var(--cyan);
  margin: 1rem 0;
}
.terminal .prompt::before { content: '$ '; color: var(--cyan-dim); }

/* ── Breadcrumb ────────────────────────────────────────────────────────────── */
.breadcrumb {
  font-size: 0.8rem;
  color: #445566;
  margin-bottom: 1.5rem;
  letter-spacing: 1px;
}
.breadcrumb a { color: var(--cyan); text-decoration: none; }
.breadcrumb a:hover { color: var(--yellow); }
.breadcrumb span { margin: 0 0.5rem; }

/* ── Tags ──────────────────────────────────────────────────────────────────── */
.tag {
  display: inline-block;
  font-family: 'Montserrat', sans-serif;
  font-size: 0.7rem;
  padding: 2px 6px;
  background: rgba(50,250,230,0.07);
  color: var(--cyan);
  border: 1px solid rgba(50,250,230,0.22);
  border-radius: 2px;
  margin-right: 0.3rem;
  letter-spacing: 1px;
}

/* ── Table ─────────────────────────────────────────────────────────────────── */
table {
  width: 100%;
  border-collapse: collapse;
  margin: 1rem 0;
  font-size: 0.9rem;
}
table th {
  background: rgba(10, 20, 55, 0.7);
  font-family: 'Montserrat', sans-serif;
  color: var(--cyan);
  padding: 0.6rem 1rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
  letter-spacing: 1px;
}
table td {
  padding: 0.6rem 1rem;
  border-bottom: 1px solid rgba(30,48,80,0.8);
  color: var(--text);
}
table tr:hover td { background: rgba(50,250,230,0.04); }

/* ── Footer ────────────────────────────────────────────────────────────────── */
footer {
  font-family: 'Poppins', sans-serif;
  text-align: center;
  padding: 2rem;
  color: #2a3a50;
  font-size: 0.75rem;
  letter-spacing: 2px;
  border-top: 1px solid rgba(50,250,230,0.07);
  margin-top: 4rem;
  position: relative;
  z-index: 10;
}
