:root {
  color-scheme: dark;
  --bg: #030815;
  --panel: rgba(9, 18, 34, 0.84);
  --panel-strong: #0b1730;
  --line: rgba(47, 188, 229, 0.22);
  --text: #edf8ff;
  --muted: #93a7b7;
  --green: #ff2aa3;
  --cyan: #2fc7f4;
  --blue: #155fb4;
  --magenta: #ff2aa3;
  --navy: #050b1b;
  --warning: #ffd166;
  --danger: #ff6b6b;
  --shadow: 0 0 42px rgba(255, 42, 163, 0.13), 0 0 24px rgba(47, 199, 244, 0.08);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(rgba(255,42,163,0.032) 1px, transparent 1px),
    linear-gradient(90deg, rgba(47,199,244,0.038) 1px, transparent 1px),
    radial-gradient(circle at 18% 12%, rgba(21,95,180,0.2), transparent 28rem),
    radial-gradient(circle at 82% 3%, rgba(255,42,163,0.18), transparent 24rem),
    var(--bg);
  background-size: 48px 48px, 48px 48px, auto, auto, auto;
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

a { color: inherit; text-decoration: none; }

img { max-width: 100%; display: block; }

.shell { width: min(1180px, calc(100% - 32px)); margin: 0 auto; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  border-bottom: 1px solid var(--line);
  background: rgba(5, 9, 16, 0.88);
  backdrop-filter: blur(18px);
}

.nav {
  min-height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 13px;
  font-weight: 800;
  font-size: 1.08rem;
}

.brand-logo {
  width: 48px;
  height: 48px;
  object-fit: cover;
  object-position: center;
  border: 1px solid rgba(255, 42, 163, 0.48);
  box-shadow: 0 0 22px rgba(255,42,163,0.22), 0 0 12px rgba(47,199,244,0.16);
  background: var(--navy);
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.nav-links a, .chip, button, input, select, textarea {
  border-radius: 6px;
}

.nav-links a {
  padding: 10px 12px;
  color: var(--muted);
  font-size: 0.93rem;
}

.nav-links a:hover, .nav-links a.active { color: var(--text); background: rgba(255,42,163,0.1); }

.nav .menu-button { display: none; }

.hero {
  position: relative;
  min-height: calc(100vh - 72px);
  display: grid;
  align-items: center;
  overflow: hidden;
  border-bottom: 1px solid var(--line);
}

.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 62% 34%, rgba(255,42,163,0.18), transparent 22rem),
    linear-gradient(90deg, rgba(3,8,21,0.96), rgba(3,8,21,0.74) 44%, rgba(3,8,21,0.2)),
    url("../img/cyber-hero.png") center right / cover no-repeat;
  filter: saturate(1.08);
  transform: scale(1.03);
  animation: heroDrift 18s ease-in-out infinite alternate;
}

.hero::after {
  content: "";
  position: absolute;
  inset: auto 0 0;
  height: 160px;
  background: linear-gradient(transparent, var(--bg));
}

.hero-content {
  position: relative;
  z-index: 2;
  width: min(720px, 100%);
  padding: 84px 0 130px;
}

.hero-copy {
  min-width: 0;
  animation: heroCopyIn 900ms ease both;
}

.hero-grid-overlay,
.hero-scan-sweep,
.hero-nodes {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.hero-grid-overlay {
  z-index: 2;
  background:
    linear-gradient(rgba(255, 42, 163, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(47, 199, 244, 0.045) 1px, transparent 1px);
  background-size: 52px 52px;
  mask-image: linear-gradient(90deg, rgba(0,0,0,0.7), rgba(0,0,0,0.1));
  animation: heroGridSlide 14s linear infinite;
}

.hero-scan-sweep {
  z-index: 4;
  width: 22%;
  background: linear-gradient(90deg, transparent, rgba(47, 199, 244, 0.12), transparent);
  transform: skewX(-10deg) translateX(-130%);
  animation: heroScanAcross 5.5s ease-in-out infinite;
  mix-blend-mode: screen;
}

.hero-nodes { z-index: 5; }

.hero-node {
  position: absolute;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--cyan);
  box-shadow: 0 0 18px var(--cyan);
  opacity: 0.8;
  animation: heroNodePulse 2.4s ease-in-out infinite;
}

.hero-node:nth-child(1) { left: 72%; top: 18%; animation-delay: 0s; }
.hero-node:nth-child(2) { left: 84%; top: 28%; animation-delay: 0.35s; }
.hero-node:nth-child(3) { left: 78%; top: 43%; animation-delay: 0.7s; }
.hero-node:nth-child(4) { left: 92%; top: 20%; animation-delay: 1.05s; }
.hero-node:nth-child(5) { left: 69%; top: 61%; animation-delay: 1.4s; }

.hero-hud {
  position: absolute;
  right: clamp(22px, 5vw, 82px);
  top: clamp(100px, 16vh, 160px);
  z-index: 7;
  width: min(420px, 28vw);
  min-height: 210px;
  border: 1px solid rgba(47, 199, 244, 0.28);
  background: rgba(5, 8, 17, 0.42);
  box-shadow: 0 0 42px rgba(47, 199, 244, 0.12);
  backdrop-filter: blur(6px);
  opacity: 0.72;
  pointer-events: none;
  animation: heroHudFloat 5s ease-in-out infinite;
}

.hero-hud::before,
.hero-hud::after {
  content: "";
  position: absolute;
  border: 1px solid rgba(255, 42, 163, 0.5);
}

.hero-hud::before {
  inset: 12px auto auto 12px;
  width: 72px;
  height: 34px;
  border-right: 0;
  border-bottom: 0;
}

.hero-hud::after {
  inset: auto 12px 12px auto;
  width: 96px;
  height: 44px;
  border-left: 0;
  border-top: 0;
}

.eyebrow {
  color: var(--green);
  font-family: "JetBrains Mono", Consolas, monospace;
  font-size: 0.86rem;
  text-transform: uppercase;
}

h1, h2, h3 { margin: 0; line-height: 1.06; }

h1 {
  margin-top: 14px;
  font-size: clamp(3rem, 7vw, 6.7rem);
  max-width: 760px;
}

.tagline {
  margin: 22px 0 0;
  color: var(--magenta);
  font-size: clamp(1.2rem, 2.5vw, 2rem);
  font-weight: 700;
  text-shadow: 0 0 18px rgba(255,42,163,0.42);
}

.lede {
  margin: 18px 0 0;
  color: #c5d3df;
  font-size: 1.08rem;
  line-height: 1.75;
  max-width: 660px;
}

.actions { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 30px; }

.btn {
  border: 1px solid rgba(47,199,244,0.32);
  background: rgba(47,199,244,0.08);
  color: var(--text);
  padding: 12px 16px;
  font-weight: 800;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.hero .actions .btn {
  animation: heroButtonFloat 3.8s ease-in-out infinite;
}

.hero .actions .btn:nth-child(2) { animation-delay: 0.25s; }
.hero .actions .btn:nth-child(3) { animation-delay: 0.5s; }

.btn.primary {
  color: #ffffff;
  border-color: transparent;
  background: linear-gradient(135deg, var(--magenta), #7d3cff 46%, var(--cyan));
  box-shadow: 0 0 26px rgba(255,42,163,0.28);
}

.btn.ghost { background: transparent; }

.section { padding: 72px 0; border-bottom: 1px solid rgba(90,238,255,0.08); }

.section-head {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 24px;
  margin-bottom: 24px;
}

.section-head p { max-width: 620px; color: var(--muted); line-height: 1.7; margin: 10px 0 0; }

.grid { display: grid; gap: 18px; }

.grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.four { grid-template-columns: repeat(4, minmax(0, 1fr)); }

.card, .terminal, .panel {
  border: 1px solid var(--line);
  background: var(--panel);
  box-shadow: var(--shadow);
}

.card {
  padding: 20px;
  min-height: 100%;
  position: relative;
  overflow: hidden;
}

.card::before {
  content: attr(data-accent);
  position: absolute;
  top: 12px;
  right: 14px;
  color: rgba(255,42,163,0.14);
  font-family: "JetBrains Mono", Consolas, monospace;
  font-weight: 900;
  font-size: 2.2rem;
}

.card h3 { font-size: 1.2rem; max-width: 78%; }
.card p { color: var(--muted); line-height: 1.65; }

.meta { display: flex; gap: 8px; flex-wrap: wrap; margin: 14px 0; }

.chip {
  border: 1px solid rgba(47,199,244,0.22);
  background: rgba(47,199,244,0.065);
  color: #bfeef7;
  padding: 6px 9px;
  font-size: 0.78rem;
  font-family: "JetBrains Mono", Consolas, monospace;
}

.chip.green { color: var(--magenta); border-color: rgba(255,42,163,0.38); }
.chip.warn { color: var(--warning); border-color: rgba(255,209,102,0.35); }

.terminal {
  padding: 20px;
  font-family: "JetBrains Mono", Consolas, monospace;
}

.terminal-line { color: var(--green); margin: 0 0 10px; }
.terminal code { color: var(--cyan); overflow-wrap: anywhere; }

.page-hero {
  padding: 72px 0 42px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(13,23,38,0.88), rgba(5,9,16,0));
}

.page-hero h1 { font-size: clamp(2.4rem, 5vw, 4.7rem); }

.toolbar {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin: 0 0 24px;
}

.toolbar input, .toolbar select, .auth-card input, .auth-card textarea, .admin-form input, .admin-form select, .admin-form textarea {
  border: 1px solid var(--line);
  background: rgba(5, 9, 16, 0.8);
  color: var(--text);
  padding: 12px 13px;
  min-height: 44px;
}

.toolbar input { flex: 1 1 260px; }

.learning-layout, .dashboard-layout {
  display: grid;
  grid-template-columns: 300px 1fr;
  gap: 20px;
  align-items: start;
}

.sidebar { padding: 16px; position: sticky; top: 92px; }

.module {
  display: block;
  width: 100%;
  text-align: left;
  border: 1px solid rgba(47,199,244,0.18);
  background: rgba(47,199,244,0.055);
  color: var(--text);
  padding: 12px;
  margin-bottom: 10px;
  cursor: pointer;
}

.module.done { border-color: rgba(255,42,163,0.42); color: var(--magenta); }

.progress {
  height: 10px;
  background: rgba(255,255,255,0.08);
  overflow: hidden;
  margin: 14px 0;
}

.progress span {
  display: block;
  height: 100%;
  width: var(--progress, 0%);
  background: linear-gradient(90deg, var(--magenta), var(--cyan));
}

.auth-wrap {
  min-height: calc(100vh - 72px);
  display: grid;
  place-items: center;
  padding: 48px 0;
}

.auth-card {
  width: min(500px, 100%);
  padding: 28px;
}

.auth-card form, .admin-form { display: grid; gap: 12px; }

.notice {
  display: none;
  border: 1px solid rgba(255,42,163,0.35);
  background: rgba(255,42,163,0.08);
  color: #c8ffdf;
  padding: 12px;
  margin-top: 14px;
}

.notice.show { display: block; }

.stat {
  padding: 20px;
  background: linear-gradient(135deg, rgba(47,199,244,0.08), rgba(255,42,163,0.065));
  border: 1px solid var(--line);
}

.stat strong { display: block; font-size: 2rem; color: var(--cyan); }

.admin-tabs { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 18px; }

.table {
  width: 100%;
  border-collapse: collapse;
  overflow: hidden;
}

.table th, .table td {
  border-bottom: 1px solid rgba(90,238,255,0.12);
  padding: 12px;
  text-align: left;
  color: #c9d7e4;
}

.table th { color: var(--cyan); font-family: "JetBrains Mono", Consolas, monospace; font-size: 0.82rem; }

.toc {
  display: grid;
  gap: 8px;
  padding-left: 20px;
  color: var(--cyan);
}

.footer {
  padding: 34px 0;
  color: var(--muted);
}

.footer .shell {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  flex-wrap: wrap;
}

@keyframes heroDrift {
  from { transform: scale(1.03) translateX(0); }
  to { transform: scale(1.06) translateX(-18px); }
}

@keyframes heroGridSlide {
  from { background-position: 0 0; }
  to { background-position: 104px 52px; }
}

@keyframes heroScanAcross {
  0%, 18% { transform: skewX(-10deg) translateX(-130%); opacity: 0; }
  35% { opacity: 1; }
  78%, 100% { transform: skewX(-10deg) translateX(560%); opacity: 0; }
}

@keyframes heroNodePulse {
  0%, 100% { transform: scale(0.7); opacity: 0.38; }
  50% { transform: scale(1.35); opacity: 0.95; }
}

@keyframes heroCopyIn {
  from { opacity: 0; transform: translateY(18px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes heroButtonFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-3px); }
}

@keyframes heroHudFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(12px); }
}

@media (max-width: 900px) {
  .nav .menu-button { display: inline-flex; }
  .nav { align-items: flex-start; padding: 16px 0; }
  .nav-links { display: none; width: 100%; justify-content: flex-start; }
  .nav.open { flex-wrap: wrap; }
  .nav.open .nav-links { display: flex; }
  .grid.three, .grid.two, .grid.four, .learning-layout, .dashboard-layout { grid-template-columns: 1fr; }
  .sidebar { position: static; }
  .hero { min-height: auto; }
  .hero::before { background: radial-gradient(circle at 50% 22%, rgba(255,42,163,0.2), transparent 20rem), linear-gradient(rgba(3,8,21,0.86), rgba(3,8,21,0.95)), url("../img/cyber-hero.png") center / cover no-repeat; }
  .hero-content {
    padding: 72px 0 110px;
  }
  .hero-hud { display: none; }
}

@media (max-width: 560px) {
  .shell { width: min(100% - 22px, 1180px); }
  .actions .btn { width: 100%; justify-content: center; }
  .section { padding: 48px 0; }
  .section-head { align-items: flex-start; flex-direction: column; }
  .table { font-size: 0.86rem; }
}
